mirror of https://gitee.com/openkylin/linux.git
Split out struct kvmppc_vcore creation to separate function
No code changes, just split it out to a function so that with the addition of micro partition prefetch buffer allocation (in subsequent patch) looks neater and doesn't require excessive indentation. Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com> Acked-by: Paul Mackerras <paulus@samba.org> Signed-off-by: Alexander Graf <agraf@suse.de>
This commit is contained in:
parent
1b2e33b071
commit
de9bdd1a60
|
@ -1303,6 +1303,26 @@ static int kvmppc_set_one_reg_hv(struct kvm_vcpu *vcpu, u64 id,
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static struct kvmppc_vcore *kvmppc_vcore_create(struct kvm *kvm, int core)
|
||||||
|
{
|
||||||
|
struct kvmppc_vcore *vcore;
|
||||||
|
|
||||||
|
vcore = kzalloc(sizeof(struct kvmppc_vcore), GFP_KERNEL);
|
||||||
|
|
||||||
|
if (vcore == NULL)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
INIT_LIST_HEAD(&vcore->runnable_threads);
|
||||||
|
spin_lock_init(&vcore->lock);
|
||||||
|
init_waitqueue_head(&vcore->wq);
|
||||||
|
vcore->preempt_tb = TB_NIL;
|
||||||
|
vcore->lpcr = kvm->arch.lpcr;
|
||||||
|
vcore->first_vcpuid = core * threads_per_subcore;
|
||||||
|
vcore->kvm = kvm;
|
||||||
|
|
||||||
|
return vcore;
|
||||||
|
}
|
||||||
|
|
||||||
static struct kvm_vcpu *kvmppc_core_vcpu_create_hv(struct kvm *kvm,
|
static struct kvm_vcpu *kvmppc_core_vcpu_create_hv(struct kvm *kvm,
|
||||||
unsigned int id)
|
unsigned int id)
|
||||||
{
|
{
|
||||||
|
@ -1354,16 +1374,7 @@ static struct kvm_vcpu *kvmppc_core_vcpu_create_hv(struct kvm *kvm,
|
||||||
mutex_lock(&kvm->lock);
|
mutex_lock(&kvm->lock);
|
||||||
vcore = kvm->arch.vcores[core];
|
vcore = kvm->arch.vcores[core];
|
||||||
if (!vcore) {
|
if (!vcore) {
|
||||||
vcore = kzalloc(sizeof(struct kvmppc_vcore), GFP_KERNEL);
|
vcore = kvmppc_vcore_create(kvm, core);
|
||||||
if (vcore) {
|
|
||||||
INIT_LIST_HEAD(&vcore->runnable_threads);
|
|
||||||
spin_lock_init(&vcore->lock);
|
|
||||||
init_waitqueue_head(&vcore->wq);
|
|
||||||
vcore->preempt_tb = TB_NIL;
|
|
||||||
vcore->lpcr = kvm->arch.lpcr;
|
|
||||||
vcore->first_vcpuid = core * threads_per_subcore;
|
|
||||||
vcore->kvm = kvm;
|
|
||||||
}
|
|
||||||
kvm->arch.vcores[core] = vcore;
|
kvm->arch.vcores[core] = vcore;
|
||||||
kvm->arch.online_vcores++;
|
kvm->arch.online_vcores++;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue