From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mx.groups.io with SMTP id smtpd.web10.12413.1688546539557540811 for ; Wed, 05 Jul 2023 01:42:19 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=lpBqyfnp; spf=pass (domain: intel.com, ip: 192.55.52.93, mailfrom: dun.tan@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1688546539; x=1720082539; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=63CE5u/FY0XjTdjK8pmiDWsKopch4symyJKmInSCvqU=; b=lpBqyfnpa+q9xX1QSysa1+9JeuQwAnACfFWky99axQTxXdHga8sB5S3h 4DDA0gjvZqbHljElWN91/9mAqoOabK1TsEvEqZMOYq1uiT0bOHbwhvnJN gnT5mmzOgs44VG4EW2Uh3CIwn0WrcxBdj9Eo6MWFaHDCvd0H0rpUfc4nK r3Fn/SOgN05I8rRmRHs2izDRrPT3YsdPTFRRkr5Wmmc1PezWoZ+PnD6jG dcyzRsEVEv2TFGU5ShFEcwS6gxyTEi+mGABdy36m3Bbq9W0OJKCU6znuQ bPyy/IGK3sLaOqyFHT46zOnKe+C6jxp+iA55ZbwKHucFZTa6aMaoojitL g==; X-IronPort-AV: E=McAfee;i="6600,9927,10761"; a="360761582" X-IronPort-AV: E=Sophos;i="6.01,182,1684825200"; d="scan'208";a="360761582" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jul 2023 01:42:18 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10761"; a="719157336" X-IronPort-AV: E=Sophos;i="6.01,182,1684825200"; d="scan'208";a="719157336" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by orsmga002.jf.intel.com with ESMTP; 05 Jul 2023 01:42:17 -0700 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Wed, 5 Jul 2023 01:42:17 -0700 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27 via Frontend Transport; Wed, 5 Jul 2023 01:42:17 -0700 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (104.47.56.173) by edgegateway.intel.com (192.55.55.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.27; Wed, 5 Jul 2023 01:42:16 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Lwuo7rZJiV9NltTsGix3CJTMh9pHUNCo7AOz4jiiSakgJ4aGvZhevTOGa992zjBYWOOBZY5Rr/U2o+T7WDJfVzL2QYfvmezL+lQ8l7bWWgZOYMPa0L1iDZ6BTOzmaEjLeOgLCkEqOAZIztGCRkmGDkdm4f23oFnHf9T0RM83/Q457RfFUMkqXrb6jUYQS2mlaVIGTiFSJscIIi+rRopSsqJ94hS2XMrCeH7MQEF5ZcfAeYQ97RXtseULaDeo5KO//740njJPrwWbrCHLjY9Kz+ubJr9RvabX0yTe1iGHcfYW+1YOYPrvCzeXeoMb48GnRAxaWT6b7tns6ANdEfZlEQ== 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=CShFP116ZGYFNT20pSEfxkn6aqcYVmyaacWjo5QInH0=; b=LPTrCNhcNnZu715QZbjrSKnGjWpiVH/g1qWeGxaeHPPAqivcX+/kQk8JY48ONPrVyZCYS7UsyMnkf38cWMuIDTPrtEF7MH7AUaO4Lr9QEDObc3jvV0ijv1wlWnWr8srgGxtzLdfDiq1+5DGusWTByndLOgyC8cighp38N6BZmAEEm6XaC+7eMmxXrG6RXXo4s3K0Mf2AotzKddg33T+THKWpJht9BSMbp8YaOmhAFmnP9l6QJwDF4GpTgTXh0ffoJAnxY/LwUKENynzYkY+hDwivSYWJ3rOLucpHwrjLvVs9He8j0+sAtiFQUksXobsGtkqx4du6RusKpAls6hvbBA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Received: from BN9PR11MB5483.namprd11.prod.outlook.com (2603:10b6:408:104::10) by PH0PR11MB5016.namprd11.prod.outlook.com (2603:10b6:510:32::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6544.31; Wed, 5 Jul 2023 08:42:15 +0000 Received: from BN9PR11MB5483.namprd11.prod.outlook.com ([fe80::3023:34d3:bd4e:7901]) by BN9PR11MB5483.namprd11.prod.outlook.com ([fe80::3023:34d3:bd4e:7901%3]) with mapi id 15.20.6565.016; Wed, 5 Jul 2023 08:42:14 +0000 From: "duntan" To: "devel@edk2.groups.io" , "abdattar@amd.com" CC: "Ni, Ray" Subject: Use gMmst from MmServiceTableLib in MmSaveStateLib Thread-Topic: Use gMmst from MmServiceTableLib in MmSaveStateLib Thread-Index: AQHZrxyYgLTrGq7f5UqWdxIZhLqaaQ== Date: Wed, 5 Jul 2023 08:42:14 +0000 Message-ID: References: In-Reply-To: Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: BN9PR11MB5483:EE_|PH0PR11MB5016:EE_ x-ms-office365-filtering-correlation-id: 2f4471ea-ce2d-4925-3aa0-08db7d33bb57 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: /3ZWcenvw3tsdREFXdRomRsWEvQ1Wt9dCopVL+QCevXP7jij6V6w2Uo3smGRkpkbhP7Y60IWdgzAlHGVVP6z5NwR7lrT5ALOw6V3IetdF8T/X1Sh6KT9hC76Aq426+pC++O8wsNpY0aIk88sFQXAnq4IVEcTEGoRlJSJ7wB8a/G4y0YDFld5w67Nh2XgjX1+OO90ppnaz1rXTeDWyfwWTcBFr9hPNVyDREp15fp2yITbLjcwVjH4OAnxYFgzHB6BGalSPvjBik35UsXeD1cZzysVRP0esxKJ2bH9iONCj/FPaq4jWpdz8MloUEdK4LoeWpJXJTv/aKffA+nV6nLBuEQy5WloCP05Rgd7x8SMpIgkFLXZpIZmrPPcShSa+50FGftdvea6lX+j+DY7aY0BTUu6oihtQKvRdu+wLRPHMjgpicTv9SdMZnBW9ahzF7YeqJWZoyN3YyEacZ9xxQGsx8fPLTxgz2pNT7KUp4TWxL+L7Hm/P1tjHQRCIAg3hJ3RtalyZaEA6u3UFt2FJu5zTFdoLcIjZ9b8aq9wykzzTDQgpNm3ojyqjyB4ikJRcj10BwNijbWLwh/FVoGbzoExyjwiU3mMgh1j8E9c51D/TLHbXrNQBdKWAUfkAGMbVQxQEAFHp2GFm0kb0ofp0Tp0LA== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BN9PR11MB5483.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(6029001)(376002)(396003)(136003)(366004)(39860400002)(346002)(451199021)(52536014)(9686003)(966005)(5660300002)(107886003)(86362001)(33656002)(55016003)(82960400001)(38070700005)(83380400001)(110136005)(4326008)(76116006)(66946007)(6506007)(2906002)(19627235002)(64756008)(7696005)(478600001)(53546011)(66446008)(41300700001)(8936002)(71200400001)(8676002)(316002)(66476007)(66556008)(66899021)(122000001)(38100700002)(186003);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?lQmwnROWvAJarQeNJGC8vLC9pL4Ts1OU8n/cuE1ZRPTJA+AZ7e7nUVRFdVvv?= =?us-ascii?Q?q4OxCDw1tWzkw7l9LJYhod9XNxuNHnD+cN1KceWX7t9gO+eyulEsYKrxi1oT?= =?us-ascii?Q?jQzaF8T9uy/TcWS9Ni6zdVkX7xUaaywWbyCOgsoupmKIVcsKysnh6ccNEyC3?= =?us-ascii?Q?MtwoC5P53Fpr7pw2gsu2XDtv4W+/PAN5+A3QxRSZX70JU57LYzYqP37eVae4?= =?us-ascii?Q?wcEN/kVmh6m8s+WLUHvAnakvB2kINXuU7bESI6aX7H6Gk01OmbH8zkG4Bdnh?= =?us-ascii?Q?Zk/YJSk5n6JMl519gibDNPgbbNySs3Rk4POJUo8phAloEKBRPnL3b7RRw4h5?= =?us-ascii?Q?3LjqazOIBx+tF4wOIHmvHA86aRBf94tdTYXpplXh4JaVNTBDZYtUl7W8ZNOc?= =?us-ascii?Q?CsmC9Ev/5HlWI2UxYoeZQjIf12d4vnJ8HuArLcu1nfKemL0x6ypj+pJ1fEC2?= =?us-ascii?Q?Fo34+n7k7ZauNGS49mIXuc0xv2kPgtCgbV06USqgPKHldcIXP0ILKuFBiXJN?= =?us-ascii?Q?XhUpPljdbBTAA0vGjBewhvt78oimaLJPFU6QxGLt8QOhXVH1uNSdTykxDrKX?= =?us-ascii?Q?BAPcTe58inXdPUjB/3iIUL4YxZWCT9ss1mkyYAwnNXCjYR8ZQPd1Zuw5eKgt?= =?us-ascii?Q?1L1Tu2NzRGLLV/xl+3K54Uv8lbR5rNs382fKQQC4p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version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BN9PR11MB5483.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2f4471ea-ce2d-4925-3aa0-08db7d33bb57 X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Jul 2023 08:42:14.2709 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: vBmqjCFBwHePstX64ZWPl1xqTLKF6dWBs1npwcz2h4ubYjDitxF1pse7NF8hsGIUnJz1W3DEPlzKB95mu2vWag== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR11MB5016 Return-Path: dun.tan@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi Abdul, In the new MmSaveStateLib created in this patch set, gSmst from SmmServiceT= ableLib is used. This causes that only DXE_SMM_DRIVER type module can consu= me this lib but MM_STANDALONE type module cannot. In current edk2, there are different MmServicesTableLib and SmmServicesTabl= eLib: StadaloneMmServicesTableLib(MmServicesTableLib|MM_STANDALONE): initialize g= Mmst in standalone SMM env.=20 MmServicesTableLib(MmServicesTableLib|DXE_SMM_DRIVER): in= itialize gMmst in legacy SMM env.=20 SmmServicesTableLib(SmmServicesTableLib|DXE_SMM_DRIVER): initialize gSmst i= n 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 mod= ule. 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 Hof= fmann ; Kinney, Michael D ; = Gao, Liming ; Liu, Zhiguang ; Ard Biesheuvel ; Yao, Jiewen ; Justen, Jordan L Subject: [edk2-devel] [PATCH v15 0/8] Adds AmdSmmCpuFeaturesLib and MmSaveS= tateLib 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 10064= 4 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 -- 2.25.1