forked from mirrors/linux
		
	KVM: PPC: Move kvm_vcpu_init() invocation to common code
Move the kvm_cpu_{un}init() calls to common PPC code as an intermediate
step towards removing kvm_cpu_{un}init() altogether.
No functional change intended.
Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
			
			
This commit is contained in:
		
							parent
							
								
									4dbf6fec78
								
							
						
					
					
						commit
						ff030fdf55
					
				
					 8 changed files with 29 additions and 55 deletions
				
			
		| 
						 | 
					@ -119,8 +119,7 @@ extern int kvmppc_xlate(struct kvm_vcpu *vcpu, ulong eaddr,
 | 
				
			||||||
			enum xlate_instdata xlid, enum xlate_readwrite xlrw,
 | 
								enum xlate_instdata xlid, enum xlate_readwrite xlrw,
 | 
				
			||||||
			struct kvmppc_pte *pte);
 | 
								struct kvmppc_pte *pte);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
extern int kvmppc_core_vcpu_create(struct kvm *kvm, struct kvm_vcpu *vcpu,
 | 
					extern int kvmppc_core_vcpu_create(struct kvm_vcpu *vcpu);
 | 
				
			||||||
				   unsigned int id);
 | 
					 | 
				
			||||||
extern void kvmppc_core_vcpu_free(struct kvm_vcpu *vcpu);
 | 
					extern void kvmppc_core_vcpu_free(struct kvm_vcpu *vcpu);
 | 
				
			||||||
extern int kvmppc_core_vcpu_setup(struct kvm_vcpu *vcpu);
 | 
					extern int kvmppc_core_vcpu_setup(struct kvm_vcpu *vcpu);
 | 
				
			||||||
extern int kvmppc_core_check_processor_compat(void);
 | 
					extern int kvmppc_core_check_processor_compat(void);
 | 
				
			||||||
| 
						 | 
					@ -274,8 +273,7 @@ struct kvmppc_ops {
 | 
				
			||||||
	void (*inject_interrupt)(struct kvm_vcpu *vcpu, int vec, u64 srr1_flags);
 | 
						void (*inject_interrupt)(struct kvm_vcpu *vcpu, int vec, u64 srr1_flags);
 | 
				
			||||||
	void (*set_msr)(struct kvm_vcpu *vcpu, u64 msr);
 | 
						void (*set_msr)(struct kvm_vcpu *vcpu, u64 msr);
 | 
				
			||||||
	int (*vcpu_run)(struct kvm_run *run, struct kvm_vcpu *vcpu);
 | 
						int (*vcpu_run)(struct kvm_run *run, struct kvm_vcpu *vcpu);
 | 
				
			||||||
	int (*vcpu_create)(struct kvm *kvm, struct kvm_vcpu *vcpu,
 | 
						int (*vcpu_create)(struct kvm_vcpu *vcpu);
 | 
				
			||||||
			   unsigned int id);
 | 
					 | 
				
			||||||
	void (*vcpu_free)(struct kvm_vcpu *vcpu);
 | 
						void (*vcpu_free)(struct kvm_vcpu *vcpu);
 | 
				
			||||||
	int (*check_requests)(struct kvm_vcpu *vcpu);
 | 
						int (*check_requests)(struct kvm_vcpu *vcpu);
 | 
				
			||||||
	int (*get_dirty_log)(struct kvm *kvm, struct kvm_dirty_log *log);
 | 
						int (*get_dirty_log)(struct kvm *kvm, struct kvm_dirty_log *log);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -789,10 +789,9 @@ void kvmppc_decrementer_func(struct kvm_vcpu *vcpu)
 | 
				
			||||||
	kvm_vcpu_kick(vcpu);
 | 
						kvm_vcpu_kick(vcpu);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int kvmppc_core_vcpu_create(struct kvm *kvm, struct kvm_vcpu *vcpu,
 | 
					int kvmppc_core_vcpu_create(struct kvm_vcpu *vcpu)
 | 
				
			||||||
			    unsigned int id)
 | 
					 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	return kvm->arch.kvm_ops->vcpu_create(kvm, vcpu, id);
 | 
						return vcpu->kvm->arch.kvm_ops->vcpu_create(vcpu);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void kvmppc_core_vcpu_free(struct kvm_vcpu *vcpu)
 | 
					void kvmppc_core_vcpu_free(struct kvm_vcpu *vcpu)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2271,16 +2271,16 @@ static void debugfs_vcpu_init(struct kvm_vcpu *vcpu, unsigned int id)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
#endif /* CONFIG_KVM_BOOK3S_HV_EXIT_TIMING */
 | 
					#endif /* CONFIG_KVM_BOOK3S_HV_EXIT_TIMING */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int kvmppc_core_vcpu_create_hv(struct kvm *kvm, struct kvm_vcpu *vcpu,
 | 
					static int kvmppc_core_vcpu_create_hv(struct kvm_vcpu *vcpu)
 | 
				
			||||||
				      unsigned int id)
 | 
					 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	int err;
 | 
						int err;
 | 
				
			||||||
	int core;
 | 
						int core;
 | 
				
			||||||
	struct kvmppc_vcore *vcore;
 | 
						struct kvmppc_vcore *vcore;
 | 
				
			||||||
 | 
						struct kvm *kvm;
 | 
				
			||||||
 | 
						unsigned int id;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	err = kvm_vcpu_init(vcpu, kvm, id);
 | 
						kvm = vcpu->kvm;
 | 
				
			||||||
	if (err)
 | 
						id = vcpu->vcpu_id;
 | 
				
			||||||
		return err;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	vcpu->arch.shared = &vcpu->arch.shregs;
 | 
						vcpu->arch.shared = &vcpu->arch.shregs;
 | 
				
			||||||
#ifdef CONFIG_KVM_BOOK3S_PR_POSSIBLE
 | 
					#ifdef CONFIG_KVM_BOOK3S_PR_POSSIBLE
 | 
				
			||||||
| 
						 | 
					@ -2362,7 +2362,7 @@ static int kvmppc_core_vcpu_create_hv(struct kvm *kvm, struct kvm_vcpu *vcpu,
 | 
				
			||||||
	mutex_unlock(&kvm->lock);
 | 
						mutex_unlock(&kvm->lock);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!vcore)
 | 
						if (!vcore)
 | 
				
			||||||
		goto uninit_vcpu;
 | 
							return err;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spin_lock(&vcore->lock);
 | 
						spin_lock(&vcore->lock);
 | 
				
			||||||
	++vcore->num_threads;
 | 
						++vcore->num_threads;
 | 
				
			||||||
| 
						 | 
					@ -2378,10 +2378,6 @@ static int kvmppc_core_vcpu_create_hv(struct kvm *kvm, struct kvm_vcpu *vcpu,
 | 
				
			||||||
	debugfs_vcpu_init(vcpu, id);
 | 
						debugfs_vcpu_init(vcpu, id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
 | 
					 | 
				
			||||||
uninit_vcpu:
 | 
					 | 
				
			||||||
	kvm_vcpu_uninit(vcpu);
 | 
					 | 
				
			||||||
	return err;
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int kvmhv_set_smt_mode(struct kvm *kvm, unsigned long smt_mode,
 | 
					static int kvmhv_set_smt_mode(struct kvm *kvm, unsigned long smt_mode,
 | 
				
			||||||
| 
						 | 
					@ -2435,7 +2431,6 @@ static void kvmppc_core_vcpu_free_hv(struct kvm_vcpu *vcpu)
 | 
				
			||||||
	unpin_vpa(vcpu->kvm, &vcpu->arch.slb_shadow);
 | 
						unpin_vpa(vcpu->kvm, &vcpu->arch.slb_shadow);
 | 
				
			||||||
	unpin_vpa(vcpu->kvm, &vcpu->arch.vpa);
 | 
						unpin_vpa(vcpu->kvm, &vcpu->arch.vpa);
 | 
				
			||||||
	spin_unlock(&vcpu->arch.vpa_update_lock);
 | 
						spin_unlock(&vcpu->arch.vpa_update_lock);
 | 
				
			||||||
	kvm_vcpu_uninit(vcpu);
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int kvmppc_core_check_requests_hv(struct kvm_vcpu *vcpu)
 | 
					static int kvmppc_core_check_requests_hv(struct kvm_vcpu *vcpu)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1744,22 +1744,17 @@ static int kvmppc_set_one_reg_pr(struct kvm_vcpu *vcpu, u64 id,
 | 
				
			||||||
	return r;
 | 
						return r;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int kvmppc_core_vcpu_create_pr(struct kvm *kvm, struct kvm_vcpu *vcpu,
 | 
					static int kvmppc_core_vcpu_create_pr(struct kvm_vcpu *vcpu)
 | 
				
			||||||
				      unsigned int id)
 | 
					 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct kvmppc_vcpu_book3s *vcpu_book3s;
 | 
						struct kvmppc_vcpu_book3s *vcpu_book3s;
 | 
				
			||||||
	unsigned long p;
 | 
						unsigned long p;
 | 
				
			||||||
	int err;
 | 
						int err;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	err = kvm_vcpu_init(vcpu, kvm, id);
 | 
					 | 
				
			||||||
	if (err)
 | 
					 | 
				
			||||||
		return err;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	err = -ENOMEM;
 | 
						err = -ENOMEM;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	vcpu_book3s = vzalloc(sizeof(struct kvmppc_vcpu_book3s));
 | 
						vcpu_book3s = vzalloc(sizeof(struct kvmppc_vcpu_book3s));
 | 
				
			||||||
	if (!vcpu_book3s)
 | 
						if (!vcpu_book3s)
 | 
				
			||||||
		goto uninit_vcpu;
 | 
							goto out;
 | 
				
			||||||
	vcpu->arch.book3s = vcpu_book3s;
 | 
						vcpu->arch.book3s = vcpu_book3s;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef CONFIG_KVM_BOOK3S_32_HANDLER
 | 
					#ifdef CONFIG_KVM_BOOK3S_32_HANDLER
 | 
				
			||||||
| 
						 | 
					@ -1814,8 +1809,7 @@ static int kvmppc_core_vcpu_create_pr(struct kvm *kvm, struct kvm_vcpu *vcpu,
 | 
				
			||||||
free_vcpu3s:
 | 
					free_vcpu3s:
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
	vfree(vcpu_book3s);
 | 
						vfree(vcpu_book3s);
 | 
				
			||||||
uninit_vcpu:
 | 
					out:
 | 
				
			||||||
	kvm_vcpu_uninit(vcpu);
 | 
					 | 
				
			||||||
	return err;
 | 
						return err;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1824,7 +1818,6 @@ static void kvmppc_core_vcpu_free_pr(struct kvm_vcpu *vcpu)
 | 
				
			||||||
	struct kvmppc_vcpu_book3s *vcpu_book3s = to_book3s(vcpu);
 | 
						struct kvmppc_vcpu_book3s *vcpu_book3s = to_book3s(vcpu);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	free_page((unsigned long)vcpu->arch.shared & PAGE_MASK);
 | 
						free_page((unsigned long)vcpu->arch.shared & PAGE_MASK);
 | 
				
			||||||
	kvm_vcpu_uninit(vcpu);
 | 
					 | 
				
			||||||
#ifdef CONFIG_KVM_BOOK3S_32_HANDLER
 | 
					#ifdef CONFIG_KVM_BOOK3S_32_HANDLER
 | 
				
			||||||
	kfree(vcpu->arch.shadow_vcpu);
 | 
						kfree(vcpu->arch.shadow_vcpu);
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2114,10 +2114,9 @@ int kvmppc_core_init_vm(struct kvm *kvm)
 | 
				
			||||||
	return kvm->arch.kvm_ops->init_vm(kvm);
 | 
						return kvm->arch.kvm_ops->init_vm(kvm);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int kvmppc_core_vcpu_create(struct kvm *kvm, struct kvm_vcpu *vcpu,
 | 
					int kvmppc_core_vcpu_create(struct kvm_vcpu *vcpu)
 | 
				
			||||||
			    unsigned int id)
 | 
					 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	return kvm->arch.kvm_ops->vcpu_create(kvm, vcpu, id);
 | 
						return vcpu->kvm->arch.kvm_ops->vcpu_create(vcpu);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void kvmppc_core_vcpu_free(struct kvm_vcpu *vcpu)
 | 
					void kvmppc_core_vcpu_free(struct kvm_vcpu *vcpu)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -433,8 +433,7 @@ static int kvmppc_set_one_reg_e500(struct kvm_vcpu *vcpu, u64 id,
 | 
				
			||||||
	return r;
 | 
						return r;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int kvmppc_core_vcpu_create_e500(struct kvm *kvm, struct kvm_vcpu *vcpu,
 | 
					static int kvmppc_core_vcpu_create_e500(struct kvm_vcpu *vcpu)
 | 
				
			||||||
					unsigned int id)
 | 
					 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct kvmppc_vcpu_e500 *vcpu_e500;
 | 
						struct kvmppc_vcpu_e500 *vcpu_e500;
 | 
				
			||||||
	int err;
 | 
						int err;
 | 
				
			||||||
| 
						 | 
					@ -442,14 +441,8 @@ static int kvmppc_core_vcpu_create_e500(struct kvm *kvm, struct kvm_vcpu *vcpu,
 | 
				
			||||||
	BUILD_BUG_ON(offsetof(struct kvmppc_vcpu_e500, vcpu) != 0);
 | 
						BUILD_BUG_ON(offsetof(struct kvmppc_vcpu_e500, vcpu) != 0);
 | 
				
			||||||
	vcpu_e500 = to_e500(vcpu);
 | 
						vcpu_e500 = to_e500(vcpu);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	err = kvm_vcpu_init(vcpu, kvm, id);
 | 
						if (kvmppc_e500_id_table_alloc(vcpu_e500) == NULL)
 | 
				
			||||||
	if (err)
 | 
							return -ENOMEM;
 | 
				
			||||||
		return err;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	if (kvmppc_e500_id_table_alloc(vcpu_e500) == NULL) {
 | 
					 | 
				
			||||||
		err = -ENOMEM;
 | 
					 | 
				
			||||||
		goto uninit_vcpu;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	err = kvmppc_e500_tlb_init(vcpu_e500);
 | 
						err = kvmppc_e500_tlb_init(vcpu_e500);
 | 
				
			||||||
	if (err)
 | 
						if (err)
 | 
				
			||||||
| 
						 | 
					@ -467,8 +460,6 @@ static int kvmppc_core_vcpu_create_e500(struct kvm *kvm, struct kvm_vcpu *vcpu,
 | 
				
			||||||
	kvmppc_e500_tlb_uninit(vcpu_e500);
 | 
						kvmppc_e500_tlb_uninit(vcpu_e500);
 | 
				
			||||||
uninit_id:
 | 
					uninit_id:
 | 
				
			||||||
	kvmppc_e500_id_table_free(vcpu_e500);
 | 
						kvmppc_e500_id_table_free(vcpu_e500);
 | 
				
			||||||
uninit_vcpu:
 | 
					 | 
				
			||||||
	kvm_vcpu_uninit(vcpu);
 | 
					 | 
				
			||||||
	return err;
 | 
						return err;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -479,7 +470,6 @@ static void kvmppc_core_vcpu_free_e500(struct kvm_vcpu *vcpu)
 | 
				
			||||||
	free_page((unsigned long)vcpu->arch.shared);
 | 
						free_page((unsigned long)vcpu->arch.shared);
 | 
				
			||||||
	kvmppc_e500_tlb_uninit(vcpu_e500);
 | 
						kvmppc_e500_tlb_uninit(vcpu_e500);
 | 
				
			||||||
	kvmppc_e500_id_table_free(vcpu_e500);
 | 
						kvmppc_e500_id_table_free(vcpu_e500);
 | 
				
			||||||
	kvm_vcpu_uninit(vcpu);
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int kvmppc_core_init_vm_e500(struct kvm *kvm)
 | 
					static int kvmppc_core_init_vm_e500(struct kvm *kvm)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -301,8 +301,7 @@ static int kvmppc_set_one_reg_e500mc(struct kvm_vcpu *vcpu, u64 id,
 | 
				
			||||||
	return r;
 | 
						return r;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int kvmppc_core_vcpu_create_e500mc(struct kvm *kvm, struct kvm_vcpu *vcpu,
 | 
					static int kvmppc_core_vcpu_create_e500mc(struct kvm_vcpu *vcpu)
 | 
				
			||||||
					  unsigned int id)
 | 
					 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct kvmppc_vcpu_e500 *vcpu_e500;
 | 
						struct kvmppc_vcpu_e500 *vcpu_e500;
 | 
				
			||||||
	int err;
 | 
						int err;
 | 
				
			||||||
| 
						 | 
					@ -310,16 +309,12 @@ static int kvmppc_core_vcpu_create_e500mc(struct kvm *kvm, struct kvm_vcpu *vcpu
 | 
				
			||||||
	BUILD_BUG_ON(offsetof(struct kvmppc_vcpu_e500, vcpu) != 0);
 | 
						BUILD_BUG_ON(offsetof(struct kvmppc_vcpu_e500, vcpu) != 0);
 | 
				
			||||||
	vcpu_e500 = to_e500(vcpu);
 | 
						vcpu_e500 = to_e500(vcpu);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	err = kvm_vcpu_init(vcpu, kvm, id);
 | 
					 | 
				
			||||||
	if (err)
 | 
					 | 
				
			||||||
		return err;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/* Invalid PIR value -- this LPID dosn't have valid state on any cpu */
 | 
						/* Invalid PIR value -- this LPID dosn't have valid state on any cpu */
 | 
				
			||||||
	vcpu->arch.oldpir = 0xffffffff;
 | 
						vcpu->arch.oldpir = 0xffffffff;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	err = kvmppc_e500_tlb_init(vcpu_e500);
 | 
						err = kvmppc_e500_tlb_init(vcpu_e500);
 | 
				
			||||||
	if (err)
 | 
						if (err)
 | 
				
			||||||
		goto uninit_vcpu;
 | 
							return err;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	vcpu->arch.shared = (void *)__get_free_page(GFP_KERNEL | __GFP_ZERO);
 | 
						vcpu->arch.shared = (void *)__get_free_page(GFP_KERNEL | __GFP_ZERO);
 | 
				
			||||||
	if (!vcpu->arch.shared) {
 | 
						if (!vcpu->arch.shared) {
 | 
				
			||||||
| 
						 | 
					@ -331,8 +326,6 @@ static int kvmppc_core_vcpu_create_e500mc(struct kvm *kvm, struct kvm_vcpu *vcpu
 | 
				
			||||||
 | 
					
 | 
				
			||||||
uninit_tlb:
 | 
					uninit_tlb:
 | 
				
			||||||
	kvmppc_e500_tlb_uninit(vcpu_e500);
 | 
						kvmppc_e500_tlb_uninit(vcpu_e500);
 | 
				
			||||||
uninit_vcpu:
 | 
					 | 
				
			||||||
	kvm_vcpu_uninit(vcpu);
 | 
					 | 
				
			||||||
	return err;
 | 
						return err;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -342,7 +335,6 @@ static void kvmppc_core_vcpu_free_e500mc(struct kvm_vcpu *vcpu)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	free_page((unsigned long)vcpu->arch.shared);
 | 
						free_page((unsigned long)vcpu->arch.shared);
 | 
				
			||||||
	kvmppc_e500_tlb_uninit(vcpu_e500);
 | 
						kvmppc_e500_tlb_uninit(vcpu_e500);
 | 
				
			||||||
	kvm_vcpu_uninit(vcpu);
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int kvmppc_core_init_vm_e500mc(struct kvm *kvm)
 | 
					static int kvmppc_core_init_vm_e500mc(struct kvm *kvm)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -729,14 +729,20 @@ struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm, unsigned int id)
 | 
				
			||||||
	if (!vcpu)
 | 
						if (!vcpu)
 | 
				
			||||||
		return ERR_PTR(-ENOMEM);
 | 
							return ERR_PTR(-ENOMEM);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	err = kvmppc_core_vcpu_create(kvm, vcpu, id);
 | 
						err = kvm_vcpu_init(vcpu, kvm, id);
 | 
				
			||||||
	if (err)
 | 
						if (err)
 | 
				
			||||||
		goto free_vcpu;
 | 
							goto free_vcpu;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						err = kvmppc_core_vcpu_create(vcpu);
 | 
				
			||||||
 | 
						if (err)
 | 
				
			||||||
 | 
							goto uninit_vcpu;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	vcpu->arch.wqp = &vcpu->wq;
 | 
						vcpu->arch.wqp = &vcpu->wq;
 | 
				
			||||||
	kvmppc_create_vcpu_debugfs(vcpu, id);
 | 
						kvmppc_create_vcpu_debugfs(vcpu, id);
 | 
				
			||||||
	return vcpu;
 | 
						return vcpu;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					uninit_vcpu:
 | 
				
			||||||
 | 
						kvm_vcpu_uninit(vcpu);
 | 
				
			||||||
free_vcpu:
 | 
					free_vcpu:
 | 
				
			||||||
	kmem_cache_free(kvm_vcpu_cache, vcpu);
 | 
						kmem_cache_free(kvm_vcpu_cache, vcpu);
 | 
				
			||||||
	return ERR_PTR(err);
 | 
						return ERR_PTR(err);
 | 
				
			||||||
| 
						 | 
					@ -770,6 +776,8 @@ void kvm_arch_vcpu_free(struct kvm_vcpu *vcpu)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	kvmppc_core_vcpu_free(vcpu);
 | 
						kvmppc_core_vcpu_free(vcpu);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						kvm_vcpu_uninit(vcpu);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	kmem_cache_free(kvm_vcpu_cache, vcpu);
 | 
						kmem_cache_free(kvm_vcpu_cache, vcpu);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue