Re: [PATCH v3 00/21] TDX host kernel support

From: Dave Hansen
Date: Tue May 03 2022 - 20:25:24 EST


On 5/3/22 16:59, Kai Huang wrote:
> Should be:
>
> // prevent racing with TDX module initialization */
> tdx_init_disable();
>
> if (tdx_module_initialized()) {
> if (new_memory_resource in TDMRs)
> // allow memory hot-add
> else
> // reject memory hot-add
> } else if (new_memory_resource in CMR) {
> // add new memory to TDX memory so it can be
> // included into TDMRs
>
> // allow memory hot-add
> }
> else
> // reject memory hot-add
>
> tdx_module_enable();
>
> And when platform doesn't TDX, always allow memory hot-add.

I don't think it even needs to be *that* complicated.

It could just be winner take all: if TDX is initialized first, don't
allow memory hotplug. If memory hotplug happens first, don't allow TDX
to be initialized.

That's fine at least for a minimal patch set.

What you have up above is probably where you want to go eventually, but
it means doing things like augmenting the e820 since it's the single
source of truth for creating the TMDRs right now.