* [Buildroot] [PATCH v3 0/9] kvm-unit-tests: update deps and fine tune qemu
@ 2025-07-21 15:48 Alex Bennée
2025-07-21 15:48 ` [Buildroot] [PATCH v3 1/9] toolchain/external: allow installing of libc utils Alex Bennée
` (8 more replies)
0 siblings, 9 replies; 12+ messages in thread
From: Alex Bennée @ 2025-07-21 15:48 UTC (permalink / raw)
To: buildroot
The kvm-unit-tests recipe is a little out of date with the
dependencies it needs. With that and some tweaking of the of processor
dependencies we can now build kvm-unit-tests for arm64.
As kvm-unit-tests need the libc utils and I use external tooling I
added support for that.
On the way I've added some new config options for QEMU so you can just
select your native, kvm-only QEMU build.
For Arm we can also run with kvmtool so I've added an option to enable
that.
Finally I've added a simple test case for the kvm-unit-tests package.
For v3
- add r-b tags
- update kvm-unit-tests to current master
- update kvmtool
- enable kvmtool as alternative to QEMU
For v2
- addressed review comments
- added external libc util support
- added test case
- ran and addressed linter warnings
Alex.
Alex Bennée (9):
toolchain/external: allow installing of libc utils
package/kvm-unit-tests: assume AArch64 supports KVM
package/kvm-unit-tests: update dependencies
package/qemu: introduce kvm and tcg system options
package/kvm-unit-tests: bump to current master
package/kvm-unit-tests: honour BR2_ARM64_PAGE_SIZE
support/testing: add test for kvm-unit-tests
package/kvmtool: bump to current HEAD
package/kvm-unit-tests: allow kvmtool to be used
board/qemu/aarch64-virt/linux.config | 2 +
package/kvm-unit-tests/Config.in | 37 +++++++++----
package/kvm-unit-tests/kvm-unit-tests.hash | 2 +-
package/kvm-unit-tests/kvm-unit-tests.mk | 20 +++++--
...e-h-inclusion-for-musl-compatibility.patch | 52 -------------------
package/kvmtool/kvmtool.hash | 2 +-
package/kvmtool/kvmtool.mk | 2 +-
package/qemu/Config.in | 23 ++++++--
package/qemu/qemu.mk | 14 ++++-
support/testing/tests/package/test_kvm.py | 47 +++++++++++++++++
toolchain/toolchain-external/Config.in | 7 +++
.../pkg-toolchain-external.mk | 24 +++++++++
12 files changed, 157 insertions(+), 75 deletions(-)
delete mode 100644 package/kvmtool/0001-remove-wordsize-h-inclusion-for-musl-compatibility.patch
create mode 100644 support/testing/tests/package/test_kvm.py
--
2.47.2
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Buildroot] [PATCH v3 1/9] toolchain/external: allow installing of libc utils
2025-07-21 15:48 [Buildroot] [PATCH v3 0/9] kvm-unit-tests: update deps and fine tune qemu Alex Bennée
@ 2025-07-21 15:48 ` Alex Bennée
2025-07-21 15:48 ` [Buildroot] [PATCH v3 2/9] package/kvm-unit-tests: assume AArch64 supports KVM Alex Bennée
` (7 subsequent siblings)
8 siblings, 0 replies; 12+ messages in thread
From: Alex Bennée @ 2025-07-21 15:48 UTC (permalink / raw)
To: buildroot; +Cc: Giulio Benetti, Romain Naour, Thomas Petazzoni
For buildroot's own tools we have BR2_PACKAGE_GLIBC_UTILS (and similar
for ulibc). As we need the tools for somethings we should also support
this for external toolchains.
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
toolchain/toolchain-external/Config.in | 7 ++++++
.../pkg-toolchain-external.mk | 24 +++++++++++++++++++
2 files changed, 31 insertions(+)
diff --git a/toolchain/toolchain-external/Config.in b/toolchain/toolchain-external/Config.in
index e91aa16326..cbf51fb019 100644
--- a/toolchain/toolchain-external/Config.in
+++ b/toolchain/toolchain-external/Config.in
@@ -143,4 +143,11 @@ config BR2_TOOLCHAIN_EXTERNAL_GDB_SERVER_COPY
Copy the gdbserver provided by the external toolchain to the
target.
+config BR2_TOOLCHAIN_EXTERNAL_LIBC_UTILS_COPY
+ bool "Install libc utilities"
+ depends on BR2_TOOLCHAIN_EXTERNAL
+ help
+ Enabling this option will compile and install the getconf,
+ ldd and locale gibc utilities for the target.
+
endif # BR2_TOOLCHAIN_EXTERNAL
diff --git a/toolchain/toolchain-external/pkg-toolchain-external.mk b/toolchain/toolchain-external/pkg-toolchain-external.mk
index 2c2afa76c0..4281c240af 100644
--- a/toolchain/toolchain-external/pkg-toolchain-external.mk
+++ b/toolchain/toolchain-external/pkg-toolchain-external.mk
@@ -450,6 +450,29 @@ define TOOLCHAIN_EXTERNAL_INSTALL_TARGET_GDBSERVER
endef
endif
+ifeq ($(BR2_TOOLCHAIN_EXTERNAL_LIBC_UTILS_COPY),y)
+define TOOLCHAIN_EXTERNAL_INSTALL_TARGET_LIBC_UTILS
+ $(Q)$(call MESSAGE,"Copying libc utils")
+ $(Q)ARCH_SYSROOT_DIR="$(call toolchain_find_sysroot,$(TOOLCHAIN_EXTERNAL_CC) $(TOOLCHAIN_EXTERNAL_CFLAGS))" ; \
+ utils_found=0 ; \
+ for d in $${ARCH_SYSROOT_DIR} \
+ $${ARCH_SYSROOT_DIR}/usr \
+ $(TOOLCHAIN_EXTERNAL_INSTALL_DIR); do \
+ if test -f $${d}/bin/getconf ; then \
+ for f in getconf ldd locale; do \
+ install -m 0755 -D $${d}/bin/$${f} $(TARGET_DIR)/usr/bin ; \
+ done ; \
+ utils_found=1 ; \
+ break ; \
+ fi ; \
+ done ; \
+ if [ $${utils_found} -eq 0 ] ; then \
+ echo "Could not find libc utils in external toolchain" ; \
+ exit 1 ; \
+ fi
+endef
+endif
+
define TOOLCHAIN_EXTERNAL_INSTALL_SYSROOT_LIBS
$(Q)SYSROOT_DIR="$(call toolchain_find_sysroot,$(TOOLCHAIN_EXTERNAL_CC))" ; \
ARCH_SYSROOT_DIR="$(call toolchain_find_sysroot,$(TOOLCHAIN_EXTERNAL_CC) $(TOOLCHAIN_EXTERNAL_CFLAGS))" ; \
@@ -631,6 +654,7 @@ endef
define $(2)_INSTALL_TARGET_CMDS
$$(TOOLCHAIN_EXTERNAL_CREATE_TARGET_LIB_SYMLINK)
$$(TOOLCHAIN_EXTERNAL_INSTALL_TARGET_LIBS)
+ $$(TOOLCHAIN_EXTERNAL_INSTALL_TARGET_LIBC_UTILS)
$$(TOOLCHAIN_EXTERNAL_INSTALL_TARGET_GDBSERVER)
$$(TOOLCHAIN_EXTERNAL_FIXUP_UCLIBCNG_LDSO)
$$(TOOLCHAIN_EXTERNAL_INSTALL_TARGET_LDD)
--
2.47.2
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [Buildroot] [PATCH v3 2/9] package/kvm-unit-tests: assume AArch64 supports KVM
2025-07-21 15:48 [Buildroot] [PATCH v3 0/9] kvm-unit-tests: update deps and fine tune qemu Alex Bennée
2025-07-21 15:48 ` [Buildroot] [PATCH v3 1/9] toolchain/external: allow installing of libc utils Alex Bennée
@ 2025-07-21 15:48 ` Alex Bennée
2025-07-21 15:48 ` [Buildroot] [PATCH v3 3/9] package/kvm-unit-tests: update dependencies Alex Bennée
` (6 subsequent siblings)
8 siblings, 0 replies; 12+ messages in thread
From: Alex Bennée @ 2025-07-21 15:48 UTC (permalink / raw)
To: buildroot; +Cc: Thomas Huth, Cyril Bur
Although it is possible to configure an AArch64 CPU without support
for EL2 in practice all the common AArch64 have supported
virtualisation from the start.
If we really wanted to be strict we could blacklist known non-EL2 CPUs
but AFAICT all the current ones in the config have EL2.
I should also note KVM on Arm is deprecated and was removed from the
kernel in v6.10.
Reviewed-by: Thomas Huth <huth@tuxfamily.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
v2
- leave BR2_cortex_a76 and BR2_cortex_a76_a55 in place as can be
used with arm32
v3
- r-b
---
package/kvm-unit-tests/Config.in | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/package/kvm-unit-tests/Config.in b/package/kvm-unit-tests/Config.in
index 02ea8dd58c..87b075c4b9 100644
--- a/package/kvm-unit-tests/Config.in
+++ b/package/kvm-unit-tests/Config.in
@@ -1,13 +1,13 @@
config BR2_PACKAGE_KVM_UNIT_TESTS_ARCH_SUPPORTS
bool
# On ARM, it needs virtualization extensions and little endian CPUs
- default y if (BR2_arm || BR2_aarch64) && \
+ default y if BR2_arm && \
(BR2_cortex_a7 || BR2_cortex_a12 || \
BR2_cortex_a15 || BR2_cortex_a15_a7 || \
BR2_cortex_a17 || BR2_cortex_a17_a7 || \
- BR2_cortex_a55 || BR2_cortex_a75 || \
- BR2_cortex_a75_a55 || BR2_cortex_a76 || \
- BR2_cortex_a76_a55)
+ BR2_cortex_a76 || BR2_cortex_a76_a55 )
+ # For AArch64 we can assume all v8.0+ support virtualization
+ default y if BR2_aarch64
default y if BR2_i386 || BR2_x86_64
default y if BR2_powerpc64 || BR2_powerpc64le
default y if BR2_s390x
--
2.47.2
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [Buildroot] [PATCH v3 3/9] package/kvm-unit-tests: update dependencies
2025-07-21 15:48 [Buildroot] [PATCH v3 0/9] kvm-unit-tests: update deps and fine tune qemu Alex Bennée
2025-07-21 15:48 ` [Buildroot] [PATCH v3 1/9] toolchain/external: allow installing of libc utils Alex Bennée
2025-07-21 15:48 ` [Buildroot] [PATCH v3 2/9] package/kvm-unit-tests: assume AArch64 supports KVM Alex Bennée
@ 2025-07-21 15:48 ` Alex Bennée
2025-07-21 15:48 ` [Buildroot] [PATCH v3 4/9] package/qemu: introduce kvm and tcg system options Alex Bennée
` (5 subsequent siblings)
8 siblings, 0 replies; 12+ messages in thread
From: Alex Bennée @ 2025-07-21 15:48 UTC (permalink / raw)
To: buildroot; +Cc: Thomas Huth, Cyril Bur
To run the tests we need a system QEMU, timeout, getconf and nmap-ncat
so update the select/depends for them. As we need at least GCC 8 we
can drop the specific requirement for old x86-64 tests.
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
v2
- remove old gcc notes as we need at least 8 anyway
- select QEMU and other runtime deps
- mention the runtime deps
- add support for getconf from external toolchain
- update comment fallback
---
package/kvm-unit-tests/Config.in | 24 +++++++++++++++++-------
1 file changed, 17 insertions(+), 7 deletions(-)
diff --git a/package/kvm-unit-tests/Config.in b/package/kvm-unit-tests/Config.in
index 87b075c4b9..775b250d5f 100644
--- a/package/kvm-unit-tests/Config.in
+++ b/package/kvm-unit-tests/Config.in
@@ -14,12 +14,19 @@ config BR2_PACKAGE_KVM_UNIT_TESTS_ARCH_SUPPORTS
config BR2_PACKAGE_KVM_UNIT_TESTS
bool "kvm-unit-tests"
- depends on BR2_PACKAGE_KVM_UNIT_TESTS_ARCH_SUPPORTS
- # on i386 and x86-64, __builtin_reachable is used, so we need
- # gcc 4.5 at least. on i386, we use the target gcc, while on
- # x86-64 we use the host gcc (see .mk file for details)
- depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_5 || !BR2_i386
depends on BR2_HOSTARCH = "x86_64" || !BR2_x86_64
+ depends on BR2_PACKAGE_KVM_UNIT_TESTS_ARCH_SUPPORTS
+ depends on BR2_TOOLCHAIN_GCC_AT_LEAST_8 # qemu
+ depends on BR2_PACKAGE_QEMU_ARCH_SUPPORTS_TARGET
+ depends on (BR2_PACKAGE_GLIBC_UTILS || \
+ BR2_UCLIBC_INSTALL_UTILS || \
+ BR2_TOOLCHAIN_EXTERNAL_LIBC_UTILS_COPY) # runtime getconf
+ select BR2_PACKAGE_QEMU
+ select BR2_PACKAGE_QEMU_SYSTEM # runtime for qemu-system-$ARCH
+ select BR2_PACKAGE_COREUTILS # runtime for timeout
+ select BR2_PACKAGE_BASH # runtime
+ select BR2_PACKAGE_NMAP
+ select BR2_PACKAGE_NMAP_NCAT # runtime for ncat
select BR2_HOSTARCH_NEEDS_IA32_COMPILER if BR2_x86_64
help
kvm-unit-tests is a project as old as KVM. As its name
@@ -39,6 +46,9 @@ config BR2_PACKAGE_KVM_UNIT_TESTS
http://www.linux-kvm.org/page/KVM-unit-tests
-comment "kvm-unit-tests needs a toolchain w/ gcc >= 4.5"
+comment "kvm-unit-tests needs a toolchain w/ utils and gcc >= 8"
depends on BR2_i386
- depends on !BR2_TOOLCHAIN_GCC_AT_LEAST_4_5
+ depends on !BR2_TOOLCHAIN_GCC_AT_LEAST_8
+ depends on !(BR2_PACKAGE_GLIBC_UTILS || \
+ BR2_UCLIBC_INSTALL_UTILS || \
+ BR2_TOOLCHAIN_EXTERNAL_LIBC_UTILS_COPY)
--
2.47.2
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [Buildroot] [PATCH v3 4/9] package/qemu: introduce kvm and tcg system options
2025-07-21 15:48 [Buildroot] [PATCH v3 0/9] kvm-unit-tests: update deps and fine tune qemu Alex Bennée
` (2 preceding siblings ...)
2025-07-21 15:48 ` [Buildroot] [PATCH v3 3/9] package/kvm-unit-tests: update dependencies Alex Bennée
@ 2025-07-21 15:48 ` Alex Bennée
2025-07-21 15:48 ` [Buildroot] [PATCH v3 5/9] package/kvm-unit-tests: bump to current master Alex Bennée
` (4 subsequent siblings)
8 siblings, 0 replies; 12+ messages in thread
From: Alex Bennée @ 2025-07-21 15:48 UTC (permalink / raw)
To: buildroot; +Cc: Romain Naour
When building system binaries you may not even want TCG support if you
are only intending to use KVM. Provide the options so the user can
select only what they need.
With only KVM selected the QEMU build will generally only build the
binary for your target system. We keep TCG support on by default so as
not to break existing defconfigs.
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
v2
- clean-up whitespace
- default TCG=y
- fix typos
- drop --enable-kvm from default configure list
---
package/qemu/Config.in | 23 ++++++++++++++++++-----
package/qemu/qemu.mk | 14 +++++++++++++-
2 files changed, 31 insertions(+), 6 deletions(-)
diff --git a/package/qemu/Config.in b/package/qemu/Config.in
index 2d15ab1ea9..49c78d26ec 100644
--- a/package/qemu/Config.in
+++ b/package/qemu/Config.in
@@ -59,6 +59,20 @@ config BR2_PACKAGE_QEMU_SYSTEM
if BR2_PACKAGE_QEMU_SYSTEM
+config BR2_PACKAGE_QEMU_SYSTEM_KVM
+ bool "Enable KVM system virtualisation"
+ default y
+ help
+ Say 'y' here to enable a QEMU with KVM support.
+ If unsure, say 'y'
+
+config BR2_PACKAGE_QEMU_SYSTEM_TCG
+ bool "Enable TCG system emulation"
+ default y
+ help
+ Say 'y' here to enable QEMU binaries which can emulate foreign
+ architectures using the TCG JIT.
+
config BR2_PACKAGE_QEMU_BLOBS
bool "Install binary blobs"
default y
@@ -130,12 +144,11 @@ config BR2_PACKAGE_QEMU_LINUX_USER
config BR2_PACKAGE_QEMU_CHOOSE_TARGETS
bool "Select individual emulator targets"
- depends on BR2_PACKAGE_QEMU_SYSTEM || BR2_PACKAGE_QEMU_LINUX_USER
+ depends on BR2_PACKAGE_QEMU_SYSTEM_TCG || BR2_PACKAGE_QEMU_LINUX_USER
help
- By default, all targets (system and/or user, subject to the
- corresponding options, above) are built. If you only need a
- subset of the emulated targets, say 'y' here and enable at
- least one target, below.
+ By default, all targets system targets are built when TCG is
+ enabled. If you only need a subset of the emulated targets,
+ say 'y' here and enable at least one target, below.
if BR2_PACKAGE_QEMU_CHOOSE_TARGETS
diff --git a/package/qemu/qemu.mk b/package/qemu/qemu.mk
index fdc8591e54..5e63166545 100644
--- a/package/qemu/qemu.mk
+++ b/package/qemu/qemu.mk
@@ -48,6 +48,19 @@ QEMU_VARS = LIBTOOL=$(HOST_DIR)/bin/libtool
ifeq ($(BR2_PACKAGE_QEMU_SYSTEM),y)
QEMU_DEPENDENCIES += pixman
QEMU_OPTS += --enable-system
+
+ifeq ($(BR2_PACKAGE_QEMU_SYSTEM_KVM), y)
+QEMU_OPTS += --enable-kvm
+else
+QEMU_OPTS += --disable-kvm
+endif
+
+ifeq ($(BR2_PACKAGE_QEMU_SYSTEM_TCG), y)
+QEMU_OPTS += --enable-tcg
+else
+QEMU_OPTS += --disable-tcg
+endif
+
QEMU_TARGET_LIST_$(BR2_PACKAGE_QEMU_TARGET_AARCH64) += aarch64-softmmu
QEMU_TARGET_LIST_$(BR2_PACKAGE_QEMU_TARGET_ALPHA) += alpha-softmmu
QEMU_TARGET_LIST_$(BR2_PACKAGE_QEMU_TARGET_ARM) += arm-softmmu
@@ -326,7 +339,6 @@ define QEMU_CONFIGURE_CMDS
--disable-whpx \
--disable-xen \
--enable-attr \
- --enable-kvm \
--enable-vhost-net \
--disable-download \
--disable-hexagon-idef-parser \
--
2.47.2
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [Buildroot] [PATCH v3 5/9] package/kvm-unit-tests: bump to current master
2025-07-21 15:48 [Buildroot] [PATCH v3 0/9] kvm-unit-tests: update deps and fine tune qemu Alex Bennée
` (3 preceding siblings ...)
2025-07-21 15:48 ` [Buildroot] [PATCH v3 4/9] package/qemu: introduce kvm and tcg system options Alex Bennée
@ 2025-07-21 15:48 ` Alex Bennée
2025-07-31 9:26 ` Thomas Huth
2025-07-21 15:48 ` [Buildroot] [PATCH v3 6/9] package/kvm-unit-tests: honour BR2_ARM64_PAGE_SIZE Alex Bennée
` (3 subsequent siblings)
8 siblings, 1 reply; 12+ messages in thread
From: Alex Bennée @ 2025-07-21 15:48 UTC (permalink / raw)
To: buildroot; +Cc: Thomas Huth, Cyril Bur
Update to the current version of KVM unit tests. The main changes
since the last check point:
- default page size to 4k (instead of 64k)
- support for kvmtool to launch tests
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
v3
- reword commit
- move to current master so we can use kvmtool as well
- didn't apply th_huth's r-b as moved to master
---
package/kvm-unit-tests/kvm-unit-tests.hash | 2 +-
package/kvm-unit-tests/kvm-unit-tests.mk | 5 ++---
2 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/package/kvm-unit-tests/kvm-unit-tests.hash b/package/kvm-unit-tests/kvm-unit-tests.hash
index d4db9f2b75..62d44667b3 100644
--- a/package/kvm-unit-tests/kvm-unit-tests.hash
+++ b/package/kvm-unit-tests/kvm-unit-tests.hash
@@ -1,4 +1,4 @@
# Locally computed
-sha256 8636994e10240705f10a9150ef688ae6832d0ea0dcc8860c826c645ecfc1169f kvm-unit-tests-v2024-01-08.tar.bz2
+sha256 ea2ac333785b20895ef0ca03fb068865dcfd62a1498c2f08a4b379c4cf4da631 kvm-unit-tests-f045ea5627a3a2d9800d0288269ecd044fb42914.tar.gz
sha256 b3c9ca9e257f2eaae070cf0ccdf8770764f05a947a39a835e633413750a5777b COPYRIGHT
sha256 8177f97513213526df2cf6184d8ff986c675afb514d4e68a404010521b880643 LICENSE
diff --git a/package/kvm-unit-tests/kvm-unit-tests.mk b/package/kvm-unit-tests/kvm-unit-tests.mk
index 73d20d6b2e..dc6416b0eb 100644
--- a/package/kvm-unit-tests/kvm-unit-tests.mk
+++ b/package/kvm-unit-tests/kvm-unit-tests.mk
@@ -4,9 +4,8 @@
#
################################################################################
-KVM_UNIT_TESTS_VERSION = 2024-01-08
-KVM_UNIT_TESTS_SOURCE = kvm-unit-tests-v$(KVM_UNIT_TESTS_VERSION).tar.bz2
-KVM_UNIT_TESTS_SITE = https://gitlab.com/kvm-unit-tests/kvm-unit-tests/-/archive/v$(KVM_UNIT_TESTS_VERSION)
+KVM_UNIT_TESTS_VERSION = f045ea5627a3a2d9800d0288269ecd044fb42914
+KVM_UNIT_TESTS_SITE = $(call gitlab,kvm-unit-tests,kvm-unit-tests,$(KVM_UNIT_TESTS_VERSION))
KVM_UNIT_TESTS_LICENSE = GPL-2.0, LGPL-2.0
KVM_UNIT_TESTS_LICENSE_FILES = COPYRIGHT LICENSE
--
2.47.2
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [Buildroot] [PATCH v3 6/9] package/kvm-unit-tests: honour BR2_ARM64_PAGE_SIZE
2025-07-21 15:48 [Buildroot] [PATCH v3 0/9] kvm-unit-tests: update deps and fine tune qemu Alex Bennée
` (4 preceding siblings ...)
2025-07-21 15:48 ` [Buildroot] [PATCH v3 5/9] package/kvm-unit-tests: bump to current master Alex Bennée
@ 2025-07-21 15:48 ` Alex Bennée
2025-07-21 15:48 ` [Buildroot] [PATCH v3 7/9] support/testing: add test for kvm-unit-tests Alex Bennée
` (2 subsequent siblings)
8 siblings, 0 replies; 12+ messages in thread
From: Alex Bennée @ 2025-07-21 15:48 UTC (permalink / raw)
To: buildroot; +Cc: Thomas Huth, Cyril Bur
The latest kvm-unit-tests defaults to 4k but there is no reason why we
shouldn't honour the system page size if it is set.
Reviewed-by: Thomas Huth <huth@tuxfamily.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
package/kvm-unit-tests/kvm-unit-tests.mk | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/package/kvm-unit-tests/kvm-unit-tests.mk b/package/kvm-unit-tests/kvm-unit-tests.mk
index dc6416b0eb..990795db00 100644
--- a/package/kvm-unit-tests/kvm-unit-tests.mk
+++ b/package/kvm-unit-tests/kvm-unit-tests.mk
@@ -35,6 +35,14 @@ KVM_UNIT_TESTS_CONF_OPTS =\
--processor="$(GCC_TARGET_CPU)" \
--endian="$(KVM_UNIT_TESTS_ENDIAN)"
+ifeq ($(BR2_ARM64_PAGE_SIZE_4K),y)
+KVM_UNIT_TESTS_CONF_OPTS += --page-size=4k
+else ifeq ($(BR2_ARM64_PAGE_SIZE_16K),y)
+KVM_UNIT_TESTS_CONF_OPTS += --page-size=16k
+else ifeq ($(BR2_ARM64_PAGE_SIZE_64K),y)
+KVM_UNIT_TESTS_CONF_OPTS += --page-size=64k
+endif
+
# For all architectures but x86-64, we use the target
# compiler. However, for x86-64, we use the host compiler, as
# kvm-unit-tests builds 32 bit code, which Buildroot toolchains for
--
2.47.2
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [Buildroot] [PATCH v3 7/9] support/testing: add test for kvm-unit-tests
2025-07-21 15:48 [Buildroot] [PATCH v3 0/9] kvm-unit-tests: update deps and fine tune qemu Alex Bennée
` (5 preceding siblings ...)
2025-07-21 15:48 ` [Buildroot] [PATCH v3 6/9] package/kvm-unit-tests: honour BR2_ARM64_PAGE_SIZE Alex Bennée
@ 2025-07-21 15:48 ` Alex Bennée
2025-07-21 15:48 ` [Buildroot] [PATCH v3 8/9] package/kvmtool: bump to current HEAD Alex Bennée
2025-07-21 15:48 ` [Buildroot] [PATCH v3 9/9] package/kvm-unit-tests: allow kvmtool to be used Alex Bennée
8 siblings, 0 replies; 12+ messages in thread
From: Alex Bennée @ 2025-07-21 15:48 UTC (permalink / raw)
To: buildroot; +Cc: Romain Naour
Now we have updated kvm-unit-tests we should defend it with a test. To
support that enable KVM in the qemu kernel config and boot an image
where we can run the basic tests.
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
board/qemu/aarch64-virt/linux.config | 2 +
support/testing/tests/package/test_kvm.py | 47 +++++++++++++++++++++++
2 files changed, 49 insertions(+)
create mode 100644 support/testing/tests/package/test_kvm.py
diff --git a/board/qemu/aarch64-virt/linux.config b/board/qemu/aarch64-virt/linux.config
index 971b9fcf86..9d1934c648 100644
--- a/board/qemu/aarch64-virt/linux.config
+++ b/board/qemu/aarch64-virt/linux.config
@@ -74,3 +74,5 @@ CONFIG_VIRTIO_FS=y
CONFIG_OVERLAY_FS=y
CONFIG_TMPFS=y
CONFIG_TMPFS_POSIX_ACL=y
+CONFIG_VIRTUALIZATION=y
+CONFIG_KVM=y
diff --git a/support/testing/tests/package/test_kvm.py b/support/testing/tests/package/test_kvm.py
new file mode 100644
index 0000000000..da5ebfb1b7
--- /dev/null
+++ b/support/testing/tests/package/test_kvm.py
@@ -0,0 +1,47 @@
+import os
+import infra.basetest
+
+KVM_TIMEOUT = 120
+
+
+class TestKVM(infra.basetest.BRTest):
+ config = \
+ """
+ BR2_aarch64=y
+ BR2_cortex_a72=y
+ BR2_TOOLCHAIN_EXTERNAL=y
+ BR2_TOOLCHAIN_EXTERNAL_LIBC_UTILS_COPY=y
+ BR2_OPTIMIZE_S=y
+ BR2_TARGET_ROOTFS_CPIO=y
+ BR2_LINUX_KERNEL=y
+ BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
+ BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="board/qemu/aarch64-virt/linux.config"
+ BR2_PACKAGE_BUSYBOX_SHOW_OTHERS=y
+ BR2_PACKAGE_KVM_UNIT_TESTS=y
+ # BR2_PACKAGE_QEMU_SYSTEM_TCG is not set
+ # BR2_PACKAGE_QEMU_BLOBS is not set
+ BR2_TARGET_ROOTFS_EXT2=y
+ """
+
+ def test_run(self):
+ kern = os.path.join(self.builddir, "images", "Image")
+ img = os.path.join(self.builddir, "images", "rootfs.ext2")
+
+ qemu_opts = ["-M", "virt,gic-version=3,virtualization=on",
+ "-cpu", "cortex-a72",
+ "-smp", "2",
+ "-m", "512M",
+ "-drive", f"file={img},if=virtio,format=raw", "-snapshot"]
+
+ self.emulator.boot(arch="aarch64",
+ kernel=kern,
+ kernel_cmdline=["root=/dev/vda console=ttyAMA0"],
+ options=qemu_opts)
+
+ self.emulator.login()
+
+ # Run the selftests
+ self.assertRunOk("/usr/share/kvm-unit-tests/selftest-setup")
+ self.assertRunOk("/usr/share/kvm-unit-tests/selftest-smp")
+ self.assertRunOk("/usr/share/kvm-unit-tests/selftest-vectors-kernel")
+ self.assertRunOk("/usr/share/kvm-unit-tests/selftest-vectors-user")
--
2.47.2
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [Buildroot] [PATCH v3 8/9] package/kvmtool: bump to current HEAD
2025-07-21 15:48 [Buildroot] [PATCH v3 0/9] kvm-unit-tests: update deps and fine tune qemu Alex Bennée
` (6 preceding siblings ...)
2025-07-21 15:48 ` [Buildroot] [PATCH v3 7/9] support/testing: add test for kvm-unit-tests Alex Bennée
@ 2025-07-21 15:48 ` Alex Bennée
2025-07-21 15:48 ` [Buildroot] [PATCH v3 9/9] package/kvm-unit-tests: allow kvmtool to be used Alex Bennée
8 siblings, 0 replies; 12+ messages in thread
From: Alex Bennée @ 2025-07-21 15:48 UTC (permalink / raw)
To: buildroot
By doing so we can also drop the patches for musl which have now been
merged upstream.
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
...e-h-inclusion-for-musl-compatibility.patch | 52 -------------------
package/kvmtool/kvmtool.hash | 2 +-
package/kvmtool/kvmtool.mk | 2 +-
3 files changed, 2 insertions(+), 54 deletions(-)
delete mode 100644 package/kvmtool/0001-remove-wordsize-h-inclusion-for-musl-compatibility.patch
diff --git a/package/kvmtool/0001-remove-wordsize-h-inclusion-for-musl-compatibility.patch b/package/kvmtool/0001-remove-wordsize-h-inclusion-for-musl-compatibility.patch
deleted file mode 100644
index 3128a23689..0000000000
--- a/package/kvmtool/0001-remove-wordsize-h-inclusion-for-musl-compatibility.patch
+++ /dev/null
@@ -1,52 +0,0 @@
-From 0592f8f829c843ff5cb2d108c309e32f4f6f5379 Mon Sep 17 00:00:00 2001
-From: Andre Przywara <andre.przywara@arm.com>
-Date: Thu, 1 Aug 2024 12:10:54 +0100
-Subject: remove wordsize.h inclusion (for musl compatibility)
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-The wordsize.h header file and the __WORDSIZE definition do not seem
-to be universal, the musl libc for instance has the definition in a
-different header file. This breaks compilation of kvmtool against musl.
-
-The two leading underscores suggest a compiler-internal symbol anyway, so
-let's just remove that particular macro usage entirely, and replace it
-with the number we really want: the size of a "long" type.
-
-Reported-by: J. Neuschäfer <j.neuschaefer@gmx.net>
-Signed-off-by: Andre Przywara <andre.przywara@arm.com>
-Reviewed-by: Alexandru Elisei <alexandru.elisei@arm.com>
-Link: https://lore.kernel.org/r/20240801111054.818765-1-andre.przywara@arm.com
-Signed-off-by: Will Deacon <will@kernel.org>
-Upstream: https://git.kernel.org/pub/scm/linux/kernel/git/will/kvmtool.git/commit/?id=0592f8f829c843ff5cb2d108c309e32f4f6f5379
-Signed-off-by: Thomas Perale <thomas.perale@mind.be>
----
- include/linux/bitops.h | 6 ++----
- 1 file changed, 2 insertions(+), 4 deletions(-)
-
-diff --git a/include/linux/bitops.h b/include/linux/bitops.h
-index ae33922f..ee8fd560 100644
---- a/include/linux/bitops.h
-+++ b/include/linux/bitops.h
-@@ -1,15 +1,13 @@
- #ifndef _KVM_LINUX_BITOPS_H_
- #define _KVM_LINUX_BITOPS_H_
-
--#include <bits/wordsize.h>
--
- #include <linux/kernel.h>
- #include <linux/compiler.h>
- #include <asm/hweight.h>
-
--#define BITS_PER_LONG __WORDSIZE
- #define BITS_PER_BYTE 8
--#define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(long))
-+#define BITS_PER_LONG (BITS_PER_BYTE * sizeof(long))
-+#define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_LONG)
-
- #define BIT_WORD(nr) ((nr) / BITS_PER_LONG)
-
---
-cgit 1.2.3-korg
-
diff --git a/package/kvmtool/kvmtool.hash b/package/kvmtool/kvmtool.hash
index 63bbb7167c..8df6f929df 100644
--- a/package/kvmtool/kvmtool.hash
+++ b/package/kvmtool/kvmtool.hash
@@ -1,3 +1,3 @@
# Locally computed
-sha256 a8504d8b184cae4e65ff5555cc84a436f3fbbc832a8017e3ca59d997dd5581db kvmtool-4d2c017f41533b0e51e00f689050c26190a15318-git4.tar.gz
+sha256 18841c414e82b405a0bd6f5c546bc088becd298c1145a2bac97563e699231925 kvmtool-1117dbc8ceb21abc6e8cd9861450695995852290-git4.tar.gz
sha256 0d5bf346df9e635a29dcdddf832dc5b002ca6cdc1c5c9c6c567d2a61bb0c5c15 COPYING
diff --git a/package/kvmtool/kvmtool.mk b/package/kvmtool/kvmtool.mk
index 7fec6643f8..f5637e5384 100644
--- a/package/kvmtool/kvmtool.mk
+++ b/package/kvmtool/kvmtool.mk
@@ -4,7 +4,7 @@
#
################################################################################
-KVMTOOL_VERSION = 4d2c017f41533b0e51e00f689050c26190a15318
+KVMTOOL_VERSION = 1117dbc8ceb21abc6e8cd9861450695995852290
KVMTOOL_SITE = https://git.kernel.org/pub/scm/linux/kernel/git/will/kvmtool.git
KVMTOOL_SITE_METHOD = git
KVMTOOL_DEPENDENCIES = \
--
2.47.2
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [Buildroot] [PATCH v3 9/9] package/kvm-unit-tests: allow kvmtool to be used
2025-07-21 15:48 [Buildroot] [PATCH v3 0/9] kvm-unit-tests: update deps and fine tune qemu Alex Bennée
` (7 preceding siblings ...)
2025-07-21 15:48 ` [Buildroot] [PATCH v3 8/9] package/kvmtool: bump to current HEAD Alex Bennée
@ 2025-07-21 15:48 ` Alex Bennée
8 siblings, 0 replies; 12+ messages in thread
From: Alex Bennée @ 2025-07-21 15:48 UTC (permalink / raw)
To: buildroot; +Cc: Thomas Huth, Cyril Bur
For some targets launching tests with kvmtool is an option which makes
for an even smaller test image. Create a new symbol which can be
expanded with additional targets that will allow the skipping of the
selection of QEMU if not needed.
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
package/kvm-unit-tests/Config.in | 9 +++++++--
package/kvm-unit-tests/kvm-unit-tests.mk | 7 +++++++
2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/package/kvm-unit-tests/Config.in b/package/kvm-unit-tests/Config.in
index 775b250d5f..eba88b6d30 100644
--- a/package/kvm-unit-tests/Config.in
+++ b/package/kvm-unit-tests/Config.in
@@ -12,6 +12,11 @@ config BR2_PACKAGE_KVM_UNIT_TESTS_ARCH_SUPPORTS
default y if BR2_powerpc64 || BR2_powerpc64le
default y if BR2_s390x
+# Some architectures can use kvmtool instead of QEMU to launch the tests
+config BR2_PACKAGE_KVM_UNIT_TESTS_CAN_USE_KVMTOOL
+ bool
+ default y if BR2_aarch64 && BR2_PACKAGE_KVMTOOL
+
config BR2_PACKAGE_KVM_UNIT_TESTS
bool "kvm-unit-tests"
depends on BR2_HOSTARCH = "x86_64" || !BR2_x86_64
@@ -21,8 +26,8 @@ config BR2_PACKAGE_KVM_UNIT_TESTS
depends on (BR2_PACKAGE_GLIBC_UTILS || \
BR2_UCLIBC_INSTALL_UTILS || \
BR2_TOOLCHAIN_EXTERNAL_LIBC_UTILS_COPY) # runtime getconf
- select BR2_PACKAGE_QEMU
- select BR2_PACKAGE_QEMU_SYSTEM # runtime for qemu-system-$ARCH
+ select BR2_PACKAGE_QEMU if !BR2_PACKAGE_KVM_UNIT_TESTS_CAN_USE_KVMTOOL
+ select BR2_PACKAGE_QEMU_SYSTEM if !BR2_PACKAGE_KVM_UNIT_TESTS_CAN_USE_KVMTOOL # runtime for qemu-system-$ARCH
select BR2_PACKAGE_COREUTILS # runtime for timeout
select BR2_PACKAGE_BASH # runtime
select BR2_PACKAGE_NMAP
diff --git a/package/kvm-unit-tests/kvm-unit-tests.mk b/package/kvm-unit-tests/kvm-unit-tests.mk
index 990795db00..1a5253e869 100644
--- a/package/kvm-unit-tests/kvm-unit-tests.mk
+++ b/package/kvm-unit-tests/kvm-unit-tests.mk
@@ -35,6 +35,13 @@ KVM_UNIT_TESTS_CONF_OPTS =\
--processor="$(GCC_TARGET_CPU)" \
--endian="$(KVM_UNIT_TESTS_ENDIAN)"
+# The default runner is QEMU but kvmtool can also be used
+ifeq ($(BR2_PACKAGE_QEMU_SYSTEM),y)
+KVM_UNIT_TESTS_CONF_OPTS += --target=qemu
+else ifeq ($(BR2_PACKAGE_KVMTOOL),y)
+KVM_UNIT_TESTS_CONF_OPTS += --target=kvmtool
+endif
+
ifeq ($(BR2_ARM64_PAGE_SIZE_4K),y)
KVM_UNIT_TESTS_CONF_OPTS += --page-size=4k
else ifeq ($(BR2_ARM64_PAGE_SIZE_16K),y)
--
2.47.2
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [Buildroot] [PATCH v3 5/9] package/kvm-unit-tests: bump to current master
2025-07-21 15:48 ` [Buildroot] [PATCH v3 5/9] package/kvm-unit-tests: bump to current master Alex Bennée
@ 2025-07-31 9:26 ` Thomas Huth
2025-08-05 16:34 ` Alex Bennée
0 siblings, 1 reply; 12+ messages in thread
From: Thomas Huth @ 2025-07-31 9:26 UTC (permalink / raw)
To: Alex Bennée; +Cc: buildroot, Cyril Bur
Am Mon, 21 Jul 2025 16:48:06 +0100
schrieb Alex Bennée <alex.bennee@linaro.org>:
> Update to the current version of KVM unit tests. The main changes
> since the last check point:
>
> - default page size to 4k (instead of 64k)
> - support for kvmtool to launch tests
>
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
>
> ---
> v3
> - reword commit
> - move to current master so we can use kvmtool as well
> - didn't apply th_huth's r-b as moved to master
> ---
> package/kvm-unit-tests/kvm-unit-tests.hash | 2 +-
> package/kvm-unit-tests/kvm-unit-tests.mk | 5 ++---
> 2 files changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/package/kvm-unit-tests/kvm-unit-tests.hash b/package/kvm-unit-tests/kvm-unit-tests.hash
> index d4db9f2b75..62d44667b3 100644
> --- a/package/kvm-unit-tests/kvm-unit-tests.hash
> +++ b/package/kvm-unit-tests/kvm-unit-tests.hash
> @@ -1,4 +1,4 @@
> # Locally computed
> -sha256 8636994e10240705f10a9150ef688ae6832d0ea0dcc8860c826c645ecfc1169f kvm-unit-tests-v2024-01-08.tar.bz2
> +sha256 ea2ac333785b20895ef0ca03fb068865dcfd62a1498c2f08a4b379c4cf4da631 kvm-unit-tests-f045ea5627a3a2d9800d0288269ecd044fb42914.tar.gz
Hi Alex,
the other patch to update to v2025-06-05 has been merged first, so you need
to refresh this patch now. I also just pushed a new tag v2025-07-31, so
please update to that one instead of just using a random commit.
Thanks,
Thomas
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [Buildroot] [PATCH v3 5/9] package/kvm-unit-tests: bump to current master
2025-07-31 9:26 ` Thomas Huth
@ 2025-08-05 16:34 ` Alex Bennée
0 siblings, 0 replies; 12+ messages in thread
From: Alex Bennée @ 2025-08-05 16:34 UTC (permalink / raw)
To: Thomas Huth; +Cc: buildroot, Cyril Bur
Thomas Huth <huth@tuxfamily.org> writes:
> Am Mon, 21 Jul 2025 16:48:06 +0100
> schrieb Alex Bennée <alex.bennee@linaro.org>:
>
>> Update to the current version of KVM unit tests. The main changes
>> since the last check point:
>>
>> - default page size to 4k (instead of 64k)
>> - support for kvmtool to launch tests
>>
>> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
>>
>> ---
>> v3
>> - reword commit
>> - move to current master so we can use kvmtool as well
>> - didn't apply th_huth's r-b as moved to master
>> ---
>> package/kvm-unit-tests/kvm-unit-tests.hash | 2 +-
>> package/kvm-unit-tests/kvm-unit-tests.mk | 5 ++---
>> 2 files changed, 3 insertions(+), 4 deletions(-)
>>
>> diff --git a/package/kvm-unit-tests/kvm-unit-tests.hash b/package/kvm-unit-tests/kvm-unit-tests.hash
>> index d4db9f2b75..62d44667b3 100644
>> --- a/package/kvm-unit-tests/kvm-unit-tests.hash
>> +++ b/package/kvm-unit-tests/kvm-unit-tests.hash
>> @@ -1,4 +1,4 @@
>> # Locally computed
>> -sha256 8636994e10240705f10a9150ef688ae6832d0ea0dcc8860c826c645ecfc1169f kvm-unit-tests-v2024-01-08.tar.bz2
>> +sha256 ea2ac333785b20895ef0ca03fb068865dcfd62a1498c2f08a4b379c4cf4da631 kvm-unit-tests-f045ea5627a3a2d9800d0288269ecd044fb42914.tar.gz
>
> Hi Alex,
>
> the other patch to update to v2025-06-05 has been merged first, so you need
> to refresh this patch now. I also just pushed a new tag v2025-07-31, so
> please update to that one instead of just using a random commit.
Thanks for that - I've updated and sent v4 to the list.
>
> Thanks,
> Thomas
--
Alex Bennée
Virtualisation Tech Lead @ Linaro
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2025-08-05 16:34 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-21 15:48 [Buildroot] [PATCH v3 0/9] kvm-unit-tests: update deps and fine tune qemu Alex Bennée
2025-07-21 15:48 ` [Buildroot] [PATCH v3 1/9] toolchain/external: allow installing of libc utils Alex Bennée
2025-07-21 15:48 ` [Buildroot] [PATCH v3 2/9] package/kvm-unit-tests: assume AArch64 supports KVM Alex Bennée
2025-07-21 15:48 ` [Buildroot] [PATCH v3 3/9] package/kvm-unit-tests: update dependencies Alex Bennée
2025-07-21 15:48 ` [Buildroot] [PATCH v3 4/9] package/qemu: introduce kvm and tcg system options Alex Bennée
2025-07-21 15:48 ` [Buildroot] [PATCH v3 5/9] package/kvm-unit-tests: bump to current master Alex Bennée
2025-07-31 9:26 ` Thomas Huth
2025-08-05 16:34 ` Alex Bennée
2025-07-21 15:48 ` [Buildroot] [PATCH v3 6/9] package/kvm-unit-tests: honour BR2_ARM64_PAGE_SIZE Alex Bennée
2025-07-21 15:48 ` [Buildroot] [PATCH v3 7/9] support/testing: add test for kvm-unit-tests Alex Bennée
2025-07-21 15:48 ` [Buildroot] [PATCH v3 8/9] package/kvmtool: bump to current HEAD Alex Bennée
2025-07-21 15:48 ` [Buildroot] [PATCH v3 9/9] package/kvm-unit-tests: allow kvmtool to be used Alex Bennée
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.