From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by mx.groups.io with SMTP id smtpd.web11.7856.1676009142701719213 for ; Thu, 09 Feb 2023 22:05:43 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=homWLkU8; spf=pass (domain: intel.com, ip: 192.55.52.151, 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=1676009142; x=1707545142; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=nU/qlZAFzPdxq+DESEBAmKi1CNu+8uNm436rdAmdgoI=; b=homWLkU8Qq5bAowKUP5MEwP/HVIpnmlQJBS322PYUa9l5k07g7BUiuoQ cRQOlFZduedwztU8UNvPz5uej0n8eOWyFOYsIN+G2CKkQM/8zSTaQSUo0 WiomxW33VTtcHaYCkHjtIZ/vtoE0whh8soTJtOgipT6XkWtjCM3uLMjzS 8luyXYwNhrHEx2K1LfktyLCd10k1JKf+DaWKVbaYQWFnTSJbpPjZD5WjM YI0eMZ3buZPUPtVupwOuaGi7vy5p6e8ehzroh/de/B9PuTzBrn1h/9pMA uRN6cNx42FgNJprxrYnbEZk1RUzmHFHJWJ+kdOuR2GhdfUGUBF2DNycjZ Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10616"; a="310711776" X-IronPort-AV: E=Sophos;i="5.97,286,1669104000"; d="scan'208";a="310711776" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Feb 2023 22:05:41 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10616"; a="791854754" X-IronPort-AV: E=Sophos;i="5.97,286,1669104000"; d="scan'208";a="791854754" Received: from sh1gapp1009.ccr.corp.intel.com ([10.239.189.79]) by orsmga004.jf.intel.com with ESMTP; 09 Feb 2023 22:05:37 -0800 From: "Wu, Jiaxin" To: devel@edk2.groups.io Cc: Eric Dong , Ray Ni , Zeng Star , Laszlo Ersek , Gerd Hoffmann , Rahul Kumar Subject: [PATCH v4 5/5] OvmfPkg/SmmCpuFeaturesLib: Check SmBase relocation supported or not Date: Fri, 10 Feb 2023 14:05:19 +0800 Message-Id: <20230210060519.11100-6-jiaxin.wu@intel.com> X-Mailer: git-send-email 2.16.2.windows.1 In-Reply-To: <20230210060519.11100-1-jiaxin.wu@intel.com> References: <20230210060519.11100-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 --- OvmfPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c | 8 ++++++++ OvmfPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.inf | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/OvmfPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c b/OvmfPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c index 6693666d04..ec918cad06 100644 --- a/OvmfPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c +++ b/OvmfPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c @@ -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..6a281518f5 100644 --- a/OvmfPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.inf +++ b/OvmfPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.inf @@ -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