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

Re: [PATCH v2 11/17] xen: Add capabilities to get_domain_state


  • To: Juergen Gross <jgross@xxxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jason Andryuk <jason.andryuk@xxxxxxx>
  • Date: Thu, 17 Jul 2025 16:16:36 -0400
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=suse.com 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=7zyvjFcATpZv3Jfvj6QCtALUjPUjkOZPlRV/F7yhsQ8=; b=IS5TIBXyoOsmK1QSQ9xoiucJbVXLRhYrqhLMOWQb9FA6EVL+Rx/b6EDRx5XqoIvxINLUlBG3nvN0gDbhTLyR7GrlD4PtLCxdBZvkZ/7qanTNmN+WHpxcWvjhZVXPWoC5N1xkEJHT4MoyZnRdLyOCnXUioonhoOoVtc0EF0ythtTExDyRyaamwvI5kRKITvUBGMNCsmI9XiutLlXTf+R8ppziQGv0Zb5eXXfHIOWS30yE8A6TyJSVotmI/kcqm4F75WdNulOqDT2+OSfXmmSLgKpNinyBqrIgTRQsNq5T1hRyRFb76+NT9dhHAXurjBb/+MmIIPoPdfvh3KM85mSEdg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=pVN0dp9pAasriA2PsmiVcb8mW4VC8ju74vlY65KJ7f7v28nBo5UVwYqlJdrJMXXSBLGyf8eqYij7K5ajCKTbdTWPz5YvDBdMUddf5CcVhepUvezR1RPcbvZ0d3SUR9ldDcQf2GK4TdCweoKaqyujMMWzZDJCr8VYZLFcU8Asym16oy1OU17FcGdDNPo4MQEHuwY/krSlGejhf5imtOX+tNkBJA9m5uR25xyh/f3bK/W8Ou6lRysDPQVqFlFBpLmuid3yd+KDhgy6j9capWrq+aD4GwB2+pQWo9gAG7wR8ozAoUe0erUEaikJ/uoTOxgky7Y5CfEr/LsGIqJ7xa40xA==
  • 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>
  • Delivery-date: Thu, 17 Jul 2025 20:16:52 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 2025-07-17 02:24, Juergen Gross wrote:
On 16.07.25 23:14, 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>
---
  xen/common/domain.c         | 8 +++++++-
  xen/include/public/domctl.h | 7 +++++--
  2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/xen/common/domain.c b/xen/common/domain.c
index c347de4335..8b0151a8f7 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -195,6 +195,12 @@ static void set_domain_state_info(struct xen_domctl_get_domain_state *info,
          info->state |= XEN_DOMCTL_GETDOMSTATE_STATE_DYING;
      if ( d->is_dying == DOMDYING_dead )
          info->state |= XEN_DOMCTL_GETDOMSTATE_STATE_DEAD;

I'll add:

+
+    info->caps = 0

here, to ensure all the caps bits start off cleared.

+    if ( is_control_domain(d) )
+        info->caps |= XEN_DOMCTL_GETDOMSTATE_CAP_CONTROL;
+    if ( is_hardware_domain(d) )
+        info->caps |= XEN_DOMCTL_GETDOMSTATE_CAP_HARDWARE;
+    if ( is_xenstore_domain(d) )
+        info->caps |= XEN_DOMCTL_GETDOMSTATE_CAP_XENSTORE;
      info->unique_id = d->unique_id;
  }

diff --git a/xen/include/public/domctl.h b/xen/include/public/domctl.h
index f1f6f96bc2..879343b21d 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;           /* Must be 0 on input, returned as 0. */

I'd drop the "returned as 0" in the comment. :-)

:)

I'll drop the whole comment since the input value is not checked.

With that fixed:

Reviewed-by: Juergen Gross <jgross@xxxxxxxx>

Does this stand with the above changes?

Thanks,
Jason



 


Rackspace

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