[PATCH v2 11/26] xen/domctl: wrap domain_set_node_affinity() with CONFIG_MGMT_HYPERCALLS

Penny Zheng posted 26 patches 3 days, 22 hours ago
[PATCH v2 11/26] xen/domctl: wrap domain_set_node_affinity() with CONFIG_MGMT_HYPERCALLS
Posted by Penny Zheng 3 days, 22 hours ago
Function domain_set_node_affinity() is responsible for
XEN_DOMCTL_setnodeaffinity domctl-op, and shall be wrapped with
CONFIG_MGMT_HYPERCALLS
Wrap XEN_DOMCTL_setnodeaffinity-case and xenctl_bitmap_to_nodemask()
transiently with CONFIG_MGMT_HYPERCALLS, and it will be removed when
introducing CONFIG_MGMT_HYPERCALLS on the common/domctl.c in the last.

Signed-off-by: Penny Zheng <Penny.Zheng@amd.com>
---
v1 -> v2:
- adapt to changes of "unify DOMCTL to MGMT_HYPERCALLS"
- wrap XEN_DOMCTL_setnodeaffinity-case and xenctl_bitmap_to_nodemask()
transiently
---
 xen/common/domain.c | 2 ++
 xen/common/domctl.c | 4 +++-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/xen/common/domain.c b/xen/common/domain.c
index 5d81ab3045..6778dc388c 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -1105,6 +1105,7 @@ void __init setup_system_domains(void)
 #endif
 }
 
+#ifdef CONFIG_MGMT_HYPERCALLS
 int domain_set_node_affinity(struct domain *d, const nodemask_t *affinity)
 {
     /* Being disjoint with the system is just wrong. */
@@ -1133,6 +1134,7 @@ out:
 
     return 0;
 }
+#endif /* CONFIG_MGMT_HYPERCALLS */
 
 /* rcu_read_lock(&domlist_read_lock) must be held. */
 static struct domain *domid_to_domain(domid_t dom)
diff --git a/xen/common/domctl.c b/xen/common/domctl.c
index 0f20e8941b..fb6fe90888 100644
--- a/xen/common/domctl.c
+++ b/xen/common/domctl.c
@@ -44,12 +44,14 @@ static int nodemask_to_xenctl_bitmap(struct xenctl_bitmap *xenctl_nodemap,
                                    MAX_NUMNODES);
 }
 
+#ifdef CONFIG_MGMT_HYPERCALLS
 static int xenctl_bitmap_to_nodemask(nodemask_t *nodemask,
                                      const struct xenctl_bitmap *xenctl_nodemap)
 {
     return xenctl_bitmap_to_bitmap(nodemask_bits(nodemask), xenctl_nodemap,
                                    MAX_NUMNODES);
 }
+#endif /* CONFIG_MGMT_HYPERCALLS */
 
 void getdomaininfo(struct domain *d, struct xen_domctl_getdomaininfo *info)
 {
@@ -495,7 +497,6 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl)
             ret = hypercall_create_continuation(
                 __HYPERVISOR_domctl, "h", u_domctl);
         break;
-#endif /* CONFIG_MGMT_HYPERCALLS */
 
     case XEN_DOMCTL_setnodeaffinity:
     {
@@ -507,6 +508,7 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl)
             ret = domain_set_node_affinity(d, &new_affinity);
         break;
     }
+#endif /* CONFIG_MGMT_HYPERCALLS */
 
     case XEN_DOMCTL_getnodeaffinity:
         ret = nodemask_to_xenctl_bitmap(&op->u.nodeaffinity.nodemap,
-- 
2.34.1
Re: [PATCH v2 11/26] xen/domctl: wrap domain_set_node_affinity() with CONFIG_MGMT_HYPERCALLS
Posted by Stefano Stabellini 3 days, 4 hours ago
On Wed, 10 Sep 2025, Penny Zheng wrote:
> Function domain_set_node_affinity() is responsible for
> XEN_DOMCTL_setnodeaffinity domctl-op, and shall be wrapped with
> CONFIG_MGMT_HYPERCALLS
> Wrap XEN_DOMCTL_setnodeaffinity-case and xenctl_bitmap_to_nodemask()
> transiently with CONFIG_MGMT_HYPERCALLS, and it will be removed when
> introducing CONFIG_MGMT_HYPERCALLS on the common/domctl.c in the last.
> 
> Signed-off-by: Penny Zheng <Penny.Zheng@amd.com>

Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>