Skip to content

Commit

Permalink
KVM: s390: Use kvm_get_vcpu() instead of open-coded access
Browse files Browse the repository at this point in the history
As we are about to change the way vcpus are allocated, mandate
the use of kvm_get_vcpu() instead of open-coding the access.

Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Message-Id: <20211116160403.4074052-4-maz@kernel.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
  • Loading branch information
Marc Zyngier authored and Paolo Bonzini committed Dec 8, 2021
1 parent 75a9869 commit 113d10b
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions arch/s390/kvm/kvm-s390.c
Original file line number Diff line number Diff line change
Expand Up @@ -4574,7 +4574,7 @@ int kvm_s390_vcpu_start(struct kvm_vcpu *vcpu)
}

for (i = 0; i < online_vcpus; i++) {
if (!is_vcpu_stopped(vcpu->kvm->vcpus[i]))
if (!is_vcpu_stopped(kvm_get_vcpu(vcpu->kvm, i)))
started_vcpus++;
}

Expand Down Expand Up @@ -4636,9 +4636,11 @@ int kvm_s390_vcpu_stop(struct kvm_vcpu *vcpu)
__disable_ibs_on_vcpu(vcpu);

for (i = 0; i < online_vcpus; i++) {
if (!is_vcpu_stopped(vcpu->kvm->vcpus[i])) {
struct kvm_vcpu *tmp = kvm_get_vcpu(vcpu->kvm, i);

if (!is_vcpu_stopped(tmp)) {
started_vcpus++;
started_vcpu = vcpu->kvm->vcpus[i];
started_vcpu = tmp;
}
}

Expand Down

0 comments on commit 113d10b

Please sign in to comment.