Re: [RFC PATCH 14/15] x86/virt/tdx: Embed version info in SEAMCALL leaf function definitions

From: Xiaoyao Li

Date: Wed May 27 2026 - 03:45:20 EST


On 5/27/2026 2:45 PM, Xu Yilun wrote:
/*
* TDX module SEAMCALL leaf functions
*/
@@ -31,7 +44,7 @@
#define TDH_VP_CREATE 10
#define TDH_MNG_KEY_FREEID 20
#define TDH_MNG_INIT 21
-#define TDH_VP_INIT 22
+#define TDH_VP_INIT SEAMCALL_LEAF_VER(22, 1)

how about

#define TDH_VP_INIT 22
#define TDH_VP_INIT_V1 SEAMCALL_LEAF_VER(TDH_VP_INIT, 1)

and use TDH_VP_INIT_V1 below?

I'm trying to avoid a _Vx postfix if unnecessary. Don't make callers
have to choose between versions. The main MACRO should always point to
the latest version since later versions are backward compatible.

I don't agree.

The later versions are backwards compatible, but the later versions might not be supported by the loaded TDX module.

Usually the callers will have to choose between versions due to the TDX module being used varies, just like the case in the next patch.

We can make TDH_VP_INIT represent the v1 as this patch because Linux mandates v1 when the code was merged. So it can be made the default.

The next patch is an exception. I've found there is no public TDX Module
release available for TDH.SYS.CONFIG v1. I expect people just use the
un-versioned MACRO for development, but have to keep the explicitly
versioned _V0 macro for compatibility for now.