Agree, current is too much PCDs for the driver.

Laszlo, what’s your comments?

Thanks,
Eric
From: Fan Jeff <vanjeff_...@hotmail.com>
Sent: Friday, September 4, 2020 10:19 AM
To: devel@edk2.groups.io; Dong, Eric <eric.d...@intel.com>; Ni, Ray 
<ray...@intel.com>; ler...@redhat.com
Cc: Lou, Yun <yun....@intel.com>
Subject: 回复: [edk2-devel] [PATCH v2] UefiCpuPkg/MpInitLib: Add check for 
CR3/GDT/IDT.

Laszlo & Eric,

Introducing one new PCD to handle such rare test case is too heavy. I think We 
could do validating CR3/GDT/IDT space < 4GB address always in MpInitLib.

Jeff

发件人: Dong, Eric<mailto:eric.d...@intel.com>
发送时间: 2020年9月4日 10:01
收件人: Ni, Ray<mailto:ray...@intel.com>; 
devel@edk2.groups.io<mailto:devel@edk2.groups.io>; 
ler...@redhat.com<mailto:ler...@redhat.com>
抄送: Lou, Yun<mailto:yun....@intel.com>
主题: Re: [edk2-devel] [PATCH v2] UefiCpuPkg/MpInitLib: Add check for CR3/GDT/IDT.

I guess Laszlo think this check is not always needed, just used for this 
special shell application case. He wants to use default FALSE to always ignore 
this check and make code logic clear.

Thanks,
Eric

From: Ni, Ray <ray...@intel.com<mailto:ray...@intel.com>>
Sent: Friday, September 4, 2020 9:34 AM
To: devel@edk2.groups.io<mailto:devel@edk2.groups.io>; 
ler...@redhat.com<mailto:ler...@redhat.com>; Dong, Eric 
<eric.d...@intel.com<mailto:eric.d...@intel.com>>
Cc: Lou, Yun <yun....@intel.com<mailto:yun....@intel.com>>
Subject: Re: [edk2-devel] [PATCH v2] UefiCpuPkg/MpInitLib: Add check for 
CR3/GDT/IDT.

Why do we need a new PCD to control such check? Under what circumstance the PCD 
is false?
We may need to move such check out of MpLib.c. Because when bps runs at 32bit 
mode, AP doesn’t need to switch to long mode, such check is not needed and also 
always passes.

We should not assume PEI runs at 32 bit mode.


发件人: devel@edk2.groups.io<mailto:devel@edk2.groups.io> 
<devel@edk2.groups.io<mailto:devel@edk2.groups.io>> 代表 Laszlo Ersek 
<ler...@redhat.com<mailto:ler...@redhat.com>>
发送时间: Friday, September 4, 2020 3:55:47 AM
收件人: Dong, Eric <eric.d...@intel.com<mailto:eric.d...@intel.com>>; 
devel@edk2.groups.io<mailto:devel@edk2.groups.io> 
<devel@edk2.groups.io<mailto:devel@edk2.groups.io>>
抄送: Ni, Ray <ray...@intel.com<mailto:ray...@intel.com>>
主题: Re: [edk2-devel] [PATCH v2] UefiCpuPkg/MpInitLib: Add check for CR3/GDT/IDT.

On 09/03/20 21:00, Laszlo Ersek wrote:

> (10) More importantly, ValidCR3GdtIdtCheck() should not be called in the
> Worker functions for StartupAllAPs, StartupThisAP, SwitchBSP, and
> EnableDisableAP, in "UefiCpuPkg/Library/MpInitLib/MpLib.c".
>
> Instead, the calls should be made in the DXE instance of the library
> ("UefiCpuPkg/Library/MpInitLib/DxeMpLib.c"), at the very top of the
> functions:
>
> - MpInitLibStartupAllAPs
> - MpInitLibStartupThisAP
> - MpInitLibSwitchBSP
> - MpInitLibEnableDisableAP
>
> Here's why:
>
> (a) The symptom does not affect the PEI phase -- by the time the UEFI
> application is executed, the PEI phase has ended; there's no need to
> modify the PEI instance of the library.
>
> (b) The currently proposed failure exits are too late. For example, in
> the SwitchBSPWorker() function, by the time we exit, we have called
> DisableApicTimerInterrupt(), SaveAndDisableInterrupts(), and
> DisableLvtInterrupts() -- and the error path does not restore the
> original environment.
>
> (c) According to the PI spec (v1.7), the StartupAllAPs(),
> StartupThisAP(), SwitchBSP(), EnableDisableAP() member functions of
> EFI_MP_SERVICES_PROTOCOL may only be called on the (current) BSP.
> Because of this, it is OK to call ValidCR3GdtIdtCheck() as the very
> first action in the above-listed DxeMpLib functions.
>
> (Assuming the protocol members are called from an AP, and consequently
> we check CR3 / GDTR / IDTR on the AP (and not on the BSP), that's the
> *caller's* fault, per spec!)

This means we can move the ValidCr3GdtIdtCheck() function to
"DxeMpLib.c", and it is not necessary to modify "MpLib.h".

Thanks
Laszlo



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

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

Reply via email to