All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Beulich <jbeulich@suse.com>
To: "xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>
Cc: "Daniel Smith" <dpsmith@apertussolutions.com>,
	"Julien Grall" <julien@xen.org>,
	"Stefano Stabellini" <sstabellini@kernel.org>,
	"Volodymyr Babchuk" <volodymyr_babchuk@epam.com>,
	"Bertrand Marquis" <bertrand.marquis@arm.com>,
	"Michal Orzel" <michal.orzel@amd.com>,
	"Andrew Cooper" <andrew.cooper3@citrix.com>,
	"Teddy Astie" <teddy.astie@vates.tech>,
	"Roger Pau Monné" <roger@xenproject.org>
Subject: [PATCH v2 13/14] XSM: convert remaining miscellaneous hooks
Date: Mon, 17 Aug 2026 10:58:03 +0200	[thread overview]
Message-ID: <aac7d8fa-ef0d-4146-883f-deb9ec04a519@suse.com> (raw)
In-Reply-To: <ef09b072-c935-459e-bf8b-81c96ff9cc46@suse.com>

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@suse.com>
---
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(



  parent reply	other threads:[~2026-08-17  8:58 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-17  8:49 [PATCH v2 00/14] XSM: follow-on to XSAs 492 and 499 Jan Beulich
2026-08-17  8:51 ` [PATCH v2 01/14] XSM: make xsm_default_action() const-correct Jan Beulich
2026-08-17  8:51 ` [PATCH v2 02/14] XSM: convert "allow" (Flask: "access") parameters to bool Jan Beulich
2026-08-17  8:52 ` [PATCH v2 03/14] x86/mm: get_page_from_l1e() is PV-or-shadow-only Jan Beulich
2026-08-17  8:52 ` [PATCH v2 04/14] x86: restrict PHYSDEVOP_* when PV=n Jan Beulich
2026-08-17  8:53 ` [PATCH v2 05/14] XSM: make Argo hooks well-formed ones Jan Beulich
2026-08-17  8:53 ` [PATCH v2 06/14] XSM: fold xsm_{,un}map_domain_pirq() hooks Jan Beulich
2026-08-17  8:54 ` [PATCH v2 07/14] x86: type-correct last parameter of map_domain_pirq() Jan Beulich
2026-08-17  8:54 ` [PATCH v2 08/14] XSM: pass just SBDF to xsm_{,un}map_domain_irq() Jan Beulich
2026-08-17  8:55 ` [PATCH v2 09/14] XSM: fold xsm_{,un}map_domain_irq() hooks Jan Beulich
2026-08-17  8:56 ` [PATCH v2 10/14] XSM: fold xsm_{,un}bind_pt_irq() hooks Jan Beulich
2026-08-17  8:56 ` [PATCH v2 11/14] XSM: convert remaining event channel hooks Jan Beulich
2026-08-17  8:57 ` [PATCH v2 12/14] XSM: convert remaining domain-related hooks Jan Beulich
2026-08-17  8:58 ` Jan Beulich [this message]
2026-08-17  8:58 ` [PATCH RFC v2 14/14] XSM: avoid fragile assumptions in xsm_fixup_ops() Jan Beulich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aac7d8fa-ef0d-4146-883f-deb9ec04a519@suse.com \
    --to=jbeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=bertrand.marquis@arm.com \
    --cc=dpsmith@apertussolutions.com \
    --cc=julien@xen.org \
    --cc=michal.orzel@amd.com \
    --cc=roger@xenproject.org \
    --cc=sstabellini@kernel.org \
    --cc=teddy.astie@vates.tech \
    --cc=volodymyr_babchuk@epam.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.