Re: [edk2-devel] [PATCH] UefiCpuPkg: Fix SMM code hangs when InitPaging

2023-01-18 Thread Ni, Ray
> > > And for the CpuPageTableLib, I think the API don't provide the > > interface to split 2MB-page page table into 4KB-page, which is the > > function wants to do. > > I think that is handled by the library automatically. You can request > address ranges being mapped with specific attributes (

Re: [edk2-devel] [PATCH] UefiCpuPkg: Fix SMM code hangs when InitPaging

2023-01-18 Thread Gerd Hoffmann
On Wed, Jan 18, 2023 at 09:12:09AM +, Zhiguang Liu wrote: > Hi Gerd, > > Let's check the code in InitPaging. > If 5LevelPaging is disabled, Pml5 points to a local variable. Pml5[1] > shouldn't be used. > > UINT64Pml5Entry; > UINT64*Pml5; > if (!Enable5LevelPaging) { >

Re: [edk2-devel] [PATCH] UefiCpuPkg: Fix SMM code hangs when InitPaging

2023-01-18 Thread Zhiguang Liu
.com > Sent: Wednesday, January 18, 2023 4:54 PM > To: devel@edk2.groups.io; Liu, Zhiguang > Cc: Ni, Ray ; Kumar, Rahul R ; > Dong, Eric ; Zeng, Star ; Wu, > Jiaxin > Subject: Re: [edk2-devel] [PATCH] UefiCpuPkg: Fix SMM code hangs when > InitPaging > > On Wed, Jan 18, 2

Re: [edk2-devel] [PATCH] UefiCpuPkg: Fix SMM code hangs when InitPaging

2023-01-18 Thread Gerd Hoffmann
On Wed, Jan 18, 2023 at 01:13:43AM +, Zhiguang Liu wrote: > Thanks all for reviewing, and I will send a new version to address the > comment. > > As for Gerd's question, let me explain. > Let's see one example, that the CPU has SizeOfMemorySpace >48, but the CPU > doesn't enable 5 level pagi

Re: [edk2-devel] [PATCH] UefiCpuPkg: Fix SMM code hangs when InitPaging

2023-01-17 Thread Zhiguang Liu
ng entry as one if 5 level paging is disabled. Thanks Zhiguang > -Original Message- > From: Ni, Ray > Sent: Tuesday, January 17, 2023 8:49 PM > To: devel@edk2.groups.io; kra...@redhat.com > Cc: Liu, Zhiguang ; Kumar, Rahul R > ; Dong, Eric > Subject: RE: [edk2-devel]

Re: [edk2-devel] [PATCH] UefiCpuPkg: Fix SMM code hangs when InitPaging

2023-01-17 Thread Ni, Ray
> > > +ASSERT (SizeOfMemorySpace <= 52); > > > + > > > // > > > -// Calculate the table entries of PML4E and PDPTE. > > > +// Calculate the table entries of PML5E, PML4E and PDPTE. > > > // > > > NumberOfPml5Entries = 1; > > > -if (SizeOfMemorySpace > 48) { > > > +

Re: [edk2-devel] [PATCH] UefiCpuPkg: Fix SMM code hangs when InitPaging

2023-01-17 Thread Gerd Hoffmann
On Tue, Jan 17, 2023 at 09:02:01AM +, Ni, Ray wrote: > + Gerd. > > > -Original Message- > > From: Liu, Zhiguang > > Sent: Wednesday, January 4, 2023 1:41 PM > > To: devel@edk2.groups.io > > Cc: Liu, Zhiguang ; Ni, Ray ; > > Kumar, Rahul R ; Dong, > > Eric > > Subject: [PATCH] UefiCp

Re: [edk2-devel] [PATCH] UefiCpuPkg: Fix SMM code hangs when InitPaging

2023-01-17 Thread Ni, Ray
+ Gerd. > -Original Message- > From: Liu, Zhiguang > Sent: Wednesday, January 4, 2023 1:41 PM > To: devel@edk2.groups.io > Cc: Liu, Zhiguang ; Ni, Ray ; > Kumar, Rahul R ; Dong, > Eric > Subject: [PATCH] UefiCpuPkg: Fix SMM code hangs when InitPaging > > REF: https://bugzilla.tianocore

Re: [edk2-devel] [PATCH] UefiCpuPkg: Fix SMM code hangs when InitPaging

2023-01-17 Thread Ni, Ray
Reviewed-by: Ray Ni > -Original Message- > From: Liu, Zhiguang > Sent: Wednesday, January 4, 2023 1:41 PM > To: devel@edk2.groups.io > Cc: Liu, Zhiguang ; Ni, Ray ; > Kumar, Rahul R ; Dong, > Eric > Subject: [PATCH] UefiCpuPkg: Fix SMM code hangs when InitPaging > > REF: https://bugzi

Re: [edk2-devel] [PATCH] UefiCpuPkg: Fix SMM code hangs when InitPaging

2023-01-17 Thread Wu, Jiaxin
ps.io > Cc: Liu, Zhiguang ; Ni, Ray ; > Kumar, Rahul R ; Dong, Eric > Subject: [edk2-devel] [PATCH] UefiCpuPkg: Fix SMM code hangs when > InitPaging > > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4246 > > In function InitPaging, NumberOfPml5Entries is calculated by

Re: [edk2-devel] [PATCH] UefiCpuPkg: Fix SMM code hangs when InitPaging

2023-01-12 Thread Zeng, Star
Reviewed-by: Star Zeng -Original Message- From: devel@edk2.groups.io On Behalf Of Zhiguang Liu Sent: Wednesday, January 4, 2023 1:41 PM To: devel@edk2.groups.io Cc: Liu, Zhiguang ; Ni, Ray ; Kumar, Rahul R ; Dong, Eric Subject: [edk2-devel] [PATCH] UefiCpuPkg: Fix SMM code hangs when

[edk2-devel] [PATCH] UefiCpuPkg: Fix SMM code hangs when InitPaging

2023-01-03 Thread Zhiguang Liu
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4246 In function InitPaging, NumberOfPml5Entries is calculated by below code NumberOfPml5Entries = (UINTN)LShiftU64 (1, SizeOfMemorySpace - 48); If the SizeOfMemorySpace is larger than 48, NumberOfPml5Entries will be larger than 1. However, this