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

[xen master] XSM: make .{,un}map_domain_pirq() hooks dependent upon HAS_PIRQ=y



commit 51eaa9d1a8ae392e6238b71efde61123c02ea89b
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Mon Aug 3 16:32:44 2026 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Mon Aug 3 16:32:44 2026 +0200

    XSM: make .{,un}map_domain_pirq() hooks dependent upon HAS_PIRQ=y
    
    They're unreachable / dead otherwise.
    
    Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
    Acked-by: Daniel P. Smith <dpsmith@xxxxxxxxxxxxxxxxxxxx>
---
 xen/include/xsm/dummy.h | 16 ++++++++++------
 xen/include/xsm/hooks.h |  5 ++++-
 xen/xsm/flask/hooks.c   | 14 +++++++++-----
 3 files changed, 23 insertions(+), 12 deletions(-)

diff --git a/xen/include/xsm/dummy.h b/xen/include/xsm/dummy.h
index d75285477d..8fb73d032c 100644
--- a/xen/include/xsm/dummy.h
+++ b/xen/include/xsm/dummy.h
@@ -450,6 +450,8 @@ static XSM_INLINE char *cf_check xsm_show_irq_sid(int irq)
     return NULL;
 }
 
+#ifdef CONFIG_HAS_PIRQ
+
 static XSM_INLINE int cf_check xsm_map_domain_pirq(
     XSM_DEFAULT_ARG struct domain *d)
 {
@@ -457,17 +459,19 @@ static XSM_INLINE int cf_check xsm_map_domain_pirq(
     return xsm_default_action(action, current->domain, d);
 }
 
-static XSM_INLINE int cf_check xsm_map_domain_irq(
-    XSM_DEFAULT_ARG struct domain *d, int irq, const void *data)
+static XSM_INLINE int cf_check xsm_unmap_domain_pirq(
+    XSM_DEFAULT_ARG struct domain *d)
 {
-    XSM_ASSERT_ACTION(XSM_HOOK);
+    XSM_ASSERT_ACTION(XSM_DM_PRIV);
     return xsm_default_action(action, current->domain, d);
 }
 
-static XSM_INLINE int cf_check xsm_unmap_domain_pirq(
-    XSM_DEFAULT_ARG struct domain *d)
+#endif /* CONFIG_HAS_PIRQ */
+
+static XSM_INLINE int cf_check xsm_map_domain_irq(
+    XSM_DEFAULT_ARG struct domain *d, int irq, const void *data)
 {
-    XSM_ASSERT_ACTION(XSM_DM_PRIV);
+    XSM_ASSERT_ACTION(XSM_HOOK);
     return xsm_default_action(action, current->domain, d);
 }
 
diff --git a/xen/include/xsm/hooks.h b/xen/include/xsm/hooks.h
index 8dbce67bd1..97b0d95169 100644
--- a/xen/include/xsm/hooks.h
+++ b/xen/include/xsm/hooks.h
@@ -65,9 +65,12 @@ XSM_HOOK(int, kexec)
 
 XSM_HOOK(int, schedop_shutdown, struct domain *, struct domain *)
 
+#ifdef CONFIG_HAS_PIRQ
 XSM_HOOK(int, map_domain_pirq, struct domain *)
-XSM_HOOK(int, map_domain_irq, struct domain *, int, const void *)
 XSM_HOOK(int, unmap_domain_pirq, struct domain *)
+#endif
+
+XSM_HOOK(int, map_domain_irq, struct domain *, int, const void *)
 XSM_HOOK(int, unmap_domain_irq, struct domain *, int, const void *)
 XSM_HOOK(int, bind_pt_irq, struct domain *, struct xen_domctl_bind_pt_irq *)
 XSM_HOOK(int, unbind_pt_irq, struct domain *, struct xen_domctl_bind_pt_irq *)
diff --git a/xen/xsm/flask/hooks.c b/xen/xsm/flask/hooks.c
index d861b08d8b..bd9d9e1bcf 100644
--- a/xen/xsm/flask/hooks.c
+++ b/xen/xsm/flask/hooks.c
@@ -1018,11 +1018,20 @@ static char *cf_check flask_show_irq_sid(int irq)
     return ctx;
 }
 
+#ifdef CONFIG_HAS_PIRQ
+
 static int cf_check flask_map_domain_pirq(struct domain *d)
 {
     return current_has_perm(d, SECCLASS_RESOURCE, RESOURCE__ADD);
 }
 
+static int cf_check flask_unmap_domain_pirq(struct domain *d)
+{
+    return current_has_perm(d, SECCLASS_RESOURCE, RESOURCE__REMOVE);
+}
+
+#endif /* CONFIG_HAS_PIRQ */
+
 static int flask_map_domain_msi (
     struct domain *d, int irq, const void *data, uint32_t *sid,
     struct avc_audit_data *ad)
@@ -1085,11 +1094,6 @@ static int cf_check flask_map_domain_irq(
     return rc;
 }
 
-static int cf_check flask_unmap_domain_pirq(struct domain *d)
-{
-    return current_has_perm(d, SECCLASS_RESOURCE, RESOURCE__REMOVE);
-}
-
 static int flask_unmap_domain_msi (
     struct domain *d, int irq, const void *data, uint32_t *sid,
     struct avc_audit_data *ad)
--
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®.