From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mx.groups.io with SMTP id smtpd.web11.52745.1683788171168290611 for ; Wed, 10 May 2023 23:56:11 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=JCwoAB/w; spf=pass (domain: intel.com, ip: 192.55.52.115, mailfrom: ray.ni@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1683788171; x=1715324171; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=XUGHD/Zj6UUOeMF7sw82bNjj7qtrZICMaVK9Gqrp3Gs=; b=JCwoAB/wyHMnJeM7c+83OazSoZVhcBFNS/pf3ZkE2gn9l/LofehS+lB9 2l/7aXDruuLBuz5i5UglyieOKI95fMBl9tFwpZF43cma/F+WeeV0D4WNY Tfz8uF/nL8ARsrzfMZF5kmecMLgxlcJ52EGw7CUwwgk7z5SmJWMN8yAld zEFyLFeGWLcpFjz5jCZR4sWE3MlQ2NvWwr1Hl0sngYPYKey+iAncHsCkD UFvG7j+T5JeeZGMks/sfvRfSl/IDgIwn4V+TF78i5pOPfsr3XvMNRtmZe TCVR1nWZhLecGw/ehZw3chYl3laIm0skdNrOCiFu8XIH+OGRs6mf0fe75 g==; X-IronPort-AV: E=McAfee;i="6600,9927,10706"; a="350444916" X-IronPort-AV: E=Sophos;i="5.99,266,1677571200"; d="scan'208";a="350444916" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 May 2023 23:56:10 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10706"; a="699591199" X-IronPort-AV: E=Sophos;i="5.99,266,1677571200"; d="scan'208";a="699591199" Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by orsmga002.jf.intel.com with ESMTP; 10 May 2023 23:56:10 -0700 Received: from fmsmsx612.amr.corp.intel.com (10.18.126.92) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Wed, 10 May 2023 23:56:09 -0700 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx612.amr.corp.intel.com (10.18.126.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Wed, 10 May 2023 23:56:08 -0700 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) 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.23 via Frontend Transport; Wed, 10 May 2023 23:56:08 -0700 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (104.47.58.100) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.23; Wed, 10 May 2023 23:56:08 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=l/qUp6NFOKoy5QVu0sFbtJ/i7gByQJpZRYDqMzunKPoQ31cxBypLKbiI0hRlrTKDAddryNEaxfgKSk0DNeBdRO2+b4RwqF46jChEV3PTD8kaiuMbxwyn1mNWNIKngRrbMh1ZhyRo+GZEEpQe7CYMpdz0CJy2g0QjKgn/LQZrNTuoyh0E1YLga+gb83cg7ECht6fUkAnTwrnAd1l5968bQZLmUfXQB4HZccQHiAjsjSiY58zQ0ousyYo33XLFeYrauS/EkJ61I2uAGG6g4pqUyQJ7jAFgSiYA/4AG/YCEvKwte0B4BH1wS9Crp3LbkOgkf+An6Jd0578qKJHFL8Ax8w== 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=MZ9jaDg758RdTHxecXw+zr1upqWQ47uU3QcQn/uxZOk=; b=VhQd4qNpNbyYH+rXtTwAjRO0Ubfy6ej1TdZfI5soSbzKGlmymW9wBzZVTlEFPFfHhElIl6ghTU93SZnKbaixUHXNfDuAOhkxScOTs4+cqqJmchGQp2FWvQFE59KBqsEMQ4WmHHPQWf9IT6Oz88OTLwtiSryT47HQ+5WaO9VjxeB5jsmXQt3syVYH5QjIrIZGmKjv2SoJHDXBuMdY8uXWsGgi+TbcBOELVD/foOkmjD2SpjyjKK6bjKQN0j9QG1Zln0ke8VyqPGdv0qJYSpfkiPDHQhanZyeN97270Wg06eLpq3JoHd3hQ/MkPmq8JMy2r0WyHs5HZN6Tl0vCjzQ76w== 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 MN6PR11MB8244.namprd11.prod.outlook.com (2603:10b6:208:470::14) by MN6PR11MB8193.namprd11.prod.outlook.com (2603:10b6:208:47a::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6363.32; Thu, 11 May 2023 06:55:47 +0000 Received: from MN6PR11MB8244.namprd11.prod.outlook.com ([fe80::892b:b8e6:bab7:635d]) by MN6PR11MB8244.namprd11.prod.outlook.com ([fe80::892b:b8e6:bab7:635d%5]) with mapi id 15.20.6363.032; Thu, 11 May 2023 06:55:47 +0000 From: "Ni, Ray" To: Abdul Lateef Attar , "devel@edk2.groups.io" , "Wu, Jiaxin" CC: Paul Grimes , Abner Chang , "Dong, Eric" , "Kumar, Rahul R" , Gerd Hoffmann , "Kinney, Michael D" , "Gao, Liming" , "Liu, Zhiguang" , "Ard Biesheuvel" , "Yao, Jiewen" , "Justen, Jordan L" , "Holthaus, CJ" Subject: Re: [PATCH v11 0/8] Adds AmdSmmCpuFeaturesLib and MmSaveStateLib Thread-Topic: [PATCH v11 0/8] Adds AmdSmmCpuFeaturesLib and MmSaveStateLib Thread-Index: AQHZf9BYwljLSgFxIECt6QiQHw56Lq9UnaGw Date: Thu, 11 May 2023 06:55:47 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US X-Mentions: jiaxin.wu@intel.com 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: MN6PR11MB8244:EE_|MN6PR11MB8193:EE_ x-ms-office365-filtering-correlation-id: d3770a08-5d9f-4a68-ddc5-08db51ecbfad x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: wi5is70/nntxgKKXdqD7FYRnJFtf8grKoi3i2VykKd32senk8OPssSVINkBnkQhXpgcsxZYRfjzy6yrEJg8jqZSRrWVtxXxWuQFQIXu3WpjUCQ54SJQI7M2ydVTUN9gbv2RIXnPvQpQK4gz+5HiBb7cLBDd5viTCeXNG0m6Rp4XUpl1onLTdTAxVRPesepUJ0Am+MM5TGI0td/RIj2ABHr5LiUVE5/HihnRKtC4ZDoA/bb2iEt2zpx0L/N0H6ZtmsCa5hJehvcGzmNobhvEvq2GnHfIiknb1c8tWGHh/Nnv68ZP31pqY6jQ/1GzBilcIeIWA64AYv9p3GeCv4UYyR/ND50r0mK5SjEuS8hzDOFCVSucUTH7cVztnc04iD7nIglSZIxNrSke33xURJPYsuMA/DRtFndw1XrkuJFcFriSyeXBjaux4gGXK7foEQkfTB5fGlYytuyCBw6rVV1cBKBfbMQIs1uHUlqhDltdzEiGdj6ET+0wZtu54zfBMsLx4UK1UTHLvRgHCET7qe2NFg3X9Eat/Ls9KmlciBNj8jdpqD68oXEUOpJ88gOMaPXP/pKTXiUYj3pA7MTthV1X4P5/XFQGkyQ/IXE6T8xQuy8NcJUggovXQgIbEXIS5FNts x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MN6PR11MB8244.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(6029001)(346002)(136003)(366004)(39860400002)(396003)(376002)(451199021)(41300700001)(316002)(8676002)(110136005)(54906003)(8936002)(478600001)(52536014)(71200400001)(76116006)(19627235002)(66446008)(2906002)(66556008)(66946007)(6636002)(66476007)(64756008)(5660300002)(4326008)(53546011)(966005)(9686003)(6506007)(26005)(107886003)(82960400001)(186003)(55016003)(7696005)(38070700005)(33656002)(83380400001)(38100700002)(122000001)(86362001)(213903007);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?8l7Kr1A5oti8jD9B0/NJ2JDSxfNCwLutostExRDZe69G8qX3Z0OZ9GnqsN/p?= =?us-ascii?Q?bA0WNFUAB7fAp1LMM9lhxv0HK4wNVyfI/IuBVAq+oQklhwzWyIXCLNheG5sA?= =?us-ascii?Q?mBTgUZO/MHIp9QU3U1zb1v/+CjFDre+ruw3Wti7GFNGBDPoQlIx7Ah80gUJO?= =?us-ascii?Q?/fmae3t8SQw4TsMHK/3P01/u+jtMO8dfzOFNJLHHbPH+QvBBiuJF0I5UjrwP?= =?us-ascii?Q?uterYwlWfWZq4gya1ybfzQqfB4FF3VOidYwa0R9j3G6vdtzlq+SNwEFPcVxy?= =?us-ascii?Q?vbBn/JUAsANcu6Sz9bM0+3OX9KFBz+ePNDVW6LZdgzKs0K+uE9MPL8tlAsRT?= =?us-ascii?Q?R8DA7EZ9fcrF6NaGtzTC+GWQFF3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uZn?= =?us-ascii?Q?t1gPw8zwmMJTk6E7447hePMXX0HSU2NUOFGv2OKtxWPqfulf8reaEDXRF03G?= =?us-ascii?Q?APVlisT9CFGuttSBcAbTfInkwlZvuQlCf6EZWFJzAAVsgghS6TY7PqwgoBHw?= =?us-ascii?Q?FT2vdTDoQiTzNGRi1hX5CKPYe6DW65FJsZ5Y6rg4B6dUmPxhteDK53BfrX1X?= =?us-ascii?Q?fYY7kb58mfVHhyUhXyJ3b/U5Td5I3yNF1oRPonUuPCLruaUFNiwdoouyZZja?= =?us-ascii?Q?soKL93oA/cFzDr4U7zy3FonAYYw1SdPbAglo2BRJl01y7VkLeFfAUInfe8wU?= =?us-ascii?Q?OXAnbxvXJFrAwhROnic=3D?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MN6PR11MB8244.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: d3770a08-5d9f-4a68-ddc5-08db51ecbfad X-MS-Exchange-CrossTenant-originalarrivaltime: 11 May 2023 06:55:47.2944 (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: pm7m4v+3KKYENvA1U4SijJImxMgXf2O9V5Fzp7zKCbtLZTIdZgCn+h+9c6MeiG2+0jvdshU6KkCvkU5c61ZKWQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN6PR11MB8193 Return-Path: ray.ni@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable > UefiCpuPkg: Adds MmSaveStateLib library class You can take "Reviewed-by: Ray Ni " for this patch. > UefiCpuPkg/SmmCpuFeaturesLib: Restructure arch-dependent code You can take "Reviewed-by: Ray Ni " for this patch. > UefiCpuPkg: Implements SmmCpuFeaturesLib for AMD Family One comment: can you please change the BASE_NAME in lib INF to "AmdSmmCpuFe= aturesLib"? The BASE_NAME guides tool to generate the .Lib file in the disk. Choosing different BASE_NAME for Intel and AMD lib instance can avoid one L= IB file is replaced by the other during pkg build. > UefiCpuPkg: Implements MmSaveStateLib for Intel 1. MmSaveStateLib local functions should not have "EFIAPI". Please only add= "EFIAPI" for lib APIs. 2. MmSaveStateGetRegisterLma() doesn't need to carry "CpuIndex" as paramete= r. Can you please remove the parameter? 3. MmSaveStateGetRegisterIndex () returns wrong value for Intel processors = because it uses Offset ( =3D 2) but Intel implementation uses Offset ( =3D = 4). (I remember comments #1, #3 were both raised last time when I reviewed the = patch.) > UefiCpuPkg: Removes SmmCpuFeaturesReadSaveStateRegister You can take "Reviewed-by: Ray Ni " for this patch. One more comment: Can you please avoid FILE_GUID overridden in UefiCpuPkg.dsc for Intel insta= nce of SmmCpu driver? AMD instance can override the FILE_GUID for sure. @Wu, Jiaxin, we will need to change the close-source SmmCpuFeatureLib accor= dingly (separating the SaveState access code into a different lib) when thi= s patch series are merged. > -----Original Message----- > From: Abdul Lateef Attar > Sent: Saturday, May 6, 2023 12:07 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: [PATCH v11 0/8] Adds AmdSmmCpuFeaturesLib and MmSaveStateLib >=20 > PR: https://github.com/tianocore/edk2/pull/4341 >=20 > 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. >=20 > 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 >=20 > 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 >=20 > UefiCpuPkg/UefiCpuPkg.dec | 4 + > OvmfPkg/OvmfPkgIa32.dsc | 1 + > OvmfPkg/OvmfPkgIa32X64.dsc | 3 + > OvmfPkg/OvmfPkgX64.dsc | 1 + > UefiCpuPkg/UefiCpuPkg.dsc | 14 + > .../MmSaveStateLib/AmdMmSaveStateLib.inf | 28 + > .../MmSaveStateLib/IntelMmSaveStateLib.inf | 28 + > .../AmdSmmCpuFeaturesLib.inf | 38 + > UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf | 2 + > .../Include/Register/Amd/SmramSaveStateMap.h | 194 +++++ > UefiCpuPkg/Include/Library/MmSaveStateLib.h | 70 ++ > .../Include/Library/SmmCpuFeaturesLib.h | 52 -- > .../Library/MmSaveStateLib/MmSaveState.h | 102 +++ > UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h | 56 +- > .../SmmCpuFeaturesLib/SmmCpuFeaturesLib.c | 767 ------------------ > .../Library/MmSaveStateLib/AmdMmSaveState.c | 309 +++++++ > .../Library/MmSaveStateLib/IntelMmSaveState.c | 413 ++++++++++ > .../MmSaveStateLib/MmSaveStateCommon.c | 138 ++++ > .../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, 1812 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 >=20 > -- > 2.25.1