From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (NAM11-BN8-obe.outbound.protection.outlook.com [40.107.236.40]) by mx.groups.io with SMTP id smtpd.web11.526.1688271260259680364 for ; Sat, 01 Jul 2023 21:14:20 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@amd.com header.s=selector1 header.b=I44iEgl8; spf=permerror, err=parse error for token &{10 18 %{i}._ip.%{h}._ehlo.%{d}._spf.vali.email}: invalid domain name (domain: amd.com, ip: 40.107.236.40, mailfrom: abdullateef.attar@amd.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iOj2WPqta/AsOYzkvn92FwHGcQkZ1eWR0pra9LX1VOI8x5rbb1vbgtzyJ3PoVAs6aK6GsGs7IihErMdQr5xCMPwBrXiLqLvyJsqeOuqOXFDWe8PJ6Bu91ArAXeQpUoY8hQ7S9QF1oI7MgkBmY35FiCBJipBZ3uklgTpuH8ghOFbALMF3kYsfBN84trzWgTqV4vWoaeiFDfxnWQ/P1dxTvvvPxoNtvxwjhSjV/q1AxMBfFY8RNyeaSnt56yi6vwFPl0opDeyriy5O+OhWelqs0ejfK8cVN3Xi75Mbhj1rVMs3P1n94lN/by4pSgUz0qHP+Zpr8qlukPGb37rO2veT7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=72Qn+60Y2SueXNgBsnKAtpqSUK0YJ4R/Je4bH2l1I6I=; b=G1u4YitHSQUw+cCp55TxgLO8RPpvm6vIKkEF0cdGN8FAPAu5s8GRqZ1xDYUaR41ROjzuq6GxYyUYjtkcY8mjw3ivtLyPuIUA+O8lrbsXXRbAzXRhhL+ZTdhWuy7eXiQkVvwe+QMYbDV6VF192Ed/qoatCF44+m4QCttyXDoiPfoJDW2tVee8OpSBa5JUPbE64DsekAphg+HaYtQJEsmHK04p0bRjUaxOk7gEqUrI9X8jZYP9SNyZ5GfbDVvvXlfrozX7ucGtwF4D+cwHFS2JF67ZJXyg7zTDBSqrYLb7FDRsULkwovY6plOyyhJV66IyvzSzrKRmUMVN5uNo2jkErQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=edk2.groups.io smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=72Qn+60Y2SueXNgBsnKAtpqSUK0YJ4R/Je4bH2l1I6I=; b=I44iEgl8vzROD/6ltOTlvzigqXdQwMnoYRWdvbXSDr3xO5rzLyd9qVKOmM4jMwfh8Fw5l3jyIGl1xH9ToppOZ1ClcqHXRWWoZPKUOFo5kYhVncgKKtvUAzTCqHCtmJ3Hbw78HqwwsiNRQXtlyZJeGgeZ9POBVLaKbMf8vFv4F8o= Received: from BN0PR04CA0174.namprd04.prod.outlook.com (2603:10b6:408:eb::29) by LV8PR12MB9181.namprd12.prod.outlook.com (2603:10b6:408:18d::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6544.24; Sun, 2 Jul 2023 04:14:17 +0000 Received: from BN8NAM11FT038.eop-nam11.prod.protection.outlook.com (2603:10b6:408:eb:cafe::d9) by BN0PR04CA0174.outlook.office365.com (2603:10b6:408:eb::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6544.26 via Frontend Transport; Sun, 2 Jul 2023 04:14:17 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; pr=C Received: from SATLEXMB03.amd.com (165.204.84.17) by BN8NAM11FT038.mail.protection.outlook.com (10.13.176.246) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6521.43 via Frontend Transport; Sun, 2 Jul 2023 04:14:17 +0000 Received: from SATLEXMB08.amd.com (10.181.40.132) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Sat, 1 Jul 2023 23:14:17 -0500 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB08.amd.com (10.181.40.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Sat, 1 Jul 2023 21:14:17 -0700 Received: from BLR-LAB-SFW01.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2507.23 via Frontend Transport; Sat, 1 Jul 2023 23:14:13 -0500 From: "Abdul Lateef Attar" To: CC: Abdul Lateef Attar , Paul Grimes , Abner Chang , Eric Dong , Ray Ni , Rahul Kumar , Gerd Hoffmann , Michael D Kinney , "Liming Gao" , Zhiguang Liu , "Ard Biesheuvel" , Jiewen Yao , Jordan Justen Subject: [PATCH v15 0/8] Adds AmdSmmCpuFeaturesLib and MmSaveStateLib Date: Sun, 2 Jul 2023 09:44:11 +0530 Message-ID: X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Return-Path: AbdulLateef.Attar@amd.com X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT038:EE_|LV8PR12MB9181:EE_ X-MS-Office365-Filtering-Correlation-Id: 69e13cfe-6a8d-4390-429c-08db7ab2cdbf X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: PpgpdO9QDjowjk9aMRgGGTX0vjj41OaVWHLzMbcdSifdzJgJuknJv03Iph9eJKO4pIzyQv1D5lJ1zBh7qLHSOvVzJVGis8ESiu9tP2xF7nCkk+nAdX0BbSTSwwPZyxhRvL8i2YqvZfQOhhEyXFDcctkLyrYw88i6qq6A6VTYqB73iTqkaKgl17t3UD6SzPp3RtLvILEkHDBIrniBtRXT0aAHGi3VS6EuuLTXssrThHWRlb68vNRc3ss1N1N4EGizHj3lfRkM6n7HE30YGQpOJrcSS4dkMJwWukH58boSjydT00O+OTnRlw2KNGZYDnngBBbrvg71cAUQz0f99fNAjPMBjIOpmzPsOF4+BlXxyxNnZwQzK/2RsbGC5S2eCuEghphnhZbUHrI+mO+PnwxtTRjWoOone0Lj1tmSVKsvyRZAvrr40a/DEhnUUUo55CriboW/MdblPsEtuJDrhwupgSWi9U0orpjyzBUUgirJcVTSFIpEv+k01sIFSf9w839cGb7x/qDM+ZMyvOnW9pngFuP6gjOEp6BsA/2Gh42k9EHB6Auy5IDxjplRzbtgw5DFIGlggFevX9HbPTBB1cfa+8HyL4mpRHfdnFYXHxJZGfnF0V9LM/5GwseZv1WlEN1lK0KErwjsAQJK42kNDWmsweXCgA6y8vhjKt/dM4Va/opTNh8PHejayfbUe2MCQ/HXcDYzDUv00IjLuzoW+T/45G6Ma5EsLUVKZmvTLqMdsb6XVeDY2x4KE/f6ZM3CDU6QVxfS0DHOZISIoCzn3jQSP/05hcDueFjt5TZ1CKBGnfg= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB03.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230028)(6029001)(4636009)(396003)(136003)(39860400002)(376002)(346002)(451199021)(36840700001)(46966006)(40470700004)(7416002)(6916009)(4326008)(70586007)(70206006)(316002)(478600001)(2906002)(36756003)(8676002)(8936002)(5660300002)(40460700003)(336012)(41300700001)(40480700001)(966005)(36860700001)(19627235002)(54906003)(82310400005)(7696005)(426003)(26005)(186003)(47076005)(82740400003)(83380400001)(81166007)(356005)(2616005)(213903007)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Jul 2023 04:14:17.7219 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 69e13cfe-6a8d-4390-429c-08db7ab2cdbf X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT038.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV8PR12MB9181 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain Backward-compatibility changes: This patch series removes the SmmCpuFeaturesReadSaveStateRegister and SmmCpuFeaturesWriteSaveStateRegister interface/function. SmmReadSaveState() and SmmWriteSaveState() now directly invokes MmSaveSta= teLib routines to save/restore registers. PR: https://github.com/tianocore/edk2/pull/4597 V15: Delta changes Rebase the branch and fix the merge conflicts. V14: Delta changes Added @note to the MmSaveStateLib.h. SaveState(Read/Write) of EFI_SMM_SAVE_STATE_REGISTER_PROCESSOR_ID/EFI_MM_= SAVE_STATE_REGISTER_PROCESSOR_ID is handled by PiSmmCpuDxeSmm driver. Fixed PatchCheck warnings. V13: Delta changes Address review comments from Ray Ni Changed the BASE _NAME of AmdSmmCpuFeaturesLib. Removed EFIAPI from local function. Removed CpuIndex parameter from MmSaveStateGetRegisterLma Modifed MmSaveStateGetRegisterIndex () to accept RegOffset as second parameter. Removed FILE_GUID library instance for intel implemention from UefiCpuPkg= .dsc. V12: Addressed review comments from Michael. Added LibraryClasses to .inf file. removed duplicate MACRO definations. Moved related MACRO defination to respective file. V11: Delta changes Drop the OVMF implementation of MmSaveStateLib V10: Delta changes: Addressed review comments from Abner. V9: Delta changes: Addressed review comments. Rename to MmSaveStateLib. Also rename SMM_ defines to MM_. Implemented OVMF MmSaveStateLib. Removes SmmCpuFeaturesReadSaveStateRegister and SmmCpuFeaturesWriteSaveSt= ateRegister function interface. V8 delta changes: Addressed review comments from Abner, Fix the whitespace error. Seperate the Ovmf changes to another patch V7 delta changes: Adds SmmSmramSaveStateLib for Intel processor. Integrate SmmSmramSaveStateLib library. V6 delta changes: Addressed review comments for Ray NI. removed unnecessary EFIAPI. V5 delta changes: rebase to master branch. updated Reviewed-by V4 delta changes: rebase to master branch. added reviewed-by. V3 delta changes: Addressed review comments from Abner chang. Re-arranged patch order. Cc: Paul Grimes Cc: Abner Chang Cc: Eric Dong Cc: Ray Ni Cc: Rahul Kumar Cc: Gerd Hoffmann Cc: Michael D Kinney Cc: Liming Gao Cc: Zhiguang Liu Cc: Ard Biesheuvel Cc: Jiewen Yao Cc: Jordan Justen Cc: Abdul Lateef Attar Abdul Lateef Attar (8): MdePkg: Adds AMD SMRAM save state map UefiCpuPkg: Adds MmSaveStateLib library class UefiCpuPkg: Implements MmSaveStateLib library instance UefiCpuPkg/SmmCpuFeaturesLib: Restructure arch-dependent code UefiCpuPkg: Implements SmmCpuFeaturesLib for AMD Family UefiCpuPkg: Implements MmSaveStateLib for Intel UefiCpuPkg: Removes SmmCpuFeaturesReadSaveStateRegister OvmfPkg: Uses MmSaveStateLib library UefiCpuPkg/UefiCpuPkg.dec | 4 + OvmfPkg/OvmfPkgIa32.dsc | 1 + OvmfPkg/OvmfPkgIa32X64.dsc | 3 + OvmfPkg/OvmfPkgX64.dsc | 1 + UefiCpuPkg/UefiCpuPkg.dsc | 12 + .../MmSaveStateLib/AmdMmSaveStateLib.inf | 34 + .../MmSaveStateLib/IntelMmSaveStateLib.inf | 34 + .../AmdSmmCpuFeaturesLib.inf | 38 + UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf | 2 + .../Include/Register/Amd/SmramSaveStateMap.h | 194 +++++ UefiCpuPkg/Include/Library/MmSaveStateLib.h | 74 ++ .../Include/Library/SmmCpuFeaturesLib.h | 52 -- .../Library/MmSaveStateLib/MmSaveState.h | 94 +++ UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h | 56 +- .../SmmCpuFeaturesLib/SmmCpuFeaturesLib.c | 767 ------------------ .../Library/MmSaveStateLib/AmdMmSaveState.c | 309 +++++++ .../Library/MmSaveStateLib/IntelMmSaveState.c | 410 ++++++++++ .../MmSaveStateLib/MmSaveStateCommon.c | 132 +++ .../SmmCpuFeaturesLib/AmdSmmCpuFeaturesLib.c | 387 +++++++++ .../IntelSmmCpuFeaturesLib.c | 70 ++ .../SmmCpuFeaturesLibCommon.c | 128 --- UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c | 11 +- UefiCpuPkg/PiSmmCpuDxeSmm/SmramSaveState.c | 500 +----------- MdePkg/MdePkg.ci.yaml | 4 +- 24 files changed, 1809 insertions(+), 1508 deletions(-) create mode 100644 UefiCpuPkg/Library/MmSaveStateLib/AmdMmSaveStateLib.inf create mode 100644 UefiCpuPkg/Library/MmSaveStateLib/IntelMmSaveStateLib.i= nf create mode 100644 UefiCpuPkg/Library/SmmCpuFeaturesLib/AmdSmmCpuFeaturesL= ib.inf create mode 100644 MdePkg/Include/Register/Amd/SmramSaveStateMap.h create mode 100644 UefiCpuPkg/Include/Library/MmSaveStateLib.h create mode 100644 UefiCpuPkg/Library/MmSaveStateLib/MmSaveState.h create mode 100644 UefiCpuPkg/Library/MmSaveStateLib/AmdMmSaveState.c create mode 100644 UefiCpuPkg/Library/MmSaveStateLib/IntelMmSaveState.c create mode 100644 UefiCpuPkg/Library/MmSaveStateLib/MmSaveStateCommon.c create mode 100644 UefiCpuPkg/Library/SmmCpuFeaturesLib/AmdSmmCpuFeaturesL= ib.c --=20 2.25.1