arm64: mmu: Spot check security state for TTB mapping
commit487f7f24a5c71e29f28b355819b9cab7d5b90a4a
authorJulius Werner <jwerner@chromium.org>
Fri, 10 Aug 2018 20:06:00 +0000 (10 13:06 -0700)
committerPatrick Georgi <pgeorgi@google.com>
Mon, 13 Aug 2018 12:24:56 +0000 (13 12:24 +0000)
tree1d7587194f5d4390e4f698c6b73713cfb30a45d1
parent72b2022b31e6ee8d6d81a3761b90df2df88ba8a8
arm64: mmu: Spot check security state for TTB mapping

Since commit 372d0ff1d1 (arch/arm64: mmu: Spot check TTB memory
attributes), we already check the memory attributes that the TTB region
is mapped with to avoid configuration mistakes that cause weird issues
(because the MMU walks the page tables with different memory attributes
than they were written with). Unfortunately, we only checked
cachability, but the security state attribute is just as important for
this (because it is part of the cache tag, meaning that a cache entry
created by accessing the non-secure mapping won't be used when trying to
read the same address through a secure mapping... and since AArch64 page
table walks are cache snooping and we rely on that behavior, this can
lead to the MMU not seeing the new page table entries we just wrote).

This patch adds the check for security state and cleans up that code a
little.

Change-Id: I70cda4f76f201b03d69a9ece063a3830b15ac04b
Signed-off-by: Julius Werner <jwerner@chromium.org>
Reviewed-on: https://review.coreboot.org/28017
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
src/arch/arm64/armv8/mmu.c