From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 3D4EE7803D9 for ; Tue, 28 Nov 2023 10:33:09 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=1A+u96HAB1RBQ07X9ufeJGn57mysanxMsoRSjQqum0Q=; c=relaxed/simple; d=groups.io; h=ARC-Seal:ARC-Message-Signature:ARC-Authentication-Results:From:To:CC:Subject:Thread-Topic:Thread-Index:Date:Message-ID:References:In-Reply-To:Accept-Language:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Language:Content-Type:Content-Transfer-Encoding; s=20140610; t=1701167587; v=1; b=YShStQdBxs3YNuFbh1ZQUOCnKA4XxbYaCNUT0JtBGTSLcmtHskk/buk+vIJx84+FnQKp5DNW x8DUFQPik2dVwJW9lEr6IROscNd2JsYRf4R1LYDoQ/fbLjnUq/ltqCMD9fvfA1blSQTbX03x9bT i8lsJteJhKZqt32F4rSqP3Ls= X-Received: by 127.0.0.2 with SMTP id BucQYY7687511xZSw6U5sBQC; Tue, 28 Nov 2023 02:33:07 -0800 X-Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.43]) by mx.groups.io with SMTP id smtpd.web11.29753.1701167587036824530 for ; Tue, 28 Nov 2023 02:33:07 -0800 X-IronPort-AV: E=McAfee;i="6600,9927,10907"; a="479095387" X-IronPort-AV: E=Sophos;i="6.04,233,1695711600"; d="scan'208";a="479095387" X-Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Nov 2023 02:33:06 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10907"; a="892033520" X-IronPort-AV: E=Sophos;i="6.04,233,1695711600"; d="scan'208";a="892033520" X-Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by orsmga004.jf.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 28 Nov 2023 02:33:05 -0800 X-Received: from fmsmsx611.amr.corp.intel.com (10.18.126.91) 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.34; Tue, 28 Nov 2023 02:33:05 -0800 X-Received: from fmsmsx603.amr.corp.intel.com (10.18.126.83) by fmsmsx611.amr.corp.intel.com (10.18.126.91) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.34; Tue, 28 Nov 2023 02:33:04 -0800 X-Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by fmsmsx603.amr.corp.intel.com (10.18.126.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.34 via Frontend Transport; Tue, 28 Nov 2023 02:33:04 -0800 X-Received: from NAM02-BN1-obe.outbound.protection.outlook.com (104.47.51.41) by edgegateway.intel.com (192.55.55.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.34; Tue, 28 Nov 2023 02:33:04 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QgknQx1Aettj+WQNN2FiAye0ADvJEU2j6DZFF7G4u6DgsF7Y2akcvvjLUCcouL2ePYJ+yhnm3ugsZT1BP7z0VS4+LV9Fqv3KSKxiZexUlS4kRYXPSUvpqCjTLYMn2BrD13O1rf8htIGPuJwsS2CIEMnynv8L3Z506lZLLd3dpTGfN1zHpVRGmTeQOD1nPwQB6jVg2RntdGsSckgHWkBXhvbnw+WeFC1LzJ6wh6YpRPoiviRlZUFCTFHLHeob0bps2YCsGQtT9T1ykBiIjsjNNIJvSBicLk1FvpQGylT9I/HyrQPXK/xQbpIYGSZ3cgF+mEzNu7Ky2f4JuC+bOKZVuQ== 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=T8umlwuArjAqmOoIt2/UNA92W1w+BBYYWJGfBGiJ558=; b=Vmg6s8nICYcV852A7mFeOE9eVC0KZ3/twMcPPppkxJZw20kqjSrfAtblUVDpdEgtqqsYSHjJlqy3qimg0PtSB28du6UH6ds1yLtiPjCsRm5w2Ey36tZUw36V9XPX+6E9J6xCuPbXZwb1mne+utLccxOyscX8J1CzMmYJJRF8e7pZq+AYHccKTF3Q1G0GIuXftbvh81l/Bbbh5tcTFquG51oExq6SOWCILAqSugvjouplWEFC8uBD+fEfcxFpLdp8Z7mDudjjaliN+G64TjOUIUutKjPAcnqIgEcVeABo7Iap4cTUVKacwVfq4vYfehzuuH6nU5SZNvfwHrk1ekUqDw== 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 X-Received: from MN6PR11MB8244.namprd11.prod.outlook.com (2603:10b6:208:470::14) by SJ0PR11MB7155.namprd11.prod.outlook.com (2603:10b6:a03:48d::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7025.27; Tue, 28 Nov 2023 10:33:02 +0000 X-Received: from MN6PR11MB8244.namprd11.prod.outlook.com ([fe80::b614:1f5e:8b0c:9858]) by MN6PR11MB8244.namprd11.prod.outlook.com ([fe80::b614:1f5e:8b0c:9858%4]) with mapi id 15.20.7025.022; Tue, 28 Nov 2023 10:33:02 +0000 From: "Ni, Ray" To: Tom Lendacky , "devel@edk2.groups.io" CC: "Dong, Eric" , "Kumar, Rahul R" , Gerd Hoffmann , Ard Biesheuvel , Michael Roth Subject: Re: [edk2-devel] [PATCH 2/2] UefiCpuPkg/MpInitLib: Copy SEV-ES save area pointer during APIC ID sorting Thread-Topic: [PATCH 2/2] UefiCpuPkg/MpInitLib: Copy SEV-ES save area pointer during APIC ID sorting Thread-Index: AQHaEQMISlUnTrJaUkyEIum5bn1n7rCPqkZA Date: Tue, 28 Nov 2023 10:33:01 +0000 Message-ID: References: <09a41658fc43ceffadf5bfcda44356fa38049935.1699310731.git.thomas.lendacky@amd.com> In-Reply-To: <09a41658fc43ceffadf5bfcda44356fa38049935.1699310731.git.thomas.lendacky@amd.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: MN6PR11MB8244:EE_|SJ0PR11MB7155:EE_ x-ms-office365-filtering-correlation-id: d9e12976-073c-4bdd-35c9-08dbeffd65fa x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam-message-info: 1tNA9lD2dzLOqg459LjyejRDkuGPinpn354p+tUAvJ2rBIDbyL/KYTYUyH/NlAd9ZLe417tkNML9CY/QWnBN4TpTqvcg+nbnwUx88Mt+Mxi9VdPMTE7Jqf9+47W1fMHbMkEf4o3PEDdkIYC7y+atxsXxpAN6AvnlrRiKEcwIK+POaH9U46rYfpr5KnwkCf/Pm2U18jNNEVktcOqw988KBlS+mG4f6gTrkNgnMwQO7Qw6bDAT8SbX5APy4IUalytBzLNXJcGuMNzijG+j2P2TViafxHJW+jcMKNCNWJbzGZ13tF3N91dxHHAhJYN2+jjAHL2VOZ5OLqW4O875wHmzDuWWM9b3eFwYj2lh/mYXGy06SS3BNjIFlK1HjjJg/Cc9N9g1W/pLVF0jKm6qlglhJHdxcKKAs++pqqMfMaIwbiBwKgrXl8fPL9RcCL1jCwOwgDnTGzJsdANHqD+B8Tp0Bbornd3H701Oozg/xUZqSkxeOgzBdUMYERGAU78EgsZuqzQ2DUaQHUVra8VCSLCR7A6dzK0maZ8D9Fzpp/Onoz8kk74/o8tdZoBfS4O2eaERoso6S/EMc+qYP9gp5zWdW/20u5J6m7wN3he6+e4LrWU= x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?5/50s+fQeFMe9uhD35a4bi5tTyjhD6Fifd8J+Elov9LLuoMZztUOerx0Rge/?= =?us-ascii?Q?2VH2xsrxw5vbnVeoEXI4tuqgKC3a3/mCZ5C24fVjyWfl4PhYRK9kwLdy4LTi?= =?us-ascii?Q?HaQa7rv8FVkekxWrZ64Xe9LnzH9LspfqVb/O6oFfeBKsYOepgFV6h+wN04/B?= =?us-ascii?Q?M1MtFN/tqdBYYux8T8wcrNGHxmJRNLypGd+uJurKy+FD2MOy/xe8N7P0rm3V?= =?us-ascii?Q?mnLkuYhROkBQfAkbbre7cnOEdCA11br+sn6xzR130ROfgBbcHtt8HaP7O5sP?= =?us-ascii?Q?vn+GcwdLyIGRBBqZJOGGvf1I5/yEiIPALCAn1RiSXi5MCkQIdwsTYxo5zTNZ?= =?us-ascii?Q?op/faEsT/MX8mO63BjE1dEKoF5vJRWOPw0Z6DRTep4Hml4yQ1MzoKTT+ntVf?= =?us-ascii?Q?7fiRTvVXS7Ca92I4wzlutda8KGCU8hqmT1s5P+aUODs6iH82FqUcKmBwDf1u?= =?us-ascii?Q?Ug/KVp5Q9C38U1drUa+q4YOOpzAPbROAfDZs2X3j1xCzMP5ZVfbUztiMiteU?= =?us-ascii?Q?maq+sJDFELDQVRpz5wNLm11b0Lq5gN6CNFmHaJ4hmrflqr59VcCbMw1ae+f5?= =?us-ascii?Q?srhsx4D4f6JbbvAHyZ+eELS1a8i9oYb7iR3SB6pD2noZSXpXNhld8BNCm/lo?= =?us-ascii?Q?9cEYHsIBEZcGU/wjwmuY3M5f8LKxhDxJO6E2it2i6U4gcOCObMmFSR4OyGtl?= =?us-ascii?Q?A0iQRL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-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MN6PR11MB8244.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: d9e12976-073c-4bdd-35c9-08dbeffd65fa X-MS-Exchange-CrossTenant-originalarrivaltime: 28 Nov 2023 10:33:01.9561 (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: OoJf/hAaPLbhYiOM2sv4cz1rs3WcwcuAr/tMv4a7R7ZXz23AM1GnAGxXQiAguC/mGES8EVf7ryd3R2SR8CBVCA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR11MB7155 X-OriginatorOrg: intel.com Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,ray.ni@intel.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: L3OA6PX5V94g4WJxV3JNwJCfx7686176AA= Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=YShStQdB; arc=reject ("signature check failed: fail, {[1] = sig:microsoft.com:reject}"); dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=intel.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io Reviewed-by: Ray Ni Thanks, Ray > -----Original Message----- > From: Tom Lendacky > Sent: Tuesday, November 7, 2023 6:46 AM > To: devel@edk2.groups.io > Cc: Dong, Eric ; Ni, Ray ; Kumar, > Rahul R ; Gerd Hoffmann ; > Ard Biesheuvel ; Michael Roth > > Subject: [PATCH 2/2] UefiCpuPkg/MpInitLib: Copy SEV-ES save area pointer > during APIC ID sorting >=20 > With SEV-SNP, the SEV-ES save area for a vCPU should be unique to that > vCPU. After commit 3323359a811a, the VMSA allocation was re-used, but > when > sorting the CPUs by APIC ID, the save area was not updated to follow the > original CPU. Similar to the StartupApSignal address, the SevEsSaveArea > address should be updated when sorting the CPUs. >=20 > This does not cause an issue at this time because all APs are in HLT stat= e > and then are (re)started at the same time, with the same VMSA contents. > However, this should be fixed to account for any change in future > behavior. >=20 > Fixes: 3323359a811a ("UefiCpuPkg/MpInitLib: Reuse VMSA allocation to ..."= ) > Signed-off-by: Tom Lendacky > --- > UefiCpuPkg/Library/MpInitLib/MpLib.c | 8 +++++++- > 1 file changed, 7 insertions(+), 1 deletion(-) >=20 > diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c > b/UefiCpuPkg/Library/MpInitLib/MpLib.c > index 9a6ec5db5ce9..a41b9e5701af 100644 > --- a/UefiCpuPkg/Library/MpInitLib/MpLib.c > +++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c > @@ -370,6 +370,7 @@ SortApicId ( > UINT32 ApCount; > CPU_INFO_IN_HOB *CpuInfoInHob; > volatile UINT32 *StartupApSignal; > + VOID *SevEsSaveArea; >=20 > ApCount =3D CpuMpData->CpuCount - 1; > CpuInfoInHob =3D (CPU_INFO_IN_HOB > *)(UINTN)CpuMpData->CpuInfoInHob; > @@ -397,12 +398,17 @@ SortApicId ( > CopyMem (&CpuInfoInHob[Index1], &CpuInfo, sizeof > (CPU_INFO_IN_HOB)); >=20 > // > - // Also exchange the StartupApSignal. > + // Also exchange the StartupApSignal and SevEsSaveArea. > // > StartupApSignal =3D > CpuMpData->CpuData[Index3].StartupApSignal; > CpuMpData->CpuData[Index3].StartupApSignal =3D > CpuMpData->CpuData[Index1].StartupApSignal; > CpuMpData->CpuData[Index1].StartupApSignal =3D StartupApSignal; > + > + SevEsSaveArea =3D > CpuMpData->CpuData[Index3].SevEsSaveArea; > + CpuMpData->CpuData[Index3].SevEsSaveArea =3D > + CpuMpData->CpuData[Index1].SevEsSaveArea; > + CpuMpData->CpuData[Index1].SevEsSaveArea =3D SevEsSaveArea; > } > } >=20 > -- > 2.42.0 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#111806): https://edk2.groups.io/g/devel/message/111806 Mute This Topic: https://groups.io/mt/102432047/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/leave/12367111/7686176/19134562= 12/xyzzy [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-