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 953B3AC11AA for ; Fri, 10 May 2024 10:09:05 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=C/TD10x4YP1T0WzJFnsIfo5fj6/sz2NkrewYu5RzaX0=; 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=1715335744; v=1; b=zZWoNx4uT4hAraX8nSyL10hMYoiFgDhBfF7IynUdbBDX8UdiuixQIN/lmhpnTHyNUabl93mB WRI60ZTFUskogkb1LlMd2841bZM+k7ekhEjkA7sZ91z9tXKNivt5c3J6ZOLLC7H1jlCeUJNYGMJ QCyKxKPzJJfqjGhQD92RtN5pdaVmmUqnAW3s3V4TYruCv1XDCAb+D4W+cJY3rYQoXu/fCv9f+18 N96DV0/YwhaVW6dOdX7jwtyqk2CAnrDpD+DzlwBJ1njFKsOGpIWCPthSsS/s+QUStTpqJ16VGis O5jI33Zqpvby8NzheDGyYzRzQvvAL/N13D7kA+3DYIASw== X-Received: by 127.0.0.2 with SMTP id 2bc9YY7687511xL9Ul4CyBx5; Fri, 10 May 2024 03:09:04 -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:58 -0700 X-CSE-ConnectionGUID: ilj6Y8aHSHWZkCQIWo/zng== X-CSE-MsgGUID: rZUo/Q8lQ4CjO95xvvbr5Q== X-IronPort-AV: E=McAfee;i="6600,9927,11068"; a="28819128" X-IronPort-AV: E=Sophos;i="6.08,150,1712646000"; d="scan'208";a="28819128" 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:58 -0700 X-CSE-ConnectionGUID: HSqhx6p8S0G3Z6s+uFXbAQ== X-CSE-MsgGUID: zqBjgcO0TS+ra6J3SYbM/Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,150,1712646000"; d="scan'208";a="60424239" 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:57 -0700 From: "duntan" To: devel@edk2.groups.io Cc: Ray Ni , Rahul Kumar , Gerd Hoffmann , Jiaxin Wu Subject: [edk2-devel] [PATCH 04/18] UefiCpuPkg: Save MTRR by lockbox in CpuS3DataDxe Date: Fri, 10 May 2024 18:08:13 +0800 Message-Id: <20240510100827.1903-5-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:58 -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: MmniOj1bocmLNLgzq2utdhRDx7686176AA= 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=zZWoNx4u; 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: Ray Ni Cc: Rahul Kumar Cc: Gerd Hoffmann Cc: Jiaxin Wu --- UefiCpuPkg/CpuS3DataDxe/CpuS3Data.c | 11 +++++++++++ UefiCpuPkg/CpuS3DataDxe/CpuS3DataDxe.inf | 2 ++ 2 files changed, 13 insertions(+) diff --git a/UefiCpuPkg/CpuS3DataDxe/CpuS3Data.c b/UefiCpuPkg/CpuS3DataDxe/CpuS3Data.c index 86ce5303ca..825bb00b74 100644 --- a/UefiCpuPkg/CpuS3DataDxe/CpuS3Data.c +++ b/UefiCpuPkg/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/UefiCpuPkg/CpuS3DataDxe/CpuS3DataDxe.inf b/UefiCpuPkg/CpuS3DataDxe/CpuS3DataDxe.inf index 510133a614..a09254746b 100644 --- a/UefiCpuPkg/CpuS3DataDxe/CpuS3DataDxe.inf +++ b/UefiCpuPkg/CpuS3DataDxe/CpuS3DataDxe.inf @@ -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 (#118796): https://edk2.groups.io/g/devel/message/118796 Mute This Topic: https://groups.io/mt/106018124/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-