Hi, Vishal

TESTED_MEMORY_ATTRIBUTES is expected to be set by host VMM. Please see [TDVF] Table 7-1

[TDVF] https://www.intel.com/content/dam/develop/external/us/en/documents/tdx-virtual-firmware-design-guide-rev-1.01.pdf

 

Below is the TDVF log (in the very beginning).

   1 Intel Tdx Started with (GPAW: 52, Cpus: 8)

   2

   3 ResourceType: 0x0                       ß EFI_RESOURCE_SYSTEM_MEMORY

   4 ResourceAttribute: 0x4000007  ß 7 is TESTED_MEMORY_ATTRIBUTES

   5 PhysicalStart: 0x0

   6 ResourceLength: 0x800000

 

TransferTdxHobList just copy the ResourceAttribute from host Vmm.

 

In your mail you mentioned “Function CoreInitializeMemoryServices (from ./MdeModulePkg/Core/Dxe/Gcd/Gcd.c) is not able to find any resources with TESTED_MEMORY_ATTRIBUTES set”.  Can you explain more about it? Have you added some logs?

 

From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Vishal Annapurve via groups.io
Sent: Friday, January 14, 2022 3:19 AM
To: Xu, Min M <min.m.xu@intel.com>; devel@edk2.groups.io
Subject: Re: [edk2-devel] [PATCH V4 22/31] OvmfPkg: Update PlatformPei to support TDX

 

Hi Min,

+/**
+ Transfer the incoming HobList for the TD to the final HobList for Dxe.
+ The Hobs transferred in this function are ResourceDescriptor hob and
+ MemoryAllocation hob.
+
+ @param[in] VmmHobList The Hoblist pass the firmware
+
+**/
+VOID
+EFIAPI
+TransferTdxHobList (
+ VOID
+ )
+{
+ EFI_PEI_HOB_POINTERS Hob;
+ EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttribute;
+
+ //
+ // PcdOvmfSecGhcbBase is used as the TD_HOB in Tdx guest.
+ //
+ Hob.Raw = (UINT8 *)(UINTN)PcdGet32 (PcdOvmfSecGhcbBase);
+ while (!END_OF_HOB_LIST (Hob)) {
+ switch (Hob.Header->HobType) {
+ case EFI_HOB_TYPE_RESOURCE_DESCRIPTOR:
+ ResourceAttribute = Hob.ResourceDescriptor->ResourceAttribute;
+

I am trying to test TDX functionality with config A patches (Wave1 + Wave2.v4) and with the above function passing the memory attributes of the resources in TD HOB list (Originally populated by VMM) as is to DXE phase,
Function CoreInitializeMemoryServices (from ./MdeModulePkg/Core/Dxe/Gcd/Gcd.c) is not able to find any resources with TESTED_MEMORY_ATTRIBUTES set.

For config A, Is there an expectation from VMM to set TESTED_MEMORY_ATTRIBUTES for each System Memory resource passed via TD HOB list or should this function
be appending TESTED_MEMORY_ATTRIBUTES to existing resource attributes?

Regards,
Vishal