Skip to content

Commit

Permalink
cache: ax45mp_cache: Align end size to cache boundary in ax45mp_dma_c…
Browse files Browse the repository at this point in the history
…ache_wback()

[ Upstream commit 9bd405c ]

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: d34599b ("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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
prabhakarlad authored and gregkh committed Mar 1, 2024
1 parent 9b099ed commit 50b3065
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions drivers/cache/ax45mp_cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 50b3065

Please sign in to comment.