All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/9] Add Spacemit K3 Machine
@ 2026-11-29 17:09 Anirudh Srinivasan
  2026-11-29 17:09 ` [PATCH v2 1/9] target/riscv: Add Spacemit X100 CPU type Anirudh Srinivasan
                   ` (9 more replies)
  0 siblings, 10 replies; 16+ messages in thread
From: Anirudh Srinivasan @ 2026-11-29 17:09 UTC (permalink / raw)
  To: qemu-devel
  Cc: Anirudh Srinivasan, Palmer Dabbelt, Alistair Francis, Weiwei Li,
	Daniel Henrique Barboza, Liu Zhiwei, Chao Liu, qemu-riscv,
	Jeuk Kim, Alistair Francis, Paolo Bonzini, Pierrick Bouvier, mps,
	tgamblin, w1355457260

This series adds a spacemit-k3 machine to QEMU. The main intended usage
of this machine is for firmware develeopment. This series models 8 X100
harts, has SMP support, uart output, minimal implementation of syscons/
clock controllers needed to boot, 4 types of boot media (SPI NOR, SD
EMMC, UFS) and boot mode selection.

The machine allows the user to boot with the bootrom dumped from real
spacemit k3 hardware. If the user doesn't supply this, QEMU emulates the
bootrom and loads the next stage from boot media in the same manner in
which the bootrom would. 

SMP support was somewhat complicated to implement because the K3 doesn't
have one clear way to do so. A single hart is released at reset, and the
remaining can be woken up by M-mode IPIs or writes to a wakeup register.
One of the syscons applies an overlay over the M-IMSIC to intercept IPIs
while in reset and wake up the non-boot harts.

If there are better ways to implement the bootrom emultion/boot media
loading and the SMP support patch, please let me know.

The model does not implement the 8 A100 harts, I2C, PCIe, networking.

UFS doesn't work properly in linux yet, and requires some fixes to
QEMU's UFS implementation, which will be sent separately.

This series[1] is needed for the SPI controller to work in EDK2
properly.

A sample boot log is here[2].

[1] https://lore.kernel.org/qemu-devel/20261123-m25p80_write_enable_fix-v2-0-0ac94f99e91f@oss.tenstorrent.com/
[2] https://gist.github.com/asrinivasanTT/77e692e00d305051533c828fbb2d1ecc

Signed-off-by: Anirudh Srinivasan <asrinivasan@oss.tenstorrent.com>
---
Changes in v2:
- Fixed a bug where BOOT_DEV_FLAG_REG wasn't set properly, resulting in boot not working when bootrom wasn't supplied
- Improved SPI controller to support interrupts for transfer completion
- Add docs on how to boot linux and a linux boot test
- Limit memory selection to 16G as boot fw defaults to that without an EEPROM to read DDR info from
- Added sdtrig ext to cpu definition
- Link to v1: https://lore.kernel.org/qemu-devel/20261126023501.460848-1-w1355457260@gmail.com

To: qemu-devel@nongnu.org
Cc: Palmer Dabbelt <palmer@dabbelt.com>
Cc: Alistair Francis <alistair.francis@wdc.com>
Cc: Weiwei Li <liwei1518@gmail.com>
Cc: Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>
Cc: Liu Zhiwei <zhiwei_liu@linux.alibaba.com>
Cc: Chao Liu <chao.liu@processmission.com>
Cc: Anirudh Srinivasan <asrinivasan@oss.tenstorrent.com>
Cc: qemu-riscv@nongnu.org
Cc: Jeuk Kim <jeuk20.kim@samsung.com>
Cc: Alistair Francis <alistair@alistair23.me>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Cc: mps@arvanta.net
Cc: tgamblin@baylibre.com
Cc: w1355457260@gmail.com

---
Anirudh Srinivasan (9):
      target/riscv: Add Spacemit X100 CPU type
      hw/ufs: Add Spacemit K3 UFS controller
      hw/ssi: Add Spacemit K3 SPI controller
      hw/misc: Add a model for Spacemit K3 syscons
      riscv: Add Spacemit K3 machine
      hw/riscv/spacemit-k3: Load next stage from boot media if bootrom is not supplied
      hw/riscv/spacemit-k3: SMP support for Spacemit K3 machine
      docs: Document spacemit-k3 machine
      tests/functional/riscv64: Add spacemit-k3 tests

 MAINTAINERS                                  |  15 +
 docs/system/riscv/spacemit_k3.rst            | 283 ++++++++++
 docs/system/target-riscv.rst                 |   1 +
 hw/misc/meson.build                          |   1 +
 hw/misc/spacemit_k3_syscon.c                 | 530 +++++++++++++++++++
 hw/misc/trace-events                         |  10 +
 hw/riscv/Kconfig                             |  16 +
 hw/riscv/meson.build                         |   1 +
 hw/riscv/spacemit_k3.c                       | 763 +++++++++++++++++++++++++++
 hw/ssi/meson.build                           |   1 +
 hw/ssi/spacemit_k3_spi.c                     | 309 +++++++++++
 hw/ssi/trace-events                          |   5 +
 hw/ufs/meson.build                           |   1 +
 hw/ufs/spacemit_k3_ufs.c                     | 109 ++++
 hw/ufs/spacemit_k3_ufs.h                     |  27 +
 hw/ufs/trace-events                          |   4 +
 include/hw/misc/spacemit_k3_syscon.h         | 104 ++++
 include/hw/riscv/spacemit_k3.h               | 104 ++++
 include/hw/ssi/spacemit_k3_spi.h             |  55 ++
 target/riscv/cpu-qom.h                       |   1 +
 target/riscv/cpu.c                           |  88 +++
 target/riscv/cpu_vendorid.h                  |   4 +
 target/riscv/tcg/csr.h                       |   3 +
 target/riscv/tcg/meson.build                 |   1 +
 target/riscv/tcg/spacemit_csr.c              |  82 +++
 tests/functional/riscv64/meson.build         |   1 +
 tests/functional/riscv64/test_spacemit_k3.py | 137 +++++
 27 files changed, 2656 insertions(+)
---
base-commit: 8f66cb79044c370e3813c56ceb7a75a5ca2d0a0e
change-id: 20261122-spacemit_k3-6f93beeb114a

Best regards,
--  
Anirudh Srinivasan <asrinivasan@oss.tenstorrent.com>



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

end of thread, other threads:[~2026-12-02 15:09 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-29 17:09 [PATCH v2 0/9] Add Spacemit K3 Machine Anirudh Srinivasan
2026-11-29 17:09 ` [PATCH v2 1/9] target/riscv: Add Spacemit X100 CPU type Anirudh Srinivasan
2026-11-29 17:09 ` [PATCH v2 2/9] hw/ufs: Add Spacemit K3 UFS controller Anirudh Srinivasan
2026-11-30  7:18   ` Jeuk Kim
2026-12-01  9:30   ` Zixin Wang
2026-11-29 17:09 ` [PATCH v2 3/9] hw/ssi: Add Spacemit K3 SPI controller Anirudh Srinivasan
2026-11-29 17:09 ` [PATCH v2 4/9] hw/misc: Add a model for Spacemit K3 syscons Anirudh Srinivasan
2026-11-29 17:09 ` [PATCH v2 5/9] riscv: Add Spacemit K3 machine Anirudh Srinivasan
2026-11-29 17:09 ` [PATCH v2 6/9] hw/riscv/spacemit-k3: Load next stage from boot media if bootrom is not supplied Anirudh Srinivasan
2026-11-29 17:09 ` [PATCH v2 7/9] hw/riscv/spacemit-k3: SMP support for Spacemit K3 machine Anirudh Srinivasan
2026-12-01  9:29   ` Zixin Wang
2026-11-29 17:09 ` [PATCH v2 8/9] docs: Document spacemit-k3 machine Anirudh Srinivasan
2026-11-29 17:09 ` [PATCH v2 9/9] tests/functional/riscv64: Add spacemit-k3 tests Anirudh Srinivasan
2026-12-02 15:09   ` Milan P. Stanić
2026-12-01  9:29 ` [PATCH v2 0/9] Add Spacemit K3 Machine Zixin Wang
2026-12-01 15:06   ` Anirudh Srinivasan

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.