From a72d552f197b9b5cc3afdf22891b27ecf4067037 Mon Sep 17 00:00:00 2001 From: Min Xu Date: Wed, 18 May 2022 11:37:16 +0800 Subject: OvmfPkg/OvmfPkgX64: Use different CcProbeLib when SMM is on or off BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3930 CcProbeLib is designed to check the vm guest type. The OvmfPkg/CcProbeLib reads the OvmfWorkArea (0x80B000) to get the vm guest type which is written by each guest (SEV or TDX guest). But in SMM drivers the access to OvmfWorkArea is illegal. PiSmmCpuDxeSmm.inf is an example. It uses IoLib which in OvmfPkgX64 BaseIoLibIntrinsicSev.inf is included. The IoLib probes if the working guest is td guest by calling CcProbe(). So CcProbeLibNull will be included when SMM_REQUIRE is set. Currently only TDVF uses CcProbe to check the guest type, and TDVF doesn't support SMM, so this fix has no side-effect. Cc: Andrew Fish Cc: Leif Lindholm Cc: Michael D Kinney Cc: Dann Frazier Cc: Erdem Aktas Cc: James Bottomley Cc: Jiewen Yao Cc: Tom Lendacky Cc: Liming Gao Tested-by: dann frazier Reviewed-by: Jiewen Yao Signed-off-by: Min Xu --- OvmfPkg/OvmfPkgX64.dsc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'OvmfPkg') diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc index c01355e..7b3d48a 100644 --- a/OvmfPkg/OvmfPkgX64.dsc +++ b/OvmfPkg/OvmfPkgX64.dsc @@ -171,7 +171,6 @@ PciCapLib|OvmfPkg/Library/BasePciCapLib/BasePciCapLib.inf PciCapPciSegmentLib|OvmfPkg/Library/BasePciCapPciSegmentLib/BasePciCapPciSegmentLib.inf PciCapPciIoLib|OvmfPkg/Library/UefiPciCapPciIoLib/UefiPciCapPciIoLib.inf - CcProbeLib|OvmfPkg/Library/CcProbeLib/CcProbeLib.inf IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsicSev.inf OemHookStatusCodeLib|MdeModulePkg/Library/OemHookStatusCodeLibNull/OemHookStatusCodeLibNull.inf SerialPortLib|PcAtChipsetPkg/Library/SerialIoLib/SerialIoLib.inf @@ -198,6 +197,9 @@ !if $(SMM_REQUIRE) == FALSE LockBoxLib|OvmfPkg/Library/LockBoxLib/LockBoxBaseLib.inf + CcProbeLib|OvmfPkg/Library/CcProbeLib/CcProbeLib.inf +!else + CcProbeLib|MdePkg/Library/CcProbeLibNull/CcProbeLibNull.inf !endif CustomizedDisplayLib|MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLib.inf FrameBufferBltLib|MdeModulePkg/Library/FrameBufferBltLib/FrameBufferBltLib.inf -- cgit v1.1