Skip to content

Commit

Permalink
[ARM] 4568/1: fix l2x0 cache invalidate handling of unaligned addresses
Browse files Browse the repository at this point in the history
The l2x0_inv_range() function doesn't handle unaligned addresses
correctly. It's necessary to clean the cache lines that are at the
start and end of the invalidate range, if the addresses are not aligned,
to prevent corruption of other data sharing the same cache line.

Signed-off-by: Rui Sousa <rui.p.m.sousa@gmail.com>
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
  • Loading branch information
Rui Sousa authored and Russell King committed Sep 17, 2007
1 parent c2f8289 commit 4f6627a
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion arch/arm/mm/cache-l2x0.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,17 @@ static void l2x0_inv_range(unsigned long start, unsigned long end)
{
unsigned long addr;

start &= ~(CACHE_LINE_SIZE - 1);
if (start & (CACHE_LINE_SIZE - 1)) {
start &= ~(CACHE_LINE_SIZE - 1);
sync_writel(start, L2X0_CLEAN_INV_LINE_PA, 1);
start += CACHE_LINE_SIZE;
}

if (end & (CACHE_LINE_SIZE - 1)) {
end &= ~(CACHE_LINE_SIZE - 1);
sync_writel(end, L2X0_CLEAN_INV_LINE_PA, 1);
}

for (addr = start; addr < end; addr += CACHE_LINE_SIZE)
sync_writel(addr, L2X0_INV_LINE_PA, 1);
cache_sync();
Expand Down

0 comments on commit 4f6627a

Please sign in to comment.