The libvirt developers explained to me what's wrong. In my system the file kvm.h is missing. I should install the kernel headers file if I want it. I could do this if the kernel in use was 6.1,but I'm forced to use 5.4. I can't install the kernel headers for the kernel 5.4 on top of debian bookworm. Or at least,at the moment I don't know how to do this. I'm not sure that the kernel headers for the 5.4 kernel are present between the packages. Or maybe I can build it from scratch or I can find it somewhere ? Even in this case, I'm not sure that they will work on a system that has been compiled on top of a 6.x kernel.
Anyway,I've found the missing file here :
/home/marietto/Desktop/Dati/virt/qemu-v5.1.0/linux-headers/linux/kvm.h
and I've copied it to this directory :
/usr/include/linux
the previous error is gone,but it still doesn't work :
# virsh domcapabilities --machine virt --emulatorbin /usr/local/bin/qemu-system-arm
error: failed to get emulator capabilities
error: KVM is not supported on this platform: Function not implemented
I think that I should re-compile libvirt and QEMU on top of the 5.4 kernel and for this reason I should use an older version of Debian,maybe 8 or 9. Maybe later,I can upgrade the userland from 8/9 to 12,keeping intact the same kernel. What do you think ? do you see a shorter solution ? for sure I don't like to reinstall and recompile everything on a older version of Linux.