qemu-system-loongarch64 failed to run with kvm accel on Loongarch host with kernel 6.6
Host environment
-
Operating system:
Debian sid
-
OS/kernel version:
Linux debian 6.6.52-loong64 #1 SMP Debian 6.6.52-1.4 (2025-05-14) loongarch64 GNU/Linux
-
Architecture:
Loongarch64
-
QEMU flavor:
qemu-system-loongarch64
-
QEMU version:
QEMU emulator version 10.1.0 (Debian 1:10.1.0+ds-5)
-
QEMU command line:
qemu-system-loongarch64 \ -m 4G \ -cpu la464-loongarch-cpu \ -machine virt \ -accel kvm \ -smp 4 \ -serial stdio \ -device virtio-gpu-pci \ -net nic -net user \ -device nec-usb-xhci,id=xhci,addr=0x1b \ -device usb-tablet,id=tablet,bus=xhci.0,port=1 \ -device usb-kbd,id=keyboard,bus=xhci.0,port=2 \ -hda archlinux-minimal-2024.04.23-loong64.qcow2 \ -bios /usr/share/qemu-efi-loongarch64/QEMU_EFI.fd
Emulated/Virtualized environment
-
Operating system:
ArchLinux
-
OS/kernel version:
6.16
-
Architecture:
Loongarch64
Description of problem
I have installed Debian sid on a loongarch machine. with Loongson 3A6000 CPU. The kernel in this OS is Linux 6.6, which is provided by Loongnix 25. After upgrading qemu-system-loongarch64 to 10.1, the qemu-system-loongarch64 command fails to work. The error message is
IPI KVM_CREATE_DEVICE failed: Operation not supported
I have tried to install different versions of qemu-system-loongarch64 in debian snapshot. version 1:10.0.3+ds-4 or lower works well and 1:10.1.0+ds-1 or higher versions failed to work.
I also tried to upgrade the kernel version to 6.16.7, and qemu-system-loongarch64 10.1 works. In conclusion, the problem happens with the combination of kernel 6.6 and qemu 10.1.
I also check the source code of qemu. The error message is introduced by a new function kvm_ipi_realize() in qemu 10.1 in file hw/intc/loongarch_ipi_kvm.c. This function is commited by Bibo Mao in commit 412f6555.
void kvm_ipi_realize(DeviceState \*dev, Error \*\*errp)
{
LoongarchIPIState \*lis = LOONGARCH_IPI(dev);
int ret;
ret = kvm_create_device(kvm_state, KVM_DEV_TYPE_LOONGARCH_IPI, false);
if (ret \< 0) {
fprintf(stderr, "IPI KVM_CREATE_DEVICE failed: %s\\n",
strerror(-ret));
abort();
}
lis-\>dev_fd = ret;
}
Since kernel 6.6 is a long term version, qemu should support this version well or provide some compatibility plan at least.
Steps to reproduce
- Install Debian on a Loongson 3A6000 laptop computer with kernel 6.6.
- Install qemu-system-loongarch64 by "apt install qemu-system-misc"
- Download the virtual machine qcow2 file from https://loongarchlinux.org/pages/download/
- run the qemu command in the previous section.