Re: [PATCH v3] x86/virt/tdx: Formalize SEAMCALL version encoding support

From: Kishen Maloor

Date: Fri Sep 11 2026 - 16:28:02 EST


On 7/22/26 1:46 AM, Xu Yilun wrote:
> ...
> +/*
> + * SEAMCALL leaf:
> + *
> + * Bit 15:0 Leaf number
> + * Bit 23:16 Leaf ABI version number
> + * Bit 24 Pending interrupts detection mode
> + * Bit 63 1 for P-SEAMLDR leaf, 0 for TDX module leaf
> + */
> +#define SEAMCALL_LEAF_MASK GENMASK_U64(15, 0)
> +#define SEAMCALL_SEAMLDR_MASK BIT_U64(63)
> +
> static __always_inline u64 __seamcall_dirty_cache(sc_func_t func, u64 fn,
> struct tdx_module_args *args)
> {
> + /*
> + * fn contains base leaf number for TDX module calls and P-SEAMLDR
> + * calls. Other fields in SEAMCALL leaf like leaf ABI version number
> + * are in struct tdx_module_args.
> + */
> + BUILD_BUG_ON(fn & ~(SEAMCALL_LEAF_MASK | SEAMCALL_SEAMLDR_MASK));
The changelog lists the SEAMLDR flag among the RAX fields that are not a good fit
for the function number definition, but 'fn' still carries it. Why does 'version'
get a field in struct tdx_module_args while the SEAMLDR flag stays in 'fn'?

Otherwise, looks fine.

Reviewed-by: Kishen Maloor <kishen.maloor@xxxxxxxxx>