SlideShare une entreprise Scribd logo
1  sur  26
© 2019 Western Digital Corporation or its affiliates. All rights reserved. 1/6/2020
RISC-V Boot Process: One step
at a time
Atish Patra <Atish.Patra@wdc.com>
1/6/2020© 2019 Western Digital Corporation or its affiliates. All rights reserved. 2
Outline
• Introduction to RISC-V
• Common embedded boot flow
• Current RISC-V boot flow
• OpenSBI Project
• Upstream Status
• Future work
• Demo
1/6/2020© 2019 Western Digital Corporation or its affiliates. All rights reserved. 3
Acknowledgements
• U-Boot
– Lukas Auler
– Bin Meng
– Anup Patel
• Coreboot
– Ron Minnich
– Jonathan Neuschäfer
– Patrick Rudolph
– Philip Hug
• EDK2
– Abner Chang
• And others
1/6/2020© 2019 Western Digital Corporation or its affiliates. All rights reserved. 4
What is RISC-V ?
Free and Open Instruction Set Architecture (ISA)
1/6/2020© 2019 Western Digital Corporation or its affiliates. All rights reserved. 5
What is RISC-V?
• Pronounced as risk-five
• An open RISC Instruction Set Architecture (ISA)
• The base ISA is incredibly small
– The ISA can be extended
• Integer (I) and Embedded (E) are part of the base ISA
• Multiply/Divide (M), Atomic (A), Single Floating Point (F), Double Floating Point (D), Quad Floating Point (Q) and
Compressed Instructions (C) are frozen already
• Virtualization (H), Vector (V), Bit Manipulation (B) are examples of draft extensions
• The General Extension (G) is shorthand for M, A, F and D
– Aimed at everything from small embedded systems to high end HPC
• Multiple CPU implementations already available
• SiFive, BOOM, Rocket64, Andes, Western Digital, QEMU, etc
• Currently heavily backed by SiFive, Microsemi, NVIDIA, Western Digital and others
Free and Open Instruction Set Architecture (ISA)
1/6/2020© 2019 Western Digital Corporation or its affiliates. All rights reserved. 6
Why RISC-V?
• An open source ISA allows anyone to use and modify the ISA without any licensing cost
– This is different to commercial companies which ship black boxes with strict NDAs
• Customization for specific applications
• Security audits to verify security in critical applications
• No license fees to use the ISA
• Community driven development approach allows input from anybody
Free and Open Instruction Set Architecture (ISA)
1/6/2020© 2019 Western Digital Corporation or its affiliates. All rights reserved. 7
Common boot flow
Commonly used multiple boot stages model
ROM LOADER RUNTIME BOOTLOADER OS
Loads
Jumps
• Runs from On-Chip
ROM
• Uses On-Chip SRAM
• SOC power-up and
clock setup
• DDR initialization
• Loads RUNTIME and
BOOTLOADER
• Examples:
• BIOS/UEFI
• U-Boot SPL
• Coreboot
• Runs from On-Chip SRAM or
DDR
• SOC security setup
• Runtime services as-per
specifications
• Examples:
• ATF
• BIOS/UEFI
• Runs from DDR
• Typically open-source
• Filesystem support
• Network booting
• Boot configuration
• Examples:
• U-Boot
• GRUB
• LinuxBoot
Proprietary
Open Source
1/6/2020© 2019 Western Digital Corporation or its affiliates. All rights reserved. 8
RISC-V Upstream Boot Flow
Follows commonly used multiple boot stages model
• For HiFive Unleashed hardware (only Linux capable RISC-V platform available)
• Follows a standard boot flow
• Uses U-Boot as the last stage boot loader
• U-Boot binary as the payload to OpenSBI
• FSBL is SiFive specific and will be replaced by Coreboot/U-Boot SPL
• OpenSBI is a RISC-V specific runtime service provider
Linux
(S-mode)
(OS)
ZSBL
(M-mode)
(ROM)
FSBL
(M-mode)
(LOADER)
OpenSBI
(M-mode)
(RUNTIME)
U-Boot
(S-mode)
(BOOTLOADER)
Loads
Jumps
Proprietary
Open
Source
RISC-V
specific
1/6/2020© 2019 Western Digital Corporation or its affiliates. All rights reserved. 9
RISC-V boot flow development timeline
OpenSBI
v0.1
release
U-Boot
SMP
support
U-Boot
MMC
support
U-Boot SPL
Coreboot
Legacy
Feb 18
Jan 19
Mar 19
July 19
Jul 19
Aug 19
EDK2
Oct 19
U-Boot
support for
Unleashed
Feb 19Grub
support
Nov 18
1/6/2020© 2019 Western Digital Corporation or its affiliates. All rights reserved. 10
What is SBI ?
• SBI is the RISC-V Supervisor Binary Interface
– System call style calling convention between Supervisor (S-mode OS) and Supervisor
Execution Environment (SEE)
• SEE can be:
– A M-mode RUNTIME firmware for OS/Hypervisor running in HS-mode
– A HS-mode Hypervisor for Guest OS running in VS-mode
• SBI calls help:
– Reduce duplicate platform code across OSes (Linux, FreeBSD, etc)
– Provide common drivers for an OS which can be shared by multiple platforms
– Provide an interface for direct access to hardware resources (M-mode only resources)
• Specifications being drafted by the Unix Platform Specification Working group
– Currently, SBI v0.1 in-use and SBI v0.2 in draft stage
– https://github.com/riscv/riscv-sbi-doc
SEE (M-Mode)
SBI
OS (S-Mode)
ABI ABI
App1 App2
1/6/2020© 2019 Western Digital Corporation or its affiliates. All rights reserved. 11
What is OpenSBI ?
• OpenSBI is an open-source implementation of the RISC-V Supervisor Binary Interface
(SBI) specifications
– Licensed under the terms of the BSD-2 clause license
– Helps to avoid SBI implementation fragmentation
– Maintained by the community
• Aimed at providing RUNTIME services in M-mode
– Typically used in boot stage following ROM/LOADER
• Provides support for reference platforms
– Generic simple drivers included for M-mode to operate
 PLIC, CLINT, UART 8250
– Other platforms can reuse the common code and add needed drivers
• Source
– https://github.com/riscv/opensbi
1/6/2020© 2019 Western Digital Corporation or its affiliates. All rights reserved. 12
Key Features
• Layered structure to accommodate various use cases
– Generic SBI library with platform abstraction
• Typically used with external firmware and bootloader
– EDK2 (UEFI implementation), Secure boot working group
– Platform specific library
• Similar to core library but including platform specific drivers
– Platform specific reference firmware
• Three different types of RUNTIME firmware
• Wide range of hardware features supported
– RV32 and RV64
– Hypervisor support
– Misaligned load/store handling
– Missing CSR emulation
– Protects firmware using PMP support
Platform Specific
Reference Firmware
Platform Specific
Library
SBI Library
OpenSBI Layers
1/6/2020© 2019 Western Digital Corporation or its affiliates. All rights reserved. 13
Reference Firmwares
• OpenSBI provides several types of reference firmware, all platform-specific
– FW_PAYLOAD
• Firmware with the next booting stage as a payload
• Default firmware being used in Linux capable RISC-V hardware
– FW_JUMP
• Firmware with fixed jump address to the next booting stage
• Default method for QEMU
– FW_DYNAMIC
• Firmware with dynamic information on the next booting stage
• U-Boot SPL/Coreboot is using FW_DYNAMIC
• SOC Vendors may choose:
– Use one of OpenSBI reference firmwares as their M-mode RUNTIME firmware
– Build M-mode RUNTIME firmware from scratch with OpenSBI as library
– Extend existing M-mode firmwares (U-Boot_M_mode/EDK2) with OpenSBI as library
1/6/2020© 2019 Western Digital Corporation or its affiliates. All rights reserved. 14
Platform support
• SiFive HiFive Unleashed
• Andes AE350
• Ariane FPGA SOC
• Kendryte K210
• QEMU virt machines (32-bit/64-bit)
1/6/2020© 2019 Western Digital Corporation or its affiliates. All rights reserved. 15
Boot flow using OpenSBI dynamic firmware
• OpenSBI firmware with dynamic information about the next booting
stage
• Coreboot support available on both hardware & QEMU
• U-Boot SPL available for QEMU and Andes AE350
• HiFive Unleashed U-Boot SPL support not available yet
Passed via ‘a2’ register
Linux
(S-mode)
(OS)
ZSBL
(M-mode)
(ROM)
U-Boot SPL/
Coreboot
(M-mode)
OpenSBI
(M-mode)
(RUNTIME)
U-Boot
(S-mode)
(BOOTLOADER)
Loads
Jumps
Proprietary
Open
Source
RISC-V
specific
struct
fw_dynamic_info
1/6/2020© 2019 Western Digital Corporation or its affiliates. All rights reserved. 16
Boot flow using OpenSBI as a library
• OpenSBI as a part of external firmware source
code
• Must configure program stack and scratch
space for OpenSBI
• Same GCC target option for external firmware
and OpenSBI
• Currently EDK2 integration with OpenSBI
– HPE leading this effort
– Available in EDK2 mailing list for U540 on Xilinx VC707
FPGA
– OpenSBI built with EDK2 build environment
– OpenSBI used as library in Pre-EFI Initialization (PEI)
phase
1/6/2020© 2019 Western Digital Corporation or its affiliates. All rights reserved. 17
Upstream status
• OpenSBI
– Actively developed and maintained
– Version 0.5 released
– Default in Buildroot, Yocto/OpenEmbedded and
the QEMU “BIOS”
– Fedora/Debian provides images available with
OpenSBI binary
• U-Boot
– U-Boot-2019.10 release has full support HiFive
Unleashed S-mode
– Boot via network/MMC supported
– FIT image support
– EFI support for RISC-V available
• Grub
– RISC-V support available upstream
• Linux Kernel
– Upstream kernel boots in QEMU
– Device tree hosted in Kernel
– v5.3 kernel works with OpenSBI+U-Boot
on HiFive Unleashed
Rapid progress: traditional full boot support expected by year end
1/6/2020© 2019 Western Digital Corporation or its affiliates. All rights reserved. 18
Future boot support
• EFI stub support in Linux kernel for full UEFI support in progress
– Enterprise class boot environment
• U-Boot SPL support for HiFive Unleashed
• SMP support in coreboot
• EDK2 project upstreaming (in progress)
• Oreboot (Coreboot written in Rust)
• LinuxBoot ?
• Other bootloaders ?
Toward a stable and easy to use boot ecosystem
1/6/2020© 2019 Western Digital Corporation or its affiliates. All rights reserved. 19
Ongoing work
• SBI specifications
– SBI v0.2 specification
– Hart state management extension in SBI
– Legacy SBI extension replacement in SBI
• OpenSBI
– Sequential cpu boot via CPU hotplug
– Support other M-mode boot loader such as
Coreboot/U-Boot SPL
– Hypervisor support when specification changes
– More platforms support
• Need hardware !
• Linux kernel
– SBI v0.2 implementation (patches are under
review)
– EFI stub in Linux kernel (work in progress)
– SBI legacy extension replacements
– Sequential booting
– CPU hotplug
Toward a stable and easy to use boot ecosystem
1/6/2020© 2019 Western Digital Corporation or its affiliates. All rights reserved. 20
Demo 1: U-Boot MMC boot
1/6/2020© 2019 Western Digital Corporation or its affiliates. All rights reserved. 21
Thank you!!
• Q&A ?
© 2019 Western Digital Corporation or its affiliates. All rights reserved. 1/6/2020
1/6/2020© 2019 Western Digital Corporation or its affiliates. All rights reserved. 23
Backup
1/6/2020© 2019 Western Digital Corporation or its affiliates. All rights reserved. 24
Constraints on using OpenSBI Library
• Same GCC target options (i.e. -march, -mabi, and -mcmodel) need to be used for the
external firmware and OpenSBI sources
• External firmware must create per-HART non-overlapping:
1.Program Stack
2.OpenSBI scratch space (i.e. struct sbi_scratch instance with extra space above)
• Two constraints in calling any OpenSBI functions from external firmware:
1.MSCRATCH CSR of calling HART must be set to its own OpenSBI scratch space
2.SP register (i.e. the stack pointer) of calling HART must be set to its own stack
• External firmware must also ensure that:
– Interrupts are disabled in the MSTATUS and MIE CSRs when calling sbi_init()
– sbi_init() is called for each HART that is powered-up at boot-time or in response to a CPU hotplug event
– sbi_trap_handler() is called for M-mode interrupts and M-mode traps
1/6/2020© 2019 Western Digital Corporation or its affiliates. All rights reserved. 25
EDK2 implementation details
• OpenSBI used as library
• Open Source EDK2 (UEFI implementation) OpenSBI integration
– HPE leading this effort
– Available in EDK2 staging area for U540 on Xilinx VC707 FPGA
– OpenSBI built with EDK2 build environment
Passed via ‘a2’ register
ZSBL
(M-mode)
(ROM)
Bootloader
(Grub/U-
Boot)
Loads
Jumps
Open
Source
RISC-V
specific
EDK2
FSBL
(M-mode)
(ROM)
Linux
(S-Mode)
OS
SEC
phase
PEI phase
(M-Mode)
DXE phase
(S-Mode)
BDS phase
(S-Mode)
EDK2 OpenSBI DXE Driver
(S-Mode)
OpenSBI library
(M-Mode)
1/6/2020© 2019 Western Digital Corporation or its affiliates. All rights reserved. 26
Reference
• OpenSBI
– https://github.com/riscv/opensbi
• SBI
– https://github.com/riscv/riscv-sbi-doc
• EDK2
– https://edk2.groups.io/g/devel/message/46479?p=,,,20,0,0,0::Created,,riscv,20,2,0,33047245

Contenu connexe

Tendances

Chips alliance omni xtend overview
Chips alliance omni xtend overviewChips alliance omni xtend overview
Chips alliance omni xtend overviewRISC-V International
 
Secure Boot on ARM systems – Building a complete Chain of Trust upon existing...
Secure Boot on ARM systems – Building a complete Chain of Trust upon existing...Secure Boot on ARM systems – Building a complete Chain of Trust upon existing...
Secure Boot on ARM systems – Building a complete Chain of Trust upon existing...Linaro
 
An Introduction to RISC-V bootflow
An Introduction to RISC-V bootflowAn Introduction to RISC-V bootflow
An Introduction to RISC-V bootflowAtish Patra
 
Jagan Teki - U-boot from scratch
Jagan Teki - U-boot from scratchJagan Teki - U-boot from scratch
Jagan Teki - U-boot from scratchlinuxlab_conf
 
RISC-V software state of the union
RISC-V software state of the unionRISC-V software state of the union
RISC-V software state of the unionRISC-V International
 
SFO15-TR9: PSCI, ACPI (and UEFI to boot)
SFO15-TR9: PSCI, ACPI (and UEFI to boot)SFO15-TR9: PSCI, ACPI (and UEFI to boot)
SFO15-TR9: PSCI, ACPI (and UEFI to boot)Linaro
 
LCU13: An Introduction to ARM Trusted Firmware
LCU13: An Introduction to ARM Trusted FirmwareLCU13: An Introduction to ARM Trusted Firmware
LCU13: An Introduction to ARM Trusted FirmwareLinaro
 
Linux Internals - Kernel/Core
Linux Internals - Kernel/CoreLinux Internals - Kernel/Core
Linux Internals - Kernel/CoreShay Cohen
 
Embedded_Linux_Booting
Embedded_Linux_BootingEmbedded_Linux_Booting
Embedded_Linux_BootingRashila Rr
 
U boot porting guide for SoC
U boot porting guide for SoCU boot porting guide for SoC
U boot porting guide for SoCMacpaul Lin
 
GPU Virtualization in SUSE
GPU Virtualization in SUSEGPU Virtualization in SUSE
GPU Virtualization in SUSELiang Yan
 
Linux Initialization Process (2)
Linux Initialization Process (2)Linux Initialization Process (2)
Linux Initialization Process (2)shimosawa
 
Trusted firmware deep_dive_v1.0_
Trusted firmware deep_dive_v1.0_Trusted firmware deep_dive_v1.0_
Trusted firmware deep_dive_v1.0_Linaro
 
I2C Subsystem In Linux-2.6.24
I2C Subsystem In Linux-2.6.24I2C Subsystem In Linux-2.6.24
I2C Subsystem In Linux-2.6.24Varun Mahajan
 

Tendances (20)

Chips alliance omni xtend overview
Chips alliance omni xtend overviewChips alliance omni xtend overview
Chips alliance omni xtend overview
 
Secure Boot on ARM systems – Building a complete Chain of Trust upon existing...
Secure Boot on ARM systems – Building a complete Chain of Trust upon existing...Secure Boot on ARM systems – Building a complete Chain of Trust upon existing...
Secure Boot on ARM systems – Building a complete Chain of Trust upon existing...
 
Interrupts
InterruptsInterrupts
Interrupts
 
Introduction to Modern U-Boot
Introduction to Modern U-BootIntroduction to Modern U-Boot
Introduction to Modern U-Boot
 
An Introduction to RISC-V bootflow
An Introduction to RISC-V bootflowAn Introduction to RISC-V bootflow
An Introduction to RISC-V bootflow
 
U boot-boot-flow
U boot-boot-flowU boot-boot-flow
U boot-boot-flow
 
Jagan Teki - U-boot from scratch
Jagan Teki - U-boot from scratchJagan Teki - U-boot from scratch
Jagan Teki - U-boot from scratch
 
RISC-V software state of the union
RISC-V software state of the unionRISC-V software state of the union
RISC-V software state of the union
 
SFO15-TR9: PSCI, ACPI (and UEFI to boot)
SFO15-TR9: PSCI, ACPI (and UEFI to boot)SFO15-TR9: PSCI, ACPI (and UEFI to boot)
SFO15-TR9: PSCI, ACPI (and UEFI to boot)
 
LCU13: An Introduction to ARM Trusted Firmware
LCU13: An Introduction to ARM Trusted FirmwareLCU13: An Introduction to ARM Trusted Firmware
LCU13: An Introduction to ARM Trusted Firmware
 
Linux Internals - Kernel/Core
Linux Internals - Kernel/CoreLinux Internals - Kernel/Core
Linux Internals - Kernel/Core
 
Embedded_Linux_Booting
Embedded_Linux_BootingEmbedded_Linux_Booting
Embedded_Linux_Booting
 
U boot porting guide for SoC
U boot porting guide for SoCU boot porting guide for SoC
U boot porting guide for SoC
 
Embedded Linux Kernel - Build your custom kernel
Embedded Linux Kernel - Build your custom kernelEmbedded Linux Kernel - Build your custom kernel
Embedded Linux Kernel - Build your custom kernel
 
GPU Virtualization in SUSE
GPU Virtualization in SUSEGPU Virtualization in SUSE
GPU Virtualization in SUSE
 
Linux Initialization Process (2)
Linux Initialization Process (2)Linux Initialization Process (2)
Linux Initialization Process (2)
 
Trusted firmware deep_dive_v1.0_
Trusted firmware deep_dive_v1.0_Trusted firmware deep_dive_v1.0_
Trusted firmware deep_dive_v1.0_
 
I2C Subsystem In Linux-2.6.24
I2C Subsystem In Linux-2.6.24I2C Subsystem In Linux-2.6.24
I2C Subsystem In Linux-2.6.24
 
SR-IOV Introduce
SR-IOV IntroduceSR-IOV Introduce
SR-IOV Introduce
 
Basic Linux Internals
Basic Linux InternalsBasic Linux Internals
Basic Linux Internals
 

Similaire à RISC-V Boot Process: One Step at a Time

The role of_open_source_firmware_in_risc-v
The role of_open_source_firmware_in_risc-vThe role of_open_source_firmware_in_risc-v
The role of_open_source_firmware_in_risc-vAtish Patra
 
"Building Complete Embedded Vision Systems on Linux—From Camera to Display," ...
"Building Complete Embedded Vision Systems on Linux—From Camera to Display," ..."Building Complete Embedded Vision Systems on Linux—From Camera to Display," ...
"Building Complete Embedded Vision Systems on Linux—From Camera to Display," ...Edge AI and Vision Alliance
 
Embedded Fest 2019. Wei Fu. Linux on RISC-V--Fedora and Firmware in practice
Embedded Fest 2019. Wei Fu. Linux on RISC-V--Fedora and Firmware in practiceEmbedded Fest 2019. Wei Fu. Linux on RISC-V--Fedora and Firmware in practice
Embedded Fest 2019. Wei Fu. Linux on RISC-V--Fedora and Firmware in practiceEmbeddedFest
 
Open source Android 10 on Orange Pi: Meth or Reality?
Open source Android 10 on Orange Pi: Meth or Reality?Open source Android 10 on Orange Pi: Meth or Reality?
Open source Android 10 on Orange Pi: Meth or Reality?GlobalLogic Ukraine
 
BRKSPG-2069-64bit-package.pdf
BRKSPG-2069-64bit-package.pdfBRKSPG-2069-64bit-package.pdf
BRKSPG-2069-64bit-package.pdfHeng30
 
Strata - Scaling Jupyter with Jupyter Enterprise Gateway
Strata - Scaling Jupyter with Jupyter Enterprise GatewayStrata - Scaling Jupyter with Jupyter Enterprise Gateway
Strata - Scaling Jupyter with Jupyter Enterprise GatewayLuciano Resende
 
Applying Hyper-scale Design Patterns to Routing
Applying Hyper-scale Design Patterns to RoutingApplying Hyper-scale Design Patterns to Routing
Applying Hyper-scale Design Patterns to RoutingHannes Gredler
 
Embedded Linux BSP Training (Intro)
Embedded Linux BSP Training (Intro)Embedded Linux BSP Training (Intro)
Embedded Linux BSP Training (Intro)RuggedBoardGroup
 
XPDS14: Xen 4.5 Roadmap - Konrad Wilk, Oracle
XPDS14: Xen 4.5 Roadmap - Konrad Wilk, OracleXPDS14: Xen 4.5 Roadmap - Konrad Wilk, Oracle
XPDS14: Xen 4.5 Roadmap - Konrad Wilk, OracleThe Linux Foundation
 
Srikanth_PILLI_CV_latest
Srikanth_PILLI_CV_latestSrikanth_PILLI_CV_latest
Srikanth_PILLI_CV_latestSrikanth Pilli
 
Building PoC ready ODM Platforms with Arm SystemReady v5.2.pdf
Building PoC ready ODM Platforms with Arm SystemReady v5.2.pdfBuilding PoC ready ODM Platforms with Arm SystemReady v5.2.pdf
Building PoC ready ODM Platforms with Arm SystemReady v5.2.pdfPaul Yang
 
Linux on RISC-V with Open Source Hardware (Open Source Summit Japan 2020)
Linux on RISC-V with Open Source Hardware (Open Source Summit Japan 2020)Linux on RISC-V with Open Source Hardware (Open Source Summit Japan 2020)
Linux on RISC-V with Open Source Hardware (Open Source Summit Japan 2020)Drew Fustini
 
How to run Linux on RISC-V (FOSS North 2020)
How to run Linux on RISC-V (FOSS North 2020)How to run Linux on RISC-V (FOSS North 2020)
How to run Linux on RISC-V (FOSS North 2020)Drew Fustini
 
XPDS14 - Xen in EFI World - Daniel Kiper, Oracle
XPDS14 - Xen in EFI World - Daniel Kiper, OracleXPDS14 - Xen in EFI World - Daniel Kiper, Oracle
XPDS14 - Xen in EFI World - Daniel Kiper, OracleThe Linux Foundation
 
FOSDEM_2019_Buildroot_RISCV.pdf
FOSDEM_2019_Buildroot_RISCV.pdfFOSDEM_2019_Buildroot_RISCV.pdf
FOSDEM_2019_Buildroot_RISCV.pdfssuser30e7d2
 
Cisco usNIC libfabric provider
Cisco usNIC libfabric providerCisco usNIC libfabric provider
Cisco usNIC libfabric providerJeff Squyres
 

Similaire à RISC-V Boot Process: One Step at a Time (20)

The role of_open_source_firmware_in_risc-v
The role of_open_source_firmware_in_risc-vThe role of_open_source_firmware_in_risc-v
The role of_open_source_firmware_in_risc-v
 
"Building Complete Embedded Vision Systems on Linux—From Camera to Display," ...
"Building Complete Embedded Vision Systems on Linux—From Camera to Display," ..."Building Complete Embedded Vision Systems on Linux—From Camera to Display," ...
"Building Complete Embedded Vision Systems on Linux—From Camera to Display," ...
 
UEFI presentation
UEFI presentationUEFI presentation
UEFI presentation
 
TFI2014 Session II - Requirements for SDN - Brian Field
TFI2014 Session II - Requirements for SDN - Brian FieldTFI2014 Session II - Requirements for SDN - Brian Field
TFI2014 Session II - Requirements for SDN - Brian Field
 
Embedded Fest 2019. Wei Fu. Linux on RISC-V--Fedora and Firmware in practice
Embedded Fest 2019. Wei Fu. Linux on RISC-V--Fedora and Firmware in practiceEmbedded Fest 2019. Wei Fu. Linux on RISC-V--Fedora and Firmware in practice
Embedded Fest 2019. Wei Fu. Linux on RISC-V--Fedora and Firmware in practice
 
Open source Android 10 on Orange Pi: Meth or Reality?
Open source Android 10 on Orange Pi: Meth or Reality?Open source Android 10 on Orange Pi: Meth or Reality?
Open source Android 10 on Orange Pi: Meth or Reality?
 
BRKSPG-2069-64bit-package.pdf
BRKSPG-2069-64bit-package.pdfBRKSPG-2069-64bit-package.pdf
BRKSPG-2069-64bit-package.pdf
 
Strata - Scaling Jupyter with Jupyter Enterprise Gateway
Strata - Scaling Jupyter with Jupyter Enterprise GatewayStrata - Scaling Jupyter with Jupyter Enterprise Gateway
Strata - Scaling Jupyter with Jupyter Enterprise Gateway
 
Applying Hyper-scale Design Patterns to Routing
Applying Hyper-scale Design Patterns to RoutingApplying Hyper-scale Design Patterns to Routing
Applying Hyper-scale Design Patterns to Routing
 
Embedded Linux BSP Training (Intro)
Embedded Linux BSP Training (Intro)Embedded Linux BSP Training (Intro)
Embedded Linux BSP Training (Intro)
 
XPDS14: Xen 4.5 Roadmap - Konrad Wilk, Oracle
XPDS14: Xen 4.5 Roadmap - Konrad Wilk, OracleXPDS14: Xen 4.5 Roadmap - Konrad Wilk, Oracle
XPDS14: Xen 4.5 Roadmap - Konrad Wilk, Oracle
 
Srikanth_PILLI_CV_latest
Srikanth_PILLI_CV_latestSrikanth_PILLI_CV_latest
Srikanth_PILLI_CV_latest
 
Building PoC ready ODM Platforms with Arm SystemReady v5.2.pdf
Building PoC ready ODM Platforms with Arm SystemReady v5.2.pdfBuilding PoC ready ODM Platforms with Arm SystemReady v5.2.pdf
Building PoC ready ODM Platforms with Arm SystemReady v5.2.pdf
 
Linux on RISC-V with Open Source Hardware (Open Source Summit Japan 2020)
Linux on RISC-V with Open Source Hardware (Open Source Summit Japan 2020)Linux on RISC-V with Open Source Hardware (Open Source Summit Japan 2020)
Linux on RISC-V with Open Source Hardware (Open Source Summit Japan 2020)
 
How to run Linux on RISC-V (FOSS North 2020)
How to run Linux on RISC-V (FOSS North 2020)How to run Linux on RISC-V (FOSS North 2020)
How to run Linux on RISC-V (FOSS North 2020)
 
XPDS14 - Xen in EFI World - Daniel Kiper, Oracle
XPDS14 - Xen in EFI World - Daniel Kiper, OracleXPDS14 - Xen in EFI World - Daniel Kiper, Oracle
XPDS14 - Xen in EFI World - Daniel Kiper, Oracle
 
FOSDEM_2019_Buildroot_RISCV.pdf
FOSDEM_2019_Buildroot_RISCV.pdfFOSDEM_2019_Buildroot_RISCV.pdf
FOSDEM_2019_Buildroot_RISCV.pdf
 
Slimline Open Firmware
Slimline Open FirmwareSlimline Open Firmware
Slimline Open Firmware
 
Linux 101
Linux 101Linux 101
Linux 101
 
Cisco usNIC libfabric provider
Cisco usNIC libfabric providerCisco usNIC libfabric provider
Cisco usNIC libfabric provider
 

Dernier

TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 

Dernier (20)

TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 

RISC-V Boot Process: One Step at a Time

  • 1. © 2019 Western Digital Corporation or its affiliates. All rights reserved. 1/6/2020 RISC-V Boot Process: One step at a time Atish Patra <Atish.Patra@wdc.com>
  • 2. 1/6/2020© 2019 Western Digital Corporation or its affiliates. All rights reserved. 2 Outline • Introduction to RISC-V • Common embedded boot flow • Current RISC-V boot flow • OpenSBI Project • Upstream Status • Future work • Demo
  • 3. 1/6/2020© 2019 Western Digital Corporation or its affiliates. All rights reserved. 3 Acknowledgements • U-Boot – Lukas Auler – Bin Meng – Anup Patel • Coreboot – Ron Minnich – Jonathan Neuschäfer – Patrick Rudolph – Philip Hug • EDK2 – Abner Chang • And others
  • 4. 1/6/2020© 2019 Western Digital Corporation or its affiliates. All rights reserved. 4 What is RISC-V ? Free and Open Instruction Set Architecture (ISA)
  • 5. 1/6/2020© 2019 Western Digital Corporation or its affiliates. All rights reserved. 5 What is RISC-V? • Pronounced as risk-five • An open RISC Instruction Set Architecture (ISA) • The base ISA is incredibly small – The ISA can be extended • Integer (I) and Embedded (E) are part of the base ISA • Multiply/Divide (M), Atomic (A), Single Floating Point (F), Double Floating Point (D), Quad Floating Point (Q) and Compressed Instructions (C) are frozen already • Virtualization (H), Vector (V), Bit Manipulation (B) are examples of draft extensions • The General Extension (G) is shorthand for M, A, F and D – Aimed at everything from small embedded systems to high end HPC • Multiple CPU implementations already available • SiFive, BOOM, Rocket64, Andes, Western Digital, QEMU, etc • Currently heavily backed by SiFive, Microsemi, NVIDIA, Western Digital and others Free and Open Instruction Set Architecture (ISA)
  • 6. 1/6/2020© 2019 Western Digital Corporation or its affiliates. All rights reserved. 6 Why RISC-V? • An open source ISA allows anyone to use and modify the ISA without any licensing cost – This is different to commercial companies which ship black boxes with strict NDAs • Customization for specific applications • Security audits to verify security in critical applications • No license fees to use the ISA • Community driven development approach allows input from anybody Free and Open Instruction Set Architecture (ISA)
  • 7. 1/6/2020© 2019 Western Digital Corporation or its affiliates. All rights reserved. 7 Common boot flow Commonly used multiple boot stages model ROM LOADER RUNTIME BOOTLOADER OS Loads Jumps • Runs from On-Chip ROM • Uses On-Chip SRAM • SOC power-up and clock setup • DDR initialization • Loads RUNTIME and BOOTLOADER • Examples: • BIOS/UEFI • U-Boot SPL • Coreboot • Runs from On-Chip SRAM or DDR • SOC security setup • Runtime services as-per specifications • Examples: • ATF • BIOS/UEFI • Runs from DDR • Typically open-source • Filesystem support • Network booting • Boot configuration • Examples: • U-Boot • GRUB • LinuxBoot Proprietary Open Source
  • 8. 1/6/2020© 2019 Western Digital Corporation or its affiliates. All rights reserved. 8 RISC-V Upstream Boot Flow Follows commonly used multiple boot stages model • For HiFive Unleashed hardware (only Linux capable RISC-V platform available) • Follows a standard boot flow • Uses U-Boot as the last stage boot loader • U-Boot binary as the payload to OpenSBI • FSBL is SiFive specific and will be replaced by Coreboot/U-Boot SPL • OpenSBI is a RISC-V specific runtime service provider Linux (S-mode) (OS) ZSBL (M-mode) (ROM) FSBL (M-mode) (LOADER) OpenSBI (M-mode) (RUNTIME) U-Boot (S-mode) (BOOTLOADER) Loads Jumps Proprietary Open Source RISC-V specific
  • 9. 1/6/2020© 2019 Western Digital Corporation or its affiliates. All rights reserved. 9 RISC-V boot flow development timeline OpenSBI v0.1 release U-Boot SMP support U-Boot MMC support U-Boot SPL Coreboot Legacy Feb 18 Jan 19 Mar 19 July 19 Jul 19 Aug 19 EDK2 Oct 19 U-Boot support for Unleashed Feb 19Grub support Nov 18
  • 10. 1/6/2020© 2019 Western Digital Corporation or its affiliates. All rights reserved. 10 What is SBI ? • SBI is the RISC-V Supervisor Binary Interface – System call style calling convention between Supervisor (S-mode OS) and Supervisor Execution Environment (SEE) • SEE can be: – A M-mode RUNTIME firmware for OS/Hypervisor running in HS-mode – A HS-mode Hypervisor for Guest OS running in VS-mode • SBI calls help: – Reduce duplicate platform code across OSes (Linux, FreeBSD, etc) – Provide common drivers for an OS which can be shared by multiple platforms – Provide an interface for direct access to hardware resources (M-mode only resources) • Specifications being drafted by the Unix Platform Specification Working group – Currently, SBI v0.1 in-use and SBI v0.2 in draft stage – https://github.com/riscv/riscv-sbi-doc SEE (M-Mode) SBI OS (S-Mode) ABI ABI App1 App2
  • 11. 1/6/2020© 2019 Western Digital Corporation or its affiliates. All rights reserved. 11 What is OpenSBI ? • OpenSBI is an open-source implementation of the RISC-V Supervisor Binary Interface (SBI) specifications – Licensed under the terms of the BSD-2 clause license – Helps to avoid SBI implementation fragmentation – Maintained by the community • Aimed at providing RUNTIME services in M-mode – Typically used in boot stage following ROM/LOADER • Provides support for reference platforms – Generic simple drivers included for M-mode to operate  PLIC, CLINT, UART 8250 – Other platforms can reuse the common code and add needed drivers • Source – https://github.com/riscv/opensbi
  • 12. 1/6/2020© 2019 Western Digital Corporation or its affiliates. All rights reserved. 12 Key Features • Layered structure to accommodate various use cases – Generic SBI library with platform abstraction • Typically used with external firmware and bootloader – EDK2 (UEFI implementation), Secure boot working group – Platform specific library • Similar to core library but including platform specific drivers – Platform specific reference firmware • Three different types of RUNTIME firmware • Wide range of hardware features supported – RV32 and RV64 – Hypervisor support – Misaligned load/store handling – Missing CSR emulation – Protects firmware using PMP support Platform Specific Reference Firmware Platform Specific Library SBI Library OpenSBI Layers
  • 13. 1/6/2020© 2019 Western Digital Corporation or its affiliates. All rights reserved. 13 Reference Firmwares • OpenSBI provides several types of reference firmware, all platform-specific – FW_PAYLOAD • Firmware with the next booting stage as a payload • Default firmware being used in Linux capable RISC-V hardware – FW_JUMP • Firmware with fixed jump address to the next booting stage • Default method for QEMU – FW_DYNAMIC • Firmware with dynamic information on the next booting stage • U-Boot SPL/Coreboot is using FW_DYNAMIC • SOC Vendors may choose: – Use one of OpenSBI reference firmwares as their M-mode RUNTIME firmware – Build M-mode RUNTIME firmware from scratch with OpenSBI as library – Extend existing M-mode firmwares (U-Boot_M_mode/EDK2) with OpenSBI as library
  • 14. 1/6/2020© 2019 Western Digital Corporation or its affiliates. All rights reserved. 14 Platform support • SiFive HiFive Unleashed • Andes AE350 • Ariane FPGA SOC • Kendryte K210 • QEMU virt machines (32-bit/64-bit)
  • 15. 1/6/2020© 2019 Western Digital Corporation or its affiliates. All rights reserved. 15 Boot flow using OpenSBI dynamic firmware • OpenSBI firmware with dynamic information about the next booting stage • Coreboot support available on both hardware & QEMU • U-Boot SPL available for QEMU and Andes AE350 • HiFive Unleashed U-Boot SPL support not available yet Passed via ‘a2’ register Linux (S-mode) (OS) ZSBL (M-mode) (ROM) U-Boot SPL/ Coreboot (M-mode) OpenSBI (M-mode) (RUNTIME) U-Boot (S-mode) (BOOTLOADER) Loads Jumps Proprietary Open Source RISC-V specific struct fw_dynamic_info
  • 16. 1/6/2020© 2019 Western Digital Corporation or its affiliates. All rights reserved. 16 Boot flow using OpenSBI as a library • OpenSBI as a part of external firmware source code • Must configure program stack and scratch space for OpenSBI • Same GCC target option for external firmware and OpenSBI • Currently EDK2 integration with OpenSBI – HPE leading this effort – Available in EDK2 mailing list for U540 on Xilinx VC707 FPGA – OpenSBI built with EDK2 build environment – OpenSBI used as library in Pre-EFI Initialization (PEI) phase
  • 17. 1/6/2020© 2019 Western Digital Corporation or its affiliates. All rights reserved. 17 Upstream status • OpenSBI – Actively developed and maintained – Version 0.5 released – Default in Buildroot, Yocto/OpenEmbedded and the QEMU “BIOS” – Fedora/Debian provides images available with OpenSBI binary • U-Boot – U-Boot-2019.10 release has full support HiFive Unleashed S-mode – Boot via network/MMC supported – FIT image support – EFI support for RISC-V available • Grub – RISC-V support available upstream • Linux Kernel – Upstream kernel boots in QEMU – Device tree hosted in Kernel – v5.3 kernel works with OpenSBI+U-Boot on HiFive Unleashed Rapid progress: traditional full boot support expected by year end
  • 18. 1/6/2020© 2019 Western Digital Corporation or its affiliates. All rights reserved. 18 Future boot support • EFI stub support in Linux kernel for full UEFI support in progress – Enterprise class boot environment • U-Boot SPL support for HiFive Unleashed • SMP support in coreboot • EDK2 project upstreaming (in progress) • Oreboot (Coreboot written in Rust) • LinuxBoot ? • Other bootloaders ? Toward a stable and easy to use boot ecosystem
  • 19. 1/6/2020© 2019 Western Digital Corporation or its affiliates. All rights reserved. 19 Ongoing work • SBI specifications – SBI v0.2 specification – Hart state management extension in SBI – Legacy SBI extension replacement in SBI • OpenSBI – Sequential cpu boot via CPU hotplug – Support other M-mode boot loader such as Coreboot/U-Boot SPL – Hypervisor support when specification changes – More platforms support • Need hardware ! • Linux kernel – SBI v0.2 implementation (patches are under review) – EFI stub in Linux kernel (work in progress) – SBI legacy extension replacements – Sequential booting – CPU hotplug Toward a stable and easy to use boot ecosystem
  • 20. 1/6/2020© 2019 Western Digital Corporation or its affiliates. All rights reserved. 20 Demo 1: U-Boot MMC boot
  • 21. 1/6/2020© 2019 Western Digital Corporation or its affiliates. All rights reserved. 21 Thank you!! • Q&A ?
  • 22. © 2019 Western Digital Corporation or its affiliates. All rights reserved. 1/6/2020
  • 23. 1/6/2020© 2019 Western Digital Corporation or its affiliates. All rights reserved. 23 Backup
  • 24. 1/6/2020© 2019 Western Digital Corporation or its affiliates. All rights reserved. 24 Constraints on using OpenSBI Library • Same GCC target options (i.e. -march, -mabi, and -mcmodel) need to be used for the external firmware and OpenSBI sources • External firmware must create per-HART non-overlapping: 1.Program Stack 2.OpenSBI scratch space (i.e. struct sbi_scratch instance with extra space above) • Two constraints in calling any OpenSBI functions from external firmware: 1.MSCRATCH CSR of calling HART must be set to its own OpenSBI scratch space 2.SP register (i.e. the stack pointer) of calling HART must be set to its own stack • External firmware must also ensure that: – Interrupts are disabled in the MSTATUS and MIE CSRs when calling sbi_init() – sbi_init() is called for each HART that is powered-up at boot-time or in response to a CPU hotplug event – sbi_trap_handler() is called for M-mode interrupts and M-mode traps
  • 25. 1/6/2020© 2019 Western Digital Corporation or its affiliates. All rights reserved. 25 EDK2 implementation details • OpenSBI used as library • Open Source EDK2 (UEFI implementation) OpenSBI integration – HPE leading this effort – Available in EDK2 staging area for U540 on Xilinx VC707 FPGA – OpenSBI built with EDK2 build environment Passed via ‘a2’ register ZSBL (M-mode) (ROM) Bootloader (Grub/U- Boot) Loads Jumps Open Source RISC-V specific EDK2 FSBL (M-mode) (ROM) Linux (S-Mode) OS SEC phase PEI phase (M-Mode) DXE phase (S-Mode) BDS phase (S-Mode) EDK2 OpenSBI DXE Driver (S-Mode) OpenSBI library (M-Mode)
  • 26. 1/6/2020© 2019 Western Digital Corporation or its affiliates. All rights reserved. 26 Reference • OpenSBI – https://github.com/riscv/opensbi • SBI – https://github.com/riscv/riscv-sbi-doc • EDK2 – https://edk2.groups.io/g/devel/message/46479?p=,,,20,0,0,0::Created,,riscv,20,2,0,33047245

Notes de l'éditeur

  1. Meant for world domination – So ISA is designed so that microcontroller to enterprise server, everything can ba handled
  2. There were some questions about why part RISC-V bof last night. So I will quickly address them. Community driven development – Individual membership is free
  3. U-Boot supports MMC card & tftpbooting Why another runtime service Provider ? Why OpenSBI ?? Qemu can load super
  4. That’s the personification of RISC-V I could come up with which tells how incapable is right brain is  Legacy – BBL + Vmlinux as a single binary Grub was ported to RISC-V were upstreamed sometime in last year. UEFI support in U-Boot was done even before that time. But it was way ahead of its time as there was no effort in separating supervisor binary interface implementation from the Linux.
  5. Maintain and evolve the SBI specifications
  6. 20K lines of code 49K – dynamic firmware
  7. OpenSBI firmware with dynamic information about the next booting stage The next stage booting stage (i.e. BOOTLADER) and FW_DYNAMIC are loaded by the previous booting stage (i.e. LOADER) The previous booting stage (i.e. LOADER) passes the location of struct fw_dynamic_info to FW_DYNAMIC via ‘a2’ register Down-side: Previous booting stage (i.e. LOADER) needs to be aware of struct fw_dynamic_info