Commit 1e579429 authored by Oliver Upton's avatar Oliver Upton Committed by Marc Zyngier

KVM: arm64: Dedupe vCPU power off helpers

vcpu_power_off() and kvm_psci_vcpu_off() are equivalent; rename the
former and replace all callsites to the latter.

No functional change intended.
Signed-off-by: default avatarOliver Upton <oupton@google.com>
Reviewed-by: default avatarReiji Watanabe <reijiw@google.com>
Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20220504032446.4133305-3-oupton@google.com
parent 5bc2cb95
...@@ -841,4 +841,6 @@ void __init kvm_hyp_reserve(void); ...@@ -841,4 +841,6 @@ void __init kvm_hyp_reserve(void);
static inline void kvm_hyp_reserve(void) { } static inline void kvm_hyp_reserve(void) { }
#endif #endif
void kvm_arm_vcpu_power_off(struct kvm_vcpu *vcpu);
#endif /* __ARM64_KVM_HOST_H__ */ #endif /* __ARM64_KVM_HOST_H__ */
...@@ -432,7 +432,7 @@ void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu) ...@@ -432,7 +432,7 @@ void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu)
vcpu->cpu = -1; vcpu->cpu = -1;
} }
static void vcpu_power_off(struct kvm_vcpu *vcpu) void kvm_arm_vcpu_power_off(struct kvm_vcpu *vcpu)
{ {
vcpu->arch.power_off = true; vcpu->arch.power_off = true;
kvm_make_request(KVM_REQ_SLEEP, vcpu); kvm_make_request(KVM_REQ_SLEEP, vcpu);
...@@ -460,7 +460,7 @@ int kvm_arch_vcpu_ioctl_set_mpstate(struct kvm_vcpu *vcpu, ...@@ -460,7 +460,7 @@ int kvm_arch_vcpu_ioctl_set_mpstate(struct kvm_vcpu *vcpu,
vcpu->arch.power_off = false; vcpu->arch.power_off = false;
break; break;
case KVM_MP_STATE_STOPPED: case KVM_MP_STATE_STOPPED:
vcpu_power_off(vcpu); kvm_arm_vcpu_power_off(vcpu);
break; break;
default: default:
ret = -EINVAL; ret = -EINVAL;
...@@ -1124,7 +1124,7 @@ static int kvm_arch_vcpu_ioctl_vcpu_init(struct kvm_vcpu *vcpu, ...@@ -1124,7 +1124,7 @@ static int kvm_arch_vcpu_ioctl_vcpu_init(struct kvm_vcpu *vcpu,
* Handle the "start in power-off" case. * Handle the "start in power-off" case.
*/ */
if (test_bit(KVM_ARM_VCPU_POWER_OFF, vcpu->arch.features)) if (test_bit(KVM_ARM_VCPU_POWER_OFF, vcpu->arch.features))
vcpu_power_off(vcpu); kvm_arm_vcpu_power_off(vcpu);
else else
vcpu->arch.power_off = false; vcpu->arch.power_off = false;
......
...@@ -51,13 +51,6 @@ static unsigned long kvm_psci_vcpu_suspend(struct kvm_vcpu *vcpu) ...@@ -51,13 +51,6 @@ static unsigned long kvm_psci_vcpu_suspend(struct kvm_vcpu *vcpu)
return PSCI_RET_SUCCESS; return PSCI_RET_SUCCESS;
} }
static void kvm_psci_vcpu_off(struct kvm_vcpu *vcpu)
{
vcpu->arch.power_off = true;
kvm_make_request(KVM_REQ_SLEEP, vcpu);
kvm_vcpu_kick(vcpu);
}
static inline bool kvm_psci_valid_affinity(struct kvm_vcpu *vcpu, static inline bool kvm_psci_valid_affinity(struct kvm_vcpu *vcpu,
unsigned long affinity) unsigned long affinity)
{ {
...@@ -245,7 +238,7 @@ static int kvm_psci_0_2_call(struct kvm_vcpu *vcpu) ...@@ -245,7 +238,7 @@ static int kvm_psci_0_2_call(struct kvm_vcpu *vcpu)
val = kvm_psci_vcpu_suspend(vcpu); val = kvm_psci_vcpu_suspend(vcpu);
break; break;
case PSCI_0_2_FN_CPU_OFF: case PSCI_0_2_FN_CPU_OFF:
kvm_psci_vcpu_off(vcpu); kvm_arm_vcpu_power_off(vcpu);
val = PSCI_RET_SUCCESS; val = PSCI_RET_SUCCESS;
break; break;
case PSCI_0_2_FN_CPU_ON: case PSCI_0_2_FN_CPU_ON:
...@@ -379,7 +372,7 @@ static int kvm_psci_0_1_call(struct kvm_vcpu *vcpu) ...@@ -379,7 +372,7 @@ static int kvm_psci_0_1_call(struct kvm_vcpu *vcpu)
switch (psci_fn) { switch (psci_fn) {
case KVM_PSCI_FN_CPU_OFF: case KVM_PSCI_FN_CPU_OFF:
kvm_psci_vcpu_off(vcpu); kvm_arm_vcpu_power_off(vcpu);
val = PSCI_RET_SUCCESS; val = PSCI_RET_SUCCESS;
break; break;
case KVM_PSCI_FN_CPU_ON: case KVM_PSCI_FN_CPU_ON:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment