From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mx.groups.io with SMTP id smtpd.web12.33920.1602479480997113153 for ; Sun, 11 Oct 2020 22:11:21 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=EeWpi7Ks; spf=pass (domain: intel.com, ip: 134.134.136.126, mailfrom: ray.ni@intel.com) IronPort-SDR: KKPmfM8nz1tH/NZ0zU4VwlTvkPqEy7PDOheaM3ZyFo+LQyPk8VDKJr2AKQDtiK1XgeGY+niRhw b6jTjAUfPK4g== X-IronPort-AV: E=McAfee;i="6000,8403,9771"; a="153521378" X-IronPort-AV: E=Sophos;i="5.77,365,1596524400"; d="scan'208";a="153521378" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Oct 2020 22:11:19 -0700 IronPort-SDR: vsgn75eEEebhLo3MWndpJ/JLbka7Lr0MI6x4GQUstMiaTMUqVWLyWaZ0P8uoCaheklNi64zQYw c0bWD1LRw7LQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,365,1596524400"; d="scan'208";a="344731056" Received: from orsmsx606.amr.corp.intel.com ([10.22.229.19]) by fmsmga004.fm.intel.com with ESMTP; 11 Oct 2020 22:11:19 -0700 Received: from orsmsx609.amr.corp.intel.com (10.22.229.22) by ORSMSX606.amr.corp.intel.com (10.22.229.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Sun, 11 Oct 2020 22:11:18 -0700 Received: from orsmsx601.amr.corp.intel.com (10.22.229.14) by ORSMSX609.amr.corp.intel.com (10.22.229.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Sun, 11 Oct 2020 22:11:18 -0700 Received: from ORSEDG602.ED.cps.intel.com (10.7.248.7) by orsmsx601.amr.corp.intel.com (10.22.229.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5 via Frontend Transport; Sun, 11 Oct 2020 22:11:18 -0700 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (104.47.74.48) by edgegateway.intel.com (134.134.137.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.1713.5; Sun, 11 Oct 2020 22:11:17 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GZ/2iJI7Wa8D6nz9LkcLLOncpY89M4IEoMdhlZwaLea3BT515g5vxeL3SWytG0eaM5nbJHPAwoeuXB0Fqoc97RTn2IAcBSGBTut7tdTyGZt1pcSe/BqPoULw0Jq00azPA5kpgpz2QjuukBebICk6tpOV+0qflkAXu3d5hMLaM/XjOj1Fad1cbtuuLm/Nz1nh7Ac+V417XBXnZGUQIM6A1OntO3gLoq/QO6AO5T0DfYgqerOayayDJXTLi+ZyqnrvTsc7I5RiCSE39fxHUnSLcNcXABvn2FbzBnjwEQsWgOYU5SOqCu5byWb+7ugM2WgPHDvtQbRr6khQ+t0ezAApIQ== 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-SenderADCheck; bh=KPaI3dW89fEK/3zKFQIjKhlAPHoE0MP8x4yzy4KrHrg=; b=W0sJoydl0FGZQNhinOmPnUkv2nJgTA+6oC9qWyw6M6Ba0JLHdsSh1s/KF8Nwpie/YhXiqzx6TZi2KnvQ/ORYI4FNOnJPwtaVVYR2/QMNhCtWzjVmGWKvXzJ3t0PzS7/UCiGX1AriBkgIE6i85HK5OcWgSYIXm5hKdOQB6dkuRn4kbuiOvxu9dXcIn6x6ljTXo5zFAsb6JwHkhGbxWQDW+WH4yLZxshv4Hjcbl9RQjB3rJB5L4cd5PS64vVY4nrq+tO2AgKC9Be0AvlTY/uIjc3RP2l5I/fmMJQ7pZrXNJPhfd0fp3B0mAVWYFc72TW0NwzV4KYCUL1+UsOOJSqXabw== 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=KPaI3dW89fEK/3zKFQIjKhlAPHoE0MP8x4yzy4KrHrg=; b=EeWpi7KsspZLC5/xGG5kJZLllrZr8R3H5JqMSiyzINiFaprGSJDNdwPkSU8Rqa7UreiklfPkaDtlS1qmdMf6udi9wbq4tXr3foPruRZjGKFTDmxX+trl4jJZCP8EX6LjdO/sXA+a3yI39f8PrgzVhMpnJiKfoMbZt8iUZisVtjE= Received: from CO1PR11MB4930.namprd11.prod.outlook.com (2603:10b6:303:9b::11) by CO1PR11MB5092.namprd11.prod.outlook.com (2603:10b6:303:6e::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3455.29; Mon, 12 Oct 2020 05:11:16 +0000 Received: from CO1PR11MB4930.namprd11.prod.outlook.com ([fe80::9804:f9c4:d0d7:9961]) by CO1PR11MB4930.namprd11.prod.outlook.com ([fe80::9804:f9c4:d0d7:9961%3]) with mapi id 15.20.3455.029; Mon, 12 Oct 2020 05:11:16 +0000 From: "Ni, Ray" To: Tom Lendacky , "devel@edk2.groups.io" CC: Brijesh Singh , "Dong, Eric" , Laszlo Ersek , "Kumar, Rahul1" Subject: Re: [PATCH 9/9] UefiCpuPkg/MpInitLib: For SEV-ES guest set stack based on processor number Thread-Topic: [PATCH 9/9] UefiCpuPkg/MpInitLib: For SEV-ES guest set stack based on processor number Thread-Index: AQHWnx+cwNSgraMwYUSn1UKgpYS7TKmTbZDA Date: Mon, 12 Oct 2020 05:11:16 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: amd.com; dkim=none (message not signed) header.d=none;amd.com; dmarc=none action=none header.from=intel.com; x-originating-ip: [192.198.147.194] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: f0b4b5de-5740-47da-4b22-08d86e6d3f28 x-ms-traffictypediagnostic: CO1PR11MB5092: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:747; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: PPbTrNebunN1+pa5KSzcvPX5ol6gQmXgZ6+nn52uEmIMcJKCHDxdQv0DrnyzYBckBpdyG3HmUoIDPBSzcadGkVZYdji6CphhPYNRsa+pg2FbMs9fI5NXLdZZAl4ZJRpY+2wuwZ9bfLBjPlmRZhjmF4oR+NFjWSqWi4XGHtOwfg03VakWN6rgtFJsNp1s7jpuIwObAYoW88jMrMtOTd+wUvxne+CA/fYFsWwAJRrhSbcAHSuN0fbhMqUxyFYmmLnr8fhCE+dIiK2ktIREtXNqykapTa/JyXu4mVqdwWP8Fg0yStOGP2+Hcf4Y9lw3fWc3rHcfaYo0z5ZOPecUC3Q4eQ== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CO1PR11MB4930.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(6029001)(4636009)(366004)(39860400002)(346002)(376002)(136003)(396003)(86362001)(110136005)(71200400001)(83380400001)(66476007)(76116006)(66946007)(66556008)(54906003)(52536014)(19627235002)(5660300002)(66446008)(64756008)(8936002)(9686003)(186003)(2906002)(26005)(8676002)(33656002)(7696005)(55016002)(6506007)(107886003)(53546011)(316002)(4326008)(478600001);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata: WLyHuYSR7L/jl0LPvHJyIFTt+SH9ypw/YvmQlrVoxvlulhcMOxQC3IYWYX7iypzhXvRtCoi02duqvHlUJNPoxh2j7pt/Aw3x2xWra5/mlM2qauy3V7ri+ffCESpIxHPoetI0xYMmDkUh3UgMTHZ6beKHousV1VZCh6GNAq9a+c5rWIowOchMtVVmdpQjtVz16+ozPZltUEEEIJ0gZrB2XMeWN+dAa2xk4QN61fKphB+YGuXC6GHSn/A7IdBXpJ5rXoK84UEZDPSWJvWyxWN1ctGxbj5yjlKKKLBTg2Rdm8dPvdKhL+QCj93dYtNTrwto1uWgfTLsVMp47xKclBO+rDvWNz7oWRqSOczqA8kc5a1vl3RnZge4Mh3yEflCvBpMNSvHU0BwryA40A53RN2rMmndKE+maHY7lp0CCiqZ9hFOxoqi9YbWJDF/SG0xUa9nblOEme5/7OD9cDZHGIcKosm/DVQ3kJ69r4FbOnkg+wtxyEzykZMNFyFYX7Th80LcOAtBpy9526CQ+F31cyL9qSC73TFJ7ytYfji8dfZbqkbvQfQE4g4knWKBLHq0Wh1JgAqMKSmkA78DVVQKjFT1oOrXvWitnxET7EmLgMsfZnD4K6i8O0y3DvwXhS/0whQDZABN/Oepg/3Bb67GeXvTaA== MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: CO1PR11MB4930.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: f0b4b5de-5740-47da-4b22-08d86e6d3f28 X-MS-Exchange-CrossTenant-originalarrivaltime: 12 Oct 2020 05:11:16.1288 (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: n81Jc0a4odQmZSTKW8023bRnzHEPoj7O6vMRGbQMfok8EjujJQIT6+kXAiLN8L0RdQKeDxuNv1sPXncYUgDzxA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR11MB5092 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 Acked-by: Ray Ni > -----Original Message----- > From: Tom Lendacky > Sent: Sunday, October 11, 2020 12:07 AM > To: devel@edk2.groups.io > Cc: Brijesh Singh ; Dong, Eric ; > Ni, Ray ; Laszlo Ersek ; Kumar, Rahu= l1 > > Subject: [PATCH 9/9] UefiCpuPkg/MpInitLib: For SEV-ES guest set stack bas= ed > on processor number >=20 > From: Tom Lendacky >=20 > Set the SEV-ES reset stack address for an AP based on the processor numbe= r > instead of the APIC ID in case the APIC IDs are not zero-based and densel= y > packed/enumerated. This will ensure an AP reset stack address does not ge= t > set outside of the AP reset stack memory allocation. >=20 > Cc: Eric Dong > Cc: Ray Ni > Cc: Laszlo Ersek > Cc: Rahul Kumar > Signed-off-by: Tom Lendacky > --- > UefiCpuPkg/Library/MpInitLib/MpLib.c | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) >=20 > diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c > b/UefiCpuPkg/Library/MpInitLib/MpLib.c > index 07426274f639..71922141b70b 100644 > --- a/UefiCpuPkg/Library/MpInitLib/MpLib.c > +++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c > @@ -680,11 +680,16 @@ MpInitLibSevEsAPReset ( > IN CPU_MP_DATA *CpuMpData > ) > { > + EFI_STATUS Status; > + UINTN ProcessorNumber; > UINT16 Code16, Code32; > AP_RESET *APResetFn; > UINTN BufferStart; > UINTN StackStart; >=20 > + Status =3D GetProcessorNumber (CpuMpData, &ProcessorNumber); > + ASSERT_EFI_ERROR (Status); > + > Code16 =3D GetProtectedMode16CS (); > Code32 =3D GetProtectedMode32CS (); >=20 > @@ -696,7 +701,7 @@ MpInitLibSevEsAPReset ( >=20 > BufferStart =3D CpuMpData->MpCpuExchangeInfo->BufferStart; > StackStart =3D CpuMpData->SevEsAPResetStackStart - > - (AP_RESET_STACK_SIZE * GetApicId ()); > + (AP_RESET_STACK_SIZE * ProcessorNumber); >=20 > // > // This call never returns. > -- > 2.28.0