summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastien Boeuf <sebastien.boeuf@intel.com>2022-12-15 23:10:02 +0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2022-12-16 02:37:56 +0000
commite03b0d06726c0a2c3fa4a6aff43a8c584172767b (patch)
tree715d81dc8caa4c11a301728cb49409f8d9ef88a3
parent0adc35fccd59c8c5171273319ec899aa48fc2c35 (diff)
downloadedk2-e03b0d06726c0a2c3fa4a6aff43a8c584172767b.tar.gz
edk2-e03b0d06726c0a2c3fa4a6aff43a8c584172767b.tar.bz2
edk2-e03b0d06726c0a2c3fa4a6aff43a8c584172767b.zip
OvmfPkg/PlatformInitLib: Differentiate TDX case for Cloud Hypervisor
Rely on the CcProbe() function to identify when running on TDX. This allows the firmware to follow a different codepath for Cloud Hypervisor, which means it doesn't rely on PVH to find out about memory below 4GiB. instead it falls back onto the CMOS to retrieve that information. Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com> Reviewed-by: Min Xu <min.m.xu@intel.com> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
-rw-r--r--OvmfPkg/Library/PlatformInitLib/MemDetect.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/OvmfPkg/Library/PlatformInitLib/MemDetect.c b/OvmfPkg/Library/PlatformInitLib/MemDetect.c
index b8feae4309..6dbdbf9306 100644
--- a/OvmfPkg/Library/PlatformInitLib/MemDetect.c
+++ b/OvmfPkg/Library/PlatformInitLib/MemDetect.c
@@ -26,6 +26,7 @@ Module Name:
//
#include <Library/BaseLib.h>
#include <Library/BaseMemoryLib.h>
+#include <Library/CcProbeLib.h>
#include <Library/DebugLib.h>
#include <Library/HardwareInfoLib.h>
#include <Library/HobLib.h>
@@ -312,7 +313,9 @@ PlatformGetSystemMemorySizeBelow4gb (
UINT8 Cmos0x34;
UINT8 Cmos0x35;
- if (PlatformInfoHob->HostBridgeDevId == CLOUDHV_DEVICE_ID) {
+ if ((PlatformInfoHob->HostBridgeDevId == CLOUDHV_DEVICE_ID) &&
+ (CcProbe () != CcGuestTypeIntelTdx))
+ {
// Get the information from PVH memmap
return (UINT32)GetHighestSystemMemoryAddressFromPvhMemmap (TRUE);
}