From: Chao Liu <chao.liu@processmission.com>
To: Kangjie Huang <flamboyant.h.01@gmail.com>
Cc: qemu-devel@nongnu.org, qemu-riscv@nongnu.org,
Alistair Francis <alistair.francis@wdc.com>,
Palmer Dabbelt <palmer@dabbelt.com>,
Weiwei Li <liwei1518@gmail.com>,
Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>,
Liu Zhiwei <zhiwei_liu@linux.alibaba.com>,
Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Fabiano Rosas <farosas@suse.de>,
Laurent Vivier <lvivier@redhat.com>
Subject: Re: [PATCH v2 2/3] hw/riscv/k230: wire up the IOMUX device
Date: Fri, 17 Jul 2026 21:45:29 +0800 [thread overview]
Message-ID: <alox45BlNTiMoGMA@ChaodeMacBook-Pro.local> (raw)
In-Reply-To: <43e4eb64d1c29419d5803e42ad692324bde2b6c7.1784022244.git.flamboyant.h.01@gmail.com>
On Tue, Jul 14, 2026 at 06:22:01PM +0800, Kangjie Huang wrote:
> Instantiate the K230 IOMUX device and map its MMIO region at
> 0x91105000, replacing the unimplemented device covering the same SoC
> address window.
>
> Select the model from the K230 machine configuration and document the
> newly modeled device.
>
> Signed-off-by: Kangjie Huang <flamboyant.h.01@gmail.com>
Suggested-by: Chao Liu <chao.liu@processmission.com>
Thanks,
Chao
> ---
> docs/system/riscv/k230.rst | 1 +
> hw/riscv/Kconfig | 1 +
> hw/riscv/k230.c | 11 ++++++++---
> include/hw/riscv/k230.h | 2 ++
> 4 files changed, 12 insertions(+), 3 deletions(-)
>
> diff --git a/docs/system/riscv/k230.rst b/docs/system/riscv/k230.rst
> index cea8202e55..b160c401fd 100644
> --- a/docs/system/riscv/k230.rst
> +++ b/docs/system/riscv/k230.rst
> @@ -20,6 +20,7 @@ The ``k230`` machine supports the following devices:
> * Platform-Level Interrupt Controller (PLIC)
> * 2 K230 Watchdog Timer
> * 5 UART
> +* K230 IOMUX register block
>
> Boot options
> ------------
> diff --git a/hw/riscv/Kconfig b/hw/riscv/Kconfig
> index de37c08cae..4c9fc3e7ad 100644
> --- a/hw/riscv/Kconfig
> +++ b/hw/riscv/Kconfig
> @@ -162,3 +162,4 @@ config K230
> select SERIAL_MM
> select UNIMP
> select K230_WDT
> + select K230_IOMUX
> diff --git a/hw/riscv/k230.c b/hw/riscv/k230.c
> index 656f28190c..430c1646b5 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-iomux", &s->iomux, TYPE_K230_IOMUX);
>
> qdev_prop_set_uint32(DEVICE(cpu0), "hartid-base", 0);
> qdev_prop_set_string(DEVICE(cpu0), "cpu-type", TYPE_RISCV_CPU_THEAD_C908);
> @@ -198,6 +199,11 @@ static void k230_soc_realize(DeviceState *dev, Error **errp)
> }
> }
>
> + /* IOMUX */
> + if (!sysbus_realize(SYS_BUS_DEVICE(&s->iomux), errp)) {
> + return;
> + }
> +
> sysbus_mmio_map(SYS_BUS_DEVICE(&s->wdt[0]), 0, memmap[K230_DEV_WDT0].base);
> sysbus_connect_irq(SYS_BUS_DEVICE(&s->wdt[0]), 0,
> qdev_get_gpio_in(DEVICE(s->c908_plic), K230_WDT0_IRQ));
> @@ -206,6 +212,8 @@ 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));
>
> + sysbus_mmio_map(SYS_BUS_DEVICE(&s->iomux), 0, memmap[K230_DEV_IOMUX].base);
> +
> /* unimplemented devices */
> create_unimplemented_device("kpu.l2-cache",
> memmap[K230_DEV_KPU_L2_CACHE].base,
> @@ -280,9 +288,6 @@ static void k230_soc_realize(DeviceState *dev, Error **errp)
> create_unimplemented_device("ipcm", memmap[K230_DEV_MAILBOX].base,
> memmap[K230_DEV_MAILBOX].size);
>
> - create_unimplemented_device("iomux", memmap[K230_DEV_IOMUX].base,
> - memmap[K230_DEV_IOMUX].size);
> -
> create_unimplemented_device("timer", memmap[K230_DEV_TIMER].base,
> memmap[K230_DEV_TIMER].size);
>
> diff --git a/include/hw/riscv/k230.h b/include/hw/riscv/k230.h
> index 592e1c26bf..223e76b420 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_iomux.h"
>
> #define C908_CPU_HARTID (0)
>
> @@ -33,6 +34,7 @@ typedef struct K230SoCState {
> RISCVHartArrayState c908_cpu; /* Small core */
>
> K230WdtState wdt[2];
> + K230IomuxState iomux;
> MemoryRegion sram;
> MemoryRegion bootrom;
>
> --
> 2.43.0
>
next prev parent reply other threads:[~2026-07-17 13:46 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-14 10:21 [PATCH v2 0/3] hw/riscv/k230: add IOMUX register block model Kangjie Huang
2026-07-14 10:22 ` [PATCH v2 1/3] hw/misc/k230_iomux: add Kendryte K230 IOMUX model Kangjie Huang
2026-07-17 13:44 ` Chao Liu
2026-07-14 10:22 ` [PATCH v2 2/3] hw/riscv/k230: wire up the IOMUX device Kangjie Huang
2026-07-17 13:45 ` Chao Liu [this message]
2026-07-14 10:22 ` [PATCH v2 3/3] tests/qtest: add test for K230 IOMUX Kangjie Huang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alox45BlNTiMoGMA@ChaodeMacBook-Pro.local \
--to=chao.liu@processmission.com \
--cc=alistair.francis@wdc.com \
--cc=daniel.barboza@oss.qualcomm.com \
--cc=farosas@suse.de \
--cc=flamboyant.h.01@gmail.com \
--cc=liwei1518@gmail.com \
--cc=lvivier@redhat.com \
--cc=palmer@dabbelt.com \
--cc=pbonzini@redhat.com \
--cc=pierrick.bouvier@oss.qualcomm.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-riscv@nongnu.org \
--cc=zhiwei_liu@linux.alibaba.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.