[PATCH v4 24/24] xen: move MGMT_HYPERCALLS out of PV_SHIM_EXCLUSIVE

Penny Zheng posted 24 patches 3 weeks, 1 day ago
There is a newer version of this series
[PATCH v4 24/24] xen: move MGMT_HYPERCALLS out of PV_SHIM_EXCLUSIVE
Posted by Penny Zheng 3 weeks, 1 day ago
As we're aiming at moving away from PV_SHIM_EXCLUSIVE=y, we are
moving MGMT_HYPERCALLS out of it.

Signed-off-by: Penny Zheng <Penny.Zheng@amd.com>
---
v3 -> v4:
- new commit
---
 xen/arch/x86/Makefile             |  2 +-
 xen/arch/x86/hvm/Kconfig          |  1 -
 xen/arch/x86/include/asm/paging.h |  2 +-
 xen/common/Kconfig                |  1 -
 xen/common/Makefile               |  5 +----
 xen/include/hypercall-defs.c      | 10 ++--------
 xen/include/xen/domain.h          |  4 ----
 7 files changed, 5 insertions(+), 20 deletions(-)

diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile
index 006a6e56d3..3aea179838 100644
--- a/xen/arch/x86/Makefile
+++ b/xen/arch/x86/Makefile
@@ -30,6 +30,7 @@ obj-bin-y += dmi_scan.init.o
 obj-y += domain.o
 obj-bin-y += dom0_build.init.o
 obj-y += domain_page.o
+obj-$(CONFIG_MGMT_HYPERCALLS) += domctl.o
 obj-y += e820.o
 obj-y += emul-i8254.o
 obj-y += extable.o
@@ -79,7 +80,6 @@ obj-$(CONFIG_VM_EVENT) += vm_event.o
 obj-y += xstate.o
 
 ifneq ($(CONFIG_PV_SHIM_EXCLUSIVE),y)
-obj-$(CONFIG_MGMT_HYPERCALLS) += domctl.o
 obj-y += platform_hypercall.o
 obj-$(CONFIG_COMPAT) += x86_64/platform_hypercall.o
 endif
diff --git a/xen/arch/x86/hvm/Kconfig b/xen/arch/x86/hvm/Kconfig
index 52b22e5d17..3351afc5a1 100644
--- a/xen/arch/x86/hvm/Kconfig
+++ b/xen/arch/x86/hvm/Kconfig
@@ -1,6 +1,5 @@
 menuconfig HVM
 	bool "HVM support"
-	depends on !PV_SHIM_EXCLUSIVE
 	default !PV_SHIM
 	select COMPAT
 	select IOREQ_SERVER
diff --git a/xen/arch/x86/include/asm/paging.h b/xen/arch/x86/include/asm/paging.h
index ba5ba7324e..db3e5b8f31 100644
--- a/xen/arch/x86/include/asm/paging.h
+++ b/xen/arch/x86/include/asm/paging.h
@@ -55,7 +55,7 @@
 #define PG_translate   0
 #define PG_external    0
 #endif
-#if defined(CONFIG_PAGING) && !defined(CONFIG_PV_SHIM_EXCLUSIVE) && defined(CONFIG_MGMT_HYPERCALLS)
+#if defined(CONFIG_PAGING) && defined(CONFIG_MGMT_HYPERCALLS)
 /* Enable log dirty mode */
 #define PG_log_dirty   (XEN_DOMCTL_SHADOW_ENABLE_LOG_DIRTY << PG_mode_shift)
 #else
diff --git a/xen/common/Kconfig b/xen/common/Kconfig
index 5aecb88680..d396ac94ab 100644
--- a/xen/common/Kconfig
+++ b/xen/common/Kconfig
@@ -653,7 +653,6 @@ menu "Supported hypercall interfaces"
 
 config MGMT_HYPERCALLS
 	bool "Enable privileged hypercalls for system management"
-	depends on !PV_SHIM_EXCLUSIVE
 	help
 	  Management hypercalls provide the means for dom0 to manage the
 	  overall Xen system and other domains, including sysctl, domctl, etc.
diff --git a/xen/common/Makefile b/xen/common/Makefile
index e0afc89591..45c0bda000 100644
--- a/xen/common/Makefile
+++ b/xen/common/Makefile
@@ -11,6 +11,7 @@ obj-$(filter-out $(CONFIG_X86),$(CONFIG_ACPI)) += device.o
 obj-$(CONFIG_DEVICE_TREE_PARSE) += device-tree/
 obj-$(CONFIG_IOREQ_SERVER) += dm.o
 obj-y += domain.o
+obj-$(CONFIG_MGMT_HYPERCALLS) += domctl.o
 obj-y += domid.o
 obj-y += event_2l.o
 obj-y += event_channel.o
@@ -70,10 +71,6 @@ obj-bin-$(CONFIG_X86) += $(foreach n,decompress bunzip2 unxz unlzma lzo unlzo un
 
 obj-$(CONFIG_COMPAT) += $(addprefix compat/,domain.o memory.o multicall.o xlat.o)
 
-ifneq ($(CONFIG_PV_SHIM_EXCLUSIVE),y)
-obj-$(CONFIG_MGMT_HYPERCALLS) += domctl.o
-endif
-
 extra-y := symbols-dummy.o
 
 obj-$(CONFIG_COVERAGE) += coverage/
diff --git a/xen/include/hypercall-defs.c b/xen/include/hypercall-defs.c
index 5343fd7a6f..ae56383bf7 100644
--- a/xen/include/hypercall-defs.c
+++ b/xen/include/hypercall-defs.c
@@ -196,13 +196,11 @@ dm_op(domid_t domid, unsigned int nr_bufs, xen_dm_op_buf_t *bufs)
 #endif
 #ifdef CONFIG_MGMT_HYPERCALLS
 sysctl(xen_sysctl_t *u_sysctl)
-#if defined(CONFIG_X86) && defined(CONFIG_PAGING) && !defined(CONFIG_PV_SHIM_EXCLUSIVE)
+#if defined(CONFIG_X86) && defined(CONFIG_PAGING)
 paging_domctl_cont(xen_domctl_t *u_domctl)
 #endif
-#ifndef CONFIG_PV_SHIM_EXCLUSIVE
 domctl(xen_domctl_t *u_domctl)
 #endif
-#endif
 #ifndef CONFIG_PV_SHIM_EXCLUSIVE
 platform_op(xen_platform_op_t *u_xenpf_op)
 #endif
@@ -281,10 +279,8 @@ hvm_op                             do       do       do       do       do
 #endif
 #ifdef CONFIG_MGMT_HYPERCALLS
 sysctl                             do       do       do       do       do
-#ifndef CONFIG_PV_SHIM_EXCLUSIVE
 domctl                             do       do       do       do       do
 #endif
-#endif
 #ifdef CONFIG_KEXEC
 kexec_op                           compat   do       -        -        -
 #endif
@@ -300,10 +296,8 @@ dm_op                              compat   do       compat   do       do
 hypfs_op                           do       do       do       do       do
 #endif
 mca                                do       do       -        -        -
-#if defined(CONFIG_X86) && defined(CONFIG_PAGING) && !defined(CONFIG_PV_SHIM_EXCLUSIVE)
-#ifdef CONFIG_MGMT_HYPERCALLS
+#if defined(CONFIG_X86) && defined(CONFIG_PAGING) && defined(CONFIG_MGMT_HYPERCALLS)
 paging_domctl_cont                 do       do       do       do       -
 #endif
-#endif
 
 #endif /* !CPPCHECK */
diff --git a/xen/include/xen/domain.h b/xen/include/xen/domain.h
index aa86a9f460..6d8cb9690c 100644
--- a/xen/include/xen/domain.h
+++ b/xen/include/xen/domain.h
@@ -185,11 +185,7 @@ struct vnuma_info {
     struct xen_vmemrange *vmemrange;
 };
 
-#ifndef CONFIG_PV_SHIM_EXCLUSIVE
 void vnuma_destroy(struct vnuma_info *vnuma);
-#else
-static inline void vnuma_destroy(struct vnuma_info *vnuma) { ASSERT(!vnuma); }
-#endif
 
 #ifdef CONFIG_VMTRACE
 extern bool vmtrace_available;
-- 
2.34.1
Re: [PATCH v4 24/24] xen: move MGMT_HYPERCALLS out of PV_SHIM_EXCLUSIVE
Posted by Jan Beulich 2 weeks, 3 days ago
On 21.11.2025 11:58, Penny Zheng wrote:
> As we're aiming at moving away from PV_SHIM_EXCLUSIVE=y, we are
> moving MGMT_HYPERCALLS out of it.

How are we "moving away from PV_SHIM_EXCLUSIVE=y"? It's the "depends on
!PV_SHIM_EXCLUSIVE" (and related Makefile constructs) which we decided to
get rid of.

> --- a/xen/arch/x86/Makefile
> +++ b/xen/arch/x86/Makefile
> @@ -30,6 +30,7 @@ obj-bin-y += dmi_scan.init.o
>  obj-y += domain.o
>  obj-bin-y += dom0_build.init.o
>  obj-y += domain_page.o
> +obj-$(CONFIG_MGMT_HYPERCALLS) += domctl.o
>  obj-y += e820.o
>  obj-y += emul-i8254.o
>  obj-y += extable.o
> @@ -79,7 +80,6 @@ obj-$(CONFIG_VM_EVENT) += vm_event.o
>  obj-y += xstate.o
>  
>  ifneq ($(CONFIG_PV_SHIM_EXCLUSIVE),y)
> -obj-$(CONFIG_MGMT_HYPERCALLS) += domctl.o
>  obj-y += platform_hypercall.o
>  obj-$(CONFIG_COMPAT) += x86_64/platform_hypercall.o
>  endif

A change like this fits under the subject.

> --- a/xen/arch/x86/hvm/Kconfig
> +++ b/xen/arch/x86/hvm/Kconfig
> @@ -1,6 +1,5 @@
>  menuconfig HVM
>  	bool "HVM support"
> -	depends on !PV_SHIM_EXCLUSIVE
>  	default !PV_SHIM
>  	select COMPAT
>  	select IOREQ_SERVER

This, however, is entirely unrelated afaics.

> --- a/xen/arch/x86/include/asm/paging.h
> +++ b/xen/arch/x86/include/asm/paging.h
> @@ -55,7 +55,7 @@
>  #define PG_translate   0
>  #define PG_external    0
>  #endif
> -#if defined(CONFIG_PAGING) && !defined(CONFIG_PV_SHIM_EXCLUSIVE) && defined(CONFIG_MGMT_HYPERCALLS)
> +#if defined(CONFIG_PAGING) && defined(CONFIG_MGMT_HYPERCALLS)
>  /* Enable log dirty mode */
>  #define PG_log_dirty   (XEN_DOMCTL_SHADOW_ENABLE_LOG_DIRTY << PG_mode_shift)
>  #else

Whereas this could fit here if the subject was e.g. "decouple PV_SHIM_EXCLUSIVE and
MGMT_HYPERCALLS".

Further, because of prior issue: Can you please clarify that you have tried builds
with all (possible) combinations of the involved Kconfig settings? The set isn't
that big, so exhaustive testing is possible.

Jan
RE: [PATCH v4 24/24] xen: move MGMT_HYPERCALLS out of PV_SHIM_EXCLUSIVE
Posted by Penny, Zheng 1 week, 2 days ago
[Public]

> -----Original Message-----
> From: Jan Beulich <jbeulich@suse.com>
> Sent: Wednesday, November 26, 2025 5:34 PM
> To: Penny, Zheng <penny.zheng@amd.com>
> Cc: Huang, Ray <Ray.Huang@amd.com>; grygorii_strashko@epam.com; Andrew
> Cooper <andrew.cooper3@citrix.com>; Roger Pau Monné <roger.pau@citrix.com>;
> Anthony PERARD <anthony.perard@vates.tech>; Orzel, Michal
> <Michal.Orzel@amd.com>; Julien Grall <julien@xen.org>; Stefano Stabellini
> <sstabellini@kernel.org>; xen-devel@lists.xenproject.org
> Subject: Re: [PATCH v4 24/24] xen: move MGMT_HYPERCALLS out of
> PV_SHIM_EXCLUSIVE
>
> Further, because of prior issue: Can you please clarify that you have tried builds
> with all (possible) combinations of the involved Kconfig settings? The set isn't that
> big, so exhaustive testing is possible.

In case I omits anything:
I'll test the following four scenario, (turning on all other possible kconfigs at the same time):
1) MGMT_HYPERCALLS=y && PV_SHIM_EXCLUSIVE=y
2) MGMT_HYPERCALLS=n && PV_SHIM_EXCLUSIVE=y
3) MGMT_HYPERCALLS=y && PV_SHIM_EXCLUSIVE=n
4) MGMT_HYPERCALLS=n && PV_SHIM_EXCLUSIVE=n

>
> Jan
Re: [PATCH v4 24/24] xen: move MGMT_HYPERCALLS out of PV_SHIM_EXCLUSIVE
Posted by Jan Beulich 1 week, 2 days ago
On 04.12.2025 10:20, Penny, Zheng wrote:
>> -----Original Message-----
>> From: Jan Beulich <jbeulich@suse.com>
>> Sent: Wednesday, November 26, 2025 5:34 PM
>>
>> Further, because of prior issue: Can you please clarify that you have tried builds
>> with all (possible) combinations of the involved Kconfig settings? The set isn't that
>> big, so exhaustive testing is possible.
> 
> In case I omits anything:
> I'll test the following four scenario, (turning on all other possible kconfigs at the same time):
> 1) MGMT_HYPERCALLS=y && PV_SHIM_EXCLUSIVE=y
> 2) MGMT_HYPERCALLS=n && PV_SHIM_EXCLUSIVE=y
> 3) MGMT_HYPERCALLS=y && PV_SHIM_EXCLUSIVE=n
> 4) MGMT_HYPERCALLS=n && PV_SHIM_EXCLUSIVE=n

Judging from this patch alone, at least PAGING also looks to be in need of
testing both ways (indirectly, as it can't be controlled directly).

Jan