From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mx.groups.io with SMTP id smtpd.web11.1668.1676515600234036658 for ; Wed, 15 Feb 2023 18:46:53 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=ncfD7dvP; spf=pass (domain: intel.com, ip: 192.55.52.93, mailfrom: jiaxin.wu@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1676515613; x=1708051613; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=rZ+XknqcIxGUNoDW+SO5FH1I+Vz6pBHobK2ZkqqCWfY=; b=ncfD7dvPCtXjIWvqSOj1Yq/x+hkY3SFqa7uj5rxZDUI/GGjjduuzt5NZ jHImx6VYWr/MP6XeBCXSM5Ox4wAv+72hmOjrmqHtJS2RVtNRJmO1akGBI vobr1VUz7oIkdGVam4qHwbQfmd+9V5ojUr/Z5MBEcNvHdwtoI0Dlu/xqb fgCbP92dQN6y/qoXFcavPy3VIIbA8rDxoT7jCT8r55B7T02WmuHfdAY5b Z9763skikQebVlXcmMQVQ0r5uzertrxJrNjKw+ZkiTnEYv8J5xWOo/mMG 5kTKX0eBVLOflWRH2jgdR1KmfUmIWE4m/9AjJMt0AqZIkBiEt2ePvB6CI A==; X-IronPort-AV: E=McAfee;i="6500,9779,10622"; a="329331701" X-IronPort-AV: E=Sophos;i="5.97,301,1669104000"; d="scan'208";a="329331701" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Feb 2023 18:46:51 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10622"; a="758759788" X-IronPort-AV: E=Sophos;i="5.97,301,1669104000"; d="scan'208";a="758759788" Received: from sh1gapp1009.ccr.corp.intel.com ([10.239.189.79]) by FMSMGA003.fm.intel.com with ESMTP; 15 Feb 2023 18:46:49 -0800 From: "Wu, Jiaxin" To: devel@edk2.groups.io Cc: Eric Dong , Ray Ni , Zeng Star , Laszlo Ersek , Gerd Hoffmann , Rahul Kumar Subject: [PATCH v8 6/6] OvmfPkg/SmmCpuFeaturesLib: Check SmBase relocation supported or not Date: Thu, 16 Feb 2023 10:46:35 +0800 Message-Id: <20230216024635.9316-7-jiaxin.wu@intel.com> X-Mailer: git-send-email 2.16.2.windows.1 In-Reply-To: <20230216024635.9316-1-jiaxin.wu@intel.com> References: <20230216024635.9316-1-jiaxin.wu@intel.com> 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 Cc: Ray Ni Cc: Zeng Star Cc: Laszlo Ersek Cc: Gerd Hoffmann Cc: Rahul Kumar Signed-off-by: Jiaxin Wu Reviewed-by: Gerd Hoffmann Reviewed-by: Ray Ni --- OvmfPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c | 10 +++++++++- OvmfPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.inf | 6 +++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/OvmfPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c b/OvmfPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c index 6693666d04..a1dd10c9f2 100644 --- a/OvmfPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c +++ b/OvmfPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c @@ -1,9 +1,9 @@ /** @file The CPU specific programming for PiSmmCpuDxeSmm module. - Copyright (c) 2010 - 2015, Intel Corporation. All rights reserved.
+ Copyright (c) 2010 - 2023, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent **/ #include @@ -15,14 +15,16 @@ #include #include #include #include #include +#include #include #include #include #include +#include // // EFER register LMA bit // #define LMA BIT10 @@ -41,10 +43,16 @@ EFIAPI SmmCpuFeaturesLibConstructor ( IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable ) { + // + // If gSmmBaseHobGuid found, means SmBase info has been relocated and recorded + // in the SmBase array. ASSERT it's not supported in OVMF. + // + ASSERT (GetFirstGuidHob (&gSmmBaseHobGuid) == NULL); + // // No need to program SMRRs on our virtual platform. // return EFI_SUCCESS; } diff --git a/OvmfPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.inf b/OvmfPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.inf index 8a426a4c10..2697a90525 100644 --- a/OvmfPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.inf +++ b/OvmfPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.inf @@ -1,9 +1,9 @@ ## @file # The CPU specific programming for PiSmmCpuDxeSmm module. # -# Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.
+# Copyright (c) 2009 - 2023, Intel Corporation. All rights reserved.
# # SPDX-License-Identifier: BSD-2-Clause-Patent # ## @@ -33,10 +33,14 @@ MemoryAllocationLib PcdLib SafeIntLib SmmServicesTableLib UefiBootServicesTableLib + HobLib + +[Guids] + gSmmBaseHobGuid ## CONSUMES [Pcd] gUefiCpuPkgTokenSpaceGuid.PcdCpuMaxLogicalProcessorNumber gUefiOvmfPkgTokenSpaceGuid.PcdCpuHotEjectDataAddress gUefiOvmfPkgTokenSpaceGuid.PcdQ35SmramAtDefaultSmbase -- 2.16.2.windows.1