From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail04.groups.io (mail04.groups.io [45.79.224.9]) by spool.mail.gandi.net (Postfix) with ESMTPS id B25C474004F for ; Mon, 15 Apr 2024 13:30:30 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=5N81zKIbpksXK0A3B/J5Lq2hiWLXdhA7/nZwNhDRe8w=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-Id: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=1713187829; v=1; b=rwp8W2DrPizNixNdug0Se6dMLirxHBPVBOPVsONaLRyGbywdYfeVnOcXB4wChlHlQUSIGig8 AP8qSP5jnckgZK2BXU4FEdX4+OLQJVPwXR+0QF40GoeOpMS6K5hDDg13Susc1sIri0Vm2IIuNhR P0Rv6Ha0TdO0nMl/s3XCaFItsw3s1OovfEyV6qKehppdEkb1fNHE7fjiTJ6LaGH3cL0j51kwSty CNHzDL6qRl5CuyZZIApiq4gF0WNzOTOGEPhYGKuQlUrW5+p+R6lM2a3HFuO0Zus5QYRrQwEHGoA Szl7oJF7PaOdFKxska3HLgdl/0keiiDtBm+njKjcvGNkg== X-Received: by 127.0.0.2 with SMTP id CORTYY7687511xYzaJGWgH6L; Mon, 15 Apr 2024 06:30:29 -0700 X-Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) by mx.groups.io with SMTP id smtpd.web10.21064.1713187828784399677 for ; Mon, 15 Apr 2024 06:30:28 -0700 X-CSE-ConnectionGUID: 7XdmXwluRAGa8hNJ3QmYVg== X-CSE-MsgGUID: UKWUjc03SP2bJCos3J1fxA== X-IronPort-AV: E=McAfee;i="6600,9927,11044"; a="33961784" X-IronPort-AV: E=Sophos;i="6.07,203,1708416000"; d="scan'208";a="33961784" X-Received: from fmviesa007.fm.intel.com ([10.60.135.147]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Apr 2024 06:30:28 -0700 X-CSE-ConnectionGUID: eYpfJ6atSzGYuM7YvqMWxA== X-CSE-MsgGUID: CVAZnaIgQdSTllUSMl1mow== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,203,1708416000"; d="scan'208";a="22000510" X-Received: from sh1gapp1009.ccr.corp.intel.com ([10.239.189.219]) by fmviesa007.fm.intel.com with ESMTP; 15 Apr 2024 06:30:25 -0700 From: "Wu, Jiaxin" To: devel@edk2.groups.io Cc: Ray Ni , Zeng Star , Gerd Hoffmann , Rahul Kumar , Guo Dong , Sean Rhodes , James Lu , Gua Guo , Ard Biesheuvel , Jiewen Yao , Abdul Lateef Attar , Abner Chang , Tom Lendacky Subject: [edk2-devel] [PATCH v2 00/10] Add SmmRelocationLib Date: Mon, 15 Apr 2024 21:30:11 +0800 Message-Id: <20240415133021.10516-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: Mon, 15 Apr 2024 06:30:28 -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: RmCI25Lz1CG2vgYgwg5oW8W2x7686176AA= X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20240206 header.b=rwp8W2Dr; 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.9 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) can be simplfied as below for SMM init: 1. Consume the gSmmBaseHobGuid HOB for the relocated smbases for each Processor. 2. Execute the early SMM Init. Cc: Ray Ni Cc: Zeng Star Cc: Gerd Hoffmann Cc: Rahul Kumar Cc: Guo Dong Cc: Sean Rhodes Cc: James Lu Cc: Gua Guo Cc: Ard Biesheuvel Cc: Jiewen Yao Cc: Abdul Lateef Attar Cc: Abner Chang Cc: Tom Lendacky Signed-off-by: Jiaxin Wu Jiaxin Wu (10): UefiCpuPkg: Add SmmRelocationLib class UefiCpuPkg/SmmRelocationLib: Add SmmRelocationLib library instance UefiCpuPkg/SmmRelocationLib: Add library instance for AMD OvmfPkg/SmmRelocationLib: Add library instance for OVMF OvmfPkg/PlatformInitLib: Create gEfiSmmSmramMemoryGuid OvmfPkg: Refine SmmAccess implementation OvmfPkg/SmmCpuFeaturesLib: Check Smbase Relocation is done or not OvmfPkg/PlatformPei: Relocate SmBases in PEI phase UefiPayloadPkg/UefiPayloadPkg.dsc: Include SmmRelocationLib UefiCpuPkg/PiSmmCpuDxeSmm: Remove SmBases relocation logic OvmfPkg/AmdSev/AmdSevX64.dsc | 3 + OvmfPkg/CloudHv/CloudHvX64.dsc | 2 + OvmfPkg/Library/PlatformInitLib/MemDetect.c | 104 ++-- .../Library/PlatformInitLib/PlatformInitLib.inf | 6 +- .../Library/SmmCpuFeaturesLib/SmmCpuFeaturesLib.c | 33 +- .../Library/SmmRelocationLib}/Ia32/Semaphore.c | 13 +- OvmfPkg/Library/SmmRelocationLib/Ia32/SmmInit.nasm | 148 +++++ .../SmmRelocationLib/InternalSmmRelocationLib.h | 140 +++++ .../Library/SmmRelocationLib/SmmRelocationLib.c | 599 +++++++++++++++++++++ .../Library/SmmRelocationLib/SmmRelocationLib.inf | 61 +++ .../SmmRelocationLib/SmramSaveStateConfig.c | 107 ++++ .../Library/SmmRelocationLib}/X64/Semaphore.c | 13 +- .../Library/SmmRelocationLib}/X64/SmmInit.nasm | 86 ++- OvmfPkg/Microvm/MicrovmX64.dsc | 3 + OvmfPkg/OvmfPkgIa32.dsc | 2 + OvmfPkg/OvmfPkgIa32X64.dsc | 2 + OvmfPkg/OvmfPkgX64.dsc | 1 + OvmfPkg/PlatformPei/Platform.c | 3 + OvmfPkg/PlatformPei/Platform.h | 5 + OvmfPkg/PlatformPei/PlatformPei.inf | 5 +- OvmfPkg/PlatformPei/SmmRelocation.c | 80 +++ OvmfPkg/SmmAccess/SmmAccess2Dxe.c | 4 +- OvmfPkg/SmmAccess/SmmAccess2Dxe.inf | 5 + OvmfPkg/SmmAccess/SmmAccessPei.c | 88 +-- OvmfPkg/SmmAccess/SmmAccessPei.inf | 7 +- OvmfPkg/SmmAccess/SmramInternal.c | 73 +-- OvmfPkg/SmmAccess/SmramInternal.h | 18 +- UefiCpuPkg/Include/Library/SmmRelocationLib.h | 42 ++ .../SmmRelocationLib/AmdSmmRelocationLib.inf | 61 +++ .../SmmRelocationLib/AmdSmramSaveStateConfig.c | 132 +++++ .../SmmRelocationLib}/Ia32/Semaphore.c | 13 +- .../Library/SmmRelocationLib/Ia32/SmmInit.nasm | 148 +++++ .../SmmRelocationLib/InternalSmmRelocationLib.h | 140 +++++ .../Library/SmmRelocationLib/SmmRelocationLib.c | 599 +++++++++++++++++++++ .../Library/SmmRelocationLib/SmmRelocationLib.inf | 62 +++ .../SmmRelocationLib/SmramSaveStateConfig.c | 139 +++++ .../SmmRelocationLib}/X64/Semaphore.c | 13 +- .../SmmRelocationLib}/X64/SmmInit.nasm | 86 ++- UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c | 21 +- UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmmInit.nasm | 96 ---- UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c | 10 +- UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c | 331 +----------- UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h | 103 +--- UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf | 4 - UefiCpuPkg/PiSmmCpuDxeSmm/SmmMpPerf.h | 2 +- UefiCpuPkg/PiSmmCpuDxeSmm/SmramSaveState.c | 69 --- UefiCpuPkg/UefiCpuPkg.dec | 3 + UefiCpuPkg/UefiCpuPkg.dsc | 2 + UefiPayloadPkg/UefiPayloadPkg.dsc | 2 + 49 files changed, 2833 insertions(+), 856 deletions(-) copy {UefiCpuPkg/PiSmmCpuDxeSmm => OvmfPkg/Library/SmmRelocationLib}/Ia32/Semaphore.c (72%) create mode 100644 OvmfPkg/Library/SmmRelocationLib/Ia32/SmmInit.nasm create mode 100644 OvmfPkg/Library/SmmRelocationLib/InternalSmmRelocationLib.h create mode 100644 OvmfPkg/Library/SmmRelocationLib/SmmRelocationLib.c create mode 100644 OvmfPkg/Library/SmmRelocationLib/SmmRelocationLib.inf create mode 100644 OvmfPkg/Library/SmmRelocationLib/SmramSaveStateConfig.c copy {UefiCpuPkg/PiSmmCpuDxeSmm => OvmfPkg/Library/SmmRelocationLib}/X64/Semaphore.c (78%) copy {UefiCpuPkg/PiSmmCpuDxeSmm => OvmfPkg/Library/SmmRelocationLib}/X64/SmmInit.nasm (59%) create mode 100644 OvmfPkg/PlatformPei/SmmRelocation.c create mode 100644 UefiCpuPkg/Include/Library/SmmRelocationLib.h create mode 100644 UefiCpuPkg/Library/SmmRelocationLib/AmdSmmRelocationLib.inf create mode 100644 UefiCpuPkg/Library/SmmRelocationLib/AmdSmramSaveStateConfig.c rename UefiCpuPkg/{PiSmmCpuDxeSmm => Library/SmmRelocationLib}/Ia32/Semaphore.c (72%) create mode 100644 UefiCpuPkg/Library/SmmRelocationLib/Ia32/SmmInit.nasm create mode 100644 UefiCpuPkg/Library/SmmRelocationLib/InternalSmmRelocationLib.h create mode 100644 UefiCpuPkg/Library/SmmRelocationLib/SmmRelocationLib.c create mode 100644 UefiCpuPkg/Library/SmmRelocationLib/SmmRelocationLib.inf create mode 100644 UefiCpuPkg/Library/SmmRelocationLib/SmramSaveStateConfig.c rename UefiCpuPkg/{PiSmmCpuDxeSmm => Library/SmmRelocationLib}/X64/Semaphore.c (78%) rename UefiCpuPkg/{PiSmmCpuDxeSmm => Library/SmmRelocationLib}/X64/SmmInit.nasm (59%) delete mode 100644 UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmmInit.nasm -- 2.16.2.windows.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#117775): https://edk2.groups.io/g/devel/message/117775 Mute This Topic: https://groups.io/mt/105535804/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-