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

ARM: 6941/1: cache: ensure MVA is cacheline aligned in flush_kern_dcache_area

The v6 and v7 implementations of flush_kern_dcache_area do not align
the passed MVA to the size of a cacheline in the data cache. If a
misaligned address is used, only a subset of the requested area will
be flushed. This has been observed to cause failures in SMP boot where
the secondary_data initialised by the primary CPU is not cacheline
aligned, causing the secondary CPUs to read incorrect values for their
pgd and stack pointers.

This patch ensures that the base address is cacheline aligned before
flushing the d-cache.

Cc: <stable@kernel.org>
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>

authored by

Will Deacon and committed by
Russell King
a248b13b a85fab1c

+3
+1
arch/arm/mm/cache-v6.S
··· 176 176 */ 177 177 ENTRY(v6_flush_kern_dcache_area) 178 178 add r1, r0, r1 179 + bic r0, r0, #D_CACHE_LINE_SIZE - 1 179 180 1: 180 181 #ifdef HARVARD_CACHE 181 182 mcr p15, 0, r0, c7, c14, 1 @ clean & invalidate D line
+2
arch/arm/mm/cache-v7.S
··· 221 221 ENTRY(v7_flush_kern_dcache_area) 222 222 dcache_line_size r2, r3 223 223 add r1, r0, r1 224 + sub r3, r2, #1 225 + bic r0, r0, r3 224 226 1: 225 227 mcr p15, 0, r0, c7, c14, 1 @ clean & invalidate D line / unified line 226 228 add r0, r0, r2