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 4F7AFAC10BC for ; Fri, 10 May 2024 10:08:55 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=KZo1zTqI+MvjgMcVMoGEfiHIBIit1uPeb363u/IwLTA=; 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=1715335733; v=1; b=XrNL+8Vvn/Xv/7cGZ7aB6pXPQzu1ynZJIkNl0ag39/alEq/1hdZzzY1jZfIM3shR4UPE8qlI isym2TweeHkHqBS/mfU9XmFwex8H/1BaqVLDt1hxv2r9DMBJFGn/zv2CZjbG6VRS4cLobj6ayRT 3EHYTcqqkuJPUW3xMzbHn/gnjAIeI++jQ5NDN2M/hje+iAioAaj2NIt2QtFMm64WIggudIAklPM YPZAtOm3pM9g72F6156shsdumPSyuvBagjuwghoihtZaZue3F7nBxJpCpmSBQPqn5ZSxHsOKABG sc1apa8519/gs8G8VXlTBndXxWIWD7obxjnq2/sqatFzA== X-Received: by 127.0.0.2 with SMTP id aykoYY7687511xLT9rFQnHwn; Fri, 10 May 2024 03:08:53 -0700 X-Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.8]) by mx.groups.io with SMTP id smtpd.web10.9485.1715335727366928454 for ; Fri, 10 May 2024 03:08:53 -0700 X-CSE-ConnectionGUID: pCI6rW4WQQ6xi4fHM80PlA== X-CSE-MsgGUID: A42cWOIuR8qh4B7Lj75lzA== X-IronPort-AV: E=McAfee;i="6600,9927,11068"; a="28819118" X-IronPort-AV: E=Sophos;i="6.08,150,1712646000"; d="scan'208";a="28819118" X-Received: from orviesa002.jf.intel.com ([10.64.159.142]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 May 2024 03:08:53 -0700 X-CSE-ConnectionGUID: 6m3Z8MhtQpKxLOlhiz8+dw== X-CSE-MsgGUID: +wnn3rCBQUGfktirvvgnBw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,150,1712646000"; d="scan'208";a="60424220" X-Received: from unknown (HELO shwdeopenlab702.ccr.corp.intel.com) ([10.239.55.43]) by orviesa002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 May 2024 03:08:52 -0700 From: "duntan" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Jiewen Yao , Gerd Hoffmann , Ray Ni , Jiaxin Wu Subject: [edk2-devel] [PATCH 02/18] OvmfPkg: Save MTRR by lockbox in CpuS3DataDxe Date: Fri, 10 May 2024 18:08:11 +0800 Message-Id: <20240510100827.1903-3-dun.tan@intel.com> In-Reply-To: <20240510100827.1903-1-dun.tan@intel.com> References: <20240510100827.1903-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, 10 May 2024 03:08:53 -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: lVW3U4FsGSeLhJhJSa2iFm8Vx7686176AA= 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=XrNL+8Vv; 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 Cc: Ray Ni Cc: Jiaxin Wu --- OvmfPkg/CpuS3DataDxe/CpuS3Data.c | 11 +++++++++++ OvmfPkg/CpuS3DataDxe/CpuS3DataDxe.inf | 2 ++ 2 files changed, 13 insertions(+) diff --git a/OvmfPkg/CpuS3DataDxe/CpuS3Data.c b/OvmfPkg/CpuS3DataDxe/CpuS3Data.c index 289048b75d..d1aba32842 100644 --- a/OvmfPkg/CpuS3DataDxe/CpuS3Data.c +++ b/OvmfPkg/CpuS3DataDxe/CpuS3Data.c @@ -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..f5032a9222 100644 --- a/OvmfPkg/CpuS3DataDxe/CpuS3DataDxe.inf +++ b/OvmfPkg/CpuS3DataDxe/CpuS3DataDxe.inf @@ -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 (#118794): https://edk2.groups.io/g/devel/message/118794 Mute This Topic: https://groups.io/mt/106018122/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-