Re: [PATCH v2 02/17] x86/virt/tdx: Configure add-on features on TDX module init and update
From: Dave Hansen
Date: Thu Jun 18 2026 - 11:05:18 EST
On 6/18/26 01:13, Xu Yilun wrote:
> int tdx_module_run_update(void)
> {
> + u64 seamcall_fn = TDH_SYS_UPDATE_V0;
> struct tdx_module_args args = {};
> int ret;
>
> - ret = seamcall_prerr(TDH_SYS_UPDATE, &args);
> + if (tdx_addon_feature0) {
> + args.r9 = tdx_addon_feature0;
> + seamcall_fn = TDH_SYS_UPDATE;
> + }
Heh, and it falls apart into craziness immediately. See how it
immediately loses the logical information that there's a version 1 and a
version 0? The "1" isn't even visible. It's hidden in "TDH_SYS_UPDATE".
Isn't this a million times more sane?
struct tdx_module_args args = {};
u64 version;
int ret;
if (tdx_addon_feature0) {
args.r9 = tdx_addon_feature0;
version = 1;
} else {
version = 0;
}
ret = seamcall_prerr(TDH_SYS_UPDATE, version, &args);
There's also zero stopping us from putting version in args:
struct tdx_module_args args = {};
int ret;
if (tdx_addon_feature0) {
args.r9 = tdx_addon_feature0;
args.version = 1;
}
ret = seamcall_prerr(TDH_SYS_UPDATE, &args);
Eh?
That gives args.version==0 in all the normal cases which just happens to
be the exact behavior we want. It also avoids having to plumb version
through all the seamcall*() wrappers.
But this is *exactly* the kind of thing that shouldn't be a part of an
attestation patch series. This could very much have been a separate
discussion and happened a month or a year ago. But now it is blocking
this DICE thing from getting done <grumble>.