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 03541941600 for ; Fri, 26 Apr 2024 12:17:40 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=VJY7LJG8voyNrdOxFAKws85HhBzr0i9w8fff6LVA1AU=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Resent-Date:Resent-From:Reply-To:List-Unsubscribe-Post:List-Unsubscribe; s=20240206; t=1714133859; v=1; b=eRnErxLl/Rr0jqstwdqysrWv/Q+M+iUBLQNxxhsf8JKiL4k+p0Fq4GjoKT1Cf3SuLb+QBEpY FOeBhP8uXfTz4YUYePFenLvrt5Sev+GmHvc1lQunLUUWXLH+kjB3w3vAudeNS5aGEt3E4DfHK4E AHkRl0FT03M2FE9ntDe/gC+810tBXbYTdl9wM56gTGixj1HPY7K7G5eWEzlSri3cLlXnFr6SBPs N6hz8pN3zznU1zinwyA+Iv1L/l0RTs945qlxH68HtZM+eA51jb/VMF6yJEfflOTOdRbUjVJ3Exk 1Oj6NEYCH+rLWBlZAsuNvDz8r7xp9EHiwJiHB6hq9Ng1Q== X-Received: by 127.0.0.2 with SMTP id jnoSYY7687511xmgpKKe8090; Fri, 26 Apr 2024 05:17:39 -0700 X-Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.18]) by mx.groups.io with SMTP id smtpd.web11.12554.1714133857432549514 for ; Fri, 26 Apr 2024 05:17:39 -0700 X-CSE-ConnectionGUID: V2CtjSZ9Tt6yJTXdpQlUgg== X-CSE-MsgGUID: rnDhD6VzQD6mhP4rP5JjPQ== X-IronPort-AV: E=McAfee;i="6600,9927,11055"; a="10027134" X-IronPort-AV: E=Sophos;i="6.07,232,1708416000"; d="scan'208";a="10027134" X-Received: from orviesa001.jf.intel.com ([10.64.159.141]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Apr 2024 05:17:39 -0700 X-CSE-ConnectionGUID: DIj2NctzRV28EUnvWyaIKQ== X-CSE-MsgGUID: Q+bOlkcXTJCc8WVIbLYs4w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,232,1708416000"; d="scan'208";a="62879056" X-Received: from sh1gapp1009.ccr.corp.intel.com ([10.239.189.219]) by orviesa001.jf.intel.com with ESMTP; 26 Apr 2024 05:17:37 -0700 From: "Wu, Jiaxin" To: devel@edk2.groups.io Cc: Ray Ni , Zeng Star , Gerd Hoffmann , Rahul Kumar Subject: [edk2-devel] [PATCH v4 01/14] UefiCpuPkg: Add SmmRelocationLib class Date: Fri, 26 Apr 2024 20:17:07 +0800 Message-Id: <20240426121720.54308-2-jiaxin.wu@intel.com> In-Reply-To: <20240426121720.54308-1-jiaxin.wu@intel.com> References: <20240426121720.54308-1-jiaxin.wu@intel.com> 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, 26 Apr 2024 05:17:39 -0700 Resent-From: jiaxin.wu@intel.com Reply-To: devel@edk2.groups.io,jiaxin.wu@intel.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: NMRqezazzck1iJlbDyHmkgDSx7686176AA= X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20240206 header.b=eRnErxLl; 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 Intel plans to separate the smbase relocation logic from PiSmmCpuDxeSmm driver, and the related behavior will be moved to the new interface defined by the SmmRelocationLib class. The SmmRelocationLib class provides the SmmRelocationInit() interface for platform to do the smbase relocation, which shall provide below 2 functionalities: 1. Relocate smbases for each processor. 2. Create the gSmmBaseHobGuid HOB. With SmmRelocationLib, PiSmmCpuDxeSmm driver (which runs at a later phase) shall: 1. Consume the gSmmBaseHobGuid HOB for the relocated smbases for each Processor. 2. Execute the early SMM Init. This patch just provides the SmmRelocationLib class. Cc: Ray Ni Cc: Zeng Star Cc: Gerd Hoffmann Cc: Rahul Kumar Signed-off-by: Jiaxin Wu Reviewed-by: Ray Ni --- UefiCpuPkg/Include/Library/SmmRelocationLib.h | 42 +++++++++++++++++++++++++++ UefiCpuPkg/UefiCpuPkg.dec | 3 ++ 2 files changed, 45 insertions(+) create mode 100644 UefiCpuPkg/Include/Library/SmmRelocationLib.h diff --git a/UefiCpuPkg/Include/Library/SmmRelocationLib.h b/UefiCpuPkg/Include/Library/SmmRelocationLib.h new file mode 100644 index 0000000000..999a5b46d1 --- /dev/null +++ b/UefiCpuPkg/Include/Library/SmmRelocationLib.h @@ -0,0 +1,42 @@ +/** @file + Header file for SMM Relocation Library. + + The SmmRelocationLib class provides the SmmRelocationInit() + interface for platform to do the smbase relocation, which + shall provide below 2 functionalities: + 1. Relocate SmBases for each processor. + 2. Create the SmBase HOB (gSmmBaseHobGuid). + + With SmmRelocationLib, PiSmmCpuDxeSmm driver (which runs at a later phase) + shall: + 1. Consume the gSmmBaseHobGuid for the relocated smbase for each Processor. + 2. Execute early SMM init. + + Copyright (c) 2024, Intel Corporation. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef SMM_RELOCATION_LIB_H_ +#define SMM_RELOCATION_LIB_H_ + +#include + +/** + CPU SmmBase Relocation Init. + + This function is to relocate CPU SmmBase. + + @param[in] MpServices2 Pointer to this instance of the MpServices. + + @retval EFI_SUCCESS CPU SmmBase Relocated successfully. + @retval Others CPU SmmBase Relocation failed. + +**/ +EFI_STATUS +EFIAPI +SmmRelocationInit ( + IN EDKII_PEI_MP_SERVICES2_PPI *MpServices2 + ); + +#endif diff --git a/UefiCpuPkg/UefiCpuPkg.dec b/UefiCpuPkg/UefiCpuPkg.dec index f412ac0ce2..f86a6d2bcb 100644 --- a/UefiCpuPkg/UefiCpuPkg.dec +++ b/UefiCpuPkg/UefiCpuPkg.dec @@ -69,10 +69,13 @@ MmSaveStateLib|Include/Library/MmSaveStateLib.h ## @libraryclass Provides functions for SMM CPU Sync Operation. SmmCpuSyncLib|Include/Library/SmmCpuSyncLib.h + ## @libraryclass Provides functions for SMM Relocation Operation. + SmmRelocationLib|Include/Library/SmmRelocationLib.h + [LibraryClasses.RISCV64] ## @libraryclass Provides functions to manage MMU features on RISCV64 CPUs. ## RiscVMmuLib|Include/Library/BaseRiscVMmuLib.h -- 2.16.2.windows.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#118325): https://edk2.groups.io/g/devel/message/118325 Mute This Topic: https://groups.io/mt/105748912/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-