[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xen master] XSM: suppress hypercall when XSM=n



commit 7f659ae00ac5a235d21fcee7816ed5958512dbd2
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Mon Aug 17 09:23:18 2026 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Mon Aug 17 09:23:18 2026 +0200

    XSM: suppress hypercall when XSM=n
    
    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 <jbeulich@xxxxxxxx>
    Acked-by: Daniel P. Smith <dpsmith@xxxxxxxxxxxxxxxxxxx>
---
 xen/Makefile                 | 2 +-
 xen/include/hypercall-defs.c | 4 ++++
 xen/include/xsm/dummy.h      | 4 ++++
 xen/xsm/Makefile             | 4 ++--
 xen/xsm/xsm_core.c           | 4 ----
 5 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/xen/Makefile b/xen/Makefile
index d10c29162f..8c56295493 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -458,7 +458,7 @@ CFLAGS += -I$(objtree)/arch/$(SRCARCH)/include/generated
 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
 
diff --git a/xen/include/hypercall-defs.c b/xen/include/hypercall-defs.c
index a625d634b6..48290b51e4 100644
--- 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     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       -        -        -
diff --git a/xen/include/xsm/dummy.h b/xen/include/xsm/dummy.h
index 50bf962e72..59d35466e5 100644
--- a/xen/include/xsm/dummy.h
+++ b/xen/include/xsm/dummy.h
@@ -437,6 +437,8 @@ static XSM_INLINE int xsm_hypfs_op(XSM_DEFAULT_VOID)
 }
 #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(XEN_GUEST_HANDLE_PARAM(void) op)
 }
 #endif
 
+#endif /* CONFIG_XSM */
+
 static XSM_INLINE char *xsm_show_irq_sid(int irq)
 {
     return NULL;
diff --git a/xen/xsm/Makefile b/xen/xsm/Makefile
index cf0a728f1c..0059794dd5 100644
--- 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/
diff --git a/xen/xsm/xsm_core.c b/xen/xsm/xsm_core.c
index b7e864a874..b7638d2bc1 100644
--- 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);
--
generated by git-patchbot for /home/xen/git/xen.git#master



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.