From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by mx.groups.io with SMTP id smtpd.web11.3942.1579074197167788769 for ; Tue, 14 Jan 2020 23:43:17 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 134.134.136.31, mailfrom: ray.ni@intel.com) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 Jan 2020 23:43:16 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,321,1574150400"; d="scan'208";a="225953074" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by orsmga006.jf.intel.com with ESMTP; 14 Jan 2020 23:43:16 -0800 Received: from fmsmsx101.amr.corp.intel.com (10.18.124.199) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 14 Jan 2020 23:43:16 -0800 Received: from shsmsx105.ccr.corp.intel.com (10.239.4.158) by fmsmsx101.amr.corp.intel.com (10.18.124.199) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 14 Jan 2020 23:43:15 -0800 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.197]) by SHSMSX105.ccr.corp.intel.com ([169.254.11.28]) with mapi id 14.03.0439.000; Wed, 15 Jan 2020 15:43:14 +0800 From: "Ni, Ray" To: "devel@edk2.groups.io" , "Dong, Eric" CC: Laszlo Ersek Subject: Re: [edk2-devel] [PATCH] UefiCpuPkg/Library/MpInitLib: Remove BSP index == 0 Assumption. Thread-Topic: [edk2-devel] [PATCH] UefiCpuPkg/Library/MpInitLib: Remove BSP index == 0 Assumption. Thread-Index: AQHVy2oDst6phhspP028HfdBKFPOcqfrV/mg Date: Wed, 15 Jan 2020 07:43:14 +0000 Message-ID: <734D49CCEBEEF84792F5B80ED585239D5C3F5870@SHSMSX104.ccr.corp.intel.com> References: <20200115060642.1707-1-eric.dong@intel.com> In-Reply-To: <20200115060642.1707-1-eric.dong@intel.com> Accept-Language: en-US, zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.2.0.6 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Return-Path: ray.ni@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Eric, What unit test was done for this patch? > -----Original Message----- > From: devel@edk2.groups.io On Behalf Of Dong, Eric > Sent: Wednesday, January 15, 2020 2:07 PM > To: devel@edk2.groups.io > Cc: Ni, Ray ; Laszlo Ersek > Subject: [edk2-devel] [PATCH] UefiCpuPkg/Library/MpInitLib: Remove BSP in= dex =3D=3D 0 Assumption. >=20 > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2392 >=20 >=20 > Current code implementation assumes BSP index is 0 at the begin. > This code change removes this assumption. It get BSP index from > the saved data structure if it existed. >=20 > Cc: Ray Ni > Cc: Laszlo Ersek > Signed-off-by: Eric Dong > --- > UefiCpuPkg/Library/MpInitLib/MpLib.c | 10 ++++++---- > 1 file changed, 6 insertions(+), 4 deletions(-) >=20 > diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c b/UefiCpuPkg/Library/Mp= InitLib/MpLib.c > index 6ec9b172b8..922c87b766 100644 > --- a/UefiCpuPkg/Library/MpInitLib/MpLib.c > +++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c > @@ -636,7 +636,7 @@ ApWakeupFunction ( > // to initialize AP in InitConfig path. >=20 > // NOTE: IDTR.BASE stored in CpuMpData->CpuData[0].VolatileRegiste= rs points to a different IDT shared by all APs. >=20 > // >=20 > - RestoreVolatileRegisters (&CpuMpData->CpuData[0].VolatileRegisters= , FALSE); >=20 > + RestoreVolatileRegisters (&CpuMpData->CpuData[CpuMpData->BspNumber= ].VolatileRegisters, FALSE); >=20 > InitializeApData (CpuMpData, ProcessorNumber, BistData, ApTopOfSta= ck); >=20 > ApStartupSignalBuffer =3D CpuMpData->CpuData[ProcessorNumber].Star= tupApSignal; >=20 >=20 >=20 > @@ -1615,6 +1615,7 @@ MpInitLibInitialize ( > UINTN ApResetVectorSize; >=20 > UINTN BackupBufferAddr; >=20 > UINTN ApIdtBase; >=20 > + UINT64 BspTopOfStack; >=20 >=20 >=20 > OldCpuMpData =3D GetCpuMpDataFromGuidedHob (); >=20 > if (OldCpuMpData =3D=3D NULL) { >=20 > @@ -1677,7 +1678,7 @@ MpInitLibInitialize ( > CpuMpData->BackupBufferSize =3D ApResetVectorSize; >=20 > CpuMpData->WakeupBuffer =3D (UINTN) -1; >=20 > CpuMpData->CpuCount =3D 1; >=20 > - CpuMpData->BspNumber =3D 0; >=20 > + CpuMpData->BspNumber =3D OldCpuMpData !=3D NULL ? OldCpuMpData-= >BspNumber : 0; >=20 > CpuMpData->WaitEvent =3D NULL; >=20 > CpuMpData->SwitchBspFlag =3D FALSE; >=20 > CpuMpData->CpuData =3D (CPU_AP_DATA *) (CpuMpData + 1); >=20 > @@ -1704,11 +1705,12 @@ MpInitLibInitialize ( > // Don't pass BSP's TR to APs to avoid AP init failure. >=20 > // >=20 > VolatileRegisters.Tr =3D 0; >=20 > - CopyMem (&CpuMpData->CpuData[0].VolatileRegisters, &VolatileRegisters,= sizeof (VolatileRegisters)); >=20 > + CopyMem (&CpuMpData->CpuData[CpuMpData->BspNumber].VolatileRegisters, = &VolatileRegisters, sizeof > (VolatileRegisters)); >=20 > // >=20 > // Set BSP basic information >=20 > // >=20 > - InitializeApData (CpuMpData, 0, 0, CpuMpData->Buffer + ApStackSize); >=20 > + BspTopOfStack =3D CpuMpData->Buffer + (CpuMpData->BspNumber + 1) * Cpu= MpData->CpuApStackSize; >=20 > + InitializeApData (CpuMpData, CpuMpData->BspNumber, 0, BspTopOfStack); >=20 > // >=20 > // Save assembly code information >=20 > // >=20 > -- > 2.23.0.windows.1 >=20 >=20 > -=3D-=3D-=3D-=3D-=3D-=3D > Groups.io Links: You receive all messages sent to this group. >=20 > View/Reply Online (#53263): https://edk2.groups.io/g/devel/message/53263 > Mute This Topic: https://groups.io/mt/69712223/1712937 > Group Owner: devel+owner@edk2.groups.io > Unsubscribe: https://edk2.groups.io/g/devel/unsub [ray.ni@intel.com] > -=3D-=3D-=3D-=3D-=3D-=3D