KVM: Use common function for VCPU lookup by id
Let's reuse the new common function for VPCU lookup by id. Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com> Reviewed-by: Dominik Dingel <dingel@linux.vnet.ibm.com> Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com> [split out the new function into a separate patch]
This commit is contained in:

committed by
Christian Borntraeger

parent
bb11c6c965
commit
e09fefdeeb
@@ -155,10 +155,8 @@ static int __diag_time_slice_end(struct kvm_vcpu *vcpu)
|
||||
|
||||
static int __diag_time_slice_end_directed(struct kvm_vcpu *vcpu)
|
||||
{
|
||||
struct kvm *kvm = vcpu->kvm;
|
||||
struct kvm_vcpu *tcpu;
|
||||
int tid;
|
||||
int i;
|
||||
|
||||
tid = vcpu->run->s.regs.gprs[(vcpu->arch.sie_block->ipa & 0xf0) >> 4];
|
||||
vcpu->stat.diagnose_9c++;
|
||||
@@ -167,12 +165,9 @@ static int __diag_time_slice_end_directed(struct kvm_vcpu *vcpu)
|
||||
if (tid == vcpu->vcpu_id)
|
||||
return 0;
|
||||
|
||||
kvm_for_each_vcpu(i, tcpu, kvm)
|
||||
if (tcpu->vcpu_id == tid) {
|
||||
kvm_vcpu_yield_to(tcpu);
|
||||
break;
|
||||
}
|
||||
|
||||
tcpu = kvm_get_vcpu_by_id(vcpu->kvm, tid);
|
||||
if (tcpu)
|
||||
kvm_vcpu_yield_to(tcpu);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user