]> git.baikalelectronics.ru Git - kernel.git/commit
arm64: Use a variable to store non-global mappings decision
authorMark Brown <broonie@kernel.org>
Mon, 9 Dec 2019 18:12:17 +0000 (18:12 +0000)
committerWill Deacon <will@kernel.org>
Wed, 15 Jan 2020 14:11:18 +0000 (14:11 +0000)
commit809890dbdabb5eff496af14bf15981c039846c8f
treee3d19c1815d1bc5c338e0093e581ea3357665598
parentfcf6c8e1c72d07e3a570792adaafe59728c51188
arm64: Use a variable to store non-global mappings decision

Refactor the code which checks to see if we need to use non-global
mappings to use a variable instead of checking with the CPU capabilities
each time, doing the initial check for KPTI early in boot before we
start allocating memory so we still avoid transitioning to non-global
mappings in common cases.

Since this variable always matches our decision about non-global
mappings this means we can also combine arm64_kernel_use_ng_mappings()
and arm64_unmap_kernel_at_el0() into a single function, the variable
simply stores the result and the decision code is elsewhere. We could
just have the users check the variable directly but having a function
makes it clear that these uses are read-only.

The result is that we simplify the code a bit and reduces the amount of
code executed at runtime.

Signed-off-by: Mark Brown <broonie@kernel.org>
Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Will Deacon <will@kernel.org>
arch/arm64/include/asm/mmu.h
arch/arm64/include/asm/pgtable-prot.h
arch/arm64/kernel/cpufeature.c
arch/arm64/kernel/setup.c