From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.byosoft.com.cn (mail.byosoft.com.cn [58.240.74.242]) by mx.groups.io with SMTP id smtpd.web11.5317.1614051786167433319 for ; Mon, 22 Feb 2021 19:43:08 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=none, err=permanent DNS error (domain: byosoft.com.cn, ip: 58.240.74.242, mailfrom: fanjianfeng@byosoft.com.cn) Received: from DESKTOP-M5NI163 ([58.246.60.130]) (envelope-sender ) by 192.168.6.13 with ESMTP for ; Tue, 23 Feb 2021 11:42:37 +0800 X-WM-Sender: fanjianfeng@byosoft.com.cn X-Originating-IP: 58.246.60.130 X-WM-AuthFlag: YES X-WM-AuthUser: fanjianfeng@byosoft.com.cn Date: Tue, 23 Feb 2021 11:42:37 +0800 From: "Jeff Fan" To: "devel@edk2.groups.io" , =?UTF-8?B?TmksIFJheQ==?= , maurice.ma , "Patrick Rudolph" , =?UTF-8?B?RG9uZywgR3Vv?= , =?UTF-8?B?RG9uZywgRXJpYw==?= Cc: "devel@edk2.groups.io" , =?UTF-8?B?WW91LCBCZW5qYW1pbg==?= Subject: Re: [edk2-devel] [PATCH] UefiPayloadPkg/UefiPayloadEntry: Remove 4GB memory WA References: <20210215051308.11796-1-guo.dong@intel.com>, , , , , , <202102230850236136429@byosoft.com.cn>, X-Priority: 3 X-Has-Attach: no X-Mailer: Foxmail 7.2.20.269[cn] Mime-Version: 1.0 Message-ID: <2021022311423730957521@byosoft.com.cn> Content-Type: multipart/alternative; boundary="----=_001_NextPart852657200530_=----" ------=_001_NextPart852657200530_=---- Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: base64 UmF5LA0KDQpZZXMuIFlvdSBhcmUgcmlnaHQuIEFjdXRhbGx5LCB4NjQgSURUIHRhYmxlIGNhbm5v dCB3b3JrIGNvcnJlY3RseSBvbiBwcm90ZWN0ZWQgbW9kZS4gOi0pDQoNCkJ1dCBmb3IgR0RUIGxv Y2F0aW9uLCBJIGFncmVlIGl0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ID4NCj4gPiA+ID4NCj4gPiA+DQo+ ID4gPg0KPiA+ID4gDQo+ID4gPg0KPiA+DQogDQogDQogDQogDQoNCg== ------=_001_NextPart852657200530_=---- Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Ray,

Yes. You are right. Acutal= ly, x64 IDT table cannot work correctly on protected mode. :-)
But for GDT location, I agree it should be located under 4G sp= ace to support AP mode changing.  But we could allocate room under 4G = for GDT table directly in CpuDxe.

Thanks,
Jeff

 
F= rom: Ni, Ray
Date: 2021-02-2= 3 10:52
= Subject: Re: [edk2-devel] [PATCH] UefiPayloadPkg/UefiPayloadEnt= ry: Remove 4GB memory WA

Jeff,

You are right that BSP=E2=80=99s GDT and IDT tables = are under 4G memory.

 

It=E2=80=99s because when AP wakes up, it needs the = GDT for entering protected mode. AP cannot access above 4G memory without e= ntering to long mode.

 

I do agree that the 64bit IDT is not proper for AP w= hen entering protected mode. As long as there is no exception in the short = time frame (load 64bit IDT, before entering long mode), it=E2=80=99s still = ok.

 

Thanks,

Ray

 

From: fanjianfeng@byosoft.com.cn <fanjianf= eng@byosoft.com.cn>
Sent: Tuesday, February 23, 2021 8:50 AM
To: devel <devel@edk2.groups.io>; Ma, Maurice <maurice.ma@= intel.com>; Patrick Rudolph <patrick.rudolph@9elements.com>; Dong,= Guo <guo.dong@intel.com>; Dong, Eric <eric.dong@intel.com>; Ni= , Ray <ray.ni@intel.com>
Cc: devel@edk2.groups.io; You, Benjamin <benjamin.you@intel.com&= gt;
Subject: Re: Re: [edk2-devel] [PATCH] UefiPayloadPkg/UefiPayloadEnt= ry: Remove 4GB memory WA

 

we will save the current BSP= 's GDT and IDT for APs at first time APs are waken by BSP as below. APs wil= l start from real mode to protected mode and then to long mode. During protected mode, BSP's GDT/IDT table are working on A= Ps.

 

In UefiCpuPkg\Library\MpInit= Lib\MpLib.c, 

  //<= /p>

  // Get the BSP's data= of GDT and IDT

  //<= /p>

  AsmReadGdtr ((IA32_DE= SCRIPTOR *) &ExchangeInfo->GdtrProfile);

  AsmReadIdtr ((IA32_DE= SCRIPTOR *) &ExchangeInfo->IdtrProfile);

 

It seems to be one bug we ha= ve assumption on GDT table and IDT table located under 4G memory space.

 

Could Ray&Eric help me t= o confirm it?

 

Jeff

 

Hi, Ray and Eric,=

 

Is there any reason why the = GDT base was typecast to UINT32 in CpuDxe driver ? 

In x64 long mode, the GDT ba= se is actually 64bit.   Typecasting will zero out the high 32bit = address.

To me the correct code seems= to be something like:

gdtPtr.Base =3D (UINTN)(VOID= *) gdt;

 

Thanks

Maurice

> -----Original Message--= ---

> Sent: Monday, February = 22, 2021 7:43

> To: Dong, Guo <guo.dong@intel.com>

> Cc: devel@edk2.groups.io; Ma, Maurice <mauric= e.ma@intel.com>; You,

> Benjamin <benjamin.you@intel.com>

> Subject: Re: [edk2-deve= l] [PATCH] UefiPayloadPkg/UefiPayloadEntry:

> Remove 4GB memory WA

>

> Hi Guo,

> I tested on 078400ee15e= 7b250e4dfafd840c2e0c19835e16b and run it in

> QEMU.=

> The problem seems to be= here, as gdt is allocated > 4GiB:

> gdtPtr.Base =3D (UINT32= )(UINTN)(VOID*) gdt;

>

> Regards,

> Patrick

>

> On Mon, Feb 22, 2021 at= 3:59 PM Dong, Guo <guo.dong@intel.c= om> wrote:

> ><= /p>

> ><= /p>

> > Hi Patrick,

> > Please make sure y= ou are using latest master when testing this patch.

> > That issue should = be fix be this patch:

> > UefiCpuPkg/CpuDxe:= Fix boot error (commit:

> > ebfe2d3eb5ac7fd92d= 74011edb31303a181920c7)

> > And there is simil= ar fix in another place as below:

> > UefiCpuPkg/MpInitL= ib: Fix a hang in above 4GB case (commit:

> > edd74ad3ad79b855f7= 6d9cf60a96c405cb3e863b)

> ><= /p>

> > Thanks,=

> > Guo

> ><= /p>

> > > -----Original= Message-----

> > > From: devel@edk2.groups.io <devel@edk2.group= s.io> On Behalf Of

> > > Patrick Rudol= ph

> > > Sent: Monday,= February 22, 2021 7:04 AM

> > > To: devel@edk2.groups.io; Ma, Maurice <mauric= e.ma@intel.com>

> > > Cc: Dong, Guo= <guo.dong@intel.com>; You, Benjamin

> > > <benjamin.you@intel.com>

> > > Subject: Re: = [edk2-devel] [PATCH] UefiPayloadPkg/UefiPayloadEntry:

> > > Remove 4GB me= mory WA

> > >

> > > This patch br= eaks booting on master.

> > > In CpuDxe.efi= / InitGlobalDescriptorTable as the GDT pointer is

> > > casted to 32b= its.

> > >

> > > Regards,=

> > > Patrick<= /o:p>

> > >

> > > On Fri, Feb 1= 9, 2021 at 3:12 AM Ma, Maurice <mauri= ce.ma@intel.com>

> wrote:

> > > >

> > > > Reviewed= -by:  Maurice Ma <maurice.ma@int= el.com>

> > > >

> > > > Regards<= o:p>

> > > > Maurice<= o:p>

> > > >

> > > > > ---= --Original Message-----

> > > > > Fro= m: Dong, Guo <guo.dong@intel.com= >

> > > > > Sen= t: Sunday, February 14, 2021 21:13

> > > > > To: devel@edk2.groups.io

> > > > > Cc:= Ma, Maurice <maurice.ma@intel.com>; You, Benjamin

> > > > > <= ;benjamin.you@intel.com>

> > > > > Sub= ject: [edk2-devel] [PATCH] UefiPayloadPkg/UefiPayloadEntry:

> > > > > Rem= ove 4GB memory WA

> > > > >

> > > > > Pre= vious it would hang in CpuDxe if DXE drivers are dispatched above

> 4GB.<= /p>

> > > > > Now= remove the work around since the fixed in CpuDxe are merged.

> > > > >

> > > > > Sig= ned-off-by: Guo Dong <guo.dong@intel.c= om>

> > > > > ---=

> > > > >&nbs= p; UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c | 5 -----<= /span>

> > > > >&nbs= p; 1 file changed, 5 deletions(-)

> > > > >

> > > > > dif= f --git a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c

> > > > > b/U= efiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c

> > > > > ind= ex 805f5448d9..c403b0a80a 100644

> > > > > ---= a/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c

> > > > > +++= b/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.c

> > > > > @@ = -40,11 +40,6 @@ MemInfoCallback (

> > > > >&nbs= p;            &= nbsp; EFI_RESOURCE_ATTRIBUTE_WRITE_THROUGH_CACHEABLE |

> > > > >&nbs= p;            &= nbsp; EFI_RESOURCE_ATTRIBUTE_WRITE_BACK_CACHEABLE;

> > > > >

> > > > > -&n= bsp; if (Base >=3D BASE_4GB ) {

> > > > > -&n= bsp;   // Remove tested attribute to avoid DXE core to dispatch d= river to

> > > > > mem= ory above 4GB

> > > > > -&n= bsp;   Attribue &=3D ~EFI_RESOURCE_ATTRIBUTE_TESTED;

> > > > > -&n= bsp; }

> > > > > -

> > > > >&nbs= p;   BuildResourceDescriptorHob (Type, Attribue,

> > > > > (EF= I_PHYSICAL_ADDRESS)Base, Size);

> > > > >&nbs= p;   DEBUG ((DEBUG_INFO , "buildhob: base =3D 0x%lx, size =3D 0x%= lx,

> > > > > typ= e =3D 0x%x\n", Base, Size, Type));

> > > > >

> > > > > --<= o:p>

> > > > > 2.1= 6.2.windows.1

> > > >

> > > >

> > > >

> > > >

> > > >

> > > >

> > >

> > >

> > >

> > >

> ><= /p>

 

 

 

 

------=_001_NextPart852657200530_=------