Skip to contentSkip to conversation

hw/riscv: Experimental Server Platform Reference Board

PATCH In review Daniel Henrique Barboza 6 participants 20 messages Nov 11, 2025 – Dec 4, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v4 cover hw/riscv: Experimental Server Platform Reference Board

Hi,

In this new version we addressed the comments from Chao Liu in patches 2 and 4.

We're also owning up the fact that the board is being contributed in an incomplete status, given that we're missing 'sdext'.In theory we shouldn't try to upstream it until we have 'sdext' implemented but this board seems to be used by a lot of folks for for firmware development and whatnot. Thus, I changed the board description in patch 3 to add an 'EXPERIMENTAL' tag.

This is how the board is presented with -M help:

$ ./build/qemu-system-riscv64 -M help Supported machines are:
amd-microblaze-v-generic AMD Microblaze-V generic platform
microchip-icicle-kit Microchip PolarFire SoC Icicle Kit none
empty machine rvsp-ref             RISC-V Server SoC Reference board
(EXPERIMENTAL) (...)

Patch 5 adds documentation for the board. Again, making it clear that this is an experimental board that will be subject to changes before being 100% compliant with the spec.

Patches based on current master.

Changes in v4:
- patch 2:
- changed rvsp-ref CPU base type to BARE
- added a comment mentioning the lack of 'sdext'
- patch 3:
- changed the board description to add 'experimental'
- patch 4:
- fixed RVSP_IOMMU_SYS memmap addr: 0102000 -> 0x102000
- patch 5 (new):
- add board documentation
- v3 link: https://lore.kernel.org/qemu-riscv/[email protected]/

Daniel Henrique Barboza (3):
target/riscv/cpu.c: remove 'bare' condition for .profile hw/riscv/server_platform_ref.c: add riscv-iommu-sys
docs: add rvsp-ref.rst

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

 configs/devices/riscv64-softmmu/default.mak |    1 +
 docs/system/riscv/rvsp-ref.rst              |   28 +
 docs/system/target-riscv.rst                |    1 +
 hw/riscv/Kconfig                            |   15 +
 hw/riscv/meson.build                        |    1 +
 hw/riscv/server_platform_ref.c              | 1346 +++++++++++++++++++
 target/riscv/cpu-qom.h                      |    1 +
 target/riscv/cpu.c                          |   15 +-
 8 files changed, 1407 insertions(+), 1 deletion(-)
 create mode 100644 docs/system/riscv/rvsp-ref.rst
 create mode 100644 hw/riscv/server_platform_ref.c
Signature · 1 line
2.51.1
#1 lore raw

PATCH v4 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 73d4280d7c..975f7953e1 100644
@@ -2792,7 +2792,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.51.1
Tested-by on v4 1/5
#2 lore raw

Re: [PATCH v4 1/5] target/riscv/cpu.c: remove 'bare' condition for .profile

Quoted 10 lines · Daniel Henrique Barboza

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.

Thanks,
Chao

target/riscv/cpu.c static void riscv_cpu_class_base_init(ObjectClass *c,

Quoted 9 lines

---
target/riscv/cpu.c | 1 -

1 file changed, 1 deletion(-)
target/riscv/cpu.c +0 -0
index 73d4280d7c..975f7953e1 100644
@@ -2792,7 +2792,6 @@ static void riscv_cpu_class_base_init(ObjectClass *c,

const void *data)

Quoted 7 lines
target/riscv/cpu.c +0 -1
        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) {
#3 lore raw

PATCH v4 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, plus Sv48, Svadu, H, Sscofmpf etc.

This patch provides a CPU type (rvsp-ref) to go along with the rvsp-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     | 14 ++++++++++++++
 2 files changed, 15 insertions(+)
target/riscv/cpu-qom.h +1 -0
index 75f4e43408..07e96a14ba 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_RVSP_REF         RISCV_CPU_TYPE_NAME("rvsp-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 +14 -0
index 975f7953e1..3ddb249970 100644
@@ -3305,6 +3305,20 @@ static const TypeInfo riscv_cpu_type_infos[] = {
         .cfg.max_satp_mode = VM_1_10_SV48,
     ),
 
+    DEFINE_RISCV_CPU(TYPE_RISCV_CPU_RVSP_REF, TYPE_RISCV_BARE_CPU,
+        .misa_mxl_max = MXL_RV64,
+        .profile = &RVA23S64,
+
+        /*
+         * ISA extensions
+         * NOTE: we're missing 'sdext'.
+         */
+        .cfg.ext_zkr = true,
+        .cfg.ext_svadu = true,
+
+        .cfg.max_satp_mode = VM_1_10_SV57,
+    ),
+
 #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.51.1
#4 lore raw

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

Quoted 37 lines · Daniel Henrique Barboza

From: Fei Wu <[email protected]>

The harts requirements of RISC-V server platform [1] require RVA23 ISA profile support, plus Sv48, Svadu, H, Sscofmpf etc.

This patch provides a CPU type (rvsp-ref) to go along with the rvsp-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     | 14 ++++++++++++++
 2 files changed, 15 insertions(+)
target/riscv/cpu-qom.h +1 -0
index 75f4e43408..07e96a14ba 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_RVSP_REF         RISCV_CPU_TYPE_NAME("rvsp-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 975f7953e1..3ddb249970 100644
@@ -3305,6 +3305,20 @@ static const TypeInfo riscv_cpu_type_infos[] = {
         .cfg.max_satp_mode = VM_1_10_SV48,
     ),
 

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

Quoted 10 lines
target/riscv/cpu.c +10 -0
+    DEFINE_RISCV_CPU(TYPE_RISCV_CPU_RVSP_REF, TYPE_RISCV_BARE_CPU,
+        .misa_mxl_max = MXL_RV64,
+        .profile = &RVA23S64,
+
+        /*
+         * ISA extensions
+         * NOTE: we're missing 'sdext'.
+         */
+        .cfg.ext_zkr = true,
+        .cfg.ext_svadu = true,

Svadu is no longer required.

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

Quoted 2 lines
target/riscv/cpu.c +2 -0
+
+        .cfg.max_satp_mode = VM_1_10_SV57,

Shouldn't this be SV48 and then allow instantiations to use rvsp-ref,sv57=on.

We also need Ssccfg and Sdtrig.

Quoted 9 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,
Signature · 1 line
2.51.1

Thanks,
drew

#5 lore raw

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

Quoted 51 lines · Andrew Jones
Quoted 37 lines · Daniel Henrique Barboza

From: Fei Wu <[email protected]>

The harts requirements of RISC-V server platform [1] require RVA23 ISA profile support, plus Sv48, Svadu, H, Sscofmpf etc.

This patch provides a CPU type (rvsp-ref) to go along with the rvsp-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     | 14 ++++++++++++++
  2 files changed, 15 insertions(+)
target/riscv/cpu-qom.h +1 -0
index 75f4e43408..07e96a14ba 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_RVSP_REF         RISCV_CPU_TYPE_NAME("rvsp-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 975f7953e1..3ddb249970 100644
@@ -3305,6 +3305,20 @@ static const TypeInfo riscv_cpu_type_infos[] = {
          .cfg.max_satp_mode = VM_1_10_SV48,
      ),
 

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

Quoted 10 lines
target/riscv/cpu.c +10 -0
+    DEFINE_RISCV_CPU(TYPE_RISCV_CPU_RVSP_REF, TYPE_RISCV_BARE_CPU,
+        .misa_mxl_max = MXL_RV64,
+        .profile = &RVA23S64,
+
+        /*
+         * ISA extensions
+         * NOTE: we're missing 'sdext'.
+         */
+        .cfg.ext_zkr = true,
+        .cfg.ext_svadu = true,

Svadu is no longer required.

Quoted 5 lines

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

Quoted 2 lines
target/riscv/cpu.c +2 -0
+
+        .cfg.max_satp_mode = VM_1_10_SV57,

Shouldn't this be SV48 and then allow instantiations to use rvsp-ref,sv57=on.

Makes sense.

Quoted 2 lines

We also need Ssccfg and Sdtrig.

Sdtrig is enabled by default, and somehow I forgot to add ssccfg. I'll add it.

Thanks,

Daniel

Quoted 13 lines
Quoted 10 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,
Signature · 1 line
2.51.1

Thanks,
drew

#6 lore raw

PATCH v4 3/5 hw/riscv: experimental 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.

We do not have all the required extensions in QEMU: we're missing 'sdext'. In theory we shouldn't go ahead with this work, but the emulation as is now is proving to be useful for development and testing of other parts of the SW stack (firmware, kernel) and we would like to make it broadly available to everyone. We're contributing it as 'experimental', hopefully making it clear that the board does NOT complies 100% with [1].

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
- A new virt CPU type rvsp-ref-cpu for server platform compliance
- 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                            |   14 +
 hw/riscv/meson.build                        |    1 +
 hw/riscv/server_platform_ref.c              | 1276 +++++++++++++++++++
 4 files changed, 1292 insertions(+)
 create mode 100644 hw/riscv/server_platform_ref.c
configs/devices/riscv64-softmmu/default.mak +1 -0
index e485bbd1a3..e6075a7113 100644
@@ -9,6 +9,7 @@
 # CONFIG_SIFIVE_E=n
 # CONFIG_SIFIVE_U=n
 # CONFIG_RISCV_VIRT=n
+# CONFIG_SERVER_PLATFORM_REF=n
 # CONFIG_MICROCHIP_PFSOC=n
 # CONFIG_SHAKTI_C=n
 # CONFIG_XIANGSHAN_KUNMINGHU=n
hw/riscv/Kconfig +14 -0
index fc9c35bd98..6a5085c7a5 100644
@@ -69,6 +69,20 @@ config RISCV_VIRT
     select ACPI
     select ACPI_PCI
 
+config 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
+
 config SHAKTI_C
     bool
     default y
hw/riscv/meson.build +1 -0
index 2a8d5b136c..0daf77e887 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_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 +1276 -0

1,276 lines not on this page · raw message

Signature · 1 line
2.51.1
#7 lore raw

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

Quoted 1 line · Daniel Henrique Barboza

From: Fei Wu <[email protected]>

...

Quoted 5 lines
hw/riscv/server_platform_ref.c new file +5 -0
+static char *rvsp_ref_get_aia_guests(Object *obj, Error **errp)
+{
+    RVSPMachineState *s = RVSP_REF_MACHINE(obj);
+    char val[32];
+

hw/riscv/server_platform_ref.c line 1225

Quoted 10 lines
hw/riscv/server_platform_ref.c new file +10 -0
+    sprintf(val, "%d", s->aia_guests);
+    return g_strdup(val);
+}
+
+static void rvsp_ref_set_aia_guests(Object *obj, const char *val, Error **errp)
+{
+    RVSPMachineState *s = RVSP_REF_MACHINE(obj);
+
+    s->aia_guests = atoi(val);
+    if (s->aia_guests < 0 || s->aia_guests > RVSP_IRQCHIP_MAX_GUESTS) {

The minimum is 5 for the server platform, so we should enforce that. Also I suggest we bump RVSP_IRQCHIP_MAX_GUESTS since it's only 7 right now.

Quoted 5 lines
hw/riscv/server_platform_ref.c new file +5 -0
+        error_setg(errp, "Invalid number of AIA IMSIC guests");
+        error_append_hint(errp, "Valid values be between 0 and %d.\n",
+                          RVSP_IRQCHIP_MAX_GUESTS);
+    }
+}

hw/riscv/server_platform_ref.c line 1240

Quoted 10 lines
hw/riscv/server_platform_ref.c new file +10 -0
+
+static void rvsp_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_RVSP_REF,
+    };
+
+    mc->desc = "RISC-V Server SoC Reference board (EXPERIMENTAL)";

We could (and probably should) version this machine type from the get go. If we do that, then we could simply give it a version 0.9, which would match the current spec. When the spec is ratified and this model is complete, then it can be bumped to 1.0. Going that route would allow us to avoid the EXPERIMENTAL "flag".

Quoted 9 lines
hw/riscv/server_platform_ref.c new file +9 -0
+    mc->init = rvsp_ref_machine_init;
+    mc->max_cpus = RVSP_CPUS_MAX;
+    mc->default_cpu_type = TYPE_RISCV_CPU_RVSP_REF;
+    mc->valid_cpu_types = valid_cpu_types;
+    mc->pci_allow_0_address = true;
+    mc->default_nic = "e1000e";
+    mc->possible_cpu_arch_ids = riscv_numa_possible_cpu_arch_ids;
+    mc->cpu_index_to_instance_props = riscv_numa_cpu_index_to_props;
+    mc->get_default_cpu_node_id = riscv_numa_get_default_cpu_node_id;

hw/riscv/server_platform_ref.c line 1259

Quoted 10 lines
hw/riscv/server_platform_ref.c new file +10 -0
+    mc->numa_mem_supported = true;
+    /* platform instead of architectural choice */
+    mc->cpu_cluster_has_numa_boundary = true;
+    mc->default_ram_id = "riscv_rvsp_ref_board.ram";
+
+    object_class_property_add_str(oc, "aia-guests",
+                                  rvsp_ref_get_aia_guests,
+                                  rvsp_ref_set_aia_guests);
+    sprintf(str, "Set number of guest MMIO pages for AIA IMSIC. Valid value "
+                 "should be between 0 and %d.", RVSP_IRQCHIP_MAX_GUESTS);

Same comment about the guest file range as above (we shouldn't suggest anything less than 5).

Quoted 21 lines
hw/riscv/server_platform_ref.c new file +17 -0
+    object_class_property_set_description(oc, "aia-guests", str);
+}
+
+static const TypeInfo rvsp_ref_typeinfo = {
+    .name       = TYPE_RVSP_REF_MACHINE,
+    .parent     = TYPE_MACHINE,
+    .class_init = rvsp_ref_machine_class_init,
+    .instance_init = rvsp_ref_machine_instance_init,
+    .instance_size = sizeof(RVSPMachineState),
+};
+
+static void rvsp_ref_init_register_types(void)
+{
+    type_register_static(&rvsp_ref_typeinfo);
+}
+
+type_init(rvsp_ref_init_register_types)
Signature · 1 line
2.51.1

Thanks,
drew

#8 lore raw

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

Quoted 35 lines · Andrew Jones
Quoted 1 line · Daniel Henrique Barboza

From: Fei Wu <[email protected]>

...

Quoted 5 lines
hw/riscv/server_platform_ref.c new file +5 -0
+static char *rvsp_ref_get_aia_guests(Object *obj, Error **errp)
+{
+    RVSPMachineState *s = RVSP_REF_MACHINE(obj);
+    char val[32];
+

hw/riscv/server_platform_ref.c line 1225

Quoted 10 lines
hw/riscv/server_platform_ref.c new file +10 -0
+    sprintf(val, "%d", s->aia_guests);
+    return g_strdup(val);
+}
+
+static void rvsp_ref_set_aia_guests(Object *obj, const char *val, Error **errp)
+{
+    RVSPMachineState *s = RVSP_REF_MACHINE(obj);
+
+    s->aia_guests = atoi(val);
+    if (s->aia_guests < 0 || s->aia_guests > RVSP_IRQCHIP_MAX_GUESTS) {

The minimum is 5 for the server platform, so we should enforce that. Also I suggest we bump RVSP_IRQCHIP_MAX_GUESTS since it's only 7 right now.

Quoted 13 lines
hw/riscv/server_platform_ref.c new file +13 -0
+        error_setg(errp, "Invalid number of AIA IMSIC guests");
+        error_append_hint(errp, "Valid values be between 0 and %d.\n",
+                          RVSP_IRQCHIP_MAX_GUESTS);
+    }
+}
+
+static void rvsp_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_RVSP_REF,
+    };
Quoted 8 lines

hw/riscv/server_platform_ref.c line 1240

Quoted 2 lines
hw/riscv/server_platform_ref.c new file +2 -0
+
+    mc->desc = "RISC-V Server SoC Reference board (EXPERIMENTAL)";

We could (and probably should) version this machine type from the get go. If we do that, then we could simply give it a version 0.9, which would match the current spec. When the spec is ratified and this model is complete, then it can be bumped to 1.0. Going that route would allow us to avoid the EXPERIMENTAL "flag".

There has been some discussions offline on this and I'll bring them here.

A minor point: it was suggested to rename the board to 'rvserver' instead of 'rvsp-ref'. I like this idea mostly because I keep misspelling rvsp-ref as rsvp-ref.

As for the "version this machine type": in this case is different with what we do with other QEMU machines. They have a new version for every QEMU release, e.g. ARM's newest virt board is virt-10.2, in the next QEMU release it will be virt-11.0 and so on. We wouldn't do the same thing here - 'versioning' in this case is name the board in a way that makes reference to the spec it implements. So this current emulation would be named 'rvsp-ref-0.9', with an alias 'rvsp-ref' pointing to it.

Changing the emulation to comply with spec version 1.0 will create a rvsp-ref-1.0 board while keeping rvsp-ref-0.9 as is. Usually QEMU does that by using compat flags that changes the behavior of the board, and we'll probably go this route.

One thing worth considering is that we can't just version stamp the board, we need to do the same with the CPU. So we would have a rvsp-ref-cpu-0.9, rvsp-ref-cpu-1.0 and an alias to point to the newest available emulation.

Also note that we're not 0.9 compliant either since we're missing sdext. So unless we're willing to name this current board as rvsp-ref-0.9-beta or something like that, maybe it's a good idea to postpone this work until we have 'sdext' implemented.

Thoughts always welcome. Thanks,

Daniel

Quoted 48 lines
Quoted 10 lines
hw/riscv/server_platform_ref.c new file +9 -0
+    mc->init = rvsp_ref_machine_init;
+    mc->max_cpus = RVSP_CPUS_MAX;
+    mc->default_cpu_type = TYPE_RISCV_CPU_RVSP_REF;
+    mc->valid_cpu_types = valid_cpu_types;
+    mc->pci_allow_0_address = true;
+    mc->default_nic = "e1000e";
+    mc->possible_cpu_arch_ids = riscv_numa_possible_cpu_arch_ids;
+    mc->cpu_index_to_instance_props = riscv_numa_cpu_index_to_props;
+    mc->get_default_cpu_node_id = riscv_numa_get_default_cpu_node_id;

hw/riscv/server_platform_ref.c line 1259

Quoted 10 lines
hw/riscv/server_platform_ref.c new file +10 -0
+    mc->numa_mem_supported = true;
+    /* platform instead of architectural choice */
+    mc->cpu_cluster_has_numa_boundary = true;
+    mc->default_ram_id = "riscv_rvsp_ref_board.ram";
+
+    object_class_property_add_str(oc, "aia-guests",
+                                  rvsp_ref_get_aia_guests,
+                                  rvsp_ref_set_aia_guests);
+    sprintf(str, "Set number of guest MMIO pages for AIA IMSIC. Valid value "
+                 "should be between 0 and %d.", RVSP_IRQCHIP_MAX_GUESTS);

Same comment about the guest file range as above (we shouldn't suggest anything less than 5).

Quoted 21 lines
hw/riscv/server_platform_ref.c new file +17 -0
+    object_class_property_set_description(oc, "aia-guests", str);
+}
+
+static const TypeInfo rvsp_ref_typeinfo = {
+    .name       = TYPE_RVSP_REF_MACHINE,
+    .parent     = TYPE_MACHINE,
+    .class_init = rvsp_ref_machine_class_init,
+    .instance_init = rvsp_ref_machine_instance_init,
+    .instance_size = sizeof(RVSPMachineState),
+};
+
+static void rvsp_ref_init_register_types(void)
+{
+    type_register_static(&rvsp_ref_typeinfo);
+}
+
+type_init(rvsp_ref_init_register_types)
Signature · 1 line
2.51.1

Thanks,
drew

#9 lore raw

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

Quoted 47 lines · Daniel Henrique Barboza
Quoted 35 lines · Andrew Jones
Quoted 1 line · Daniel Henrique Barboza

From: Fei Wu <[email protected]>

...

Quoted 5 lines
hw/riscv/server_platform_ref.c new file +5 -0
+static char *rvsp_ref_get_aia_guests(Object *obj, Error **errp)
+{
+    RVSPMachineState *s = RVSP_REF_MACHINE(obj);
+    char val[32];
+

hw/riscv/server_platform_ref.c line 1225

Quoted 10 lines
hw/riscv/server_platform_ref.c new file +10 -0
+    sprintf(val, "%d", s->aia_guests);
+    return g_strdup(val);
+}
+
+static void rvsp_ref_set_aia_guests(Object *obj, const char *val, Error **errp)
+{
+    RVSPMachineState *s = RVSP_REF_MACHINE(obj);
+
+    s->aia_guests = atoi(val);
+    if (s->aia_guests < 0 || s->aia_guests > RVSP_IRQCHIP_MAX_GUESTS) {

The minimum is 5 for the server platform, so we should enforce that. Also I suggest we bump RVSP_IRQCHIP_MAX_GUESTS since it's only 7 right now.

Quoted 13 lines
hw/riscv/server_platform_ref.c new file +13 -0
+        error_setg(errp, "Invalid number of AIA IMSIC guests");
+        error_append_hint(errp, "Valid values be between 0 and %d.\n",
+                          RVSP_IRQCHIP_MAX_GUESTS);
+    }
+}
+
+static void rvsp_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_RVSP_REF,
+    };
Quoted 8 lines

hw/riscv/server_platform_ref.c line 1240

Quoted 2 lines
hw/riscv/server_platform_ref.c new file +2 -0
+
+    mc->desc = "RISC-V Server SoC Reference board (EXPERIMENTAL)";

We could (and probably should) version this machine type from the get go. If we do that, then we could simply give it a version 0.9, which would match the current spec. When the spec is ratified and this model is complete, then it can be bumped to 1.0. Going that route would allow us to avoid the EXPERIMENTAL "flag".

Quoted 5 lines

There has been some discussions offline on this and I'll bring them here.

A minor point: it was suggested to rename the board to 'rvserver' instead of 'rvsp-ref'. I like this idea mostly because I keep misspelling rvsp-ref as rsvp-ref.

I do like the '-ref' suffix though.

Quoted 11 lines

As for the "version this machine type": in this case is different with what we do with other QEMU machines. They have a new version for every QEMU release, e.g. ARM's newest virt board is virt-10.2, in the next QEMU release it will be virt-11.0 and so on. We wouldn't do the same thing here - 'versioning' in this case is name the board in a way that makes reference to the spec it implements. So this current emulation would be named 'rvsp-ref-0.9', with an alias 'rvsp-ref' pointing to it.

Changing the emulation to comply with spec version 1.0 will create a rvsp-ref-1.0 board while keeping rvsp-ref-0.9 as is. Usually QEMU does that by using compat flags that changes the behavior of the board, and we'll probably go this route.

Yes, as long as we point out what the version numbers mean somewhere, e.g. in the machine description, then I guess people will get it.

I'm not sure I want a 0.9 board to live on after a ratified 1.0 is released, though. So maybe an 'experimental' board makes more sense if we need to call it that in order to reserve the right to delete it.

Quoted 4 lines

One thing worth considering is that we can't just version stamp the board, we need to do the same with the CPU. So we would have a rvsp-ref-cpu-0.9, rvsp-ref-cpu-1.0 and an alias to point to the newest available emulation.

ack

Quoted 4 lines

Also note that we're not 0.9 compliant either since we're missing sdext. So unless we're willing to name this current board as rvsp-ref-0.9-beta or something like that, maybe it's a good idea to postpone this work until we have 'sdext' implemented.

Yes, let's prioritize sdext so we can match the current spec (which is unlikely to change much before ratification) before we merge the reference board at all.

Thanks,
drew

#10 lore raw

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

In reply to Daniel Henrique Barboza

Hi Fei, Daniel,

Quoted 30 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.

We do not have all the required extensions in QEMU: we're missing 'sdext'. In theory we shouldn't go ahead with this work, but the emulation as is now is proving to be useful for development and testing of other parts of the SW stack (firmware, kernel) and we would like to make it broadly available to everyone. We're contributing it as 'experimental', hopefully making it clear that the board does NOT complies 100% with [1].

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
- A new virt CPU type rvsp-ref-cpu for server platform compliance
- 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

Quoted 7 lines
---
  configs/devices/riscv64-softmmu/default.mak |    1 +
  hw/riscv/Kconfig                            |   14 +
  hw/riscv/meson.build                        |    1 +
  hw/riscv/server_platform_ref.c              | 1276 +++++++++++++++++++

Too big to my taste to review and/or look back in future.

(Don't bother splitting if someone is willing to review the patch).

Quoted 2 lines
  4 files changed, 1292 insertions(+)

create mode 100644 hw/riscv/server_platform_ref.c

#11 lore raw

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

In reply to Daniel Henrique Barboza
Quoted 33 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.

We do not have all the required extensions in QEMU: we're missing 'sdext'. In theory we shouldn't go ahead with this work, but the emulation as is now is proving to be useful for development and testing of other parts of the SW stack (firmware, kernel) and we would like to make it broadly available to everyone. We're contributing it as 'experimental', hopefully making it clear that the board does NOT complies 100% with [1].

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
- A new virt CPU type rvsp-ref-cpu for server platform compliance
- 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

---

Review

Quoted 8 lines
configs/devices/riscv64-softmmu/default.mak |    1 +
hw/riscv/Kconfig                            |   14 +
hw/riscv/meson.build                        |    1 +
hw/riscv/server_platform_ref.c              | 1276 +++++++++++++++++++
4 files changed, 1292 insertions(+)

create mode 100644 hw/riscv/server_platform_ref.c

(quoted diff) +0 -0

b/configs/devices/riscv64-softmmu/default.mak

Quoted 41 lines

index e485bbd1a3..e6075a7113 100644

configs/devices/riscv64-softmmu/default.mak +1 -0
@@ -9,6 +9,7 @@
 # CONFIG_SIFIVE_E=n
 # CONFIG_SIFIVE_U=n
 # CONFIG_RISCV_VIRT=n
+# CONFIG_SERVER_PLATFORM_REF=n
 # CONFIG_MICROCHIP_PFSOC=n
 # CONFIG_SHAKTI_C=n
 # CONFIG_XIANGSHAN_KUNMINGHU=n
hw/riscv/Kconfig +14 -0
index fc9c35bd98..6a5085c7a5 100644
@@ -69,6 +69,20 @@ config RISCV_VIRT
    select ACPI
    select ACPI_PCI
 
+config 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
+

config SHAKTI_C
bool
default y

hw/riscv/meson.build +0 -0
index 2a8d5b136c..0daf77e887 100644

hw/riscv/meson.build riscv_ss.add(when: 'CONFIG_RISCV_NUMA', if_true: files('numa.c')) · line 7

Quoted 4 lines
hw/riscv/meson.build +1 -0
@@ -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_SERVER_PLATFORM_REF', if_true:

files('server_platform_ref.c'))

Quoted 154 lines
hw/riscv/meson.build +0 -0
 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 +145 -0
new file mode 100644
index 0000000000..ef2891a9d7
@@ -0,0 +1,1276 @@
+/*
+ * QEMU RISC-V Server Platform (RVSP) Reference Board
+ *
+ * Copyright (c) 2024 Intel, Inc.
+ * Copyright (c) 2025 Ventana Micro Systems Inc.
+ *
+ * This board is compliant RISC-V Server platform specification and leveraging
+ * a lot of riscv virt code.
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#include "qemu/osdep.h"
+#include "qemu/units.h"
+#include "qemu/error-report.h"
+#include "qemu/guest-random.h"
+#include "qapi/error.h"
+#include "qapi/qapi-visit-common.h"
+#include "hw/boards.h"
+#include "hw/loader.h"
+#include "hw/sysbus.h"
+#include "hw/qdev-properties.h"
+#include "hw/char/serial.h"
+#include "hw/block/flash.h"
+#include "hw/ide/pci.h"
+#include "hw/ide/ahci-pci.h"
+#include "hw/pci/pci.h"
+#include "hw/pci-host/gpex.h"
+#include "hw/core/sysbus-fdt.h"
+#include "hw/riscv/riscv_hart.h"
+#include "hw/riscv/boot.h"
+#include "hw/riscv/numa.h"
+#include "hw/intc/riscv_aclint.h"
+#include "hw/intc/riscv_aplic.h"
+#include "hw/intc/riscv_imsic.h"
+#include "chardev/char.h"
+#include "hw/char/serial-mm.h"
+#include "system/device_tree.h"
+#include "system/runstate.h"
+#include "system/system.h"
+#include "system/tcg.h"
+#include "system/qtest.h"
+#include "target/riscv/cpu.h"
+#include "target/riscv/pmu.h"
+#include "net/net.h"
+
+#define RVSP_CPUS_MAX_BITS             9
+#define RVSP_CPUS_MAX                  (1 << RVSP_CPUS_MAX_BITS)
+#define RVSP_SOCKETS_MAX_BITS          2
+#define RVSP_SOCKETS_MAX               (1 << RVSP_SOCKETS_MAX_BITS)
+
+#define RVSP_IRQCHIP_NUM_MSIS 255
+#define RVSP_IRQCHIP_NUM_SOURCES 96
+#define RVSP_IRQCHIP_NUM_PRIO_BITS 3
+#define RVSP_IRQCHIP_MAX_GUESTS_BITS 3
+#define RVSP_IRQCHIP_MAX_GUESTS ((1U << RVSP_IRQCHIP_MAX_GUESTS_BITS) - 1U)
+
+#define FDT_PCI_ADDR_CELLS    3
+#define FDT_PCI_INT_CELLS     1
+#define FDT_APLIC_INT_CELLS   2
+#define FDT_IMSIC_INT_CELLS   0
+#define FDT_MAX_INT_CELLS     2
+#define FDT_MAX_INT_MAP_WIDTH (FDT_PCI_ADDR_CELLS + FDT_PCI_INT_CELLS + \
+                                 1 + FDT_MAX_INT_CELLS)
+#define FDT_APLIC_INT_MAP_WIDTH (FDT_PCI_ADDR_CELLS + FDT_PCI_INT_CELLS + \
+                                 1 + FDT_APLIC_INT_CELLS)
+
+#define NUM_SATA_PORTS  6
+
+#define SYSCON_RESET     0x1
+#define SYSCON_POWEROFF  0x2
+
+#define TYPE_RVSP_REF_MACHINE MACHINE_TYPE_NAME("rvsp-ref")
+OBJECT_DECLARE_SIMPLE_TYPE(RVSPMachineState, RVSP_REF_MACHINE)
+
+struct RVSPMachineState {
+    /*< private >*/
+    MachineState parent;
+
+    /*< public >*/
+    Notifier machine_done;
+    RISCVHartArrayState soc[RVSP_SOCKETS_MAX];
+    DeviceState *irqchip[RVSP_SOCKETS_MAX];
+    PFlashCFI01 *flash[2];
+
+    int fdt_size;
+    int aia_guests;
+    const MemMapEntry *memmap;
+};
+
+enum {
+    RVSP_DEBUG,
+    RVSP_MROM,
+    RVSP_RESET_SYSCON,
+    RVSP_RTC,
+    RVSP_ACLINT,
+    RVSP_APLIC_M,
+    RVSP_APLIC_S,
+    RVSP_UART0,
+    RVSP_IMSIC_M,
+    RVSP_IMSIC_S,
+    RVSP_FLASH,
+    RVSP_DRAM,
+    RVSP_PCIE_MMIO,
+    RVSP_PCIE_PIO,
+    RVSP_PCIE_ECAM,
+    RVSP_PCIE_MMIO_HIGH
+};
+
+enum {
+    RVSP_UART0_IRQ = 10,
+    RVSP_RTC_IRQ = 11,
+    RVSP_PCIE_IRQ = 0x20, /* 32 to 35 */
+};
+
+/*
+ * The server soc reference machine physical address space used by some of the
+ * devices namely ACLINT, APLIC and IMSIC depend on number of Sockets, number
+ * of CPUs, and number of IMSIC guest files.
+ *
+ * Various limits defined by RVSP_SOCKETS_MAX_BITS, RVSP_CPUS_MAX_BITS, and
+ * RVSP_IRQCHIP_MAX_GUESTS_BITS are tuned for maximum utilization of server soc
+ * reference machine physical address space.
+ */
+
+#define RVSP_IMSIC_GROUP_MAX_SIZE      (1U << IMSIC_MMIO_GROUP_MIN_SHIFT)
+#if RVSP_IMSIC_GROUP_MAX_SIZE < \
+    IMSIC_GROUP_SIZE(RVSP_CPUS_MAX_BITS, RVSP_IRQCHIP_MAX_GUESTS_BITS)
+#error "Can't accomodate single IMSIC group in address space"
+#endif
+
+#define RVSP_IMSIC_MAX_SIZE            (RVSP_SOCKETS_MAX * \
+                                        RVSP_IMSIC_GROUP_MAX_SIZE)
+#if 0x4000000 < RVSP_IMSIC_MAX_SIZE
+#error "Can't accomodate all IMSIC groups in address space"
+#endif
+
+static const MemMapEntry rvsp_ref_memmap[] = {
+    [RVSP_DEBUG] =          {        0x0,         0x100 },
+    [RVSP_MROM] =           {     0x1000,        0xf000 },
+    [RVSP_RESET_SYSCON] =   {   0x100000,        0x1000 },
+    [RVSP_RTC] =            {   0x101000,        0x1000 },
+    [RVSP_ACLINT] =         {  0x2000000,       0x10000 },
+    [RVSP_PCIE_PIO] =       {  0x3000000,       0x10000 },

hw/riscv/server_platform_ref.c line 155

Quoted 10 lines
hw/riscv/server_platform_ref.c new file +10 -0
+    [RVSP_APLIC_M] =        {  0xc000000, APLIC_SIZE(RVSP_CPUS_MAX) },
+    [RVSP_APLIC_S] =        {  0xd000000, APLIC_SIZE(RVSP_CPUS_MAX) },
+    [RVSP_UART0] =          { 0x10000000,         0x100 },
+    [RVSP_FLASH] =          { 0x20000000,     0x4000000 },
+    [RVSP_IMSIC_M] =        { 0x24000000, RVSP_IMSIC_MAX_SIZE },
+    [RVSP_IMSIC_S] =        { 0x28000000, RVSP_IMSIC_MAX_SIZE },
+    [RVSP_PCIE_ECAM] =      { 0x30000000,    0x10000000 },
+    [RVSP_PCIE_MMIO] =      { 0x40000000,    0x40000000 },
+    [RVSP_DRAM] =           { 0x80000000, 0xff80000000ull },
+    [RVSP_PCIE_MMIO_HIGH] = { 0x10000000000ull, 0x10000000000ull },

The base address of RVSP_PCIE_MMIO_HIGH exceeds the 39-bit address space, while the satp mode of the rvsp-ref-cpu is SV39 (based on the RVA23S64).

static RISCVCPUProfile RVA23S64 = {
    .u_parent = &RVA23U64,
    .s_parent = &RVA22S64,
    .name = "rva23s64",
    .misa_ext = RVS,
    .priv_spec = PRIV_VERSION_1_13_0,
    .satp_mode = VM_1_10_SV39, /* there */
    ...
}

This will cause an error when EDKII processes the address mapping of PCI MMIO, but I am not yet sure whose issue this is.

I suggest setting the default value of satp_mode for rvsp-ref-cpu to SV48.

Thanks,
Chao

#12 lore raw

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

Quoted 266 lines · Chao Liu
Quoted 33 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.

We do not have all the required extensions in QEMU: we're missing 'sdext'. In theory we shouldn't go ahead with this work, but the emulation as is now is proving to be useful for development and testing of other parts of the SW stack (firmware, kernel) and we would like to make it broadly available to everyone. We're contributing it as 'experimental', hopefully making it clear that the board does NOT complies 100% with [1].

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
- A new virt CPU type rvsp-ref-cpu for server platform compliance
- 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

---

Review

Quoted 8 lines
configs/devices/riscv64-softmmu/default.mak |    1 +
hw/riscv/Kconfig                            |   14 +
hw/riscv/meson.build                        |    1 +
hw/riscv/server_platform_ref.c              | 1276 +++++++++++++++++++
4 files changed, 1292 insertions(+)

create mode 100644 hw/riscv/server_platform_ref.c

(quoted diff) +0 -0

b/configs/devices/riscv64-softmmu/default.mak

Quoted 41 lines

index e485bbd1a3..e6075a7113 100644

configs/devices/riscv64-softmmu/default.mak +1 -0
@@ -9,6 +9,7 @@
 # CONFIG_SIFIVE_E=n
 # CONFIG_SIFIVE_U=n
 # CONFIG_RISCV_VIRT=n
+# CONFIG_SERVER_PLATFORM_REF=n
 # CONFIG_MICROCHIP_PFSOC=n
 # CONFIG_SHAKTI_C=n
 # CONFIG_XIANGSHAN_KUNMINGHU=n
hw/riscv/Kconfig +14 -0
index fc9c35bd98..6a5085c7a5 100644
@@ -69,6 +69,20 @@ config RISCV_VIRT
     select ACPI
     select ACPI_PCI
 
+config 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
+

config SHAKTI_C
bool
default y

hw/riscv/meson.build +0 -0
index 2a8d5b136c..0daf77e887 100644

hw/riscv/meson.build riscv_ss.add(when: 'CONFIG_RISCV_NUMA', if_true: files('numa.c')) · line 7

Quoted 4 lines
hw/riscv/meson.build +1 -0
@@ -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_SERVER_PLATFORM_REF', if_true:

files('server_platform_ref.c'))

Quoted 154 lines
hw/riscv/meson.build +0 -0
 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 +145 -0
new file mode 100644
index 0000000000..ef2891a9d7
@@ -0,0 +1,1276 @@
+/*
+ * QEMU RISC-V Server Platform (RVSP) Reference Board
+ *
+ * Copyright (c) 2024 Intel, Inc.
+ * Copyright (c) 2025 Ventana Micro Systems Inc.
+ *
+ * This board is compliant RISC-V Server platform specification and leveraging
+ * a lot of riscv virt code.
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#include "qemu/osdep.h"
+#include "qemu/units.h"
+#include "qemu/error-report.h"
+#include "qemu/guest-random.h"
+#include "qapi/error.h"
+#include "qapi/qapi-visit-common.h"
+#include "hw/boards.h"
+#include "hw/loader.h"
+#include "hw/sysbus.h"
+#include "hw/qdev-properties.h"
+#include "hw/char/serial.h"
+#include "hw/block/flash.h"
+#include "hw/ide/pci.h"
+#include "hw/ide/ahci-pci.h"
+#include "hw/pci/pci.h"
+#include "hw/pci-host/gpex.h"
+#include "hw/core/sysbus-fdt.h"
+#include "hw/riscv/riscv_hart.h"
+#include "hw/riscv/boot.h"
+#include "hw/riscv/numa.h"
+#include "hw/intc/riscv_aclint.h"
+#include "hw/intc/riscv_aplic.h"
+#include "hw/intc/riscv_imsic.h"
+#include "chardev/char.h"
+#include "hw/char/serial-mm.h"
+#include "system/device_tree.h"
+#include "system/runstate.h"
+#include "system/system.h"
+#include "system/tcg.h"
+#include "system/qtest.h"
+#include "target/riscv/cpu.h"
+#include "target/riscv/pmu.h"
+#include "net/net.h"
+
+#define RVSP_CPUS_MAX_BITS             9
+#define RVSP_CPUS_MAX                  (1 << RVSP_CPUS_MAX_BITS)
+#define RVSP_SOCKETS_MAX_BITS          2
+#define RVSP_SOCKETS_MAX               (1 << RVSP_SOCKETS_MAX_BITS)
+
+#define RVSP_IRQCHIP_NUM_MSIS 255
+#define RVSP_IRQCHIP_NUM_SOURCES 96
+#define RVSP_IRQCHIP_NUM_PRIO_BITS 3
+#define RVSP_IRQCHIP_MAX_GUESTS_BITS 3
+#define RVSP_IRQCHIP_MAX_GUESTS ((1U << RVSP_IRQCHIP_MAX_GUESTS_BITS) - 1U)
+
+#define FDT_PCI_ADDR_CELLS    3
+#define FDT_PCI_INT_CELLS     1
+#define FDT_APLIC_INT_CELLS   2
+#define FDT_IMSIC_INT_CELLS   0
+#define FDT_MAX_INT_CELLS     2
+#define FDT_MAX_INT_MAP_WIDTH (FDT_PCI_ADDR_CELLS + FDT_PCI_INT_CELLS + \
+                                 1 + FDT_MAX_INT_CELLS)
+#define FDT_APLIC_INT_MAP_WIDTH (FDT_PCI_ADDR_CELLS + FDT_PCI_INT_CELLS + \
+                                 1 + FDT_APLIC_INT_CELLS)
+
+#define NUM_SATA_PORTS  6
+
+#define SYSCON_RESET     0x1
+#define SYSCON_POWEROFF  0x2
+
+#define TYPE_RVSP_REF_MACHINE MACHINE_TYPE_NAME("rvsp-ref")
+OBJECT_DECLARE_SIMPLE_TYPE(RVSPMachineState, RVSP_REF_MACHINE)
+
+struct RVSPMachineState {
+    /*< private >*/
+    MachineState parent;
+
+    /*< public >*/
+    Notifier machine_done;
+    RISCVHartArrayState soc[RVSP_SOCKETS_MAX];
+    DeviceState *irqchip[RVSP_SOCKETS_MAX];
+    PFlashCFI01 *flash[2];
+
+    int fdt_size;
+    int aia_guests;
+    const MemMapEntry *memmap;
+};
+
+enum {
+    RVSP_DEBUG,
+    RVSP_MROM,
+    RVSP_RESET_SYSCON,
+    RVSP_RTC,
+    RVSP_ACLINT,
+    RVSP_APLIC_M,
+    RVSP_APLIC_S,
+    RVSP_UART0,
+    RVSP_IMSIC_M,
+    RVSP_IMSIC_S,
+    RVSP_FLASH,
+    RVSP_DRAM,
+    RVSP_PCIE_MMIO,
+    RVSP_PCIE_PIO,
+    RVSP_PCIE_ECAM,
+    RVSP_PCIE_MMIO_HIGH
+};
+
+enum {
+    RVSP_UART0_IRQ = 10,
+    RVSP_RTC_IRQ = 11,
+    RVSP_PCIE_IRQ = 0x20, /* 32 to 35 */
+};
+
+/*
+ * The server soc reference machine physical address space used by some of the
+ * devices namely ACLINT, APLIC and IMSIC depend on number of Sockets, number
+ * of CPUs, and number of IMSIC guest files.
+ *
+ * Various limits defined by RVSP_SOCKETS_MAX_BITS, RVSP_CPUS_MAX_BITS, and
+ * RVSP_IRQCHIP_MAX_GUESTS_BITS are tuned for maximum utilization of server soc
+ * reference machine physical address space.
+ */
+
+#define RVSP_IMSIC_GROUP_MAX_SIZE      (1U << IMSIC_MMIO_GROUP_MIN_SHIFT)
+#if RVSP_IMSIC_GROUP_MAX_SIZE < \
+    IMSIC_GROUP_SIZE(RVSP_CPUS_MAX_BITS, RVSP_IRQCHIP_MAX_GUESTS_BITS)
+#error "Can't accomodate single IMSIC group in address space"
+#endif
+
+#define RVSP_IMSIC_MAX_SIZE            (RVSP_SOCKETS_MAX * \
+                                        RVSP_IMSIC_GROUP_MAX_SIZE)
+#if 0x4000000 < RVSP_IMSIC_MAX_SIZE
+#error "Can't accomodate all IMSIC groups in address space"
+#endif
+
+static const MemMapEntry rvsp_ref_memmap[] = {
+    [RVSP_DEBUG] =          {        0x0,         0x100 },
+    [RVSP_MROM] =           {     0x1000,        0xf000 },
+    [RVSP_RESET_SYSCON] =   {   0x100000,        0x1000 },
+    [RVSP_RTC] =            {   0x101000,        0x1000 },
+    [RVSP_ACLINT] =         {  0x2000000,       0x10000 },
+    [RVSP_PCIE_PIO] =       {  0x3000000,       0x10000 },

hw/riscv/server_platform_ref.c line 155

Quoted 10 lines
hw/riscv/server_platform_ref.c new file +10 -0
+    [RVSP_APLIC_M] =        {  0xc000000, APLIC_SIZE(RVSP_CPUS_MAX) },
+    [RVSP_APLIC_S] =        {  0xd000000, APLIC_SIZE(RVSP_CPUS_MAX) },
+    [RVSP_UART0] =          { 0x10000000,         0x100 },
+    [RVSP_FLASH] =          { 0x20000000,     0x4000000 },
+    [RVSP_IMSIC_M] =        { 0x24000000, RVSP_IMSIC_MAX_SIZE },
+    [RVSP_IMSIC_S] =        { 0x28000000, RVSP_IMSIC_MAX_SIZE },
+    [RVSP_PCIE_ECAM] =      { 0x30000000,    0x10000000 },
+    [RVSP_PCIE_MMIO] =      { 0x40000000,    0x40000000 },
+    [RVSP_DRAM] =           { 0x80000000, 0xff80000000ull },
+    [RVSP_PCIE_MMIO_HIGH] = { 0x10000000000ull, 0x10000000000ull },

The base address of RVSP_PCIE_MMIO_HIGH exceeds the 39-bit address space, while the satp mode of the rvsp-ref-cpu is SV39 (based on the RVA23S64).

static RISCVCPUProfile RVA23S64 = {
     .u_parent = &RVA23U64,
     .s_parent = &RVA22S64,
     .name = "rva23s64",
     .misa_ext = RVS,
     .priv_spec = PRIV_VERSION_1_13_0,
     .satp_mode = VM_1_10_SV39, /* there */
     ...
}
Quoted 4 lines

This will cause an error when EDKII processes the address mapping of PCI MMIO, but I am not yet sure whose issue this is.

I suggest setting the default value of satp_mode for rvsp-ref-cpu to SV48.

So, in the latest spec, section 2.1 RISC-V Harts:

https://github.com/riscv-non-isa/riscv-server-platform/releases/download/v0.9-rc3/riscv-server-platform.pdf

There's a set of "rules" that each hart should or can follow. Rule RVA_010 states:

"The RISC-V application processor harts in the SoC MUST support the RVA23S64 ISA profile [6]."

The next rule, RVA_020:

"The RISC-V application processor harts in the SoC MUST support the following extensions:
- Sv48
- Sdtrig [7]
- Sdext [7]
- Zkr
- Ssccfg
- Ssstrict [6]
- Ssaia [8]"

I take it that the wording used, **MUST**, indicates that RVA_020 is mandatory so we should in fact support sv48. In this case we can change the default to sv48 without problems

Drew, is this a fair interpretation? Thanks,

Daniel

Quoted 4 lines

Thanks,
Chao

#13 lore raw

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

On Tue, Nov 25, 2025 at 08:24:22AM -0300, Daniel Henrique Barboza wrote:
...

Quoted 22 lines

So, in the latest spec, section 2.1 RISC-V Harts:

https://github.com/riscv-non-isa/riscv-server-platform/releases/download/v0.9-rc3/riscv-server-platform.pdf

There's a set of "rules" that each hart should or can follow. Rule RVA_010 states:

"The RISC-V application processor harts in the SoC MUST support the RVA23S64 ISA profile [6]."

The next rule, RVA_020:

"The RISC-V application processor harts in the SoC MUST support the following extensions:
- Sv48
- Sdtrig [7]
- Sdext [7]
- Zkr
- Ssccfg
- Ssstrict [6]
- Ssaia [8]"

Quoted 5 lines

I take it that the wording used, **MUST**, indicates that RVA_020 is mandatory so we should in fact support sv48. In this case we can change the default to sv48 without problems

Drew, is this a fair interpretation? Thanks,

Yes. The server platform spec is based on rva23, but also mandates additional extensions beyond what's mandated by the profile, including sv48. (And this is why I stated the default should be sv48 when pointing out that it shouldn't be sv57[1]).

[1] https://lore.kernel.org/all/20251111-e4f4062f326aef78ef820d00@orel/

Thanks,
drew

#14 lore raw

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

In reply to Daniel Henrique Barboza
Quoted 58 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.

We do not have all the required extensions in QEMU: we're missing 'sdext'. In theory we shouldn't go ahead with this work, but the emulation as is now is proving to be useful for development and testing of other parts of the SW stack (firmware, kernel) and we would like to make it broadly available to everyone. We're contributing it as 'experimental', hopefully making it clear that the board does NOT complies 100% with [1].

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
- A new virt CPU type rvsp-ref-cpu for server platform compliance
- 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                            |   14 +
 hw/riscv/meson.build                        |    1 +
 hw/riscv/server_platform_ref.c              | 1276 +++++++++++++++++++
 4 files changed, 1292 insertions(+)
 create mode 100644 hw/riscv/server_platform_ref.c
configs/devices/riscv64-softmmu/default.mak +1 -0
index e485bbd1a3..e6075a7113 100644
@@ -9,6 +9,7 @@
 # CONFIG_SIFIVE_E=n
 # CONFIG_SIFIVE_U=n
 # CONFIG_RISCV_VIRT=n
+# CONFIG_SERVER_PLATFORM_REF=n
 # CONFIG_MICROCHIP_PFSOC=n
 # CONFIG_SHAKTI_C=n
 # CONFIG_XIANGSHAN_KUNMINGHU=n
hw/riscv/Kconfig +0 -0
index fc9c35bd98..6a5085c7a5 100644

hw/riscv/Kconfig config RISCV_VIRT · line 72

Quoted 4 lines
hw/riscv/Kconfig +1 -0
@@ -69,6 +69,20 @@ config RISCV_VIRT
     select ACPI
     select ACPI_PCI
 
+config SERVER_PLATFORM_REF

s/SERVER_PLATFORM_REF/RISCV_SERVER_PLATFORM/

Quoted 34 lines
hw/riscv/Kconfig +13 -0
+    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
+
 config SHAKTI_C
     bool
     default y
hw/riscv/meson.build +1 -0
index 2a8d5b136c..0daf77e887 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_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 +0 -0
new file mode 100644
index 0000000000..ef2891a9d7

hw/riscv/server_platform_ref.c line 2

Quoted 2 lines
hw/riscv/server_platform_ref.c new file +2 -0
@@ -0,0 +1,1276 @@
+/*
+ * QEMU RISC-V Server Platform (RVSP) Reference Board

Instead of "rvsp" name it is better to use a more obvious and meaningful full name such as "rvserver".

Quoted 143 lines
hw/riscv/server_platform_ref.c new file +143 -0
+ *
+ * Copyright (c) 2024 Intel, Inc.
+ * Copyright (c) 2025 Ventana Micro Systems Inc.
+ *
+ * This board is compliant RISC-V Server platform specification and leveraging
+ * a lot of riscv virt code.
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#include "qemu/osdep.h"
+#include "qemu/units.h"
+#include "qemu/error-report.h"
+#include "qemu/guest-random.h"
+#include "qapi/error.h"
+#include "qapi/qapi-visit-common.h"
+#include "hw/boards.h"
+#include "hw/loader.h"
+#include "hw/sysbus.h"
+#include "hw/qdev-properties.h"
+#include "hw/char/serial.h"
+#include "hw/block/flash.h"
+#include "hw/ide/pci.h"
+#include "hw/ide/ahci-pci.h"
+#include "hw/pci/pci.h"
+#include "hw/pci-host/gpex.h"
+#include "hw/core/sysbus-fdt.h"
+#include "hw/riscv/riscv_hart.h"
+#include "hw/riscv/boot.h"
+#include "hw/riscv/numa.h"
+#include "hw/intc/riscv_aclint.h"
+#include "hw/intc/riscv_aplic.h"
+#include "hw/intc/riscv_imsic.h"
+#include "chardev/char.h"
+#include "hw/char/serial-mm.h"
+#include "system/device_tree.h"
+#include "system/runstate.h"
+#include "system/system.h"
+#include "system/tcg.h"
+#include "system/qtest.h"
+#include "target/riscv/cpu.h"
+#include "target/riscv/pmu.h"
+#include "net/net.h"
+
+#define RVSP_CPUS_MAX_BITS             9
+#define RVSP_CPUS_MAX                  (1 << RVSP_CPUS_MAX_BITS)
+#define RVSP_SOCKETS_MAX_BITS          2
+#define RVSP_SOCKETS_MAX               (1 << RVSP_SOCKETS_MAX_BITS)
+
+#define RVSP_IRQCHIP_NUM_MSIS 255
+#define RVSP_IRQCHIP_NUM_SOURCES 96
+#define RVSP_IRQCHIP_NUM_PRIO_BITS 3
+#define RVSP_IRQCHIP_MAX_GUESTS_BITS 3
+#define RVSP_IRQCHIP_MAX_GUESTS ((1U << RVSP_IRQCHIP_MAX_GUESTS_BITS) - 1U)
+
+#define FDT_PCI_ADDR_CELLS    3
+#define FDT_PCI_INT_CELLS     1
+#define FDT_APLIC_INT_CELLS   2
+#define FDT_IMSIC_INT_CELLS   0
+#define FDT_MAX_INT_CELLS     2
+#define FDT_MAX_INT_MAP_WIDTH (FDT_PCI_ADDR_CELLS + FDT_PCI_INT_CELLS + \
+                                 1 + FDT_MAX_INT_CELLS)
+#define FDT_APLIC_INT_MAP_WIDTH (FDT_PCI_ADDR_CELLS + FDT_PCI_INT_CELLS + \
+                                 1 + FDT_APLIC_INT_CELLS)
+
+#define NUM_SATA_PORTS  6
+
+#define SYSCON_RESET     0x1
+#define SYSCON_POWEROFF  0x2
+
+#define TYPE_RVSP_REF_MACHINE MACHINE_TYPE_NAME("rvsp-ref")
+OBJECT_DECLARE_SIMPLE_TYPE(RVSPMachineState, RVSP_REF_MACHINE)
+
+struct RVSPMachineState {
+    /*< private >*/
+    MachineState parent;
+
+    /*< public >*/
+    Notifier machine_done;
+    RISCVHartArrayState soc[RVSP_SOCKETS_MAX];
+    DeviceState *irqchip[RVSP_SOCKETS_MAX];
+    PFlashCFI01 *flash[2];
+
+    int fdt_size;
+    int aia_guests;
+    const MemMapEntry *memmap;
+};
+
+enum {
+    RVSP_DEBUG,
+    RVSP_MROM,
+    RVSP_RESET_SYSCON,
+    RVSP_RTC,
+    RVSP_ACLINT,
+    RVSP_APLIC_M,
+    RVSP_APLIC_S,
+    RVSP_UART0,
+    RVSP_IMSIC_M,
+    RVSP_IMSIC_S,
+    RVSP_FLASH,
+    RVSP_DRAM,
+    RVSP_PCIE_MMIO,
+    RVSP_PCIE_PIO,
+    RVSP_PCIE_ECAM,
+    RVSP_PCIE_MMIO_HIGH
+};
+
+enum {
+    RVSP_UART0_IRQ = 10,
+    RVSP_RTC_IRQ = 11,
+    RVSP_PCIE_IRQ = 0x20, /* 32 to 35 */
+};
+
+/*
+ * The server soc reference machine physical address space used by some of the
+ * devices namely ACLINT, APLIC and IMSIC depend on number of Sockets, number
+ * of CPUs, and number of IMSIC guest files.
+ *
+ * Various limits defined by RVSP_SOCKETS_MAX_BITS, RVSP_CPUS_MAX_BITS, and
+ * RVSP_IRQCHIP_MAX_GUESTS_BITS are tuned for maximum utilization of server soc
+ * reference machine physical address space.
+ */
+
+#define RVSP_IMSIC_GROUP_MAX_SIZE      (1U << IMSIC_MMIO_GROUP_MIN_SHIFT)
+#if RVSP_IMSIC_GROUP_MAX_SIZE < \
+    IMSIC_GROUP_SIZE(RVSP_CPUS_MAX_BITS, RVSP_IRQCHIP_MAX_GUESTS_BITS)
+#error "Can't accomodate single IMSIC group in address space"
+#endif
+
+#define RVSP_IMSIC_MAX_SIZE            (RVSP_SOCKETS_MAX * \
+                                        RVSP_IMSIC_GROUP_MAX_SIZE)
+#if 0x4000000 < RVSP_IMSIC_MAX_SIZE
+#error "Can't accomodate all IMSIC groups in address space"
+#endif
+
+static const MemMapEntry rvsp_ref_memmap[] = {
+    [RVSP_DEBUG] =          {        0x0,         0x100 },
+    [RVSP_MROM] =           {     0x1000,        0xf000 },
+    [RVSP_RESET_SYSCON] =   {   0x100000,        0x1000 },
+    [RVSP_RTC] =            {   0x101000,        0x1000 },
+    [RVSP_ACLINT] =         {  0x2000000,       0x10000 },
+    [RVSP_PCIE_PIO] =       {  0x3000000,       0x10000 },

hw/riscv/server_platform_ref.c line 155

Quoted 10 lines
hw/riscv/server_platform_ref.c new file +10 -0
+    [RVSP_APLIC_M] =        {  0xc000000, APLIC_SIZE(RVSP_CPUS_MAX) },
+    [RVSP_APLIC_S] =        {  0xd000000, APLIC_SIZE(RVSP_CPUS_MAX) },
+    [RVSP_UART0] =          { 0x10000000,         0x100 },
+    [RVSP_FLASH] =          { 0x20000000,     0x4000000 },
+    [RVSP_IMSIC_M] =        { 0x24000000, RVSP_IMSIC_MAX_SIZE },
+    [RVSP_IMSIC_S] =        { 0x28000000, RVSP_IMSIC_MAX_SIZE },
+    [RVSP_PCIE_ECAM] =      { 0x30000000,    0x10000000 },
+    [RVSP_PCIE_MMIO] =      { 0x40000000,    0x40000000 },
+    [RVSP_DRAM] =           { 0x80000000, 0xff80000000ull },
+    [RVSP_PCIE_MMIO_HIGH] = { 0x10000000000ull, 0x10000000000ull },

I think goal should be to have minimal possible MMIO devices in "rvserver" and wherever required prefer PCIe devices or RPMI messaging protocol. The "rvserver" must always have an IOMMU as well. In general, the bar for adding MMIO device in "rvserver" should be really high.

My suggestion is to drop the RESET_SYSCON and FLASH devices in-favor of the RPMI system reset service group and RPMI MM service group. Also, with RPMI support in "rvserver", we can have graceful shutdown and reboot available using system MSIs. In other words, "rvserver" should have RPMI shared memory transport emulated by QEMU using the librpmi project.

For distros friendly boot flow, we can use U-Boot SPL as the bios such that U-Boot SPL will load FIT image from ESP (EFI system partition) of some PCIe storage device (as described in the EBBR specification). The FIT image will contain OpenSBI and the final bootloader where the final bootloader can be regular U-Boot or EDK2.

In fact, we (Ventana) have an internal PoC based on the above suggestions which helps us use unmodified Ubuntu RISC-V distributed by Canonical.

Regards,
Anup

#15 lore raw

PATCH v4 4/5 hw/riscv/server_platform_ref.c: add riscv-iommu-sys

In reply to Daniel Henrique Barboza

Add an always present IOMMU platform device for the rvsp-ref board.

The IRQs being used are similar to what the 'virt' board is using: IRQs 36 to 39, one IRQ for queue.

---
 hw/riscv/Kconfig               |  1 +
 hw/riscv/server_platform_ref.c | 78 ++++++++++++++++++++++++++++++++--
 2 files changed, 75 insertions(+), 4 deletions(-)
hw/riscv/Kconfig +1 -0
index 6a5085c7a5..4f8cbfe77f 100644
@@ -82,6 +82,7 @@ config SERVER_PLATFORM_REF
     select RISCV_ACLINT
     select RISCV_APLIC
     select RISCV_IMSIC
+    select RISCV_IOMMU
 
 config SHAKTI_C
     bool
hw/riscv/server_platform_ref.c +74 -4

138 lines not on this page · raw message

Signature · 1 line
2.51.1
Reviewed-by on v4 4/5
#16 lore raw

Re: [PATCH v4 4/5] hw/riscv/server_platform_ref.c: add riscv-iommu-sys

Quoted 11 lines · Daniel Henrique Barboza

Add an always present IOMMU platform device for the rvsp-ref board.

The IRQs being used are similar to what the 'virt' board is using: IRQs 36 to 39, one IRQ for queue.

---
  hw/riscv/Kconfig               |  1 +
  hw/riscv/server_platform_ref.c | 78 ++++++++++++++++++++++++++++++++--
  2 files changed, 75 insertions(+), 4 deletions(-)
#17 lore raw

PATCH v4 5/5 docs: add rvsp-ref.rst

In reply to Daniel Henrique Barboza

Add documentation on the new experimental board rvsp-ref.

---
 docs/system/riscv/rvsp-ref.rst | 28 ++++++++++++++++++++++++++++
 docs/system/target-riscv.rst   |  1 +
 2 files changed, 29 insertions(+)
 create mode 100644 docs/system/riscv/rvsp-ref.rst
docs/system/riscv/rvsp-ref.rst new file +28 -0
new file mode 100644
index 0000000000..3889fce413
@@ -0,0 +1,28 @@
+Experimental RISC-V Server Platform Reference board (``rvsp-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.
+
+The main features included in rvsp-ref are:
+
+*  a new CPU type rvsp-ref CPU for server platform compliance
+* AIA
+* PCIe AHCI
+* PCIe NIC
+* No virtio mmio bus
+* No fw_cfg device
+* No ACPI table
+* Minimal device tree nodes
+
+The board is being provisioned as *experimental* because QEMU isn't
+100% compliant with the specification at this moment - we do not have
+support for the mandatory 'sdext' extension. The existence of the board
+is beneficial to the development of the ecossystem around the specification,
+so we're choosing the make the board available even in an incomplete state.
+When 'sdext' is implemented we'll remove the 'experimental' tag from it.
+
+.. _spec: https://github.com/riscv-non-isa/riscv-server-platform
docs/system/target-riscv.rst +1 -0
index 89b2cb732c..2ed337c8cf 100644
@@ -72,6 +72,7 @@ undocumented; you can get a complete list by running
    riscv/sifive_u
    riscv/virt
    riscv/xiangshan-kunminghu
+   riscv/rvsp-ref
 
 RISC-V CPU firmware
 -------------------
Signature · 1 line
2.51.1
#18 lore raw

Re: [PATCH v4 5/5] docs: add rvsp-ref.rst

Quoted 31 lines · Daniel Henrique Barboza

Add documentation on the new experimental board rvsp-ref.

---
 docs/system/riscv/rvsp-ref.rst | 28 ++++++++++++++++++++++++++++
 docs/system/target-riscv.rst   |  1 +
 2 files changed, 29 insertions(+)
 create mode 100644 docs/system/riscv/rvsp-ref.rst
docs/system/riscv/rvsp-ref.rst new file +16 -0
new file mode 100644
index 0000000000..3889fce413
@@ -0,0 +1,28 @@
+Experimental RISC-V Server Platform Reference board (``rvsp-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.
+
+The main features included in rvsp-ref are:
+
+*  a new CPU type rvsp-ref CPU for server platform compliance
+* AIA
+* PCIe AHCI
+* PCIe NIC
+* No virtio mmio bus

docs/system/riscv/rvsp-ref.rst line 26

Quoted 10 lines
docs/system/riscv/rvsp-ref.rst new file +10 -0
+* No fw_cfg device
+* No ACPI table
+* Minimal device tree nodes
+
+The board is being provisioned as *experimental* because QEMU isn't
+100% compliant with the specification at this moment - we do not have
+support for the mandatory 'sdext' extension. The existence of the board
+is beneficial to the development of the ecossystem around the specification,
+so we're choosing the make the board available even in an incomplete state.
+When 'sdext' is implemented we'll remove the 'experimental' tag from it.

'experimental' needs to stay until the 1.0 spec is ratified. Or, see my comments in a previous patch about versioning the board instead.

Thanks,
drew

Quoted 18 lines
docs/system/riscv/rvsp-ref.rst new file +2 -0
+
+.. _spec: https://github.com/riscv-non-isa/riscv-server-platform
docs/system/target-riscv.rst +1 -0
index 89b2cb732c..2ed337c8cf 100644
@@ -72,6 +72,7 @@ undocumented; you can get a complete list by running
    riscv/sifive_u
    riscv/virt
    riscv/xiangshan-kunminghu
+   riscv/rvsp-ref
 
 RISC-V CPU firmware
 -------------------
Signature · 1 line
2.51.1
#19 lore raw

Re: [PATCH v4 5/5] docs: add rvsp-ref.rst

In reply to Daniel Henrique Barboza
Quoted 17 lines · Daniel Henrique Barboza

Add documentation on the new experimental board rvsp-ref.

---
docs/system/riscv/rvsp-ref.rst | 28 ++++++++++++++++++++++++++++
docs/system/target-riscv.rst | 1 +

2 files changed, 29 insertions(+)

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

docs/system/riscv/rvsp-ref.rst new file +2 -0
new file mode 100644
index 0000000000..3889fce413
@@ -0,0 +1,28 @@
+Experimental RISC-V Server Platform Reference board (``rvsp-ref``)
+==================================================================

docs/system/riscv/rvsp-ref.rst line 12

Quoted 10 lines
docs/system/riscv/rvsp-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.
+
+The main features included in rvsp-ref are:
+
+*  a new CPU type rvsp-ref CPU for server platform compliance

There is an extra space before the character "a", which can be removed.

Thanks,
Chao

Quoted 7 lines
docs/system/riscv/rvsp-ref.rst new file +7 -0
+* AIA
+* PCIe AHCI
+* PCIe NIC
+* No virtio mmio bus
+* No fw_cfg device
+* No ACPI table
+* Minimal device tree nodes