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.web10.3321.1689066369563252879 for ; Tue, 11 Jul 2023 02:06:09 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@amd.com header.s=selector1 header.b=bHNGYwex; 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=beeDtMCATYL9aC9rv1uspj0s+7So8orIqtFDSiE5UHoTz3OEOctzF30BsNci8JBleBKBm6Cnmuu4WinPjzpps/Tg5HcUh1Dh934aMTbuFeS0DL1mQX9/q7/27F1pI+NQgkmOfeHvbI6VaoWAJGPFHjy20LG8gckp/x6g9O72I49Rg9kDDATtbDK/TrsgO/ALqG+m3mfiC429wfH/AgvXNTiayQkZ6Nu0hHPoLmK6YpljeJZQ8f+KArCI5CrKesEHL9FsPJy1PDRPtUXMEHJCwXRZNentj/dzuA4m7xWE54p1XH0HGQlnDUPA8GjghF/fHzBx86SwY/07Ix3nlWGdGQ== 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=JZ8qdIYTBUjlda+4vB0oTy47jpz9lnFT8FTvUvmzxSc=; b=a7i3/cKlCyW+SG5VSNy1/eGG0iejbnKpKTaeBIBOO0V1tKrvXQV0mpxTDHv06CPymuZGAx1H3AJLN6vb+CqxE/6zfT7pbMIVn+0Ih2OQ6fTdoE+Oms3uiTeTnZD/yTV9t3Qx2VU2Pga3wyjBKBkcv/kJaX2RA/2UemgUCB+a8TjzeDtDEeGUeMrCasivjZZsJTI7SKePZViZgMK+Z9ZNv3p+t6PRsxyChwH4c0k1419XVl8zYAr6O3NAo3v16eBzNqpOwUuBX2dLxxdFLhe0h4w9N6K4zCqe1iwXyGAWXvwKGZAGhRhQb1mXz0Kx2V0OMCe8CHuMT/Ia/sxIHnLKOA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; 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=JZ8qdIYTBUjlda+4vB0oTy47jpz9lnFT8FTvUvmzxSc=; b=bHNGYwexS6SH5yQuJsiTE/Ht/VHSAWEnpD2r5KNga6kFitj3JFOLammhDKLJw7OWkUvpivsd7ucNNOyLWm/9lQZxtsYGLEfeyCzV+iQD2w00TVgRSpX3oGFKybECTY0XN2QZeNRsJKFUypfUEJBgq9Yq2ETluims+rEa5mnM49E= Received: from IA1PR12MB6458.namprd12.prod.outlook.com (2603:10b6:208:3aa::22) by CY8PR12MB7514.namprd12.prod.outlook.com (2603:10b6:930:92::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6565.32; Tue, 11 Jul 2023 09:06:03 +0000 Received: from IA1PR12MB6458.namprd12.prod.outlook.com ([fe80::52d6:3130:de5e:c6da]) by IA1PR12MB6458.namprd12.prod.outlook.com ([fe80::52d6:3130:de5e:c6da%5]) with mapi id 15.20.6565.028; Tue, 11 Jul 2023 09:05:55 +0000 From: "Attar, AbdulLateef (Abdul Lateef)" To: "Ni, Ray" , "Tan, Dun" , "devel@edk2.groups.io" , "Chang, Abner" Subject: Re: Use gMmst from MmServiceTableLib in MmSaveStateLib Thread-Topic: Use gMmst from MmServiceTableLib in MmSaveStateLib Thread-Index: AQHZrxyehADTUL7+sU627KUQ+0uppa+0QAeAgAAOyWA= Date: Tue, 11 Jul 2023 09:05:55 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_ActionId=6dc398f7-412d-44ef-b71b-fb1cde65807a;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_ContentBits=0;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_Enabled=true;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_Method=Standard;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_Name=General;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_SetDate=2023-07-11T09:03:11Z;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_SiteId=3dd8961f-e488-4e60-8e11-a82d994e183d; authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: IA1PR12MB6458:EE_|CY8PR12MB7514:EE_ x-ms-office365-filtering-correlation-id: 17bdc136-7d0d-4a22-8c5f-08db81ee08f6 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: IV6noiON4ck+2ultslVDjupP2ArWMMVtgman4RC/+QiSNu0J2I2CjcuqSnX2cCq6CX7zOvxfzPR9x3pkM7HCABiyoLEGY8FsDp+ZZSdcZ7ZGh8HND8LrU/MqRMvPywztE1N/O9NFRLTUDn95epoxSBEec+0w7v8T1xcE30SuFupKaYchrep04AXpkVRMVnCJDY/k9Cgl8sHn8YaMG8X24+LrolFygTZacorrhWR2sZjrKbBA2gAz+6jS5TRDCwzHTYJxsCIsB0iMD66AVta2bP7DGPT7TRRqEpMKjVAVbI/m++T978y3CdT9r4f1dNjXp18KUuXiA2fkFlOHwBYHO3ZmwrkIXyIpIJUny/exIw3PF37Z7eaMUVVn5EQw/YvaE6I6FcNSa908IRAUPQjvZXcf7pbfNMgZ8lgFuS30yssp9pjJV0ostPx5wgCYFwskcbxi6MldD7u6omrQ38lVK2GYcMqNd43no9lOpUfgprXzyKmRI4rKV5XZJmTE4SdKZAnxsaUfFfzZ3cb1+Sqz0etcG40L9dxbV1J3NFKjUbAnm2zd29FRDmpft5zZneV3wjFGseGv6MKDaXpCt8jXP+mLQttmsO7F8p1/PRH6d1Ix5GsU/SgsvzP5QzAUBrg3OMTuIdMLGq8UtCtwej36bA== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:IA1PR12MB6458.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(6029001)(4636009)(366004)(376002)(346002)(39860400002)(396003)(136003)(451199021)(71200400001)(966005)(9686003)(316002)(66899021)(7696005)(110136005)(76116006)(19627235002)(122000001)(55016003)(38100700002)(38070700005)(478600001)(6636002)(2906002)(64756008)(66476007)(66446008)(66556008)(66946007)(83380400001)(186003)(5660300002)(8676002)(8936002)(52536014)(41300700001)(86362001)(33656002)(53546011)(6506007);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?1SfmToXLwt2UKDfxKvWlR56MPcbkx1P5mdWem0X/Efi3HgF+zYsrwzDQe72F?= =?us-ascii?Q?HphgAMRA5jmArW21WbsQlljl4fXRzJxWKpvIRN5AJhdQs2kfZbddQ/WhAsNF?= =?us-ascii?Q?2sm0dZ5psyx+K3zkNqJPhp8bpb2/tlLuqp1WYEaXPeedQWqht2tFCnaAGThx?= =?us-ascii?Q?U547NUiWywa7Q3OeTBkvfDHBd9VKMZKBAHnmjw65uV2Tx72elubmuId/0NmH?= =?us-ascii?Q?lIwfbvL5S7RZe8i/3KEt3f9F2r1ktP89eyNC8KDyKzBx/Kb8SYgC4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ytOUtwUpecJ8MVxOAWt5eW7qL2f5?= =?us-ascii?Q?SXL2gLxCsjD1rB0r8DBbU76swObccNyH9sjctcK8w1ng9sUYNfgbdzCNVTt7?= =?us-ascii?Q?nMwXrfikR48AhW9NqhdKnEbe38+yDvR+PhDf2sQajRfvSChtUrkqkHu8xJHv?= =?us-ascii?Q?JltjDB1rYxsIUa2PjDMhFOkGT3qpd764yFH4W3Y3joGgRdJisFPuluIDKkSZ?= =?us-ascii?Q?Fu3uL0nm7SR+uKKEqyrnxsK9Wu4AfRVXeFqkEb3kQe+TuWmvKcQ32JTqicpv?= =?us-ascii?Q?Vj11/6nJSfF13iErFNIYhbveM+/YAzxJUwh14+52VyVP8lhHOZSIFB0Awz7T?= =?us-ascii?Q?T5eDvbKZqPfDQ3wk4Q+cT1om/vhCos6wq8ijz1g5A+3n8oPm6n6/TG8kUA?= =?us-ascii?Q?=3D=3D?= MIME-Version: 1.0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: IA1PR12MB6458.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 17bdc136-7d0d-4a22-8c5f-08db81ee08f6 X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Jul 2023 09:05:55.5185 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: /H4+CEvt4P8rGFX7iuXW/LDYHA7/Mfz8ZBw3/mVrmlvVaORxctfSY/LktMde+BQyXJlgPZ7bzvFZrK/3XpjT+A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR12MB7514 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable [AMD Official Use Only - General] Hi Ray, I think Michael raised the similar concerned during the patch revie= w. Its intentionally kept it as gSmst because of the below reason. 2. AmdMmSaveStateLib and IntelMmSaveStateLib depend on SmmServicesTableLib.= Can they depend on MmServicesTableLib instead? [Attar, AbdulLateef (Abdul Lateef)] MmSaveStateLib is mainly used by PiSmmC= puDxeSmm driver which still uses Smm convention and preserve the SAVE_STATE= pointed by gSmst(Instead of gMmst). Hence I don't think we can move to MmServicesTableLib. Thanks AbduL -----Original Message----- From: Ni, Ray Sent: Tuesday, July 11, 2023 1:40 PM To: Tan, Dun ; devel@edk2.groups.io; Attar, AbdulLateef = (Abdul Lateef) ; Chang, Abner Subject: RE: Use gMmst from MmServiceTableLib in MmSaveStateLib Caution: This message originated from an External Source. Use proper cautio= n when opening attachments, clicking links, or responding. Abdul, Can you please send a patch to fix MmSaveStateLib to use gMmst (instead of = gSmst)? Using gSmst forbids the lib instance be linked by standalone MM modules. Thanks, Ray > -----Original Message----- > From: Tan, Dun > Sent: Wednesday, July 5, 2023 4:42 PM > To: devel@edk2.groups.io; abdattar@amd.com > Cc: Ni, Ray > Subject: Use gMmst from MmServiceTableLib in MmSaveStateLib > > Hi Abdul, > > In the new MmSaveStateLib created in this patch set, gSmst from > SmmServiceTableLib is used. This causes that only DXE_SMM_DRIVER type > module can consume this lib but MM_STANDALONE type module cannot. > > In current edk2, there are different MmServicesTableLib and > SmmServicesTableLib: > StadaloneMmServicesTableLib(MmServicesTableLib|MM_STANDALONE): > initialize gMmst in standalone SMM env. > MmServicesTableLib(MmServicesTableLib|DXE_SMM_DRIVER): > initialize gMmst in legacy SMM env. > SmmServicesTableLib(SmmServicesTableLib|DXE_SMM_DRIVER): initialize > gSmst in legacy SMM env. > > If MmSaveStateLib uses gMmst from MmServiceTableLib instead of gSmst, > then MmSaveStateLib can be consumed by both DXE_SMM_DRIVER and > MM_STANDALONE module. > Could you pls send patch to fix this? > > Thanks, > Dun > > -----Original Message----- > From: devel@edk2.groups.io On Behalf Of Abdul > Lateef Attar via groups.io > Sent: Sunday, July 2, 2023 12:14 PM > To: devel@edk2.groups.io > Cc: Abdul Lateef Attar ; Paul Grimes > ; Abner Chang ; Dong, Eric > ; Ni, Ray ; Kumar, Rahul R > ; Gerd Hoffmann ; Kinney, > Michael D ; Gao, Liming > ; Liu, Zhiguang ; > Ard Biesheuvel ; Yao, Jiewen > ; Justen, Jordan L > Subject: [edk2-devel] [PATCH v15 0/8] Adds AmdSmmCpuFeaturesLib and > MmSaveStateLib > > Backward-compatibility changes: > This patch series removes the SmmCpuFeaturesReadSaveStateRegister > and SmmCpuFeaturesWriteSaveStateRegister interface/function. > SmmReadSaveState() and SmmWriteSaveState() now directly invokes > MmSaveStateLib > 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_REGIS > TER_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 > SmmCpuFeaturesWriteSaveStateRegister > 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.inf > create mode 100644 > UefiCpuPkg/Library/SmmCpuFeaturesLib/AmdSmmCpuFeaturesLib.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/AmdSmmCpuFeaturesLib.c > > -- > 2.25.1 > > > >=20 >