[PATCH v2 09/26] xen/domctl: wrap domain_resume() with CONFIG_MGMT_HYPERCALLS

Penny Zheng posted 26 patches 3 days, 22 hours ago
[PATCH v2 09/26] xen/domctl: wrap domain_resume() with CONFIG_MGMT_HYPERCALLS
Posted by Penny Zheng 3 days, 22 hours ago
One usage of function domain_resume() is in domain resume domctl-op, and
the other is in domain_soft_reset(), which is already guarded with
CONFIG_MGMT_HYPERCALLS.
So we could wrap domain_soft_reset() with CONFIG_MGMT_HYPERCALLS.

Wrap XEN_DOMCTL_resumedomain-case 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:
- new commit
---
 xen/common/domain.c | 2 ++
 xen/common/domctl.c | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/xen/common/domain.c b/xen/common/domain.c
index 678e81b400..34e2e501dc 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -1351,6 +1351,7 @@ int domain_shutdown(struct domain *d, u8 reason)
     return 0;
 }
 
+#ifdef CONFIG_MGMT_HYPERCALLS
 void domain_resume(struct domain *d)
 {
     struct vcpu *v;
@@ -1377,6 +1378,7 @@ void domain_resume(struct domain *d)
 
     domain_unpause(d);
 }
+#endif /* CONFIG_MGMT_HYPERCALLS */
 
 int vcpu_start_shutdown_deferral(struct vcpu *v)
 {
diff --git a/xen/common/domctl.c b/xen/common/domctl.c
index 1c0bfd456e..278a00b141 100644
--- a/xen/common/domctl.c
+++ b/xen/common/domctl.c
@@ -402,12 +402,14 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl)
         ret = domain_unpause_by_systemcontroller(d);
         break;
 
+#ifdef CONFIG_MGMT_HYPERCALLS
     case XEN_DOMCTL_resumedomain:
         if ( d == current->domain ) /* no domain_pause() */
             ret = -EINVAL;
         else
             domain_resume(d);
         break;
+#endif /* CONFIG_MGMT_HYPERCALLS */
 
     case XEN_DOMCTL_createdomain:
     {
-- 
2.34.1
Re: [PATCH v2 09/26] xen/domctl: wrap domain_resume() with CONFIG_MGMT_HYPERCALLS
Posted by Stefano Stabellini 3 days, 4 hours ago
On Wed, 10 Sep 2025, Penny Zheng wrote:
> One usage of function domain_resume() is in domain resume domctl-op, and
> the other is in domain_soft_reset(), which is already guarded with
> CONFIG_MGMT_HYPERCALLS.
> So we could wrap domain_soft_reset() with CONFIG_MGMT_HYPERCALLS.
> 
> Wrap XEN_DOMCTL_resumedomain-case 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>