]> git.proxmox.com Git - mirror_edk2.git/commitdiff
OvmfPkg/SmmCpuFeaturesLib: Check SmBase relocation supported or not
authorWu, Jiaxin <jiaxin.wu@intel.com>
Thu, 16 Feb 2023 06:16:33 +0000 (14:16 +0800)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Mon, 6 Mar 2023 06:07:48 +0000 (06:07 +0000)
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4337

This patch is to check SmBase relocation supported or not.
If gSmmBaseHobGuid found, means SmBase info has been relocated
and recorded in the SmBase array. ASSERT it's not supported in OVMF.

Cc: Eric Dong <eric.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Zeng Star <star.zeng@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
OvmfPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c
OvmfPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.inf

index 6693666d043f812767ef8682f009fd0f6f0e94fa..a1dd10c9f23bbb004586c8ed2d753b7fa29bb494 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   The CPU specific programming for PiSmmCpuDxeSmm module.\r
 \r
-  Copyright (c) 2010 - 2015, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2010 - 2023, Intel Corporation. All rights reserved.<BR>\r
 \r
   SPDX-License-Identifier: BSD-2-Clause-Patent\r
 **/\r
 #include <Library/SmmCpuFeaturesLib.h>\r
 #include <Library/SmmServicesTableLib.h>\r
 #include <Library/UefiBootServicesTableLib.h>\r
+#include <Library/HobLib.h>\r
 #include <Pcd/CpuHotEjectData.h>\r
 #include <PiSmm.h>\r
 #include <Register/Intel/SmramSaveStateMap.h>\r
 #include <Register/QemuSmramSaveStateMap.h>\r
+#include <Guid/SmmBaseHob.h>\r
 \r
 //\r
 // EFER register LMA bit\r
@@ -43,6 +45,12 @@ SmmCpuFeaturesLibConstructor (
   IN EFI_SYSTEM_TABLE  *SystemTable\r
   )\r
 {\r
+  //\r
+  // If gSmmBaseHobGuid found, means SmBase info has been relocated and recorded\r
+  // in the SmBase array. ASSERT it's not supported in OVMF.\r
+  //\r
+  ASSERT (GetFirstGuidHob (&gSmmBaseHobGuid) == NULL);\r
+\r
   //\r
   // No need to program SMRRs on our virtual platform.\r
   //\r
index 8a426a4c10fb437bd36aaf2e7c2ccf7f76e5b84f..2697a90525bb87bc4d2abde099f8655ebb8c33be 100644 (file)
@@ -1,7 +1,7 @@
 ## @file\r
 #  The CPU specific programming for PiSmmCpuDxeSmm module.\r
 #\r
-#  Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.<BR>\r
+#  Copyright (c) 2009 - 2023, Intel Corporation. All rights reserved.<BR>\r
 #\r
 #  SPDX-License-Identifier: BSD-2-Clause-Patent\r
 #\r
   SafeIntLib\r
   SmmServicesTableLib\r
   UefiBootServicesTableLib\r
+  HobLib\r
+\r
+[Guids]\r
+  gSmmBaseHobGuid                ## CONSUMES\r
 \r
 [Pcd]\r
   gUefiCpuPkgTokenSpaceGuid.PcdCpuMaxLogicalProcessorNumber\r