Re: [PATCH 11/24] XSM: make certain x86-specific hooks dependent upon PV=y

"Daniel P. Smith" <[email protected]> Sun, 2 Aug 2026 11:08:55 -0400
Newsgroups gmane.comp.emulators.xen.devel
Message-ID <[email protected]>
On 7/28/26 9:18 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
> @@ -640,11 +640,6 @@ static XSM_INLINE int cf_check xsm_platf
>   }
>   
>   #ifdef CONFIG_X86
> -static XSM_INLINE int cf_check xsm_do_mca(XSM_DEFAULT_VOID)
> -{
> -    XSM_ASSERT_ACTION(XSM_PRIV);
> -    return xsm_default_action(action, current->domain, NULL);
> -}
>   
>   static XSM_INLINE int cf_check xsm_mem_sharing_op(
>       XSM_DEFAULT_ARG struct domain *d, struct domain *cd, int op)
> @@ -673,6 +668,14 @@ static XSM_INLINE int cf_check xsm_domai
>       return xsm_default_action(action, current->domain, d);
>   }
>   
> +#ifdef CONFIG_PV
> +
> +static XSM_INLINE int cf_check xsm_do_mca(XSM_DEFAULT_VOID)
> +{
> +    XSM_ASSERT_ACTION(XSM_PRIV);
> +    return xsm_default_action(action, current->domain, NULL);
> +}
> +
>   static XSM_INLINE int cf_check xsm_mmu_update(
>       XSM_DEFAULT_ARG struct domain *d, struct domain *t, struct domain *f,
>       uint32_t flags)
> @@ -700,6 +703,8 @@ static XSM_INLINE int cf_check xsm_updat
>       return xsm_default_action(action, d, f);
>   }
>   
> +#endif /* CONFIG_PV */
> +
>   static XSM_INLINE int cf_check xsm_priv_mapping(
>       XSM_DEFAULT_ARG struct domain *d, struct domain *t)
>   {
> --- a/xen/include/xsm/hooks.h
> +++ b/xen/include/xsm/hooks.h
> @@ -131,14 +131,16 @@ XSM_HOOK(int, mem_sharing_op, struct dom
>   XSM_HOOK(int, platform_op, uint32_t)
>   
>   #ifdef CONFIG_X86
> -XSM_HOOK(int, do_mca)
>   XSM_HOOK(int, apic, struct domain *, int)
>   XSM_HOOK(int, machine_memory_map)
>   XSM_HOOK(int, domain_memory_map, struct domain *)
> +#ifdef CONFIG_PV
> +XSM_HOOK(int, do_mca)
>   XSM_HOOK(int, mmu_update, struct domain *, struct domain *, struct domain *,
>                             uint32_t)
>   XSM_HOOK(int, mmuext_op, struct domain *, struct domain *)
>   XSM_HOOK(int, update_va_mapping, struct domain *, struct domain *, l1_pgentry_t)
> +#endif /* CONFIG_PV */
>   XSM_HOOK(int, priv_mapping, struct domain *, struct domain *)
>   XSM_HOOK(int, ioport_permission, struct domain *, uint32_t, uint32_t, uint8_t)
>   XSM_HOOK(int, ioport_mapping, struct domain *, uint32_t, uint32_t, uint8_t)
> --- a/xen/xsm/flask/hooks.c
> +++ b/xen/xsm/flask/hooks.c
> @@ -1654,10 +1654,6 @@ static int cf_check flask_platform_op(ui
>   }
>   
>   #ifdef CONFIG_X86
> -static int cf_check flask_do_mca(void)
> -{
> -    return domain_has_xen(current->domain, XEN__MCA_OP);
> -}
>   
>   static int flask_shadow_control(struct domain *d, unsigned int op)
>   {
> @@ -1783,6 +1779,13 @@ static int cf_check flask_domain_memory_
>       return current_has_perm(d, SECCLASS_MMU, MMU__MEMORYMAP);
>   }
>   
> +#ifdef CONFIG_PV
> +
> +static int cf_check flask_do_mca(void)
> +{
> +    return domain_has_xen(current->domain, XEN__MCA_OP);
> +}
> +
>   static int cf_check flask_mmu_update(
>       struct domain *d, struct domain *t, struct domain *f, uint32_t flags)
>   {
> @@ -1823,6 +1826,8 @@ static int cf_check flask_update_va_mapp
>       return domain_has_perm(d, f, SECCLASS_MMU, map_perms);
>   }
>   
> +#endif /* CONFIG_PV */
> +
>   static int cf_check flask_priv_mapping(struct domain *d, struct domain *t)
>   {
>       return domain_has_perm(d, t, SECCLASS_MMU, MMU__TARGET_HACK);
> 

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