<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body>
<div dir="ltr">
<div></div>
<div>
<div>
<div style="direction: ltr;">Why do we need a new PCD to control such check? Under what circumstance the PCD is false?</div>
<div style="direction: ltr;">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.</div>
</div>
<div style="direction: ltr;" dir="ltr"><br>
</div>
<div style="direction: ltr;" dir="ltr">We should not assume PEI runs at 32 bit mode.</div>
<div><br>
</div>
<div class="ms-outlook-ios-signature"></div>
</div>
</div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>发件人:</b> devel@edk2.groups.io <devel@edk2.groups.io> 代表 Laszlo Ersek <lersek@redhat.com><br>
<b>发送时间:</b> Friday, September 4, 2020 3:55:47 AM<br>
<b>收件人:</b> Dong, Eric <eric.dong@intel.com>; devel@edk2.groups.io <devel@edk2.groups.io><br>
<b>抄送:</b> Ni, Ray <ray.ni@intel.com><br>
<b>主题:</b> Re: [edk2-devel] [PATCH v2] UefiCpuPkg/MpInitLib: Add check for CR3/GDT/IDT.</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">On 09/03/20 21:00, Laszlo Ersek wrote:<br>
<br>
> (10) More importantly, ValidCR3GdtIdtCheck() should not be called in the<br>
> Worker functions for StartupAllAPs, StartupThisAP, SwitchBSP, and<br>
> EnableDisableAP, in "UefiCpuPkg/Library/MpInitLib/MpLib.c".<br>
> <br>
> Instead, the calls should be made in the DXE instance of the library<br>
> ("UefiCpuPkg/Library/MpInitLib/DxeMpLib.c"), at the very top of the<br>
> functions:<br>
> <br>
> - MpInitLibStartupAllAPs<br>
> - MpInitLibStartupThisAP<br>
> - MpInitLibSwitchBSP<br>
> - MpInitLibEnableDisableAP<br>
> <br>
> Here's why:<br>
> <br>
> (a) The symptom does not affect the PEI phase -- by the time the UEFI<br>
> application is executed, the PEI phase has ended; there's no need to<br>
> modify the PEI instance of the library.<br>
> <br>
> (b) The currently proposed failure exits are too late. For example, in<br>
> the SwitchBSPWorker() function, by the time we exit, we have called<br>
> DisableApicTimerInterrupt(), SaveAndDisableInterrupts(), and<br>
> DisableLvtInterrupts() -- and the error path does not restore the<br>
> original environment.<br>
> <br>
> (c) According to the PI spec (v1.7), the StartupAllAPs(),<br>
> StartupThisAP(), SwitchBSP(), EnableDisableAP() member functions of<br>
> EFI_MP_SERVICES_PROTOCOL may only be called on the (current) BSP.<br>
> Because of this, it is OK to call ValidCR3GdtIdtCheck() as the very<br>
> first action in the above-listed DxeMpLib functions.<br>
> <br>
> (Assuming the protocol members are called from an AP, and consequently<br>
> we check CR3 / GDTR / IDTR on the AP (and not on the BSP), that's the<br>
> *caller's* fault, per spec!)<br>
<br>
This means we can move the ValidCr3GdtIdtCheck() function to<br>
"DxeMpLib.c", and it is not necessary to modify "MpLib.h".<br>
<br>
Thanks<br>
Laszlo<br>
<br>
<br>
<br>
<br>
</div>
</span></font></div>
</body>
</html>

<div width="1" style="color:white;clear:both">_._,_._,_</div>
<hr>
Groups.io Links:<p>


You receive all messages sent to this group.



<p>

<a target="_blank" href="https://edk2.groups.io/g/devel/message/65018">View/Reply Online (#65018)</a> |


  


|


  
    <a target="_blank" href="https://groups.io/mt/76609049/1813853">Mute This Topic</a>
  

| <a href="https://edk2.groups.io/g/devel/post">New Topic</a><br>



<br>

<a href="https://edk2.groups.io/g/devel/editsub/1813853">Your Subscription</a> |
<a href="mailto:devel+owner@edk2.groups.io">Contact Group Owner</a> |

<a href="https://edk2.groups.io/g/devel/unsub">Unsubscribe</a>

 [edk2-devel-archive@redhat.com]<br>
<div width="1" style="color:white;clear:both">_._,_._,_</div>