]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - arch/powerpc/kvm/book3s_hv.c
KVM: Use common function for VCPU lookup by id
[karo-tx-linux.git] / arch / powerpc / kvm / book3s_hv.c
index 9c26c5a96ea2bc0ea9d2286f4995b2d629be9003..a29da44cdc6cb3e88eaacd70d01b38b68eb51eef 100644 (file)
@@ -308,16 +308,10 @@ static void kvmppc_dump_regs(struct kvm_vcpu *vcpu)
 
 static struct kvm_vcpu *kvmppc_find_vcpu(struct kvm *kvm, int id)
 {
-       int r;
-       struct kvm_vcpu *v, *ret = NULL;
+       struct kvm_vcpu *ret;
 
        mutex_lock(&kvm->lock);
-       kvm_for_each_vcpu(r, v, kvm) {
-               if (v->vcpu_id == id) {
-                       ret = v;
-                       break;
-               }
-       }
+       ret = kvm_get_vcpu_by_id(kvm, id);
        mutex_unlock(&kvm->lock);
        return ret;
 }
@@ -2019,7 +2013,7 @@ static bool can_split_piggybacked_subcores(struct core_info *cip)
                        return false;
                n_subcores += (cip->subcore_threads[sub] - 1) >> 1;
        }
-       if (n_subcores > 3 || large_sub < 0)
+       if (large_sub < 0 || !subcore_config_ok(n_subcores + 1, 2))
                return false;
 
        /*