Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Lad Prabhakar and committed by
Conor Dooley
9bd405c4 6613476e

+4
+4
drivers/cache/ax45mp_cache.c
··· 129 129 unsigned long line_size; 130 130 unsigned long flags; 131 131 132 + if (unlikely(start == end)) 133 + return; 134 + 132 135 line_size = ax45mp_priv.ax45mp_cache_line_size; 133 136 start = start & (~(line_size - 1)); 137 + end = ((end + line_size - 1) & (~(line_size - 1))); 134 138 local_irq_save(flags); 135 139 ax45mp_cpu_dcache_wb_range(start, end); 136 140 local_irq_restore(flags);