[PATCH v5 24/24] xen: decouple PV_SHIM_EXCLUSIVE and MGMT_HYPERCALLS

Penny Zheng posted 24 patches 2 days, 1 hour ago
[PATCH v5 24/24] xen: decouple PV_SHIM_EXCLUSIVE and MGMT_HYPERCALLS
Posted by Penny Zheng 2 days, 1 hour ago
We try to decouple PV_SHIM_EXCLUSIVE and MGMT_HYPERCALLS, including getting
rid of "depends on !PV_SHIM_EXCLUSIVE" (and related Makefile constructs)
regarding features guarded under MGMT_HYPERCALLS.
There is little possibility that random config may pick MGMT_HYPERCALLS=y
and PV_SHIM_EXCLUSIVE=y, so we need to add !defined(CONFIG_PV_SHIM_EXCLUSIVE)
constriction on paging_domctl() under XEN_DOMCTL_shadow_op-case to avoid
undefined error.

Signed-off-by: Penny Zheng <Penny.Zheng@amd.com>
---
v3 -> v4:
- new commit
---
v4 -> v5:
- Remove unrelated changes on CONFIG_HVM
- add !defined(CONFIG_PV_SHIM_EXCLUSIVE) constriction on paging_domctl() under
XEN_DOMCTL_shadow_op-case
- refine title and commit message
---
 xen/arch/x86/Makefile        | 2 +-
 xen/arch/x86/domctl.c        | 2 +-
 xen/common/Kconfig           | 1 -
 xen/common/Makefile          | 4 +---
 xen/include/hypercall-defs.c | 4 ----
 xen/include/xen/domain.h     | 4 ----
 6 files changed, 3 insertions(+), 14 deletions(-)

diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile
index d389787bb3..03650049ce 100644
--- a/xen/arch/x86/Makefile
+++ b/xen/arch/x86/Makefile
@@ -31,6 +31,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
@@ -80,7 +81,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/domctl.c b/xen/arch/x86/domctl.c
index 6153e3c07e..235fd3b60f 100644
--- a/xen/arch/x86/domctl.c
+++ b/xen/arch/x86/domctl.c
@@ -216,7 +216,7 @@ long arch_do_domctl(
     {
 
     case XEN_DOMCTL_shadow_op:
-#ifdef CONFIG_PAGING
+#if defined(CONFIG_PAGING) && !defined(CONFIG_PV_SHIM_EXCLUSIVE)
         ret = paging_domctl(d, &domctl->u.shadow_op, u_domctl, 0);
         if ( ret == -ERESTART )
             return hypercall_create_continuation(
diff --git a/xen/common/Kconfig b/xen/common/Kconfig
index d59e108652..f57a5f00a3 100644
--- a/xen/common/Kconfig
+++ b/xen/common/Kconfig
@@ -654,7 +654,6 @@ menu "Supported hypercall interfaces"
 
 config MGMT_HYPERCALLS
 	bool "Enable privileged hypercalls for system management"
-	depends on !PV_SHIM_EXCLUSIVE
 	default y
 	help
 	  Management hypercalls provide the means for dom0 to manage the
diff --git a/xen/common/Makefile b/xen/common/Makefile
index 9f59f141a8..a0b0705f72 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,9 +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
 
 obj-$(CONFIG_COVERAGE) += coverage/
 obj-y += sched/
diff --git a/xen/include/hypercall-defs.c b/xen/include/hypercall-defs.c
index c9ee5de99e..e7209f8b63 100644
--- a/xen/include/hypercall-defs.c
+++ b/xen/include/hypercall-defs.c
@@ -199,10 +199,8 @@ sysctl(xen_sysctl_t *u_sysctl)
 #if defined(CONFIG_X86) && defined(CONFIG_PAGING) && !defined(CONFIG_PV_SHIM_EXCLUSIVE)
 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
@@ -284,10 +282,8 @@ sysctl                             do       do       do       do       do
 #if defined(CONFIG_X86) && defined(CONFIG_PAGING) && !defined(CONFIG_PV_SHIM_EXCLUSIVE)
 paging_domctl_cont                 do       do       do       do       -
 #endif
-#ifndef CONFIG_PV_SHIM_EXCLUSIVE
 domctl                             do       do       do       do       do
 #endif
-#endif
 #ifdef CONFIG_KEXEC
 kexec_op                           compat   do       -        -        -
 #endif
diff --git a/xen/include/xen/domain.h b/xen/include/xen/domain.h
index 8aab05ae93..11d2505420 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
 
 extern bool vmtrace_available;
 
-- 
2.34.1