From: Cédric Le Goater Date: Mon, 20 May 2019 07:15:14 +0000 (+0200) Subject: KVM: PPC: Book3S HV: XIVE: Fix the enforced limit on the vCPU identifier X-Git-Tag: v5.2-rc3~7^2~1^2~6 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=e717d0ae10041d18fa97da1e6bb4942b5eb9f77c;p=users%2Fjedix%2Flinux-maple.git KVM: PPC: Book3S HV: XIVE: Fix the enforced limit on the vCPU identifier When a vCPU is connected to the KVM device, it is done using its vCPU identifier in the guest. Fix the enforced limit on the vCPU identifier by taking into account the SMT mode. Reported-by: Satheesh Rajendran Tested-by: Satheesh Rajendran Signed-off-by: Cédric Le Goater Reviewed-by: Greg Kurz Signed-off-by: Paul Mackerras --- diff --git a/arch/powerpc/kvm/book3s_xive_native.c b/arch/powerpc/kvm/book3s_xive_native.c index 53b7159dc305..3caf64b96f7e 100644 --- a/arch/powerpc/kvm/book3s_xive_native.c +++ b/arch/powerpc/kvm/book3s_xive_native.c @@ -109,7 +109,7 @@ int kvmppc_xive_native_connect_vcpu(struct kvm_device *dev, return -EPERM; if (vcpu->arch.irq_type != KVMPPC_IRQ_DEFAULT) return -EBUSY; - if (server_num >= KVM_MAX_VCPUS) { + if (server_num >= (KVM_MAX_VCPUS * vcpu->kvm->arch.emul_smt_mode)) { pr_devel("Out of bounds !\n"); return -EINVAL; }