Re: [PATCH 17/24] XSM: make Argo hooks well-formed ones

Jason Andryuk <[email protected]> Mon, 3 Aug 2026 17:01:43 -0400
Newsgroups gmane.comp.emulators.xen.devel
Message-ID <[email protected]>
On 2026-07-28 09:22, Jan Beulich wrote:
> For whatever reason they didn't have an xsm_default_t first argument (to
> cope with XSM=n mode), making it impossible to (easily) cover them in
> xsm/hooks.h.
> 
> To be able to retain the const on their function parameters, adjust
> xsm_default_action() accordingly.
> 
> Signed-off-by: Jan Beulich <[email protected]>

> --- a/xen/include/xsm/dummy.h
> +++ b/xen/include/xsm/dummy.h

> @@ -751,27 +751,32 @@ static XSM_INLINE int xsm_dm_op(XSM_DEFA
>   #endif
>   
>   #ifdef CONFIG_ARGO
> -static XSM_INLINE int xsm_argo_enable(const struct domain *d)
> +
> +static XSM_INLINE int xsm_argo_enable(XSM_DEFAULT_ARG const struct domain *d)
>   {
> -    return 0;
> +    XSM_ASSERT_ACTION(XSM_HOOK);
> +    return xsm_default_action(action, current->domain, d);

This one I think should be
     return xsm_default_action(action, d, NULL);

Usually current is passed in for the check, but for domain_create() -> 
argo_init() it is the under-construction domain.
>   }
>   
>   static XSM_INLINE int xsm_argo_register_single_source(
> -    const struct domain *d, const struct domain *t)
> +    XSM_DEFAULT_ARG const struct domain *d, const struct domain *t)
>   {
> -    return 0;
> +    XSM_ASSERT_ACTION(XSM_HOOK);
> +    return xsm_default_action(action, d, t);
>   }
>   
>   static XSM_INLINE int xsm_argo_register_any_source(
> -    const struct domain *d)
> +    XSM_DEFAULT_ARG const struct domain *d)
>   {
> -    return 0;
> +    XSM_ASSERT_ACTION(XSM_HOOK);
> +    return xsm_default_action(action, current->domain, d);

Similarly:
     return xsm_default_action(action, d, NULL);

The single call is:
xsm_argo_register_any_source(currd);

These argo hooks all pass in their arguments explicitly, so I think we 
should do that and not use current.  (The send and register hooks could 
use current, and that could make sense as those map to hypercalls.  But 
it is correct today with the explicit arguments.)

With the changes:
Reviewed-by: Jason Andryuk <[email protected]>

Thanks,
Jason

>   }
>   
>   static XSM_INLINE int xsm_argo_send(
> -    const struct domain *d, const struct domain *t)
> +    XSM_DEFAULT_ARG const struct domain *d, const struct domain *t)
>   {
> -    return 0;
> +    XSM_ASSERT_ACTION(XSM_HOOK);
> +    return xsm_default_action(action, d, t);
>   }
>   
>   #endif /* CONFIG_ARGO */