diff options
author | Rui Sousa <rui.p.m.sousa@gmail.com> | 2007-09-14 19:56:19 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2007-09-17 09:56:39 -0400 |
commit | 4f6627ac3ba6948a4aebec80edfd6565aec3a40c (patch) | |
tree | 68d18a79a04fdfc22fc6b9ee5bd1bba8d6605c18 /arch/arm/mm | |
parent | c2f828977ba5d17c13debba374ea252d18e5ccfb (diff) |
[ARM] 4568/1: fix l2x0 cache invalidate handling of unaligned addresses
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>
Diffstat (limited to 'arch/arm/mm')
-rw-r--r-- | arch/arm/mm/cache-l2x0.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/arch/arm/mm/cache-l2x0.c b/arch/arm/mm/cache-l2x0.c index b4e9b734e0bd..76b800a95191 100644 --- a/arch/arm/mm/cache-l2x0.c +++ b/arch/arm/mm/cache-l2x0.c | |||
@@ -57,7 +57,17 @@ static void l2x0_inv_range(unsigned long start, unsigned long end) | |||
57 | { | 57 | { |
58 | unsigned long addr; | 58 | unsigned long addr; |
59 | 59 | ||
60 | start &= ~(CACHE_LINE_SIZE - 1); | 60 | if (start & (CACHE_LINE_SIZE - 1)) { |
61 | start &= ~(CACHE_LINE_SIZE - 1); | ||
62 | sync_writel(start, L2X0_CLEAN_INV_LINE_PA, 1); | ||
63 | start += CACHE_LINE_SIZE; | ||
64 | } | ||
65 | |||
66 | if (end & (CACHE_LINE_SIZE - 1)) { | ||
67 | end &= ~(CACHE_LINE_SIZE - 1); | ||
68 | sync_writel(end, L2X0_CLEAN_INV_LINE_PA, 1); | ||
69 | } | ||
70 | |||
61 | for (addr = start; addr < end; addr += CACHE_LINE_SIZE) | 71 | for (addr = start; addr < end; addr += CACHE_LINE_SIZE) |
62 | sync_writel(addr, L2X0_INV_LINE_PA, 1); | 72 | sync_writel(addr, L2X0_INV_LINE_PA, 1); |
63 | cache_sync(); | 73 | cache_sync(); |