Re: [PATCH 03/24] XSM: make .{,un}map_domain_pirq() hooks dependent upon HAS_PIRQ=y

"Daniel P. Smith" <[email protected]> Sun, 2 Aug 2026 10:50:41 -0400
Newsgroups gmane.comp.emulators.xen.devel
Message-ID <[email protected]>
On 7/28/26 9:14 AM, Jan Beulich wrote:
> They're unreachable / dead otherwise.
> 
> Signed-off-by: Jan Beulich <[email protected]>
> 
> --- a/xen/include/xsm/dummy.h
> +++ b/xen/include/xsm/dummy.h
> @@ -450,6 +450,8 @@ static XSM_INLINE char *cf_check xsm_sho
>       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_d
>       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);
>   }
>   
> --- 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 *)
> --- a/xen/xsm/flask/hooks.c
> +++ b/xen/xsm/flask/hooks.c
> @@ -1018,11 +1018,20 @@ static char *cf_check flask_show_irq_sid
>       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)
> 

Acked-by: Daniel P. Smith <[email protected]>