Re: [RFC PATCH 14/15] x86/virt/tdx: Embed version info in SEAMCALL leaf function definitions
From: Xu Yilun
Date: Wed May 27 2026 - 08:10:29 EST
On Wed, May 27, 2026 at 03:44:45PM +0800, Xiaoyao Li wrote:
> 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.
No, we don't choose SEAMCALL versions based on TDX module versions. The
next patch is an exception, if by the time of merging there are releases
support TDX_SYS_CONFIG v1, I'd rather delete TDX_SYS_CONFIG_V0.