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

[xen staging] XSM: make XSM hooks well-formed ones



commit 5e2bbb53f5107fbbf319787f3961b5e8a4bcdc3a
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Mon Aug 17 09:23:57 2026 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Mon Aug 17 09:23:57 2026 +0200

    XSM: make XSM hooks well-formed ones
    
    For whatever reason they didn't have an xsm_default_t first argument (to
    cope with XSM=n mode), making it impossible to (easily) cover them in
    xsm/hooks.h.
    
    flask_do_xsm_op() is also changed to return int, as all the function ever
    returns is an int. This way no new machinery needs adding to xsm/hooks.h.
    Instead one piece of compat machinery can then be dropped from
    xsm/flask/flask_op.c.
    
    Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
    Acked-by: Daniel P. Smith <dpsmith@xxxxxxxxxxxxxxxxxxxx>
---
 xen/include/xsm/dummy.h  |  2 +-
 xen/include/xsm/hooks.h  |  5 +++++
 xen/include/xsm/xsm.h    | 17 -----------------
 xen/xsm/dummy.c          |  5 -----
 xen/xsm/flask/flask_op.c |  7 ++-----
 xen/xsm/flask/hooks.c    |  6 ------
 xen/xsm/flask/private.h  |  4 ++--
 xen/xsm/xsm_core.c       |  4 ++--
 8 files changed, 12 insertions(+), 38 deletions(-)

diff --git a/xen/include/xsm/dummy.h b/xen/include/xsm/dummy.h
index 59d35466e5..7af5cbdfb7 100644
--- a/xen/include/xsm/dummy.h
+++ b/xen/include/xsm/dummy.h
@@ -439,7 +439,7 @@ static XSM_INLINE int xsm_hypfs_op(XSM_DEFAULT_VOID)
 
 #ifdef CONFIG_XSM
 
-static XSM_INLINE long xsm_do_xsm_op(XEN_GUEST_HANDLE_PARAM(void) op)
+static XSM_INLINE int xsm_do_xsm_op(XEN_GUEST_HANDLE_PARAM(void) op)
 {
     return -ENOSYS;
 }
diff --git a/xen/include/xsm/hooks.h b/xen/include/xsm/hooks.h
index 5bdb23f26d..1e558bf710 100644
--- a/xen/include/xsm/hooks.h
+++ b/xen/include/xsm/hooks.h
@@ -154,6 +154,11 @@ XSM_HOOK(int, dm_op, struct domain *)
 XSM_HOOK(int, xen_version, uint32_t)
 XSM_HOOK(int, domain_resource_map, struct domain *)
 
+XSM_HOOK(int, do_xsm_op, XEN_GUEST_HANDLE_PARAM(void))
+#ifdef CONFIG_COMPAT
+XSM_HOOK(int, do_compat_op, XEN_GUEST_HANDLE_PARAM(void))
+#endif
+
 #undef XSM_HOOK0
 #undef XSM_HOOK1
 #undef XSM_HOOK2
diff --git a/xen/include/xsm/xsm.h b/xen/include/xsm/xsm.h
index 53c722f868..b94f0cd0fd 100644
--- a/xen/include/xsm/xsm.h
+++ b/xen/include/xsm/xsm.h
@@ -86,11 +86,6 @@ struct xsm_ops {
 
     char *(*show_irq_sid)(int irq);
 
-    long (*do_xsm_op)(XEN_GUEST_HANDLE_PARAM(void) op);
-#ifdef CONFIG_COMPAT
-    int (*do_compat_op)(XEN_GUEST_HANDLE_PARAM(void) op);
-#endif
-
 #ifdef CONFIG_ARGO
     int (*argo_enable)(const struct domain *d);
     int (*argo_register_single_source)(const struct domain *d,
@@ -201,18 +196,6 @@ static inline char *xsm_show_irq_sid(int irq)
     return alternative_call(xsm_ops.show_irq_sid, irq);
 }
 
-static inline long xsm_do_xsm_op(XEN_GUEST_HANDLE_PARAM(void) op)
-{
-    return alternative_call(xsm_ops.do_xsm_op, op);
-}
-
-#ifdef CONFIG_COMPAT
-static inline int xsm_do_compat_op(XEN_GUEST_HANDLE_PARAM(void) op)
-{
-    return alternative_call(xsm_ops.do_compat_op, op);
-}
-#endif
-
 #ifdef CONFIG_ARGO
 static inline int xsm_argo_enable(const struct domain *d)
 {
diff --git a/xen/xsm/dummy.c b/xen/xsm/dummy.c
index dfe1cf41c7..046c0cb59e 100644
--- a/xen/xsm/dummy.c
+++ b/xen/xsm/dummy.c
@@ -36,11 +36,6 @@ static const struct xsm_ops __initconst_cf_clobber dummy_ops 
= {
 
     .show_irq_sid                  = xsm_show_irq_sid,
 
-    .do_xsm_op                     = xsm_do_xsm_op,
-#ifdef CONFIG_COMPAT
-    .do_compat_op                  = xsm_do_compat_op,
-#endif
-
 #ifdef CONFIG_ARGO
     .argo_enable                   = xsm_argo_enable,
     .argo_register_single_source   = xsm_argo_register_single_source,
diff --git a/xen/xsm/flask/flask_op.c b/xen/xsm/flask/flask_op.c
index ea7dd10dc8..d2f04ca5ef 100644
--- a/xen/xsm/flask/flask_op.c
+++ b/xen/xsm/flask/flask_op.c
@@ -23,7 +23,6 @@
 #include <conditional.h>
 #include "private.h"
 
-#define ret_t long
 #define _copy_to_guest copy_to_guest
 #define _copy_from_guest copy_from_guest
 
@@ -606,7 +605,7 @@ static int flask_relabel_domain(const struct 
xen_flask_relabel *arg)
 
 #endif /* !COMPAT */
 
-ret_t cf_check do_flask_op(XEN_GUEST_HANDLE_PARAM(void) u_flask_op)
+int cf_check flask_do_xsm_op(XEN_GUEST_HANDLE_PARAM(void) u_flask_op)
 {
     xen_flask_op_t op;
     int rv;
@@ -772,9 +771,7 @@ CHECK_flask_transition;
 #define flask_devicetree_label compat_devicetree_label
 
 #define xen_flask_op_t compat_flask_op_t
-#undef ret_t
-#define ret_t int
-#define do_flask_op compat_flask_op
+#define flask_do_xsm_op flask_do_compat_op
 
 #include "flask_op.c"
 #endif
diff --git a/xen/xsm/flask/hooks.c b/xen/xsm/flask/hooks.c
index 3cfdf6bf08..11a77f0e28 100644
--- a/xen/xsm/flask/hooks.c
+++ b/xen/xsm/flask/hooks.c
@@ -1969,12 +1969,6 @@ static const struct xsm_ops __initconst_cf_clobber 
flask_ops = {
 
     .show_irq_sid = flask_show_irq_sid,
 
-    .do_xsm_op = do_flask_op,
-
-#ifdef CONFIG_COMPAT
-    .do_compat_op = compat_flask_op,
-#endif
-
 #ifdef CONFIG_ARGO
     .argo_enable = flask_argo_enable,
     .argo_register_single_source = flask_argo_register_single_source,
diff --git a/xen/xsm/flask/private.h b/xen/xsm/flask/private.h
index 429f213cce..e443ad54aa 100644
--- a/xen/xsm/flask/private.h
+++ b/xen/xsm/flask/private.h
@@ -3,7 +3,7 @@
 
 #include <public/xen.h>
 
-long cf_check do_flask_op(XEN_GUEST_HANDLE_PARAM(void) u_flask_op);
-int cf_check compat_flask_op(XEN_GUEST_HANDLE_PARAM(void) u_flask_op);
+int cf_check flask_do_xsm_op(XEN_GUEST_HANDLE_PARAM(void) u_flask_op);
+int cf_check flask_do_compat_op(XEN_GUEST_HANDLE_PARAM(void) u_flask_op);
 
 #endif /* XSM_FLASK_PRIVATE */
diff --git a/xen/xsm/xsm_core.c b/xen/xsm/xsm_core.c
index b7638d2bc1..6a91940c4e 100644
--- a/xen/xsm/xsm_core.c
+++ b/xen/xsm/xsm_core.c
@@ -216,12 +216,12 @@ bool __init has_xsm_magic(paddr_t start)
 
 long do_xsm_op(XEN_GUEST_HANDLE_PARAM(void) op)
 {
-    return xsm_do_xsm_op(op);
+    return xsm_do_xsm_op(XSM_HOOK, op);
 }
 
 #ifdef CONFIG_COMPAT
 int compat_xsm_op(XEN_GUEST_HANDLE_PARAM(void) op)
 {
-    return xsm_do_compat_op(op);
+    return xsm_do_compat_op(XSM_HOOK, op);
 }
 #endif
--
generated by git-patchbot for /home/xen/git/xen.git#staging



 


Rackspace

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