]> 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)
commitecee240c1a105e2619dce3781a397960b5d07957
treee3d19c1815d1bc5c338e0093e581ea3357665598
parenta64ed9fc1a59fc72847df4a0b979b84d00c0d3d5
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