summaryrefslogtreecommitdiffstats
path: root/arch/arm64/kvm/arm.c
diff options
context:
space:
mode:
authorMarc Zyngier <maz@kernel.org>2020-12-22 12:46:41 +0000
committerMarc Zyngier <maz@kernel.org>2020-12-22 12:56:44 +0000
commit767c973f2e4a9264a4f159c9fad5ca8acdb9915e (patch)
tree635addaa0a5ec0a94d732ec19930ae63b09055ed /arch/arm64/kvm/arm.c
parent860a4c3d1e04a3c3e62bacbbba64417bf49768e2 (diff)
downloadlinux-767c973f2e4a9264a4f159c9fad5ca8acdb9915e.tar.bz2
KVM: arm64: Declutter host PSCI 0.1 handling
Although there is nothing wrong with the current host PSCI relay implementation, we can clean it up and remove some of the helpers that do not improve the overall readability of the legacy PSCI 0.1 handling. Opportunity is taken to turn the bitmap into a set of booleans, and creative use of preprocessor macros make init and check more concise/readable. Suggested-by: Mark Rutland <mark.rutland@arm.com> Signed-off-by: Marc Zyngier <maz@kernel.org>
Diffstat (limited to 'arch/arm64/kvm/arm.c')
-rw-r--r--arch/arm64/kvm/arm.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/arch/arm64/kvm/arm.c b/arch/arm64/kvm/arm.c
index 836ca763b91d..e207e4541f55 100644
--- a/arch/arm64/kvm/arm.c
+++ b/arch/arm64/kvm/arm.c
@@ -1603,6 +1603,9 @@ static void init_cpu_logical_map(void)
hyp_cpu_logical_map[cpu] = cpu_logical_map(cpu);
}
+#define init_psci_0_1_impl_state(config, what) \
+ config.psci_0_1_ ## what ## _implemented = psci_ops.what
+
static bool init_psci_relay(void)
{
/*
@@ -1618,11 +1621,10 @@ static bool init_psci_relay(void)
if (kvm_host_psci_config.version == PSCI_VERSION(0, 1)) {
kvm_host_psci_config.function_ids_0_1 = get_psci_0_1_function_ids();
- kvm_host_psci_config.enabled_functions_0_1 =
- (psci_ops.cpu_suspend ? KVM_HOST_PSCI_0_1_CPU_SUSPEND : 0) |
- (psci_ops.cpu_off ? KVM_HOST_PSCI_0_1_CPU_OFF : 0) |
- (psci_ops.cpu_on ? KVM_HOST_PSCI_0_1_CPU_ON : 0) |
- (psci_ops.migrate ? KVM_HOST_PSCI_0_1_MIGRATE : 0);
+ init_psci_0_1_impl_state(kvm_host_psci_config, cpu_suspend);
+ init_psci_0_1_impl_state(kvm_host_psci_config, cpu_on);
+ init_psci_0_1_impl_state(kvm_host_psci_config, cpu_off);
+ init_psci_0_1_impl_state(kvm_host_psci_config, migrate);
}
return true;
}