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

Re: [PATCH v2 08/14] XSM: pass just SBDF to xsm_{,un}map_domain_irq()




On 12/3/26 2:43 AM, Jan Beulich wrote:
On 02.12.2026 20:46, Daniel P. Smith wrote:
On 8/17/26 4:54 AM, Jan Beulich wrote:
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@xxxxxxxx>
Acked-by: Daniel P. Smith <dpsmith@xxxxxxxxxxxxxxxxxxxx>
---
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);

I know I acked this, and confirmed that action this morning, but I was
thinking about it further would it hurt to make this:


msi_desc && msi_desc->dev ? &msi_desc->dev->sbdf : NULL);

"hurt" as in what exactly? Yes, we could extend it, but doing so would
effectively add dead code (in [at least] Misra's terms).
I am uncertain how the addition of a likely true condition to a test would create dead code. But in terms of MISRA, would accessing a pointer that could potentially be NULL not be a violation of Directive 4.1, minimize run-time failures which explicitly calls out checks for pointer dereferencing? Currently, only the top level pointer is checked with the assumption that any future code, as current code paths have been validated, will not result in dev being NULL.

v/r,
dps



 


Rackspace

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