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 D373AAC0D9B for ; Fri, 17 May 2024 09:46:48 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=5r+H1iT2hRHOEhndQ0QRAhpPbSqXeOSSYy+8ja1uGVs=; 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=1715939207; v=1; b=PSRHnOpKhYXU0pd3Zfjeebn6OGbNGUGB1jUqIq19sNMhNRf8RcAEjy5ojPRNNsM7IP3j0ysn Y6q855aauXs/AiisSXCuKRhh96G1QBo5YiyZKSfMqdcOQsQ6NKG/2clnmI0H4I3dEAqBtKUN8GD KJpKX9UV3RQ++SJHUZmpe3dn3U5d1gX8XQWW3fM6tLPmEk3UvzArrDlTZLrK56FD0oyFk+T7jXh 9Vbk6cUrXDbNWUbbfQi3+f+oNNKhIzSjUZl8UgAIq81TSh2mQxnScT1N2JIbbwuuT4e/cd4toWQ dJgVVEh0qZvoScjUXS4otDVdaRi/vJMLf3c/YETq6mrnA== X-Received: by 127.0.0.2 with SMTP id QouTYY7687511xtr10CWglsl; Fri, 17 May 2024 02:46:47 -0700 X-Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.14]) by mx.groups.io with SMTP id smtpd.web10.35979.1715939201399766364 for ; Fri, 17 May 2024 02:46:41 -0700 X-CSE-ConnectionGUID: 7GoGjhLPRe+/qr/bIr8DJw== X-CSE-MsgGUID: dSV66Z3ySA6ILbv+pXPumw== X-IronPort-AV: E=McAfee;i="6600,9927,11074"; a="12318722" X-IronPort-AV: E=Sophos;i="6.08,167,1712646000"; d="scan'208";a="12318722" 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:40 -0700 X-CSE-ConnectionGUID: P6sEXKurTqeg5i+uFBBDcw== X-CSE-MsgGUID: beNt8iQERtesbpCacOwK+w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,167,1712646000"; d="scan'208";a="36646770" 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:37 -0700 From: "duntan" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Jiewen Yao , Gerd Hoffmann , Ray Ni , Jiaxin Wu Subject: [edk2-devel] [Patch V2 02/18] OvmfPkg: Save MTRR by lockbox in CpuS3DataDxe Date: Fri, 17 May 2024 17:45:54 +0800 Message-Id: <20240517094610.533-3-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:41 -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: 9JGbzELioVKby1CgQtrznepnx7686176AA= 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=PSRHnOpK; 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 Cc: Ard Biesheuvel Cc: Jiewen Yao Cc: Gerd Hoffmann Reviewed-by: Ray Ni Cc: Jiaxin Wu --- OvmfPkg/CpuS3DataDxe/CpuS3Data.c | 13 ++++++++++++- OvmfPkg/CpuS3DataDxe/CpuS3DataDxe.inf | 4 +++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/OvmfPkg/CpuS3DataDxe/CpuS3Data.c b/OvmfPkg/CpuS3DataDxe/CpuS3Data.c index 289048b75d..eacdfa12c3 100644 --- a/OvmfPkg/CpuS3DataDxe/CpuS3Data.c +++ b/OvmfPkg/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 - 2020, 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/OvmfPkg/CpuS3DataDxe/CpuS3DataDxe.inf b/OvmfPkg/CpuS3DataDxe/CpuS3DataDxe.inf index 228d5ae1b2..5369613f5d 100644 --- a/OvmfPkg/CpuS3DataDxe/CpuS3DataDxe.inf +++ b/OvmfPkg/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-2020, Red Hat, Inc. # # SPDX-License-Identifier: BSD-2-Clause-Patent @@ -46,9 +46,11 @@ MtrrLib UefiBootServicesTableLib UefiDriverEntryPoint + 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 (#118999): https://edk2.groups.io/g/devel/message/118999 Mute This Topic: https://groups.io/mt/106150760/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-