From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail05.groups.io (mail05.groups.io [45.79.224.7]) by spool.mail.gandi.net (Postfix) with ESMTPS id E790C74003E for ; Fri, 17 May 2024 09:46:50 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=NNBSbRK50d8dMpQL2MdgA5vE9jOuO7dopf8HWjIjAso=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Resent-Date:Resent-From:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding; s=20240206; t=1715939209; v=1; b=ZenwZqQysXT1yiWOqAIRUOwZKSatnGkZU8Yy3gv7M/kC5u1lbY5Uo3ZfHi2g83HeIjoxsr/5 XwEJhcHDHFkt4r6d8oxN5iPNMkVa+6rUJ876xcYcWlJ9IDeF6/0C1ZljkmjQNW5t2Vkq9y39uwe Q8dwFORxo4cDvcOI4lJu4zWcLuB5y0VYf8yA1ZZ6BkPUZf63z8rvZbMLge98Y05RdyVfHz2nm2e EZWl0v9DT4++SBuiInTbk3hPCRJmYhgvQEdRUUlCiLFB1OGVwUrDGzpMC+BxrPS6AsYMb3sMxN3 YKZ8+XXmLy3PPw4UFJj8Sd3Kw+ib2Zjl4qXWms1Q39WaQ== X-Received: by 127.0.0.2 with SMTP id 2Jb8YY7687511xKGrqq6YEgz; Fri, 17 May 2024 02:46:49 -0700 X-Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.14]) by mx.groups.io with SMTP id smtpd.web10.35981.1715939207425420009 for ; Fri, 17 May 2024 02:46:47 -0700 X-CSE-ConnectionGUID: eRIaPsO/Q2aQghMFKfBzKw== X-CSE-MsgGUID: dGwuCSkHREeTzRC0Z09rXg== X-IronPort-AV: E=McAfee;i="6600,9927,11074"; a="12318741" X-IronPort-AV: E=Sophos;i="6.08,167,1712646000"; d="scan'208";a="12318741" X-Received: from orviesa004.jf.intel.com ([10.64.159.144]) by fmvoesa108.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 May 2024 02:46:45 -0700 X-CSE-ConnectionGUID: EIe6qLHHQBOaJrgnz0woBA== X-CSE-MsgGUID: opGA9huTRmOYHlHvwgvS6w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,167,1712646000"; d="scan'208";a="36646783" X-Received: from unknown (HELO shwdeopenlab702.ccr.corp.intel.com) ([10.239.55.43]) by orviesa004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 May 2024 02:46:42 -0700 From: "duntan" To: devel@edk2.groups.io Cc: Ray Ni , Rahul Kumar , Gerd Hoffmann , Jiaxin Wu Subject: [edk2-devel] [Patch V2 04/18] UefiCpuPkg: Save MTRR by lockbox in CpuS3DataDxe Date: Fri, 17 May 2024 17:45:56 +0800 Message-Id: <20240517094610.533-5-dun.tan@intel.com> In-Reply-To: <20240517094610.533-1-dun.tan@intel.com> References: <20240517094610.533-1-dun.tan@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Resent-Date: Fri, 17 May 2024 02:46:47 -0700 Resent-From: dun.tan@intel.com Reply-To: devel@edk2.groups.io,dun.tan@intel.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: ZJxXaYDm6NhnhTTPxIRiZERex7686176AA= Content-Transfer-Encoding: 8bit X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20240206 header.b=ZenwZqQy; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=intel.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 45.79.224.7 as permitted sender) smtp.mailfrom=bounce@groups.io Save MTRR by lockbox in CpuS3DataDxe. In S3 boot, The MTRR setting will be restored in S3Resume.c in following patches. Then S3Resume.c will wakeup all APs to load the MTRR setting. This can avoid waking up APs in CpuS3.c. Signed-off-by: Dun Tan Reviewed-by: Ray Ni Cc: Rahul Kumar Cc: Gerd Hoffmann Cc: Jiaxin Wu --- UefiCpuPkg/CpuS3DataDxe/CpuS3Data.c | 13 ++++++++++++- UefiCpuPkg/CpuS3DataDxe/CpuS3DataDxe.inf | 4 +++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/UefiCpuPkg/CpuS3DataDxe/CpuS3Data.c b/UefiCpuPkg/CpuS3DataDxe/CpuS3Data.c index 86ce5303ca..c87f82bc22 100644 --- a/UefiCpuPkg/CpuS3DataDxe/CpuS3Data.c +++ b/UefiCpuPkg/CpuS3DataDxe/CpuS3Data.c @@ -9,7 +9,7 @@ number of CPUs reported by the MP Services Protocol, so this module does not support hot plug CPUs. This module can be copied into a CPU specific package and customized if these additional features are required. -Copyright (c) 2013 - 2021, Intel Corporation. All rights reserved.
+Copyright (c) 2013 - 2024, Intel Corporation. All rights reserved.
Copyright (c) 2015, Red Hat, Inc. SPDX-License-Identifier: BSD-2-Clause-Patent @@ -26,6 +26,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include #include #include +#include #include #include @@ -130,6 +131,16 @@ CpuS3DataOnEndOfDxe ( DEBUG ((DEBUG_VERBOSE, "%a\n", __func__)); MtrrGetAllMtrrs (&AcpiCpuDataEx->MtrrTable); + // + // Save MTRR in lockbox + // + Status = SaveLockBox ( + &gEdkiiS3MtrrSettingGuid, + &AcpiCpuDataEx->MtrrTable, + sizeof (MTRR_SETTINGS) + ); + ASSERT_EFI_ERROR (Status); + // // Close event, so it will not be invoked again. // diff --git a/UefiCpuPkg/CpuS3DataDxe/CpuS3DataDxe.inf b/UefiCpuPkg/CpuS3DataDxe/CpuS3DataDxe.inf index 510133a614..c690f7df5b 100644 --- a/UefiCpuPkg/CpuS3DataDxe/CpuS3DataDxe.inf +++ b/UefiCpuPkg/CpuS3DataDxe/CpuS3DataDxe.inf @@ -9,7 +9,7 @@ # support hot plug CPUs. This module can be copied into a CPU specific package # and customized if these additional features are required. # -# Copyright (c) 2013-2016, Intel Corporation. All rights reserved.
+# Copyright (c) 2013-2024, Intel Corporation. All rights reserved.
# Copyright (c) 2015, Red Hat, Inc. # # SPDX-License-Identifier: BSD-2-Clause-Patent @@ -46,9 +46,11 @@ BaseLib MtrrLib MemoryAllocationLib + LockBoxLib [Guids] gEfiEndOfDxeEventGroupGuid ## CONSUMES ## Event + gEdkiiS3MtrrSettingGuid [Protocols] gEfiMpServiceProtocolGuid ## CONSUMES -- 2.31.1.windows.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#119001): https://edk2.groups.io/g/devel/message/119001 Mute This Topic: https://groups.io/mt/106150762/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-