diff options
| author | Alexander Spyridakis <[email protected]> | 2015-09-04 15:06:24 +0000 |
|---|---|---|
| committer | Marc Zyngier <[email protected]> | 2015-09-04 16:02:48 +0000 |
| commit | 0c0672922dcc70ffba11d96385e98e42fb3ae08d (patch) | |
| tree | d9eaca6ea9b7eccc926a21117e3df8f2072b2d1b /arch/arm/kvm/psci.c | |
| parent | arm64: KVM: set {v,}TCR_EL2 RES1 bits (diff) | |
| download | kernel-0c0672922dcc70ffba11d96385e98e42fb3ae08d.tar.gz kernel-0c0672922dcc70ffba11d96385e98e42fb3ae08d.zip | |
arm/arm64: KVM: Fix PSCI affinity info return value for non valid cores
If a guest requests the affinity info for a non-existing vCPU we need to
properly return an error, instead of erroneously reporting an off state.
Signed-off-by: Alexander Spyridakis <[email protected]>
Signed-off-by: Alvise Rigo <[email protected]>
Acked-by: Mark Rutland <[email protected]>
Reviewed-by: Marc Zyngier <[email protected]>
Signed-off-by: Marc Zyngier <[email protected]>
Diffstat (limited to 'arch/arm/kvm/psci.c')
| -rw-r--r-- | arch/arm/kvm/psci.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/arch/arm/kvm/psci.c b/arch/arm/kvm/psci.c index 4b94b513168d..ad6f6424f1d1 100644 --- a/arch/arm/kvm/psci.c +++ b/arch/arm/kvm/psci.c @@ -126,7 +126,7 @@ static unsigned long kvm_psci_vcpu_on(struct kvm_vcpu *source_vcpu) static unsigned long kvm_psci_vcpu_affinity_info(struct kvm_vcpu *vcpu) { - int i; + int i, matching_cpus = 0; unsigned long mpidr; unsigned long target_affinity; unsigned long target_affinity_mask; @@ -151,12 +151,16 @@ static unsigned long kvm_psci_vcpu_affinity_info(struct kvm_vcpu *vcpu) */ kvm_for_each_vcpu(i, tmp, kvm) { mpidr = kvm_vcpu_get_mpidr_aff(tmp); - if (((mpidr & target_affinity_mask) == target_affinity) && - !tmp->arch.pause) { - return PSCI_0_2_AFFINITY_LEVEL_ON; + if ((mpidr & target_affinity_mask) == target_affinity) { + matching_cpus++; + if (!tmp->arch.pause) + return PSCI_0_2_AFFINITY_LEVEL_ON; } } + if (!matching_cpus) + return PSCI_RET_INVALID_PARAMS; + return PSCI_0_2_AFFINITY_LEVEL_OFF; } |
