[edk2-devel] [PATCH 9/9] MdeModulePkg:Add global variable mVariableRtCacheInfo

2024-05-17 Thread duntan
Add global variable mVariableRtCacheInfo to save the content in gEdkiiVariableRuntimeCacheInfoHobGuid. With this new global variable, 7 global variables can be removed. Signed-off-by: Dun Tan Cc: Ray Ni Cc: Liming Gao Cc: Jiaxin Wu ---

[edk2-devel] [PATCH 8/9] MdeModulePkg: Refine InitVariableCache()

2024-05-17 Thread duntan
Refine the code logic in InitVariableCache(). In this commit, three times calling of InitVariableCache() for different type cache are merged into one calling. This commit is to make the code looks cleaner and doesn't change any code functionality. Signed-off-by: Dun Tan Cc: Ray Ni Cc: Liming

[edk2-devel] [PATCH 7/9] MdeModulePkg:Consume gEdkiiVariableRuntimeCacheInfoHobGuid

2024-05-17 Thread duntan
Consume gEdkiiVariableRuntimeCacheInfoHobGuid in VariableSmmRuntimeDxe driver to initialize the following variable cache related buffer: *mVariableRuntimeHobCacheBuffer *mVariableRuntimeNvCacheBuffer *mVariableRuntimeVolatileCacheBuffer *mVariableRuntimeCachePendingUpdate

[edk2-devel] [PATCH 6/9] MdeModulePkg:Remove unnecessary global variable

2024-05-17 Thread duntan
Remove the two unnecessary global variables and replace them by two local variables: mVariableRuntimeNvCacheBufferSize mVariableRuntimeVolatileCacheBufferSize Signed-off-by: Dun Tan Cc: Ray Ni Cc: Liming Gao Cc: Jiaxin Wu --- MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.c

[edk2-devel] [PATCH 5/9] MdeModulePkg:Create gEdkiiVariableRuntimeCacheInfoHobGuid

2024-05-17 Thread duntan
Install the callback of gEfiPeiMemoryDiscoveredPpiGuid to create gEdkiiVariableRuntimeCacheInfoHobGuid in VariablePei module. When PcdEnableVariableRuntimeCache is TRUE, the callback will be installed to allocate the needed buffer for different type variable runtime cache, unblock the buffer and

[edk2-devel] [PATCH 3/9] EmulatorPkg: Add MmUnblockMemoryLib in DSC

2024-05-17 Thread duntan
Add MmUnblockMemoryLib in EmulatorPkg.dsc. This lib will be required by VariablePei in following commits. Signed-off-by: Dun Tan Cc: Andrew Fish Cc: Ray Ni --- EmulatorPkg/EmulatorPkg.dsc | 1 + 1 file changed, 1 insertion(+) diff --git a/EmulatorPkg/EmulatorPkg.dsc

[edk2-devel] [PATCH 4/9] OvmfPkg: Add MmUnblockMemoryLib in DSC

2024-05-17 Thread duntan
Add MmUnblockMemoryLib in OvmfPkgIa32X64.dsc. This lib will be required by VariablePei in following commits. Signed-off-by: Dun Tan Cc: Ray Ni Cc: Ard Biesheuvel Cc: Jiewen Yao Cc: Gerd Hoffmann --- OvmfPkg/OvmfPkgIa32X64.dsc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git

[edk2-devel] [PATCH 2/9] ArmVirtPkg: Add MmUnblockMemoryLib in DSC

2024-05-17 Thread duntan
Add MmUnblockMemoryLib in ArmVirtCloudHv.dsc. This lib will be required by VariablePei in following commits. Signed-off-by: Dun Tan Cc: Ray Ni Cc: Ard Biesheuvel Cc: Leif Lindholm Cc: Sami Mujawar Cc: Gerd Hoffmann --- ArmVirtPkg/ArmVirtCloudHv.dsc | 2 ++ 1 file changed, 2 insertions(+)

[edk2-devel] [PATCH 1/9] MdeModulePkg:Add new gEdkiiVariableRuntimeCacheInfoHobGuid

2024-05-17 Thread duntan
This commit defines VARIABLE_RUNTIME_CACHE_INFO HOB. The HOB is used to store the address and size of the buffer that will be used for variable runtime service when the PcdEnableVariableRuntimeCache is TRUE. In following patches, when PcdEnableVariableRuntimeCache is TRUE, VariablePei module will

[edk2-devel] [PATCH 0/9] Allocate and unblock variable runtime cache buffer in PEI

2024-05-17 Thread duntan
This patch set defines a new VARIABLE_RUNTIME_CACHE_INFO HOB. The HOB is used to store the address and size of the buffer that will be used for variable runtime service when the PcdEnableVariableRuntimeCache is TRUE. In following patches, when PcdEnableVariableRuntimeCache is TRUE, VariablePei

[edk2-devel] [Patch V2 18/18] UefiCpuPkg: Remove GetAcpiCpuData() in CpuS3.c

2024-05-17 Thread duntan
Remove GetAcpiCpuData() in CpuS3.c. The mAcpiCpuData is not needed in S3 boot anymore. Signed-off-by: Dun Tan Reviewed-by: Ray Ni Cc: Rahul Kumar Cc: Gerd Hoffmann Cc: Jiaxin Wu --- UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c | 243

[edk2-devel] [Patch V2 16/18] UefiCpuPkg: Remove unneeded MpService2Ppi assignment

2024-05-17 Thread duntan
Remove the unneeded assignment of MpService2Ppi field in SmmS3ResumeState. Previously, when the execution combination of PEI and DXE are the same, the pointer of mpservice ppi will be passed to CpuS3.c in smm cpu driver to wakeup all APs, instead of init-sipi-sipi. Currently, CpuS3.c doesn't need

[edk2-devel] [Patch V2 17/18] MdeModulePkg:Remove MpService2Ppi field in SMM_S3_RESUME_STATE

2024-05-17 Thread duntan
This MpService2Ppi field in SMM_S3_RESUME_STATE is used to wakeup AP to do the CPU initialization during smm s3 boot when the execution mode of PEI and DXE are the same. Currently, in CpuS3.c of smm cpu driver, BSP doesn't need to wakeup AP anymore. The initialization for AP will be done in

[edk2-devel] [Patch V2 15/18] UefiCpuPkg:Remove code to wakeup AP and relocate ap

2024-05-17 Thread duntan
After the code to load mtrr setting, set register table, handle APIC setting and Interrupt after INIT-SIPI-SIPI is moved, the InitializeCpuProcedure() only contains following code logic: 1.Bsp runs ExecuteFirstSmiInit(). 2.Bsp transfers AP to safe hlt-loop During S3 boot, since APs will be

[edk2-devel] [Patch V2 14/18] UefiCpuPkg:Remove code to handle APIC setting and Interrupt

2024-05-17 Thread duntan
Remove ProgramVirtualWireMode()/DisableLvtInterrupts() since APs won't be waken by INIT-SIPI-SIPI in CpuS3.c any more. The two functions has been executed in MpInitLibInitialize() in PeiMplib. Signed-off-by: Dun Tan Reviewed-by: Ray Ni Cc: Rahul Kumar Cc: Gerd Hoffmann Cc: Jiaxin Wu ---

[edk2-devel] [Patch V2 13/18] UefiCpuPkg:Relocate AP to new safe buffer in PeiMpLib

2024-05-17 Thread duntan
In this commit, change PeiMpLib to install callback of gEdkiiEndOfS3ResumeGuid to relocate AP to new safe buffer. The gEdkiiEndOfS3ResumeGuid is installed in S3Resume.c before jmping to OS waking vector. Previously, code in CpuS3.c of PiSmmCpuDxe driver will prepare the new safe buffer for AP and

[edk2-devel] [Patch V2 12/18] UefiCpuPkg: Install gEdkiiEndOfS3ResumeGuid in S3Resume

2024-05-17 Thread duntan
Install gEdkiiEndOfS3ResumeGuid in S3Resume to trigger callback registered by PeiMpLib. The callback is to relocate Ap to new safe memory before jump to OS waking vector in S3 boot flow. Signed-off-by: Dun Tan Reviewed-by: Ray Ni Cc: Rahul Kumar Cc: Gerd Hoffmann Cc: Jiaxin Wu ---

[edk2-devel] [Patch V2 11/18] UefiCpuPkg:Move some code in DxeMpLib to common place

2024-05-17 Thread duntan
Move some code in DxeMpLib.C to common MpLib.c. The related code is to relocate Ap to new safe buffer before booting into OS. In next commits, these code also will be used by PeiMpLib. This commit doesn't change any code functionality. Signed-off-by: Dun Tan Reviewed-by: Ray Ni Cc: Rahul Kumar

[edk2-devel] [Patch V2 10/18] UefiCpuPkg:Abstract some DxeMpLib code to function

2024-05-17 Thread duntan
Abstract some DxeMpLib code to function in this commit. Some of these internal functions will be moved to common MpLib.c in following commits. Then PeiMpLib can reuse the code. Signed-off-by: Dun Tan Reviewed-by: Ray Ni Cc: Rahul Kumar Cc: Gerd Hoffmann Cc: Jiaxin Wu ---

[edk2-devel] [Patch V2 09/18] UefiCpuPkg: Disable PG in IA32 ApLoopCode

2024-05-17 Thread duntan
Disable paging in IA32 RelocateApLoop assembly code to fix the issue that the AP page table is unavailiable after boot OS under IA32 execution mode. This issue exist in IA32 PEI + IA32 DXE normal boot (also S3 boot with IA32 PEI after previous three commits are accepted). In current MpLib code,

[edk2-devel] [Patch V2 08/18] UefiCpuPkg: Remove code to set register table

2024-05-17 Thread duntan
Remove code to set register table in CpuS3.c. In previous commit, PcdCpuFeaturesInitOnS3Resume has been set to TRUE. So that CpuFeaturesPei PEIM will initialize the CPU registers and perform CPU features initialization. Signed-off-by: Dun Tan Reviewed-by: Ray Ni Cc: Rahul Kumar Cc: Gerd

[edk2-devel] [Patch V2 07/18] UefiCpuPkg:Set PcdCpuFeaturesInitOnS3Resume to TRUE

2024-05-17 Thread duntan
Set PcdCpuFeaturesInitOnS3Resume to TRUE. So that CpuFeaturesPei PEIM will initialize the CPU registers and perform CPU features initialization. Signed-off-by: Dun Tan Reviewed-by: Ray Ni Cc: Rahul Kumar Cc: Gerd Hoffmann Cc: Jiaxin Wu --- UefiCpuPkg/UefiCpuPkg.dec | 4 ++-- 1 file changed,

[edk2-devel] [Patch V2 06/18] UefiCpuPkg: Remove code to load mtrr setting

2024-05-17 Thread duntan
Remove code to load mtrr setting in CpuS3.c. In previous commits, before transferring to CpuS3.c, MTRR setting has been loaded in S3RestoreConfig2() for all CPU. Signed-off-by: Dun Tan Reviewed-by: Ray Ni Cc: Rahul Kumar Cc: Gerd Hoffmann Cc: Jiaxin Wu --- UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c

[edk2-devel] [Patch V2 04/18] UefiCpuPkg: Save MTRR by lockbox in CpuS3DataDxe

2024-05-17 Thread duntan
Save MTRR by lockbox in CpuS3DataDxe. In S3 boot, The MTRR setting will be restored in S3Resume.c in following patches. Then S3Resume.c will wakeup all APs to load the MTRR setting. This can avoid waking up APs in CpuS3.c. Signed-off-by: Dun Tan Reviewed-by: Ray Ni Cc: Rahul Kumar Cc: Gerd

[edk2-devel] [Patch V2 05/18] UefiCpuPkg: LoadMtrrData for all cpu in S3Resume

2024-05-17 Thread duntan
In this commit, S3Resume.c wakeup all Aps to run LoadMtrrData for all cpu before transfer to CpuS3.c in smm cpu driver. The MtrrSetting table can be restored by gEdkiiS3MtrrSettingGuid which is saved by lockbox in PEI phase. This can avoid waking up APs in CpuS3.c. Signed-off-by: Dun Tan

[edk2-devel] [Patch V2 03/18] UefiCpuPkg: Add locbox lib instance in DSC

2024-05-17 Thread duntan
Add locbox lib instance in DSC. The SmmLockBoxDxeLib will be consumed by CpuS3DataDxe driver Signed-off-by: Dun Tan Reviewed-by: Ray Ni Cc: Rahul Kumar Cc: Gerd Hoffmann Cc: Jiaxin Wu --- UefiCpuPkg/UefiCpuPkg.dsc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git

[edk2-devel] [Patch V2 02/18] OvmfPkg: Save MTRR by lockbox in CpuS3DataDxe

2024-05-17 Thread duntan
Save MTRR by lockbox in CpuS3DataDxe. In S3 boot, The MTRR setting will be restored in S3Resume.c in following patches. Then S3Resume.c will wakeup all APs to load the MTRR setting. This can avoid waking up APs in CpuS3.c. Signed-off-by: Dun Tan Cc: Ard Biesheuvel Cc: Jiewen Yao Cc: Gerd

[edk2-devel] [Patch V2 01/18] MdeModulePkg: Add gEdkiiS3MtrrSettingGuid

2024-05-17 Thread duntan
Add gEdkiiS3MtrrSettingGuid a new GUID for s3 MTRR setting. This GUID will be used to save MTRR_SETTINGS at EndOfDxe by LockBox and restore at S3 boot PEI phase for s3 usage. Signed-off-by: Dun Tan Reviewed-by: Ray Ni Cc: Liming Gao Cc: Jiaxin Wu --- MdeModulePkg/MdeModulePkg.dec | 5 -

[edk2-devel] [Patch V2 00/18] Remove some S3 related code in CpuS3.c of smm cpu driver

2024-05-17 Thread duntan
Comparing to V1 patchs set, the V2 patch set only adjusts the commits ordering and modifies copy right year in some files. This patch set is to remove some S3 related code in CpuS3.c of smm cpu driver. It contain commits to: 1) S3 MTRRs operation: > MdeModulePkg: Add gEdkiiS3MtrrSettingGuid >

[edk2-devel] [PATCH] UefiCpuPkg:fix issue when splitting paging entry

2024-05-17 Thread duntan
This patch is to fix issue when splitting leaf paging entry in CpuPageTableLib code. In previous code, before we assign the new child paging structure address to the content of splitted paging entry, PageTableLibSetPnle() is called to make sure the bit7 is set to 0, which indicate the previous

Re: [edk2-devel] [PATCH 18/18] MdeModulePkg:Remove MpService2Ppi field in SMM_S3_RESUME_STATE

2024-05-12 Thread duntan
Thanks for the comments. How about change the commits order to be like: 1) S3 MTRRs operation: 2) AP page table unavailiable issue fix: 3) S3 ApHltLoopCode Operation: > UefiCpuPkg:Abstract some DxeMpLib code to function > UefiCpuPkg:Move some code in DxeMpLib to common place >

Re: [edk2-devel] [PATCH 04/18] UefiCpuPkg: Save MTRR by lockbox in CpuS3DataDxe

2024-05-12 Thread duntan
Yes, let's do the cleanup for PcdCpuS3DataAddress in another new patch set. Thanks, Dun -Original Message- From: Wu, Jiaxin Sent: Monday, May 13, 2024 11:04 AM To: Tan, Dun ; devel@edk2.groups.io Cc: Ni, Ray ; Kumar, Rahul R ; Gerd Hoffmann Subject: RE: [PATCH 04/18] UefiCpuPkg: Save

Re: [edk2-devel] [PATCH 00/19] Remove some S3 related code in CpuS3.c of smm cpu driver

2024-05-12 Thread duntan
egister table > UefiCpuPkg: Remove GetAcpiCpuData() in CpuS3.c 2. Update all intel copyright year. 3. Add all reviewer in the 00 patch. 4. Add PR in the 00 patch (if have). Thanks, Jiaxin > -Original Message- > From: devel@edk2.groups.io On Behalf Of duntan > Sent: Fr

[edk2-devel] [PATCH 18/18] MdeModulePkg:Remove MpService2Ppi field in SMM_S3_RESUME_STATE

2024-05-10 Thread duntan
This MpService2Ppi field in SMM_S3_RESUME_STATE is used to wakeup AP to do the CPU initialization during smm s3 boot when the execution mode of PEI and DXE are the same. Currently, in CpuS3.c of smm cpu driver, BSP doesn't need to wakeup AP anymore. The initialization for AP will be done in

[edk2-devel] [PATCH 17/18] UefiCpuPkg: Remove GetAcpiCpuData() in CpuS3.c

2024-05-10 Thread duntan
Remove GetAcpiCpuData() in CpuS3.c. The mAcpiCpuData is not needed in S3 boot anymore. Signed-off-by: Dun Tan Cc: Ray Ni Cc: Laszlo Ersek Cc: Rahul Kumar Cc: Gerd Hoffmann Cc: Jiaxin Wu --- UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c | 243

[edk2-devel] [PATCH 14/18] UefiCpuPkg: Remove code to set register table

2024-05-10 Thread duntan
Remove code to set register table in CpuS3.c. In previous commit, PcdCpuFeaturesInitOnS3Resume has been set to TRUE. So that CpuFeaturesPei PEIM will initialize the CPU registers and perform CPU features initialization. Signed-off-by: Dun Tan Cc: Ray Ni Cc: Laszlo Ersek Cc: Rahul Kumar Cc:

[edk2-devel] [PATCH 16/18] UefiCpuPkg:Remove code to wakeup AP and relocate ap

2024-05-10 Thread duntan
After the code to load mtrr setting, set register table, handle APIC setting and Interrupt after INIT-SIPI-SIPI is moved, the InitializeCpuProcedure() only contains following code logic: 1.Bsp runs ExecuteFirstSmiInit(). 2.Bsp transfers AP to safe hlt-loop During S3 boot, since APs will be

[edk2-devel] [PATCH 13/18] UefiCpuPkg:Set PcdCpuFeaturesInitOnS3Resume to TRUE

2024-05-10 Thread duntan
Set PcdCpuFeaturesInitOnS3Resume to TRUE. So that CpuFeaturesPei PEIM will initialize the CPU registers and perform CPU features initialization. Signed-off-by: Dun Tan Cc: Ray Ni Cc: Laszlo Ersek Cc: Rahul Kumar Cc: Gerd Hoffmann Cc: Jiaxin Wu --- UefiCpuPkg/UefiCpuPkg.dec | 2 +- 1 file

[edk2-devel] [PATCH 15/18] UefiCpuPkg:Remove code to handle APIC setting and Interrupt

2024-05-10 Thread duntan
Remove ProgramVirtualWireMode()/DisableLvtInterrupts() since APs won't be waken by INIT-SIPI-SIPI in CpuS3.c any more. The two functions has been executed in MpInitLibInitialize() in PeiMplib. Signed-off-by: Dun Tan Cc: Ray Ni Cc: Laszlo Ersek Cc: Rahul Kumar Cc: Gerd Hoffmann Cc: Jiaxin Wu

[edk2-devel] [PATCH 12/18] UefiCpuPkg: Remove code to load mtrr setting

2024-05-10 Thread duntan
Remove code to load mtrr setting in CpuS3.c. In previous commits, before transferring to CpuS3.c, MTRR setting has been loaded in S3RestoreConfig2() for all CPU. Signed-off-by: Dun Tan Cc: Ray Ni Cc: Laszlo Ersek Cc: Rahul Kumar Cc: Gerd Hoffmann Cc: Jiaxin Wu ---

[edk2-devel] [PATCH 11/18] UefiCpuPkg: Disable PG in IA32 ApLoopCode

2024-05-10 Thread duntan
Disable paging in IA32 RelocateApLoop assembly code to fix the issue that the AP page table is unavailiable after boot OS under IA32 execution mode. This issue exist in IA32 PEI + IA32 DXE normal boot (also S3 boot with IA32 PEI after previous three commits are accepted). In current MpLib code,

[edk2-devel] [PATCH 10/18] UefiCpuPkg:Relocate AP to new safe buffer in PeiMpLib

2024-05-10 Thread duntan
In this commit, change PeiMpLib to install callback of gEdkiiEndOfS3ResumeGuid to relocate AP to new safe buffer. The gEdkiiEndOfS3ResumeGuid is installed in S3Resume.c before jmping to OS waking vector. Previously, code in CpuS3.c of PiSmmCpuDxe driver will prepare the new safe buffer for AP and

[edk2-devel] [PATCH 09/18] UefiCpuPkg:Move some code in DxeMpLib to common place

2024-05-10 Thread duntan
Move some code in DxeMpLib.C to common MpLib.c. The related code is to relocate Ap to new safe buffer before booting into OS. In next commits, these code also will be used by PeiMpLib. This commit doesn't change any code functionality. Signed-off-by: Dun Tan Cc: Ray Ni Cc: Laszlo Ersek Cc:

[edk2-devel] [PATCH 08/18] UefiCpuPkg:Abstract some DxeMpLib code to function

2024-05-10 Thread duntan
Abstract some DxeMpLib code to function in this commit. Some of these internal functions will be moved to common MpLib.c in following commits. Then PeiMpLib can reuse the code. Signed-off-by: Dun Tan Cc: Ray Ni Cc: Laszlo Ersek Cc: Rahul Kumar Cc: Gerd Hoffmann Cc: Jiaxin Wu ---

[edk2-devel] [PATCH 07/18] UefiCpuPkg: Install gEdkiiEndOfS3ResumeGuid in S3Resume

2024-05-10 Thread duntan
Install gEdkiiEndOfS3ResumeGuid in S3Resume to trigger callback registered by PeiMpLib. The callback is to relocate Ap to new safe memory before jump to OS waking vector in S3 boot flow. Signed-off-by: Dun Tan Cc: Ray Ni Cc: Laszlo Ersek Cc: Rahul Kumar Cc: Gerd Hoffmann Cc: Jiaxin Wu ---

[edk2-devel] [PATCH 06/18] UefiCpuPkg: Remove the duplicated mpservice locate

2024-05-10 Thread duntan
Remove the duplicated mpservice locate in the code logic. Previously, when the execution combination of PEI and DXE are the same, the pointer of mpservice ppi will be passed to CpuS3.c in smm cpu driver to wakeup all APs, instead of init-sipi-sipi. Currently, CpuS3.c doesn't need to wakeup Aps

[edk2-devel] [PATCH 05/18] UefiCpuPkg: LoadMtrrData for all cpu in S3Resume

2024-05-10 Thread duntan
In this commit, S3Resume.c wakeup all Aps to run LoadMtrrData for all cpu before transfer to CpuS3.c in smm cpu driver. The MtrrSetting table can be restored by gEdkiiS3MtrrSettingGuid which is saved by lockbox in PEI phase. This can avoid waking up APs in CpuS3.c. Signed-off-by: Dun Tan Cc: Ray

[edk2-devel] [PATCH 04/18] UefiCpuPkg: Save MTRR by lockbox in CpuS3DataDxe

2024-05-10 Thread duntan
Save MTRR by lockbox in CpuS3DataDxe. In S3 boot, The MTRR setting will be restored in S3Resume.c in following patches. Then S3Resume.c will wakeup all APs to load the MTRR setting. This can avoid waking up APs in CpuS3.c. Signed-off-by: Dun Tan Cc: Ray Ni Cc: Rahul Kumar Cc: Gerd Hoffmann

[edk2-devel] [PATCH 03/18] UefiCpuPkg: Add locbox lib instance in DSC

2024-05-10 Thread duntan
Add locbox lib instance in DSC. The SmmLockBoxDxeLib will be consumed by CpuS3DataDxe driver Signed-off-by: Dun Tan Cc: Ray Ni Cc: Rahul Kumar Cc: Gerd Hoffmann Cc: Jiaxin Wu --- UefiCpuPkg/UefiCpuPkg.dsc | 1 + 1 file changed, 1 insertion(+) diff --git a/UefiCpuPkg/UefiCpuPkg.dsc

[edk2-devel] [PATCH 02/18] OvmfPkg: Save MTRR by lockbox in CpuS3DataDxe

2024-05-10 Thread duntan
Save MTRR by lockbox in CpuS3DataDxe. In S3 boot, The MTRR setting will be restored in S3Resume.c in following patches. Then S3Resume.c will wakeup all APs to load the MTRR setting. This can avoid waking up APs in CpuS3.c. Signed-off-by: Dun Tan Cc: Ard Biesheuvel Cc: Jiewen Yao Cc: Gerd

[edk2-devel] [PATCH 01/18] MdeModulePkg: Add gEdkiiS3MtrrSettingGuid

2024-05-10 Thread duntan
Add gEdkiiS3MtrrSettingGuid a new GUID for s3 MTRR setting. This GUID will be used to save MTRR_SETTINGS at EndOfDxe by LockBox and restore at S3 boot PEI phase for s3 usage. Signed-off-by: Dun Tan Cc: Ray Ni Cc: Liming Gao Cc: Jiaxin Wu --- MdeModulePkg/MdeModulePkg.dec | 3 +++ 1 file

[edk2-devel] [PATCH 00/19] Remove some S3 related code in CpuS3.c of smm cpu driver

2024-05-10 Thread duntan
This patch set is to remove some S3 related code in CpuS3.c of smm cpu driver. It contain commits to: 1.Save MTRR setting by lockbox in PEI phase 2.Load MTRR in S3Resume.c before transferring to CpuS3.c in smm cpu driver. 3.Add callback of gEdkiiEndOfS3ResumeGuid in PeiMpLib to relocate Ap to

[edk2-devel] [edk2-platforms V2 3/3] MinPlatformPkg: Sort ApicIdOrderTable by special rules

2024-04-01 Thread duntan
Sort ApicIdOrderTable by following special rules: 1. Make sure BSP is the first entry. 2. For APs, big core first, then small core. With this implementation, BIOS can present cores in order of relative performance in MADT. Linux OS would schedule cores by the order that they are presented in the

[edk2-devel] [edk2-platforms V2 2/3] MinPlatformPkg: Get CoreType for all cores

2024-04-01 Thread duntan
Add a new field CoreType in EFI_CPU_ID_ORDER_MAP and get CoreType for all cores. Signed-off-by: Dun Tan Cc: Ray Ni Cc: Jason Lou Cc: Chasel Chiu Cc: Nate DeSimone Cc: Liming Gao Cc: Eric Dong --- Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c | 50

[edk2-devel] [edk2-platforms V2 1/3] MinPlatformPkg: Remove the global variable mForceX2ApicId

2024-04-01 Thread duntan
This global variable mForceX2ApicId is not assigned to any value in code and will be initialized to 0 when the driver is loaded. So remove the global variable and related code that will not be executed. Signed-off-by: Dun Tan Cc: Ray Ni Cc: Jason Lou Cc: Chasel Chiu Cc: Nate DeSimone Cc:

[edk2-devel] [edk2-platforms V2 0/3] MinPlatformPkg: Sort ApicIdOrderTable by special rules

2024-04-01 Thread duntan
This patch set is to sort ApicIdOrderTable by following special rules: 1. Make sure BSP is the first entry. 2. For APs, big core first, then small core. With this implementation, BIOS can present cores in order of relative performance in MADT. Linux OS would schedule cores by the order that they

[edk2-devel] [edk2-platforms V2] MinPlatformPkg: Corret AcpiProcessorUid in MADT

2024-03-31 Thread duntan
Change AcpiProcessorUid in CpuApicIdOrderTable to the index in MpService regardless of disabled core. Let's take a simple example: There are 2 enabled cores and 1 disabled core. APICID Index in MpService 0x_0 0x_0010(disbaled) 1 0x_0040

[edk2-devel] [edk2-platforms] MinPlatformPkg: Corret AcpiProcessorUid in MADT

2024-03-28 Thread duntan
Change AcpiProcessorUid in CpuApicIdOrderTable to the Index value in MP service regardless of diabled fore. Let take a simple example: CORE number APICID Index in MpService CORE0 0x_ 0 CORE1(Disabled) 0x_0010 1 CORE2 0x_0040

[edk2-devel] [edk2-platforms] MinPlatformPkg: Sort ApicIdOrderTable by special rules

2024-03-28 Thread duntan
Sort ApicIdOrderTable by following special rules: 1. Make sure BSP is the first entry. 2. For APs, big core first, then small core. 3. For APs, if the core type are the same, sort them by AcpiProcessorUid. With this implementation, BIOS can present cores in order of relative performance in

Re: [edk2-devel] [edk2-stable202402 PATCH 1/2] UefiCpuPkg/PiSmmCpuDxeSmm: distinguish GetSmBase() failure modes

2024-02-19 Thread duntan
Laszlo, Sorry for the late reply. Thanks for your code refactoring patch and bugfix patch! Thanks, Dun -Original Message- From: Laszlo Ersek Sent: Thursday, February 15, 2024 4:45 PM To: Kinney, Michael D ; Leif Lindholm ; devel@edk2.groups.io; Leif Lindholm ; Andrew Fish

Re: [edk2-devel] [Patch V4] UefiCpuPkg:Limit PhysicalAddressBits in special case

2024-01-12 Thread duntan
Hi Gerd, I've refined the comments and the commit message. Could you please help to review again? Thanks, Dun -Original Message- From: devel@edk2.groups.io On Behalf Of duntan Sent: Friday, January 12, 2024 4:32 PM To: devel@edk2.groups.io Cc: Ni, Ray ; Laszlo Ersek ; Kumar, Rahul R

[edk2-devel] [Patch V4] UefiCpuPkg:Limit PhysicalAddressBits in special case

2024-01-12 Thread duntan
When creating smm page table, limit maximum supported physical addresses bits returned by CalculateMaximumSupportAddress() to 47 if 5-Level Paging is disabled. This commit is to avoid issue that more than 47-bit physical addresses are requested in smm page table when 5-level paging is disabled.

Re: [edk2-devel] [Patch V3] UefiCpuPkg:Limit PhysicalAddressBits in special case

2024-01-11 Thread duntan
Hi Gerd, I explain the reason why 47 here is since virtual addresses are sign-extended in the commit message. About the technical background, I also mentioned in the commit message " When 5-Level Paging is disabled and the PhysicalAddressBits retrived from CPU HOB or CpuId is bigger than 47".

Re: [edk2-devel] [Patch V3] UefiCpuPkg:Limit PhysicalAddressBits in special case

2024-01-11 Thread duntan
.groups.io On Behalf Of duntan Sent: Thursday, January 11, 2024 5:00 PM To: devel@edk2.groups.io Cc: Ni, Ray ; Laszlo Ersek ; Kumar, Rahul R ; Gerd Hoffmann Subject: [edk2-devel] [Patch V3] UefiCpuPkg:Limit PhysicalAddressBits in special case When creating smm page table, limit maximum supported

[edk2-devel] [PATCH] UefiCpuPkg: change name of gMpInformationHobGuid2

2024-01-11 Thread duntan
Change name of gMpInformationHobGuid2 to gMpInformation2HobGuid. It's to align with the file name MpInformation2.h and the structure name MP_INFORMATION2_HOB_DATA. Signed-off-by: Dun Tan Cc: Ray Ni Cc: Laszlo Ersek Cc: Rahul Kumar Cc: Gerd Hoffmann --- UefiCpuPkg/CpuMpPei/CpuMpPei.c

[edk2-devel] [Patch V3] UefiCpuPkg:Limit PhysicalAddressBits in special case

2024-01-11 Thread duntan
When creating smm page table, limit maximum supported physical address bits returned by CalculateMaximumSupportAddress() to 47 if 5-Level Paging is disabled. When 5-Level Paging is disabled and the PhysicalAddressBits retrived from CPU HOB or CpuId is bigger than 47, and since virtual addresses

Re: [edk2-devel] [Patch V2] UefiCpuPkg:Limit PhysicalAddressBits in speicial case

2024-01-11 Thread duntan
Oh, thanks for your comments! Will correct it in next version patch. Thanks, Dun -Original Message- From: Laszlo Ersek Sent: Thursday, January 11, 2024 4:48 PM To: Tan, Dun ; devel@edk2.groups.io Cc: Ni, Ray ; Kumar, Rahul R ; Gerd Hoffmann Subject: Re: [Patch V2] UefiCpuPkg:Limit

[edk2-devel] [Patch V2] UefiCpuPkg:Limit PhysicalAddressBits in speicial case

2024-01-10 Thread duntan
When creating smm page table, limit maximum supported physical address bits returned by CalculateMaximumSupportAddress() to 47 if 5-Level Paging is disabled. When 5-Level Paging is disabled and the PhysicalAddressBits retrived from CPU HOB or CpuId is bigger than 47, and since virtual addresses

Re: [edk2-devel] [PATCH] UefiCpuPkg:Limit PhysicalAddressBits in speicial case

2024-01-10 Thread duntan
Hi Gerd, Thanks for your comments. I agree with your opinion. Will change the code and related comments in V2 patch. Thanks, Dun -Original Message- From: Gerd Hoffmann Sent: Wednesday, January 10, 2024 6:55 PM To: Tan, Dun Cc: devel@edk2.groups.io; Ni, Ray ; Laszlo Ersek ; Kumar,

[edk2-devel] [PATCH] UefiCpuPkg:Limit PhysicalAddressBits in speicial case

2024-01-10 Thread duntan
When creating smm page table, limit maximum supported physical address bits returned by CalculateMaximumSupportAddress() to 48 if 5-Level Paging is disabled. When 5-Level Paging is disabled and the PhysicalAddressBits retrived from CPU HOB or CpuId is bigger than 48, only [0, 2^48 -1] range in

Re: [edk2-devel] [Patch V3 0/2] Change the usage of input parameter ProcessorNumber in MpInitLibGetProcessorInfo() of MpInitLibUp

2024-01-09 Thread duntan
() of MpInitLibUp On 1/8/24 06:08, duntan wrote: > Please ignore the V2 PATCH set. No other change except adding BaseMemoryLib > headfile and lib instance in .inf to pass build since ZeroMem() is used. > > Comparing to the V1 patch set: > In "set EXTENDED_PROCESSOR_IN

Re: [edk2-devel] [Patch V2 0/2] Change the usage of input parameter ProcessorNumber in MpInitLibGetProcessorInfo() of MpInitLibUp

2024-01-07 Thread duntan
s fixed in V3 patch set. Thanks, Dun -Original Message- From: devel@edk2.groups.io On Behalf Of duntan Sent: Monday, January 8, 2024 11:56 AM To: devel@edk2.groups.io Subject: [edk2-devel] [Patch V2 0/2] Change the usage of input parameter ProcessorNumber in MpInitLibGetProcessorI

[edk2-devel] [Patch V3 2/2] UefiCpuPkg: Check lower 24 bits of ProcessorNumber

2024-01-07 Thread duntan
Check lower 24 bits of ProcessorNumber instead of the value of ProcessorNumber in the API MpInitLibGetProcessorInfo() of MpInitLibUp instance. Lower 24 bits of ProcessorNumber contains the actual processor number. The BIT24 of input ProcessorNumber might be set to indicate if the

[edk2-devel] [Patch V3 1/2] UefiCpuPkg: set EXTENDED_PROCESSOR_INFORMATION to 0

2024-01-07 Thread duntan
Set EXTENDED_PROCESSOR_INFORMATION to 0 in API MpInitLibGetProcessorInfo() of MpInitLibUp. This commit use ZeroMem() to set all fileds in output EFI_PROCESSOR_INFORMATION to 0 before StatusFlag field is reassigned. Previously EXTENDED_PROCESSOR_INFORMATION in the API MpInitLibGetProcessorInfo()

[edk2-devel] [Patch V3 0/2] Change the usage of input parameter ProcessorNumber in MpInitLibGetProcessorInfo() of MpInitLibUp

2024-01-07 Thread duntan
Please ignore the V2 PATCH set. No other change except adding BaseMemoryLib headfile and lib instance in .inf to pass build since ZeroMem() is used. Comparing to the V1 patch set: In "set EXTENDED_PROCESSOR_INFORMATION to 0", set EXTENDED_PROCESSOR_INFORMATION to 0 in API

Re: [edk2-devel] [PATCH 2/2] UefiCpuPkg: Check lower 24 bits of ProcessorNumber

2024-01-07 Thread duntan
Thanks for the comments. The code has been updated in the V2 patch set. Thanks, Dun -Original Message- From: Laszlo Ersek Sent: Friday, January 5, 2024 9:56 PM To: Ni, Ray ; devel@edk2.groups.io; Tan, Dun Cc: Kumar, Rahul R ; Gerd Hoffmann ; Xu, Min M Subject: Re: [edk2-devel]

[edk2-devel] [Patch V2 2/2] UefiCpuPkg: Check lower 24 bits of ProcessorNumber

2024-01-07 Thread duntan
Check lower 24 bits of ProcessorNumber instead of the value of ProcessorNumber in the API MpInitLibGetProcessorInfo() of MpInitLibUp instance. Lower 24 bits of ProcessorNumber contains the actual processor number. The BIT24 of input ProcessorNumber might be set to indicate if the

[edk2-devel] [Patch V2 1/2] UefiCpuPkg: set EXTENDED_PROCESSOR_INFORMATION to 0

2024-01-07 Thread duntan
Set EXTENDED_PROCESSOR_INFORMATION to 0 in API MpInitLibGetProcessorInfo() of MpInitLibUp. This commit use ZeroMem() to set all fileds in output EFI_PROCESSOR_INFORMATION to 0 before StatusFlag field is reassigned. Previously EXTENDED_PROCESSOR_INFORMATION in the API MpInitLibGetProcessorInfo()

[edk2-devel] [Patch V2 0/2] Change the usage of input parameter ProcessorNumber in MpInitLibGetProcessorInfo() of MpInitLibUp

2024-01-07 Thread duntan
In the V2 patch set: In "set EXTENDED_PROCESSOR_INFORMATION to 0", set EXTENDED_PROCESSOR_INFORMATION to 0 in API MpInitLibGetProcessorInfo() of MpInitLibUp. This commit use ZeroMem() to set all fileds in output EFI_PROCESSOR_INFORMATION to 0 before StatusFlag field is reassigned. In "Check

Re: [edk2-devel] [PATCH 1/2] UefiCpuPkg: Retrive EXTENDED_PROCESSOR_INFORMATION

2024-01-05 Thread duntan
To: devel@edk2.groups.io; Tan, Dun Cc: Ni, Ray ; Kumar, Rahul R ; Gerd Hoffmann ; Xu, Min M Subject: Re: [edk2-devel] [PATCH 1/2] UefiCpuPkg: Retrive EXTENDED_PROCESSOR_INFORMATION On 1/4/24 08:32, duntan wrote: > Retrive EXTENDED_PROCESSOR_INFORMATION in the API > MpInitLibGetProcess

[edk2-devel] [PATCH 1/2] UefiCpuPkg: Retrive EXTENDED_PROCESSOR_INFORMATION

2024-01-03 Thread duntan
Retrive EXTENDED_PROCESSOR_INFORMATION in the API MpInitLibGetProcessorInfo() of MpInitLibUp instance when the BIT24 of input ProcessorNumber is set. It's to align with the behavior in PEI/DXE MpInitLib Signed-off-by: Dun Tan Cc: Ray Ni Cc: Laszlo Ersek Cc: Rahul Kumar Cc: Gerd Hoffmann Cc:

[edk2-devel] [PATCH 2/2] UefiCpuPkg: Check lower 24 bits of ProcessorNumber

2024-01-03 Thread duntan
Check lower 24 bits of ProcessorNumber instead of the value of ProcessorNumber in the API MpInitLibGetProcessorInfo() of MpInitLibUp instance. Lower 24 bits of ProcessorNumber contains the actual processor number. The BIT24 of input ProcessorNumber might be set to indicate if the

[edk2-devel] [PATCH 0/2] Change the usage of input parameter ProcessorNumber in MpInitLibGetProcessorInfo() of MpInitLibUp

2024-01-03 Thread duntan
In this patch set, the usage of input parameter ProcessorNumber in MpInitLibGetProcessorInfo() of MpInitLibUp instance is changed. 1.Retrive EXTENDED_PROCESSOR_INFORMATION in the API MpInitLibGetProcessorInfo() of MpInitLibUp instance when the BIT24 of input ProcessorNumber is set. It's to align

Re: [edk2-devel] [Patch V2 0/3] Move gMpInformationHobGuid from StandaloneMmPkg to UefiCpuPkg.

2024-01-03 Thread duntan
limitation of the existing implementation? > > -Original Message- > From: devel@edk2.groups.io On Behalf Of duntan > Sent: Friday, November 17, 2023 5:40 PM > To: devel@edk2.groups.io > Subject: [edk2-devel] [Patch V2 0/3] Move gMpInformationHobGuid from > StandaloneMmPkg to Uefi

Re: [edk2-devel] [PATCH 3/3] StandaloneMmPkg:Remove MpInformation.h

2024-01-03 Thread duntan
Thu, 9 Nov 2023 at 03:51, duntan wrote: > > Remove MpInformation.h in StandaloneMmPkg since it has been moved to > UefiCpuPkg > > Signed-off-by: Dun Tan > Cc: Ard Biesheuvel > Cc: Sami Mujawar > Cc: Ray Ni Doesn't this break the ARM build? > --- >

Re: [edk2-devel] [Patch V3 0/6] Create and consume a new gMpInformationHobGuid2 in UefiCpuPkg.

2023-12-11 Thread duntan
st practicality, not laziness. It feels hopeless for me to make a serious "dent" in reviewing any larger patch set this week, so I'll try to spend review effort where it has a fleeting chance at enabling actual progress. Best regards, Laszlo > > -Original Message- > From:

Re: [edk2-devel] [Patch V3 0/6] Create and consume a new gMpInformationHobGuid2 in UefiCpuPkg.

2023-12-10 Thread duntan
eate a new MpInfo2Hob in UefiCpuPkg in this patch set. Do you have any comments about the patch set? Thanks, Dun -Original Message- From: devel@edk2.groups.io On Behalf Of duntan Sent: Friday, December 8, 2023 5:55 PM To: devel@edk2.groups.io Subject: [edk2-devel] [Patch V3 0/6] Create a

[edk2-devel] [Patch V3 6/6] UefiCpuPkg: Avoid assuming only one smmbasehob

2023-12-08 Thread duntan
Modify the gSmmBaseHobGuid consumption code to remove the asuumption that there is only one gSmmBaseHobGuid. If the CPU number is big enough, there will be more than one SmmBaseHob in the HOB list. Signed-off-by: Dun Tan Cc: Eric Dong Reviewed-by: Ray Ni Cc: Rahul Kumar Cc: Gerd Hoffmann ---

[edk2-devel] [Patch V3 3/6] UefiCpuPkg: Consume MpInfo2Hob in PiSmmCpuDxe

2023-12-08 Thread duntan
Consume MpInfo2Hob in PiSmmCpuDxe driver to get NumberOfProcessors, MaxNumberOfCpus and EFI_PROCESSOR_INFORMATION for all CPU from the MpInformation2 HOB. This can avoid calling MP service. Signed-off-by: Dun Tan Cc: Eric Dong Reviewed-by: Ray Ni Cc: Rahul Kumar Cc: Gerd Hoffmann ---

[edk2-devel] [Patch V3 2/6] UefiCpuPkg: Build MpInfo2HOB in CpuMpPei

2023-12-08 Thread duntan
Build MpInfo2HOB in CpuMpPei module so that later PiSmmCpuDxe or other StandaloneMm module can consume the HOB. Since there might be more one gMpInformationHobGuid2 in HOB list, CpuMpPei create a gMpInformationHobGuid2 with 0 value NumberOfProcessors field in the end of the process to indicate

[edk2-devel] [Patch V3 0/6] Create and consume a new gMpInformationHobGuid2 in UefiCpuPkg.

2023-12-08 Thread duntan
In the V3 patch set, In patch "UefiCpuPkg: Build MpInfo2HOB in CpuMpPei", the DEBUG message format is modified In patch "UefiCpuPkg: Consume MpInfo2Hob in PiSmmCpuDxe", remove unneccesary assert check. In patch "UefiCpuPkg: Avoid assuming only one smmbasehob", free allocated buffer when error

[edk2-devel] [Patch V2 3/6] UefiCpuPkg: Consume MpInfo2Hob in PiSmmCpuDxe

2023-12-06 Thread duntan
Consume MpInfo2Hob in PiSmmCpuDxe driver to get NumberOfProcessors, MaxNumberOfCpus and EFI_PROCESSOR_INFORMATION for all CPU from the MpInformation2 HOB. This can avoid calling MP service. Signed-off-by: Dun Tan Cc: Eric Dong Cc: Ray Ni Cc: Rahul Kumar Cc: Gerd Hoffmann ---

[edk2-devel] [Patch V2 6/6] UefiCpuPkg: Avoid assuming only one smmbasehob

2023-12-06 Thread duntan
Modify the gSmmBaseHobGuid consumption code to remove the asuumption that there is only one gSmmBaseHobGuid. If the CPU number is big enough, there will be more than one SmmBaseHob in the HOB list. Signed-off-by: Dun Tan Cc: Eric Dong Cc: Ray Ni Cc: Rahul Kumar Cc: Gerd Hoffmann ---

[edk2-devel] [Patch V2 5/6] UefiCpuPkg: Cache core type in MpInfo2 HOB

2023-12-06 Thread duntan
Cache core type in MpInfo2 HOB by CpuMpPei module. Signed-off-by: Dun Tan Cc: Eric Dong Cc: Ray Ni Cc: Rahul Kumar Cc: Gerd Hoffmann --- UefiCpuPkg/CpuMpPei/CpuMpPei.c | 59 +-- UefiCpuPkg/CpuMpPei/CpuMpPei.h | 2 ++ 2 files changed,

[edk2-devel] [Patch V2 1/6] UefiCpuPkg: Create gMpInformationHobGuid2 in UefiCpuPkg

2023-12-06 Thread duntan
Create gMpInformationHobGuid2 in UefiCpuPkg. Currently, there is a gMpInformationHobGuid defined, created and consumed only in StandaloneMmPkg. The HOB contains the EFI_PROCESSOR_INFORMATION structure for each CPU and the number of processors. This is the same as the information that

[edk2-devel] [Patch V2 2/6] UefiCpuPkg: Build MpInfo2HOB in CpuMpPei

2023-12-06 Thread duntan
Build MpInfo2HOB in CpuMpPei module so that later PiSmmCpuDxe or other StandaloneMm module can consume the HOB. Since there might be more one gMpInformationHobGuid2 in HOB list, CpuMpPei create a gMpInformationHobGuid2 with 0 value NumberOfProcessors field in the end of the process to indicate

[edk2-devel] [Patch V2 0/6] Create and consume a new gMpInformationHobGuid2 in UefiCpuPkg.

2023-12-06 Thread duntan
In the V2 patch set, modify some function protype and some variables naming. Original message: Create and consume gMpInformationHobGuid2 in UefiCpuPkg in this patch series. Currently, there is a gMpInformationHobGuid defined, created and consumed only in StandaloneMmPkg. The HOB contains the

Re: [edk2-devel] [PATCH 6/6] UefiCpuPkg: Avoid assuming only one smmbasehob

2023-12-06 Thread duntan
Updated in original message. Thanks, Dun -Original Message- From: Ni, Ray Sent: Wednesday, December 6, 2023 6:15 PM To: Tan, Dun ; devel@edk2.groups.io Cc: Dong, Eric ; Kumar, Rahul R ; Gerd Hoffmann Subject: RE: [PATCH 6/6] UefiCpuPkg: Avoid assuming only one smmbasehob >

Re: [edk2-devel] [PATCH 5/6] UefiCpuPkg: Cache core type in MpInfo2 HOB

2023-12-06 Thread duntan
Will change the commit based on the comments Thanks, Dun -Original Message- From: Ni, Ray Sent: Wednesday, December 6, 2023 6:02 PM To: Tan, Dun ; devel@edk2.groups.io Cc: Dong, Eric ; Kumar, Rahul R ; Gerd Hoffmann Subject: RE: [PATCH 5/6] UefiCpuPkg: Cache core type in MpInfo2 HOB

Re: [edk2-devel] [PATCH 3/6] UefiCpuPkg: Consume MpInfo2Hob in PiSmmCpuDxe

2023-12-06 Thread duntan
Will change the code based on comments 1-9. About comments 10, "10. The depex change means that CpuSmm driver could run before CpuMp driver runs. Have you verified if CpuSmm can start well even removing CpuMp DXE driver?" Yes, I verified it in OvmfIa32X64 boot. CpuSmm can start well even

  1   2   3   4   5   6   >