U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] riscv: consolidate the T-Head C9xx cache operations and CSRs
@ 2026-11-24 19:52 Indrek Kruusa
  2026-11-24 19:52 ` [PATCH 1/4] riscv: thead: add a common header for the C9xx CSRs Indrek Kruusa
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Indrek Kruusa @ 2026-11-24 19:52 UTC (permalink / raw)
  To: Tim Ouyang, Leo Liang
  Cc: Yao Zi, Tom Rini, Han Gao, Kongyang Liu, Junhui Liu,
	Samuel Holland, Andre Przywara, Hiago De Franco, E Shattow,
	Yixun Lan, Raymond Mao, u-boot, Indrek Kruusa

This series consolidates the vendor-specific cache operations of the
T-Head C9xx cores and the machine-mode CSRs those ports use, and
implements the whole-cache operations.  It is a prerequisite for the
upcoming Allwinner D1/D1s support.  However, no definitions have been
added yet that only D1 would use.

The series adds arch/riscv/include/asm/thead_csr.h, with the CSR numbers
and bitfields the T-Head ports use today.  It also adds
arch/riscv/lib/thead_cache.c: the renamed thead_cmo.c, with the enable and
disable functions taken from arch/riscv/cpu/th1520/cache.c, which is
removed.

The whole-cache operations have an earlier version in Samuel Holland's
d1-wip branch [1], reworked here for the in-tree ports.

[1] https://github.com/smaeul/u-boot/tree/d1-wip

SoCs select THEAD_CACHE.  For the L2 operations (C910) there is an
additional THEAD_L2_CACHE selection: the whole-cache operations cover only
the L1 of the calling core, while the address-range ones already reach the
L2 and every core of the cluster, so only the former need an operation on
top.

The code is built for both U-Boot proper and SPL.  Where an operation makes
no sense it is compiled out: the D-cache ones with SYS_DCACHE_OFF, the MHCR
ones when U-Boot runs in S-mode.  CV1800B is covered too.

Build tested for th1520_lpi4a, including the SPL link, and for
milkv_duo.


Indrek Kruusa (4):
  riscv: thead: add a common header for the C9xx CSRs
  riscv: th1520: use the common C9xx CSR definitions
  riscv: lib: rename thead_cmo.c to thead_cache.c
  riscv: lib: add the whole-cache and enable operations

 arch/riscv/Kconfig                 |  17 ++--
 arch/riscv/cpu/cv1800b/Kconfig     |   2 +-
 arch/riscv/cpu/th1520/Kconfig      |   3 +-
 arch/riscv/cpu/th1520/Makefile     |   1 -
 arch/riscv/cpu/th1520/cache.c      |  34 --------
 arch/riscv/cpu/th1520/spl.c        |  96 ++++++---------------
 arch/riscv/include/asm/thead_csr.h | 105 +++++++++++++++++++++++
 arch/riscv/lib/Makefile            |   2 +-
 arch/riscv/lib/thead_cache.c       | 129 +++++++++++++++++++++++++++++
 arch/riscv/lib/thead_cmo.c         |  45 ----------
 10 files changed, 275 insertions(+), 159 deletions(-)
 delete mode 100644 arch/riscv/cpu/th1520/cache.c
 create mode 100644 arch/riscv/include/asm/thead_csr.h
 create mode 100644 arch/riscv/lib/thead_cache.c
 delete mode 100644 arch/riscv/lib/thead_cmo.c

-- 
2.43.0


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

end of thread, other threads:[~2026-11-25 17:24 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-24 19:52 [PATCH 0/4] riscv: consolidate the T-Head C9xx cache operations and CSRs Indrek Kruusa
2026-11-24 19:52 ` [PATCH 1/4] riscv: thead: add a common header for the C9xx CSRs Indrek Kruusa
2026-11-25 15:00   ` Junhui Liu
2026-11-24 19:52 ` [PATCH 2/4] riscv: th1520: use the common C9xx CSR definitions Indrek Kruusa
2026-11-24 19:52 ` [PATCH 3/4] riscv: lib: rename thead_cmo.c to thead_cache.c Indrek Kruusa
2026-11-24 19:52 ` [PATCH 4/4] riscv: lib: add the whole-cache and enable operations Indrek Kruusa
2026-11-25 17:23 ` [PATCH 0/4] riscv: consolidate the T-Head C9xx cache operations and CSRs Yao Zi

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