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

From: Edgecombe, Rick P

Date: Thu Sep 10 2026 - 16:21:11 EST


On Thu, 2026-09-10 at 18:43 +0800, Xu Yilun wrote:
> The TDX architecture includes a syscall-like ABI for OSes to communicate
> with SEAM mode software. This ABI has the concept of a "leaf". Each leaf
> is roughly analogous to a Linux syscall: it has a set of register
> arguments and does one logical thing like adding a page of memory to a
> VM or running a VM. The TDX architecture refers to this interface
> function as a "SEAMCALL leaf".
>
> Just like syscalls, the TDX architecture wants to evolve the ABI to
> extend functionality while keeping compatibility. But unlike syscalls,
> which do this by picking a totally new syscall number, the ABI encodes
> the "version" number directly into the bits of a register argument. So
> instead of openatN being whatever the next free number is, the SEAMCALL
> leaf number and version number are encoded into certain bits in how the
> RAX register is defined in the ABI.
>
> In Linux, several seamcall*() wrappers have been introduced to invoke
> SEAMCALL leafs. They all take a u64 "fn" argument for the leaf number
> which eventually get set in the register. As above, the version number
> lives in the same register as the leaf number. So callers that want to
> select a specific version of the leaf, can jam it in the right place in
> the register by passing it in the "fn" argument. Today only the caller
> of TDH.VP.INIT does this hack, but future kernel changes will need to
> select versions for more SEAMCALL leafs, so a less hacky solution is
> needed.

Only nit is that this would probably read a little bit smoother as two
sentences. Everything else looks good.

Reviewed-by: Rick Edgecombe <rick.p.edgecombe@xxxxxxxxx>