From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by mx.groups.io with SMTP id smtpd.web09.6696.1652791444281211050 for ; Tue, 17 May 2022 05:44:05 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=bHmIqDDy; spf=pass (domain: intel.com, ip: 134.134.136.20, mailfrom: min.m.xu@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1652791444; x=1684327444; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=/nFFFVoiWSvvTre5QBT5yd2gWtsDjclfo7IW92Unx6s=; b=bHmIqDDy7yHdKxT1rx8EH4Tb3ETqXDpah0uaU1EGo+jVxd/swh+aylEQ yTuv136+vPr5zu1C2qir7o86WBttvI5jjMBqil6Y1ch9xvdE6GzPYjz5y 85MDeX4r1ISxQJDZNEVVieWGTOskfZdIts1wF2pZkNtcKsBvfqFX1B7F5 Vr6qN3ndPuLgq8Mz9A3JagK9B+lKBNBGavDHvkmby3BKpfzVjJXzDDc8x LXiX9IFXPm8fcoNr2mbW7JOf0cJGlLFktx+KjM6f9YAFKg7RUwVXwZyiX eoLs6486Wzx7g71sVBX0YnBnKKycsCYlUhIt7YlLpukotnX2G1DBbXU7R Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10349"; a="258732499" X-IronPort-AV: E=Sophos;i="5.91,232,1647327600"; d="scan'208";a="258732499" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 May 2022 05:44:03 -0700 X-IronPort-AV: E=Sophos;i="5.91,232,1647327600"; d="scan'208";a="568875250" Received: from mxu9-mobl1.ccr.corp.intel.com ([10.255.31.65]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 May 2022 05:44:01 -0700 From: "Min Xu" To: devel@edk2.groups.io Cc: Min Xu , dann frazier , Erdem Aktas , James Bottomley , Jiewen Yao , Tom Lendacky Subject: [PATCH] OvmfPkg/OvmfPkgX64: Use different CcProbeLib when SMM is on or off Date: Tue, 17 May 2022 20:43:14 +0800 Message-Id: <20220517124314.1021-1-min.m.xu@intel.com> X-Mailer: git-send-email 2.29.2.windows.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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: dann frazier Cc: Erdem Aktas Cc: James Bottomley Cc: Jiewen Yao Cc: Tom Lendacky Signed-off-by: Min Xu --- OvmfPkg/OvmfPkgX64.dsc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc index 71526bba31..db7f4def7a 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 -- 2.29.2.windows.2