Re: [PATCH v2] x86/virt/tdx: Formalize SEAMCALL version encoding support
From: Dave Hansen
Date: Fri Jul 10 2026 - 12:54:20 EST
On 7/10/26 09:21, Kiryl Shutsemau wrote:
> The version is not a register operand, it is part of the function
> number.
I'm not sure why that's important.
Sure, the arg structure is all full registers now. But it's not even all
the registers because RAX isn't there. So let's say we made the data
structure smarter:
struct tdx_module_args {
union {
u64 rax;
struct {
u16 function_nr;
u8 version
u8 padding0;
u32 flags;
};
};
u64 rcx;
u64 rdx;
...
}
All of the:
struct tdx_module_args args = {};
instances would default to version=0. It would take a one-liner to get
bit 63 set:
static int seamldr_call(u64 fn, struct tdx_module_args *args)
{
...
+ args->flags |= SEAMLDR_BIT;
guard(raw_spinlock)(&seamldr_lock);
return seamcall_prerr(fn, args);
}
The truth of the matter is that 'fn' *IS* the RAX from the TDX ABI.
We're carrying it around the kernel in that format, and it just doesn't
work very well.
The alternative is to carry the logical pieces of RAX around the kernel
and them assemble RAX out of them in one (or very few) places. *Not* to
build RAX in the TDX module ABI early far from the TDX module ABI layer
itself.