public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Ni, Ray" <ray.ni@intel.com>
To: "devel@edk2.groups.io" <devel@edk2.groups.io>,
	"Dong, Eric" <eric.dong@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Subject: Re: [edk2-devel] [PATCH] UefiCpuPkg/Library/MpInitLib: Remove BSP index == 0 Assumption.
Date: Wed, 15 Jan 2020 07:43:14 +0000	[thread overview]
Message-ID: <734D49CCEBEEF84792F5B80ED585239D5C3F5870@SHSMSX104.ccr.corp.intel.com> (raw)
In-Reply-To: <20200115060642.1707-1-eric.dong@intel.com>

Eric,
What unit test was done for this patch?

> -----Original Message-----
> From: devel@edk2.groups.io <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 <ray.ni@intel.com>; Laszlo Ersek <lersek@redhat.com>
> Subject: [edk2-devel] [PATCH] UefiCpuPkg/Library/MpInitLib: Remove BSP index == 0 Assumption.
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2392
> 
> 
> 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.
> 
> Cc: Ray Ni <ray.ni@intel.com>
> Cc: Laszlo Ersek <lersek@redhat.com>
> Signed-off-by: Eric Dong <eric.dong@intel.com>
> ---
>  UefiCpuPkg/Library/MpInitLib/MpLib.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c b/UefiCpuPkg/Library/MpInitLib/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.
> 
>        // NOTE: IDTR.BASE stored in CpuMpData->CpuData[0].VolatileRegisters points to a different IDT shared by all APs.
> 
>        //
> 
> -      RestoreVolatileRegisters (&CpuMpData->CpuData[0].VolatileRegisters, FALSE);
> 
> +      RestoreVolatileRegisters (&CpuMpData->CpuData[CpuMpData->BspNumber].VolatileRegisters, FALSE);
> 
>        InitializeApData (CpuMpData, ProcessorNumber, BistData, ApTopOfStack);
> 
>        ApStartupSignalBuffer = CpuMpData->CpuData[ProcessorNumber].StartupApSignal;
> 
> 
> 
> @@ -1615,6 +1615,7 @@ MpInitLibInitialize (
>    UINTN                    ApResetVectorSize;
> 
>    UINTN                    BackupBufferAddr;
> 
>    UINTN                    ApIdtBase;
> 
> +  UINT64                   BspTopOfStack;
> 
> 
> 
>    OldCpuMpData = GetCpuMpDataFromGuidedHob ();
> 
>    if (OldCpuMpData == NULL) {
> 
> @@ -1677,7 +1678,7 @@ MpInitLibInitialize (
>    CpuMpData->BackupBufferSize = ApResetVectorSize;
> 
>    CpuMpData->WakeupBuffer     = (UINTN) -1;
> 
>    CpuMpData->CpuCount         = 1;
> 
> -  CpuMpData->BspNumber        = 0;
> 
> +  CpuMpData->BspNumber        = OldCpuMpData != NULL ? OldCpuMpData->BspNumber : 0;
> 
>    CpuMpData->WaitEvent        = NULL;
> 
>    CpuMpData->SwitchBspFlag    = FALSE;
> 
>    CpuMpData->CpuData          = (CPU_AP_DATA *) (CpuMpData + 1);
> 
> @@ -1704,11 +1705,12 @@ MpInitLibInitialize (
>    // Don't pass BSP's TR to APs to avoid AP init failure.
> 
>    //
> 
>    VolatileRegisters.Tr = 0;
> 
> -  CopyMem (&CpuMpData->CpuData[0].VolatileRegisters, &VolatileRegisters, sizeof (VolatileRegisters));
> 
> +  CopyMem (&CpuMpData->CpuData[CpuMpData->BspNumber].VolatileRegisters, &VolatileRegisters, sizeof
> (VolatileRegisters));
> 
>    //
> 
>    // Set BSP basic information
> 
>    //
> 
> -  InitializeApData (CpuMpData, 0, 0, CpuMpData->Buffer + ApStackSize);
> 
> +  BspTopOfStack = CpuMpData->Buffer + (CpuMpData->BspNumber + 1) * CpuMpData->CpuApStackSize;
> 
> +  InitializeApData (CpuMpData, CpuMpData->BspNumber, 0, BspTopOfStack);
> 
>    //
> 
>    // Save assembly code information
> 
>    //
> 
> --
> 2.23.0.windows.1
> 
> 
> -=-=-=-=-=-=
> Groups.io Links: You receive all messages sent to this group.
> 
> 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]
> -=-=-=-=-=-=


  reply	other threads:[~2020-01-15  7:43 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-15  6:06 [PATCH] UefiCpuPkg/Library/MpInitLib: Remove BSP index == 0 Assumption Dong, Eric
2020-01-15  7:43 ` Ni, Ray [this message]
2020-01-15  7:52   ` [edk2-devel] " Dong, Eric
2020-01-16 12:23     ` Ni, Ray
2020-01-15 10:04 ` Laszlo Ersek
2020-01-16  3:15   ` Dong, Eric
2020-01-16  8:35     ` Laszlo Ersek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=734D49CCEBEEF84792F5B80ED585239D5C3F5870@SHSMSX104.ccr.corp.intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox