TianoCore Community Design Meeting Minutes - Mar 25, 2020 (extended)

Ni, Ray


1. RISC-V EDK2 Port with OpenSBI Architecture (Abner Chang/HPE)

Slides: https://edk2.groups.io/g/devel/files/Designs/2020/0325/RISC-V%20EDK2%20Port%20Design%20Architecture.pptx

Abner showed the overall picture of how to enable open SBI in edk2. Discussion was started from a DxeIpl dependency issue.

1. Goal and plans (page #2)

Development work is in phase 1 now. Two RISC-V platforms are to be enabled.

Daniel Schaefer (HPE German) is working on phase 2 (OS boot enabling).

Phase 3 will provide wrapper protocol over OpenSBI for PEI/DXE modules.

2. OpenSBI Introduction (page #3)

HART = hardware thread; ZSBL = Zero Stage Bootloader; FSBL = First Stage Bootloader; OpenSBI = RISC-V Open Source Supervisor Binary Interface.

Four privilege modes: Machine, Supervisor, Hypervisor (it was not listed in minutes, a mistake.), User. Hypervisor mode is for virtualization only and reserved now.

Generally, firmware runs in Machine mode and operation system runs in Supervisor mode. Linux can run in Machine mode.

Initial mode after power on is Machine mode.

OS calls OpenSBI through "ecall" CPU instruction, like "sysenter" in x86.

3. Principle of using OpenSBI in edk2 (page #4)

@Mike: Why "Build OpenSBI from edk2 build environment" is required? It can be built in its own environment.
@Abner: Try to make developers' life easy.
@Mike: OpenSBI change may cause build issue in EDKII. Separate eco, separate build environment.
@Abner: OpenSBI community is very supportive and we are working very closely.

4. Integration of OpenSBI library in edk2 (page #5)

@Mike: it's not a real library that can be linked to multiple modules. It's a firmware that provides services before edk2. It's complicated to figure out the relationship between OpenSBI and edk2.
@Leif: Agree. Natural of RISC-V is to cause less pain.

5. OpenSBI with uBoot (page #6)

‚Äč Today's RISC-V firmware jumps from OpenSBI from M mode to uBoot in S mode then to OS.

6. OpenSBI with edk2 (page #7)

@Ray: uBoot flow looks cleaner that doesn't require call internal APIs such as opensbi_init(). Why not switch to S mode in beginning of EDK2 flow?
@Mike: All architectures have the trend to enable paging in PEI to have more protections. You can start S mode in PEI and create static library to wrapper "ecall" to OpenSBI as uBoot.
@Abner: OpenSBI interface doesn't provide support to change MTRR which may be required in HW initialization.
@Ard: PEI in M mode and DXE in S mode may have different requirements to PE loader and dispatcher.
@Mike: Can follow ARM way that PE loader and dispatcher always run in S mode. individual module can go back to M mode.
@Abner: Agree to put PEI in S mode and have protocol to switch to M mode.

7. UefiCpuPkg content criteria

Abner wants to confirm that UefiCpuPkg will contain all CPU architectures content and ARM content will be moved to UefiCpuPkg. Mike will start email discussions on this topic in community.