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.web12.758.1646960526057644827 for ; Thu, 10 Mar 2022 17:02: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: gaoliming@byosoft.com.cn) Received: from DESKTOPS6D0PVI ([58.246.60.130]) (envelope-sender ) by 192.168.6.13 with ESMTP for ; Fri, 11 Mar 2022 09:01:57 +0800 X-WM-Sender: gaoliming@byosoft.com.cn X-Originating-IP: 58.246.60.130 X-WM-AuthFlag: YES X-WM-AuthUser: gaoliming@byosoft.com.cn From: "gaoliming" To: , , "'Ni, Ray'" , "'Kinney, Michael D'" Cc: "'Wang, Jian J'" , References: <20220302091859.2783-1-yu.pu@intel.com> <20220302091859.2783-3-yu.pu@intel.com> In-Reply-To: Subject: =?UTF-8?B?5Zue5aSNOiBbZWRrMi1kZXZlbF0gW1BBVENIIHYxIDIvN10gTWRlTW9kdWxlUGtnOiBJbnZva2UgR2V0UGh5c2ljYWxBZGRyZXNzQml0cygpIGFuZCByZW1vdmUgdGhlIGR1cGxpY2F0ZWQgY29kZQ==?= Date: Fri, 11 Mar 2022 09:02:00 +0800 Message-ID: <042b01d834e3$9d64d040$d82e70c0$@byosoft.com.cn> MIME-Version: 1.0 X-Mailer: Microsoft Outlook 16.0 Thread-Index: AQFhAr9jRdnbo0/WaTEAoNda6vMfVwG1WfqXAm46jAYC7kMGT61vMg4Q Content-Type: text/plain; charset="gb2312" Content-Transfer-Encoding: quoted-printable Content-Language: zh-cn Yu and Ray: I review UefiCpuLib. I think they are generic enough (X86 arch) to be placed in MdePkg. Mike: What's your comments for this proposal? Thanks Liming > -----=D3=CA=BC=FE=D4=AD=BC=FE----- > =B7=A2=BC=FE=C8=CB: devel@edk2.groups.io =B4=FA=B1= =ED Pu, Yu > =B7=A2=CB=CD=CA=B1=BC=E4: 2022=C4=EA3=D4=C210=C8=D5 16:47 > =CA=D5=BC=FE=C8=CB: Ni, Ray ; Kinney, Michael D > ; Gao, Liming > =B3=AD=CB=CD: Wang, Jian J ; Gao, Liming > ; devel@edk2.groups.io > =D6=F7=CC=E2: Re: [edk2-devel] [PATCH v1 2/7] MdeModulePkg: Invoke > GetPhysicalAddressBits() and remove the duplicated code >=20 > Hi, Mike, Liming, >=20 > This patch makes MdeModulePkg depend on UefiCpuPkg. > Ray and me would like to move the UefiCpuLib from UefiCpuPkg to MdePkg, > do you agree with it ? >=20 > Thanks, > Yu >=20 > -----Original Message----- > From: Ni, Ray > Sent: Monday, March 7, 2022 11:55 AM > To: Kinney, Michael D ; Gao, Liming > > Cc: Wang, Jian J ; Gao, Liming > ; devel@edk2.groups.io; Pu, Yu > > Subject: RE: [edk2-devel] [PATCH v1 2/7] MdeModulePkg: Invoke > GetPhysicalAddressBits() and remove the duplicated code >=20 > Mike, Liming, > This patch makes MdeModulePkg depend on UefiCpuPkg. > But according to > https://github.com/tianocore/edk2/blob/master/MdeModulePkg/MdeModul > ePkg.ci.yaml#L49, such dependency is not allowed. >=20 > Do you agree to move the UefiCpuLib from UefiCpuPkg to MdePkg? The > library header and instance are in following paths: >=20 > https://github.com/tianocore/edk2/blob/master/UefiCpuPkg/Include/Library > /UefiCpuLib.h >=20 > https://github.com/tianocore/edk2/tree/master/UefiCpuPkg/Library/BaseUe > fiCpuLib >=20 > Thanks, > Ray >=20 >=20 > -----Original Message----- > From: devel@edk2.groups.io On Behalf Of Yu Pu > Sent: Wednesday, March 2, 2022 5:19 PM > To: devel@edk2.groups.io > Cc: Pu, Yu ; Wang, Jian J ; Gao, > Liming > Subject: [edk2-devel] [PATCH v1 2/7] MdeModulePkg: Invoke > GetPhysicalAddressBits() and remove the duplicated code >=20 > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3394 >=20 > Invoke GetPhysicalAddressBits() defined in UefiCpuPkg for CPU physical > address mask calculation and remove the duplicated code in MdeModulePkg. >=20 > Cc: Jian J Wang > Cc: Liming Gao >=20 > Signed-off-by: Yu Pu > --- > MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c > | 9 ++------- > MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/X64/SetIdtEntry.c > | 14 ++------------ > MdeModulePkg/Universal/CapsulePei/X64/X64Entry.c > | 14 ++------------ > MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf > | 2 ++ > MdeModulePkg/MdeModulePkg.dsc > | 1 + >=20 > MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/BootScriptExecutorDx > e.inf | 2 ++ > MdeModulePkg/Universal/CapsulePei/CapsuleX64.inf > | 2 ++ > 7 files changed, 13 insertions(+), 31 deletions(-) >=20 > diff --git a/MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c > b/MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c > index 0700f310b203..78e91e6e9024 100644 > --- a/MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c > +++ b/MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c > @@ -22,6 +22,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent >=20 >=20 > **/ >=20 >=20 >=20 > +#include >=20 > #include >=20 > #include "DxeIpl.h" >=20 > #include "VirtualMemory.h" >=20 > @@ -733,13 +734,7 @@ CreateIdentityMappingPageTables ( > if (Hob !=3D NULL) { >=20 > PhysicalAddressBits =3D ((EFI_HOB_CPU *)Hob)->SizeOfMemorySpace; >=20 > } else { >=20 > - AsmCpuid (0x80000000, &RegEax, NULL, NULL, NULL); >=20 > - if (RegEax >=3D 0x80000008) { >=20 > - AsmCpuid (0x80000008, &RegEax, NULL, NULL, NULL); >=20 > - PhysicalAddressBits =3D (UINT8)RegEax; >=20 > - } else { >=20 > - PhysicalAddressBits =3D 36; >=20 > - } >=20 > + PhysicalAddressBits =3D GetPhysicalAddressBits(NULL, NULL); >=20 > } >=20 >=20 >=20 > Page5LevelSupport =3D FALSE; >=20 > diff --git > a/MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/X64/SetIdtEntry.c > b/MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/X64/SetIdtEntry.c > index 6b44f50bac70..367bf8cdd1e6 100644 > --- > a/MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/X64/SetIdtEntry.c > +++ > b/MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/X64/SetIdtEntry. > +++ c > @@ -10,6 +10,7 @@ Copyright (c) 2017, AMD Incorporated. All rights > reserved.
> SPDX-License-Identifier: BSD-2-Clause-Patent >=20 >=20 >=20 > **/ >=20 > +#include >=20 > #include "ScriptExecute.h" >=20 >=20 >=20 > // >=20 > @@ -51,20 +52,9 @@ HookPageFaultHandler ( > IN IA32_IDT_GATE_DESCRIPTOR *IdtEntry >=20 > ) >=20 > { >=20 > - UINT32 RegEax; >=20 > - UINT8 PhysicalAddressBits; >=20 > UINTN PageFaultHandlerHookAddress; >=20 >=20 >=20 > - AsmCpuid (0x80000000, &RegEax, NULL, NULL, NULL); >=20 > - if (RegEax >=3D 0x80000008) { >=20 > - AsmCpuid (0x80000008, &RegEax, NULL, NULL, NULL); >=20 > - PhysicalAddressBits =3D (UINT8)RegEax; >=20 > - } else { >=20 > - PhysicalAddressBits =3D 36; >=20 > - } >=20 > - >=20 > - mPhyMask =3D LShiftU64 (1, PhysicalAddressBits) - 1; >=20 > - mPhyMask &=3D (1ull << 48) - SIZE_4KB; >=20 > + GetPhysicalAddressBits(NULL, &mPhyMask); >=20 >=20 >=20 > // >=20 > // Set Page Fault entry to catch >4G access >=20 > diff --git a/MdeModulePkg/Universal/CapsulePei/X64/X64Entry.c > b/MdeModulePkg/Universal/CapsulePei/X64/X64Entry.c > index 05941f9f8d56..06d6129c5e6d 100644 > --- a/MdeModulePkg/Universal/CapsulePei/X64/X64Entry.c > +++ b/MdeModulePkg/Universal/CapsulePei/X64/X64Entry.c > @@ -12,6 +12,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent > #include >=20 > #include >=20 > #include >=20 > +#include >=20 > #include "CommonHeader.h" >=20 >=20 >=20 > #define EXCEPTION_VECTOR_NUMBER 0x22 >=20 > @@ -61,20 +62,9 @@ HookPageFaultHandler ( > IN OUT PAGE_FAULT_CONTEXT *PageFaultContext >=20 > ) >=20 > { >=20 > - UINT32 RegEax; >=20 > - UINT8 PhysicalAddressBits; >=20 > UINTN PageFaultHandlerHookAddress; >=20 >=20 >=20 > - AsmCpuid (0x80000000, &RegEax, NULL, NULL, NULL); >=20 > - if (RegEax >=3D 0x80000008) { >=20 > - AsmCpuid (0x80000008, &RegEax, NULL, NULL, NULL); >=20 > - PhysicalAddressBits =3D (UINT8)RegEax; >=20 > - } else { >=20 > - PhysicalAddressBits =3D 36; >=20 > - } >=20 > - >=20 > - PageFaultContext->PhyMask =3D LShiftU64 (1, PhysicalAddressBits) - 1; >=20 > - PageFaultContext->PhyMask &=3D (1ull << 48) - SIZE_4KB; >=20 > + GetPhysicalAddressBits(NULL, &(PageFaultContext->PhyMask)); >=20 >=20 >=20 > // >=20 > // Set Page Fault entry to catch >4G access >=20 > diff --git a/MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf > b/MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf > index 19b8a4c8aefa..45808bcdcd6c 100644 > --- a/MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf > +++ b/MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf > @@ -55,6 +55,7 @@ >=20 >=20 > [Packages] >=20 > MdePkg/MdePkg.dec >=20 > + UefiCpuPkg/UefiCpuPkg.dec >=20 > MdeModulePkg/MdeModulePkg.dec >=20 >=20 >=20 > [Packages.ARM, Packages.AARCH64] >=20 > @@ -75,6 +76,7 @@ > DebugAgentLib >=20 > PeiServicesTablePointerLib >=20 > PerformanceLib >=20 > + UefiCpuLib >=20 >=20 >=20 > [LibraryClasses.ARM, LibraryClasses.AARCH64] >=20 > ArmMmuLib >=20 > diff --git a/MdeModulePkg/MdeModulePkg.dsc > b/MdeModulePkg/MdeModulePkg.dsc index b1d83461865e..da6213c02da0 > 100644 > --- a/MdeModulePkg/MdeModulePkg.dsc > +++ b/MdeModulePkg/MdeModulePkg.dsc > @@ -62,6 +62,7 @@ >=20 > DxeServicesTableLib|MdePkg/Library/DxeServicesTableLib/DxeServicesTableL > ib.inf >=20 >=20 > UefiBootManagerLib|MdeModulePkg/Library/UefiBootManagerLib/UefiBoot > ManagerLib.inf >=20 >=20 > VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLi= b > .inf >=20 > + UefiCpuLib|UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf >=20 > # >=20 > # Generic Modules >=20 > # >=20 > diff --git > a/MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/BootScriptExecutor > Dxe.inf > b/MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/BootScriptExecutor > Dxe.inf > index fb149c2f0271..dd3dd2fc8c10 100644 > --- > a/MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/BootScriptExecutor > Dxe.inf > +++ > b/MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/BootScriptExecut > +++ orDxe.inf > @@ -41,6 +41,7 @@ >=20 >=20 > [Packages] >=20 > MdePkg/MdePkg.dec >=20 > + UefiCpuPkg/UefiCpuPkg.dec >=20 > MdeModulePkg/MdeModulePkg.dec >=20 >=20 >=20 > [LibraryClasses] >=20 > @@ -54,6 +55,7 @@ > UefiBootServicesTableLib >=20 > CacheMaintenanceLib >=20 > UefiLib >=20 > + UefiCpuLib >=20 > DebugAgentLib >=20 > LockBoxLib >=20 > CpuExceptionHandlerLib >=20 > diff --git a/MdeModulePkg/Universal/CapsulePei/CapsuleX64.inf > b/MdeModulePkg/Universal/CapsulePei/CapsuleX64.inf > index 35d2535a5b48..75813b1e5481 100644 > --- a/MdeModulePkg/Universal/CapsulePei/CapsuleX64.inf > +++ b/MdeModulePkg/Universal/CapsulePei/CapsuleX64.inf > @@ -38,12 +38,14 @@ > [Packages] >=20 > MdePkg/MdePkg.dec >=20 > MdeModulePkg/MdeModulePkg.dec >=20 > + UefiCpuPkg/UefiCpuPkg.dec >=20 >=20 >=20 > [LibraryClasses] >=20 > BaseLib >=20 > DebugLib >=20 > CpuExceptionHandlerLib >=20 > DebugAgentLib >=20 > + UefiCpuLib >=20 >=20 >=20 > [Depex] >=20 > FALSE >=20 > -- > 2.30.0.windows.2 >=20 >=20 >=20 > -=3D-=3D-=3D-=3D-=3D-=3D > Groups.io Links: You receive all messages sent to this group. > View/Reply Online (#87235): https://edk2.groups.io/g/devel/message/87235 > Mute This Topic: https://groups.io/mt/89503325/1712937 > Group Owner: devel+owner@edk2.groups.io > Unsubscribe: https://edk2.groups.io/g/devel/unsub [ray.ni@intel.com] > -=3D-=3D-=3D-=3D-=3D-=3D >=20 >=20 >=20 >=20 >=20 >=20