Hi,

On 7/9/2026 12:12 AM, jack wang wrote:
From: Jack Wang <[email protected]>

Replace the "rmu" create_unimplemented_device() stub with a real
K230RmuState instance mapped at the K230_DEV_RMU memmap entry, select
K230_RMU from the K230 Kconfig, and document the device.

So, as I said in patch 1, applying this patch will fix the qtest that you
introduced there.  I believe we want to either squash this patch in patch
1 or move the qtest creation to this patch.  Both are fine to me.


Closes: gevico/qemu-camp-2026-k230#11

Not sure what gevico is (seems like a bootcamp, according to Google at least)  
but
the "Closes" tag usually contains a gitlab bug or any other link that is 
publicly
available.  It's better to remove it.


Thanks,
Daniel


Signed-off-by: Jack Wang <[email protected]>
---
  docs/system/riscv/k230.rst |  1 +
  hw/riscv/Kconfig           |  1 +
  hw/riscv/k230.c            | 10 +++++++---
  include/hw/riscv/k230.h    |  2 ++
  4 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/docs/system/riscv/k230.rst b/docs/system/riscv/k230.rst
index cea8202e55..3f2313a127 100644
--- a/docs/system/riscv/k230.rst
+++ b/docs/system/riscv/k230.rst
@@ -19,6 +19,7 @@ The ``k230`` machine supports the following devices:
  * Core Local Interruptor (CLINT)
  * Platform-Level Interrupt Controller (PLIC)
  * 2 K230 Watchdog Timer
+* K230 Reset Management Unit (RMU)
  * 5 UART
Boot options
diff --git a/hw/riscv/Kconfig b/hw/riscv/Kconfig
index 54e41a6afc..bffa4e69c8 100644
--- a/hw/riscv/Kconfig
+++ b/hw/riscv/Kconfig
@@ -149,3 +149,4 @@ config K230
      select SERIAL_MM
      select UNIMP
      select K230_WDT
+    select K230_RMU
diff --git a/hw/riscv/k230.c b/hw/riscv/k230.c
index 502281c52c..b55e90c0d2 100644
--- a/hw/riscv/k230.c
+++ b/hw/riscv/k230.c
@@ -110,6 +110,7 @@ static void k230_soc_init(Object *obj)
      object_initialize_child(obj, "c908-cpu", cpu0, TYPE_RISCV_HART_ARRAY);
      object_initialize_child(obj, "k230-wdt0", &s->wdt[0], TYPE_K230_WDT);
      object_initialize_child(obj, "k230-wdt1", &s->wdt[1], TYPE_K230_WDT);
+    object_initialize_child(obj, "k230-rmu",  &s->rmu,    TYPE_K230_RMU);
qdev_prop_set_uint32(DEVICE(cpu0), "hartid-base", 0);
      qdev_prop_set_string(DEVICE(cpu0), "cpu-type", TYPE_RISCV_CPU_THEAD_C908);
@@ -206,6 +207,12 @@ static void k230_soc_realize(DeviceState *dev, Error 
**errp)
      sysbus_connect_irq(SYS_BUS_DEVICE(&s->wdt[1]), 0,
                         qdev_get_gpio_in(DEVICE(s->c908_plic), K230_WDT1_IRQ));
+ /* RMU (reset management unit) */
+    if (!sysbus_realize(SYS_BUS_DEVICE(&s->rmu), errp)) {
+        return;
+    }
+    sysbus_mmio_map(SYS_BUS_DEVICE(&s->rmu), 0, memmap[K230_DEV_RMU].base);
+
      /* unimplemented devices */
      create_unimplemented_device("kpu.l2-cache",
                                  memmap[K230_DEV_KPU_L2_CACHE].base,
@@ -268,9 +275,6 @@ static void k230_soc_realize(DeviceState *dev, Error **errp)
      create_unimplemented_device("cmu", memmap[K230_DEV_CMU].base,
                                  memmap[K230_DEV_CMU].size);
- create_unimplemented_device("rmu", memmap[K230_DEV_RMU].base,
-                                memmap[K230_DEV_RMU].size);
-
      create_unimplemented_device("boot", memmap[K230_DEV_BOOT].base,
                                  memmap[K230_DEV_BOOT].size);
diff --git a/include/hw/riscv/k230.h b/include/hw/riscv/k230.h
index 592e1c26bf..13f2a1ab0b 100644
--- a/include/hw/riscv/k230.h
+++ b/include/hw/riscv/k230.h
@@ -18,6 +18,7 @@
  #include "hw/core/boards.h"
  #include "hw/riscv/riscv_hart.h"
  #include "hw/watchdog/k230_wdt.h"
+#include "hw/misc/k230_rmu.h"
#define C908_CPU_HARTID (0) @@ -33,6 +34,7 @@ typedef struct K230SoCState {
      RISCVHartArrayState c908_cpu; /* Small core */
K230WdtState wdt[2];
+    K230RmuState rmu;
      MemoryRegion sram;
      MemoryRegion bootrom;


Reply via email to