arm64: Extract parts of el2_setup into a macro
authorDavid Brazdil <dbrazdil@google.com>
Wed, 2 Dec 2020 18:41:04 +0000 (18:41 +0000)
committerMarc Zyngier <maz@kernel.org>
Fri, 4 Dec 2020 10:07:12 +0000 (10:07 +0000)
commit78869f0f0552d032c7e32724c4abb2715e8f974a
treeb5da8399e70fe23b931794da95489db65587b507
parentc1f45f4eb6fd8704f72d5ed64184121e9fe129a0
arm64: Extract parts of el2_setup into a macro

When a CPU is booted in EL2, the kernel checks for VHE support and
initializes the CPU core accordingly. For nVHE it also installs the stub
vectors and drops down to EL1.

Once KVM gains the ability to boot cores without going through the
kernel entry point, it will need to initialize the CPU the same way.
Extract the relevant bits of el2_setup into an init_el2_state macro
with an argument specifying whether to initialize for VHE or nVHE.

The following ifdefs are removed:
 * CONFIG_ARM_GIC_V3 - always selected on arm64
 * CONFIG_COMPAT - hstr_el2 can be set even without 32-bit support

No functional change intended. Size of el2_setup increased by
148 bytes due to duplication.

Signed-off-by: David Brazdil <dbrazdil@google.com>
[maz: reworked to fit the new PSTATE initial setup code]
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20201202184122.26046-9-dbrazdil@google.com
arch/arm64/include/asm/el2_setup.h [new file with mode: 0644]
arch/arm64/kernel/head.S