Skip to contentSkip to conversation

hw/riscv: Server Platform Reference Board

PATCH Superseded Daniel Henrique Barboza 3 participants 20 messages Jun 4 – Jun 6

Subsystems (2)

v7 of 13 Superseded Latest is v13 →

lore
Share & tools
lore
#0 lore raw

v7 cover hw/riscv: Server Platform Reference Board

Hello,

In this version a new patch was added to include board tests. There's also minor changes in the docs to cite how the board was tested.

No other changes were made.

Patches are based on alistair/riscv-to-apply.next @2d9be31092, plus Chao Liu's series "[PATCH v6 0/7] riscv: add initial sdext support" [1]. For convenience this series is available at this branch:

https://gitlab.com/danielhb/qemu/-/tree/riscv-server-ref_v7

Changes from v6:
- patch 4 (new): add riscv-server-ref tests
- patch 5 (former 4): add more information about how the machine can be
tested/run
- v6 link: https://lore.kernel.org/qemu-devel/[email protected]/

Daniel Henrique Barboza (3):
target/riscv/cpu.c: remove 'bare' condition for .profile tests/functional/riscv64: add riscv-server-ref tests
docs: add riscv-server-ref.rst

Fei Wu (2):
target/riscv: Add server platform reference cpu
hw/riscv: server platform reference machine

 configs/devices/riscv64-softmmu/default.mak |    1 +
 docs/system/riscv/riscv-server-ref.rst      |   52 +
 docs/system/target-riscv.rst                |    1 +
 hw/riscv/Kconfig                            |   15 +
 hw/riscv/meson.build                        |    1 +
 hw/riscv/server_platform_ref.c              | 1373 +++++++++++++++++++
 target/riscv/cpu-qom.h                      |    1 +
 target/riscv/cpu.c                          |   12 +-
 tests/functional/riscv64/meson.build        |    2 +
 tests/functional/riscv64/test_opensbi.py    |    4 +
 tests/functional/riscv64/test_server_ref.py |   57 +
 11 files changed, 1518 insertions(+), 1 deletion(-)
 create mode 100644 docs/system/riscv/riscv-server-ref.rst
 create mode 100644 hw/riscv/server_platform_ref.c
 create mode 100755 tests/functional/riscv64/test_server_ref.py
Signature · 1 line
2.43.0
#1 lore raw

PATCH v7 1/5 target/riscv/cpu.c: remove 'bare' condition for .profile

We want to configure other CPU types to use profiles as an alternative to adding every profile extension explicitly, i.e. a profile is nothing more than an extension bundle.

This means that a vendor CPU can set .profile=rva23s64 while having the same handling as any other vendor CPU. Same thing with all other CPU types.

---
 target/riscv/cpu.c | 1 -
 1 file changed, 1 deletion(-)
target/riscv/cpu.c +0 -1
index f3b5d4c94c..3f0f931335 100644
@@ -2737,7 +2737,6 @@ static void riscv_cpu_class_base_init(ObjectClass *c, const void *data)
         mcc->def->bare |= def->bare;
         if (def->profile) {
             assert(profile_extends(def->profile, mcc->def->profile));
-            assert(mcc->def->bare);
             mcc->def->profile = def->profile;
         }
         if (def->misa_mxl_max) {
Signature · 1 line
2.43.0
#2 lore raw

PATCH v7 2/5 target/riscv: Add server platform reference cpu

In reply to Daniel Henrique Barboza

From: Fei Wu <[email protected]>

The harts requirements of RISC-V server platform [1] require RVA23 ISA profile support and others.

This patch provides a new "riscv-server-ref" CPU to go along with the future "riscv-server-ref" board.

[1] https://github.com/riscv-non-isa/riscv-server-platform/blob/main/server_platform_requirements.adoc

---
 target/riscv/cpu-qom.h |  1 +
 target/riscv/cpu.c     | 11 +++++++++++
 2 files changed, 12 insertions(+)
target/riscv/cpu-qom.h +1 -0
index 30dcdcfaae..a150acd151 100644
@@ -42,6 +42,7 @@
 #define TYPE_RISCV_CPU_RVA22S64         RISCV_CPU_TYPE_NAME("rva22s64")
 #define TYPE_RISCV_CPU_RVA23U64         RISCV_CPU_TYPE_NAME("rva23u64")
 #define TYPE_RISCV_CPU_RVA23S64         RISCV_CPU_TYPE_NAME("rva23s64")
+#define TYPE_RISCV_CPU_RVSERVER_REF     RISCV_CPU_TYPE_NAME("riscv-server-ref")
 #define TYPE_RISCV_CPU_IBEX             RISCV_CPU_TYPE_NAME("lowrisc-ibex")
 #define TYPE_RISCV_CPU_SHAKTI_C         RISCV_CPU_TYPE_NAME("shakti-c")
 #define TYPE_RISCV_CPU_SIFIVE_E         RISCV_CPU_TYPE_NAME("sifive-e")
target/riscv/cpu.c +11 -0
index 3f0f931335..c4a5a7f1cb 100644
@@ -3315,6 +3315,17 @@ static const TypeInfo riscv_cpu_type_infos[] = {
 #endif
     ),
 
+    DEFINE_RISCV_CPU(TYPE_RISCV_CPU_RVSERVER_REF, TYPE_RISCV_BARE_CPU,
+        .misa_mxl_max = MXL_RV64,
+        .profile = &RVA23S64,
+
+        .cfg.ext_zkr = true,
+        .cfg.ext_svadu = true,
+        .cfg.ext_sdext = true,
+
+        .cfg.max_satp_mode = VM_1_10_SV48,
+    ),
+
 #if defined(CONFIG_TCG) && !defined(CONFIG_USER_ONLY)
     DEFINE_RISCV_CPU(TYPE_RISCV_CPU_BASE128, TYPE_RISCV_DYNAMIC_CPU,
         .cfg.max_satp_mode = VM_1_10_SV57,
Signature · 1 line
2.43.0
#3 lore raw

Re: [PATCH v7 2/5] target/riscv: Add server platform reference cpu

Quoted 34 lines · Daniel Henrique Barboza

From: Fei Wu <[email protected]>

The harts requirements of RISC-V server platform [1] require RVA23 ISA profile support and others.

This patch provides a new "riscv-server-ref" CPU to go along with the future "riscv-server-ref" board.

[1] https://github.com/riscv-non-isa/riscv-server-platform/blob/main/server_platform_requirements.adoc

---
 target/riscv/cpu-qom.h |  1 +
 target/riscv/cpu.c     | 11 +++++++++++
 2 files changed, 12 insertions(+)
target/riscv/cpu-qom.h +1 -0
index 30dcdcfaae..a150acd151 100644
@@ -42,6 +42,7 @@
 #define TYPE_RISCV_CPU_RVA22S64         RISCV_CPU_TYPE_NAME("rva22s64")
 #define TYPE_RISCV_CPU_RVA23U64         RISCV_CPU_TYPE_NAME("rva23u64")
 #define TYPE_RISCV_CPU_RVA23S64         RISCV_CPU_TYPE_NAME("rva23s64")
+#define TYPE_RISCV_CPU_RVSERVER_REF     RISCV_CPU_TYPE_NAME("riscv-server-ref")
 #define TYPE_RISCV_CPU_IBEX             RISCV_CPU_TYPE_NAME("lowrisc-ibex")
 #define TYPE_RISCV_CPU_SHAKTI_C         RISCV_CPU_TYPE_NAME("shakti-c")
 #define TYPE_RISCV_CPU_SIFIVE_E         RISCV_CPU_TYPE_NAME("sifive-e")
target/riscv/cpu.c +0 -0
index 3f0f931335..c4a5a7f1cb 100644

target/riscv/cpu.c static const TypeInfo riscv_cpu_type_infos[] = { · line 3323

Quoted 9 lines
target/riscv/cpu.c +6 -0
@@ -3315,6 +3315,17 @@ static const TypeInfo riscv_cpu_type_infos[] = {
 #endif
     ),
 
+    DEFINE_RISCV_CPU(TYPE_RISCV_CPU_RVSERVER_REF, TYPE_RISCV_BARE_CPU,
+        .misa_mxl_max = MXL_RV64,
+        .profile = &RVA23S64,
+
+        .cfg.ext_zkr = true,
+        .cfg.ext_svadu = true,

Svadu isn't required. It's only a 'SHOULD' in the spec. We should remove it.

What about Sdtrig, Ssccfg, Ssstrict, Ssaia?

Thanks,
drew

Quoted 11 lines
target/riscv/cpu.c +5 -0
+        .cfg.ext_sdext = true,
+
+        .cfg.max_satp_mode = VM_1_10_SV48,
+    ),
+
 #if defined(CONFIG_TCG) && !defined(CONFIG_USER_ONLY)
     DEFINE_RISCV_CPU(TYPE_RISCV_CPU_BASE128, TYPE_RISCV_DYNAMIC_CPU,
         .cfg.max_satp_mode = VM_1_10_SV57,
Signature · 1 line
2.43.0
#4 lore raw

Re: [PATCH v7 2/5] target/riscv: Add server platform reference cpu

In reply to Daniel Henrique Barboza
Quoted 52 lines · 在 2026-06-04四的 06:52 -0300,Daniel Henrique Barboza写道:

From: Fei Wu <[email protected]>

The harts requirements of RISC-V server platform [1] require RVA23 ISA
profile support and others.

This patch provides a new "riscv-server-ref" CPU to go along with the future "riscv-server-ref" board.

[1]
https://github.com/riscv-non-isa/riscv-server-platform/blob/main/server_platform_requirements.adoc

Signed-off-by Daniel Henrique Barboza

<[email protected]>
---
 target/riscv/cpu-qom.h |  1 +
 target/riscv/cpu.c     | 11 +++++++++++

 2 files changed, 12 insertions(+)
target/riscv/cpu-qom.h +1 -0
index 30dcdcfaae..a150acd151 100644
@@ -42,6 +42,7 @@
  #define TYPE_RISCV_CPU_RVA22S64        
 RISCV_CPU_TYPE_NAME("rva22s64")
  #define TYPE_RISCV_CPU_RVA23U64        
 RISCV_CPU_TYPE_NAME("rva23u64")
  #define TYPE_RISCV_CPU_RVA23S64        
 RISCV_CPU_TYPE_NAME("rva23s64")
+#define TYPE_RISCV_CPU_RVSERVER_REF     RISCV_CPU_TYPE_NAME("riscv-

server-ref")
 #define TYPE_RISCV_CPU_IBEX RISCV_CPU_TYPE_NAME("lowrisc-ibex")
 #define TYPE_RISCV_CPU_SHAKTI_C         RISCV_CPU_TYPE_NAME("shakti- c")
 #define TYPE_RISCV_CPU_SIFIVE_E         RISCV_CPU_TYPE_NAME("sifive- e")

target/riscv/cpu.c +0 -0
index 3f0f931335..c4a5a7f1cb 100644
@@ -3315,6 +3315,17 @@ static const TypeInfo riscv_cpu_type_infos[] =
 {
  #endif
      ),


+    DEFINE_RISCV_CPU(TYPE_RISCV_CPU_RVSERVER_REF, TYPE_RISCV_BARE_CPU,
+        .misa_mxl_max = MXL_RV64,
+        .profile = &RVA23S64,

target/riscv/cpu.c static const TypeInfo riscv_cpu_type_infos[] = { · line 3326

Quoted 6 lines
target/riscv/cpu.c +6 -0
+
+        .cfg.ext_zkr = true,
+        .cfg.ext_svadu = true,
+        .cfg.ext_sdext = true,
+
+        .cfg.max_satp_mode = VM_1_10_SV48,

Here it only declares the maximum supported SATP mode is Sv48, but the RVSP spec requires Sv48, and the RVSP REF machine created in the next patch also requires it (because the above 4G PCIe memory space is beyond 40-bit physical address space).

Without ,sv48=on explicitly enabled on the CPU, booting EDK2 firmware will fail because of the out-of-address-space PCIe memory space.

Maybe a RVSERVER profile could be defined for CPUs conformant to server platform spec (because that spec really adds some requireed extensions), and use it for RVSERVER_REF CPU type?

Thanks,
Icenowy

Quoted 5 lines

+    ),
+
 #if defined(CONFIG_TCG) && !defined(CONFIG_USER_ONLY) DEFINE_RISCV_CPU(TYPE_RISCV_CPU_BASE128, TYPE_RISCV_DYNAMIC_CPU, .cfg.max_satp_mode = VM_1_10_SV57,

#5 lore raw

Re: [PATCH v7 2/5] target/riscv: Add server platform reference cpu

Quoted 65 lines · Icenowy Zheng
Quoted 48 lines · 在 2026-06-04四的 06:52 -0300,Daniel Henrique Barboza写道:

From: Fei Wu <[email protected]>

The harts requirements of RISC-V server platform [1] require RVA23 ISA
profile support and others.

This patch provides a new "riscv-server-ref" CPU to go along with the future "riscv-server-ref" board.

[1]
https://github.com/riscv-non-isa/riscv-server-platform/blob/main/server_platform_requirements.adoc

Signed-off-by Daniel Henrique Barboza

<[email protected]>

---
  target/riscv/cpu-qom.h |  1 +
  target/riscv/cpu.c     | 11 +++++++++++
  2 files changed, 12 insertions(+)
target/riscv/cpu-qom.h +1 -0
index 30dcdcfaae..a150acd151 100644
@@ -42,6 +42,7 @@
  #define TYPE_RISCV_CPU_RVA22S64
 RISCV_CPU_TYPE_NAME("rva22s64")
  #define TYPE_RISCV_CPU_RVA23U64
 RISCV_CPU_TYPE_NAME("rva23u64")
  #define TYPE_RISCV_CPU_RVA23S64
 RISCV_CPU_TYPE_NAME("rva23s64")
+#define TYPE_RISCV_CPU_RVSERVER_REF     RISCV_CPU_TYPE_NAME("riscv-

server-ref")
 #define TYPE_RISCV_CPU_IBEX
RISCV_CPU_TYPE_NAME("lowrisc-ibex")
 #define TYPE_RISCV_CPU_SHAKTI_C         RISCV_CPU_TYPE_NAME("shakti-
c")
 #define TYPE_RISCV_CPU_SIFIVE_E         RISCV_CPU_TYPE_NAME("sifive-
e")

target/riscv/cpu.c +0 -0
index 3f0f931335..c4a5a7f1cb 100644
@@ -3315,6 +3315,17 @@ static const TypeInfo riscv_cpu_type_infos[] =
 {
  #endif
      ),
 

target/riscv/cpu.c static const TypeInfo riscv_cpu_type_infos[] = · line 3328

Quoted 10 lines
target/riscv/cpu.c +9 -0
+    DEFINE_RISCV_CPU(TYPE_RISCV_CPU_RVSERVER_REF,
 TYPE_RISCV_BARE_CPU,
+        .misa_mxl_max = MXL_RV64,
+        .profile = &RVA23S64,
+
+        .cfg.ext_zkr = true,
+        .cfg.ext_svadu = true,
+        .cfg.ext_sdext = true,
+
+        .cfg.max_satp_mode = VM_1_10_SV48,

Here it only declares the maximum supported SATP mode is Sv48, but the RVSP spec requires Sv48, and the RVSP REF machine created in the next patch also requires it (because the above 4G PCIe memory space is beyond 40-bit physical address space).

Quoted 2 lines

Without ,sv48=on explicitly enabled on the CPU, booting EDK2 firmware will fail because of the out-of-address-space PCIe memory space.

You're correct. We're not initializing satp_mode to max_satp_mode, so the default value is being set to sv39. This seems to be the case for all CPUs, not just this one. For some reason I thought we were defaulting to the max_satp_mode. I need to understand why sv39 is being set as default (i.e. why not BARE?).

As far as -cpu riscv-server-ref goes we do not want to force users to specify sv48=on. The CPU should default to that without any additional command line.

Thanks for reporting this. There might be extra stuff to do in the code base before adding this CPU (maybe adding a 'satp_mode' attribute and make CPUs default to that value, like profile CPUs do).

Quoted 4 lines

Maybe a RVSERVER profile could be defined for CPUs conformant to server platform spec (because that spec really adds some requireed extensions), and use it for RVSERVER_REF CPU type?

Treating riscv-server-ref as a profile style CPU might be an easier alternative to have what we want but I wonder if allowing CPUs to set a default satp_mode is better long term. I'll see what I can do.

Thanks,
Daniel

Quoted 9 lines

Thanks,
Icenowy

Quoted 5 lines
target/riscv/cpu.c +2 -0
+    ),
+
  #if defined(CONFIG_TCG) && !defined(CONFIG_USER_ONLY)

     DEFINE_RISCV_CPU(TYPE_RISCV_CPU_BASE128, TYPE_RISCV_DYNAMIC_CPU, .cfg.max_satp_mode = VM_1_10_SV57,

#6 lore raw

Re: [PATCH v7 2/5] target/riscv: Add server platform reference cpu

On Fri, Jun 05, 2026 at 09:28:39AM -0300, Daniel Henrique Barboza wrote:
...

Quoted 3 lines

Thanks for reporting this. There might be extra stuff to do in the code base before adding this CPU (maybe adding a 'satp_mode' attribute and make CPUs default to that value, like profile CPUs do).

Indeed. Good catch. We want to enforce a minimum of sv48, but also allow optionally wider widths. I think the current default to sv39 is fine for the virt model, or maybe it should default to the minimum that supports the rest of the machine parameters, but the server platform reference needs to enforce a strict minimum and support for that would be a nice feature for the virt model too.

Thanks,
drew

#7 lore raw

Re: [PATCH v7 2/5] target/riscv: Add server platform reference cpu

In reply to Daniel Henrique Barboza
Quoted 67 lines · Daniel Henrique Barboza
Quoted 64 lines · Icenowy Zheng
Quoted 47 lines · 在 2026-06-04四的 06:52 -0300,Daniel Henrique Barboza写道:

From: Fei Wu <[email protected]>

The harts requirements of RISC-V server platform [1] require RVA23 ISA
profile support and others.

This patch provides a new "riscv-server-ref" CPU to go along with the future "riscv-server-ref" board.

[1]
https://github.com/riscv-non-isa/riscv-server-platform/blob/main/server_platform_requirements.adoc

Signed-off-by Daniel Henrique Barboza

<[email protected]>
---
  target/riscv/cpu-qom.h |  1 +
  target/riscv/cpu.c     | 11 +++++++++++

  2 files changed, 12 insertions(+)
target/riscv/cpu-qom.h +1 -0
index 30dcdcfaae..a150acd151 100644
@@ -42,6 +42,7 @@
   #define TYPE_RISCV_CPU_RVA22S64
 RISCV_CPU_TYPE_NAME("rva22s64")
   #define TYPE_RISCV_CPU_RVA23U64
 RISCV_CPU_TYPE_NAME("rva23u64")
   #define TYPE_RISCV_CPU_RVA23S64
 RISCV_CPU_TYPE_NAME("rva23s64")
+#define TYPE_RISCV_CPU_RVSERVER_REF     RISCV_CPU_TYPE_NAME("riscv-

server-ref")
  #define TYPE_RISCV_CPU_IBEX RISCV_CPU_TYPE_NAME("lowrisc-ibex")
  #define TYPE_RISCV_CPU_SHAKTI_C         RISCV_CPU_TYPE_NAME("shakti- c")
  #define TYPE_RISCV_CPU_SIFIVE_E         RISCV_CPU_TYPE_NAME("sifive- e")

target/riscv/cpu.c +0 -0
index 3f0f931335..c4a5a7f1cb 100644
@@ -3315,6 +3315,17 @@ static const TypeInfo riscv_cpu_type_infos[] =
 {
   #endif
       ),

target/riscv/cpu.c static const TypeInfo riscv_cpu_type_infos[] = · line 3327

Quoted 10 lines
target/riscv/cpu.c +9 -0
+    DEFINE_RISCV_CPU(TYPE_RISCV_CPU_RVSERVER_REF,
 TYPE_RISCV_BARE_CPU,
+        .misa_mxl_max = MXL_RV64,
+        .profile = &RVA23S64,
+
+        .cfg.ext_zkr = true,
+        .cfg.ext_svadu = true,
+        .cfg.ext_sdext = true,
+
+        .cfg.max_satp_mode = VM_1_10_SV48,

Here it only declares the maximum supported SATP mode is Sv48, but the RVSP spec requires Sv48, and the RVSP REF machine created in the next patch also requires it (because the above 4G PCIe memory space is beyond 40-bit physical address space).

Quoted 8 lines
Quoted 2 lines

Without ,sv48=on explicitly enabled on the CPU, booting EDK2 firmware will fail because of the out-of-address-space PCIe memory space.

You're correct.  We're not initializing satp_mode to max_satp_mode, so the default value is being set to sv39.  This seems to be the case for all CPUs, not just this one.  For some reason I thought we were defaulting to the max_satp_mode.  I need to understand why sv39 is being set as default (i.e. why not BARE?).

Got an update. It turns out that what we're seeing is something that is only happening to this CPU we're trying to add.

The way satp mode is set on QEMU assuming no command line input:

- "Bare" CPUs, aka CPUs that has just I or E enabled: default to BARE;

- Profile CPUs: default to the minimum required by the spec. E.g. for RVA23 the default is set to sv39;

- all other CPUs: default to satp_mode_max from the CPU definition.

The riscv-server-ref CPU is a BARE CPU that is using the profile framework to enable extensions. So for all intents and purposes the code is treating it as a profile CPU with extra stuff. Which is good, but then the satp setting from RVA23 (sv39) is overwriting satp_mode_max from the CPU definition.

I believe the way we're creating riscv-server-ref here is correct, so what I'm going to do is send a couple of fixes to allow riscv-server-ref to use RVA23 as a base and honor its satp_mode_max value too.

Thanks,
Daniel

Quoted 34 lines

As far as -cpu riscv-server-ref goes we do not want to force users to specify sv48=on.  The CPU should default to that without any additional command line.

Thanks for reporting this.  There might be extra stuff to do in the code base before adding this CPU (maybe adding a 'satp_mode' attribute and make CPUs default to that value, like profile CPUs do).

Quoted 4 lines

Maybe a RVSERVER profile could be defined for CPUs conformant to server platform spec (because that spec really adds some requireed extensions), and use it for RVSERVER_REF CPU type?

Treating riscv-server-ref as a profile style CPU might be an easier alternative to have what we want but I wonder if allowing CPUs to set a default satp_mode is better long term.  I'll see what I can do.

Thanks,
Daniel

Quoted 9 lines

Thanks,
Icenowy

Quoted 5 lines
target/riscv/cpu.c +2 -0
+    ),
+
   #if defined(CONFIG_TCG) && !defined(CONFIG_USER_ONLY)
       DEFINE_RISCV_CPU(TYPE_RISCV_CPU_BASE128, TYPE_RISCV_DYNAMIC_CPU,

          .cfg.max_satp_mode = VM_1_10_SV57,

#8 lore raw

Re: [PATCH v7 2/5] target/riscv: Add server platform reference cpu

On Fri, Jun 05, 2026 at 05:48:18PM -0300, Daniel Henrique Barboza wrote:
...

Quoted 24 lines
Quoted 5 lines

You're correct.  We're not initializing satp_mode to max_satp_mode, so the default value is being set to sv39.  This seems to be the case for all CPUs, not just this one.  For some reason I thought we were defaulting to the max_satp_mode.  I need to understand why sv39 is being set as default (i.e. why not BARE?).

Got an update. It turns out that what we're seeing is something that is only happening to this CPU we're trying to add.

The way satp mode is set on QEMU assuming no command line input:

- "Bare" CPUs, aka CPUs that has just I or E enabled: default to BARE;

- Profile CPUs: default to the minimum required by the spec. E.g. for RVA23 the default is set to sv39;

- all other CPUs: default to satp_mode_max from the CPU definition.

The riscv-server-ref CPU is a BARE CPU that is using the profile framework to enable extensions. So for all intents and purposes the code is treating it as a profile CPU with extra stuff. Which is good, but then the satp setting from RVA23 (sv39) is overwriting satp_mode_max from the CPU definition.

Quoted 3 lines

I believe the way we're creating riscv-server-ref here is correct, so what I'm going to do is send a couple of fixes to allow riscv-server-ref to use RVA23 as a base and honor its satp_mode_max value too.

But setting satp_mode_max to sv48 is not correct if that really means _max_ since we want the reference platform to default to the minimum (sv48) but also support the supported optional extensions and sv57 is a supported optional extension.

Thanks,
drew

#9 lore raw

Re: [PATCH v7 2/5] target/riscv: Add server platform reference cpu

Quoted 26 lines · Andrew Jones

On Fri, Jun 05, 2026 at 05:48:18PM -0300, Daniel Henrique Barboza wrote:
...

Quoted 24 lines
Quoted 5 lines

You're correct.  We're not initializing satp_mode to max_satp_mode, so the default value is being set to sv39.  This seems to be the case for all CPUs, not just this one.  For some reason I thought we were defaulting to the max_satp_mode.  I need to understand why sv39 is being set as default (i.e. why not BARE?).

Got an update. It turns out that what we're seeing is something that is only happening to this CPU we're trying to add.

The way satp mode is set on QEMU assuming no command line input:

- "Bare" CPUs, aka CPUs that has just I or E enabled: default to BARE;

- Profile CPUs: default to the minimum required by the spec. E.g. for RVA23 the default is set to sv39;

- all other CPUs: default to satp_mode_max from the CPU definition.

The riscv-server-ref CPU is a BARE CPU that is using the profile framework to enable extensions. So for all intents and purposes the code is treating it as a profile CPU with extra stuff. Which is good, but then the satp setting from RVA23 (sv39) is overwriting satp_mode_max from the CPU definition.

Quoted 8 lines
Quoted 3 lines

I believe the way we're creating riscv-server-ref here is correct, so what I'm going to do is send a couple of fixes to allow riscv-server-ref to use RVA23 as a base and honor its satp_mode_max value too.

But setting satp_mode_max to sv48 is not correct if that really means _max_ since we want the reference platform to default to the minimum (sv48) but also support the supported optional extensions and sv57 is a supported optional extension.

QEMU only works this way for profile CPUs.

For non-profile CPUs: cpu.max_satp_mode is set internally as part of the CPU definition. This is the maximum satp value that the CPU allows users to set via cmd line. If the user does not provide a satp mode then we'll do curr_satp_mode = max_satp_mode.

E.g. the thead vendor CPU defines .cfg.max_satp_mode = VM_1_10_SV39. In the command line we can't set anything higher than that:

$ ./build/qemu-system-riscv64 -M virt -cpu thead-c906,sv57=on
qemu-system-riscv64: satp_mode sv57 is higher than hw max capability sv39

For profile CPUs things are different: they are bare_cpu types, which are initialized with max_satp_mode sv57, and then during profile init we set the current satp_mode (current, not max_satp_mode) to the minimum the profile requires. Thus the rva23s64 CPU, by default, starts with sv39 but it can go up to sv57.

From what I'm understanding we want the riscv-server-ref CPU to work like profile CPUs. In fact I believe we can make it official by adding a 'default_satp_mode' setting in the CPU definition and allowing all CPUs to define a default satp and a max satp. CPUs defs that don't set a default mode will keep working as today (default_satp_mode == max_satp_mode if no user input).

I'll make changes and see how it goes. Cheers,

Daniel

Quoted 3 lines

Thanks,
drew

#10 lore raw

Re: [PATCH v7 2/5] target/riscv: Add server platform reference cpu

Quoted 79 lines · 在 2026-06-05五的 23:33 -0300,Daniel Henrique Barboza写道:
Quoted 45 lines · Andrew Jones

On Fri, Jun 05, 2026 at 05:48:18PM -0300, Daniel Henrique Barboza wrote:
...

Quoted 36 lines
Quoted 9 lines

You're correct.  We're not initializing satp_mode to max_satp_mode, so the
default value is being set to sv39.  This seems to be the case for all
CPUs, not just this one.  For some reason I thought we were defaulting
to the max_satp_mode.  I need to understand why sv39 is being set as
default (i.e. why not BARE?).

Got an update.  It turns out that what we're seeing is something that is
only happening to this CPU we're trying to add.

The way satp mode is set on QEMU assuming no command line input:

- "Bare" CPUs, aka CPUs that has just I or E enabled: default to BARE;

- Profile CPUs: default to the minimum required by the spec. E.g. for
   RVA23 the default is set to sv39;

- all other CPUs: default to satp_mode_max from the CPU definition.

The riscv-server-ref CPU is a BARE CPU that is using the profile framework
to enable extensions.  So for all intents and purposes the code is treating
it as a profile CPU with extra stuff.  Which is good, but then the
satp setting from RVA23 (sv39) is overwriting satp_mode_max from the
CPU definition.

Quoted 5 lines

I believe the way we're creating riscv-server-ref here is correct, so what
I'm going to do is send a couple of fixes to allow riscv-server- ref to use
RVA23 as a base and honor its satp_mode_max value too.

Quoted 7 lines

But setting satp_mode_max to sv48 is not correct if that really means
_max_ since we want the reference platform to default to the minimum
(sv48) but also support the supported optional extensions and sv57 is
a supported optional extension.

QEMU only works this way for profile CPUs.

For non-profile CPUs: cpu.max_satp_mode is set internally as part of the CPU definition.  This is the maximum satp value that the CPU allows
users to set via cmd line.  If the user does not provide a satp mode then we'll do curr_satp_mode = max_satp_mode.

E.g. the thead vendor CPU defines .cfg.max_satp_mode = VM_1_10_SV39. In the command line we can't set anything higher than that:

$ ./build/qemu-system-riscv64 -M virt -cpu thead-c906,sv57=on
qemu-system-riscv64: satp_mode sv57 is higher than hw max capability
sv39

For profile CPUs things are different: they are bare_cpu types, which are
initialized with max_satp_mode sv57, and then during profile init we set the current satp_mode (current, not max_satp_mode) to the minimum the profile requires.  Thus the rva23s64 CPU, by default, starts with sv39 but it can go up to sv57.

Quoted 9 lines

 From what I'm understanding we want the riscv-server-ref CPU to work like profile CPUs.  In fact I believe we can make it official by adding a 'default_satp_mode' setting in the CPU definition and allowing
all CPUs to define a default satp and a max satp.  CPUs defs that don't
set a default mode will keep working as today (default_satp_mode == max_satp_mode
if no user input).

I think we can just make RVSP a profile, and rvsp-ref CPU a BARE CPU based on that profile; then set the profile's min SATP to Sv48, and the BARE CPU's max SATP to Sv57.

In this case if any other CPU complying to RVSP is added, it can just reuse the profile.

Thanks,
Icenowy

Quoted 9 lines

I'll make changes and see how it goes.  Cheers,

Daniel

Quoted 3 lines

Thanks,
drew

#11 lore raw

Re: [PATCH v7 2/5] target/riscv: Add server platform reference cpu

Quoted 90 lines · Icenowy Zheng
Quoted 79 lines · 在 2026-06-05五的 23:33 -0300,Daniel Henrique Barboza写道:
Quoted 45 lines · Andrew Jones

On Fri, Jun 05, 2026 at 05:48:18PM -0300, Daniel Henrique Barboza wrote:
...

Quoted 36 lines
Quoted 9 lines

You're correct.  We're not initializing satp_mode to max_satp_mode, so the
default value is being set to sv39.  This seems to be the case for all
CPUs, not just this one.  For some reason I thought we were defaulting
to the max_satp_mode.  I need to understand why sv39 is being set as
default (i.e. why not BARE?).

Got an update.  It turns out that what we're seeing is something that is
only happening to this CPU we're trying to add.

The way satp mode is set on QEMU assuming no command line input:

- "Bare" CPUs, aka CPUs that has just I or E enabled: default to BARE;

- Profile CPUs: default to the minimum required by the spec. E.g. for
   RVA23 the default is set to sv39;

- all other CPUs: default to satp_mode_max from the CPU definition.

The riscv-server-ref CPU is a BARE CPU that is using the profile framework
to enable extensions.  So for all intents and purposes the code is treating
it as a profile CPU with extra stuff.  Which is good, but then the
satp setting from RVA23 (sv39) is overwriting satp_mode_max from the
CPU definition.

Quoted 5 lines

I believe the way we're creating riscv-server-ref here is correct, so what
I'm going to do is send a couple of fixes to allow riscv-server- ref to use
RVA23 as a base and honor its satp_mode_max value too.

Quoted 7 lines

But setting satp_mode_max to sv48 is not correct if that really means
_max_ since we want the reference platform to default to the minimum
(sv48) but also support the supported optional extensions and sv57 is
a supported optional extension.

QEMU only works this way for profile CPUs.

For non-profile CPUs: cpu.max_satp_mode is set internally as part of the CPU definition.  This is the maximum satp value that the CPU allows
users to set via cmd line.  If the user does not provide a satp mode then we'll do curr_satp_mode = max_satp_mode.

E.g. the thead vendor CPU defines .cfg.max_satp_mode = VM_1_10_SV39. In the command line we can't set anything higher than that:

$ ./build/qemu-system-riscv64 -M virt -cpu thead-c906,sv57=on
qemu-system-riscv64: satp_mode sv57 is higher than hw max capability
sv39

For profile CPUs things are different: they are bare_cpu types, which are
initialized with max_satp_mode sv57, and then during profile init we set the current satp_mode (current, not max_satp_mode) to the minimum the profile requires.  Thus the rva23s64 CPU, by default, starts with sv39 but it can go up to sv57.

Quoted 9 lines

 From what I'm understanding we want the riscv-server-ref CPU to work
like profile CPUs.  In fact I believe we can make it official by adding a 'default_satp_mode' setting in the CPU definition and allowing
all CPUs to define a default satp and a max satp.  CPUs defs that don't
set a default mode will keep working as today (default_satp_mode == max_satp_mode
if no user input).

Quoted 6 lines

I think we can just make RVSP a profile, and rvsp-ref CPU a BARE CPU based on that profile; then set the profile's min SATP to Sv48, and the BARE CPU's max SATP to Sv57.

In this case if any other CPU complying to RVSP is added, it can just reuse the profile.

Having riscv-server-ref being a profile CPU seems compelling indeed ... new CPUs could instance it with .profile = &rvserver-ref to have everything already sorted out, we would also have a flag to enable the profile for existing cpus, e.g. -cpu rv64,rvserver-ref=on.

Drew, any thoughts?

Daniel

Quoted 13 lines

Thanks,
Icenowy

Quoted 9 lines

I'll make changes and see how it goes.  Cheers,

Daniel

Quoted 3 lines

Thanks,
drew

#12 lore raw

Re: [PATCH v7 2/5] target/riscv: Add server platform reference cpu

On Sat, Jun 06, 2026 at 07:21:32AM -0300, Daniel Henrique Barboza wrote:
...

Quoted 7 lines
Quoted 6 lines

I think we can just make RVSP a profile, and rvsp-ref CPU a BARE CPU based on that profile; then set the profile's min SATP to Sv48, and the BARE CPU's max SATP to Sv57.

In this case if any other CPU complying to RVSP is added, it can just reuse the profile.

Quoted 6 lines

Having riscv-server-ref being a profile CPU seems compelling indeed ... new CPUs could instance it with .profile = &rvserver-ref to have everything already sorted out, we would also have a flag to enable the profile for existing cpus, e.g. -cpu rv64,rvserver-ref=on.

Drew, any thoughts?

As long as the concept of 'profile' is internal to QEMU and we comment its [ab]use explaining why the riscv-server-ref is modeled that way, then that sounds good to me. If the concept is exposed to users then I fear we'd confuse things by inventing profiles that don't exist in the profiles spec.

Thanks,
drew

#13 lore raw

Re: [PATCH v7 2/5] target/riscv: Add server platform reference cpu

Quoted 23 lines · 在 2026-06-06六的 11:09 -0500,Andrew Jones写道:

On Sat, Jun 06, 2026 at 07:21:32AM -0300, Daniel Henrique Barboza wrote:
...

Quoted 18 lines
Quoted 9 lines

I think we can just make RVSP a profile, and rvsp-ref CPU a BARE CPU
based on that profile; then set the profile's min SATP to Sv48, and the
BARE CPU's max SATP to Sv57.

In this case if any other CPU complying to RVSP is added, it can just
reuse the profile.

Having riscv-server-ref being a profile CPU seems compelling indeed
...
new CPUs could instance it with .profile = &rvserver-ref to have everything
already sorted out, we would also have a flag to enable the profile for
existing cpus, e.g. -cpu rv64,rvserver-ref=on.

Quoted 1 line

Drew, any thoughts?

Quoted 8 lines

As long as the concept of 'profile' is internal to QEMU and we comment its
[ab]use explaining why the riscv-server-ref is modeled that way, then that
sounds good to me. If the concept is exposed to users then I fear we'd
confuse things by inventing profiles that don't exist in the profiles spec.

Well I think the problem here is that RVI doesn't restrict the definition of required processor feature sets to profiles spec.

The best solution here is to make them create a proper profile describing the ISA extension requirement of RV Server Platform spec, instead of open-coding it in RVSP spec; otherwise they're effectively creating a profile, even if it's not in the profiles spec.

Thanks,
Icenowy

Quoted 3 lines

Thanks,
drew

#14 lore raw

PATCH v7 3/5 hw/riscv: server platform reference machine

In reply to Daniel Henrique Barboza

From: Fei Wu <[email protected]>

The RISC-V Server Platform specification [1] defines a standardized set of hardware and software capabilities, that portable system software, such as OS and hypervisors can rely on being present in a RISC-V server platform.

The main features included in this emulation are:

- Based on riscv virt machine type;
- A new memory map as close as virt machine as possible;
- An always present IOMMU platform device (riscv-iommu-sys) that uses IRQs 36 to 39, one IRQ for queue, similar to the 'virt' board;
- AIA;
- PCIe AHCI;
- PCIe NIC;
- No virtio device;
- No fw_cfg device;
- No ACPI table provided;
- Only minimal device tree nodes.

[1] https://github.com/riscv-non-isa/riscv-server-platform

---
 configs/devices/riscv64-softmmu/default.mak |    1 +
 hw/riscv/Kconfig                            |   15 +
 hw/riscv/meson.build                        |    1 +
 hw/riscv/server_platform_ref.c              | 1373 +++++++++++++++++++
 4 files changed, 1390 insertions(+)
 create mode 100644 hw/riscv/server_platform_ref.c
configs/devices/riscv64-softmmu/default.mak +1 -0
index a8e4d0ab33..ae3f62e2d4 100644
@@ -9,6 +9,7 @@
 # CONFIG_SIFIVE_E=n
 # CONFIG_SIFIVE_U=n
 # CONFIG_RISCV_VIRT=n
+# CONFIG_RISCV_SERVER_PLATFORM_REF=n
 # CONFIG_MICROCHIP_PFSOC=n
 # CONFIG_SHAKTI_C=n
 # CONFIG_XIANGSHAN_KUNMINGHU=n
hw/riscv/Kconfig +15 -0
index 2518b04175..1807c423ff 100644
@@ -69,6 +69,21 @@ config RISCV_VIRT
     select ACPI
     select ACPI_PCI
 
+config RISCV_SERVER_PLATFORM_REF
+    bool
+    default y
+    depends on RISCV64
+    select RISCV_NUMA
+    select GOLDFISH_RTC
+    select PCI
+    select PCI_EXPRESS_GENERIC_BRIDGE
+    select PFLASH_CFI01
+    select SERIAL
+    select RISCV_ACLINT
+    select RISCV_APLIC
+    select RISCV_IMSIC
+    select RISCV_IOMMU
+
 config SHAKTI_C
     bool
     default y
hw/riscv/meson.build +1 -0
index 533472e22a..74944cca84 100644
@@ -4,6 +4,7 @@ riscv_ss.add(when: 'CONFIG_RISCV_NUMA', if_true: files('numa.c'))
 riscv_ss.add(files('riscv_hart.c'))
 riscv_ss.add(when: 'CONFIG_OPENTITAN', if_true: files('opentitan.c'))
 riscv_ss.add(when: 'CONFIG_RISCV_VIRT', if_true: files('virt.c'))
+riscv_ss.add(when: 'CONFIG_RISCV_SERVER_PLATFORM_REF', if_true: files('server_platform_ref.c'))
 riscv_ss.add(when: 'CONFIG_SHAKTI_C', if_true: files('shakti_c.c'))
 riscv_ss.add(when: 'CONFIG_SIFIVE_E', if_true: files('sifive_e.c'))
 riscv_ss.add(when: 'CONFIG_SIFIVE_U', if_true: files('sifive_u.c'))
hw/riscv/server_platform_ref.c new file +1373 -0

1,373 lines not on this page · raw message

Signature · 1 line
2.43.0
#15 lore raw

Re: [PATCH v7 3/5] hw/riscv: server platform reference machine

Quoted 9 lines · Daniel Henrique Barboza

From: Fei Wu <[email protected]>

The RISC-V Server Platform specification [1] defines a standardized set of hardware and software capabilities, that portable system software, such as OS and hypervisors can rely on being present in a RISC-V server platform.

The main features included in this emulation are:

Quoted 8 lines

- Based on riscv virt machine type;
- A new memory map as close as virt machine as possible;
- An always present IOMMU platform device (riscv-iommu-sys) that uses IRQs 36 to 39, one IRQ for queue, similar to the 'virt' board;
- AIA;
- PCIe AHCI;
- PCIe NIC;
- No virtio device;

s/No virtio device/No Virtio MMIO transports/

Virtio devices, when plugged into PCIe slots, are fine. The spec doesn't care about that and it's even possible to make real hardware that conforms to the Virtio spec.

Quoted 2 lines

- No fw_cfg device;
- No ACPI table provided;

Maybe point out the reason there's no ACPI tables, even though the spec mandates the use of ACPI, is because it is expected that the firmware generate those tables.

Quoted 14 lines

- Only minimal device tree nodes.

[1] https://github.com/riscv-non-isa/riscv-server-platform

---
 configs/devices/riscv64-softmmu/default.mak |    1 +
 hw/riscv/Kconfig                            |   15 +
 hw/riscv/meson.build                        |    1 +
 hw/riscv/server_platform_ref.c              | 1373 +++++++++++++++++++
 4 files changed, 1390 insertions(+)
 create mode 100644 hw/riscv/server_platform_ref.c

...

hw/riscv/server_platform_ref.c line 1336

Quoted 9 lines
hw/riscv/server_platform_ref.c new file +9 -0
+static void rvserver_ref_machine_class_init(ObjectClass *oc, const void *data)
+{
+    char str[128];
+    MachineClass *mc = MACHINE_CLASS(oc);
+    static const char * const valid_cpu_types[] = {
+        TYPE_RISCV_CPU_RVSERVER_REF,
+    };
+
+    mc->desc = "RISC-V Server SoC Reference board";

Is 'SoC' the right thing to call this? We're aiming to model the whole specified server platform, not just the server soc (which has its own spec). I also suggest adding 'v1.0' to the description. Do CPU models have descriptions? If so, then 'v1.0' there would be good too.

hw/riscv/server_platform_ref.c line 1342

Quoted 6 lines
hw/riscv/server_platform_ref.c new file +6 -0
+    mc->init = rvserver_ref_machine_init;
+    mc->max_cpus = RVSERVER_CPUS_MAX;
+    mc->default_cpu_type = TYPE_RISCV_CPU_RVSERVER_REF;
+    mc->valid_cpu_types = valid_cpu_types;
+    mc->pci_allow_0_address = true;
+    mc->default_nic = "e1000e";

virtio-net-pci would probably be fine. See my comment about virtio devices above.

Thanks,
drew

#16 lore raw

PATCH v7 4/5 tests/functional/riscv64: add riscv-server-ref tests

In reply to Daniel Henrique Barboza

Add two tests for the recently added riscv-server-ref machine:

- a new test_opensbi.py test. The idea is to have a quick test that can catch trivial regressions that would prevent OpenSBI to finish;
- a new Linux boot "thorough" test that will boot the machine up to the buildroot prompt.

---
 tests/functional/riscv64/meson.build        |  2 +
 tests/functional/riscv64/test_opensbi.py    |  4 ++
 tests/functional/riscv64/test_server_ref.py | 57 +++++++++++++++++++++
 3 files changed, 63 insertions(+)
 create mode 100755 tests/functional/riscv64/test_server_ref.py
tests/functional/riscv64/meson.build +2 -0
index 5871211e89..2eb12586bf 100644
@@ -2,6 +2,7 @@
 
 test_riscv64_timeouts = {
   'boston' : 120,
+  'server_ref' : 120,
   'tuxrun' : 120,
 }
 
@@ -13,6 +14,7 @@ tests_riscv64_system_quick = [
 tests_riscv64_system_thorough = [
   'endianness',
   'boston',
+  'server_ref',
   'sifive_u',
   'tuxrun',
 ]
tests/functional/riscv64/test_opensbi.py +4 -0
index d077e40f42..057f55f90b 100755
@@ -32,5 +32,9 @@ def test_riscv_virt(self):
         self.set_machine('virt')
         self.boot_opensbi()
 
+    def test_riscv_server_ref(self):
+        self.set_machine('riscv-server-ref')
+        self.boot_opensbi()
+
 if __name__ == '__main__':
     QemuSystemTest.main()
tests/functional/riscv64/test_server_ref.py new file +57 -0

57 lines not on this page · raw message

Signature · 1 line
2.43.0
#17 lore raw

PATCH v7 5/5 docs: add riscv-server-ref.rst

In reply to Daniel Henrique Barboza

Add documentation for the new riscv-server-ref board.

---
 docs/system/riscv/riscv-server-ref.rst | 52 ++++++++++++++++++++++++++
 docs/system/target-riscv.rst           |  1 +
 2 files changed, 53 insertions(+)
 create mode 100644 docs/system/riscv/riscv-server-ref.rst
docs/system/riscv/riscv-server-ref.rst new file +52 -0
new file mode 100644
index 0000000000..379b7ef76e
@@ -0,0 +1,52 @@
+.. SPDX-License-Identifier: GPL-2.0-or-later
+
+RISC-V Server Platform Reference board (``riscv-server-ref``)
+=============================================================
+
+The RISC-V Server Platform specification `spec`_ defines a standardized
+set of hardware and software capabilities that portable system software,
+such as OS and hypervisors, can rely on being present in a RISC-V server
+platform.  This machine aims to emulate this specification, providing
+an environment for firmware/OS development and testing.
+
+`spec`_ is version 1.0 at the introduction of this board.  New spec versions
+might trigger a revision of the emulation itself, which will strive to always
+match the latest version available.  In case the emulation changes aren't
+backwards compatible we'll introduce a versioning scheme, probably via
+a machine property, to allow older SW to run with older spec versions.
+
+The main features included in the riscv-server-ref board are:
+
+* IOMMU platform device (riscv-iommu-sys)
+* AIA
+* PCIe AHCI
+* PCIe NIC
+* No virtio mmio bus
+* No fw_cfg device
+* No ACPI table
+* Minimal device tree nodes
+
+There are multiple ways of using this reference board, some of them being:
+
+* BIOS: u-boot-spl.bin; SD-CARD: <disk_containing_FIT>; NVME: <distro_disk>
+* BIOS: fw_dynamic.bin; KERNEL: u-boot.bin; NVME: <distro_disk>
+* BIOS: fw_dynamic.bin; KERNEL: EDK2.fd; NVME: <distro_disk>
+* BIOS: fw_dynamic.bin; KERNEL: <linux_image>; INITRD: <busybox_initrd>
+
+Here's an usage example with a recent (June 2026) ``Image`` and ``rootfs.ext2``
+files from buildroot:
+
+.. code-block:: bash
+
+ qemu-system-riscv64 -M riscv-server-ref \
+     -kernel ./buildroot/Image -append "rw rootwait root=/dev/vda" \
+     -drive file=./buildroot/rootfs.ext2,format=raw,id=hd0,if=virtio \
+     -nographic
+
+The images QEMU is using for selftests of the riscv-server-ref machine can
+be found below:
+
+https://github.com/danielhb/qemu-machine-boot/tree/master/riscv/images/virt64/buildroot
+
+
+.. _spec: https://github.com/riscv-non-isa/riscv-server-platform
docs/system/target-riscv.rst +1 -0
index afd86ca2ba..b2aeb39a8e 100644
@@ -73,6 +73,7 @@ undocumented; you can get a complete list by running
    riscv/sifive_u
    riscv/virt
    riscv/xiangshan-kunminghu
+   riscv/riscv-server-ref
 
 RISC-V CPU firmware
 -------------------
Signature · 1 line
2.43.0
#18 lore raw

Re: [PATCH v7 5/5] docs: add riscv-server-ref.rst

Quoted 20 lines · Daniel Henrique Barboza

Add documentation for the new riscv-server-ref board.

---
 docs/system/riscv/riscv-server-ref.rst | 52 ++++++++++++++++++++++++++
 docs/system/target-riscv.rst           |  1 +
 2 files changed, 53 insertions(+)
 create mode 100644 docs/system/riscv/riscv-server-ref.rst
docs/system/riscv/riscv-server-ref.rst new file +5 -0
new file mode 100644
index 0000000000..379b7ef76e
@@ -0,0 +1,52 @@
+.. SPDX-License-Identifier: GPL-2.0-or-later
+
+RISC-V Server Platform Reference board (``riscv-server-ref``)
+=============================================================
+

docs/system/riscv/riscv-server-ref.rst line 15

Quoted 10 lines
docs/system/riscv/riscv-server-ref.rst new file +10 -0
+The RISC-V Server Platform specification `spec`_ defines a standardized
+set of hardware and software capabilities that portable system software,
+such as OS and hypervisors, can rely on being present in a RISC-V server
+platform.  This machine aims to emulate this specification, providing
+an environment for firmware/OS development and testing.
+
+`spec`_ is version 1.0 at the introduction of this board.  New spec versions
+might trigger a revision of the emulation itself, which will strive to always
+match the latest version available.  In case the emulation changes aren't
+backwards compatible we'll introduce a versioning scheme, probably via

Even in the case the changes are backwards compatible we'll introduce a versioning scheme. Because...

docs/system/riscv/riscv-server-ref.rst line 16

Quoted 1 line
docs/system/riscv/riscv-server-ref.rst new file +1 -0
+a machine property, to allow older SW to run with older spec versions.

...we aren't as worried about older SW running on something than we are about new SW being tested on older machine models in order to allow OS developers to ensure changes to the OS to support newer spec versions don't regress support for older spec versions.

(And I think we're currently leaning towards a global property instead of a machine property in order to cover the cpu model too.)

Quoted 8 lines
docs/system/riscv/riscv-server-ref.rst new file +8 -0
+
+The main features included in the riscv-server-ref board are:
+
+* IOMMU platform device (riscv-iommu-sys)
+* AIA
+* PCIe AHCI
+* PCIe NIC
+* No virtio mmio bus

docs/system/riscv/riscv-server-ref.rst line 34

Quoted 10 lines
docs/system/riscv/riscv-server-ref.rst new file +10 -0
+* No fw_cfg device
+* No ACPI table
+* Minimal device tree nodes
+
+There are multiple ways of using this reference board, some of them being:
+
+* BIOS: u-boot-spl.bin; SD-CARD: <disk_containing_FIT>; NVME: <distro_disk>
+* BIOS: fw_dynamic.bin; KERNEL: u-boot.bin; NVME: <distro_disk>
+* BIOS: fw_dynamic.bin; KERNEL: EDK2.fd; NVME: <distro_disk>
+* BIOS: fw_dynamic.bin; KERNEL: <linux_image>; INITRD: <busybox_initrd>

Maybe we need to point out that a firmware that generates ACPI tables and supports EFI runtime services is required for a completely spec conforming platform. I think that's only the 3rd bullet above.

docs/system/riscv/riscv-server-ref.rst line 44

Quoted 10 lines
docs/system/riscv/riscv-server-ref.rst new file +10 -0
+
+Here's an usage example with a recent (June 2026) ``Image`` and ``rootfs.ext2``
+files from buildroot:
+
+.. code-block:: bash
+
+ qemu-system-riscv64 -M riscv-server-ref \
+     -kernel ./buildroot/Image -append "rw rootwait root=/dev/vda" \
+     -drive file=./buildroot/rootfs.ext2,format=raw,id=hd0,if=virtio \
+     -nographic

This example does not generate a server platform that conforms to the spec since there are no ACPI tables and no EFI support for the OS/hypervisor. Also, how is the disk configured? It should be a PCIe device.

Thanks,
drew

Quoted 23 lines
docs/system/riscv/riscv-server-ref.rst new file +8 -0
+
+The images QEMU is using for selftests of the riscv-server-ref machine can
+be found below:
+
+https://github.com/danielhb/qemu-machine-boot/tree/master/riscv/images/virt64/buildroot
+
+
+.. _spec: https://github.com/riscv-non-isa/riscv-server-platform
docs/system/target-riscv.rst +1 -0
index afd86ca2ba..b2aeb39a8e 100644
@@ -73,6 +73,7 @@ undocumented; you can get a complete list by running
    riscv/sifive_u
    riscv/virt
    riscv/xiangshan-kunminghu
+   riscv/riscv-server-ref
 
 RISC-V CPU firmware
 -------------------
Signature · 1 line
2.43.0
#19 lore raw

Re: [PATCH v7 5/5] docs: add riscv-server-ref.rst

Quoted 59 lines · Andrew Jones
Quoted 20 lines · Daniel Henrique Barboza

Add documentation for the new riscv-server-ref board.

---
  docs/system/riscv/riscv-server-ref.rst | 52 ++++++++++++++++++++++++++
  docs/system/target-riscv.rst           |  1 +
  2 files changed, 53 insertions(+)

create mode 100644 docs/system/riscv/riscv-server-ref.rst

docs/system/riscv/riscv-server-ref.rst new file +5 -0
new file mode 100644
index 0000000000..379b7ef76e
@@ -0,0 +1,52 @@
+.. SPDX-License-Identifier: GPL-2.0-or-later
+
+RISC-V Server Platform Reference board (``riscv-server-ref``)
+=============================================================
+

docs/system/riscv/riscv-server-ref.rst line 15

Quoted 10 lines
docs/system/riscv/riscv-server-ref.rst new file +10 -0
+The RISC-V Server Platform specification `spec`_ defines a standardized
+set of hardware and software capabilities that portable system software,
+such as OS and hypervisors, can rely on being present in a RISC-V server
+platform.  This machine aims to emulate this specification, providing
+an environment for firmware/OS development and testing.
+
+`spec`_ is version 1.0 at the introduction of this board.  New spec versions
+might trigger a revision of the emulation itself, which will strive to always
+match the latest version available.  In case the emulation changes aren't
+backwards compatible we'll introduce a versioning scheme, probably via

Even in the case the changes are backwards compatible we'll introduce a versioning scheme. Because...

docs/system/riscv/riscv-server-ref.rst line 16

Quoted 1 line
docs/system/riscv/riscv-server-ref.rst new file +1 -0
+a machine property, to allow older SW to run with older spec versions.

...we aren't as worried about older SW running on something than we are about new SW being tested on older machine models in order to allow OS developers to ensure changes to the OS to support newer spec versions don't regress support for older spec versions.

(And I think we're currently leaning towards a global property instead of a machine property in order to cover the cpu model too.)

Quoted 14 lines
docs/system/riscv/riscv-server-ref.rst new file +14 -0
+
+The main features included in the riscv-server-ref board are:
+
+* IOMMU platform device (riscv-iommu-sys)
+* AIA
+* PCIe AHCI
+* PCIe NIC
+* No virtio mmio bus
+* No fw_cfg device
+* No ACPI table
+* Minimal device tree nodes
+
+There are multiple ways of using this reference board, some of them being:
+
Quoted 8 lines

docs/system/riscv/riscv-server-ref.rst line 34

Quoted 4 lines
docs/system/riscv/riscv-server-ref.rst new file +4 -0
+* BIOS: u-boot-spl.bin; SD-CARD: <disk_containing_FIT>; NVME: <distro_disk>
+* BIOS: fw_dynamic.bin; KERNEL: u-boot.bin; NVME: <distro_disk>
+* BIOS: fw_dynamic.bin; KERNEL: EDK2.fd; NVME: <distro_disk>
+* BIOS: fw_dynamic.bin; KERNEL: <linux_image>; INITRD: <busybox_initrd>

Maybe we need to point out that a firmware that generates ACPI tables and supports EFI runtime services is required for a completely spec conforming platform. I think that's only the 3rd bullet above.

Fair enough. I'll remove bullets 1,2 and 4 and mention that we need a firmware that generates ACPI tables and supports EFI.

Quoted 15 lines

docs/system/riscv/riscv-server-ref.rst line 44

Quoted 11 lines
docs/system/riscv/riscv-server-ref.rst new file +10 -0
+
+Here's an usage example with a recent (June 2026) ``Image`` and ``rootfs.ext2``
+files from buildroot:
+
+.. code-block:: bash
+
+ qemu-system-riscv64 -M riscv-server-ref \
+     -kernel ./buildroot/Image -append "rw rootwait root=/dev/vda" \
+     -drive file=./buildroot/rootfs.ext2,format=raw,id=hd0,if=virtio \
+     -nographic

This example does not generate a server platform that conforms to the spec since there are no ACPI tables and no EFI support for the OS/hypervisor. Also, how is the disk configured? It should be a PCIe device.

Since this is not the intended usage (bullet 3 from above) I'll remove this example since it'll just confuse users. We should document only the usage that leads to a spec compliant setup.

Cheers,
Daniel

Quoted 28 lines

Thanks,
drew

Quoted 23 lines
docs/system/riscv/riscv-server-ref.rst new file +8 -0
+
+The images QEMU is using for selftests of the riscv-server-ref machine can
+be found below:
+
+https://github.com/danielhb/qemu-machine-boot/tree/master/riscv/images/virt64/buildroot
+
+
+.. _spec: https://github.com/riscv-non-isa/riscv-server-platform
docs/system/target-riscv.rst +1 -0
index afd86ca2ba..b2aeb39a8e 100644
@@ -73,6 +73,7 @@ undocumented; you can get a complete list by running
     riscv/sifive_u
     riscv/virt
     riscv/xiangshan-kunminghu
+   riscv/riscv-server-ref
 
  RISC-V CPU firmware
  -------------------
Signature · 1 line
2.43.0