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

From: Xu Yilun

Date: Mon Sep 07 2026 - 22:07:08 EST


On Mon, Sep 07, 2026 at 07:35:31AM -0700, Dave Hansen wrote:
> On 9/7/26 04:20, Tony Lindgren wrote:
> > /*
> > - * Used in __tdcall*() to gather the input/output registers' values of the
> > - * TDCALL instruction when requesting services from the TDX module. This is a
> > - * software only structure and not part of the TDX module/VMM ABI
> > + * Used in __tdcall*() to gather the input/output parameters of the TDCALL
> > + * instruction when requesting services from the TDX module. "version" is
> > + * encoded in RAX along with the leaf number. Others are raw input/output
> > + * registers' values. This is a software only structure and not part of the TDX
> > + * module/VMM ABI.
> > */
>
> It's a wee bit silly to talk about "version" in here. If you need to
> comment on "version" specifically, then put a comment *on* that variable.

Yes. I'll recover the original structure description and comment on the
"version".

And Thank Tony for the description for "version".

----8<----

/*
- * Used in __tdcall*() to gather the input/output parameters of the TDCALL
- * instruction when requesting services from the TDX module. "version" is
- * encoded in RAX along with the leaf number. Others are raw input/output
- * registers' values. This is a software only structure and not part of the TDX
- * module/VMM ABI.
+ * Used in __tdcall*() to gather the input/output registers' values of the
+ * TDCALL instruction when requesting services from the TDX module. This is a
+ * software only structure and not part of the TDX module/VMM ABI
*/
struct tdx_module_args {
/* callee-clobbered */
@@ -145,7 +143,10 @@ struct tdx_module_args {
u64 rbx;
u64 rdi;
u64 rsi;
- /* leaf ABI version, encoded in rax */
+ /*
+ * leaf ABI version. Note that it gets encoded into RAX along with the
+ * leaf number.
+ */
u8 version;
};