Re: [PATCH] x86/virt/tdx: Formalize SEAMCALL version encoding support
From: Xu Yilun
Date: Tue Jul 07 2026 - 11:46:00 EST
On Fri, Jul 03, 2026 at 08:00:38AM +0800, Xiaoyao Li wrote:
> On 7/2/2026 10:46 PM, Xu Yilun wrote:
> > +/*
> > + * SEAMCALL leaf:
> > + *
> > + * Bit 15:0 Leaf number
> > + * Bit 23:16 Version number
> > + */
> > +#define SEAMCALL_VERSION_MASK GENMASK_U64(23, 16)
> > +
> > +static __always_inline u64 __seamcall_encode_fn(sc_func_t func, u64 fn,
> > + struct tdx_module_args *args)
> > +{
> > + FIELD_MODIFY(SEAMCALL_VERSION_MASK, &fn, args->version);
> > +
> > + return func(fn, args);
> > +}
> > +
> > static __always_inline u64 __seamcall_dirty_cache(sc_func_t func, u64 fn,
> > struct tdx_module_args *args)
> > {
> > @@ -39,7 +56,7 @@ static __always_inline u64 __seamcall_dirty_cache(sc_func_t func, u64 fn,
> > */
> > this_cpu_write(cache_state_incoherent, true);
> > - return func(fn, args);
> > + return __seamcall_encode_fn(func, fn, args);
> > }
>
> Can we drop the new wrapper? I don't see why we need it. The wrapper makes
> the code harder to read.
OK, will call FIELD_MODIFY() directly in __seamcall_dirty_cache()
>
>