Re: [PATCH v2 11/31] x86/virt/tdx: Make TDX Module initialize Extensions

Xu Yilun
2026-04-08T08:46:18Z

On Wed, Apr 01, 2026 at 11:42:36AM +0000, Huang, Kai wrote:
> On Tue, 2026-03-31 at 22:58 +0800, Xu Yilun wrote:
> > > > + /*
> > > > + * ext_required == 0 means no need to call TDH.EXT.INIT, the Extensions
> > > > + * are already working.
> > >
> > > How does this scenario happen exactly? And why not check it above at the
> > > beginning? Before the allocation, so it doesn't need to free.
> > >
> > > Is there a scenario where the memory needs to be given, but the extension is
> > > already inited?
> >
> > mm.. you are right. It leads to something absurd.
> >
> > I checked with TDX Module team again. The correct understanding is:
> >
> >  - TDX_FEATURES0_EXT bit shows Extensions is supported.
> >  - optional feature bits are selected on TDH_SYS_CONFIG
> >  - If one of the optional feature (e.g. TDX CONNECT) requires Extention,
> >    memory_pool_required_pages > 0 && ext_required == 1. Otherwise no
> >    need to initialize Extension.
> >
> > So yes, I should check memory_pool_required_pages && ext_required at the
> > beginning.
>
> My understanding is different:
>
> Per spec, the 'EXT_REQUIRED' global metadata just means "Return true if the
> TDH.EXT.INIT is required to be called", so I think, architecturally, it's

Maybe these text should be improved. They just literally tell how, so leads
to our disagreement.

> possible that one particular feature only requires additional memory pool
> but doesn't explicitly need to call TDH.EXT.INIT. Or some feature may not
> require any additional memory pool but needs TDH.EXT.INIT.

This is different from what I've been told by TDX Module team. Do you
have a real setup like that?

My gut feeling also tells me there is little chance that:

1. The Extensions is already working (cause no need to call
TDH.EXT.INIT) while we are still adding memory.
2. The Extensions could enable long running / hard-irq preemptible
flows with no memory consumption.