From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM02-BN1-obe.outbound.protection.outlook.com (NAM02-BN1-obe.outbound.protection.outlook.com [40.107.212.89]) by mx.groups.io with SMTP id smtpd.web10.2518.1686031684000631685 for ; Mon, 05 Jun 2023 23:08:04 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@amd.com header.s=selector1 header.b=T7BYga/5; 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.212.89, mailfrom: abdullateef.attar@amd.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=byE2C1r1ZpSBTU9187SbrW2BhcjOlhobGTgXmUgR2wUHBMM7xrTQKNzQTdBmj9dxScWYfz2jf/V+rbbqWkURSoojQydmCxe4r6JMKS6bwH8CS82+hVzSV0DQdy3ZkF9iPVZA/BhvHU91wdtESEnG6L8D0SKe+2+ZnZ8XNdIhu3qFONmspRft124CZLxFnF1ZgHbY616atw18Qt6GI8ZW7KFA4M1DL5v2Rj7QFJ06bHvagSOUZie/Q5gi13VX/ztQQ4PZYyTfKxMgNZ+JfKRsgKkUovF35frWZvD7pp7WHygpfOc6T3v5qyBdZ+cbnm/2DdP9GHLLkQUUtdMN06KE6g== 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=iaNDdJ9XeCW6xIaMQtLQJic1AIWBeNdqpEhB42VhGpw=; b=b8lc+EBb9MY9i2LxbMl5lwVxs9VzLrfJ2KlBP8qKiFGRIyL/FLX6KxLdxk0PU0Sa+mYL7Y3G/5Yls2WvfdVIJNLAyx5RVV8cnJUxdbZ9VGG3X3D/9Qx7MdQ9hxvb5JwyftR2Jef2qNKi5TW0TjAaVOm6nldg3PcGG+LRupmNUSZ+VGREMbz9QPImYVZXrUfqKFk1y+7JbHsapOiXwvP3MgNC66rMc3u6y5ajYiFVfLVgZ0U1yKj7KuWepM5au4kKHMQW65N7IqSsPBBzmc9OUFM0cA8V3DFMWMi4jW32AlH3HRTm0FEoWz0KtrP6HPJOnhGI2w0fJsjKP6qGFPhP3w== 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=iaNDdJ9XeCW6xIaMQtLQJic1AIWBeNdqpEhB42VhGpw=; b=T7BYga/5sG8LselDKfkjsjzox8+5Mb/pfL9qtfsvmQ8OT2sbL0Lk49FoD2ENEQJhPSmhoweptCs97Fa2DF3lDkDrKRIDNO+fIRYXUdKdzEL5hCyLJg2XswB7cfe1SmshZm/HwCx624nOeHAudkf9t3hlNJ1mCt2wm8L1a/mV/oI= Received: from BN1PR13CA0024.namprd13.prod.outlook.com (2603:10b6:408:e2::29) by SJ1PR12MB6218.namprd12.prod.outlook.com (2603:10b6:a03:457::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.32; Tue, 6 Jun 2023 06:08:01 +0000 Received: from BN8NAM11FT086.eop-nam11.prod.protection.outlook.com (2603:10b6:408:e2:cafe::dd) by BN1PR13CA0024.outlook.office365.com (2603:10b6:408:e2::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.19 via Frontend Transport; Tue, 6 Jun 2023 06:08:00 +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 BN8NAM11FT086.mail.protection.outlook.com (10.13.176.220) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6455.33 via Frontend Transport; Tue, 6 Jun 2023 06:08:00 +0000 Received: from SATLEXMB07.amd.com (10.181.41.45) 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.2375.34; Tue, 6 Jun 2023 01:08:00 -0500 Received: from SATLEXMB03.amd.com (10.181.40.144) by SATLEXMB07.amd.com (10.181.41.45) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Mon, 5 Jun 2023 23:07:36 -0700 Received: from BLR-LAB-SFW01.amd.com (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server id 15.1.2375.34 via Frontend Transport; Tue, 6 Jun 2023 01:07:32 -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 v14 0/8] Adds AmdSmmCpuFeaturesLib and MmSaveStateLib Date: Tue, 6 Jun 2023 11:37:20 +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: BN8NAM11FT086:EE_|SJ1PR12MB6218:EE_ X-MS-Office365-Filtering-Correlation-Id: fb653494-3d08-40c1-9fbc-08db665461b3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zebSb0kd7gBfE8C2kjMqfetHksnff9FvWo7SSPqiJ3+/l6RJ7grm6ONpoGoclTIeJQL4o/8UoaGApqken5j224wAlSs434Bb/JzOX1o9tYXjndWbuzJE6uDkNON2QdukcLmXWJn6LuFrtr66W9p7xKhYB5WjrlBTtL8pBwDMFZXpVwJrxOsXMMDF4qccDgV/c3/OWGnb+9PTbZFrCN8IAaMv46OTQLraTfHZlUQDql1fJROF/mAMxNRvvavXpUr0crNGko8SROCyFr8+wzlRZFyaMERMvf+KIAS6tNx4lg/kWZ5bdfzJyD0+fZQfITWUgvhb8LTRp+slSYc7bTz40p0fvpeIvUaG2kUp8JWEY3lfWLdYmKfNEpLuvakbWk3iztW96lFYQUWA1TF14w8gXJ0CSdVg3dTdhMBtt3MI4eXgMbn7wfsCEEkMoxhcbq/LFhAnRpyY4pErCa3UAPK9yLg/qYa+7uTb/7wipeHQSEVtZTAaSFF6X0A0YwSsV6qzrVJOEk4ZkJe+DpEvvmMI8j+rrM57z1po1KsSQM2NfslUnlOnR3O729FZu3NXubLMlIf4dvy1f6geS/REDQIIsz8SkaWAHTf+bZ1TyW//epe0L3sPrswo2YAcGR4E8PzX6vb+ICiQIZV3QUr72XYrGVqGIfsVOfcz2DgcNzPET6gPYgm1s29XwhNdmaAosy1OUS8INw55txNvdYwbxt04q0JJP3+Xa23BQoqFHM2Cnldch7vRnibW3hZSHWDKimOEuz5hwze0iAaE6+1j8hM0RIPxZHVhw6FJZ78N3QoOYHk= 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)(346002)(376002)(136003)(396003)(39860400002)(451199021)(40470700004)(46966006)(36840700001)(2616005)(41300700001)(336012)(426003)(7696005)(6666004)(47076005)(26005)(36860700001)(186003)(83380400001)(966005)(40460700003)(478600001)(40480700001)(19627235002)(54906003)(81166007)(6916009)(82310400005)(356005)(70586007)(82740400003)(70206006)(316002)(7416002)(8676002)(4326008)(5660300002)(8936002)(2906002)(36756003)(213903007)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jun 2023 06:08:00.5036 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fb653494-3d08-40c1-9fbc-08db665461b3 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: BN8NAM11FT086.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ1PR12MB6218 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/4519 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 | 13 + .../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, 1810 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