<html><head><meta http-equiv="content-type" content="text/html; charset=UTF-8"><style>body { line-height: 1.5; }blockquote { margin-top: 0px; margin-bottom: 0px; margin-left: 0.5em; }body { font-size: 14px; font-family: "Microsoft YaHei UI"; color: rgb(0, 0, 0); line-height: 1.5; }</style></head><body>
<div><span></span>we will save the current BSP's GDT and IDT for APs at first time APs are waken by BSP as below. APs will start from real mode to protected mode and then to long mode. During protected mode, BSP's GDT/IDT table are working on APs.</div>
<div><div><br></div><div>In UefiCpuPkg\Library\MpInitLib\MpLib.c, </div><div>  //</div><div>  // Get the BSP's data of GDT and IDT</div><div>  //</div><div>  AsmReadGdtr ((IA32_DESCRIPTOR *) &ExchangeInfo->GdtrProfile);</div><div>  AsmReadIdtr ((IA32_DESCRIPTOR *) &ExchangeInfo->IdtrProfile);</div></div><div><br></div><div>It seems to be one bug we have assumption on GDT table and IDT table located under 4G memory space.</div><div><br></div><div>Could Ray&Eric help me to confirm it?</div><div><br></div><div>Jeff</div><div><br></div><blockquote style="margin-Top: 0px; margin-Bottom: 0px; margin-Left: 0.5em; margin-Right: inherit"><div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm"><div style="PADDING-RIGHT: 8px; PADDING-LEFT: 8px; FONT-SIZE: 12px;FONT-FAMILY:tahoma;COLOR:#000000; BACKGROUND: #efefef; PADDING-BOTTOM: 8px; PADDING-TOP: 8px"><div><b>From:</b> <a href="mailto:maurice.ma@intel.com">Ma, Maurice</a></div><div><b>Date:</b> 2021-02-23 00:49</div><div><b>To:</b> <a href="mailto:patrick.rudolph@9elements.com">Patrick Rudolph</a>; <a href="mailto:guo.dong@intel.com">Dong, Guo</a>; <a href="mailto:eric.dong@intel.com">Dong, Eric</a>; <a href="mailto:ray.ni@intel.com">Ni, Ray</a></div><div><b>CC:</b> <a href="mailto:devel@edk2.groups.io">devel@edk2.groups.io</a>; <a href="mailto:benjamin.you@intel.com">You, Benjamin</a></div><div><b>Subject:</b> Re: [edk2-devel] [PATCH] UefiPayloadPkg/UefiPayloadEntry: Remove 4GB memory WA</div></div></div><div><div>Hi, Ray and Eric,</div>
<div> </div>
<div>Is there any reason why the GDT base was typecast to UINT32 in CpuDxe driver ?  </div>
<div>In x64 long mode, the GDT base is actually 64bit.   Typecasting will zero out the high 32bit address.</div>
<div>To me the correct code seems to be something like: </div>
<div>     gdtPtr.Base = (UINTN)(VOID*) gdt;</div>
<div> </div>
<div>Thanks</div>
<div>Maurice</div>
<div>> -----Original Message-----</div>
<div>> From: Patrick Rudolph <patrick.rudolph@9elements.com></div>
<div>> Sent: Monday, February 22, 2021 7:43</div>
<div>> To: Dong, Guo <guo.dong@intel.com></div>
<div>> Cc: devel@edk2.groups.io; Ma, Maurice <maurice.ma@intel.com>; You,</div>
<div>> Benjamin <benjamin.you@intel.com></div>
<div>> Subject: Re: [edk2-devel] [PATCH] UefiPayloadPkg/UefiPayloadEntry:</div>
<div>> Remove 4GB memory WA</div>
<div>> </div>
<div>> Hi Guo,</div>
<div>> I tested on 078400ee15e7b250e4dfafd840c2e0c19835e16b and run it in</div>
<div>> QEMU.</div>
<div>> The problem seems to be here, as gdt is allocated > 4GiB:</div>
<div>> gdtPtr.Base = (UINT32)(UINTN)(VOID*) gdt;</div>
<div>> </div>
<div>> Regards,</div>
<div>> Patrick</div>
<div>> </div>
<div>> On Mon, Feb 22, 2021 at 3:59 PM Dong, Guo <guo.dong@intel.com> wrote:</div>
<div>> ></div>
<div>> ></div>
<div>> > Hi Patrick,</div>
<div>> > Please make sure you are using latest master when testing this patch.</div>
<div>> > That issue should be fix be this patch:</div>
<div>> > UefiCpuPkg/CpuDxe: Fix boot error (commit:</div>
<div>> > ebfe2d3eb5ac7fd92d74011edb31303a181920c7)</div>
<div>> > And there is similar fix in another place as below:</div>
<div>> > UefiCpuPkg/MpInitLib: Fix a hang in above 4GB case (commit:</div>
<div>> > edd74ad3ad79b855f76d9cf60a96c405cb3e863b)</div>
<div>> ></div>
<div>> > Thanks,</div>
<div>> > Guo</div>
<div>> ></div>
<div>> > > -----Original Message-----</div>
<div>> > > From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of</div>
<div>> > > Patrick Rudolph</div>
<div>> > > Sent: Monday, February 22, 2021 7:04 AM</div>
<div>> > > To: devel@edk2.groups.io; Ma, Maurice <maurice.ma@intel.com></div>
<div>> > > Cc: Dong, Guo <guo.dong@intel.com>; You, Benjamin</div>
<div>> > > <benjamin.you@intel.com></div>
<div>> > > Subject: Re: [edk2-devel] [PATCH] UefiPayloadPkg/UefiPayloadEntry:</div>
<div>> > > Remove 4GB memory WA</div>
<div>> > ></div>
<div>> > > This patch breaks booting on master.</div>
<div>> > > In CpuDxe.efi / InitGlobalDescriptorTable as the GDT pointer is</div>
<div>> > > casted to 32bits.</div>
<div>> > ></div>
<div>> > > Regards,</div>
<div>> > > Patrick</div>
<div>> > ></div>
<div>> > > On Fri, Feb 19, 2021 at 3:12 AM Ma, Maurice <maurice.ma@intel.com></div>
<div>> wrote:</div>
<div>> > > ></div>
<div>> > > > Reviewed-by:  Maurice Ma <maurice.ma@intel.com></div>
<div>> > > ></div>
<div>> > > > Regards</div>
<div>> > > > Maurice</div>
<div>> > > ></div>
<div>> > > > > -----Original Message-----</div>
<div>> > > > > From: Dong, Guo <guo.dong@intel.com></div>
<div>> > > > > Sent: Sunday, February 14, 2021 21:13</div>
<div>> > > > > To: devel@edk2.groups.io</div>
<div>> > > > > Cc: Ma, Maurice <maurice.ma@intel.com>; You, Benjamin</div>
<div>> > > > > <benjamin.you@intel.com></div>
<div>> > > > > Subject: [edk2-devel] [PATCH] UefiPayloadPkg/UefiPayloadEntry:</div>
<div>> > > > > Remove 4GB memory WA</div>
<div>> > > > ></div>
<div>> > > > > Previous it would hang in CpuDxe if DXE drivers are dispatched above</div>
<div>> 4GB.</div>
<div>> > > > > Now remove the work around since the fixed in CpuDxe are merged.</div>
<div>> > > > ></div>
<div>> > > > > Signed-off-by: Guo Dong <guo.dong@intel.com></div>
<div>> > > > > ---</div>
<div>> > > > >  UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c | 5 -----</div>
<div>> > > > >  1 file changed, 5 deletions(-)</div>
<div>> > > > ></div>
<div>> > > > > diff --git a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c</div>
<div>> > > > > b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c</div>
<div>> > > > > index 805f5448d9..c403b0a80a 100644</div>
<div>> > > > > --- a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c</div>
<div>> > > > > +++ b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c</div>
<div>> > > > > @@ -40,11 +40,6 @@ MemInfoCallback (</div>
<div>> > > > >               EFI_RESOURCE_ATTRIBUTE_WRITE_THROUGH_CACHEABLE |</div>
<div>> > > > >               EFI_RESOURCE_ATTRIBUTE_WRITE_BACK_CACHEABLE;</div>
<div>> > > > ></div>
<div>> > > > > -  if (Base >= BASE_4GB ) {</div>
<div>> > > > > -    // Remove tested attribute to avoid DXE core to dispatch driver to</div>
<div>> > > > > memory above 4GB</div>
<div>> > > > > -    Attribue &= ~EFI_RESOURCE_ATTRIBUTE_TESTED;</div>
<div>> > > > > -  }</div>
<div>> > > > > -</div>
<div>> > > > >    BuildResourceDescriptorHob (Type, Attribue,</div>
<div>> > > > > (EFI_PHYSICAL_ADDRESS)Base, Size);</div>
<div>> > > > >    DEBUG ((DEBUG_INFO , "buildhob: base = 0x%lx, size = 0x%lx,</div>
<div>> > > > > type = 0x%x\n", Base, Size, Type));</div>
<div>> > > > ></div>
<div>> > > > > --</div>
<div>> > > > > 2.16.2.windows.1</div>
<div>> > > ></div>
<div>> > > ></div>
<div>> > > ></div>
<div>> > > ></div>
<div>> > > ></div>
<div>> > > ></div>
<div>> > ></div>
<div>> > ></div>
<div>> > > </div>
<div>> > ></div>
<div>> ></div>
<div> </div>
<div> </div>
<div></div>
<div> </div>
<div> </div>
</div></blockquote>
</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/72012">View/Reply Online (#72012)</a> |    |  <a target="_blank" href="https://groups.io/mt/80647875/1813853">Mute This Topic</a>  | <a href="https://edk2.groups.io/g/devel/post">New Topic</a><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>