From: Jan Beulich <jbeulich@suse.com>
To: "xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>
Cc: "Daniel Smith" <dpsmith@apertussolutions.com>,
"Andrew Cooper" <andrew.cooper3@citrix.com>,
"Teddy Astie" <teddy.astie@vates.tech>,
"Roger Pau Monné" <roger@xenproject.org>
Subject: [PATCH v2 08/14] XSM: pass just SBDF to xsm_{,un}map_domain_irq()
Date: Mon, 17 Aug 2026 10:54:45 +0200 [thread overview]
Message-ID: <f72a1f61-b258-4f7d-b61a-6ba04cb11207@suse.com> (raw)
In-Reply-To: <ef09b072-c935-459e-bf8b-81c96ff9cc46@suse.com>
That's what Flask needs, and by unifying the hooks flask_map_domain_msi()
can then also serve both flask_{,un}map_domain_irq().
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Daniel P. Smith <dpsmith@apertussolutions.com>
---
How come Arm doesn't use xsm_unmap_domain_irq()?
--- a/xen/arch/x86/irq.c
+++ b/xen/arch/x86/irq.c
@@ -2214,7 +2214,7 @@ int map_domain_pirq(
return 0;
}
- ret = xsm_map_domain_irq(XSM_HOOK, d, irq, msi);
+ ret = xsm_map_domain_irq(XSM_HOOK, d, irq, msi ? &msi->sbdf : NULL);
if ( ret )
{
dprintk(XENLOG_G_ERR, "dom%d: could not permit access to irq %d mapping to pirq %d\n",
@@ -2442,7 +2442,7 @@ int unmap_domain_pirq(struct domain *d,
*/
if ( !d->is_dying )
ret = xsm_unmap_domain_irq(XSM_HOOK, d, irq,
- msi_desc ? msi_desc->dev : NULL);
+ msi_desc ? &msi_desc->dev->sbdf : NULL);
if ( ret )
goto done;
--- a/xen/include/xsm/dummy.h
+++ b/xen/include/xsm/dummy.h
@@ -470,7 +470,7 @@ static XSM_INLINE int xsm_pirq_mapping(
#endif /* CONFIG_HAS_PIRQ */
static XSM_INLINE int xsm_map_domain_irq(
- XSM_DEFAULT_ARG struct domain *d, int irq, const void *data)
+ XSM_DEFAULT_ARG struct domain *d, int irq, const pci_sbdf_t *sbdf)
{
XSM_ASSERT_ACTION(XSM_HOOK);
return xsm_default_action(action, current->domain, d);
@@ -491,7 +491,7 @@ static XSM_INLINE int xsm_unbind_pt_irq(
}
static XSM_INLINE int xsm_unmap_domain_irq(
- XSM_DEFAULT_ARG struct domain *d, int irq, const void *data)
+ XSM_DEFAULT_ARG struct domain *d, int irq, const pci_sbdf_t *sbdf)
{
XSM_ASSERT_ACTION(XSM_HOOK);
return xsm_default_action(action, current->domain, d);
--- a/xen/include/xsm/hooks.h
+++ b/xen/include/xsm/hooks.h
@@ -71,8 +71,8 @@ XSM_HOOK(int, schedop_shutdown, struct d
XSM_HOOK(int, pirq_mapping, struct domain *, bool)
#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, map_domain_irq, struct domain *, int, const pci_sbdf_t *)
+XSM_HOOK(int, unmap_domain_irq, struct domain *, int, const pci_sbdf_t *)
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 *)
--- a/xen/xsm/flask/hooks.c
+++ b/xen/xsm/flask/hooks.c
@@ -1030,17 +1030,14 @@ static int cf_check flask_pirq_mapping(s
#endif /* CONFIG_HAS_PIRQ */
static int flask_map_domain_msi (
- struct domain *d, int irq, const void *data, uint32_t *sid,
+ struct domain *d, int irq, pci_sbdf_t sbdf, uint32_t *sid,
struct avc_audit_data *ad)
{
#ifdef CONFIG_HAS_PCI_MSI
- const struct msi_info *msi = data;
- uint32_t machine_bdf = msi->sbdf.sbdf;
-
AVC_AUDIT_DATA_INIT(ad, DEV);
- ad->device = machine_bdf;
+ ad->device = sbdf.sbdf;
- return security_device_sid(machine_bdf, sid);
+ return security_device_sid(sbdf.sbdf, sid);
#else
return -EINVAL;
#endif
@@ -1066,15 +1063,15 @@ static uint32_t flask_iommu_resource_use
}
static int cf_check flask_map_domain_irq(
- struct domain *d, int irq, const void *data)
+ struct domain *d, int irq, const pci_sbdf_t *sbdf)
{
uint32_t sid, dsid;
int rc = -EPERM;
struct avc_audit_data ad;
uint32_t dperm = flask_iommu_resource_use_perm(d);
- if ( irq >= nr_static_irqs && data )
- rc = flask_map_domain_msi(d, irq, data, &sid, &ad);
+ if ( irq >= nr_static_irqs && sbdf )
+ rc = flask_map_domain_msi(d, irq, *sbdf, &sid, &ad);
else
rc = get_irq_sid(irq, &sid, &ad);
@@ -1091,32 +1088,15 @@ static int cf_check flask_map_domain_irq
return rc;
}
-static int flask_unmap_domain_msi (
- struct domain *d, int irq, const void *data, uint32_t *sid,
- struct avc_audit_data *ad)
-{
-#ifdef CONFIG_HAS_PCI_MSI
- const struct pci_dev *pdev = data;
- uint32_t machine_bdf = (pdev->seg << 16) | (pdev->bus << 8) | pdev->devfn;
-
- AVC_AUDIT_DATA_INIT(ad, DEV);
- ad->device = machine_bdf;
-
- return security_device_sid(machine_bdf, sid);
-#else
- return -EINVAL;
-#endif
-}
-
static int cf_check flask_unmap_domain_irq(
- struct domain *d, int irq, const void *data)
+ struct domain *d, int irq, const pci_sbdf_t *sbdf)
{
uint32_t sid;
int rc = -EPERM;
struct avc_audit_data ad;
- if ( irq >= nr_static_irqs && data )
- rc = flask_unmap_domain_msi(d, irq, data, &sid, &ad);
+ if ( irq >= nr_static_irqs && sbdf )
+ rc = flask_map_domain_msi(d, irq, *sbdf, &sid, &ad);
else
rc = get_irq_sid(irq, &sid, &ad);
next prev parent reply other threads:[~2026-08-17 8:55 UTC|newest]
Thread overview: 18+ 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-27 18:19 ` Daniel P. Smith
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-27 18:24 ` Daniel P. Smith
2026-08-17 8:53 ` [PATCH v2 06/14] XSM: fold xsm_{,un}map_domain_pirq() hooks Jan Beulich
2026-08-27 18:25 ` Daniel P. Smith
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 ` Jan Beulich [this message]
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 ` [PATCH v2 13/14] XSM: convert remaining miscellaneous hooks Jan Beulich
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=f72a1f61-b258-4f7d-b61a-6ba04cb11207@suse.com \
--to=jbeulich@suse.com \
--cc=andrew.cooper3@citrix.com \
--cc=dpsmith@apertussolutions.com \
--cc=roger@xenproject.org \
--cc=teddy.astie@vates.tech \
--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.