So. ok. If I understood correctly : 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. 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 an older version of Linux.

On Wed, Aug 30, 2023 at 11:19 AM Mario Marietto <marietto2008@gmail.com> wrote:
ok. I've copied this file :

/home/marietto/Desktop/Dati/virt/qemu-v5.1.0/linux-headers/linux/kvm.h 

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


this time there isn't any specific error :(

On Wed, Aug 30, 2023 at 11:11 AM Mario Marietto <marietto2008@gmail.com> wrote:
Ok. thanks. Yes,I'm obliged to use a kernel minor than 5.7 and I've chosen 5.4. These are the places where I've found the kvm.h file that I need.

/home/marietto/Desktop/Dati/virt/qemu-v5.1.0/include/sysemu/kvm.h
/home/marietto/Desktop/Dati/virt/qemu-v5.1.0/linux-headers/asm-arm/kvm.h
/home/marietto/Desktop/Dati/virt/qemu-v5.1.0/linux-headers/linux/kvm.h

/home/marietto/Desktop/Dati/200/Si/linux-5.4.244/tools/include/uapi/linux/kvm.h
/home/marietto/Desktop/Dati/200/Si/linux-5.4.244/tools/arch/arm/include/uapi/asm/kvm.h
/home/marietto/Desktop/Dati/200/Si/linux-5.4.244/include/uapi/linux/kvm.h
/home/marietto/Desktop/Dati/200/Si/linux-5.4.244/include/config/kvm.h
/home/marietto/Desktop/Dati/200/Si/linux-5.4.244/include/trace/events/kvm.h
/home/marietto/Desktop/Dati/200/Si/linux-5.4.244/arch/arm/include/uapi/asm/kvm.h

Basically it seems that I can get it from the qemu 5.1 or from the kernel 5.4 source code files. Can you tell me what's the correct one ? You talked about linux-headers,so it might be this :

/home/marietto/Desktop/Dati/virt/qemu-v5.1.0/linux-headers/linux/kvm.h

?

where should I copy it ? to /usr/include/linux is the right place ?

thanks.



On Wed, Aug 30, 2023 at 9:46 AM Daniel P. Berrangé <berrange@redhat.com> wrote:
On Tue, Aug 29, 2023 at 09:22:35PM +0200, Mario Marietto wrote:
> Hello.
>
> I'm running Debian bookworm on my ARM Chromebook,model "xe303c12" and
> I've recompiled the kernel (5.4) to enable KVM,so now my system sounds like
> this :

That's surely not the default kernel that comes with Debian bookworm,
as that 5.4 version is many years old.

IIUC the standard bookworm kernel will be 6.4

> root@chromarietto:~#  virsh domcapabilities --machine virt
> --emulatorbin /usr/local/bin/qemu-system-arm
>
> 2023-08-29 10:17:59.110+0000: 1763: error : virHostCPUGetKVMMaxVCPUs:1228 :
> KVM is not supported on this platform: Function not implemented ;
> error: failed to get emulator capabilities
> error: KVM is not supported on this platform: Function not implemented

This shows libvirt was built against a kernel that lacks the
kvm.h header file.

This is expected for armv7 as support for KVM on 32-bit arm was
deleted in the 5.7 kernel. I expect libvirt was built against
the kernel headers from Debian's default 6.4 kernel and thus
lacks KVM support.

Your booting of the old 5.4 kernel doesn't solve this - you
would actually need to build libvirt (and QEMU) against this
outdated kernel too.


With regards,
Daniel
--
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|



--
Mario.


--
Mario.


--
Mario.