[PATCH v3 0/5] hw/riscv: Add K230 DWC SSI Standard PIO support

Kangjie Huang posted 5 patches 1 month, 2 weeks ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20260808182956.290561-1-flamboyant.h.01@gmail.com
Maintainers: Chao Liu <chao.liu@processmission.com>, Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>, Paolo Bonzini <pbonzini@redhat.com>, Palmer Dabbelt <palmer@dabbelt.com>, Alistair Francis <alistair.francis@wdc.com>, Weiwei Li <liwei1518@gmail.com>, Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>, Liu Zhiwei <zhiwei_liu@linux.alibaba.com>, Fabiano Rosas <farosas@suse.de>, Laurent Vivier <lvivier@redhat.com>
There is a newer version of this series
docs/system/riscv/k230.rst      |    2 +
hw/riscv/Kconfig                |    2 +
hw/riscv/k230.c                 |  178 ++++-
hw/ssi/Kconfig                  |    4 +
hw/ssi/dwc_ssi.c                | 1103 +++++++++++++++++++++++++++++++
hw/ssi/meson.build              |    1 +
include/hw/riscv/k230.h         |    7 +
include/hw/ssi/dwc_ssi.h        |   79 +++
tests/qtest/k230-dwc-ssi-test.c |  702 ++++++++++++++++++++
tests/qtest/meson.build         |    4 +-
10 files changed, 2066 insertions(+), 16 deletions(-)
create mode 100644 hw/ssi/dwc_ssi.c
create mode 100644 include/hw/ssi/dwc_ssi.h
create mode 100644 tests/qtest/k230-dwc-ssi-test.c
[PATCH v3 0/5] hw/riscv: Add K230 DWC SSI Standard PIO support
Posted by Kangjie Huang 1 month, 2 weeks ago
Hi,

This series adds a reusable Standard PIO model for the Synopsys DWC SSI
controller. The K230 machine has three such controllers, and the later
patches add their machine integration.

This series supersedes the previous V2 series:

  https://lore.kernel.org/qemu-devel/20260801192848.30606-1-flamboyant.h.01@gmail.com/T/

The V2 series superseded the previous K230-specific SSI series:

  https://lore.kernel.org/qemu-devel/cover.1785064312.git.flamboyant.h.01@gmail.com/

The first patch adds the Standard SPI register subset, configurable FIFO
and chip-select resources, four transfer modes, reset and migration state,
and RAZ/WI handling for unsupported enhanced SPI, DMA, and XIP registers.
It uses the DWC CTRLR0 layout, where TMOD is at bits [11:10]. The second
patch adds the Standard PIO interrupt support. The remaining patches add
the K230 instances, PLIC routing, and an optional SPI NOR on spi0 CS0.

Changes since v2:

* Rename the controller model and integration from DesignWare/DW to DWC.
* Clarify the DWC CTRLR0.TMOD layout and keep DW APB SSI variants out of
  scope.
* Refine Standard PIO transfer pacing and FIFO handling for long transfers.

Enhanced SPI, internal IDMA, HI_SYS, and XIP remain separate follow-up
series. The older DW APB SSI TMOD encoding is not part of this series.

References:

K230 Technical Reference Manual:

  https://github.com/revyos/external-docs/blob/79b3a79072412ead81427e6755b4d9e6d9ded8d8/K230/en-us/K230_Technical_Reference_Manual_V0.3.1_20241118.pdf

Linux DWC SSI driver and binding:

  https://github.com/torvalds/linux/blob/f9a2394a23482bfd330911e9c8295b71724feacd/drivers/spi/spi-dw-core.c
  https://github.com/torvalds/linux/blob/f9a2394a23482bfd330911e9c8295b71724feacd/drivers/spi/spi-dw.h
  https://github.com/torvalds/linux/blob/f9a2394a23482bfd330911e9c8295b71724feacd/Documentation/devicetree/bindings/spi/snps,dw-apb-ssi.yaml

Intel Arria 10 HPS TRM, used only for comparison with the DW APB SSI
layout:

  https://www.intel.com/content/www/us/en/docs/programmable/683711/21-2/hard-processor-system-technical-reference.html

Testing:

* Built qemu-system-riscv64 and the K230 DWC SSI qtest target.
* Ran all 14 K230 DWC SSI qtests, including Standard PIO modes, register
  contracts, interrupts and PLIC routing, and Standard SPI NOR reads.
* Standard 1-1-1 transfers were also exercised manually through the K230
  SDK U-Boot and Linux SPI paths against the attached flash.
* git diff --check passed.
* checkpatch.pl reported no code errors; its MAINTAINERS coverage warnings
  are expected because this series does not modify MAINTAINERS.

Suggested-by: Bin Meng <bmeng.cn@gmail.com>
Suggested-by: Chao Liu <chao.liu@processmission.com>
Suggested-by: Anirudh Srinivasan <asrinivasan@oss.tenstorrent.com>

Kangjie Huang (5):
  hw/ssi: Add Synopsys DWC SSI standard PIO controller
  hw/ssi: Add DWC SSI standard interrupt support
  hw/riscv/k230: Instantiate DWC SSI controllers
  hw/riscv/k230: Route SSI interrupts to the PLIC
  hw/riscv/k230: Attach a standard SPI NOR flash

 docs/system/riscv/k230.rst      |    2 +
 hw/riscv/Kconfig                |    2 +
 hw/riscv/k230.c                 |  178 ++++-
 hw/ssi/Kconfig                  |    4 +
 hw/ssi/dwc_ssi.c                | 1103 +++++++++++++++++++++++++++++++
 hw/ssi/meson.build              |    1 +
 include/hw/riscv/k230.h         |    7 +
 include/hw/ssi/dwc_ssi.h        |   79 +++
 tests/qtest/k230-dwc-ssi-test.c |  702 ++++++++++++++++++++
 tests/qtest/meson.build         |    4 +-
 10 files changed, 2066 insertions(+), 16 deletions(-)
 create mode 100644 hw/ssi/dwc_ssi.c
 create mode 100644 include/hw/ssi/dwc_ssi.h
 create mode 100644 tests/qtest/k230-dwc-ssi-test.c


base-commit: b428fe036233cbd15d37e3c027ab6ca4d3661a80
-- 
2.43.0
Re: [PATCH v3 0/5] hw/riscv: Add K230 DWC SSI Standard PIO support
Posted by Kangjie Huang 1 month, 2 weeks ago
Kangjie Huang <flamboyant.h.01@gmail.com> 于2026年8月9日周日 02:30写道:
>
> Testing:
>
> * Built qemu-system-riscv64 and the K230 DWC SSI qtest target.
> * Ran all 14 K230 DWC SSI qtests, including Standard PIO modes, register
>   contracts, interrupts and PLIC routing, and Standard SPI NOR reads.
> * Standard 1-1-1 transfers were also exercised manually through the K230
>   SDK U-Boot and Linux SPI paths against the attached flash.
> * git diff --check passed.
> * checkpatch.pl reported no code errors; its MAINTAINERS coverage warnings
>   are expected because this series does not modify MAINTAINERS.
>
> Suggested-by: Bin Meng <bmeng.cn@gmail.com>
> Suggested-by: Chao Liu <chao.liu@processmission.com>
> Suggested-by: Anirudh Srinivasan <asrinivasan@oss.tenstorrent.com>

Hi Bin, Chao, and Anirudh,

  Just to clarify, I added the Suggested-by tags in this patch based on the
 concrete suggestions during the v1v2 review. None of the tags was explicitly
 provided by you. Sorry for any confusion this may have caused.

  Thanks again for your suggestions. Looking forward to your reviews!

  Best regards,
  Kangjie
Re: [PATCH v3 0/5] hw/riscv: Add K230 DWC SSI Standard PIO support
Posted by Bin Meng 1 month, 2 weeks ago
Hi Kangjie,

On Fri, Aug 14, 2026 at 1:02 PM Kangjie Huang <flamboyant.h.01@gmail.com> wrote:
>
> Kangjie Huang <flamboyant.h.01@gmail.com> 于2026年8月9日周日 02:30写道:
> >
> > Testing:
> >
> > * Built qemu-system-riscv64 and the K230 DWC SSI qtest target.
> > * Ran all 14 K230 DWC SSI qtests, including Standard PIO modes, register
> >   contracts, interrupts and PLIC routing, and Standard SPI NOR reads.
> > * Standard 1-1-1 transfers were also exercised manually through the K230
> >   SDK U-Boot and Linux SPI paths against the attached flash.
> > * git diff --check passed.
> > * checkpatch.pl reported no code errors; its MAINTAINERS coverage warnings
> >   are expected because this series does not modify MAINTAINERS.
> >
> > Suggested-by: Bin Meng <bmeng.cn@gmail.com>
> > Suggested-by: Chao Liu <chao.liu@processmission.com>
> > Suggested-by: Anirudh Srinivasan <asrinivasan@oss.tenstorrent.com>
>
> Hi Bin, Chao, and Anirudh,
>
>   Just to clarify, I added the Suggested-by tags in this patch based on the
>  concrete suggestions during the v1v2 review. None of the tags was explicitly
>  provided by you. Sorry for any confusion this may have caused.
>
>   Thanks again for your suggestions. Looking forward to your reviews!
>

For review comments raised during a normal process to the *existing*
patches, the Suggested-by is usually not needed.

This tag is mainly used for *new* patches inspired from the review
process / discussion thread.

Regards,
Bin
Re: [PATCH v3 0/5] hw/riscv: Add K230 DWC SSI Standard PIO support
Posted by Kangjie Huang 1 month, 2 weeks ago
Bin Meng <bmeng.cn@gmail.com> 于2026年8月14日周五 17:25写道:

>
> For review comments raised during a normal process to the *existing*
> patches, the Suggested-by is usually not needed.
>
> This tag is mainly used for *new* patches inspired from the review
> process / discussion thread.
>
Hi Bin,
I understand. Thank you very much for the explanation. I'll drop the
wrong Suggested-by
tags in the next revision and make sure not to add them again.

If you have time, could you take a look at the implementation? I'd
appreciate any review comments.

Regards,
Kangjie