On 04/22/20 11:01, Dong, Eric wrote:
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2683
> 
> This patch fixes an assertion because AP can't find the CpuMpData.
> When AP is waken up through Init-Sipi-Sipi, AP's IDT should
> be restored to pre-allocated buffer so AP can get the CpuMpData
> through the IDT base address.
> Current code already has logic to handle this when CpuMpData->
> InitFlag is ApInitConfig but misses the logic
> when CpuMpData->InitFlag is ApInitReconfig.
> This patch fixes this gap.
> 
> Cc: Ray Ni <ray...@intel.com>
> Cc: Laszlo Ersek <ler...@redhat.com>
> Cc: Chandana Kumar <chandana.c.ku...@intel.com>
> Signed-off-by: Eric Dong <eric.d...@intel.com>
> ---
> V2:
> 1. Enhance code comments.
> 
>  UefiCpuPkg/Library/MpInitLib/MpLib.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c 
> b/UefiCpuPkg/Library/MpInitLib/MpLib.c
> index 64a4c3546e..2e87aa1f06 100644
> --- a/UefiCpuPkg/Library/MpInitLib/MpLib.c
> +++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c
> @@ -692,6 +692,16 @@ ApWakeupFunction (
>          //
>          RestoreVolatileRegisters 
> (&CpuMpData->CpuData[ProcessorNumber].VolatileRegisters, TRUE);
>        } else {
> +        if (CpuMpData->InitFlag == ApInitReconfig) {
> +          //
> +          // Initialize AP volatile registers in ApInitReconfig path.
> +          // ApInitReconfig happens when:
> +          // 1. AP is re-enabled after it's disabled, in either PEI or DXE 
> phase.
> +          // 2. AP is initialized in DXE phase.
> +          //
> +          RestoreVolatileRegisters 
> (&CpuMpData->CpuData[0].VolatileRegisters, FALSE);
> +        }
> +
>          //
>          // The CPU driver might not flush TLB for APs on spot after updating
>          // page attributes. AP in mwait loop mode needs to take care of it 
> when
> 

Thanks for spelling out the scenarios when this code path could be taken.

None of both cases seem to apply to OVMF (CPUs are initialized by
CpuMpPei, and I don't think I've ever tested CPI disable/enable). So I
don't expect any regression here.

Acked-by: Laszlo Ersek <ler...@redhat.com>

Thanks
Laszlo


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#58071): https://edk2.groups.io/g/devel/message/58071
Mute This Topic: https://groups.io/mt/73191434/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to