aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>2024-02-03 21:26:40 +0000
committerConor Dooley <conor.dooley@microchip.com>2024-02-21 16:24:10 +0000
commit9bd405c48b0ac4de087c0c4440fd79597201b8a7 (patch)
treed54faaeb05d7cdaf7923a67cf0a3315120dc4546
parent6613476e225e090cc9aad49be7fa504e290dd33d (diff)
downloadlinux-9bd405c48b0ac4de087c0c4440fd79597201b8a7.tar.gz
cache: ax45mp_cache: Align end size to cache boundary in ax45mp_dma_cache_wback()
Align the end size to cache boundary size in ax45mp_dma_cache_wback() callback likewise done in ax45mp_dma_cache_inv() callback. Additionally return early in case of start == end. Fixes: d34599bcd2e4 ("cache: Add L2 cache management for Andes AX45MP RISC-V core") Reported-by: Pavel Machek <pavel@denx.de> Link: https://lore.kernel.org/cip-dev/ZYsdKDiw7G+kxQ3m@duo.ucw.cz/ Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Signed-off-by: Conor Dooley <conor.dooley@microchip.com>
Notes
Fixes: d34599bcd2e4 ("cache: Add L2 cache management for Andes AX45MP RISC-V core") # v6.6-rc1 Stable: 50b30655b224 # v6.6.19 Lore: https://lore.kernel.org/r/20240203212640.129797-1-prabhakar.mahadev-lad.rj@bp.renesas.com # linux-renesas-soc, linux-riscv, lkml Lore: https://lore.kernel.org/r/20240227131634.250191003@linuxfoundation.org # linux-patches, stable Lore: https://lore.kernel.org/r/20240227131640.751326122@linuxfoundation.org # linux-patches, stable
-rw-r--r--drivers/cache/ax45mp_cache.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/cache/ax45mp_cache.c b/drivers/cache/ax45mp_cache.c
index 57186c58dc849c..1d7dd3d2c101cd 100644
--- a/drivers/cache/ax45mp_cache.c
+++ b/drivers/cache/ax45mp_cache.c
@@ -129,8 +129,12 @@ static void ax45mp_dma_cache_wback(phys_addr_t paddr, size_t size)
unsigned long line_size;
unsigned long flags;
+ if (unlikely(start == end))
+ return;
+
line_size = ax45mp_priv.ax45mp_cache_line_size;
start = start & (~(line_size - 1));
+ end = ((end + line_size - 1) & (~(line_size - 1)));
local_irq_save(flags);
ax45mp_cpu_dcache_wb_range(start, end);
local_irq_restore(flags);