QEMU-Riscv Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH 2/2] hw/riscv/k230: wire up the RMU device
       [not found] <20260709031237.21284-1-163wangjack@gmail.com>
@ 2026-07-09  3:12 ` jack wang
  2026-07-16 17:56   ` Daniel Henrique Barboza
  2026-07-15 11:56 ` [RFC PATCH 0/2] *** Add k230 reset management unit support *** Jack wang
       [not found] ` <20260709031237.21284-2-163wangjack@gmail.com>
  2 siblings, 1 reply; 7+ messages in thread
From: jack wang @ 2026-07-09  3:12 UTC (permalink / raw)
  To: qemu-devel
  Cc: Jack Wang, Chao Liu, Pierrick Bouvier, Paolo Bonzini,
	Palmer Dabbelt, Alistair Francis, Weiwei Li,
	Daniel Henrique Barboza, Liu Zhiwei, open list:K230 Machines

From: Jack Wang <163wangjack@gmail.com>

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.

Closes: gevico/qemu-camp-2026-k230#11
Signed-off-by: Jack Wang <163wangjack@gmail.com>
---
 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;
 
-- 
2.53.0



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [RFC PATCH 0/2] *** Add k230 reset management unit support ***
       [not found] <20260709031237.21284-1-163wangjack@gmail.com>
  2026-07-09  3:12 ` [RFC PATCH 2/2] hw/riscv/k230: wire up the RMU device jack wang
@ 2026-07-15 11:56 ` Jack wang
       [not found] ` <20260709031237.21284-2-163wangjack@gmail.com>
  2 siblings, 0 replies; 7+ messages in thread
From: Jack wang @ 2026-07-15 11:56 UTC (permalink / raw)
  To: qemu-devel
  Cc: chao.liu.zevorn, pierrick.bouvier, pbonzini, palmer,
	alistair.francis, liwei1518, daniel.barboza, zhiwei_liu, farosas,
	lvivier, qemu-riscv

Hi all,

A polite ping for this RFC series. 
Could anyone please take a look when you have a moment? Any feedback or guidance would be greatly appreciated.

Thanks,
Jack Wang

> 2026年7月9日 11:12,jack wang <163wangjack@gmail.com> 写道:
> 
> From: Jack Wang <163wangjack@gmail.com>
> 
> This series adds support for reset management unit found on k230 soc and 
> successfully  wires it up to k230 machine;
> 
> The register design are implemented based on k230 trm and linux reset driver
> (drivers/reset/reset-k230.c)
> 
> detailed implementations:
> 1. write-enable mask for control registers(strobe in the upper 16 bits)
> 2. hardware auto-clearing for reset and flush request bits
> 3. latching of Done bits and w1c logic
> 4. qtest coverage for register read/write behaviors and hardware state modelin
> 
> There are some checkpatch style warnings (line length, comment
> formatting) that will be addressed in v2 based on reviewer feedback.
> 
> this is my first time for hardware-unit modeling so apologies for possible mistake.
> I am apprecitated for any feedback
> 
> Jack Wang (2):
>  hw/misc/k230_rmu: add Kendryte K230 Reset Management Unit model
>  hw/riscv/k230: wire up the RMU device
> 
> docs/system/riscv/k230.rst  |   1 +
> hw/misc/Kconfig             |   3 +
> hw/misc/k230_rmu.c          | 280 ++++++++++++++++++++++++++++++++++++
> hw/misc/meson.build         |   1 +
> hw/misc/trace-events        |   6 +
> hw/riscv/Kconfig            |   1 +
> hw/riscv/k230.c             |  10 +-
> include/hw/misc/k230_rmu.h  |  76 ++++++++++
> include/hw/riscv/k230.h     |   2 +
> tests/qtest/k230-rmu-test.c | 125 ++++++++++++++++
> tests/qtest/meson.build     |   3 +-
> 11 files changed, 504 insertions(+), 4 deletions(-)
> create mode 100644 hw/misc/k230_rmu.c
> create mode 100644 include/hw/misc/k230_rmu.h
> create mode 100644 tests/qtest/k230-rmu-test.c
> 
> -- 
> 2.53.0
> 



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [RFC PATCH 2/2] hw/riscv/k230: wire up the RMU device
  2026-07-09  3:12 ` [RFC PATCH 2/2] hw/riscv/k230: wire up the RMU device jack wang
@ 2026-07-16 17:56   ` Daniel Henrique Barboza
  2026-07-17 13:41     ` Chao Liu
  0 siblings, 1 reply; 7+ messages in thread
From: Daniel Henrique Barboza @ 2026-07-16 17:56 UTC (permalink / raw)
  To: jack wang, qemu-devel
  Cc: Chao Liu, Pierrick Bouvier, Paolo Bonzini, Palmer Dabbelt,
	Alistair Francis, Weiwei Li, Liu Zhiwei, open list:K230 Machines

Hi,

On 7/9/2026 12:12 AM, jack wang wrote:
> From: Jack Wang <163wangjack@gmail.com>
> 
> 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 <163wangjack@gmail.com>
> ---
>   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;
>   



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [RFC PATCH 1/2] hw/misc/k230_rmu: add Kendryte K230 Reset Management Unit model
       [not found] ` <20260709031237.21284-2-163wangjack@gmail.com>
@ 2026-07-17 10:11   ` Junze Cao
  0 siblings, 0 replies; 7+ messages in thread
From: Junze Cao @ 2026-07-17 10:11 UTC (permalink / raw)
  To: Jack Wang
  Cc: Junze Cao, qemu-devel, qemu-riscv, Chao Liu, Paolo Bonzini,
	Fabiano Rosas, Laurent Vivier

Hi Wang,

Thanks for working on the K230 RMU model.

I reviewed this series against the K230 TRM and the upstream Linux
reset-k230 driver. The series builds and the supplied qtest passes, but
I found several issues that should be addressed in v2.

1. The RMU currently acknowledges reset requests without actually
resetting the target devices. Please connect at least the existing K230
watchdog devices and add a qtest which verifies that their state is
reset through the RMU.

2. The register reset state does not match the TRM. Please initialize
each modelled register with its documented reset value and update the
reset-value test accordingly.

3. Some register access permissions and reset types are incorrect. In
particular, some upper SW_DONE reset lines cannot be changed, reserved
bits are writable, and CPU1 is treated as self-clearing even though it
requires separate assert and deassert operations.

4. Patch 1 adds k230-rmu-test while the K230 machine still uses the
unimplemented RMU stub. K230_RMU is enabled and wired only by patch 2,
so patch 1 cannot pass its own test when checked out independently.
Please reorder the changes, move the test to patch 2, or squash the two
patches.

5. The new source, header and qtest files should be added to the K230
section in MAINTAINERS. Please address the checkpatch errors and
warnings before sending v2 as well.

6. Please consider modelling the reset timing registers. At minimum,
their reset values and writable fields should be represented. Real-time
delays may remain simplified if the zero-latency behavior is documented
and preserves guest-visible ordering.

7. Please add coverage for the corrected reset values, CPU1
transitions, upper SW_DONE fields, reserved bits, and reset propagation
to the watchdogs.

Regards,
Junze Cao


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [RFC PATCH 2/2] hw/riscv/k230: wire up the RMU device
  2026-07-16 17:56   ` Daniel Henrique Barboza
@ 2026-07-17 13:41     ` Chao Liu
  2026-07-17 13:56       ` Daniel Henrique Barboza
  0 siblings, 1 reply; 7+ messages in thread
From: Chao Liu @ 2026-07-17 13:41 UTC (permalink / raw)
  To: Daniel Henrique Barboza
  Cc: jack wang, qemu-devel, Pierrick Bouvier, Paolo Bonzini,
	Palmer Dabbelt, Alistair Francis, Weiwei Li, Liu Zhiwei,
	open list:K230 Machines

On Thu, Jul 16, 2026 at 02:56:30PM +0800, Daniel Henrique Barboza wrote:

Hi Daniel,
> Hi,
> 
> On 7/9/2026 12:12 AM, jack wang wrote:
> > From: Jack Wang <163wangjack@gmail.com>
> > 
> > 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.
> 
I believe this link refers to:
https://github.com/gevico/qemu-camp-2026-k230/issues/11

However, according to the QEMU development collaboration workflow,
we don't need to add it.

Gevico, here is the English transliteration for the Chinese "格维". This
is a major open-source community in China focused on technical software,
which I currently organize and own.

Within our community, we run a QEMU technical training camp primarily
centered on the RISC-V architecture and exploratory work regarding
GPGPU microarchitecture.

One of our key projects involves hardware modeling for the K230, where
we are implementing a digital satellite-borne computer. The recent
contributions seen upstream were primarily patches sent by participants
of this project. We are currently in the process of contributing our
results from this stage to the QEMU upstream.

If you are interested in this, you can visit the link below.
https://qemu.gevico.online/tutorial/2026/ch3/qemu-k230/

Thanks,
Chao
> 
> Thanks,
> Daniel
> 
> 
> > Signed-off-by: Jack Wang <163wangjack@gmail.com>
> > ---
> >   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;
> 


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [RFC PATCH 2/2] hw/riscv/k230: wire up the RMU device
  2026-07-17 13:41     ` Chao Liu
@ 2026-07-17 13:56       ` Daniel Henrique Barboza
  2026-07-17 14:04         ` Chao Liu
  0 siblings, 1 reply; 7+ messages in thread
From: Daniel Henrique Barboza @ 2026-07-17 13:56 UTC (permalink / raw)
  To: Chao Liu
  Cc: jack wang, qemu-devel, Pierrick Bouvier, Paolo Bonzini,
	Palmer Dabbelt, Alistair Francis, Weiwei Li, Liu Zhiwei,
	open list:K230 Machines



On 7/17/2026 10:41 AM, Chao Liu wrote:
> On Thu, Jul 16, 2026 at 02:56:30PM +0800, Daniel Henrique Barboza wrote:
> 
> Hi Daniel,
>> Hi,
>>
>> On 7/9/2026 12:12 AM, jack wang wrote:
>>> From: Jack Wang <163wangjack@gmail.com>
>>>
>>> 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.
>>
> I believe this link refers to:
> https://github.com/gevico/qemu-camp-2026-k230/issues/11
> 
> However, according to the QEMU development collaboration workflow,
> we don't need to add it.
> 
> Gevico, here is the English transliteration for the Chinese "格维". This
> is a major open-source community in China focused on technical software,
> which I currently organize and own.
> 
> Within our community, we run a QEMU technical training camp primarily
> centered on the RISC-V architecture and exploratory work regarding
> GPGPU microarchitecture.
> 
> One of our key projects involves hardware modeling for the K230, where
> we are implementing a digital satellite-borne computer. The recent
> contributions seen upstream were primarily patches sent by participants
> of this project. We are currently in the process of contributing our
> results from this stage to the QEMU upstream.

Thanks for the info.  This seems very interesting indeed, and please keep
the QEMU contributions flowing :D


Cheers,
Daniel

> 
> If you are interested in this, you can visit the link below.
> https://qemu.gevico.online/tutorial/2026/ch3/qemu-k230/
> 
> Thanks,
> Chao
>>
>> Thanks,
>> Daniel
>>
>>
>>> Signed-off-by: Jack Wang <163wangjack@gmail.com>
>>> ---
>>>    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;
>>



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [RFC PATCH 2/2] hw/riscv/k230: wire up the RMU device
  2026-07-17 13:56       ` Daniel Henrique Barboza
@ 2026-07-17 14:04         ` Chao Liu
  0 siblings, 0 replies; 7+ messages in thread
From: Chao Liu @ 2026-07-17 14:04 UTC (permalink / raw)
  To: Daniel Henrique Barboza
  Cc: jack wang, qemu-devel, Pierrick Bouvier, Paolo Bonzini,
	Palmer Dabbelt, Alistair Francis, Weiwei Li, Liu Zhiwei,
	open list:K230 Machines

On Fri, Jul 17, 2026 at 10:56:17AM +0800, Daniel Henrique Barboza wrote:
> 
> 
> On 7/17/2026 10:41 AM, Chao Liu wrote:
> > On Thu, Jul 16, 2026 at 02:56:30PM +0800, Daniel Henrique Barboza wrote:
> > 
> > Hi Daniel,
> > > Hi,
> > > 
> > > On 7/9/2026 12:12 AM, jack wang wrote:
> > > > From: Jack Wang <163wangjack@gmail.com>
> > > > 
> > > > 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.
> > > 
> > I believe this link refers to:
> > https://github.com/gevico/qemu-camp-2026-k230/issues/11
> > 
> > However, according to the QEMU development collaboration workflow,
> > we don't need to add it.
> > 
> > Gevico, here is the English transliteration for the Chinese "格维". This
> > is a major open-source community in China focused on technical software,
> > which I currently organize and own.
> > 
> > Within our community, we run a QEMU technical training camp primarily
> > centered on the RISC-V architecture and exploratory work regarding
> > GPGPU microarchitecture.
> > 
> > One of our key projects involves hardware modeling for the K230, where
> > we are implementing a digital satellite-borne computer. The recent
> > contributions seen upstream were primarily patches sent by participants
> > of this project. We are currently in the process of contributing our
> > results from this stage to the QEMU upstream.
> 
> Thanks for the info.  This seems very interesting indeed, and please keep
> the QEMU contributions flowing :D
> 
Yes, sir. :)

Thanks,
Chao

> Cheers,
> Daniel
> 
> > 
> > If you are interested in this, you can visit the link below.
> > https://qemu.gevico.online/tutorial/2026/ch3/qemu-k230/
> > 
> > Thanks,
> > Chao
> > > 
> > > Thanks,
> > > Daniel
> > > 
> > > 
> > > > Signed-off-by: Jack Wang <163wangjack@gmail.com>
> > > > ---
> > > >    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;
> > > 
> 


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-07-17 14:04 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20260709031237.21284-1-163wangjack@gmail.com>
2026-07-09  3:12 ` [RFC PATCH 2/2] hw/riscv/k230: wire up the RMU device jack wang
2026-07-16 17:56   ` Daniel Henrique Barboza
2026-07-17 13:41     ` Chao Liu
2026-07-17 13:56       ` Daniel Henrique Barboza
2026-07-17 14:04         ` Chao Liu
2026-07-15 11:56 ` [RFC PATCH 0/2] *** Add k230 reset management unit support *** Jack wang
     [not found] ` <20260709031237.21284-2-163wangjack@gmail.com>
2026-07-17 10:11   ` [RFC PATCH 1/2] hw/misc/k230_rmu: add Kendryte K230 Reset Management Unit model Junze Cao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox