Re: [PATCH v5 5/6] x86/virt/tdx: Make TDX module initialize the extensions
From: Xu Yilun
Date: Wed Nov 25 2026 - 02:37:12 EST
On Tue, Nov 24, 2026 at 08:01:39AM +0000, Tian, Kevin wrote:
> > From: Xu Yilun <yilun.xu@xxxxxxxxxxxxxxx>
> > Sent: Wednesday, November 11, 2026 11:49 AM
> >
> [...]
> > static __init int init_tdx_module_extensions(void)
> > {
> > + int ret;
> > +
> > if (!(tdx_sysinfo.features.tdx_features0 & TDX_FEATURES0_EXT))
> > return 0;
> >
> > - return tdx_ext_mem_setup();
> > + ret = tdx_ext_mem_setup();
> > + if (ret)
> > + return ret;
> > +
> > + return tdx_ext_init();
> > }
> >
>
> Above means that tdx_ext_init() will be called even when ext.required_pages
> is 0, e.g. when TDX_KERNEL_SUPPORTED_ADDON_FEATURES0 is null as this
> series stands or on a platform which reports TDX_FEATURES0_EXT but no
> any add-on features (would it happen?).
>
> Just want to confirm that doing so won't hit an error.
It's fine. TDH.EXT.INIT should return success if no extensions are
required. This is discussed in v2 and v3 cover-letter states that:
Rick pointed out that if TDH.EXT.INIT could always return a reasonable
return code, we don't have to query ext_required metadata. A fix for the
ABI is: TDH.EXT.INIT should return success if no extensions are
required. We reached agreement with TDX module team and removed
ext_required.
Oh, there is still ambiguity here, we don't ask TDX module to delete
ext_required. We removed kernel code that reads and checks ext_required.