[PATCH 16/24] XSM: suppress hypercall when XSM=n

Jan Beulich <[email protected]>
Newsgroups org.xenproject.lists.xen-devel
Message-ID <[email protected]>
This can be easily done in hypercall-defs.c, thus avoiding the need to
dive into xsm/ when building Xen, just to add code which does what is done
for an absent hypercall handler anyway (returning -ENOSYS).

Signed-off-by: Jan Beulich <[email protected]>

--- a/xen/Makefile
+++ b/xen/Makefile
@@ -458,7 +458,7 @@ CFLAGS += -I$(objtree)/arch/$(SRCARCH)/i
 ALL_OBJS-y                := common/built_in.o
 ALL_OBJS-y                += drivers/built_in.o
 ALL_OBJS-y                += lib/built_in.o
-ALL_OBJS-y                += xsm/built_in.o
+ALL_OBJS-$(CONFIG_XSM)    += xsm/built_in.o
 ALL_OBJS-y                += arch/$(SRCARCH)/built_in.o
 ALL_OBJS-$(CONFIG_CRYPTO) += crypto/built_in.o
 
--- a/xen/include/hypercall-defs.c
+++ b/xen/include/hypercall-defs.c
@@ -119,7 +119,9 @@ prefix: do PREFIX_compat
 xen_version(int cmd, void *arg)
 vcpu_op(int cmd, unsigned int vcpuid, void *arg)
 sched_op(int cmd, void *arg)
+#ifdef CONFIG_XSM
 xsm_op(void *op)
+#endif
 callback_op(int cmd, const void *arg)
 #ifdef CONFIG_ARGO
 argo_op(unsigned int cmd, void *arg1, void *arg2, unsigned long arg3, unsigned long arg4)
@@ -264,7 +266,9 @@ set_segment_base                   do:2
 #ifdef CONFIG_PV
 mmuext_op                          compat:2 do:2     compat   do       -
 #endif
+#ifdef CONFIG_XSM
 xsm_op                             compat   do       compat   do       do
+#endif
 nmi_op                             compat   do       -        -        -
 sched_op                           compat   do       compat   do       do
 callback_op                        compat   do       -        -        -
--- a/xen/include/xsm/dummy.h
+++ b/xen/include/xsm/dummy.h
@@ -437,6 +437,8 @@ static XSM_INLINE int xsm_hypfs_op(XSM_D
 }
 #endif
 
+#ifdef CONFIG_XSM
+
 static XSM_INLINE long xsm_do_xsm_op(XEN_GUEST_HANDLE_PARAM(void) op)
 {
     return -ENOSYS;
@@ -449,6 +451,8 @@ static XSM_INLINE int xsm_do_compat_op(X
 }
 #endif
 
+#endif /* CONFIG_XSM */
+
 static XSM_INLINE char *xsm_show_irq_sid(int irq)
 {
     return NULL;
--- a/xen/xsm/Makefile
+++ b/xen/xsm/Makefile
@@ -1,6 +1,6 @@
 obj-y += xsm_core.o
-obj-$(CONFIG_XSM) += xsm_policy.o
-obj-$(CONFIG_XSM) += dummy.o
+obj-y += xsm_policy.o
+obj-y += dummy.o
 obj-$(CONFIG_XSM_SILO) += silo.o
 
 obj-$(CONFIG_XSM_FLASK) += flask/
--- a/xen/xsm/xsm_core.c
+++ b/xen/xsm/xsm_core.c
@@ -18,8 +18,6 @@
 #include <xen/hypercall.h>
 #include <xsm/xsm.h>
 
-#ifdef CONFIG_XSM
-
 #ifdef CONFIG_MULTIBOOT
 #include <asm/bootinfo.h>
 #include <asm/setup.h>
@@ -216,8 +214,6 @@ bool __init has_xsm_magic(paddr_t start)
 }
 #endif
 
-#endif
-
 long do_xsm_op(XEN_GUEST_HANDLE_PARAM(void) op)
 {
     return xsm_do_xsm_op(op);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.