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

From: Xu Yilun

Date: Mon Jul 27 2026 - 08:51:08 EST


On Fri, Jul 24, 2026 at 04:44:15PM +0800, Xiaoyao Li wrote:
> On 6/30/2026 7:10 PM, Xu Yilun wrote:
> > On Mon, Jun 29, 2026 at 02:33:56PM +0800, Chao Gao wrote:
> > > > +static __init int init_tdx_module_extensions(void)
> > > > +{
> > > > + struct tdx_sys_info_ext sysinfo_ext;
> > > > + int ret;
> > > > +
> > > > + if (!(tdx_sysinfo.features.tdx_features0 & TDX_FEATURES0_EXT))
> > > > + return 0;
> > > > +
> > > > + ret = get_tdx_sys_info_ext(&sysinfo_ext);
> > > > + if (ret)
> > > > + return ret;
> > > > +
> > > > + /* Skip if no feature requires TDX module extensions. */
> > > > + if (!sysinfo_ext.ext_required)
> > > > + return 0;
> > >
> > > What would happen if the kernel doesn't do this 'ext_required' check
> > > and always does the extension initialization?
> > >
> > > If TDH.EXT.INIT returns success when no extension is configured, we
> >
> > No, TDH.EXT.INIT fails when ext_required==false
>
> What is the SEAMCALL return code in this case?

It will return TDX_EXT_MEMORY_POOL_NOT_READY, because TDX module's internal
state machine stays at the first step of extensions' initialization.

>
> > > could drop this 'ext_required' from this series entirely.
>