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

From: Kiryl Shutsemau

Date: Mon Aug 24 2026 - 08:18:45 EST


On Fri, Aug 21, 2026 at 10:22:01PM +0000, Edgecombe, Rick P wrote:
> On Fri, 2026-08-21 at 16:22 +0100, Kiryl Shutsemau wrote:
> > On Fri, Aug 21, 2026 at 11:29:17AM +0800, Xu Yilun wrote:
> > >   static __init int init_tdx_module(void)
> > >   {
> > >    int ret;
> > > @@ -1229,6 +1253,10 @@ static __init int init_tdx_module(void)
> > >    if (ret)
> > >    goto err_reset_pamts;
> > >  
> > > + ret = init_tdx_module_extensions();
> > > + if (ret)
> > > + goto err_reset_pamts;
> > > +
> >
> > Hm. Don't we need TDH.SYS.SHUTDOWN/DISABLE on error?
> >
> > Once TDMRs are initialized the module is functional. Yanking PAMT from
> > under it is not safe AFAICS.
>
> If we reset all the memory, how is it different than bailing halfway when
> initializing the TDMRs? Some special state changes after the last TDMR is
> inited?

Hm. Yeah, it is not special. The module gets SYS_READY after
TDH.SYS.KEY.CONFIG on all CPU. So it is a new problem.

And I think it is not a problem if we never ask TDX module to manipulate
the memory.

--
Kiryl Shutsemau / Kirill A. Shutemov