* [Buildroot] [RFC PATCH v2 1/7] toolchain/external: allow installing of libc utils
2025-07-11 16:43 [Buildroot] [RFC PATCH v2 0/7] kvm-unit-tests: update deps and fine tune qemu Alex Bennée
@ 2025-07-11 16:43 ` Alex Bennée
2025-07-11 16:44 ` [Buildroot] [RFC PATCH v2 2/7] package/kvm-unit-tests: assume AArch64 supports KVM Alex Bennée
` (5 subsequent siblings)
6 siblings, 0 replies; 15+ messages in thread
From: Alex Bennée @ 2025-07-11 16:43 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] 15+ messages in thread* [Buildroot] [RFC PATCH v2 2/7] package/kvm-unit-tests: assume AArch64 supports KVM
2025-07-11 16:43 [Buildroot] [RFC PATCH v2 0/7] kvm-unit-tests: update deps and fine tune qemu Alex Bennée
2025-07-11 16:43 ` [Buildroot] [RFC PATCH v2 1/7] toolchain/external: allow installing of libc utils Alex Bennée
@ 2025-07-11 16:44 ` Alex Bennée
2025-07-12 6:32 ` Thomas Huth
2025-07-11 16:44 ` [Buildroot] [RFC PATCH v2 3/7] package/kvm-unit-tests: update dependencies Alex Bennée
` (4 subsequent siblings)
6 siblings, 1 reply; 15+ messages in thread
From: Alex Bennée @ 2025-07-11 16:44 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.
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
---
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] 15+ messages in thread* Re: [Buildroot] [RFC PATCH v2 2/7] package/kvm-unit-tests: assume AArch64 supports KVM
2025-07-11 16:44 ` [Buildroot] [RFC PATCH v2 2/7] package/kvm-unit-tests: assume AArch64 supports KVM Alex Bennée
@ 2025-07-12 6:32 ` Thomas Huth
0 siblings, 0 replies; 15+ messages in thread
From: Thomas Huth @ 2025-07-12 6:32 UTC (permalink / raw)
To: Alex Bennée; +Cc: buildroot, Cyril Bur
Am Fri, 11 Jul 2025 17:44:00 +0100
schrieb Alex Bennée <alex.bennee@linaro.org>:
> 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.
>
> 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
> ---
> package/kvm-unit-tests/Config.in | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
Reviewed-by: Thomas Huth <huth@tuxfamily.org>
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Buildroot] [RFC PATCH v2 3/7] package/kvm-unit-tests: update dependencies
2025-07-11 16:43 [Buildroot] [RFC PATCH v2 0/7] kvm-unit-tests: update deps and fine tune qemu Alex Bennée
2025-07-11 16:43 ` [Buildroot] [RFC PATCH v2 1/7] toolchain/external: allow installing of libc utils Alex Bennée
2025-07-11 16:44 ` [Buildroot] [RFC PATCH v2 2/7] package/kvm-unit-tests: assume AArch64 supports KVM Alex Bennée
@ 2025-07-11 16:44 ` Alex Bennée
2025-07-12 6:34 ` Thomas Huth
2025-07-11 16:44 ` [Buildroot] [RFC PATCH v2 4/7] package/qemu: introduce kvm and tcg system options Alex Bennée
` (3 subsequent siblings)
6 siblings, 1 reply; 15+ messages in thread
From: Alex Bennée @ 2025-07-11 16:44 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] 15+ messages in thread* Re: [Buildroot] [RFC PATCH v2 3/7] package/kvm-unit-tests: update dependencies
2025-07-11 16:44 ` [Buildroot] [RFC PATCH v2 3/7] package/kvm-unit-tests: update dependencies Alex Bennée
@ 2025-07-12 6:34 ` Thomas Huth
2025-07-15 9:19 ` Alex Bennée
0 siblings, 1 reply; 15+ messages in thread
From: Thomas Huth @ 2025-07-12 6:34 UTC (permalink / raw)
To: Alex Bennée; +Cc: buildroot, Cyril Bur
Am Fri, 11 Jul 2025 17:44:01 +0100
schrieb Alex Bennée <alex.bennee@linaro.org>:
> 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
AFAIK kvm-unit-tests can be used with kvmtool instead of QEMU, too ... so
hard-coding QEMU high might not be the best solution for the user?
Thomas
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [Buildroot] [RFC PATCH v2 3/7] package/kvm-unit-tests: update dependencies
2025-07-12 6:34 ` Thomas Huth
@ 2025-07-15 9:19 ` Alex Bennée
2025-07-20 17:14 ` Thomas Huth
0 siblings, 1 reply; 15+ messages in thread
From: Alex Bennée @ 2025-07-15 9:19 UTC (permalink / raw)
To: Thomas Huth; +Cc: buildroot, Cyril Bur
Thomas Huth <huth@tuxfamily.org> writes:
> Am Fri, 11 Jul 2025 17:44:01 +0100
> schrieb Alex Bennée <alex.bennee@linaro.org>:
>
>> 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
>
> AFAIK kvm-unit-tests can be used with kvmtool instead of QEMU, too ... so
> hard-coding QEMU high might not be the best solution for the user?
The current build doesn't support kvmtool but maybe something like this
as a follow-on patch:
--8<---------------cut here---------------start------------->8---
modified package/kvm-unit-tests/Config.in
@@ -21,8 +21,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_KVMTOOL
+ select BR2_PACKAGE_QEMU_SYSTEM if !BR2_PACKAGE_KVMTOOL # runtime for qemu-system-$ARCH
select BR2_PACKAGE_COREUTILS # runtime for timeout
select BR2_PACKAGE_BASH # runtime
select BR2_PACKAGE_NMAP
modified package/kvm-unit-tests/kvm-unit-tests.mk
@@ -36,6 +36,13 @@ KVM_UNIT_TESTS_CONF_OPTS =\
--processor="$(GCC_TARGET_CPU)" \
--endian="$(KVM_UNIT_TESTS_ENDIAN)"
+# The default runner is QEMU but kvmtool can 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)
--8<---------------cut here---------------end--------------->8---
What do you think?
>
> 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] 15+ messages in thread
* Re: [Buildroot] [RFC PATCH v2 3/7] package/kvm-unit-tests: update dependencies
2025-07-15 9:19 ` Alex Bennée
@ 2025-07-20 17:14 ` Thomas Huth
2025-07-21 8:29 ` Alex Bennée
0 siblings, 1 reply; 15+ messages in thread
From: Thomas Huth @ 2025-07-20 17:14 UTC (permalink / raw)
To: Alex Bennée; +Cc: buildroot, Cyril Bur
Am Tue, 15 Jul 2025 10:19:38 +0100
schrieb Alex Bennée <alex.bennee@linaro.org>:
> Thomas Huth <huth@tuxfamily.org> writes:
>
> > Am Fri, 11 Jul 2025 17:44:01 +0100
> > schrieb Alex Bennée <alex.bennee@linaro.org>:
> >
> >> 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
> >
> > AFAIK kvm-unit-tests can be used with kvmtool instead of QEMU, too ... so
> > hard-coding QEMU high might not be the best solution for the user?
>
> The current build doesn't support kvmtool but maybe something like this
> as a follow-on patch:
>
> --8<---------------cut here---------------start------------->8---
> modified package/kvm-unit-tests/Config.in
> @@ -21,8 +21,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_KVMTOOL
> + select BR2_PACKAGE_QEMU_SYSTEM if !BR2_PACKAGE_KVMTOOL # runtime for qemu-system-$ARCH
> select BR2_PACKAGE_COREUTILS # runtime for timeout
> select BR2_PACKAGE_BASH # runtime
> select BR2_PACKAGE_NMAP
> modified package/kvm-unit-tests/kvm-unit-tests.mk
> @@ -36,6 +36,13 @@ KVM_UNIT_TESTS_CONF_OPTS =\
> --processor="$(GCC_TARGET_CPU)" \
> --endian="$(KVM_UNIT_TESTS_ENDIAN)"
>
> +# The default runner is QEMU but kvmtool can 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)
> --8<---------------cut here---------------end--------------->8---
>
> What do you think?
Looks good! ... though kvmtool can only be used for aarch64/arm or riscv
as far as I know. Not sure whether that additional dependency should be
reflected here, too, though.
Thomas
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [Buildroot] [RFC PATCH v2 3/7] package/kvm-unit-tests: update dependencies
2025-07-20 17:14 ` Thomas Huth
@ 2025-07-21 8:29 ` Alex Bennée
0 siblings, 0 replies; 15+ messages in thread
From: Alex Bennée @ 2025-07-21 8:29 UTC (permalink / raw)
To: Thomas Huth; +Cc: buildroot, Cyril Bur
Thomas Huth <huth@tuxfamily.org> writes:
> Am Tue, 15 Jul 2025 10:19:38 +0100
> schrieb Alex Bennée <alex.bennee@linaro.org>:
>
>> Thomas Huth <huth@tuxfamily.org> writes:
>>
>> > Am Fri, 11 Jul 2025 17:44:01 +0100
>> > schrieb Alex Bennée <alex.bennee@linaro.org>:
>> >
>> >> 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
>> >
>> > AFAIK kvm-unit-tests can be used with kvmtool instead of QEMU, too ... so
>> > hard-coding QEMU high might not be the best solution for the user?
>>
>> The current build doesn't support kvmtool but maybe something like this
>> as a follow-on patch:
>>
>> --8<---------------cut here---------------start------------->8---
>> modified package/kvm-unit-tests/Config.in
>> @@ -21,8 +21,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_KVMTOOL
>> + select BR2_PACKAGE_QEMU_SYSTEM if !BR2_PACKAGE_KVMTOOL # runtime for qemu-system-$ARCH
>> select BR2_PACKAGE_COREUTILS # runtime for timeout
>> select BR2_PACKAGE_BASH # runtime
>> select BR2_PACKAGE_NMAP
>> modified package/kvm-unit-tests/kvm-unit-tests.mk
>> @@ -36,6 +36,13 @@ KVM_UNIT_TESTS_CONF_OPTS =\
>> --processor="$(GCC_TARGET_CPU)" \
>> --endian="$(KVM_UNIT_TESTS_ENDIAN)"
>>
>> +# The default runner is QEMU but kvmtool can 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)
>> --8<---------------cut here---------------end--------------->8---
>>
>> What do you think?
>
> Looks good! ... though kvmtool can only be used for aarch64/arm or riscv
> as far as I know. Not sure whether that additional dependency should be
> reflected here, too, though.
I think I need to reflect this in Config.in instead as I don't think
BR2_PACKAGE_QEMU_SYSTEM/BR2_PACKAGE_KVMTOOL is available to the
KVM_UNIT_TESTS makefile.
--
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] 15+ messages in thread
* [Buildroot] [RFC PATCH v2 4/7] package/qemu: introduce kvm and tcg system options
2025-07-11 16:43 [Buildroot] [RFC PATCH v2 0/7] kvm-unit-tests: update deps and fine tune qemu Alex Bennée
` (2 preceding siblings ...)
2025-07-11 16:44 ` [Buildroot] [RFC PATCH v2 3/7] package/kvm-unit-tests: update dependencies Alex Bennée
@ 2025-07-11 16:44 ` Alex Bennée
2025-07-11 16:44 ` [Buildroot] [RFC PATCH v2 5/7] package/kvm-unit-tests: bump to 2025-06-05 Alex Bennée
` (2 subsequent siblings)
6 siblings, 0 replies; 15+ messages in thread
From: Alex Bennée @ 2025-07-11 16:44 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] 15+ messages in thread* [Buildroot] [RFC PATCH v2 5/7] package/kvm-unit-tests: bump to 2025-06-05
2025-07-11 16:43 [Buildroot] [RFC PATCH v2 0/7] kvm-unit-tests: update deps and fine tune qemu Alex Bennée
` (3 preceding siblings ...)
2025-07-11 16:44 ` [Buildroot] [RFC PATCH v2 4/7] package/qemu: introduce kvm and tcg system options Alex Bennée
@ 2025-07-11 16:44 ` Alex Bennée
2025-07-12 6:29 ` Thomas Huth
2025-07-11 16:44 ` [Buildroot] [RFC PATCH v2 6/7] package/kvm-unit-tests: honour BR2_ARM64_PAGE_SIZE Alex Bennée
2025-07-11 16:44 ` [Buildroot] [RFC PATCH v2 7/7] support/testing: add test for kvm-unit-tests Alex Bennée
6 siblings, 1 reply; 15+ messages in thread
From: Alex Bennée @ 2025-07-11 16:44 UTC (permalink / raw)
To: buildroot; +Cc: Thomas Huth, Cyril Bur
Update to the current version of KVM unit tests. Importantly changes
the default page size to 4k (instead of 64k) which might explain the
difficulty in running the tests under HVF on Apple Silicon.
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
package/kvm-unit-tests/kvm-unit-tests.hash | 2 +-
package/kvm-unit-tests/kvm-unit-tests.mk | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/package/kvm-unit-tests/kvm-unit-tests.hash b/package/kvm-unit-tests/kvm-unit-tests.hash
index d4db9f2b75..ad0922df59 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 60015b023f34261c134d714f4670926ac81483e286a16475eb4a5cedab00eefa kvm-unit-tests-v2025-06-05.tar.bz2
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..808ea0d40b 100644
--- a/package/kvm-unit-tests/kvm-unit-tests.mk
+++ b/package/kvm-unit-tests/kvm-unit-tests.mk
@@ -4,7 +4,7 @@
#
################################################################################
-KVM_UNIT_TESTS_VERSION = 2024-01-08
+KVM_UNIT_TESTS_VERSION = 2025-06-05
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_LICENSE = GPL-2.0, LGPL-2.0
--
2.47.2
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 15+ messages in thread* Re: [Buildroot] [RFC PATCH v2 5/7] package/kvm-unit-tests: bump to 2025-06-05
2025-07-11 16:44 ` [Buildroot] [RFC PATCH v2 5/7] package/kvm-unit-tests: bump to 2025-06-05 Alex Bennée
@ 2025-07-12 6:29 ` Thomas Huth
0 siblings, 0 replies; 15+ messages in thread
From: Thomas Huth @ 2025-07-12 6:29 UTC (permalink / raw)
To: Alex Bennée; +Cc: buildroot, Cyril Bur, jesse
Am Fri, 11 Jul 2025 17:44:03 +0100
schrieb Alex Bennée <alex.bennee@linaro.org>:
> Update to the current version of KVM unit tests. Importantly changes
> the default page size to 4k (instead of 64k) which might explain the
> difficulty in running the tests under HVF on Apple Silicon.
>
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> ---
> package/kvm-unit-tests/kvm-unit-tests.hash | 2 +-
> package/kvm-unit-tests/kvm-unit-tests.mk | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/package/kvm-unit-tests/kvm-unit-tests.hash b/package/kvm-unit-tests/kvm-unit-tests.hash
> index d4db9f2b75..ad0922df59 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 60015b023f34261c134d714f4670926ac81483e286a16475eb4a5cedab00eefa kvm-unit-tests-v2025-06-05.tar.bz2
> 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..808ea0d40b 100644
> --- a/package/kvm-unit-tests/kvm-unit-tests.mk
> +++ b/package/kvm-unit-tests/kvm-unit-tests.mk
> @@ -4,7 +4,7 @@
> #
> ################################################################################
>
> -KVM_UNIT_TESTS_VERSION = 2024-01-08
> +KVM_UNIT_TESTS_VERSION = 2025-06-05
> 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_LICENSE = GPL-2.0, LGPL-2.0
FYI, there was another patch doing this already, which also enabled RISC-V:
https://lists.buildroot.org/pipermail/buildroot/2025-June/781175.html
(however, I cannot spot the original patch in the list archive, only my
reply, so maybe the original never made it to the list?)
Anyway, maybe it's better to split the RISC-V enablement from the version
update anyway, so for this patch here:
Reviewed-by: Thomas Huth <huth@tuxfamily.org>
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 15+ messages in thread
* [Buildroot] [RFC PATCH v2 6/7] package/kvm-unit-tests: honour BR2_ARM64_PAGE_SIZE
2025-07-11 16:43 [Buildroot] [RFC PATCH v2 0/7] kvm-unit-tests: update deps and fine tune qemu Alex Bennée
` (4 preceding siblings ...)
2025-07-11 16:44 ` [Buildroot] [RFC PATCH v2 5/7] package/kvm-unit-tests: bump to 2025-06-05 Alex Bennée
@ 2025-07-11 16:44 ` Alex Bennée
2025-07-12 6:35 ` Thomas Huth
2025-07-11 16:44 ` [Buildroot] [RFC PATCH v2 7/7] support/testing: add test for kvm-unit-tests Alex Bennée
6 siblings, 1 reply; 15+ messages in thread
From: Alex Bennée @ 2025-07-11 16:44 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.
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 808ea0d40b..af2c8ca2b2 100644
--- a/package/kvm-unit-tests/kvm-unit-tests.mk
+++ b/package/kvm-unit-tests/kvm-unit-tests.mk
@@ -36,6 +36,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] 15+ messages in thread* [Buildroot] [RFC PATCH v2 7/7] support/testing: add test for kvm-unit-tests
2025-07-11 16:43 [Buildroot] [RFC PATCH v2 0/7] kvm-unit-tests: update deps and fine tune qemu Alex Bennée
` (5 preceding siblings ...)
2025-07-11 16:44 ` [Buildroot] [RFC PATCH v2 6/7] package/kvm-unit-tests: honour BR2_ARM64_PAGE_SIZE Alex Bennée
@ 2025-07-11 16:44 ` Alex Bennée
6 siblings, 0 replies; 15+ messages in thread
From: Alex Bennée @ 2025-07-11 16:44 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] 15+ messages in thread