]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: arm64: Fix EL2 mode availability checks
authorDavid Brazdil <dbrazdil@google.com>
Wed, 2 Dec 2020 18:41:22 +0000 (18:41 +0000)
committerMarc Zyngier <maz@kernel.org>
Fri, 4 Dec 2020 10:08:36 +0000 (10:08 +0000)
commit105e5bb661b64019d6901357977cb113a2d8d7a5
tree6d7965c776626227b71923417ad65d44dd3f4e92
parent400ddbe8bdfad926b15f21c83372c393a73e7e49
KVM: arm64: Fix EL2 mode availability checks

With protected nVHE hyp code interception host's PSCI SMCs, the host
starts seeing new CPUs boot in EL1 instead of EL2. The kernel logic
that keeps track of the boot mode needs to be adjusted.

Add a static key enabled if KVM protected mode initialization is
successful.

When the key is enabled, is_hyp_mode_available continues to report
`true` because its users either treat it as a check whether KVM will be
/ was initialized, or whether stub HVCs can be made (eg. hibernate).

is_hyp_mode_mismatched is changed to report `false` when the key is
enabled. That's because all cores' modes matched at the point of KVM
init and KVM will not allow cores not present at init to boot. That
said, the function is never used after KVM is initialized.

Signed-off-by: David Brazdil <dbrazdil@google.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20201202184122.26046-27-dbrazdil@google.com
arch/arm64/include/asm/virt.h
arch/arm64/kvm/arm.c