KVM: arm64: Prevent use of invalid PSCI v0.1 function IDs
authorDavid Brazdil <dbrazdil@google.com>
Tue, 8 Dec 2020 14:24:47 +0000 (14:24 +0000)
committerMarc Zyngier <maz@kernel.org>
Tue, 22 Dec 2020 10:47:59 +0000 (10:47 +0000)
commitff367fe473a9857160c17827931375a899076394
tree4281bbe4ddc2f0a4bcff4d9e7de973ce4ce56c85
parent2a5f1b67ec577fb1544b563086e0377f095f88e2
KVM: arm64: Prevent use of invalid PSCI v0.1 function IDs

PSCI driver exposes a struct containing the PSCI v0.1 function IDs
configured in the DT. However, the struct does not convey the
information whether these were set from DT or contain the default value
zero. This could be a problem for PSCI proxy in KVM protected mode.

Extend config passed to KVM with a bit mask with individual bits set
depending on whether the corresponding function pointer in psci_ops is
set, eg. set bit for PSCI_CPU_SUSPEND if psci_ops.cpu_suspend != NULL.

Previously config was split into multiple global variables. Put
everything into a single struct for convenience.

Reported-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: David Brazdil <dbrazdil@google.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20201208142452.87237-2-dbrazdil@google.com
arch/arm64/include/asm/kvm_host.h
arch/arm64/kvm/arm.c
arch/arm64/kvm/hyp/nvhe/psci-relay.c