KVM: arm64: initialize HCRX_EL2
authorKristina Martsenko <kristina.martsenko@arm.com>
Tue, 9 May 2023 14:22:25 +0000 (15:22 +0100)
committerCatalin Marinas <catalin.marinas@arm.com>
Mon, 5 Jun 2023 16:05:05 +0000 (17:05 +0100)
commitaf94aad4c9150cca6781ad134c950fb05dff43f9
treebf13e615b659cd081d6b4aca2c6253e3b98b0406
parent44c026a73be8038f03dbdeef028b642880cf1511
KVM: arm64: initialize HCRX_EL2

ARMv8.7/9.2 adds a new hypervisor configuration register HCRX_EL2.
Initialize the register to a safe value (all fields 0), to be robust
against firmware that has not initialized it. This is also needed to
ensure that the register is reinitialized after a kexec by a future
kernel.

In addition, move SMPME setup over to the new flags, as it would
otherwise get overridden. It is safe to set the bit even if SME is not
(uniformly) supported, as it will write to a RES0 bit (having no
effect), and SME will be disabled by the cpufeature framework.
(Similar to how e.g. the API bit is handled in HCR_HOST_NVHE_FLAGS.)

Signed-off-by: Kristina Martsenko <kristina.martsenko@arm.com>
Acked-by: Marc Zyngier <maz@kernel.org>
Acked-by: Oliver Upton <oliver.upton@linux.dev>
Link: https://lore.kernel.org/r/20230509142235.3284028-2-kristina.martsenko@arm.com
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
arch/arm64/include/asm/el2_setup.h
arch/arm64/include/asm/kvm_arm.h