Wrap domctl hypercall def and domctl.o with CONFIG_MGMT_HYPERCALLS.
Make CONFIG_MGMT_HYPERCALLS optional and expand help message

Signed-off-by: Penny Zheng <[email protected]>
---
v1 -> v2:
- remove stub in common/domctl.c
- combine the original commit of "xen/domctl: provide stub for
 domctl_lock_{acquire,release}"
- adapt to changes of "unify DOMCTL to MGMT_HYPERCALLS"
---
v2 -> v3:
- add pitfall warnning in Kconfig help
---
v3 -> v4:
- refine help message
---
 xen/common/Kconfig           | 14 ++++++++++----
 xen/common/Makefile          |  2 +-
 xen/include/hypercall-defs.c |  6 ++++--
 3 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/xen/common/Kconfig b/xen/common/Kconfig
index 973b8e26bd..5aecb88680 100644
--- a/xen/common/Kconfig
+++ b/xen/common/Kconfig
@@ -654,11 +654,17 @@ menu "Supported hypercall interfaces"
 config MGMT_HYPERCALLS
        bool "Enable privileged hypercalls for system management"
        depends on !PV_SHIM_EXCLUSIVE
-       def_bool y
        help
-         This option shall only be disabled on some dom0less systems, or
-         PV shim on x86, to reduce Xen footprint via managing unnessary
-         hypercalls, like sysctl, etc.
+         Management hypercalls provide the means for dom0 to manage the
+         overall Xen system and other domains, including sysctl, domctl, etc.
+         In a dom0less or pv-shim build, they can be omitted to cut down
+         on the Xen binary's size. However, this comes at the loss of
+         significant runtime functionality.
+         So be cautious to disable it, as admins will face missing a few basic
+         hypercalls like listdomains, getdomaininfo, etc, hence leading to
+         have an impact on device-passthrough and DM.
+
+         Unless you know what you are doing, you should enable this.
 
 endmenu
 
diff --git a/xen/common/Makefile b/xen/common/Makefile
index 7c32fbd9f1..e0afc89591 100644
--- a/xen/common/Makefile
+++ b/xen/common/Makefile
@@ -71,7 +71,7 @@ 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-y += domctl.o
+obj-$(CONFIG_MGMT_HYPERCALLS) += domctl.o
 endif
 
 extra-y := symbols-dummy.o
diff --git a/xen/include/hypercall-defs.c b/xen/include/hypercall-defs.c
index 38b21dccbd..5343fd7a6f 100644
--- a/xen/include/hypercall-defs.c
+++ b/xen/include/hypercall-defs.c
@@ -199,9 +199,11 @@ 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
-#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
 #ifdef CONFIG_HVM
@@ -279,10 +281,10 @@ hvm_op                             do       do       do   
    do       do
 #endif
 #ifdef CONFIG_MGMT_HYPERCALLS
 sysctl                             do       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
-- 
2.34.1


Reply via email to