Re: [PATCH v2 3/5] x86/virt/tdx: Detect if the extensions initialization is required

From: Xu Yilun

Date: Fri Sep 18 2026 - 06:01:50 EST


> > +static __init int init_tdx_module_extensions(void)
> > +{
> > + int ret;
> > +
> > + if (!(tdx_sysinfo.features.tdx_features0 & TDX_FEATURES0_EXT))
> > + return 0;
> > +
> > + ret = get_tdx_sys_info_ext(&tdx_sysinfo.ext);
> > + if (ret)
> > + return ret;
> > +
> > + /*
> > + * ext_required indicates if any add-on features requiring TDX module
> > + * extensions are configured via TDH.SYS.CONFIG. If none, skip the
> > + * initialization.
> > + */
> > + if (!tdx_sysinfo.ext.ext_required)
> > + return 0;
>
> Hmm, now that we don't need to do this on update, we don't need to save
> ext.ext_required metadata.

Good to me.

>
> Also, per:
> https://lore.kernel.org/all/aox8DgpnSnhZRfCv@yilunxu-OptiPlex-7050/
> the reason we even need to check anything is because TDH_EXT_INIT returns a
> strange error code TDX_EXT_MEMORY_POOL_REQUIRED. In the case of a TDX module
> that supports extensions, but none that the kernel knows about... what if
> TDH_EXT_INIT returned SUCCESS meaning that all requested extensions (0 of them)
> are initialized.
>
> AFAICT the specs don't describe what to do in this situation. But does describe
> SUCCESS as a possible error code. And TDX_EXT_MEMORY_POOL_REQUIRED is wrong. So
> its probably the most sensible bug fix anyway.

I raised to the module team, and they will fix it.

>
> Then basically this patch goes away? We still check TDX_FEATURES0_EXT, but it
> can be squashed into the other one?

Good to me.