Skip to contentSkip to conversation

buildsys: Few WHPX improvements

PATCH New Philippe Mathieu-Daudé 1 participant 5 messages Jul 7 Arm/Amlogic Meson SoC support

lore
Share & tools
lore
#0 lore raw

cover buildsys: Few WHPX improvements

Few issues noticed when starting to develop on WHPX:

- WHPX not automatically selected as accelerator
- ARM Virt machine not selected by default
- mkvenv.py failing
- PYTHONPATH broken due to invalid PATH separator

Philippe Mathieu-Daudé (4):
system: Select WHPX by default when no other accelerator is available hw/arm: Allow using Virt on a WHPX-only binary
meson: Simplify calling mkvenv.py
meson: Do not assume PATH separator is ':'

 configure                    | 1 -
 system/vl.c                  | 3 +++
 hw/arm/Kconfig               | 2 +-
 pyvenv/meson.build           | 7 +++----
 tests/functional/meson.build | 6 ++----
 5 files changed, 9 insertions(+), 10 deletions(-)
Signature · 1 line
2.53.0
#1 lore raw

PATCH 1/4 system: Select WHPX by default when no other accelerator is available

When testing with a WHPX-only binary, we get:

qemu-system-aarch64.exe: No accelerator selected and no default accelerator available

Fix by checking for WHPX in configure_accelerators() and using it by default when no other accelerator is available, similarly to commit 964d2a0cf81 ("system: Select HVF by default ...").

---
 system/vl.c | 3 +++
 1 file changed, 3 insertions(+)
system/vl.c +3 -0
index 1d14e2e2076..4f6d1e1ca8b 100644
@@ -2444,6 +2444,7 @@ static void configure_accelerators(const char *progname)
             bool have_tcg = accel_find("tcg");
             bool have_kvm = accel_find("kvm");
             bool have_hvf = accel_find("hvf");
+            const bool have_whpx = accel_find("whpx");
 
             if (have_tcg && have_kvm) {
                 if (g_str_has_suffix(progname, "kvm")) {
@@ -2458,6 +2459,8 @@ static void configure_accelerators(const char *progname)
                 accelerators = "tcg";
             } else if (have_hvf) {
                 accelerators = "hvf";
+            } else if (have_whpx) {
+                accelerators = "whpx";
             } else {
                 error_report("No accelerator selected and"
                              " no default accelerator available");
Signature · 1 line
2.53.0
#2 lore raw

PATCH 2/4 hw/arm: Allow using Virt on a WHPX-only binary

In reply to Philippe Mathieu-Daudé

When restricting Virt machine to Xen in commit 8c4648f5a20 ("hw/arm: Do not expose the virt machine on Xen-only binary") we missed this machine works fine on WHPX. Restore that.

Fixes 8c4648f5a20 ("hw/arm: Do not expose the virt machine on Xen")
---
 hw/arm/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/arm/Kconfig +1 -1
index f9a225c19bc..d0f08c0c07d 100644
@@ -2,7 +2,7 @@ config ARM_VIRT
     bool
     default y
     depends on ARM
-    depends on TCG || KVM || HVF
+    depends on TCG || KVM || HVF || WHPX
     imply PCI_DEVICES
     imply TEST_DEVICES
     imply TPM_TIS_SYSBUS
Signature · 1 line
2.53.0
#3 lore raw

PATCH 3/4 meson: Simplify calling mkvenv.py

In reply to Philippe Mathieu-Daudé

We created the MKVENV_ENSUREGROUP variable in commit 913e47cb6b6 ("tests: respect --enable/--disable-download for Avocado") when the tests/ directory was still processed as Makefile. However later in commit 1aa22ffee20 ("meson, mkvenv: add functests custom target") we converted the rule to meson, and in commit 5abfe61b402 ("tests: replace check-venv with vm-venv target") we stopped using it in Makefiles. Since pyvenv/meson.build is included via meson 'subdir()' function, we don't need to export the arguments in Makefile format ant re-import / parse them: directly re-use the 'mkvenv' variable resolved in the main meson.build file.

This is particularly helpful on Windows, otherwise the Makefile indirection triggers this error:

  $ ninja pyvenv/functests.group
  [1/1] Generating pyvenv/pyvenv_functests_group with a custom command
  FAILED: [code=2] pyvenv/functests.group
  "C:/msys64/home/user/qemu/build/pyvenv/bin/python.exe" "-B" "/home/user/qemu/python/scripts/mkvenv.py" "ensuregroup" "--online" "--online" "--dir" "C:/msys64/home/user/qemu/python/wheels" "C:/msys64/home/user/qemu/pythondeps.toml" "functests"
  C:/msys64/clangarm64/bin/python3.14.exe: can't open file 'C:/home/user/qemu/python/scripts/mkvenv.py': [Errno 2] No such file or directory
  ninja: build stopped: subcommand failed.
---
 configure          | 1 -
 pyvenv/meson.build | 7 +++----
 2 files changed, 3 insertions(+), 5 deletions(-)
configure +0 -1
index d8bc10060e1..851b6ceeeb5 100755
@@ -1745,7 +1745,6 @@ if test "$rust" != disabled; then
   echo "RUST_TARGET_TRIPLE=$rust_target_triple" >> $config_host_mak
 fi
 echo "PYTHON=$python" >> $config_host_mak
-echo "MKVENV_ENSUREGROUP=$mkvenv ensuregroup $mkvenv_online_flag" >> $config_host_mak
 echo "GENISOIMAGE=$genisoimage" >> $config_host_mak
 echo "MESON=$meson" >> $config_host_mak
 echo "NINJA=$ninja" >> $config_host_mak
pyvenv/meson.build +3 -4
index 4e7d8d9fcc4..c2a3411cf76 100644
@@ -2,13 +2,12 @@
 # unconditionally installed at configure time are handled in configure
 # instead; namely: meson, sphinx, and the tooling groups.
 
-# Note that this command may or may not include the "--online" flag
-# based on configuration.
-ensuregroup_cmd = config_host['MKVENV_ENSUREGROUP'].split()
+mkvenv = meson.project_source_root() / 'python/scripts/mkvenv.py'
+ensuregroup_cmd = [python, mkvenv, 'ensuregroup']
 
 pyvenv_common_deps = files(
     meson.project_source_root() + '/pythondeps.toml',
-    meson.project_source_root() + '/python/scripts/mkvenv.py'
+    mkvenv,
 )
 pyvenv_wheel_dir = meson.project_source_root() + '/python/wheels'
 
Signature · 1 line
2.53.0
#4 lore raw

PATCH 4/4 meson: Do not assume PATH separator is ':'

In reply to Philippe Mathieu-Daudé

While the PATH separator is ':' on POSIX systems, on Windows it is ';'. Do not force the separator, let meson use the default which Do(es) the Right Thing:
https://mesonbuild.com/Reference-manual_functions.html#environment_separator

---
 tests/functional/meson.build | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
tests/functional/meson.build +2 -4
index c158197c4b7..e3adc42cfdb 100644
@@ -78,8 +78,7 @@ foreach speed : ['quick', 'thorough']
     test_env.set('MESON_BUILD_ROOT', meson.project_build_root())
     test_env.prepend('PYTHONPATH',
                      meson.project_source_root() / 'python',
-                     meson.current_source_dir(),
-                     separator : ':')
+                     meson.current_source_dir())
 
     # Define the GDB environment variable if gdb is available.
     gdb = get_option('gdb')
@@ -101,8 +100,7 @@ foreach speed : ['quick', 'thorough']
       test_precache_env.set('MESON_BUILD_ROOT', meson.project_build_root())
       test_precache_env.prepend('PYTHONPATH',
                                 meson.project_source_root() / 'python',
-                                meson.current_source_dir(),
-                                separator : ':')
+                                meson.current_source_dir())
       precache = custom_target('func-precache-' + testname,
                                output: teststamp,
                                command: [python, testpath],
Signature · 1 line
2.53.0