Wrap platform_op hypercall definition and platform_hypercall.o of arm and
x86 with CONFIG_PLATFORM_OP, and since PV_SHIM_EXCLUSIVE needs sorting in
the future, move them out of PV_SHIM_EXCLUSIVE condition at the same time.

And need to make PLATFORM_OP with help info. It shall at least provide
"# CONFIG_PLATFORM_OP is not set" in preset configs for PV shim on x86.
With that, all dependent option get covered and could be deleted.

Signed-off-by: Jiqian Chen <jiqian.c...@amd.com>
---
cc: Stefano Stabellini <sstabell...@kernel.org>
cc: Julien Grall <jul...@xen.org>
cc: Bertrand Marquis <bertrand.marq...@arm.com>
cc: Michal Orzel <michal.or...@amd.com>
cc: Volodymyr Babchuk <volodymyr_babc...@epam.com>
cc: Andrew Cooper <andrew.coop...@citrix.com>
cc: Anthony PERARD <anthony.per...@vates.tech>
cc: Jan Beulich <jbeul...@suse.com>
cc: "Roger Pau Monné" <roger....@citrix.com>
---
 xen/arch/arm/Makefile                 | 2 +-
 xen/arch/x86/Makefile                 | 2 ++
 xen/arch/x86/configs/pvshim_defconfig | 1 +
 xen/common/Kconfig                    | 3 +++
 xen/include/hypercall-defs.c          | 6 ++++--
 5 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/xen/arch/arm/Makefile b/xen/arch/arm/Makefile
index f833cdf2078b..4f9290fe6345 100644
--- a/xen/arch/arm/Makefile
+++ b/xen/arch/arm/Makefile
@@ -42,7 +42,7 @@ obj-$(CONFIG_VM_EVENT) += mem_access.o
 obj-y += mm.o
 obj-$(CONFIG_VM_EVENT) += monitor.o
 obj-y += p2m.o
-obj-y += platform.o
+obj-$(CONFIG_PLATFORM_OP) += platform.o
 obj-y += platform_hypercall.o
 obj-y += physdev.o
 obj-y += processor.o
diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile
index 5aab30a0c4a4..e180ab1a0409 100644
--- a/xen/arch/x86/Makefile
+++ b/xen/arch/x86/Makefile
@@ -80,6 +80,8 @@ obj-y += xstate.o
 
 ifneq ($(CONFIG_PV_SHIM_EXCLUSIVE),y)
 obj-y += domctl.o
+endif
+ifeq ($(CONFIG_PLATFORM_OP),y)
 obj-y += platform_hypercall.o
 obj-$(CONFIG_COMPAT) += x86_64/platform_hypercall.o
 endif
diff --git a/xen/arch/x86/configs/pvshim_defconfig 
b/xen/arch/x86/configs/pvshim_defconfig
index c58c29adb0bf..e9ede13250d8 100644
--- a/xen/arch/x86/configs/pvshim_defconfig
+++ b/xen/arch/x86/configs/pvshim_defconfig
@@ -25,3 +25,4 @@ CONFIG_EXPERT=y
 # CONFIG_DEBUG is not set
 # CONFIG_GDBSX is not set
 # CONFIG_SYSCTL is not set
+# CONFIG_PLATFORM_OP is not set
diff --git a/xen/common/Kconfig b/xen/common/Kconfig
index 1a8f5ec93364..13b544cbb1d5 100644
--- a/xen/common/Kconfig
+++ b/xen/common/Kconfig
@@ -630,6 +630,9 @@ config SYSCTL
 config PLATFORM_OP
        bool "Enable Platform Operation hypercall"
        default y
+       help
+         This option shall only be disabled on some dom0less systems, or
+         PV shim on x86, to reduce Xen footprint.
 
 endmenu
 
diff --git a/xen/include/hypercall-defs.c b/xen/include/hypercall-defs.c
index c1081d87a252..96ad6efacd5a 100644
--- a/xen/include/hypercall-defs.c
+++ b/xen/include/hypercall-defs.c
@@ -150,7 +150,7 @@ update_va_mapping(unsigned int va, uint32_t lo, uint32_t 
hi, unsigned int flags)
 physdev_op_compat(physdev_op_compat_t *uop)
 update_va_mapping_otherdomain(unsigned int va, uint32_t lo, uint32_t hi, 
unsigned int flags, domid_t domid)
 #endif
-#ifndef CONFIG_PV_SHIM_EXCLUSIVE
+#ifdef CONFIG_PLATFORM_OP
 platform_op(compat_platform_op_t *u_xenpf_op)
 #endif
 #ifdef CONFIG_KEXEC
@@ -200,6 +200,8 @@ sysctl(xen_sysctl_t *u_sysctl)
 #ifndef CONFIG_PV_SHIM_EXCLUSIVE
 domctl(xen_domctl_t *u_domctl)
 paging_domctl_cont(xen_domctl_t *u_domctl)
+#endif
+#ifdef CONFIG_PLATFORM_OP
 platform_op(xen_platform_op_t *u_xenpf_op)
 #endif
 #ifdef CONFIG_HVM
@@ -236,7 +238,7 @@ stack_switch                       do:2     do:2     -      
  -        -
 set_callbacks                      compat   do       -        -        -
 fpu_taskswitch                     do       do       -        -        -
 sched_op_compat                    do       do       -        -        dep
-#ifndef CONFIG_PV_SHIM_EXCLUSIVE
+#ifdef CONFIG_PLATFORM_OP
 platform_op                        compat   do       compat   do       do
 #endif
 set_debugreg                       do       do       -        -        -
-- 
2.34.1


Reply via email to