Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8e931c99 authored by Mark Rutland's avatar Mark Rutland Committed by Sami Tolvanen
Browse files

UPSTREAM: arm64: head.S: ensure visibility of page tables



After writing the page tables, we use __inval_cache_range to invalidate
any stale cache entries. Strongly Ordered memory accesses are not
ordered w.r.t. cache maintenance instructions, and hence explicit memory
barriers are required to provide this ordering. However,
__inval_cache_range was written to be used on Normal Cacheable memory
once the MMU and caches are on, and does not have any barriers prior to
the DC instructions.

This patch adds a DMB between the page tables being written and the
corresponding cachelines being invalidated, ensuring that the
invalidation makes the new data visible to subsequent cacheable
accesses. A barrier is not required before the prior invalidate as we do
not access the page table memory area prior to this, and earlier
barriers in preserve_boot_args and set_cpu_boot_mode_flag ensures
ordering w.r.t. any stores performed prior to entering Linux.

Signed-off-by: default avatarMark Rutland <mark.rutland@arm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Fixes: c218bca7 ("arm64: Relax the kernel cache requirements for boot")
Signed-off-by: default avatarWill Deacon <will.deacon@arm.com>

Bug: 31432001
Change-Id: I120bdb377d97b116b6c745899283494173fca91f
(cherry picked from commit 91d57155dc5ab4b311624b7ee570339b6af19ad5)
Signed-off-by: default avatarSami Tolvanen <samitolvanen@google.com>
parent f357e81b
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -453,6 +453,7 @@ __create_page_tables:
	 */
	 */
	mov	x0, x25
	mov	x0, x25
	add	x1, x26, #SWAPPER_DIR_SIZE
	add	x1, x26, #SWAPPER_DIR_SIZE
	dmb	sy
	bl	__inval_cache_range
	bl	__inval_cache_range


	mov	lr, x27
	mov	lr, x27