Skip to content

riscv: andes: add L2 cache flush support

Randolph Lin u-boot 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest4 patches 1 replyIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4dm: cache: Add flush_all operationdrivers/cache/cache-uclass.c include/cache.h+26 -00 replies
2/4cache: andes-l2: implement flush_alldrivers/cache/cache-andes-l2.c+14 -20 replies
3/4riscv: andes: flush the L2 cache in flush_dcache_all()arch/riscv/cpu/andes/cache.c+4 -00 replies
4/4riscv: andes: probe the L2 cache device in U-Boot properarch/riscv/cpu/andes/cache.c+15 -00 replies

Reviews trailers per patch

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

PatchLeo Yu-Chi Liang
SeriesR-b
1/4
2/4
3/4
4/4

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

Read the v1 thread

Cover letter [PATCH 0/4] riscv: andes: add L2 cache flush support

On Andes, flush_dcache_all() only flushes L1, and flush_dcache_range() and invalidate_dcache_range() call it. Without the I/O coherence port (IOCP), DMA masters do not snoop the CPU caches, so dirty lines left in L2 make them read stale data.

This series adds a flush_all operation to the cache uclass, implements it in the Andes L2 cache driver and calls it from flush_dcache_all(). In U-Boot proper, enable_caches() runs before driver model is set up after relocation and cannot find the L2 cache device, so patch 4 runs it again once driver model is ready. U-Boot proper in S-mode then drives L2 itself, as the Linux ax45mp_cache driver does.

Side effects: each range operation flushes the whole L2 cache, "dcache off" and "dcache on" turn L2 off and on in S-mode, and L2 is now enabled in M-mode U-Boot proper.

checkpatch warns about the #ifdef in patch 3, which matches the rest of the file, and does not know the Assisted-by tag from Linux's Documentation/process/coding-assistants.rst.

Randolph Lin (4):
dm: cache: Add flush_all operation
cache: andes-l2: implement flush_all
riscv: andes: flush the L2 cache in flush_dcache_all()
riscv: andes: probe the L2 cache device in U-Boot proper

 arch/riscv/cpu/andes/cache.c   | 19 +++++++++++++++++++
 drivers/cache/cache-andes-l2.c | 16 ++++++++++++++--
 drivers/cache/cache-uclass.c   | 10 ++++++++++
 include/cache.h                | 16 ++++++++++++++++
 4 files changed, 59 insertions(+), 2 deletions(-)
Signature · 1 line
2.34.1