]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
LoongArch: KVM: Fix max supported vCPUs set with EIOINTC
authorBibo Mao <maobibo@loongson.cn>
Sun, 9 Nov 2025 08:02:09 +0000 (16:02 +0800)
committerHuacai Chen <chenhuacai@loongson.cn>
Mon, 10 Nov 2025 00:37:07 +0000 (08:37 +0800)
VM fails to boot with 256 vCPUs, the detailed command is

  qemu-system-loongarch64 -smp 256

and there is an error reported as follows:

  KVM_LOONGARCH_EXTIOI_INIT_NUM_CPU failed: Invalid argument

There is typo issue in function kvm_eiointc_ctrl_access() when set
max supported vCPUs.

Cc: stable@vger.kernel.org
Fixes: 47256c4c8b1b ("LoongArch: KVM: Avoid copy_*_user() with lock hold in kvm_eiointc_ctrl_access()")
Signed-off-by: Bibo Mao <maobibo@loongson.cn>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
arch/loongarch/kvm/intc/eiointc.c

index c323336953818413385272545399c42fa1ed4173..a1cc116b4dacebf597ab7b82c7e4938396a8f913 100644 (file)
@@ -439,7 +439,7 @@ static int kvm_eiointc_ctrl_access(struct kvm_device *dev,
        spin_lock_irqsave(&s->lock, flags);
        switch (type) {
        case KVM_DEV_LOONGARCH_EXTIOI_CTRL_INIT_NUM_CPU:
-               if (val >= EIOINTC_ROUTE_MAX_VCPUS)
+               if (val > EIOINTC_ROUTE_MAX_VCPUS)
                        ret = -EINVAL;
                else
                        s->num_cpu = val;