public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH v2] UefiCpuPkg/MpInitLib: fix AP init issue in 64-bit PEI
@ 2018-01-25  7:42 Jian J Wang
  2018-01-25  8:22 ` Ni, Ruiyu
  0 siblings, 1 reply; 2+ messages in thread
From: Jian J Wang @ 2018-01-25  7:42 UTC (permalink / raw)
  To: edk2-devel; +Cc: Ruiyu Ni, Eric Dong, Laszlo Ersek

> v2:
>    Roll back changes (just white spaces) caused by misoperation in git

This issue is introduced by a patch at

   f32bfe6d061420a15bac6083063d227c567e6388

The above patch miss the case of 64-bit PEI, which will link
X64/MpFuncs.nasm instead of Ia32/MpFuncs.nasm. For X64/MpFuncs.nasm,
ExchangeInfo->ModeHighMemory should be always initialized no matter
if separate wakeup buffer is allocated or not. Ia32/MpFuncs.nasm will
not need ModeHighMemory during AP init. So the changes made in this
patch should not affect the functionality of it.

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jian J Wang <jian.j.wang@intel.com>
---
 UefiCpuPkg/Library/MpInitLib/MpLib.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c b/UefiCpuPkg/Library/MpInitLib/MpLib.c
index 42011d6231..0b7073fd02 100644
--- a/UefiCpuPkg/Library/MpInitLib/MpLib.c
+++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c
@@ -834,14 +834,15 @@ FillExchangeInfoData (
       );
 
     ExchangeInfo->ModeTransitionMemory = (UINT32)CpuMpData->WakeupBufferHigh;
-    ExchangeInfo->ModeHighMemory = (UINT32)CpuMpData->WakeupBufferHigh +
-                                   (UINT32)ExchangeInfo->ModeOffset -
-                                   (UINT32)CpuMpData->AddressMap.ModeTransitionOffset;
-    ExchangeInfo->ModeHighSegment = (UINT16)ExchangeInfo->CodeSegment;
   } else {
     ExchangeInfo->ModeTransitionMemory = (UINT32)
       (ExchangeInfo->BufferStart + CpuMpData->AddressMap.ModeTransitionOffset);
   }
+
+  ExchangeInfo->ModeHighMemory = ExchangeInfo->ModeTransitionMemory +
+                         (UINT32)ExchangeInfo->ModeOffset -
+                         (UINT32)CpuMpData->AddressMap.ModeTransitionOffset;
+  ExchangeInfo->ModeHighSegment = (UINT16)ExchangeInfo->CodeSegment;
 }
 
 /**
-- 
2.15.1.windows.2



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] UefiCpuPkg/MpInitLib: fix AP init issue in 64-bit PEI
  2018-01-25  7:42 [PATCH v2] UefiCpuPkg/MpInitLib: fix AP init issue in 64-bit PEI Jian J Wang
@ 2018-01-25  8:22 ` Ni, Ruiyu
  0 siblings, 0 replies; 2+ messages in thread
From: Ni, Ruiyu @ 2018-01-25  8:22 UTC (permalink / raw)
  To: Jian J Wang, edk2-devel; +Cc: Eric Dong, Laszlo Ersek

On 1/25/2018 3:42 PM, Jian J Wang wrote:
>> v2:
>>     Roll back changes (just white spaces) caused by misoperation in git
> 
> This issue is introduced by a patch at
> 
>     f32bfe6d061420a15bac6083063d227c567e6388
> 
> The above patch miss the case of 64-bit PEI, which will link
> X64/MpFuncs.nasm instead of Ia32/MpFuncs.nasm. For X64/MpFuncs.nasm,
> ExchangeInfo->ModeHighMemory should be always initialized no matter
> if separate wakeup buffer is allocated or not. Ia32/MpFuncs.nasm will
> not need ModeHighMemory during AP init. So the changes made in this
> patch should not affect the functionality of it.
> 
> Cc: Ruiyu Ni <ruiyu.ni@intel.com>
> Cc: Eric Dong <eric.dong@intel.com>
> Cc: Laszlo Ersek <lersek@redhat.com>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Jian J Wang <jian.j.wang@intel.com>
> ---
>   UefiCpuPkg/Library/MpInitLib/MpLib.c | 9 +++++----
>   1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c b/UefiCpuPkg/Library/MpInitLib/MpLib.c
> index 42011d6231..0b7073fd02 100644
> --- a/UefiCpuPkg/Library/MpInitLib/MpLib.c
> +++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c
> @@ -834,14 +834,15 @@ FillExchangeInfoData (
>         );
>   
>       ExchangeInfo->ModeTransitionMemory = (UINT32)CpuMpData->WakeupBufferHigh;
> -    ExchangeInfo->ModeHighMemory = (UINT32)CpuMpData->WakeupBufferHigh +
> -                                   (UINT32)ExchangeInfo->ModeOffset -
> -                                   (UINT32)CpuMpData->AddressMap.ModeTransitionOffset;
> -    ExchangeInfo->ModeHighSegment = (UINT16)ExchangeInfo->CodeSegment;
>     } else {
>       ExchangeInfo->ModeTransitionMemory = (UINT32)
>         (ExchangeInfo->BufferStart + CpuMpData->AddressMap.ModeTransitionOffset);
>     }
> +
> +  ExchangeInfo->ModeHighMemory = ExchangeInfo->ModeTransitionMemory +
> +                         (UINT32)ExchangeInfo->ModeOffset -
> +                         (UINT32)CpuMpData->AddressMap.ModeTransitionOffset;
> +  ExchangeInfo->ModeHighSegment = (UINT16)ExchangeInfo->CodeSegment;
>   }
>   
>   /**
> 
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>

-- 
Thanks,
Ray


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-01-25  8:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-25  7:42 [PATCH v2] UefiCpuPkg/MpInitLib: fix AP init issue in 64-bit PEI Jian J Wang
2018-01-25  8:22 ` Ni, Ruiyu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox