Skip to content

hw/riscv/k230: add IOMUX register block model

Kangjie Huang qemu-devel qemu-riscv 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest3 patches 3 repliesIn review
  2. v23 patches 9 repliesSuperseded
  3. v1 RFC1 patch 3 repliesSuperseded

Changes in v3 from the cover letter

- Migrated the model from the deprecated device_class_set_legacy_reset() to the Resettable interface.
- Added a comment to the model stating that bit 31 (DI) is read-only and reads as zero, since the model does not simulate external pin input (TRM V0.3.1, section 12.9.2.2).
- Added MAINTAINERS entries for the model and the qtest.
- Defined an independent K230_IOMUX_EXPECTED_WRITABLE_MASK (0x00003fff) in the test instead of reusing the implementation mask, with a comment explaining the bit layout.

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3hw/misc/k230_iomux: add Kendryte K230 IOMUX modelMAINTAINERS hw/misc/Kconfig hw/misc/k230_iomux.c +3 more+178 -03 replies
2/3hw/riscv/k230: wire up the IOMUX devicedocs/system/riscv/k230.rst hw/riscv/Kconfig hw/riscv/k230.c +1 more+12 -30 replies
3/3tests/qtest: add test for K230 IOMUXMAINTAINERS tests/qtest/k230-iomux-test.c tests/qtest/meson.build+165 -10 replies

Reviews trailers per patch

1 of 3 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchJunze CaoChao Liu
SeriesR-b
1/3
2/3R-b
3/3

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v3 thread

Cover letter [PATCH v3 0/3] hw/riscv/k230: add IOMUX register block model

Add a SysBus model for the 64 K230 Function IO configuration registers documented by the K230 Technical Reference Manual. The model retains the writable configuration fields needed by the SDK U-Boot and Linux read-modify-write paths.

The series adds the device model, wires it into the K230 SoC at 0x91105000, and adds qtest coverage.

Changes in v3:
- Migrated the model from the deprecated device_class_set_legacy_reset() to the Resettable interface.
- Added a comment to the model stating that bit 31 (DI) is read-only and reads as zero, since the model does not simulate external pin input (TRM V0.3.1, section 12.9.2.2).
- Added MAINTAINERS entries for the model and the qtest.
- Defined an independent K230_IOMUX_EXPECTED_WRITABLE_MASK (0x00003fff) in the test instead of reusing the implementation mask, with a comment explaining the bit layout.

Changes in v2:
- Split the device model, SoC wiring, and qtest coverage into separate patches.
- Removed redundant MMIO bounds, access-size, and alignment checks.
- Limited register storage to the 64 documented Function IO registers.
- Applied the documented 0x00003fff writable mask.
- Treated offsets 0x100 through 0x7ff as reserved.
- Added tests for write masking, read-modify-write accesses, IO63, reserved offsets, and system reset.

Tested with:
- qtest-riscv64/k230-iomux-test
- U-Boot and Linux boot tests with no unimplemented-device warnings for the IOMUX region

Thanks to Alistair Francis and Chao Liu for the v1 review comments that shaped the v2 series structure and the register semantics.

v2:
https://lore.kernel.org/qemu-devel/[email protected]/

v1:
https://lore.kernel.org/qemu-devel/[email protected]/

Kangjie Huang (3):
hw/misc/k230_iomux: add Kendryte K230 IOMUX model hw/riscv/k230: wire up the IOMUX device tests/qtest: add test for K230 IOMUX

 MAINTAINERS                   |   3 +
 docs/system/riscv/k230.rst    |   1 +
 hw/misc/Kconfig               |   3 +
 hw/misc/k230_iomux.c          | 125 ++++++++++++++++++++++++++
 hw/misc/meson.build           |   1 +
 hw/misc/trace-events          |   4 +
 hw/riscv/Kconfig              |   1 +
 hw/riscv/k230.c               |  11 ++-
 include/hw/misc/k230_iomux.h  |  43 +++++++++
 include/hw/riscv/k230.h       |   2 +
 tests/qtest/k230-iomux-test.c | 160 ++++++++++++++++++++++++++++++++++
 tests/qtest/meson.build       |   5 +-
 12 files changed, 355 insertions(+), 4 deletions(-)
 create mode 100644 hw/misc/k230_iomux.c
 create mode 100644 include/hw/misc/k230_iomux.h
 create mode 100644 tests/qtest/k230-iomux-test.c

base-commit: d49f87606ac1a6e15701b26c1b16c5d7e948ffcb

Signature · 1 line
2.43.0