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

[PATCH v2 13/14] XSM: convert remaining miscellaneous hooks


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 17 Aug 2026 10:58:03 +0200
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=google header.d=suse.com header.i="@suse.com" header.h="Content-Transfer-Encoding:Content-Type:In-Reply-To:Autocrypt:Content-Language:References:Cc:To:From:Subject:User-Agent:MIME-Version:Date:Message-ID"
  • Autocrypt: addr=jbeulich@xxxxxxxx; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdSoeepS07jW8UgcHNurfHvUzogEq5xk hu507c3BarVjyWCJOylMNR98Yd8VqD9UfmX0Hb8/BrA+Hl6/DB/eqGptrf4BSRwcZQM32aZK 7Pj2XbGWIUrZrd70x1eAP9QE3P79Y2oLrsCgbZJfEwCgvz9JjGmQqQkRiTVzlZVCJYcyGGsD /0tbFCzD2h20ahe8rC1gbb3K3qk+LpBtvjBu1RY9drYk0NymiGbJWZgab6t1jM7sk2vuf0Py O9Hf9XBmK0uE9IgMaiCpc32XV9oASz6UJebwkX+zF2jG5I1BfnO9g7KlotcA/v5ClMjgo6Gl MDY4HxoSRu3i1cqqSDtVlt+AOVBJBACrZcnHAUSuCXBPy0jOlBhxPqRWv6ND4c9PH1xjQ3NP nxJuMBS8rnNg22uyfAgmBKNLpLgAGVRMZGaGoJObGf72s6TeIqKJo/LtggAS9qAUiuKVnygo 3wjfkS9A3DRO+SpU7JqWdsveeIQyeyEJ/8PTowmSQLakF+3fote9ybzd880fSmFuIEJldWxp Y2ggPGpiZXVsaWNoQHN1c2UuY29tPsJgBBMRAgAgBQJZN5xEAhsDBgsJCAcDAgQVAggDBBYC AwECHgECF4AACgkQoDSui/t3IH4J+wCfQ5jHdEjCRHj23O/5ttg9r9OIruwAn3103WUITZee e7Sbg12UgcQ5lv7SzsFNBFk3nEQQCACCuTjCjFOUdi5Nm244F+78kLghRcin/awv+IrTcIWF hUpSs1Y91iQQ7KItirz5uwCPlwejSJDQJLIS+QtJHaXDXeV6NI0Uef1hP20+y8qydDiVkv6l IreXjTb7DvksRgJNvCkWtYnlS3mYvQ9NzS9PhyALWbXnH6sIJd2O9lKS1Mrfq+y0IXCP10eS FFGg+Av3IQeFatkJAyju0PPthyTqxSI4lZYuJVPknzgaeuJv/2NccrPvmeDg6Coe7ZIeQ8Yj t0ARxu2xytAkkLCel1Lz1WLmwLstV30g80nkgZf/wr+/BXJW/oIvRlonUkxv+IbBM3dX2OV8 AmRv1ySWPTP7AAMFB/9PQK/VtlNUJvg8GXj9ootzrteGfVZVVT4XBJkfwBcpC/XcPzldjv+3 HYudvpdNK3lLujXeA5fLOH+Z/G9WBc5pFVSMocI71I8bT8lIAzreg0WvkWg5V2WZsUMlnDL9 mpwIGFhlbM3gfDMs7MPMu8YQRFVdUvtSpaAs8OFfGQ0ia3LGZcjA6Ik2+xcqscEJzNH+qh8V m5jjp28yZgaqTaRbg3M/+MTbMpicpZuqF4rnB0AQD12/3BNWDR6bmh+EkYSMcEIpQmBM51qM EKYTQGybRCjpnKHGOxG0rfFY1085mBDZCH5Kx0cl0HVJuQKC+dV2ZY5AqjcKwAxpE75MLFkr wkkEGBECAAkFAlk3nEQCGwwACgkQoDSui/t3IH7nnwCfcJWUDUFKdCsBH/E5d+0ZnMQi+G0A nAuWpQkjM1ASeQwSHEeAWPgskBQL
  • Cc: Daniel Smith <dpsmith@xxxxxxxxxxxxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Volodymyr Babchuk <volodymyr_babchuk@xxxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Teddy Astie <teddy.astie@xxxxxxxxxx>, Roger Pau Monné <roger@xxxxxxxxxxxxxx>
  • Delivery-date: Mon, 17 Aug 2026 08:58:06 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Make the ones left also follow the standard scheme, i.e. taking
xsm_default_t as first argument at call sites. This way they can be
covered by the recently introduced hook machinery.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
---
Interestingly .show_irq_sid() is unused on Arm. Oddly there's no use of
register_keyhandler() there at all. (IOW I think it would be wrong to make
the hook x86-only.)
---
v2: New.

--- a/xen/arch/arm/setup.c
+++ b/xen/arch/arm/setup.c
@@ -497,7 +497,7 @@ void asmlinkage __init noreturn start_xe
     /* Hide UART from DOM0 if we're using it */
     serial_endboot();
 
-    if ( (rc = xsm_set_system_active()) != 0 )
+    if ( (rc = xsm_set_system_active(XSM_HOOK)) != 0 )
         panic("xsm: unable to switch to SYSTEM_ACTIVE privilege: %d\n", rc);
 
     system_state = SYS_STATE_active;
--- a/xen/arch/x86/irq.c
+++ b/xen/arch/x86/irq.c
@@ -2549,7 +2549,7 @@ static void cf_check dump_irqs(unsigned
         if ( !irq_desc_initialized(desc) || desc->handler == &no_irq_type )
             continue;
 
-        ssid = in_irq() ? NULL : xsm_show_irq_sid(irq);
+        ssid = in_irq() ? NULL : xsm_show_irq_sid(XSM_HOOK, irq);
 
         spin_lock_irqsave(&desc->lock, flags);
 
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -835,7 +835,7 @@ static void noreturn init_done(void)
     unsigned long start, end;
     int err;
 
-    if ( (err = xsm_set_system_active()) != 0 )
+    if ( (err = xsm_set_system_active(XSM_HOOK)) != 0 )
         panic("xsm: unable to switch to SYSTEM_ACTIVE privilege: %d\n", err);
 
     system_state = SYS_STATE_active;
--- a/xen/include/xsm/dummy.h
+++ b/xen/include/xsm/dummy.h
@@ -104,10 +104,12 @@ static always_inline int xsm_default_act
     }
 }
 
-static XSM_INLINE int xsm_set_system_active(void)
+static XSM_INLINE int xsm_set_system_active(XSM_DEFAULT_VOID)
 {
     struct domain *d = current->domain;
 
+    XSM_ASSERT_ACTION(XSM_HOOK);
+
     ASSERT(d->is_privileged);
 
     if ( d->domain_id != DOMID_IDLE )
@@ -467,8 +469,9 @@ static XSM_INLINE int xsm_do_compat_op(X
 
 #endif /* CONFIG_XSM */
 
-static XSM_INLINE char *xsm_show_irq_sid(int irq)
+static XSM_INLINE char *xsm_show_irq_sid(XSM_DEFAULT_ARG int irq)
 {
+    XSM_ASSERT_ACTION(XSM_HOOK);
     return NULL;
 }
 
--- a/xen/include/xsm/hooks.h
+++ b/xen/include/xsm/hooks.h
@@ -17,6 +17,8 @@
 
 #endif /* XSM_HOOK */
 
+XSM_HOOK(int, set_system_active)
+
 XSM_HOOK(int, domain_create, struct domain *, uint32_t)
 XSM_HOOK(int, getdomaininfo, struct domain *)
 XSM_HOOK(int, get_domain_state, struct domain *)
@@ -84,6 +86,8 @@ XSM_HOOK(int, irq_mapping, struct domain
 XSM_HOOK(int, pt_irq_binding, struct domain *, struct xen_domctl_bind_pt_irq *,
                               bool)
 
+XSM_HOOK(pchar_t, show_irq_sid, int)
+
 XSM_HOOK(int, irq_permission, struct domain *, int, bool)
 XSM_HOOK(int, iomem_permission, struct domain *, uint64_t, uint64_t, bool)
 
--- a/xen/include/xsm/xsm.h
+++ b/xen/include/xsm/xsm.h
@@ -61,7 +61,6 @@ typedef enum xsm_default xsm_default_t;
  * !!! WARNING !!!
  */
 struct xsm_ops {
-    int (*set_system_active)(void);
 
 #define XSM_HOOK0(rtype, name) rtype (*name)(void);
 #define XSM_HOOK1(rtype, name, type1) \
@@ -77,7 +76,6 @@ struct xsm_ops {
 
 #include "hooks.h"
 
-    char *(*show_irq_sid)(int irq);
 };
 
 #ifdef CONFIG_XSM
@@ -86,11 +84,6 @@ extern struct xsm_ops xsm_ops;
 
 #ifndef XSM_NO_WRAPPERS
 
-static inline int xsm_set_system_active(void)
-{
-    return alternative_call(xsm_ops.set_system_active);
-}
-
 #define XSM_ALT_void      alternative_vcall
 #define XSM_ALT_int       return alternative_call
 #define XSM_ALT_pchar_t   return alternative_call
@@ -138,11 +131,6 @@ static inline rtype xsm_ ## name( \
 
 #include "hooks.h"
 
-static inline char *xsm_show_irq_sid(int irq)
-{
-    return alternative_call(xsm_ops.show_irq_sid, irq);
-}
-
 #endif /* XSM_NO_WRAPPERS */
 
 #ifdef CONFIG_MULTIBOOT
--- a/xen/xsm/dummy.c
+++ b/xen/xsm/dummy.c
@@ -14,7 +14,6 @@
 #include <xsm/dummy.h>
 
 static const struct xsm_ops __initconst_cf_clobber dummy_ops = {
-    .set_system_active             = xsm_set_system_active,
 
 #define XSM_HOOK0(rtype, name) .name = xsm_ ## name,
 #define XSM_HOOK1(rtype, name, ...) XSM_HOOK0(rtype, name)
@@ -25,7 +24,6 @@ static const struct xsm_ops __initconst_
 
 #include <xsm/hooks.h>
 
-    .show_irq_sid                  = xsm_show_irq_sid,
 };
 
 void __init xsm_fixup_ops(struct xsm_ops *ops)
--- a/xen/xsm/flask/hooks.c
+++ b/xen/xsm/flask/hooks.c
@@ -1903,7 +1903,6 @@ static int cf_check flask_get_domain_sta
 }
 
 static const struct xsm_ops __initconst_cf_clobber flask_ops = {
-    .set_system_active = flask_set_system_active,
 
 #define XSM_HOOK0(rtype, name) .name = flask_ ## name,
 #define XSM_HOOK1(rtype, name, ...) XSM_HOOK0(rtype, name)
@@ -1914,7 +1913,6 @@ static const struct xsm_ops __initconst_
 
 #include <xsm/hooks.h>
 
-    .show_irq_sid = flask_show_irq_sid,
 };
 
 const struct xsm_ops *__init flask_init(




 


Rackspace

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