[edk2-devel] [PATCH] MdePkg/BaseLib: Add SpeculationBarrier implementation for RiscV64

2023-05-26 Thread Li, Yong
From: Yong Li Impelement the SpeculationBarrier with implementations consisting of fence instruction which provides finer-grain memory orderings. Data Barrier: fence rw,rw Instruction Barrier: fence.i; fence r,r More detail is in Chapter 17, RVWMO Memory Consistency Model https://github.com/riscv

[edk2-devel] [PATCH 2/2] UefiCpuPkg: RISC-V: TimerLib: Fix delay function to use 64-bit

2023-05-26 Thread Tuan Phan
The timer compare register is 64-bit so simplifying the delay function. Signed-off-by: Tuan Phan --- MdePkg/Include/Register/RiscV64/RiscVImpl.h | 1 - .../BaseRiscV64CpuTimerLib/CpuTimerLib.c | 62 +-- 2 files changed, 28 insertions(+), 35 deletions(-) diff --git a/MdeP

[edk2-devel] [PATCH 1/2] UefiCpuPkg: CpuTimerDxeRiscV64: Fix incorrect value sent to SbiSetTimer

2023-05-26 Thread Tuan Phan
SbiSetTimer expects core tick value. Signed-off-by: Tuan Phan --- .../CpuTimerDxeRiscV64/CpuTimerDxeRiscV64.inf | 3 +++ UefiCpuPkg/CpuTimerDxeRiscV64/Timer.c | 26 --- UefiCpuPkg/CpuTimerDxeRiscV64/Timer.h | 2 +- 3 files changed, 26 insertions(+), 5 deletions(

[edk2-devel] [PATCH v3 7/7] OvmfPkg/RiscVVirt: SEC: Add IO memory resource hob for platform devices

2023-05-26 Thread Tuan Phan
Normally, DXE driver would add device resource to GCD before start using. But some key resources such as uart, flash base address are being accessing directly in some core modules. Those resources should be populated to HOB in SEC phase so they are added to GCD before anyone can access them. Sign

[edk2-devel] [Patch 1/1] OvmfPkg/VirtIoSerialDxe: Update for VS2015x86 compatibility

2023-05-26 Thread Michael D Kinney
Move initialization of local variable structure from declaration to statements to fix VS2015x86 build break. Cc: Ard Biesheuvel Cc: Jiewen Yao Cc: Jordan Justen Cc: Gerd Hoffmann Signed-off-by: Michael D Kinney --- OvmfPkg/VirtioSerialDxe/VirtioSerial.c | 10 +- 1 file changed, 5 ins

[edk2-devel] [PATCH v3 6/7] OvmfPkg/VirtNorFlashDxe: Not add memory space if it exists

2023-05-26 Thread Tuan Phan
The flash base address can be added to GCD before this driver run. So only add it if it has not been done. Signed-off-by: Tuan Phan Reviewed-by: Andrei Warkentin --- OvmfPkg/VirtNorFlashDxe/VirtNorFlashDxe.c | 25 +++ 1 file changed, 16 insertions(+), 9 deletions(-) diff --

[edk2-devel] [PATCH v3 5/7] OvmfPkg/RiscVVirt: VirtNorFlashPlatformLib: Fix wrong flash size

2023-05-26 Thread Tuan Phan
The size should be for single region, not the whole firmware FD. Signed-off-by: Tuan Phan Reviewed-by: Andrei Warkentin --- .../Library/VirtNorFlashPlatformLib/VirtNorFlashStaticLib.c| 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/OvmfPkg/RiscVVirt/Library/VirtNorFlas

[edk2-devel] [PATCH v3 3/7] UefiCpuPkg: RISC-V: Support MMU with SV39/48/57 mode

2023-05-26 Thread Tuan Phan
During CpuDxe initialization, MMU will be setup with the highest mode that HW supports. Signed-off-by: Tuan Phan Reviewed-by: Andrei Warkentin --- UefiCpuPkg/CpuDxeRiscV64/CpuDxe.c | 9 +- UefiCpuPkg/CpuDxeRiscV64/CpuDxe.h | 2 + UefiCpuPkg/CpuDxeRiscV64/CpuDxeRiscV6

[edk2-devel] [PATCH v3 4/7] OvmfPkg/RiscVVirt: Remove satp bare mode setting

2023-05-26 Thread Tuan Phan
MMU now is initialized in CpuDxe. There is no point to set satp to bare mode as that should be the default mode when booting edk2. Signed-off-by: Tuan Phan Reviewed-by: Andrei Warkentin --- OvmfPkg/RiscVVirt/RiscVVirt.dsc.inc | 1 + OvmfPkg/RiscVVirt/Sec/Memory.c | 18 ++

[edk2-devel] [PATCH v3 2/7] MdePkg/Register: RISC-V: Add satp mode bits shift definition

2023-05-26 Thread Tuan Phan
The satp mode bits shift is used cross modules. It should be defined in one place. Signed-off-by: Tuan Phan Reviewed-by: Andrei Warkentin --- MdePkg/Include/Register/RiscV64/RiscVEncoding.h | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/MdePkg/Include/Register/RiscV6

[edk2-devel] [PATCH v3 1/7] MdePkg/BaseLib: RISC-V: Support getting satp register value

2023-05-26 Thread Tuan Phan
Add an API to retrieve satp register value. Signed-off-by: Tuan Phan Reviewed-by: Andrei Warkentin --- MdePkg/Include/Library/BaseLib.h | 5 + MdePkg/Library/BaseLib/RiscV64/RiscVMmu.S | 8 2 files changed, 13 insertions(+) diff --git a/MdePkg/Include/Library/BaseLib.h b/

[edk2-devel] [PATCH v3 0/7] RISC-V: MMU support

2023-05-26 Thread Tuan Phan
RISC-V: Add MMU support This series adds MMU support for RISC-V. Only SV39/48/57 modes are supported and tested. The MMU is required to support setting page attribute which is the first basic step to support security booting on RISC-V. There are three parts: 1. Add MMU base library. MMU will be e

Re: [edk2-devel] [PATCH v1] BaseTools: toolsetup.bat always execute PYTHON_HOME

2023-05-26 Thread Rebecca Cran
That looks good. Thanks! -- Rebecca Cran On 5/26/23 10:56 AM, Guo, Gua wrote: @Rebecca Cran I update v2 patch on the PR https://github.com/tianocore/edk2/pull/4431 Could you help to check about whether meet your expectation ? Thanks, Gua -Original Message- From: Rebecca Cran Sen

Re: [edk2-devel] [PATCH v1] BaseTools: toolsetup.bat always execute PYTHON_HOME

2023-05-26 Thread Guo, Gua
@Rebecca Cran I update v2 patch on the PR https://github.com/tianocore/edk2/pull/4431 Could you help to check about whether meet your expectation ? Thanks, Gua -Original Message- From: Rebecca Cran Sent: Saturday, May 27, 2023 12:30 AM To: Guo, Gua ; devel@edk2.groups.io Cc: Gao, Limi

Re: [edk2-devel] [PATCH v1] BaseTools: toolsetup.bat always execute PYTHON_HOME

2023-05-26 Thread Rebecca Cran
On 5/25/23 6:09 PM, gua@intel.com wrote: -%PYTHON_COMMAND% %BASE_TOOLS_PATH%\Tests\PythonTest.py %PYTHON_VER_MAJOR% %PYTHON_VER_MINOR% >NUL 2>NUL -if %ERRORLEVEL% EQU 1 ( - echo. - echo !!! ERROR !!! Python %PYTHON_VER_MAJOR%.%PYTHON_VER_MINOR% or newer is required. - echo. - goto en

[edk2-devel] [PATCH 3/3] MdeModulePkg/SmmCore: Add perf-logging for time-consuming procedures

2023-05-26 Thread Ni, Ray
Following procedures are perf-logged: * SmmReadyToBootHandler * SmmReadyToLockHandler * SmmEndOfDxeHandler * SmmEntryPoint (It's the main routine run in BSP when SMI happens.) * SmiManage Cc: Jian J Wang Cc: Liming Gao Cc: Jiaxin Wu --- MdeModulePkg/Core/PiSmmCore/PiSmmCore.c | 14 ++

[edk2-devel] [PATCH 1/3] UefiCpuPkg/CpuSmm: Add perf-logging for time-consuming BSP procedures

2023-05-26 Thread Ni, Ray
The patch adds perf-logging for the following potential time-consuming BSP procedures: * PiCpuSmmEntry - SmmRelocateBases * ExecuteFirstSmiInit * BSPHandler - SmmWaitForApArrival - PerformRemainingTasks * InitPaging * SetMemMapAttributes * SetUefiMemMapAttributes * SetPag

[edk2-devel] [PATCH 0/3] Enable perf-logging in SMM environment

2023-05-26 Thread Ni, Ray
Ray Ni (3): UefiCpuPkg/CpuSmm: Add perf-logging for time-consuming BSP procedures UefiCpuPkg/CpuSmm: Add perf-logging for MP procedures MdeModulePkg/SmmCore: Add perf-logging for time-consuming procedures MdeModulePkg/Core/PiSmmCore/PiSmmCore.c | 14 ++- MdeModulePkg/Core/PiSmmCore/

[edk2-devel] [PATCH 2/3] UefiCpuPkg/CpuSmm: Add perf-logging for MP procedures

2023-05-26 Thread Ni, Ray
MP procedures are those procedures that run in every CPU thread. The EDKII perf infra is not MP safe so it doesn't support to be called from those MP procedures. The patch adds SMM MP perf-logging support in SmmMpPerf.c. The following procedures are perf-logged: * SmmInitHandler * SmmCpuFeaturesRe