Skip to contentSkip to conversation

RISC-V: Deprecate hifive_e and hifive_u machines

PATCH In review Palmer Dabbelt 2 participants 3 messages Nov 21, 2018 – Nov 26, 2018

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

PATCH 1/1 RISC-V: Deprecate hifive_e and hifive_u machines

These machines had names that were too general: there are many E and U machines, and it's easy for users to get confused about which one is which. The one configuration that can faithfully match an existing ASIC-based board has been renamed to 'sifive-hifive1', we'll work through the emulation fidelity issues apparent in the other targets before adding machines for those.

---
 hw/riscv/sifive_e.c  | 26 ++++++++++++++++++++++++--
 hw/riscv/sifive_u.c  |  2 ++
 qemu-deprecated.texi |  7 +++++++
 3 files changed, 33 insertions(+), 2 deletions(-)
hw/riscv/sifive_e.c +24 -2
index cb513cc3bb50..439d20e0efe7 100644
@@ -95,7 +95,7 @@ static void sifive_mmio_emulate(MemoryRegion *parent, const char *name,
     memory_region_add_subregion(parent, offset, mock_mmio);
 }
 
-static void riscv_sifive_e_init(MachineState *machine)
+static void riscv_sifive_hifive1_init(MachineState *machine)
 {
     const struct MemmapEntry *memmap = sifive_e_memmap;
 
@@ -135,6 +135,17 @@ static void riscv_sifive_e_init(MachineState *machine)
     }
 }
 
+static void riscv_sifive_e_init(MachineState *machine)
+{
+#if defined(TARGET_RISCV32)
+    warn_report("The sifive_e machine is deprecated in favor of sifive-hifive1");
+#else
+    warn_report("The sifive_e machine is deprecated.");
+#endif
+
+    return riscv_sifive_hifive1_init(machine);
+}
+
 static void riscv_sifive_e_soc_init(Object *obj)
 {
     SiFiveESoCState *s = RISCV_E_SOC(obj);
@@ -213,13 +224,24 @@ static void riscv_sifive_e_soc_realize(DeviceState *dev, Error **errp)
 
 static void riscv_sifive_e_machine_init(MachineClass *mc)
 {
-    mc->desc = "RISC-V Board compatible with SiFive E SDK";
+    mc->desc = "(deprecated) RISC-V Board compatible with SiFive E SDK";
     mc->init = riscv_sifive_e_init;
     mc->max_cpus = 1;
 }
 
 DEFINE_MACHINE("sifive_e", riscv_sifive_e_machine_init)
 
+#if defined(TARGET_RISCV32)
+static void riscv_sifive_hifive1_machine_init(MachineClass *mc)
+{
+    mc->desc = "SiFive's HiFive1 Development Board";
+    mc->init = riscv_sifive_hifive1_init;
+    mc->max_cpus = 1;
+}
+
+DEFINE_MACHINE("sifive-hifive1", riscv_sifive_hifive1_machine_init)
+#endif
+
 static void riscv_sifive_e_soc_class_init(ObjectClass *oc, void *data)
 {
     DeviceClass *dc = DEVICE_CLASS(oc);
hw/riscv/sifive_u.c +2 -0
index ef07df244241..0ce6a9dd2609 100644
@@ -238,6 +238,8 @@ static void create_fdt(SiFiveUState *s, const struct MemmapEntry *memmap,
 
 static void riscv_sifive_u_init(MachineState *machine)
 {
+    warn_report("The sifive_u machine is deprecated.");
+
     const struct MemmapEntry *memmap = sifive_u_memmap;
 
     SiFiveUState *s = g_new0(SiFiveUState, 1);
qemu-deprecated.texi +7 -0
index cb4291f1e5bc..f50696d3dc53 100644
@@ -148,6 +148,13 @@ This machine type uses an unmaintained firmware, broken in lots of ways,
 and unable to start post-2004 operating systems. 40p machine type should be
 used instead.
 
+@subsection sifive_e and sifive_u (RISC-V) (since 3.2)
+
+The names for these machine types are a bit too ambiguous.  The 32-bit sifive_e
+machine has been replaced by the 'sifive-hifive1' machine, which closely
+matches that hardware.  The 'virt' machine type should be used instead of all
+others.
+
 @section Device options
 
 @subsection Block device options
Signature · 1 line
2.18.1
#1 lore raw

Hi,

Quoted 76 lines · Palmer Dabbelt

These machines had names that were too general: there are many E and U machines, and it's easy for users to get confused about which one is which. The one configuration that can faithfully match an existing ASIC-based board has been renamed to 'sifive-hifive1', we'll work through the emulation fidelity issues apparent in the other targets before adding machines for those.

---
 hw/riscv/sifive_e.c  | 26 ++++++++++++++++++++++++--
 hw/riscv/sifive_u.c  |  2 ++
 qemu-deprecated.texi |  7 +++++++
 3 files changed, 33 insertions(+), 2 deletions(-)
hw/riscv/sifive_e.c +24 -2
index cb513cc3bb50..439d20e0efe7 100644
@@ -95,7 +95,7 @@ static void sifive_mmio_emulate(MemoryRegion *parent, const char *name,
     memory_region_add_subregion(parent, offset, mock_mmio);
 }
 
-static void riscv_sifive_e_init(MachineState *machine)
+static void riscv_sifive_hifive1_init(MachineState *machine)
 {
     const struct MemmapEntry *memmap = sifive_e_memmap;
 
@@ -135,6 +135,17 @@ static void riscv_sifive_e_init(MachineState *machine)
     }
 }
 
+static void riscv_sifive_e_init(MachineState *machine)
+{
+#if defined(TARGET_RISCV32)
+    warn_report("The sifive_e machine is deprecated in favor of sifive-hifive1");
+#else
+    warn_report("The sifive_e machine is deprecated.");
+#endif
+
+    return riscv_sifive_hifive1_init(machine);
+}
+
 static void riscv_sifive_e_soc_init(Object *obj)
 {
     SiFiveESoCState *s = RISCV_E_SOC(obj);
@@ -213,13 +224,24 @@ static void riscv_sifive_e_soc_realize(DeviceState *dev, Error **errp)
 
 static void riscv_sifive_e_machine_init(MachineClass *mc)
 {
-    mc->desc = "RISC-V Board compatible with SiFive E SDK";
+    mc->desc = "(deprecated) RISC-V Board compatible with SiFive E SDK";
     mc->init = riscv_sifive_e_init;
     mc->max_cpus = 1;
 }
 
 DEFINE_MACHINE("sifive_e", riscv_sifive_e_machine_init)
 
+#if defined(TARGET_RISCV32)
+static void riscv_sifive_hifive1_machine_init(MachineClass *mc)
+{
+    mc->desc = "SiFive's HiFive1 Development Board";
+    mc->init = riscv_sifive_hifive1_init;
+    mc->max_cpus = 1;
+}
+
+DEFINE_MACHINE("sifive-hifive1", riscv_sifive_hifive1_machine_init)
+#endif
+
 static void riscv_sifive_e_soc_class_init(ObjectClass *oc, void *data)
 {
     DeviceClass *dc = DEVICE_CLASS(oc);
hw/riscv/sifive_u.c +0 -0
index ef07df244241..0ce6a9dd2609 100644

hw/riscv/sifive_u.c static void create_fdt(SiFiveUState *s, const struct MemmapEntry *memmap, · line 241

Quoted 4 lines
hw/riscv/sifive_u.c +1 -0
@@ -238,6 +238,8 @@ static void create_fdt(SiFiveUState *s, const struct MemmapEntry *memmap,
 
 static void riscv_sifive_u_init(MachineState *machine)
 {
+    warn_report("The sifive_u machine is deprecated.");

FWIW, you can also simply set MachineClass->deprecation_reason nowadays instead of manually issuing a warn_report() and tweaking the description ... that would be a little bit easier and is in sync with the other deprecated boards (see e.g. commit 08fe68244 or 54c86f5a4844d51 for other examples).

Thomas

#2 lore raw
Quoted 80 lines · On Thu, 22 Nov 2018 00:44:32 PST (-0800), [email protected] wrote:

Hi,

Quoted 77 lines · Palmer Dabbelt

These machines had names that were too general: there are many E and U machines, and it's easy for users to get confused about which one is which. The one configuration that can faithfully match an existing ASIC-based board has been renamed to 'sifive-hifive1', we'll work through the emulation fidelity issues apparent in the other targets before adding machines for those.

---
 hw/riscv/sifive_e.c  | 26 ++++++++++++++++++++++++--
 hw/riscv/sifive_u.c  |  2 ++
 qemu-deprecated.texi |  7 +++++++
 3 files changed, 33 insertions(+), 2 deletions(-)
hw/riscv/sifive_e.c +24 -2
index cb513cc3bb50..439d20e0efe7 100644
@@ -95,7 +95,7 @@ static void sifive_mmio_emulate(MemoryRegion *parent, const char *name,
     memory_region_add_subregion(parent, offset, mock_mmio);
 }
 
-static void riscv_sifive_e_init(MachineState *machine)
+static void riscv_sifive_hifive1_init(MachineState *machine)
 {
     const struct MemmapEntry *memmap = sifive_e_memmap;
 
@@ -135,6 +135,17 @@ static void riscv_sifive_e_init(MachineState *machine)
     }
 }
 
+static void riscv_sifive_e_init(MachineState *machine)
+{
+#if defined(TARGET_RISCV32)
+    warn_report("The sifive_e machine is deprecated in favor of sifive-hifive1");
+#else
+    warn_report("The sifive_e machine is deprecated.");
+#endif
+
+    return riscv_sifive_hifive1_init(machine);
+}
+
 static void riscv_sifive_e_soc_init(Object *obj)
 {
     SiFiveESoCState *s = RISCV_E_SOC(obj);
@@ -213,13 +224,24 @@ static void riscv_sifive_e_soc_realize(DeviceState *dev, Error **errp)
 
 static void riscv_sifive_e_machine_init(MachineClass *mc)
 {
-    mc->desc = "RISC-V Board compatible with SiFive E SDK";
+    mc->desc = "(deprecated) RISC-V Board compatible with SiFive E SDK";
     mc->init = riscv_sifive_e_init;
     mc->max_cpus = 1;
 }
 
 DEFINE_MACHINE("sifive_e", riscv_sifive_e_machine_init)
 
+#if defined(TARGET_RISCV32)
+static void riscv_sifive_hifive1_machine_init(MachineClass *mc)
+{
+    mc->desc = "SiFive's HiFive1 Development Board";
+    mc->init = riscv_sifive_hifive1_init;
+    mc->max_cpus = 1;
+}
+
+DEFINE_MACHINE("sifive-hifive1", riscv_sifive_hifive1_machine_init)
+#endif
+
 static void riscv_sifive_e_soc_class_init(ObjectClass *oc, void *data)
 {
     DeviceClass *dc = DEVICE_CLASS(oc);
hw/riscv/sifive_u.c +0 -0
index ef07df244241..0ce6a9dd2609 100644
@@ -238,6 +238,8 @@ static void create_fdt(SiFiveUState *s, const struct MemmapEntry *memmap,
 
Quoted 9 lines

hw/riscv/sifive_u.c static void create_fdt(SiFiveUState *s, const struct MemmapEntry *memmap, · line 241

Quoted 3 lines
hw/riscv/sifive_u.c +1 -0
 static void riscv_sifive_u_init(MachineState *machine)
 {
+    warn_report("The sifive_u machine is deprecated.");

FWIW, you can also simply set MachineClass->deprecation_reason nowadays instead of manually issuing a warn_report() and tweaking the description ... that would be a little bit easier and is in sync with the other deprecated boards (see e.g. commit 08fe68244 or 54c86f5a4844d51 for other examples).

Perfect, thanks! I couldn't find anything when grepping around, the explicit warning seemed a bit ugly.

I'll spin another patch set.