arch/loongarch/kvm/intc/eiointc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
VM fails to boot with 256 vCPUs, the detailed command is
qemu-system-loongarch64 -smp 256 and there is 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>
---
arch/loongarch/kvm/intc/eiointc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/loongarch/kvm/intc/eiointc.c b/arch/loongarch/kvm/intc/eiointc.c
index c32333695381..a1cc116b4dac 100644
--- a/arch/loongarch/kvm/intc/eiointc.c
+++ b/arch/loongarch/kvm/intc/eiointc.c
@@ -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;
base-commit: 3a8660878839faadb4f1a6dd72c3179c1df56787
--
2.39.3
Applied, thanks.
Huacai
On Tue, Oct 14, 2025 at 5:51 PM Bibo Mao <maobibo@loongson.cn> wrote:
>
> VM fails to boot with 256 vCPUs, the detailed command is
> qemu-system-loongarch64 -smp 256 and there is 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>
> ---
> arch/loongarch/kvm/intc/eiointc.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/loongarch/kvm/intc/eiointc.c b/arch/loongarch/kvm/intc/eiointc.c
> index c32333695381..a1cc116b4dac 100644
> --- a/arch/loongarch/kvm/intc/eiointc.c
> +++ b/arch/loongarch/kvm/intc/eiointc.c
> @@ -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;
>
> base-commit: 3a8660878839faadb4f1a6dd72c3179c1df56787
> --
> 2.39.3
>
© 2016 - 2025 Red Hat, Inc.