Error : virHostCPUGetKVMMaxVCPUs:1228 : KVM is not supported on this platform: Function not implemented.

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 : $ lsb_release -a No LSB modules are available. Distributor ID: Debian Description: Debian GNU/Linux 12 (bookworm) Release: 12 Codename: bookworm $ uname -a Linux chromarietto 5.4.244-stb-cbe #8 SMP PREEMPT Sat Aug 19 22:19:32 UTC 2023 armv7l GNU/Linux $ uname -r 5.4.244-stb-cbe $ kvm-ok INFO: /dev/kvm exists KVM acceleration can be used $ qemu-system-arm --version QEMU emulator version 5.1.0 (v5.1.0-dirty) Copyright (c) 2003-2020 Fabrice Bellard and the QEMU Project developers $ python3 --version Python 3.11.2 I have installed libvirt 9.7.0,qemu 5.1 and virt-manager from source code with the final goal to be able to connect qemu,kvm and libvirt together to virtualize FreeBSD 13.2 for arm 32 bit. Some useful informations about my platform : root@chromarietto:/home/marietto/Desktop# virt-host-validate QEMU: Checking if device /dev/kvm exists : PASS QEMU: Checking if device /dev/kvm is accessible : PASS QEMU: Checking if device /dev/vhost-net exists : PASS QEMU: Checking if device /dev/net/tun exists : PASS QEMU: Checking for cgroup 'cpu' controller support : PASS QEMU: Checking for cgroup 'cpuacct' controller support : PASS QEMU: Checking for cgroup 'cpuset' controller support : PASS QEMU: Checking for cgroup 'memory' controller support : PASS QEMU: Checking for cgroup 'devices' controller support : PASS QEMU: Checking for cgroup 'blkio' controller support : PASS QEMU: Checking for device assignment IOMMU support : WARN (No ACPI IORT table found, IOMMU not supported by this hardware platform) QEMU: Checking for secure guest support : WARN (Unknown if this platform has Secure Guest support) LXC: Checking for Linux >= 2.6.26 : PASS LXC: Checking for namespace ipc : PASS LXC: Checking for namespace mnt : PASS LXC: Checking for namespace pid : PASS LXC: Checking for namespace uts : PASS LXC: Checking for namespace net : PASS LXC: Checking for namespace user : PASS LXC: Checking for cgroup 'cpu' controller support : PASS LXC: Checking for cgroup 'cpuacct' controller support : PASS LXC: Checking for cgroup 'cpuset' controller support : PASS LXC: Checking for cgroup 'memory' controller support : PASS LXC: Checking for cgroup 'devices' controller support : PASS LXC: Checking for cgroup 'freezer' controller support : FAIL (Enable 'freezer' in kernel Kconfig file or mount/enable cgroup controller in your system) LXC: Checking for cgroup 'blkio' controller support : PASS LXC: Checking if device /sys/fs/fuse/connections exists : PASS # lsmod | grep kvm no errors (I have embedded the options needed to enable KVM inside the kernel) # virsh --connect qemu:///system capabilities | grep baselabel <baselabel type='kvm'>+1002:+1002</baselabel> <baselabel type='qemu'>+1002:+1002</baselabel> The error that I'm not able to fix is the following one : 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 and this is the log that I've got when I ran libvirtd with the debug option enabled root@chromarietto:~# libvirtd --debug [Tue, 29 Aug 2023 10:10:11 virt-manager 2141] DEBUG (createvm:494) UEFI found, setting it as default. [Tue, 29 Aug 2023 10:10:11 virt-manager 2141] DEBUG (createvm:728) Guest type set to os_type=hvm, arch=armv7l, dom_type=kvm [Tue, 29 Aug 2023 10:10:11 virt-manager 2141] DEBUG (guest:546) Prefer EFI => True 2023-08-29 10:10:12.972+0000: 1765: error : virHostCPUGetKVMMaxVCPUs:1228 : KVM is not supported on this platform: Function not implemented [Tue, 29 Aug 2023 10:10:12 virt-manager 2141] DEBUG (domcapabilities:250) Error fetching domcapabilities XML Traceback (most recent call last): File "/usr/local/share/virt-manager/virtinst/domcapabilities.py", line 245, in build_from_params xml = conn.getDomainCapabilities(emulator, arch, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/libvirt.py", line 4612, in getDomainCapabilities raise libvirtError('virConnectGetDomainCapabilities() failed') libvirt.libvirtError: KVM is not supported on this platform: Function not implemented *2023-08-29 10:10:14.157+0000: 1762: error : virHostCPUGetKVMMaxVCPUs:1228 : KVM is not supported on this platform: Function not implemented* [Tue, 29 Aug 2023 10:10:14 virt-manager 2141] DEBUG (domcapabilities:250) Error fetching domcapabilities XML Traceback (most recent call last): File "/usr/local/share/virt-manager/virtinst/domcapabilities.py", line 245, in build_from_params xml = conn.getDomainCapabilities(emulator, arch, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/libvirt.py", line 4612, in getDomainCapabilities raise libvirtError('virConnectGetDomainCapabilities() failed') libvirt.libvirtError: KVM is not supported on this platform: Function not implemented [Tue, 29 Aug 2023 10:10:14 virt-manager 2141] DEBUG (createvm:497) Error checking for UEFI default Traceback (most recent call last): File "/usr/local/share/virt-manager/virtManager/createvm.py", line 491, in _set_caps_state guest.enable_uefi() File "/usr/local/share/virt-manager/virtinst/guest.py", line 589, in enable_uefi path = self._lookup_default_uefi_path() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/share/virt-manager/virtinst/guest.py", line 848, in _lookup_default_uefi_path raise RuntimeError(_("Libvirt version does not support UEFI.")) RuntimeError: Libvirt version does not support UEFI Does anyone know how to fix that error ? -- Mario.

On 8/29/23 21:22, Mario Marietto wrote:
Hello.
The error that I'm not able to fix is the following one :
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 is the source code that reports that error: https://gitlab.com/libvirt/libvirt/-/blob/master/src/util/virhostcpu.c?ref_t... Long story short, you are missing kvm.h header. On my system it's located under: /usr/include/linux/kvm.h and provided by linux-headers package. And if you think about it (and take a look at the other implementation of the function), it kind of makes sense - libvirt opens /dev/kvm and calls series of ioctl()-s to learn about KVM capabilities. Libvirt shouldn't hard code values but rather use the ones provided by kernel header files. Happy hacking! Michal

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 :|

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:
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
On Tue, Aug 29, 2023 at 09:22:35PM +0200, Mario Marietto wrote: 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.

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:
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
On Tue, Aug 29, 2023 at 09:22:35PM +0200, Mario Marietto wrote: 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.

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:
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
On Tue, Aug 29, 2023 at 09:22:35PM +0200, Mario Marietto wrote: 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.

Hello. I'm trying to compile libvirt from scratch on my ARM chromebook using Ubuntu 22.04 as host os where I have recompiled the kernel 5.4.244 enabling kvm, also recompiling qemu 5.1 from scratch and where I have installed these kernel sources and libraries : https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.4.244/armhf/linux-headers-... 44- <goog_504463333>0504244.202305301242_armhf.deb https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.4.244/armhf/linux-image-5.... - <goog_504463330>0504244.202305301242_armhf.deb https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.4.244/armhf/linux-modules-... 44- <goog_504463329>0504244.202305301242_armhf.deb https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.4.244/amd64/linux-headers-... 44.202305301242_all.deb dpkg -i linux-headers-5.4.244-0504244-generic_5.4.244-0504244.202305301242_armhf.deb dpkg -i linux-headers-5.4.244-0504244_5.4.244-0504244.202305301242_all.deb dpkg -i linux-image-5.4.244-0504244-generic_5.4.244-0504244.202305301242_armhf.deb dpkg -i linux-modules-5.4.244-0504244-generic_5.4.244-0504244.202305301242_armhf.deb be careful about the version of those files. It is the same version of the kernel that I'm using,5.4.244 : # uname -a Linux chromarietto 5.4.244 #9 SMP Mon Aug 28 16:14:27 UTC 2023 armv7l armv7l armv7l GNU/Linux The idea behind is to place the correct files needed by libvirt to the right places. Unfortunately I haven't reached the solution yet,as you can see below. Can you tell me which files libvirt wants to find and into which directories it wants them ? thanks : root@chromarietto:/Dati/libvirt# ninja -C build ninja: Entering directory `build' [64/1485] Compiling C object src/util/libvirt_util.a.p/virhostcpu.c.o FAILED: src/util/libvirt_util.a.p/virhostcpu.c.o cc -Isrc/util/libvirt_util.a.p -Isrc/util -I../src/util -Iinclude -I../include -Isrc -I../src -I. -I.. -I/usr/include/p11-kit-1 -I/usr/ include/libnl3 -I/usr/include/glib-2.0 -I/usr/lib/arm-linux-gnueabihf/glib-2.0/include -I/usr/include/gio-unix-2.0 -I/usr/include/libmo unt -I/usr/include/blkid -I/usr/include/libxml2 -I/usr/include/yajl -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-p ch -Wextra -std=gnu99 -O2 -g -Werror -fasynchronous-unwind-tables -fexceptions -fipa-pure-const -fno-common -Wabsolute-value -Waddress -Waddress-of-packed-member -Waggressive-loop-optimizations -Walloc-size-larger-than=2147483647 -Walloca -Warray-bounds=2 -Wattribute-al ias=2 -Wattribute-warning -Wattributes -Wbool-compare -Wbool-operation -Wbuiltin-declaration-mismatch -Wbuiltin-macro-redefined -Wcanno t-profile -Wcast-align -Wcast-align=strict -Wno-cast-function-type -Wchar-subscripts -Wclobbered -Wcomment -Wcomments -Wcoverage-mismat ch -Wcpp -Wdangling-else -Wdate-time -Wdeclaration-after-statement -Wdeprecated-declarations -Wdesignated-init -Wdiscarded-array-qualif iers -Wdiscarded-qualifiers -Wdiv-by-zero -Wduplicated-cond -Wduplicate-decl-specifier -Wempty-body -Wendif-labels -Wexpansion-to-defin ed -Wformat-contains-nul -Wformat-extra-args -Wno-format-nonliteral -Wformat-overflow=2 -Wformat-security -Wno-format-truncation -Wform at-y2k -Wformat-zero-length -Wframe-address -Wframe-larger-than=2048 -Wfree-nonheap-object -Whsa -Wif-not-aligned -Wignored-attributes -Wignored-qualifiers -Wimplicit -Wimplicit-fallthrough=5 -Wimplicit-function-declaration -Wimplicit-int -Wincompatible-pointer-types -W init-self -Winline -Wint-conversion -Wint-in-bool-context -Wint-to-pointer-cast -Winvalid-memory-model -Winvalid-pch -Wjump-misses-init -Wlogical-not-parentheses -Wlogical-op -Wmain -Wmaybe-uninitialized -Wmemset-elt-size -Wmemset-transposed-args -Wmisleading-indentatio n -Wmissing-attributes -Wmissing-braces -Wmissing-declarations -Wmissing-field-initializers -Wmissing-include-dirs -Wmissing-parameter- type -Wmissing-profile -Wmissing-prototypes -Wmultichar -Wmultistatement-macros -Wnarrowing -Wnested-externs -Wnonnull -Wnonnull-compar e -Wnormalized=nfc -Wnull-dereference -Wodr -Wold-style-declaration -Wold-style-definition -Wopenmp-simd -Woverflow -Woverride-init -Wp acked-bitfield-compat -Wpacked-not-aligned -Wparentheses -Wpointer-arith -Wpointer-compare -Wpointer-sign -Wpointer-to-int-cast -Wpragm as -Wpsabi -Wrestrict -Wreturn-local-addr -Wreturn-type -Wscalar-storage-order -Wsequence-point -Wshadow -Wshift-count-negative -Wshift -count-overflow -Wshift-negative-value -Wshift-overflow=2 -Wno-sign-compare -Wsizeof-array-argument -Wsizeof-pointer-div -Wsizeof-point er-memaccess -Wstrict-aliasing -Wstrict-prototypes -Wstringop-overflow=2 -Wstringop-truncation -Wsuggest-attribute=cold -Wno-suggest-at tribute=const -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wno-suggest-attribute=pure -Wsuggest-final-methods -Wsuggest-fin al-types -Wswitch -Wswitch-bool -Wswitch-enum -Wswitch-unreachable -Wsync-nand -Wtautological-compare -Wtrampolines -Wtrigraphs -Wtype- limits -Wuninitialized -Wunknown-pragmas -Wunused -Wunused-but-set-parameter -Wunused-but-set-variable -Wunused-const-variable=2 -Wunus ed-function -Wunused-label -Wunused-local-typedefs -Wunused-parameter -Wunused-result -Wunused-value -Wunused-variable -Wvarargs -Wvari adic-macros -Wvector-operation-performance -Wvla -Wvolatile-register-var -Wwrite-strings -fstack-protector-strong -Wdouble-promotion -f PIC -pthread -DIN_LIBVIRT '-Dabs_top_builddir="/Dati/libvirt/build"' '-Dabs_top_srcdir="/Dati/libvirt"' -MD -MQ src/util/libvirt_util.a .p/virhostcpu.c.o -MF src/util/libvirt_util.a.p/virhostcpu.c.o.d -o src/util/libvirt_util.a.p/virhostcpu.c.o -c ../src/util/virhostcpu. c ../src/util/virhostcpu.c: In function ‘virHostCPUGetKVMMaxVCPUs’: ../src/util/virhostcpu.c:1212:26: error: ‘KVM_CHECK_EXTENSION’ undeclared (first use in this function); did you mean ‘G_GNUC_EXTENSION’ ? 1212 | if ((ret = ioctl(fd, KVM_CHECK_EXTENSION, KVM_CAP_NR_VCPUS)) > 0) | ^~~~~~~~~~~~~~~~~~~ | G_GNUC_EXTENSION ../src/util/virhostcpu.c:1212:26: note: each undeclared identifier is reported only once for each function it appears in ../src/util/virhostcpu.c:1212:47: error: ‘KVM_CAP_NR_VCPUS’ undeclared (first use in this function) 1212 | if ((ret = ioctl(fd, KVM_CHECK_EXTENSION, KVM_CAP_NR_VCPUS)) > 0) | ^~~~~~~~~~~~~~~~ [66/1485] Compiling C object src/util/libvirt_util.a.p/virhostmem.c.o ninja: build stopped: subcommand failed. On Wed, Aug 30, 2023 at 5:02 PM Mario Marietto <marietto2008@gmail.com> wrote:
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.
-- Mario.
participants (3)
-
Daniel P. Berrangé
-
Mario Marietto
-
Michal Prívozník