Skip to contentSkip to conversation

doc: arch: Add document for RISC-V architecture

RFC PATCH Superseded Yu Chien Peter Lin 4 participants 6 messages Feb 12, 2023 – Feb 14, 2023 RISC-V

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 doc: arch: Add document for RISC-V architecture

This patch adds a brief introduction to the RISC-V architecture and the typical boot process used on a variety of RISC-V platforms.

---
Hi RISC-V community,

Please leave a comment if there is anything I've missed that should be mentioned in the document. Thanks.

---
 doc/arch/index.rst |  1 +
 doc/arch/riscv.rst | 43 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 44 insertions(+)
 create mode 100644 doc/arch/riscv.rst
doc/arch/index.rst +1 -0
index b3e85f9bf3..b8da4b8c8e 100644
@@ -11,6 +11,7 @@ Architecture-specific doc
    m68k
    mips
    nios2
+   riscv
    sandbox/index
    sh
    x86
doc/arch/riscv.rst new file +43 -0

43 lines not on this page · raw message

Signature · 1 line
2.34.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Yu Chien Peter Lin

This patch adds a brief introduction to the RISC-V architecture and the typical boot process used on a variety of RISC-V platforms.

---
Hi RISC-V community,

Quoted 7 lines

Please leave a comment if there is anything I've missed that should be mentioned in the document. Thanks.

---
 doc/arch/index.rst |  1 +
 doc/arch/riscv.rst | 43 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 44 insertions(+)
 create mode 100644 doc/arch/riscv.rst
Reviewed-by on v1 1/1
#2 lore raw
In reply to Yu Chien Peter Lin
Quoted 8 lines · Yu Chien Peter Lin

This patch adds a brief introduction to the RISC-V architecture and the typical boot process used on a variety of RISC-V platforms.

---
Hi RISC-V community,

Quoted 7 lines

Please leave a comment if there is anything I've missed that should be mentioned in the document. Thanks.

---
 doc/arch/index.rst |  1 +
 doc/arch/riscv.rst | 43 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 44 insertions(+)
 create mode 100644 doc/arch/riscv.rst

Looks good. One nit is that we try to talk in terms of boot 'phases' rather than stages.

Regards,
Simon

#3 lore raw
Quoted 17 lines · Simon Glass
Quoted 8 lines · Yu Chien Peter Lin

This patch adds a brief introduction to the RISC-V architecture and the typical boot process used on a variety of RISC-V platforms.

---
Hi RISC-V community,

Quoted 7 lines

Please leave a comment if there is anything I've missed that should be mentioned in the document. Thanks.

---
 doc/arch/index.rst |  1 +
 doc/arch/riscv.rst | 43 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 44 insertions(+)
 create mode 100644 doc/arch/riscv.rst
Quoted 4 lines

Looks good. One nit is that we try to talk in terms of boot 'phases' rather than stages.

Hi Simon,

Thanks for the review, I'll update in the next patch.

Best regards,
Peter Lin

Quoted 2 lines

Regards,
Simon

#4 lore raw
In reply to Yu Chien Peter Lin
Quoted 42 lines · Yu Chien Peter Lin

This patch adds a brief introduction to the RISC-V architecture and the typical boot process used on a variety of RISC-V platforms.

---
Hi RISC-V community,

Please leave a comment if there is anything I've missed that should be mentioned in the document. Thanks.

---
  doc/arch/index.rst |  1 +
  doc/arch/riscv.rst | 43 +++++++++++++++++++++++++++++++++++++++++++
  2 files changed, 44 insertions(+)

create mode 100644 doc/arch/riscv.rst

doc/arch/index.rst +1 -0
index b3e85f9bf3..b8da4b8c8e 100644
@@ -11,6 +11,7 @@ Architecture-specific doc
     m68k
     mips
     nios2
+   riscv
     sandbox/index
     sh
     x86
doc/arch/riscv.rst new file +9 -0
new file mode 100644
index 0000000000..243e7e7e2e
@@ -0,0 +1,43 @@
+.. SPDX-License-Identifier: GPL-2.0+
+.. Copyright (C) 2023, Yu Chien Peter Lin <[email protected]>
+
+RISC-V
+======
+
+Overview
+--------
+

doc/arch/riscv.rst line 19

Quoted 10 lines
doc/arch/riscv.rst new file +10 -0
+This document outlines the U-Boot boot process for the RISC-V architecture.
+RISC-V is an open-source instruction set architecture (ISA) based on the
+principles of reduced instruction set computing (RISC). It has been designed
+to be flexible and customizable, allowing it to be adapted to different use
+cases, from embedded systems to high performance servers.
+
+Typical Boot Process
+--------------------
+
+RISC-V production boot images typically include a U-Boot SPL for platform-specific

%s/typically include/may include/

Many boards don't use SPL:

ae350_rv32_defconfig
ae350_rv64_defconfig
sipeed_maix_bitm_defconfig
sipeed_maix_smode_defconfig
openpiton_riscv64_defconfig
qemu-riscv64_defconfig

Please provide a description of those boot processes too.

doc/arch/riscv.rst line 21

Quoted 2 lines
doc/arch/riscv.rst new file +2 -0
+initialization. The U-Boot SPL then loads a FIT image (u-boot.itb), which contains
+an SBI (Supervisor Binary Interface) firmware such as `OpenSBI <https://github.com/riscv-software-src/opensbi>`_, as well as a regular

Please, try to stay within 80 columns.

%s/an SBI (Supervisor Binary Interface) firmware/a firmware providing the SBI (Supervisor Binary Interface)/

doc/arch/riscv.rst line 33

Quoted 12 lines
doc/arch/riscv.rst new file +12 -0
+U-Boot (or U-Boot proper) running in S-mode. Finally, the S-mode Operating System
+is loaded.
+
+In between the boot stages, the hartid is passed through the a0 register, and the
+start address of the devicetree is passed through the a1 register.
+
+The following diagram illustrates the boot process::
+
+	<----------( M-mode )--------><-------( S-mode )------>
+	+------------+   +---------+    +--------+   +--------+
+	| U-Boot SPL |-->|   SBI   |--->| U-Boot |-->|   OS   |
+	+------------+   +---------+    +--------+   +--------+

SBI (Supervisory Binary Interface) is an interface not a software. So it does not fit into this diagram.

Best regards

Heinrich

Quoted 10 lines
doc/arch/riscv.rst new file +10 -0
+
+To examine the boot process with the QEMU virt machine, you can follow the steps
+in the following document:
+:doc:`../board/emulation/qemu-riscv.rst`
+
+Toolchain
+---------
+
+You can build the `RISC-V GNU toolchain <https://github.com/riscv-collab/riscv-gnu-toolchain>`_ from scratch, or download a
+pre-built toolchain from the `releases page <https://github.com/riscv-collab/riscv-gnu-toolchain/releases>`_.
#5 lore raw

Hi Heinrich,

Quoted 58 lines · Heinrich Schuchardt
Quoted 42 lines · Yu Chien Peter Lin

This patch adds a brief introduction to the RISC-V architecture and the typical boot process used on a variety of RISC-V platforms.

---
Hi RISC-V community,

Please leave a comment if there is anything I've missed that should be mentioned in the document. Thanks.

---
  doc/arch/index.rst |  1 +
  doc/arch/riscv.rst | 43 +++++++++++++++++++++++++++++++++++++++++++
  2 files changed, 44 insertions(+)

create mode 100644 doc/arch/riscv.rst

doc/arch/index.rst +1 -0
index b3e85f9bf3..b8da4b8c8e 100644
@@ -11,6 +11,7 @@ Architecture-specific doc
     m68k
     mips
     nios2
+   riscv
     sandbox/index
     sh
     x86
doc/arch/riscv.rst new file +9 -0
new file mode 100644
index 0000000000..243e7e7e2e
@@ -0,0 +1,43 @@
+.. SPDX-License-Identifier: GPL-2.0+
+.. Copyright (C) 2023, Yu Chien Peter Lin <[email protected]>
+
+RISC-V
+======
+
+Overview
+--------
+

doc/arch/riscv.rst line 19

Quoted 10 lines
doc/arch/riscv.rst new file +10 -0
+This document outlines the U-Boot boot process for the RISC-V architecture.
+RISC-V is an open-source instruction set architecture (ISA) based on the
+principles of reduced instruction set computing (RISC). It has been designed
+to be flexible and customizable, allowing it to be adapted to different use
+cases, from embedded systems to high performance servers.
+
+Typical Boot Process
+--------------------
+
+RISC-V production boot images typically include a U-Boot SPL for platform-specific

%s/typically include/may include/

Many boards don't use SPL:

Quoted 8 lines

ae350_rv32_defconfig
ae350_rv64_defconfig
sipeed_maix_bitm_defconfig
sipeed_maix_smode_defconfig
openpiton_riscv64_defconfig
qemu-riscv64_defconfig

Please provide a description of those boot processes too.

Sure, I will add a description for these defconfigs.

Quoted 4 lines

doc/arch/riscv.rst line 21

Quoted 2 lines
doc/arch/riscv.rst new file +2 -0
+initialization. The U-Boot SPL then loads a FIT image (u-boot.itb), which contains
+an SBI (Supervisor Binary Interface) firmware such as `OpenSBI <https://github.com/riscv-software-src/opensbi>`_, as well as a regular

Please, try to stay within 80 columns.

OK, will fix.

Quoted 2 lines

%s/an SBI (Supervisor Binary Interface) firmware/a firmware providing the SBI (Supervisor Binary Interface)/

OK.

Quoted 7 lines
Quoted 7 lines
doc/arch/riscv.rst new file +7 -0
+U-Boot (or U-Boot proper) running in S-mode. Finally, the S-mode Operating System
+is loaded.
+
+In between the boot stages, the hartid is passed through the a0 register, and the
+start address of the devicetree is passed through the a1 register.
+
+The following diagram illustrates the boot process::
Quoted 8 lines

doc/arch/riscv.rst line 33

Quoted 5 lines
doc/arch/riscv.rst new file +5 -0
+
+	<----------( M-mode )--------><-------( S-mode )------>
+	+------------+   +---------+    +--------+   +--------+
+	| U-Boot SPL |-->|   SBI   |--->| U-Boot |-->|   OS   |
+	+------------+   +---------+    +--------+   +--------+

SBI (Supervisory Binary Interface) is an interface not a software. So it does not fit into this diagram.

Sure, I will rename the block to SBI firmware.

Quoted 15 lines

Best regards

Heinrich

Quoted 10 lines
doc/arch/riscv.rst new file +10 -0
+
+To examine the boot process with the QEMU virt machine, you can follow the steps
+in the following document:
+:doc:`../board/emulation/qemu-riscv.rst`
+
+Toolchain
+---------
+
+You can build the `RISC-V GNU toolchain <https://github.com/riscv-collab/riscv-gnu-toolchain>`_ from scratch, or download a
+pre-built toolchain from the `releases page <https://github.com/riscv-collab/riscv-gnu-toolchain/releases>`_.