Re: [PATCH v2 15/45] KVM: PPC: Move kvm_vcpu_init() invocation to common code

From: Paul Mackerras
Date: Sun Jan 19 2020 - 22:34:13 EST


On Wed, Dec 18, 2019 at 01:55:00PM -0800, Sean Christopherson wrote:
> 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@xxxxxxxxx>

This doesn't compile:

CC [M] arch/powerpc/kvm/book3s.o
/home/paulus/kernel/kvm/arch/powerpc/kvm/book3s.c: In function âkvmppc_core_vcpu_createâ:
/home/paulus/kernel/kvm/arch/powerpc/kvm/book3s.c:794:9: error: âkvmâ undeclared (first use in this function)
return kvm->arch.kvm_ops->vcpu_create(vcpu);
^
/home/paulus/kernel/kvm/arch/powerpc/kvm/book3s.c:794:9: note: each undeclared identifier is reported only once for each function it appears in
/home/paulus/kernel/kvm/arch/powerpc/kvm/book3s.c:795:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
make[3]: *** [/home/paulus/kernel/kvm/scripts/Makefile.build:266: arch/powerpc/kvm/book3s.o] Error 1

> diff --git a/arch/powerpc/kvm/book3s.c b/arch/powerpc/kvm/book3s.c
> index 13385656b90d..5ad20fc0c6a1 100644
> --- a/arch/powerpc/kvm/book3s.c
> +++ b/arch/powerpc/kvm/book3s.c
> @@ -789,10 +789,9 @@ void kvmppc_decrementer_func(struct kvm_vcpu *vcpu)
> kvm_vcpu_kick(vcpu);
> }
>
> -int kvmppc_core_vcpu_create(struct kvm *kvm, struct kvm_vcpu *vcpu,
> - unsigned int id)
> +int kvmppc_core_vcpu_create(struct kvm_vcpu *vcpu)
> {
> - return kvm->arch.kvm_ops->vcpu_create(kvm, vcpu, id);
> + return kvm->arch.kvm_ops->vcpu_create(vcpu);

Needs s/kvm/vcpu->kvm/ here.

You also need to change the declaration of the vcpu_create function
pointer in the kvmppc_ops struct in kvm_ppc.h to have just the vcpu
parameter instead of 3 parameters.

Paul.