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

From: Dan Williams
Date: Fri Apr 29 2022 - 11:19:12 EST


On Fri, Apr 29, 2022 at 7:39 AM Dave Hansen <dave.hansen@xxxxxxxxx> wrote:
>
> On 4/28/22 19:58, Dan Williams wrote:
> > That only seems possible if the kernel is given a TDX capable physical
> > address map at the beginning of time.
>
> TDX actually brings along its own memory map. The "EAS"[1]. has a lot
> of info on it, if you know where to find it. Here's the relevant chunk:
>
> CMR - Convertible Memory Range -
> A range of physical memory configured by BIOS and verified by
> MCHECK. MCHECK verificatio n is intended to help ensure that a
> CMR may be used to hold TDX memory pages encrypted with a
> private HKID.
>
> So, the BIOS has the platform knowledge to enumerate this range. It
> stashes the information off somewhere that the TDX module can find it.
> Then, during OS boot, the OS makes a SEAMCALL (TDH.SYS.CONFIG) to the
> TDX module and gets the list of CMRs.
>
> The OS then has to reconcile this CMR "memory map" against the regular
> old BIOS-provided memory map, tossing out any memory regions which are
> RAM, but not covered by a CMR, or disabling TDX entirely.
>
> Fun, eh?

Yes, I want to challenge the idea that all core-mm memory must be TDX
capable. Instead, this feels more like something that wants a
hugetlbfs / dax-device like capability to ask the kernel to gather /
set-aside the enumerated TDX memory out of all the general purpose
memory it knows about and then VMs use that ABI to get access to
convertible memory. Trying to ensure that all page allocator memory is
TDX capable feels too restrictive with all the different ways pfns can
get into the allocator.