[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v3 1/2] xen: Add capabilities to get_domain_state


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jason Andryuk <jason.andryuk@xxxxxxx>
  • Date: Tue, 22 Jul 2025 08:09:42 -0400
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=rYOOPYe75bzyjMben7td9EgcJZLTONVUqCdKjO62jUI=; b=d7WSsF0sRBUxtc/feSvxg0+znLkisYZVzpH/aCOGZfG+wNk88/5DfALCkxNJHNV7LsgwTCPl13UsYKr1CKdZja/yADhsfbucvtGISATDYQ1eKKA9RazRUfRzJRTqLxFbUfH+nI3J9DvdJPzgn5u+ztp6sEYrSVMBRHZv9Ol2at6TQRRkXDY/U5+uMLYpUdlx2mmpQgzJZ1KI5QdUj7jbmCnx+oEN0LYGEElHQEMVDwYoJFpchvAww3/II51adPCSJhRlBU18UIASwiV9NiEGOd3/zvVmrAwrr2ikTfqq+Ep17r0CUlLSrZu9xjyXeyrf20pJL3PepcxNR9mZkjd5Nw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Y1P1kztIE8RBZYGJnavNgwqgg/PFOKKrQWFCyy3IscK3dU0ZB/fDj866voUdZvOHolXRcAyu3Z08FvIAMaQZRoN1FZslzmbgLX167ic3OfjUaGox3KQ8i8a2Ql8Ewx1b1XsBFa8JFYG1t1t/gJhGY+XAsymU2jwhL2lP+A4L+76rSiu7dZrUo24ZSOdEJqpvtyG77vIKdGPrvHOuo9AiXSMVcTnsrx+/kMF1sjIfL/gM09Njz+PPgsIITUNqyKIf9f3ylagSV4FKuTzhkHuCk1OC7YvQMhLHJ+xrqOyW3PfPuP5ZvfspKMCdIOUr26K4uiwcMfZ8pbB/0nTFadG74g==
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Julien Grall <julien@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>
  • Delivery-date: Wed, 23 Jul 2025 00:20:05 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 2025-07-21 20:19, Jason Andryuk wrote:
Expose a domain's capabilities - control, hardware or xenstore - through
stable get domain state hypercall.

The xenstore domain can use this information to assign appropriate
permissions on connections.

Repurpose the 16bit pad field for this purpose.

Signed-off-by: Jason Andryuk <jason.andryuk@xxxxxxx>
Reviewed-by: Juergen Gross <jgross@xxxxxxxx>
---
v2:
Init info->caps = 0
Remove stale comment on caps field
Add Juergen's R-b
---
  xen/common/domain.c         | 10 +++++++++-
  xen/include/public/domctl.h |  7 +++++--
  2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/xen/common/domain.c b/xen/common/domain.c
index c347de4335..bb33b1f1c7 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c

diff --git a/xen/include/public/domctl.h b/xen/include/public/domctl.h
index f1f6f96bc2..136820ea5b 100644
--- a/xen/include/public/domctl.h
+++ b/xen/include/public/domctl.h
@@ -1269,8 +1269,11 @@ struct xen_domctl_get_domain_state {
  #define XEN_DOMCTL_GETDOMSTATE_STATE_SHUTDOWN  0x0002  /* Shutdown finished. 
*/
  #define XEN_DOMCTL_GETDOMSTATE_STATE_DYING     0x0004  /* Domain dying. */
  #define XEN_DOMCTL_GETDOMSTATE_STATE_DEAD      0x0008  /* Domain dead. */
-    uint16_t pad0;           /* Must be 0 on input, returned as 0. */
-    uint32_t pad1;           /* Must be 0 on input, returned as 0. */
+    uint16_t caps;
+#define XEN_DOMCTL_GETDOMSTATE_CAP_CONTROL     0x0001  /* Control domain. */
+#define XEN_DOMCTL_GETDOMSTATE_CAP_HARDWARE    0x0002  /* Hardware domain. */
+#define XEN_DOMCTL_GETDOMSTATE_CAP_XENSTORE    0x0004  /* Xenstore domain. */
+    uint32_t pad0;           /* Must be 0 on input, returned as 0. */

I have wondered if we should use some of this padding to start returning the valid capability bits. When the hypercall (and library) will be ready in case the number increases.

The other alternative would be to return the bits in some other call, in which case this one would not need to change. And returning the unchanging valids bits on each call seems unnecessary.

Regards,
Jason

      uint64_t unique_id;      /* Unique domain identifier. */
  };




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.