All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/34] Misc meson conversions for QEMU 7.1
@ 2022-04-20 15:33 Paolo Bonzini
  2022-04-20 15:33 ` [PATCH 01/34] meson: show final set of compiler flags Paolo Bonzini
                   ` (33 more replies)
  0 siblings, 34 replies; 74+ messages in thread
From: Paolo Bonzini @ 2022-04-20 15:33 UTC (permalink / raw)
  To: qemu-devel

The more interesting bits here are:

* move all remaining dependencies except glib to Meson (glib depends on
  https://github.com/mesonbuild/meson/pull/10206/)

* many more options are parsed from introspection data, including
  string options

* make all -D options optional on the meson command line

Paolo Bonzini (34):
  meson: show final set of compiler flags
  configure: remove dead code
  qga: wixl: get path to sysroot from pkg-config as intended
  configure: pc-bios/qemu-icon.bmp does not exist
  configure: gcov should not exclude fortify-source
  configure: move --enable/--disable-debug-info to second option parsing pass
  configure, meson: move OpenGL check to meson
  meson, configure: move RDMA options to meson
  meson, configure: move keyctl test to meson
  meson, configure: move usbfs test to meson
  meson, configure: move libgio test to meson
  meson: move CONFIG_XEN_PCI_PASSTHROUGH to config-host.h
  meson, configure: move --enable-module-upgrades to meson
  meson, configure: move Xen detection to meson
  meson-buildoptions: add support for string options
  configure, meson: move iasl detection to meson
  configure: move Windows flags detection to meson
  configure: switch string options to automatic parsing
  meson, configure: move --tls-priority to meson
  meson, configure: move bdrv whitelists to meson
  meson, configure: move --with-pkgversion, CONFIG_STAMP to meson
  meson, configure: move --interp-prefix to meson
  meson: always combine directories with prefix
  configure: switch directory options to automatic parsing
  meson: pass more options directly as -D
  configure: omit options with default values from meson command line
  meson, virtio: place all virtio-pci devices under virtio_pci_ss
  configure: simplify vhost-net-{user,vdpa} configuration
  build: move vhost-vsock configuration to Kconfig
  build: move vhost-scsi configuration to Kconfig
  build: move vhost-user-fs configuration to Kconfig
  meson: create have_vhost_* variables
  meson: use have_vhost_* variables to pick sources
  configure, meson: move vhost options to Meson

 Kconfig.host                    |    3 -
 backends/meson.build            |   10 +-
 configure                       | 1010 ++-----------------------------
 contrib/rdmacm-mux/meson.build  |    4 +-
 crypto/meson.build              |    4 +-
 docs/meson.build                |    2 +-
 hw/net/meson.build              |    8 +-
 hw/scsi/Kconfig                 |    5 +
 hw/virtio/Kconfig               |   18 +-
 hw/virtio/meson.build           |   34 +-
 hw/xen/meson.build              |   20 +-
 include/hw/virtio/virtio-scsi.h |    2 -
 meson.build                     |  406 ++++++++++---
 meson_options.txt               |   40 +-
 migration/meson.build           |    2 +-
 net/meson.build                 |   12 +-
 qga/meson.build                 |    2 +-
 scripts/meson-buildoptions.py   |   86 ++-
 scripts/meson-buildoptions.sh   |   93 ++-
 scripts/qemu-stamp.py           |   24 +
 scripts/xen-detect.c            |  203 +++++++
 tests/meson.build               |    2 +-
 tests/qtest/meson.build         |    9 +-
 tools/meson.build               |    2 +-
 ui/meson.build                  |   24 +-
 util/meson.build                |    2 +-
 26 files changed, 873 insertions(+), 1154 deletions(-)
 create mode 100644 scripts/qemu-stamp.py
 create mode 100644 scripts/xen-detect.c

-- 
2.35.1



^ permalink raw reply	[flat|nested] 74+ messages in thread

* [PATCH 01/34] meson: show final set of compiler flags
  2022-04-20 15:33 [PATCH 00/34] Misc meson conversions for QEMU 7.1 Paolo Bonzini
@ 2022-04-20 15:33 ` Paolo Bonzini
  2022-04-20 15:57   ` Marc-André Lureau
  2022-04-20 15:33 ` [PATCH 02/34] configure: remove dead code Paolo Bonzini
                   ` (32 subsequent siblings)
  33 siblings, 1 reply; 74+ messages in thread
From: Paolo Bonzini @ 2022-04-20 15:33 UTC (permalink / raw)
  To: qemu-devel

The actual set of compiler flags can grow beyond what is found by the configure
script, for example if gprof is used.  Show the full set in the summary.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 meson.build | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/meson.build b/meson.build
index 6ba60950c8..cf3b1b39cf 100644
--- a/meson.build
+++ b/meson.build
@@ -3521,10 +3521,10 @@ link_args = get_option(link_language + '_link_args')
 if link_args.length() > 0
   summary_info += {'LDFLAGS':         ' '.join(link_args)}
 endif
-summary_info += {'QEMU_CFLAGS':       config_host['QEMU_CFLAGS']}
-summary_info += {'QEMU_CXXFLAGS':     config_host['QEMU_CXXFLAGS']}
-summary_info += {'QEMU_OBJCFLAGS':    config_host['QEMU_OBJCFLAGS']}
-summary_info += {'QEMU_LDFLAGS':      config_host['QEMU_LDFLAGS']}
+summary_info += {'QEMU_CFLAGS':       ' '.join(qemu_cflags)}
+summary_info += {'QEMU_CXXFLAGS':     ' '.join(qemu_cxxflags)}
+summary_info += {'QEMU_OBJCFLAGS':    ' '.join(qemu_objcflags)}
+summary_info += {'QEMU_LDFLAGS':      ' '.join(qemu_ldflags)}
 summary_info += {'profiler':          get_option('profiler')}
 summary_info += {'link-time optimization (LTO)': get_option('b_lto')}
 summary_info += {'PIE':               get_option('b_pie')}
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 74+ messages in thread

* [PATCH 02/34] configure: remove dead code
  2022-04-20 15:33 [PATCH 00/34] Misc meson conversions for QEMU 7.1 Paolo Bonzini
  2022-04-20 15:33 ` [PATCH 01/34] meson: show final set of compiler flags Paolo Bonzini
@ 2022-04-20 15:33 ` Paolo Bonzini
  2022-04-20 16:04   ` Marc-André Lureau
  2022-04-20 15:33 ` [PATCH 03/34] qga: wixl: get path to sysroot from pkg-config as intended Paolo Bonzini
                   ` (31 subsequent siblings)
  33 siblings, 1 reply; 74+ messages in thread
From: Paolo Bonzini @ 2022-04-20 15:33 UTC (permalink / raw)
  To: qemu-devel

tcg_interpreter is never written, it is purely a meson option;
trace_backends is never read.

And SeaBIOS is only build from the source tree with roms/Makefile,
so the config.mak file is unused.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 configure | 24 ------------------------
 1 file changed, 24 deletions(-)

diff --git a/configure b/configure
index 7c08c18358..2fc860ed9a 100755
--- a/configure
+++ b/configure
@@ -320,7 +320,6 @@ linux_user=""
 bsd_user=""
 pkgversion=""
 pie=""
-trace_backends="log"
 trace_file="trace"
 opengl="$default_feature"
 coroutine=""
@@ -391,7 +390,6 @@ for opt do
                       cross_cc_vars="$cross_cc_vars cross_cc_cflags_${cc_arch}"
   ;;
   --cross-cc-*) cc_arch=${opt#--cross-cc-}; cc_arch=${cc_arch%%=*}
-                cc_archs="$cc_archs $cc_arch"
                 eval "cross_cc_${cc_arch}=\$optarg"
                 cross_cc_vars="$cross_cc_vars cross_cc_${cc_arch}"
   ;;
@@ -2881,9 +2879,6 @@ fi
 if test "$vhost_user_fs" = "yes" ; then
   echo "CONFIG_VHOST_USER_FS=y" >> $config_host_mak
 fi
-if test "$tcg" = "enabled" -a "$tcg_interpreter" = "true" ; then
-  echo "CONFIG_TCG_INTERPRETER=y" >> $config_host_mak
-fi
 
 if test "$opengl" = "yes" ; then
   echo "CONFIG_OPENGL=y" >> $config_host_mak
@@ -3025,7 +3020,6 @@ LINKS="Makefile"
 LINKS="$LINKS tests/tcg/Makefile.target"
 LINKS="$LINKS pc-bios/optionrom/Makefile"
 LINKS="$LINKS pc-bios/s390-ccw/Makefile"
-LINKS="$LINKS roms/seabios/Makefile"
 LINKS="$LINKS pc-bios/qemu-icon.bmp"
 LINKS="$LINKS .gdbinit scripts" # scripts needed by relative path in .gdbinit
 LINKS="$LINKS tests/avocado tests/data"
@@ -3060,24 +3054,6 @@ done
 export target_list source_path use_containers cpu
 $source_path/tests/tcg/configure.sh)
 
-# temporary config to build submodules
-if test -f $source_path/roms/seabios/Makefile; then
-  for rom in seabios; do
-    config_mak=roms/$rom/config.mak
-    echo "# Automatically generated by configure - do not modify" > $config_mak
-    echo "SRC_PATH=$source_path/roms/$rom" >> $config_mak
-    echo "AS=$as" >> $config_mak
-    echo "CCAS=$ccas" >> $config_mak
-    echo "CC=$cc" >> $config_mak
-    echo "BCC=bcc" >> $config_mak
-    echo "CPP=$cpp" >> $config_mak
-    echo "OBJCOPY=objcopy" >> $config_mak
-    echo "IASL=$iasl" >> $config_mak
-    echo "LD=$ld" >> $config_mak
-    echo "RANLIB=$ranlib" >> $config_mak
-  done
-fi
-
 config_mak=pc-bios/optionrom/config.mak
 echo "# Automatically generated by configure - do not modify" > $config_mak
 echo "TOPSRC_DIR=$source_path" >> $config_mak
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 74+ messages in thread

* [PATCH 03/34] qga: wixl: get path to sysroot from pkg-config as intended
  2022-04-20 15:33 [PATCH 00/34] Misc meson conversions for QEMU 7.1 Paolo Bonzini
  2022-04-20 15:33 ` [PATCH 01/34] meson: show final set of compiler flags Paolo Bonzini
  2022-04-20 15:33 ` [PATCH 02/34] configure: remove dead code Paolo Bonzini
@ 2022-04-20 15:33 ` Paolo Bonzini
  2022-04-20 15:47   ` Marc-André Lureau
  2022-04-21 14:18   ` Konstantin Kostiuk
  2022-04-20 15:33 ` [PATCH 04/34] configure: pc-bios/qemu-icon.bmp does not exist Paolo Bonzini
                   ` (30 subsequent siblings)
  33 siblings, 2 replies; 74+ messages in thread
From: Paolo Bonzini @ 2022-04-20 15:33 UTC (permalink / raw)
  To: qemu-devel

The .wxs file uses $(var.Mingw_bin) while configure/meson have always
used Mingw_dlls.  Fix them to match what was probably intended.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 configure       | 4 ++--
 qga/meson.build | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/configure b/configure
index 2fc860ed9a..2bc5a0b84f 100755
--- a/configure
+++ b/configure
@@ -2702,7 +2702,7 @@ if test "$QEMU_GA_VERSION" = ""; then
     QEMU_GA_VERSION=$(cat $source_path/VERSION)
 fi
 
-QEMU_GA_MSI_MINGW_DLL_PATH="$($pkg_config --variable=prefix glib-2.0)/bin"
+QEMU_GA_MSI_MINGW_BIN_PATH="$($pkg_config --variable=prefix glib-2.0)/bin"
 
 # Mac OS X ships with a broken assembler
 roms=
@@ -2790,7 +2790,7 @@ if test "$debug_tcg" = "yes" ; then
 fi
 if test "$mingw32" = "yes" ; then
   echo "CONFIG_WIN32=y" >> $config_host_mak
-  echo "QEMU_GA_MSI_MINGW_DLL_PATH=${QEMU_GA_MSI_MINGW_DLL_PATH}" >> $config_host_mak
+  echo "QEMU_GA_MSI_MINGW_BIN_PATH=${QEMU_GA_MSI_MINGW_BIN_PATH}" >> $config_host_mak
   echo "QEMU_GA_MANUFACTURER=${QEMU_GA_MANUFACTURER}" >> $config_host_mak
   echo "QEMU_GA_DISTRO=${QEMU_GA_DISTRO}" >> $config_host_mak
   echo "QEMU_GA_VERSION=${QEMU_GA_VERSION}" >> $config_host_mak
diff --git a/qga/meson.build b/qga/meson.build
index 392d560941..6d9f39bb32 100644
--- a/qga/meson.build
+++ b/qga/meson.build
@@ -129,7 +129,7 @@ if targetos == 'windows'
                               wixl, '-o', '@OUTPUT0@', '@INPUT0@',
                               qemu_ga_msi_arch[cpu],
                               qemu_ga_msi_vss,
-                              '-D', 'Mingw_dlls=' + config_host['QEMU_GA_MSI_MINGW_DLL_PATH'],
+                              '-D', 'Mingw_bin=' + config_host['QEMU_GA_MSI_MINGW_BIN_PATH'],
                             ])
     all_qga += [qga_msi]
     alias_target('msi', qga_msi)
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 74+ messages in thread

* [PATCH 04/34] configure: pc-bios/qemu-icon.bmp does not exist
  2022-04-20 15:33 [PATCH 00/34] Misc meson conversions for QEMU 7.1 Paolo Bonzini
                   ` (2 preceding siblings ...)
  2022-04-20 15:33 ` [PATCH 03/34] qga: wixl: get path to sysroot from pkg-config as intended Paolo Bonzini
@ 2022-04-20 15:33 ` Paolo Bonzini
  2022-04-20 15:47   ` Thomas Huth
  2022-04-20 16:05   ` Marc-André Lureau
  2022-04-20 15:33 ` [PATCH 05/34] configure: gcov should not exclude fortify-source Paolo Bonzini
                   ` (29 subsequent siblings)
  33 siblings, 2 replies; 74+ messages in thread
From: Paolo Bonzini @ 2022-04-20 15:33 UTC (permalink / raw)
  To: qemu-devel

The file has been removed in commit a8260d3876 ("ui: install logo icons to
$prefix/share/icons", 2019-01-21), do not try to symlink it in the build tree.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 configure | 1 -
 1 file changed, 1 deletion(-)

diff --git a/configure b/configure
index 2bc5a0b84f..7a89cb4123 100755
--- a/configure
+++ b/configure
@@ -3020,7 +3020,6 @@ LINKS="Makefile"
 LINKS="$LINKS tests/tcg/Makefile.target"
 LINKS="$LINKS pc-bios/optionrom/Makefile"
 LINKS="$LINKS pc-bios/s390-ccw/Makefile"
-LINKS="$LINKS pc-bios/qemu-icon.bmp"
 LINKS="$LINKS .gdbinit scripts" # scripts needed by relative path in .gdbinit
 LINKS="$LINKS tests/avocado tests/data"
 LINKS="$LINKS tests/qemu-iotests/check"
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 74+ messages in thread

* [PATCH 05/34] configure: gcov should not exclude fortify-source
  2022-04-20 15:33 [PATCH 00/34] Misc meson conversions for QEMU 7.1 Paolo Bonzini
                   ` (3 preceding siblings ...)
  2022-04-20 15:33 ` [PATCH 04/34] configure: pc-bios/qemu-icon.bmp does not exist Paolo Bonzini
@ 2022-04-20 15:33 ` Paolo Bonzini
  2022-04-20 16:06   ` Marc-André Lureau
  2022-04-20 15:33 ` [PATCH 06/34] configure: move --enable/--disable-debug-info to second option parsing pass Paolo Bonzini
                   ` (28 subsequent siblings)
  33 siblings, 1 reply; 74+ messages in thread
From: Paolo Bonzini @ 2022-04-20 15:33 UTC (permalink / raw)
  To: qemu-devel

There is no reason other than history (dating back to commit 1d728c3946, "tests: add gcov
support", 2013-01-06) for this, remove this unnecessary conditional.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 configure | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/configure b/configure
index 7a89cb4123..48ae18f47f 100755
--- a/configure
+++ b/configure
@@ -2625,9 +2625,7 @@ fi
 
 write_c_skeleton
 
-if test "$gcov" = "yes" ; then
-  :
-elif test "$fortify_source" = "yes" ; then
+if test "$fortify_source" = "yes" ; then
   QEMU_CFLAGS="-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $QEMU_CFLAGS"
   debug=no
 fi
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 74+ messages in thread

* [PATCH 06/34] configure: move --enable/--disable-debug-info to second option parsing pass
  2022-04-20 15:33 [PATCH 00/34] Misc meson conversions for QEMU 7.1 Paolo Bonzini
                   ` (4 preceding siblings ...)
  2022-04-20 15:33 ` [PATCH 05/34] configure: gcov should not exclude fortify-source Paolo Bonzini
@ 2022-04-20 15:33 ` Paolo Bonzini
  2022-04-20 15:42   ` Thomas Huth
  2022-04-20 16:08   ` Marc-André Lureau
  2022-04-20 15:33 ` [PATCH 07/34] configure, meson: move OpenGL check to meson Paolo Bonzini
                   ` (27 subsequent siblings)
  33 siblings, 2 replies; 74+ messages in thread
From: Paolo Bonzini @ 2022-04-20 15:33 UTC (permalink / raw)
  To: qemu-devel

$debug_info is not needed anywhere except in the final meson invocation,
no need to special case it.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 configure | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/configure b/configure
index 48ae18f47f..07053e7b27 100755
--- a/configure
+++ b/configure
@@ -244,7 +244,6 @@ audio_drv_list="default"
 block_drv_rw_whitelist=""
 block_drv_ro_whitelist=""
 host_cc="cc"
-debug_info="yes"
 lto="false"
 stack_protector=""
 safe_stack=""
@@ -304,6 +303,7 @@ vhost_user_fs="$default_feature"
 vhost_vdpa="$default_feature"
 rdma="$default_feature"
 pvrdma="$default_feature"
+debug_info="yes"
 debug_tcg="no"
 debug="no"
 sanitizers="no"
@@ -379,10 +379,6 @@ for opt do
   ;;
   --extra-ldflags=*) EXTRA_LDFLAGS="$EXTRA_LDFLAGS $optarg"
   ;;
-  --enable-debug-info) debug_info="yes"
-  ;;
-  --disable-debug-info) debug_info="no"
-  ;;
   --cross-cc-*[!a-zA-Z0-9_-]*=*) error_exit "Passed bad --cross-cc-FOO option"
   ;;
   --cross-cc-cflags-*) cc_arch=${opt#--cross-cc-cflags-}; cc_arch=${cc_arch%%=*}
@@ -759,12 +755,12 @@ for opt do
   ;;
   --extra-ldflags=*)
   ;;
-  --enable-debug-info)
-  ;;
-  --disable-debug-info)
-  ;;
   --cross-cc-*)
   ;;
+  --enable-debug-info) debug_info="yes"
+  ;;
+  --disable-debug-info) debug_info="no"
+  ;;
   --enable-modules)
       modules="yes"
   ;;
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 74+ messages in thread

* [PATCH 07/34] configure, meson: move OpenGL check to meson
  2022-04-20 15:33 [PATCH 00/34] Misc meson conversions for QEMU 7.1 Paolo Bonzini
                   ` (5 preceding siblings ...)
  2022-04-20 15:33 ` [PATCH 06/34] configure: move --enable/--disable-debug-info to second option parsing pass Paolo Bonzini
@ 2022-04-20 15:33 ` Paolo Bonzini
  2022-04-20 16:13   ` Marc-André Lureau
  2022-04-20 15:33 ` [PATCH 08/34] meson, configure: move RDMA options " Paolo Bonzini
                   ` (26 subsequent siblings)
  33 siblings, 1 reply; 74+ messages in thread
From: Paolo Bonzini @ 2022-04-20 15:33 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 configure                     | 40 -----------------------------------
 meson.build                   | 16 +++++++++-----
 meson_options.txt             |  2 ++
 scripts/meson-buildoptions.sh |  3 +++
 ui/meson.build                | 17 ++++++++-------
 5 files changed, 25 insertions(+), 53 deletions(-)

diff --git a/configure b/configure
index 07053e7b27..c9be6eb04d 100755
--- a/configure
+++ b/configure
@@ -321,7 +321,6 @@ bsd_user=""
 pkgversion=""
 pie=""
 trace_file="trace"
-opengl="$default_feature"
 coroutine=""
 tls_priority="NORMAL"
 plugins="$default_feature"
@@ -960,10 +959,6 @@ for opt do
   ;;
   --enable-vhost-user-fs) vhost_user_fs="yes"
   ;;
-  --disable-opengl) opengl="no"
-  ;;
-  --enable-opengl) opengl="yes"
-  ;;
   --disable-zlib-test)
   ;;
   --disable-virtio-blk-data-plane|--enable-virtio-blk-data-plane)
@@ -1258,7 +1253,6 @@ cat << EOF
   vhost-kernel    vhost kernel backend support
   vhost-user      vhost-user backend support
   vhost-vdpa      vhost-vdpa kernel backend support
-  opengl          opengl support
   gio             libgio support
 
 NOTE: The object files are built at the place where configure is launched
@@ -2278,34 +2272,6 @@ case "$fdt" in
 esac
 
 ##########################################
-# opengl probe (for sdl2, gtk)
-
-if test "$opengl" != "no" ; then
-  epoxy=no
-  if $pkg_config epoxy; then
-    cat > $TMPC << EOF
-#include <epoxy/egl.h>
-int main(void) { return 0; }
-EOF
-    if compile_prog "" "" ; then
-      epoxy=yes
-    fi
-  fi
-
-  if test "$epoxy" = "yes" ; then
-    opengl_cflags="$($pkg_config --cflags epoxy)"
-    opengl_libs="$($pkg_config --libs epoxy)"
-    opengl=yes
-  else
-    if test "$opengl" = "yes" ; then
-      feature_not_found "opengl" "Please install epoxy with EGL"
-    fi
-    opengl_cflags=""
-    opengl_libs=""
-    opengl=no
-  fi
-fi
-
 # check for usbfs
 have_usbfs=no
 if test "$linux_user" = "yes"; then
@@ -2874,12 +2840,6 @@ if test "$vhost_user_fs" = "yes" ; then
   echo "CONFIG_VHOST_USER_FS=y" >> $config_host_mak
 fi
 
-if test "$opengl" = "yes" ; then
-  echo "CONFIG_OPENGL=y" >> $config_host_mak
-  echo "OPENGL_CFLAGS=$opengl_cflags" >> $config_host_mak
-  echo "OPENGL_LIBS=$opengl_libs" >> $config_host_mak
-fi
-
 # XXX: suppress that
 if [ "$bsd" = "yes" ] ; then
   echo "CONFIG_BSD=y" >> $config_host_mak
diff --git a/meson.build b/meson.build
index cf3b1b39cf..f53fd66716 100644
--- a/meson.build
+++ b/meson.build
@@ -1000,9 +1000,14 @@ if not get_option('coreaudio').auto() or (targetos == 'darwin' and have_system)
 endif
 
 opengl = not_found
-if 'CONFIG_OPENGL' in config_host
-  opengl = declare_dependency(compile_args: config_host['OPENGL_CFLAGS'].split(),
-                              link_args: config_host['OPENGL_LIBS'].split())
+if not get_option('opengl').auto() or have_system or have_vhost_user_gpu
+  epoxy = dependency('epoxy', method: 'pkg-config',
+                      required: get_option('opengl'), kwargs: static_kwargs)
+  if cc.has_header('epoxy/egl.h', dependencies: epoxy)
+    opengl = epoxy
+  elif get_option('opengl').enabled()
+    error('epoxy/egl.h not found')
+  endif
 endif
 gbm = not_found
 if (have_system or have_tools) and (virgl.found() or opengl.found())
@@ -1544,6 +1549,7 @@ config_host_data.set('CONFIG_LINUX_AIO', libaio.found())
 config_host_data.set('CONFIG_LINUX_IO_URING', linux_io_uring.found())
 config_host_data.set('CONFIG_LIBPMEM', libpmem.found())
 config_host_data.set('CONFIG_NUMA', numa.found())
+config_host_data.set('CONFIG_OPENGL', opengl.found())
 config_host_data.set('CONFIG_PROFILER', get_option('profiler'))
 config_host_data.set('CONFIG_RBD', rbd.found())
 config_host_data.set('CONFIG_SDL', sdl.found())
@@ -2079,7 +2085,7 @@ host_kconfig = \
   (have_tpm ? ['CONFIG_TPM=y'] : []) + \
   (spice.found() ? ['CONFIG_SPICE=y'] : []) + \
   (have_ivshmem ? ['CONFIG_IVSHMEM=y'] : []) + \
-  ('CONFIG_OPENGL' in config_host ? ['CONFIG_OPENGL=y'] : []) + \
+  (opengl.found() ? ['CONFIG_OPENGL=y'] : []) + \
   (x11.found() ? ['CONFIG_X11=y'] : []) + \
   ('CONFIG_VHOST_USER' in config_host ? ['CONFIG_VHOST_USER=y'] : []) + \
   ('CONFIG_VHOST_VDPA' in config_host ? ['CONFIG_VHOST_VDPA=y'] : []) + \
@@ -3694,7 +3700,7 @@ summary_info += {'smartcard support': cacard}
 summary_info += {'U2F support':       u2f}
 summary_info += {'libusb':            libusb}
 summary_info += {'usb net redir':     usbredir}
-summary_info += {'OpenGL support':    config_host.has_key('CONFIG_OPENGL')}
+summary_info += {'OpenGL support (epoxy)': opengl}
 summary_info += {'GBM':               gbm}
 summary_info += {'libiscsi support':  libiscsi}
 summary_info += {'libnfs support':    libnfs}
diff --git a/meson_options.txt b/meson_options.txt
index 52b11cead4..bd8efe4fbf 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -149,6 +149,8 @@ option('lzo', type : 'feature', value : 'auto',
        description: 'lzo compression support')
 option('rbd', type : 'feature', value : 'auto',
        description: 'Ceph block device driver')
+option('opengl', type : 'feature', value : 'auto',
+       description: 'OpenGL support')
 option('gtk', type : 'feature', value : 'auto',
        description: 'GTK+ user interface')
 option('sdl', type : 'feature', value : 'auto',
diff --git a/scripts/meson-buildoptions.sh b/scripts/meson-buildoptions.sh
index 1e26f4571e..f91bd9231b 100644
--- a/scripts/meson-buildoptions.sh
+++ b/scripts/meson-buildoptions.sh
@@ -91,6 +91,7 @@ meson_options_help() {
   printf "%s\n" '  nettle          nettle cryptography support'
   printf "%s\n" '  numa            libnuma support'
   printf "%s\n" '  nvmm            NVMM acceleration support'
+  printf "%s\n" '  opengl          OpenGL support'
   printf "%s\n" '  oss             OSS sound support'
   printf "%s\n" '  pa              PulseAudio sound support'
   printf "%s\n" '  parallels       parallels image format support'
@@ -271,6 +272,8 @@ _meson_option_parse() {
     --disable-numa) printf "%s" -Dnuma=disabled ;;
     --enable-nvmm) printf "%s" -Dnvmm=enabled ;;
     --disable-nvmm) printf "%s" -Dnvmm=disabled ;;
+    --enable-opengl) printf "%s" -Dopengl=enabled ;;
+    --disable-opengl) printf "%s" -Dopengl=disabled ;;
     --enable-oss) printf "%s" -Doss=enabled ;;
     --disable-oss) printf "%s" -Doss=disabled ;;
     --enable-pa) printf "%s" -Dpa=enabled ;;
diff --git a/ui/meson.build b/ui/meson.build
index 64286ba150..b21d3d1534 100644
--- a/ui/meson.build
+++ b/ui/meson.build
@@ -1,5 +1,6 @@
 softmmu_ss.add(pixman)
 specific_ss.add(when: ['CONFIG_SOFTMMU'], if_true: pixman)   # for the include path
+specific_ss.add(when: ['CONFIG_SOFTMMU'], if_true: opengl)   # for the include path
 
 softmmu_ss.add(files(
   'clipboard.c',
@@ -43,7 +44,6 @@ vnc_ss.add(zlib, png, jpeg, gnutls)
 vnc_ss.add(when: sasl, if_true: files('vnc-auth-sasl.c'))
 softmmu_ss.add_all(when: vnc, if_true: vnc_ss)
 softmmu_ss.add(when: vnc, if_false: files('vnc-stubs.c'))
-specific_ss.add(when: ['CONFIG_SOFTMMU'], if_true: opengl)
 
 ui_modules = {}
 
@@ -53,17 +53,18 @@ if curses.found()
   ui_modules += {'curses' : curses_ss}
 endif
 
-if config_host.has_key('CONFIG_OPENGL')
+softmmu_ss.add(opengl)
+if opengl.found()
   opengl_ss = ss.source_set()
   opengl_ss.add(gbm)
-  opengl_ss.add(when: [opengl, pixman, 'CONFIG_OPENGL'],
+  opengl_ss.add(when: [opengl, pixman],
                if_true: files('shader.c', 'console-gl.c', 'egl-helpers.c', 'egl-context.c'))
   ui_modules += {'opengl' : opengl_ss}
 endif
 
-if config_host.has_key('CONFIG_OPENGL') and gbm.found()
+if opengl.found() and gbm.found()
   egl_headless_ss = ss.source_set()
-  egl_headless_ss.add(when: [opengl, gbm, pixman, 'CONFIG_OPENGL'],
+  egl_headless_ss.add(when: [opengl, gbm, pixman],
                       if_true: files('egl-headless.c'))
   ui_modules += {'egl-headless' : egl_headless_ss}
 endif
@@ -98,8 +99,8 @@ if gtk.found()
   gtk_ss = ss.source_set()
   gtk_ss.add(gtk, vte, pixman, files('gtk.c', 'gtk-clipboard.c'))
   gtk_ss.add(when: x11, if_true: files('x_keymap.c'))
-  gtk_ss.add(when: [opengl, 'CONFIG_OPENGL'], if_true: files('gtk-gl-area.c'))
-  gtk_ss.add(when: [x11, opengl, 'CONFIG_OPENGL'], if_true: files('gtk-egl.c'))
+  gtk_ss.add(when: opengl, if_true: files('gtk-gl-area.c'))
+  gtk_ss.add(when: [x11, opengl], if_true: files('gtk-egl.c'))
   ui_modules += {'gtk' : gtk_ss}
 endif
 
@@ -112,7 +113,7 @@ if sdl.found()
     'sdl2-input.c',
     'sdl2.c',
   ))
-  sdl_ss.add(when: [opengl, 'CONFIG_OPENGL'], if_true: files('sdl2-gl.c'))
+  sdl_ss.add(when: opengl, if_true: files('sdl2-gl.c'))
   sdl_ss.add(when: x11, if_true: files('x_keymap.c'))
   ui_modules += {'sdl' : sdl_ss}
 endif
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 74+ messages in thread

* [PATCH 08/34] meson, configure: move RDMA options to meson
  2022-04-20 15:33 [PATCH 00/34] Misc meson conversions for QEMU 7.1 Paolo Bonzini
                   ` (6 preceding siblings ...)
  2022-04-20 15:33 ` [PATCH 07/34] configure, meson: move OpenGL check to meson Paolo Bonzini
@ 2022-04-20 15:33 ` Paolo Bonzini
  2022-04-20 16:24   ` Marc-André Lureau
  2022-04-20 15:33 ` [PATCH 09/34] meson, configure: move keyctl test " Paolo Bonzini
                   ` (25 subsequent siblings)
  33 siblings, 1 reply; 74+ messages in thread
From: Paolo Bonzini @ 2022-04-20 15:33 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 configure                      | 115 ---------------------------------
 contrib/rdmacm-mux/meson.build |   4 +-
 meson.build                    |  56 ++++++++++++++--
 meson_options.txt              |   4 ++
 migration/meson.build          |   2 +-
 scripts/meson-buildoptions.sh  |   6 ++
 6 files changed, 62 insertions(+), 125 deletions(-)

diff --git a/configure b/configure
index c9be6eb04d..cfd15c3518 100755
--- a/configure
+++ b/configure
@@ -301,8 +301,6 @@ vhost_vsock="$default_feature"
 vhost_user="no"
 vhost_user_fs="$default_feature"
 vhost_vdpa="$default_feature"
-rdma="$default_feature"
-pvrdma="$default_feature"
 debug_info="yes"
 debug_tcg="no"
 debug="no"
@@ -972,14 +970,6 @@ for opt do
   ;;
   --tls-priority=*) tls_priority="$optarg"
   ;;
-  --enable-rdma) rdma="yes"
-  ;;
-  --disable-rdma) rdma="no"
-  ;;
-  --enable-pvrdma) pvrdma="yes"
-  ;;
-  --disable-pvrdma) pvrdma="no"
-  ;;
   --disable-vhost-user) vhost_user="no"
   ;;
   --enable-vhost-user) vhost_user="yes"
@@ -1244,8 +1234,6 @@ cat << EOF
   lto             Enable Link-Time Optimization.
   safe-stack      SafeStack Stack Smash Protection. Depends on
                   clang/llvm >= 3.7 and requires coroutine backend ucontext.
-  rdma            Enable RDMA-based migration
-  pvrdma          Enable PVRDMA support
   vhost-net       vhost-net kernel acceleration support
   vhost-vsock     virtio sockets device support
   vhost-scsi      vhost-scsi kernel target support
@@ -2037,100 +2025,6 @@ EOF
   fi
 fi
 
-##########################################
-# RDMA needs OpenFabrics libraries
-if test "$rdma" != "no" ; then
-  cat > $TMPC <<EOF
-#include <rdma/rdma_cma.h>
-int main(void) { return 0; }
-EOF
-  rdma_libs="-lrdmacm -libverbs -libumad"
-  if compile_prog "" "$rdma_libs" ; then
-    rdma="yes"
-  else
-    if test "$rdma" = "yes" ; then
-        error_exit \
-            " OpenFabrics librdmacm/libibverbs/libibumad not present." \
-            " Your options:" \
-            "  (1) Fast: Install infiniband packages (devel) from your distro." \
-            "  (2) Cleanest: Install libraries from www.openfabrics.org" \
-            "  (3) Also: Install softiwarp if you don't have RDMA hardware"
-    fi
-    rdma="no"
-  fi
-fi
-
-##########################################
-# PVRDMA detection
-
-cat > $TMPC <<EOF &&
-#include <sys/mman.h>
-
-int
-main(void)
-{
-    char buf = 0;
-    void *addr = &buf;
-    addr = mremap(addr, 0, 1, MREMAP_MAYMOVE | MREMAP_FIXED);
-
-    return 0;
-}
-EOF
-
-if test "$rdma" = "yes" ; then
-    case "$pvrdma" in
-    "")
-        if compile_prog "" ""; then
-            pvrdma="yes"
-        else
-            pvrdma="no"
-        fi
-        ;;
-    "yes")
-        if ! compile_prog "" ""; then
-            error_exit "PVRDMA is not supported since mremap is not implemented"
-        fi
-        pvrdma="yes"
-        ;;
-    "no")
-        pvrdma="no"
-        ;;
-    esac
-else
-    if test "$pvrdma" = "yes" ; then
-        error_exit "PVRDMA requires rdma suppport"
-    fi
-    pvrdma="no"
-fi
-
-# Let's see if enhanced reg_mr is supported
-if test "$pvrdma" = "yes" ; then
-
-cat > $TMPC <<EOF &&
-#include <infiniband/verbs.h>
-
-int
-main(void)
-{
-    struct ibv_mr *mr;
-    struct ibv_pd *pd = NULL;
-    size_t length = 10;
-    uint64_t iova = 0;
-    int access = 0;
-    void *addr = NULL;
-
-    mr = ibv_reg_mr_iova(pd, addr, length, iova, access);
-
-    ibv_dereg_mr(mr);
-
-    return 0;
-}
-EOF
-    if ! compile_prog "" "-libverbs"; then
-        QEMU_CFLAGS="$QEMU_CFLAGS -DLEGACY_RDMA_REG_MR"
-    fi
-fi
-
 ##########################################
 # glib support probe
 
@@ -2855,15 +2749,6 @@ if test "$have_tsan" = "yes" && test "$have_tsan_iface_fiber" = "yes" ; then
     echo "CONFIG_TSAN=y" >> $config_host_mak
 fi
 
-if test "$rdma" = "yes" ; then
-  echo "CONFIG_RDMA=y" >> $config_host_mak
-  echo "RDMA_LIBS=$rdma_libs" >> $config_host_mak
-fi
-
-if test "$pvrdma" = "yes" ; then
-  echo "CONFIG_PVRDMA=y" >> $config_host_mak
-fi
-
 if test "$plugins" = "yes" ; then
     echo "CONFIG_PLUGIN=y" >> $config_host_mak
 fi
diff --git a/contrib/rdmacm-mux/meson.build b/contrib/rdmacm-mux/meson.build
index 7674f54cc5..36c9c89630 100644
--- a/contrib/rdmacm-mux/meson.build
+++ b/contrib/rdmacm-mux/meson.build
@@ -1,7 +1,5 @@
-if 'CONFIG_PVRDMA' in config_host
-  # if not found, CONFIG_PVRDMA should not be set
+if have_pvrdma
   # FIXME: broken on big endian architectures
-  libumad = cc.find_library('ibumad', required: true)
   executable('rdmacm-mux', files('main.c'), genh,
              dependencies: [glib, libumad],
              build_by_default: false,
diff --git a/meson.build b/meson.build
index f53fd66716..bdee186702 100644
--- a/meson.build
+++ b/meson.build
@@ -1217,9 +1217,22 @@ if numa.found() and not cc.links('''
 endif
 
 rdma = not_found
-if 'CONFIG_RDMA' in config_host
-  rdma = declare_dependency(link_args: config_host['RDMA_LIBS'].split())
+if not get_option('rdma').auto() or have_system
+  libumad = cc.find_library('ibumad', required: get_option('rdma'))
+  rdma_libs = [cc.find_library('rdmacm', has_headers: ['rdma/rdma_cma.h'],
+                               required: get_option('rdma'),
+                               kwargs: static_kwargs),
+               cc.find_library('ibverbs', required: get_option('rdma'),
+                               kwargs: static_kwargs),
+               libumad]
+  rdma = declare_dependency(dependencies: rdma_libs)
+  foreach lib: rdma_libs
+    if not lib.found()
+      rdma = not_found
+    endif
+  endforeach
 endif
+
 xen = not_found
 if 'CONFIG_XEN_BACKEND' in config_host
   xen = declare_dependency(compile_args: config_host['XEN_CFLAGS'].split(),
@@ -1552,6 +1565,7 @@ config_host_data.set('CONFIG_NUMA', numa.found())
 config_host_data.set('CONFIG_OPENGL', opengl.found())
 config_host_data.set('CONFIG_PROFILER', get_option('profiler'))
 config_host_data.set('CONFIG_RBD', rbd.found())
+config_host_data.set('CONFIG_RDMA', rdma.found())
 config_host_data.set('CONFIG_SDL', sdl.found())
 config_host_data.set('CONFIG_SDL_IMAGE', sdl_image.found())
 config_host_data.set('CONFIG_SECCOMP', seccomp.found())
@@ -1650,7 +1664,7 @@ config_host_data.set('HAVE_SYSTEM_FUNCTION', cc.has_function('system', prefix: '
 if rdma.found()
   config_host_data.set('HAVE_IBV_ADVISE_MR',
                        cc.has_function('ibv_advise_mr',
-                                       args: config_host['RDMA_LIBS'].split(),
+                                       dependencies: rdma,
                                        prefix: '#include <infiniband/verbs.h>'))
 endif
 
@@ -1970,6 +1984,36 @@ config_host_data.set('CONFIG_AVX512F_OPT', get_option('avx512f') \
     int main(int argc, char *argv[]) { return bar(argv[0]); }
   '''), error_message: 'AVX512F not available').allowed())
 
+have_pvrdma = get_option('pvrdma') \
+  .require(rdma.found(), error_message: 'PVRDMA requires OpenFabrics libraries') \
+  .require(cc.compiles('''
+    int main(void)
+    {
+      char buf = 0;
+      void *addr = &buf;
+      addr = mremap(addr, 0, 1, MREMAP_MAYMOVE | MREMAP_FIXED);
+
+      return 0;
+    }'''), error_message: 'PVRDMA requires mremap').allowed()
+
+if have_pvrdma
+  config_host_data.set('LEGACY_RDMA_REG_MR', not cc.compiles('''
+    #include <infiniband/verbs.h>
+    int main(void)
+    {
+      struct ibv_mr *mr;
+      struct ibv_pd *pd = NULL;
+      size_t length = 10;
+      uint64_t iova = 0;
+      int access = 0;
+      void *addr = NULL;
+
+      mr = ibv_reg_mr_iova(pd, addr, length, iova, access);
+      ibv_dereg_mr(mr);
+      return 0;
+    }'''))
+endif
+
 if get_option('membarrier').disabled()
   have_membarrier = false
 elif targetos == 'windows'
@@ -2092,7 +2136,7 @@ host_kconfig = \
   ('CONFIG_VHOST_KERNEL' in config_host ? ['CONFIG_VHOST_KERNEL=y'] : []) + \
   (have_virtfs ? ['CONFIG_VIRTFS=y'] : []) + \
   ('CONFIG_LINUX' in config_host ? ['CONFIG_LINUX=y'] : []) + \
-  ('CONFIG_PVRDMA' in config_host ? ['CONFIG_PVRDMA=y'] : []) + \
+  (have_pvrdma ? ['CONFIG_PVRDMA=y'] : []) + \
   (multiprocess_allowed ? ['CONFIG_MULTIPROCESS_ALLOWED=y'] : [])
 
 ignored = [ 'TARGET_XML_FILES', 'TARGET_ABI_DIR', 'TARGET_ARCH' ]
@@ -3686,8 +3730,8 @@ summary_info += {'l2tpv3 support':    have_l2tpv3}
 summary_info += {'Linux AIO support': libaio}
 summary_info += {'Linux io_uring support': linux_io_uring}
 summary_info += {'ATTR/XATTR support': libattr}
-summary_info += {'RDMA support':      config_host.has_key('CONFIG_RDMA')}
-summary_info += {'PVRDMA support':    config_host.has_key('CONFIG_PVRDMA')}
+summary_info += {'RDMA support':      rdma}
+summary_info += {'PVRDMA support':    have_pvrdma}
 summary_info += {'fdt support':       fdt_opt == 'disabled' ? false : fdt_opt}
 summary_info += {'libcap-ng support': libcap_ng}
 summary_info += {'bpf support':       libbpf}
diff --git a/meson_options.txt b/meson_options.txt
index bd8efe4fbf..c00e0866e9 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -151,6 +151,10 @@ option('rbd', type : 'feature', value : 'auto',
        description: 'Ceph block device driver')
 option('opengl', type : 'feature', value : 'auto',
        description: 'OpenGL support')
+option('rdma', type : 'feature', value : 'auto',
+       description: 'Enable RDMA-based migration')
+option('pvrdma', type : 'feature', value : 'auto',
+       description: 'Enable PVRDMA support')
 option('gtk', type : 'feature', value : 'auto',
        description: 'GTK+ user interface')
 option('sdl', type : 'feature', value : 'auto',
diff --git a/migration/meson.build b/migration/meson.build
index 8b5ca5c047..6880b61b10 100644
--- a/migration/meson.build
+++ b/migration/meson.build
@@ -27,7 +27,7 @@ softmmu_ss.add(files(
   'tls.c',
 ), gnutls)
 
-softmmu_ss.add(when: ['CONFIG_RDMA', rdma], if_true: files('rdma.c'))
+softmmu_ss.add(when: rdma, if_true: files('rdma.c'))
 if get_option('live_block_migration').allowed()
   softmmu_ss.add(files('block.c'))
 endif
diff --git a/scripts/meson-buildoptions.sh b/scripts/meson-buildoptions.sh
index f91bd9231b..cd922614e8 100644
--- a/scripts/meson-buildoptions.sh
+++ b/scripts/meson-buildoptions.sh
@@ -95,10 +95,12 @@ meson_options_help() {
   printf "%s\n" '  oss             OSS sound support'
   printf "%s\n" '  pa              PulseAudio sound support'
   printf "%s\n" '  parallels       parallels image format support'
+  printf "%s\n" '  pvrdma          Enable PVRDMA support'
   printf "%s\n" '  qcow1           qcow1 image format support'
   printf "%s\n" '  qed             qed image format support'
   printf "%s\n" '  qga-vss         build QGA VSS support (broken with MinGW)'
   printf "%s\n" '  rbd             Ceph block device driver'
+  printf "%s\n" '  rdma            Enable RDMA-based migration'
   printf "%s\n" '  replication     replication support'
   printf "%s\n" '  sdl             SDL user interface'
   printf "%s\n" '  sdl-image       SDL Image support for icons'
@@ -282,6 +284,8 @@ _meson_option_parse() {
     --disable-parallels) printf "%s" -Dparallels=disabled ;;
     --enable-profiler) printf "%s" -Dprofiler=true ;;
     --disable-profiler) printf "%s" -Dprofiler=false ;;
+    --enable-pvrdma) printf "%s" -Dpvrdma=enabled ;;
+    --disable-pvrdma) printf "%s" -Dpvrdma=disabled ;;
     --enable-qcow1) printf "%s" -Dqcow1=enabled ;;
     --disable-qcow1) printf "%s" -Dqcow1=disabled ;;
     --enable-qed) printf "%s" -Dqed=enabled ;;
@@ -292,6 +296,8 @@ _meson_option_parse() {
     --disable-qom-cast-debug) printf "%s" -Dqom_cast_debug=false ;;
     --enable-rbd) printf "%s" -Drbd=enabled ;;
     --disable-rbd) printf "%s" -Drbd=disabled ;;
+    --enable-rdma) printf "%s" -Drdma=enabled ;;
+    --disable-rdma) printf "%s" -Drdma=disabled ;;
     --enable-replication) printf "%s" -Dreplication=enabled ;;
     --disable-replication) printf "%s" -Dreplication=disabled ;;
     --enable-rng-none) printf "%s" -Drng_none=true ;;
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 74+ messages in thread

* [PATCH 09/34] meson, configure: move keyctl test to meson
  2022-04-20 15:33 [PATCH 00/34] Misc meson conversions for QEMU 7.1 Paolo Bonzini
                   ` (7 preceding siblings ...)
  2022-04-20 15:33 ` [PATCH 08/34] meson, configure: move RDMA options " Paolo Bonzini
@ 2022-04-20 15:33 ` Paolo Bonzini
  2022-04-20 16:27   ` Marc-André Lureau
  2022-04-20 15:33 ` [PATCH 10/34] meson, configure: move usbfs " Paolo Bonzini
                   ` (24 subsequent siblings)
  33 siblings, 1 reply; 74+ messages in thread
From: Paolo Bonzini @ 2022-04-20 15:33 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 configure                     | 44 -----------------------------------
 crypto/meson.build            |  4 +++-
 meson.build                   | 15 +++++++++++-
 meson_options.txt             |  2 ++
 scripts/meson-buildoptions.sh |  3 +++
 5 files changed, 22 insertions(+), 46 deletions(-)

diff --git a/configure b/configure
index cfd15c3518..1c74d2c5f2 100755
--- a/configure
+++ b/configure
@@ -322,7 +322,6 @@ trace_file="trace"
 coroutine=""
 tls_priority="NORMAL"
 plugins="$default_feature"
-secret_keyring="$default_feature"
 meson=""
 meson_args=""
 ninja=""
@@ -1009,10 +1008,6 @@ for opt do
   ;;
   --gdb=*) gdb_bin="$optarg"
   ;;
-  --enable-keyring) secret_keyring="yes"
-  ;;
-  --disable-keyring) secret_keyring="no"
-  ;;
   --enable-gio) gio=yes
   ;;
   --disable-gio) gio=no
@@ -2440,41 +2435,6 @@ case "$slirp" in
     ;;
 esac
 
-##########################################
-# check for usable __NR_keyctl syscall
-
-if test "$linux" = "yes" ; then
-
-    have_keyring=no
-    cat > $TMPC << EOF
-#include <errno.h>
-#include <asm/unistd.h>
-#include <linux/keyctl.h>
-#include <unistd.h>
-int main(void) {
-    return syscall(__NR_keyctl, KEYCTL_READ, 0, NULL, NULL, 0);
-}
-EOF
-    if compile_prog "" "" ; then
-        have_keyring=yes
-    fi
-fi
-if test "$secret_keyring" != "no"
-then
-    if test "$have_keyring" = "yes"
-    then
-	secret_keyring=yes
-    else
-	if test "$secret_keyring" = "yes"
-	then
-	    error_exit "syscall __NR_keyctl requested, \
-but not implemented on your system"
-	else
-	    secret_keyring=no
-	fi
-    fi
-fi
-
 ##########################################
 # End of CC checks
 # After here, no more $cc or $ld runs
@@ -2760,10 +2720,6 @@ if test -n "$gdb_bin"; then
     fi
 fi
 
-if test "$secret_keyring" = "yes" ; then
-  echo "CONFIG_SECRET_KEYRING=y" >> $config_host_mak
-fi
-
 echo "ROMS=$roms" >> $config_host_mak
 echo "MAKE=$make" >> $config_host_mak
 echo "PYTHON=$python" >> $config_host_mak
diff --git a/crypto/meson.build b/crypto/meson.build
index 19c44bea89..f065f2f277 100644
--- a/crypto/meson.build
+++ b/crypto/meson.build
@@ -34,7 +34,9 @@ else
   crypto_ss.add(files('hash-glib.c', 'hmac-glib.c', 'pbkdf-stub.c'))
 endif
 
-crypto_ss.add(when: 'CONFIG_SECRET_KEYRING', if_true: files('secret_keyring.c'))
+if have_keyring
+  crypto_ss.add(files('secret_keyring.c'))
+endif
 if have_afalg
   crypto_ss.add(if_true: files('afalg.c', 'cipher-afalg.c', 'hash-afalg.c'))
 endif
diff --git a/meson.build b/meson.build
index bdee186702..066bb69174 100644
--- a/meson.build
+++ b/meson.build
@@ -1938,6 +1938,19 @@ config_host_data.set('CONFIG_GETAUXVAL', cc.links(gnu_source_prefix + '''
     return getauxval(AT_HWCAP) == 0;
   }'''))
 
+have_keyring = get_option('keyring') \
+  .require(targetos == 'linux', error_message: 'keyring is only available on Linux') \
+  .require(cc.compiles('''
+    #include <errno.h>
+    #include <asm/unistd.h>
+    #include <linux/keyctl.h>
+    #include <sys/syscall.h>
+    #include <unistd.h>
+    int main(void) {
+        return syscall(__NR_keyctl, KEYCTL_READ, 0, NULL, NULL, 0);
+    }'''), error_message: 'keyctl syscall not available on this system').allowed()
+config_host_data.set('CONFIG_SECRET_KEYRING', have_keyring)
+
 have_cpuid_h = cc.links('''
   #include <cpuid.h>
   int main(void) {
@@ -3684,7 +3697,7 @@ if nettle.found()
 endif
 summary_info += {'AF_ALG support':    have_afalg}
 summary_info += {'rng-none':          get_option('rng_none')}
-summary_info += {'Linux keyring':     config_host.has_key('CONFIG_SECRET_KEYRING')}
+summary_info += {'Linux keyring':     have_keyring}
 summary(summary_info, bool_yn: true, section: 'Crypto')
 
 # Libraries
diff --git a/meson_options.txt b/meson_options.txt
index c00e0866e9..d58c69315c 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -90,6 +90,8 @@ option('avx2', type: 'feature', value: 'auto',
        description: 'AVX2 optimizations')
 option('avx512f', type: 'feature', value: 'disabled',
        description: 'AVX512F optimizations')
+option('keyring', type: 'feature', value: 'auto',
+       description: 'Linux keyring support')
 
 option('attr', type : 'feature', value : 'auto',
        description: 'attr/xattr support')
diff --git a/scripts/meson-buildoptions.sh b/scripts/meson-buildoptions.sh
index cd922614e8..0daeb11fd3 100644
--- a/scripts/meson-buildoptions.sh
+++ b/scripts/meson-buildoptions.sh
@@ -68,6 +68,7 @@ meson_options_help() {
   printf "%s\n" '  hvf             HVF acceleration support'
   printf "%s\n" '  iconv           Font glyph conversion support'
   printf "%s\n" '  jack            JACK sound support'
+  printf "%s\n" '  keyring         Linux keyring support'
   printf "%s\n" '  kvm             KVM acceleration support'
   printf "%s\n" '  l2tpv3          l2tpv3 network backend support'
   printf "%s\n" '  libdaxctl       libdaxctl support'
@@ -229,6 +230,8 @@ _meson_option_parse() {
     --disable-install-blobs) printf "%s" -Dinstall_blobs=false ;;
     --enable-jack) printf "%s" -Djack=enabled ;;
     --disable-jack) printf "%s" -Djack=disabled ;;
+    --enable-keyring) printf "%s" -Dkeyring=enabled ;;
+    --disable-keyring) printf "%s" -Dkeyring=disabled ;;
     --enable-kvm) printf "%s" -Dkvm=enabled ;;
     --disable-kvm) printf "%s" -Dkvm=disabled ;;
     --enable-l2tpv3) printf "%s" -Dl2tpv3=enabled ;;
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 74+ messages in thread

* [PATCH 10/34] meson, configure: move usbfs test to meson
  2022-04-20 15:33 [PATCH 00/34] Misc meson conversions for QEMU 7.1 Paolo Bonzini
                   ` (8 preceding siblings ...)
  2022-04-20 15:33 ` [PATCH 09/34] meson, configure: move keyctl test " Paolo Bonzini
@ 2022-04-20 15:33 ` Paolo Bonzini
  2022-04-20 16:35   ` Marc-André Lureau
  2022-04-20 15:33 ` [PATCH 11/34] meson, configure: move libgio " Paolo Bonzini
                   ` (23 subsequent siblings)
  33 siblings, 1 reply; 74+ messages in thread
From: Paolo Bonzini @ 2022-04-20 15:33 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 configure   | 28 ----------------------------
 meson.build | 13 +++++++++++++
 2 files changed, 13 insertions(+), 28 deletions(-)

diff --git a/configure b/configure
index 1c74d2c5f2..d4d7c001f6 100755
--- a/configure
+++ b/configure
@@ -2160,31 +2160,6 @@ case "$fdt" in
     ;;
 esac
 
-##########################################
-# check for usbfs
-have_usbfs=no
-if test "$linux_user" = "yes"; then
-  cat > $TMPC << EOF
-#include <linux/usbdevice_fs.h>
-
-#ifndef USBDEVFS_GET_CAPABILITIES
-#error "USBDEVFS_GET_CAPABILITIES undefined"
-#endif
-
-#ifndef USBDEVFS_DISCONNECT_CLAIM
-#error "USBDEVFS_DISCONNECT_CLAIM undefined"
-#endif
-
-int main(void)
-{
-    return 0;
-}
-EOF
-  if compile_prog "" ""; then
-    have_usbfs=yes
-  fi
-fi
-
 ##########################################
 # capstone
 
@@ -2641,9 +2616,6 @@ fi
 if test "$module_upgrades" = "yes"; then
   echo "CONFIG_MODULE_UPGRADES=y" >> $config_host_mak
 fi
-if test "$have_usbfs" = "yes" ; then
-  echo "CONFIG_USBFS=y" >> $config_host_mak
-fi
 if test "$gio" = "yes" ; then
     echo "CONFIG_GIO=y" >> $config_host_mak
     echo "GIO_CFLAGS=$gio_cflags" >> $config_host_mak
diff --git a/meson.build b/meson.build
index 066bb69174..c0b2838d2e 100644
--- a/meson.build
+++ b/meson.build
@@ -1938,6 +1938,19 @@ config_host_data.set('CONFIG_GETAUXVAL', cc.links(gnu_source_prefix + '''
     return getauxval(AT_HWCAP) == 0;
   }'''))
 
+config_host_data.set('CONFIG_USBFS', have_linux_user and cc.compiles('''
+  #include <linux/usbdevice_fs.h>
+
+  #ifndef USBDEVFS_GET_CAPABILITIES
+  #error "USBDEVFS_GET_CAPABILITIES undefined"
+  #endif
+
+  #ifndef USBDEVFS_DISCONNECT_CLAIM
+  #error "USBDEVFS_DISCONNECT_CLAIM undefined"
+  #endif
+
+  int main(void) { return 0; }'''))
+
 have_keyring = get_option('keyring') \
   .require(targetos == 'linux', error_message: 'keyring is only available on Linux') \
   .require(cc.compiles('''
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 74+ messages in thread

* [PATCH 11/34] meson, configure: move libgio test to meson
  2022-04-20 15:33 [PATCH 00/34] Misc meson conversions for QEMU 7.1 Paolo Bonzini
                   ` (9 preceding siblings ...)
  2022-04-20 15:33 ` [PATCH 10/34] meson, configure: move usbfs " Paolo Bonzini
@ 2022-04-20 15:33 ` Paolo Bonzini
  2022-04-20 16:40   ` Marc-André Lureau
  2022-04-20 15:33 ` [PATCH 12/34] meson: move CONFIG_XEN_PCI_PASSTHROUGH to config-host.h Paolo Bonzini
                   ` (22 subsequent siblings)
  33 siblings, 1 reply; 74+ messages in thread
From: Paolo Bonzini @ 2022-04-20 15:33 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 backends/meson.build          |  2 +-
 configure                     | 58 -----------------------------------
 meson.build                   | 32 ++++++++++++++++---
 meson_options.txt             |  2 ++
 scripts/meson-buildoptions.sh |  3 ++
 tests/qtest/meson.build       |  5 ++-
 ui/meson.build                |  7 ++---
 util/meson.build              |  2 +-
 8 files changed, 39 insertions(+), 72 deletions(-)

diff --git a/backends/meson.build b/backends/meson.build
index 6e68945528..535c3ca7dd 100644
--- a/backends/meson.build
+++ b/backends/meson.build
@@ -15,7 +15,7 @@ softmmu_ss.add(when: 'CONFIG_LINUX', if_true: files('hostmem-memfd.c'))
 softmmu_ss.add(when: ['CONFIG_VHOST_USER', 'CONFIG_VIRTIO'], if_true: files('vhost-user.c'))
 softmmu_ss.add(when: 'CONFIG_VIRTIO_CRYPTO', if_true: files('cryptodev-vhost.c'))
 softmmu_ss.add(when: ['CONFIG_VIRTIO_CRYPTO', 'CONFIG_VHOST_CRYPTO'], if_true: files('cryptodev-vhost-user.c'))
-softmmu_ss.add(when: 'CONFIG_GIO', if_true: [files('dbus-vmstate.c'), gio])
+softmmu_ss.add(when: gio, if_true: files('dbus-vmstate.c'))
 softmmu_ss.add(when: 'CONFIG_SGX', if_true: files('hostmem-epc.c'))
 
 subdir('tpm')
diff --git a/configure b/configure
index d4d7c001f6..75e8b1e7aa 100755
--- a/configure
+++ b/configure
@@ -325,7 +325,6 @@ plugins="$default_feature"
 meson=""
 meson_args=""
 ninja=""
-gio="$default_feature"
 skip_meson=no
 
 # The following Meson options are handled manually (still they
@@ -1008,10 +1007,6 @@ for opt do
   ;;
   --gdb=*) gdb_bin="$optarg"
   ;;
-  --enable-gio) gio=yes
-  ;;
-  --disable-gio) gio=no
-  ;;
   # backwards compatibility options
   --enable-trace-backend=*) meson_option_parse "--enable-trace-backends=$optarg" "$optarg"
   ;;
@@ -1236,7 +1231,6 @@ cat << EOF
   vhost-kernel    vhost kernel backend support
   vhost-user      vhost-user backend support
   vhost-vdpa      vhost-vdpa kernel backend support
-  gio             libgio support
 
 NOTE: The object files are built at the place where configure is launched
 EOF
@@ -2047,50 +2041,6 @@ if test "$static" = yes && test "$mingw32" = yes; then
     glib_cflags="-DGLIB_STATIC_COMPILATION $glib_cflags"
 fi
 
-if ! test "$gio" = "no"; then
-    pass=no
-    if $pkg_config --atleast-version=$glib_req_ver gio-2.0; then
-        gio_cflags=$($pkg_config --cflags gio-2.0)
-        gio_libs=$($pkg_config --libs gio-2.0)
-        gdbus_codegen=$($pkg_config --variable=gdbus_codegen gio-2.0)
-        if ! has "$gdbus_codegen"; then
-            gdbus_codegen=
-        fi
-        # Check that the libraries actually work -- Ubuntu 18.04 ships
-        # with pkg-config --static --libs data for gio-2.0 that is missing
-        # -lblkid and will give a link error.
-        cat > $TMPC <<EOF
-#include <gio/gio.h>
-int main(void)
-{
-    g_dbus_proxy_new_sync(0, 0, 0, 0, 0, 0, 0, 0);
-    return 0;
-}
-EOF
-        if compile_prog "$gio_cflags" "$gio_libs" ; then
-            pass=yes
-        else
-            pass=no
-        fi
-
-        if test "$pass" = "yes" &&
-            $pkg_config --atleast-version=$glib_req_ver gio-unix-2.0; then
-            gio_cflags="$gio_cflags $($pkg_config --cflags gio-unix-2.0)"
-            gio_libs="$gio_libs $($pkg_config --libs gio-unix-2.0)"
-        fi
-    fi
-
-    if test "$pass" = "no"; then
-        if test "$gio" = "yes"; then
-            feature_not_found "gio" "Install libgio >= 2.0"
-        else
-            gio=no
-        fi
-    else
-        gio=yes
-    fi
-fi
-
 # Sanity check that the current size_t matches the
 # size that glib thinks it should be. This catches
 # problems on multi-arch where people try to build
@@ -2616,14 +2566,6 @@ fi
 if test "$module_upgrades" = "yes"; then
   echo "CONFIG_MODULE_UPGRADES=y" >> $config_host_mak
 fi
-if test "$gio" = "yes" ; then
-    echo "CONFIG_GIO=y" >> $config_host_mak
-    echo "GIO_CFLAGS=$gio_cflags" >> $config_host_mak
-    echo "GIO_LIBS=$gio_libs" >> $config_host_mak
-fi
-if test "$gdbus_codegen" != "" ; then
-    echo "GDBUS_CODEGEN=$gdbus_codegen" >> $config_host_mak
-fi
 echo "CONFIG_TLS_PRIORITY=\"$tls_priority\"" >> $config_host_mak
 
 if test "$xen" = "enabled" ; then
diff --git a/meson.build b/meson.build
index c0b2838d2e..b8046efcf1 100644
--- a/meson.build
+++ b/meson.build
@@ -448,11 +448,32 @@ glib = declare_dependency(compile_args: config_host['GLIB_CFLAGS'].split(),
 meson.override_dependency('glib-2.0', glib)
 
 gio = not_found
-if 'CONFIG_GIO' in config_host
-  gio = declare_dependency(compile_args: config_host['GIO_CFLAGS'].split(),
-                           link_args: config_host['GIO_LIBS'].split(),
-                           version: config_host['GLIB_VERSION'])
+gdbus_codegen = not_found
+if not get_option('gio').auto() or have_system
+  gio = dependency('gio-2.0', required: get_option('gio'),
+                   method: 'pkg-config', kwargs: static_kwargs)
+  if gio.found() and not cc.links('''
+    #include <gio/gio.h>
+    int main(void)
+    {
+      g_dbus_proxy_new_sync(0, 0, 0, 0, 0, 0, 0, 0);
+      return 0;
+    }''', dependencies: [glib, gio])
+    if get_option('gio').enabled()
+      error('The installed libgio is broken for static linking')
+    endif
+    gio = not_found
+  endif
+  if gio.found()
+    gdbus_codegen = find_program(gio.get_variable('gdbus_codegen'),
+                                 required: get_option('gio'))
+    gio_unix = dependency('gio-unix-2.0', required: get_option('gio'),
+                          method: 'pkg-config', kwargs: static_kwargs)
+    gio = declare_dependency(dependencies: [gio, gio_unix],
+                             version: gio.version())
+  endif
 endif
+
 lttng = not_found
 if 'ust' in get_option('trace_backends')
   lttng = dependency('lttng-ust', required: true, version: '>= 2.1',
@@ -1478,7 +1499,7 @@ dbus_display = get_option('dbus_display') \
            error_message: '-display dbus requires glib>=2.64') \
   .require(enable_modules,
            error_message: '-display dbus requires --enable-modules') \
-  .require(config_host.has_key('GDBUS_CODEGEN'),
+  .require(gdbus_codegen.found(),
            error_message: '-display dbus requires gdbus-codegen') \
   .allowed()
 
@@ -1540,6 +1561,7 @@ config_host_data.set('CONFIG_MPATH_NEW_API', mpathpersist_new_api)
 config_host_data.set('CONFIG_CURL', curl.found())
 config_host_data.set('CONFIG_CURSES', curses.found())
 config_host_data.set('CONFIG_GBM', gbm.found())
+config_host_data.set('CONFIG_GIO', gio.found())
 config_host_data.set('CONFIG_GLUSTERFS', glusterfs.found())
 if glusterfs.found()
   config_host_data.set('CONFIG_GLUSTERFS_XLATOR_OPT', glusterfs.version().version_compare('>=4'))
diff --git a/meson_options.txt b/meson_options.txt
index d58c69315c..d140c0ef89 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -109,6 +109,8 @@ option('cocoa', type : 'feature', value : 'auto',
        description: 'Cocoa user interface (macOS only)')
 option('curl', type : 'feature', value : 'auto',
        description: 'CURL block device driver')
+option('gio', type : 'feature', value : 'auto',
+       description: 'use libgio for D-Bus support')
 option('glusterfs', type : 'feature', value : 'auto',
        description: 'Glusterfs block device driver')
 option('libiscsi', type : 'feature', value : 'auto',
diff --git a/scripts/meson-buildoptions.sh b/scripts/meson-buildoptions.sh
index 0daeb11fd3..92be3e6187 100644
--- a/scripts/meson-buildoptions.sh
+++ b/scripts/meson-buildoptions.sh
@@ -59,6 +59,7 @@ meson_options_help() {
   printf "%s\n" '  fuse-lseek      SEEK_HOLE/SEEK_DATA support for FUSE exports'
   printf "%s\n" '  gcrypt          libgcrypt cryptography support'
   printf "%s\n" '  gettext         Localization of the GTK+ user interface'
+  printf "%s\n" '  gio             use libgio for D-Bus support'
   printf "%s\n" '  glusterfs       Glusterfs block device driver'
   printf "%s\n" '  gnutls          GNUTLS cryptography support'
   printf "%s\n" '  gtk             GTK+ user interface'
@@ -208,6 +209,8 @@ _meson_option_parse() {
     --disable-gcrypt) printf "%s" -Dgcrypt=disabled ;;
     --enable-gettext) printf "%s" -Dgettext=enabled ;;
     --disable-gettext) printf "%s" -Dgettext=disabled ;;
+    --enable-gio) printf "%s" -Dgio=enabled ;;
+    --disable-gio) printf "%s" -Dgio=disabled ;;
     --enable-glusterfs) printf "%s" -Dglusterfs=enabled ;;
     --disable-glusterfs) printf "%s" -Dglusterfs=disabled ;;
     --enable-gnutls) printf "%s" -Dgnutls=enabled ;;
diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build
index d25f82bb5a..69f97b8992 100644
--- a/tests/qtest/meson.build
+++ b/tests/qtest/meson.build
@@ -99,14 +99,13 @@ if dbus_display
 endif
 
 dbus_daemon = find_program('dbus-daemon', required: false)
-if dbus_daemon.found() and config_host.has_key('GDBUS_CODEGEN')
+if dbus_daemon.found() and gdbus_codegen.found()
   # Temporarily disabled due to Patchew failures:
   #qtests_i386 += ['dbus-vmstate-test']
   dbus_vmstate1 = custom_target('dbus-vmstate description',
                                 output: ['dbus-vmstate1.h', 'dbus-vmstate1.c'],
                                 input: meson.project_source_root() / 'backends/dbus-vmstate1.xml',
-                                command: [config_host['GDBUS_CODEGEN'],
-                                          '@INPUT@',
+                                command: [gdbus_codegen, '@INPUT@',
                                           '--interface-prefix', 'org.qemu',
                                           '--generate-c-code', '@BASENAME@']).to_list()
 else
diff --git a/ui/meson.build b/ui/meson.build
index b21d3d1534..eba93b41e3 100644
--- a/ui/meson.build
+++ b/ui/meson.build
@@ -74,14 +74,13 @@ if dbus_display
   dbus_display1 = custom_target('dbus-display gdbus-codegen',
                                 output: ['dbus-display1.h', 'dbus-display1.c'],
                                 input: files('dbus-display1.xml'),
-                                command: [config_host['GDBUS_CODEGEN'],
-                                          '@INPUT@',
+                                command: [gdbus_codegen, '@INPUT@',
                                           '--glib-min-required', '2.64',
                                           '--output-directory', meson.current_build_dir(),
                                           '--interface-prefix', 'org.qemu.',
                                           '--c-namespace', 'QemuDBus',
                                           '--generate-c-code', '@BASENAME@'])
-  dbus_ss.add(when: [gio, pixman, opengl, 'CONFIG_GIO'],
+  dbus_ss.add(when: [gio, pixman, opengl],
               if_true: [files(
                 'dbus-chardev.c',
                 'dbus-clipboard.c',
@@ -128,7 +127,7 @@ if spice.found()
   ui_modules += {'spice-core' : spice_core_ss}
 endif
 
-if spice.found() and config_host.has_key('CONFIG_GIO')
+if spice.found() and gio.found()
   spice_ss = ss.source_set()
   spice_ss.add(spice, gio, pixman, files('spice-app.c'))
   ui_modules += {'spice-app': spice_ss}
diff --git a/util/meson.build b/util/meson.build
index 82eec004e2..8f16018cd4 100644
--- a/util/meson.build
+++ b/util/meson.build
@@ -61,7 +61,7 @@ endif
 
 if have_system
   util_ss.add(files('crc-ccitt.c'))
-  util_ss.add(when: 'CONFIG_GIO', if_true: [files('dbus.c'), gio])
+  util_ss.add(when: gio, if_true: files('dbus.c'))
   util_ss.add(when: 'CONFIG_LINUX', if_true: files('userfaultfd.c'))
 endif
 
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 74+ messages in thread

* [PATCH 12/34] meson: move CONFIG_XEN_PCI_PASSTHROUGH to config-host.h
  2022-04-20 15:33 [PATCH 00/34] Misc meson conversions for QEMU 7.1 Paolo Bonzini
                   ` (10 preceding siblings ...)
  2022-04-20 15:33 ` [PATCH 11/34] meson, configure: move libgio " Paolo Bonzini
@ 2022-04-20 15:33 ` Paolo Bonzini
  2022-04-20 16:45   ` Marc-André Lureau
  2022-04-20 15:33 ` [PATCH 13/34] meson, configure: move --enable-module-upgrades to meson Paolo Bonzini
                   ` (21 subsequent siblings)
  33 siblings, 1 reply; 74+ messages in thread
From: Paolo Bonzini @ 2022-04-20 15:33 UTC (permalink / raw)
  To: qemu-devel

CONFIG_XEN_PCI_PASSTHROUGH is just a global configuration option; the selection
of the actual files in hw/xen/meson.build is also conditional on CONFIG_XEN,
so there is no need to put CONFIG_XEN_PCI_PASSTHROUGH in config-target.h.

This inaccuracy was copied over from the configure script in commit
8a19980e3f ("configure: move accelerator logic to meson", 2020-10-03).

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/xen/meson.build | 20 ++++++++++++--------
 meson.build        |  3 +--
 2 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/hw/xen/meson.build b/hw/xen/meson.build
index 076954b89c..08dc1f6857 100644
--- a/hw/xen/meson.build
+++ b/hw/xen/meson.build
@@ -8,13 +8,17 @@ softmmu_ss.add(when: ['CONFIG_XEN', xen], if_true: files(
 ))
 
 xen_specific_ss = ss.source_set()
-xen_specific_ss.add(when: 'CONFIG_XEN_PCI_PASSTHROUGH', if_true: files(
-  'xen-host-pci-device.c',
-  'xen_pt.c',
-  'xen_pt_config_init.c',
-  'xen_pt_graphics.c',
-  'xen_pt_load_rom.c',
-  'xen_pt_msi.c',
-), if_false: files('xen_pt_stub.c'))
+if have_xen_pci_passthrough
+  xen_specific_ss.add(files(
+    'xen-host-pci-device.c',
+    'xen_pt.c',
+    'xen_pt_config_init.c',
+    'xen_pt_graphics.c',
+    'xen_pt_load_rom.c',
+    'xen_pt_msi.c',
+  ))
+else
+  xen_specific_ss.add('xen_pt_stub.c')
+endif
 
 specific_ss.add_all(when: ['CONFIG_XEN', xen], if_true: xen_specific_ss)
diff --git a/meson.build b/meson.build
index b8046efcf1..84156df809 100644
--- a/meson.build
+++ b/meson.build
@@ -1627,6 +1627,7 @@ config_host_data.set('CONFIG_X11', x11.found())
 config_host_data.set('CONFIG_DBUS_DISPLAY', dbus_display)
 config_host_data.set('CONFIG_CFI', get_option('cfi'))
 config_host_data.set('CONFIG_SELINUX', selinux.found())
+config_host_data.set('CONFIG_XEN_PCI_PASSTHROUGH', have_xen_pci_passthrough)
 config_host_data.set('QEMU_VERSION', '"@0@"'.format(meson.project_version()))
 config_host_data.set('QEMU_VERSION_MAJOR', meson.project_version().split('.')[0])
 config_host_data.set('QEMU_VERSION_MINOR', meson.project_version().split('.')[1])
@@ -2228,8 +2229,6 @@ foreach target : target_dirs
       config_all += { sym: 'y' }
       if sym == 'CONFIG_TCG' and tcg_arch == 'tci'
         config_target += { 'CONFIG_TCG_INTERPRETER': 'y' }
-      elif sym == 'CONFIG_XEN' and have_xen_pci_passthrough
-        config_target += { 'CONFIG_XEN_PCI_PASSTHROUGH': 'y' }
       endif
       if target in modular_tcg
         config_target += { 'CONFIG_TCG_MODULAR': 'y' }
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 74+ messages in thread

* [PATCH 13/34] meson, configure: move --enable-module-upgrades to meson
  2022-04-20 15:33 [PATCH 00/34] Misc meson conversions for QEMU 7.1 Paolo Bonzini
                   ` (11 preceding siblings ...)
  2022-04-20 15:33 ` [PATCH 12/34] meson: move CONFIG_XEN_PCI_PASSTHROUGH to config-host.h Paolo Bonzini
@ 2022-04-20 15:33 ` Paolo Bonzini
  2022-04-20 18:05   ` Marc-André Lureau
  2022-04-20 15:33 ` [PATCH 14/34] meson, configure: move Xen detection " Paolo Bonzini
                   ` (20 subsequent siblings)
  33 siblings, 1 reply; 74+ messages in thread
From: Paolo Bonzini @ 2022-04-20 15:33 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 configure                     | 14 --------------
 meson.build                   |  7 ++++++-
 meson_options.txt             |  2 ++
 scripts/meson-buildoptions.sh |  4 ++++
 4 files changed, 12 insertions(+), 15 deletions(-)

diff --git a/configure b/configure
index 75e8b1e7aa..d4d51eff06 100755
--- a/configure
+++ b/configure
@@ -310,7 +310,6 @@ fortify_source="$default_feature"
 gcov="no"
 EXESUF=""
 modules="no"
-module_upgrades="no"
 prefix="/usr/local"
 qemu_suffix="qemu"
 softmmu="yes"
@@ -762,10 +761,6 @@ for opt do
   --disable-modules)
       modules="no"
   ;;
-  --disable-module-upgrades) module_upgrades="no"
-  ;;
-  --enable-module-upgrades) module_upgrades="yes"
-  ;;
   --cpu=*)
   ;;
   --target-list=*) target_list="$optarg"
@@ -1218,7 +1213,6 @@ cat << EOF
   bsd-user        all BSD usermode emulation targets
   pie             Position Independent Executables
   modules         modules support (non-Windows)
-  module-upgrades try to load modules from alternate paths for upgrades
   debug-tcg       TCG debugging (default is disabled)
   debug-info      debugging information
   lto             Enable Link-Time Optimization.
@@ -1487,11 +1481,6 @@ if test "$modules" = "yes" && test "$mingw32" = "yes" ; then
   error_exit "Modules are not available for Windows"
 fi
 
-# module_upgrades is only reasonable if modules are enabled
-if test "$modules" = "no" && test "$module_upgrades" = "yes" ; then
-  error_exit "Can't enable module-upgrades as Modules are not enabled"
-fi
-
 # Static linking is not possible with plugins, modules or PIE
 if test "$static" = "yes" ; then
   if test "$modules" = "yes" ; then
@@ -2563,9 +2552,6 @@ if test "$modules" = "yes"; then
   echo "CONFIG_STAMP=_$( (echo $qemu_version; echo $pkgversion; cat $0) | $shacmd - | cut -f1 -d\ )" >> $config_host_mak
   echo "CONFIG_MODULES=y" >> $config_host_mak
 fi
-if test "$module_upgrades" = "yes"; then
-  echo "CONFIG_MODULE_UPGRADES=y" >> $config_host_mak
-fi
 echo "CONFIG_TLS_PRIORITY=\"$tls_priority\"" >> $config_host_mak
 
 if test "$xen" = "enabled" ; then
diff --git a/meson.build b/meson.build
index 84156df809..3c47d82180 100644
--- a/meson.build
+++ b/meson.build
@@ -1548,6 +1548,11 @@ endif
 
 config_host_data.set('HOST_' + host_arch.to_upper(), 1)
 
+if get_option('module_upgrades') and not enable_modules
+  error('Cannot enable module-upgrades as modules are not enabled')
+endif
+config_host_data.set('CONFIG_MODULE_UPGRADES', get_option('module_upgrades'))
+
 config_host_data.set('CONFIG_ATTR', libattr.found())
 config_host_data.set('CONFIG_BDRV_WHITELIST_TOOLS', get_option('block_drv_whitelist_in_tools'))
 config_host_data.set('CONFIG_BRLAPI', brlapi.found())
@@ -3563,7 +3568,7 @@ summary_info += {'block layer':       have_block}
 summary_info += {'Install blobs':     get_option('install_blobs')}
 summary_info += {'module support':    config_host.has_key('CONFIG_MODULES')}
 if config_host.has_key('CONFIG_MODULES')
-  summary_info += {'alternative module path': config_host.has_key('CONFIG_MODULE_UPGRADES')}
+  summary_info += {'alternative module path': get_option('module_upgrades')}
 endif
 summary_info += {'fuzzing support':   get_option('fuzzing')}
 if have_system
diff --git a/meson_options.txt b/meson_options.txt
index d140c0ef89..cf18663833 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -34,6 +34,8 @@ option('fuzzing', type : 'boolean', value: false,
        description: 'build fuzzing targets')
 option('gettext', type : 'feature', value : 'auto',
        description: 'Localization of the GTK+ user interface')
+option('module_upgrades', type : 'boolean', value : false,
+       description: 'try to load modules from alternate paths for upgrades')
 option('install_blobs', type : 'boolean', value : true,
        description: 'install provided firmware blobs')
 option('sparse', type : 'feature', value : 'auto',
diff --git a/scripts/meson-buildoptions.sh b/scripts/meson-buildoptions.sh
index 92be3e6187..a269534394 100644
--- a/scripts/meson-buildoptions.sh
+++ b/scripts/meson-buildoptions.sh
@@ -19,6 +19,8 @@ meson_options_help() {
   printf "%s\n" '  --disable-install-blobs  install provided firmware blobs'
   printf "%s\n" '  --enable-malloc=CHOICE   choose memory allocator to use [system] (choices:'
   printf "%s\n" '                           jemalloc/system/tcmalloc)'
+  printf "%s\n" '  --enable-module-upgrades try to load modules from alternate paths for'
+  printf "%s\n" '                           upgrades'
   printf "%s\n" '  --enable-profiler        profiler support'
   printf "%s\n" '  --enable-qom-cast-debug  cast debugging support'
   printf "%s\n" '  --enable-rng-none        dummy RNG, avoid using /dev/(u)random and'
@@ -268,6 +270,8 @@ _meson_option_parse() {
     --disable-malloc-trim) printf "%s" -Dmalloc_trim=disabled ;;
     --enable-membarrier) printf "%s" -Dmembarrier=enabled ;;
     --disable-membarrier) printf "%s" -Dmembarrier=disabled ;;
+    --enable-module-upgrades) printf "%s" -Dmodule_upgrades=true ;;
+    --disable-module-upgrades) printf "%s" -Dmodule_upgrades=false ;;
     --enable-mpath) printf "%s" -Dmpath=enabled ;;
     --disable-mpath) printf "%s" -Dmpath=disabled ;;
     --enable-multiprocess) printf "%s" -Dmultiprocess=enabled ;;
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 74+ messages in thread

* [PATCH 14/34] meson, configure: move Xen detection to meson
  2022-04-20 15:33 [PATCH 00/34] Misc meson conversions for QEMU 7.1 Paolo Bonzini
                   ` (12 preceding siblings ...)
  2022-04-20 15:33 ` [PATCH 13/34] meson, configure: move --enable-module-upgrades to meson Paolo Bonzini
@ 2022-04-20 15:33 ` Paolo Bonzini
  2022-04-20 15:33 ` [PATCH 15/34] meson-buildoptions: add support for string options Paolo Bonzini
                   ` (19 subsequent siblings)
  33 siblings, 0 replies; 74+ messages in thread
From: Paolo Bonzini @ 2022-04-20 15:33 UTC (permalink / raw)
  To: qemu-devel

This is quite a complicated check.  I moved all the test programs to
a single file in scripts/, picking the right program with #if and a -D
flag in meson.build's cc.links() invocation.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 configure            | 322 +------------------------------------------
 meson.build          | 114 ++++++++++++---
 scripts/xen-detect.c | 203 +++++++++++++++++++++++++++
 3 files changed, 297 insertions(+), 342 deletions(-)
 create mode 100644 scripts/xen-detect.c

diff --git a/configure b/configure
index d4d51eff06..11d3cc19ca 100755
--- a/configure
+++ b/configure
@@ -292,7 +292,6 @@ EXTRA_CXXFLAGS=""
 EXTRA_OBJCFLAGS=""
 EXTRA_LDFLAGS=""
 
-xen_ctrl_version="$default_feature"
 vhost_kernel="$default_feature"
 vhost_net="$default_feature"
 vhost_crypto="$default_feature"
@@ -346,9 +345,6 @@ default_devices="true"
 tcg="enabled"
 cfi="false"
 
-# 4. Detection partly done in configure
-xen=${default_feature:+disabled}
-
 # parse CC options second
 for opt do
   optarg=$(expr "x$opt" : 'x[^=]*=\(.*\)')
@@ -866,10 +862,6 @@ for opt do
   ;;
   --enable-slirp=*) slirp="$optarg"
   ;;
-  --disable-xen) xen="disabled"
-  ;;
-  --enable-xen) xen="enabled"
-  ;;
   --disable-tcg) tcg="disabled"
                  plugins="no"
   ;;
@@ -1697,312 +1689,6 @@ if ! has "$pkg_config_exe"; then
   error_exit "pkg-config binary '$pkg_config_exe' not found"
 fi
 
-##########################################
-# xen probe
-
-if test "$xen" != "disabled" ; then
-  # Check whether Xen library path is specified via --extra-ldflags to avoid
-  # overriding this setting with pkg-config output. If not, try pkg-config
-  # to obtain all needed flags.
-
-  if ! echo $EXTRA_LDFLAGS | grep tools/libxc > /dev/null && \
-     $pkg_config --exists xencontrol ; then
-    xen_ctrl_version="$(printf '%d%02d%02d' \
-      $($pkg_config --modversion xencontrol | sed 's/\./ /g') )"
-    xen=enabled
-    xen_pc="xencontrol xenstore xenforeignmemory xengnttab"
-    xen_pc="$xen_pc xenevtchn xendevicemodel"
-    if $pkg_config --exists xentoolcore; then
-      xen_pc="$xen_pc xentoolcore"
-    fi
-    xen_cflags="$($pkg_config --cflags $xen_pc)"
-    xen_libs="$($pkg_config --libs $xen_pc)"
-  else
-
-    xen_libs="-lxenstore -lxenctrl"
-    xen_stable_libs="-lxenforeignmemory -lxengnttab -lxenevtchn"
-
-    # First we test whether Xen headers and libraries are available.
-    # If no, we are done and there is no Xen support.
-    # If yes, more tests are run to detect the Xen version.
-
-    # Xen (any)
-    cat > $TMPC <<EOF
-#include <xenctrl.h>
-int main(void) {
-  return 0;
-}
-EOF
-    if ! compile_prog "" "$xen_libs" ; then
-      # Xen not found
-      if test "$xen" = "enabled" ; then
-        feature_not_found "xen" "Install xen devel"
-      fi
-      xen=disabled
-
-    # Xen unstable
-    elif
-        cat > $TMPC <<EOF &&
-#undef XC_WANT_COMPAT_DEVICEMODEL_API
-#define __XEN_TOOLS__
-#include <xendevicemodel.h>
-#include <xenforeignmemory.h>
-int main(void) {
-  xendevicemodel_handle *xd;
-  xenforeignmemory_handle *xfmem;
-
-  xd = xendevicemodel_open(0, 0);
-  xendevicemodel_pin_memory_cacheattr(xd, 0, 0, 0, 0);
-
-  xfmem = xenforeignmemory_open(0, 0);
-  xenforeignmemory_map_resource(xfmem, 0, 0, 0, 0, 0, NULL, 0, 0);
-
-  return 0;
-}
-EOF
-        compile_prog "" "$xen_libs -lxendevicemodel $xen_stable_libs -lxentoolcore"
-      then
-      xen_stable_libs="-lxendevicemodel $xen_stable_libs -lxentoolcore"
-      xen_ctrl_version=41100
-      xen=enabled
-    elif
-        cat > $TMPC <<EOF &&
-#undef XC_WANT_COMPAT_MAP_FOREIGN_API
-#include <xenforeignmemory.h>
-#include <xentoolcore.h>
-int main(void) {
-  xenforeignmemory_handle *xfmem;
-
-  xfmem = xenforeignmemory_open(0, 0);
-  xenforeignmemory_map2(xfmem, 0, 0, 0, 0, 0, 0, 0);
-  xentoolcore_restrict_all(0);
-
-  return 0;
-}
-EOF
-        compile_prog "" "$xen_libs -lxendevicemodel $xen_stable_libs -lxentoolcore"
-      then
-      xen_stable_libs="-lxendevicemodel $xen_stable_libs -lxentoolcore"
-      xen_ctrl_version=41000
-      xen=enabled
-    elif
-        cat > $TMPC <<EOF &&
-#undef XC_WANT_COMPAT_DEVICEMODEL_API
-#define __XEN_TOOLS__
-#include <xendevicemodel.h>
-int main(void) {
-  xendevicemodel_handle *xd;
-
-  xd = xendevicemodel_open(0, 0);
-  xendevicemodel_close(xd);
-
-  return 0;
-}
-EOF
-        compile_prog "" "$xen_libs -lxendevicemodel $xen_stable_libs"
-      then
-      xen_stable_libs="-lxendevicemodel $xen_stable_libs"
-      xen_ctrl_version=40900
-      xen=enabled
-    elif
-        cat > $TMPC <<EOF &&
-/*
- * If we have stable libs the we don't want the libxc compat
- * layers, regardless of what CFLAGS we may have been given.
- *
- * Also, check if xengnttab_grant_copy_segment_t is defined and
- * grant copy operation is implemented.
- */
-#undef XC_WANT_COMPAT_EVTCHN_API
-#undef XC_WANT_COMPAT_GNTTAB_API
-#undef XC_WANT_COMPAT_MAP_FOREIGN_API
-#include <xenctrl.h>
-#include <xenstore.h>
-#include <xenevtchn.h>
-#include <xengnttab.h>
-#include <xenforeignmemory.h>
-#include <stdint.h>
-#include <xen/hvm/hvm_info_table.h>
-#if !defined(HVM_MAX_VCPUS)
-# error HVM_MAX_VCPUS not defined
-#endif
-int main(void) {
-  xc_interface *xc = NULL;
-  xenforeignmemory_handle *xfmem;
-  xenevtchn_handle *xe;
-  xengnttab_handle *xg;
-  xengnttab_grant_copy_segment_t* seg = NULL;
-
-  xs_daemon_open();
-
-  xc = xc_interface_open(0, 0, 0);
-  xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
-  xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
-  xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000);
-  xc_hvm_create_ioreq_server(xc, 0, HVM_IOREQSRV_BUFIOREQ_ATOMIC, NULL);
-
-  xfmem = xenforeignmemory_open(0, 0);
-  xenforeignmemory_map(xfmem, 0, 0, 0, 0, 0);
-
-  xe = xenevtchn_open(0, 0);
-  xenevtchn_fd(xe);
-
-  xg = xengnttab_open(0, 0);
-  xengnttab_grant_copy(xg, 0, seg);
-
-  return 0;
-}
-EOF
-        compile_prog "" "$xen_libs $xen_stable_libs"
-      then
-      xen_ctrl_version=40800
-      xen=enabled
-    elif
-        cat > $TMPC <<EOF &&
-/*
- * If we have stable libs the we don't want the libxc compat
- * layers, regardless of what CFLAGS we may have been given.
- */
-#undef XC_WANT_COMPAT_EVTCHN_API
-#undef XC_WANT_COMPAT_GNTTAB_API
-#undef XC_WANT_COMPAT_MAP_FOREIGN_API
-#include <xenctrl.h>
-#include <xenstore.h>
-#include <xenevtchn.h>
-#include <xengnttab.h>
-#include <xenforeignmemory.h>
-#include <stdint.h>
-#include <xen/hvm/hvm_info_table.h>
-#if !defined(HVM_MAX_VCPUS)
-# error HVM_MAX_VCPUS not defined
-#endif
-int main(void) {
-  xc_interface *xc = NULL;
-  xenforeignmemory_handle *xfmem;
-  xenevtchn_handle *xe;
-  xengnttab_handle *xg;
-
-  xs_daemon_open();
-
-  xc = xc_interface_open(0, 0, 0);
-  xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
-  xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
-  xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000);
-  xc_hvm_create_ioreq_server(xc, 0, HVM_IOREQSRV_BUFIOREQ_ATOMIC, NULL);
-
-  xfmem = xenforeignmemory_open(0, 0);
-  xenforeignmemory_map(xfmem, 0, 0, 0, 0, 0);
-
-  xe = xenevtchn_open(0, 0);
-  xenevtchn_fd(xe);
-
-  xg = xengnttab_open(0, 0);
-  xengnttab_map_grant_ref(xg, 0, 0, 0);
-
-  return 0;
-}
-EOF
-        compile_prog "" "$xen_libs $xen_stable_libs"
-      then
-      xen_ctrl_version=40701
-      xen=enabled
-
-    # Xen 4.6
-    elif
-        cat > $TMPC <<EOF &&
-#include <xenctrl.h>
-#include <xenstore.h>
-#include <stdint.h>
-#include <xen/hvm/hvm_info_table.h>
-#if !defined(HVM_MAX_VCPUS)
-# error HVM_MAX_VCPUS not defined
-#endif
-int main(void) {
-  xc_interface *xc;
-  xs_daemon_open();
-  xc = xc_interface_open(0, 0, 0);
-  xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
-  xc_gnttab_open(NULL, 0);
-  xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
-  xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000);
-  xc_hvm_create_ioreq_server(xc, 0, HVM_IOREQSRV_BUFIOREQ_ATOMIC, NULL);
-  xc_reserved_device_memory_map(xc, 0, 0, 0, 0, NULL, 0);
-  return 0;
-}
-EOF
-        compile_prog "" "$xen_libs"
-      then
-      xen_ctrl_version=40600
-      xen=enabled
-
-    # Xen 4.5
-    elif
-        cat > $TMPC <<EOF &&
-#include <xenctrl.h>
-#include <xenstore.h>
-#include <stdint.h>
-#include <xen/hvm/hvm_info_table.h>
-#if !defined(HVM_MAX_VCPUS)
-# error HVM_MAX_VCPUS not defined
-#endif
-int main(void) {
-  xc_interface *xc;
-  xs_daemon_open();
-  xc = xc_interface_open(0, 0, 0);
-  xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
-  xc_gnttab_open(NULL, 0);
-  xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
-  xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000);
-  xc_hvm_create_ioreq_server(xc, 0, 0, NULL);
-  return 0;
-}
-EOF
-        compile_prog "" "$xen_libs"
-      then
-      xen_ctrl_version=40500
-      xen=enabled
-
-    elif
-        cat > $TMPC <<EOF &&
-#include <xenctrl.h>
-#include <xenstore.h>
-#include <stdint.h>
-#include <xen/hvm/hvm_info_table.h>
-#if !defined(HVM_MAX_VCPUS)
-# error HVM_MAX_VCPUS not defined
-#endif
-int main(void) {
-  xc_interface *xc;
-  xs_daemon_open();
-  xc = xc_interface_open(0, 0, 0);
-  xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
-  xc_gnttab_open(NULL, 0);
-  xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
-  xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000);
-  return 0;
-}
-EOF
-        compile_prog "" "$xen_libs"
-      then
-      xen_ctrl_version=40200
-      xen=enabled
-
-    else
-      if test "$xen" = "enabled" ; then
-        feature_not_found "xen (unsupported version)" \
-                          "Install a supported xen (xen 4.2 or newer)"
-      fi
-      xen=disabled
-    fi
-
-    if test "$xen" = enabled; then
-      if test $xen_ctrl_version -ge 40701  ; then
-        xen_libs="$xen_libs $xen_stable_libs "
-      fi
-    fi
-  fi
-fi
-
 ##########################################
 # glib support probe
 
@@ -2554,12 +2240,6 @@ if test "$modules" = "yes"; then
 fi
 echo "CONFIG_TLS_PRIORITY=\"$tls_priority\"" >> $config_host_mak
 
-if test "$xen" = "enabled" ; then
-  echo "CONFIG_XEN_BACKEND=y" >> $config_host_mak
-  echo "CONFIG_XEN_CTRL_INTERFACE_VERSION=$xen_ctrl_version" >> $config_host_mak
-  echo "XEN_CFLAGS=$xen_cflags" >> $config_host_mak
-  echo "XEN_LIBS=$xen_libs" >> $config_host_mak
-fi
 if test "$vhost_scsi" = "yes" ; then
   echo "CONFIG_VHOST_SCSI=y" >> $config_host_mak
 fi
@@ -2838,7 +2518,7 @@ if test "$skip_meson" = no; then
         -Dwerror=$(if test "$werror" = yes; then echo true; else echo false; fi) \
         -Db_pie=$(if test "$pie" = yes; then echo true; else echo false; fi) \
         -Db_coverage=$(if test "$gcov" = yes; then echo true; else echo false; fi) \
-        -Db_lto=$lto -Dcfi=$cfi -Dtcg=$tcg -Dxen=$xen \
+        -Db_lto=$lto -Dcfi=$cfi -Dtcg=$tcg \
         -Dcapstone=$capstone -Dfdt=$fdt -Dslirp=$slirp \
         $(test -n "${LIB_FUZZING_ENGINE+xxx}" && echo "-Dfuzzing_engine=$LIB_FUZZING_ENGINE") \
         $(if test "$default_feature" = no; then echo "-Dauto_features=disabled"; fi) \
diff --git a/meson.build b/meson.build
index 3c47d82180..7cbb771393 100644
--- a/meson.build
+++ b/meson.build
@@ -348,12 +348,6 @@ accelerators = []
 if get_option('kvm').allowed() and targetos == 'linux'
   accelerators += 'CONFIG_KVM'
 endif
-if get_option('xen').allowed() and 'CONFIG_XEN_BACKEND' in config_host
-  accelerators += 'CONFIG_XEN'
-  have_xen_pci_passthrough = get_option('xen_pci_passthrough').allowed() and targetos == 'linux'
-else
-  have_xen_pci_passthrough = false
-endif
 if get_option('whpx').allowed() and targetos == 'windows'
   if get_option('whpx').enabled() and host_machine.cpu() != 'x86_64'
     error('WHPX requires 64-bit host')
@@ -425,13 +419,6 @@ endif
 if 'CONFIG_WHPX' not in accelerators and get_option('whpx').enabled()
   error('WHPX not available on this platform')
 endif
-if not have_xen_pci_passthrough and get_option('xen_pci_passthrough').enabled()
-  if 'CONFIG_XEN' in accelerators
-    error('Xen PCI passthrough not available on this platform')
-  else
-    error('Xen PCI passthrough requested but Xen not enabled')
-  endif
-endif
 
 ################
 # Dependencies #
@@ -1255,10 +1242,86 @@ if not get_option('rdma').auto() or have_system
 endif
 
 xen = not_found
-if 'CONFIG_XEN_BACKEND' in config_host
-  xen = declare_dependency(compile_args: config_host['XEN_CFLAGS'].split(),
-                           link_args: config_host['XEN_LIBS'].split())
+if get_option('xen').enabled() or (get_option('xen').auto() and have_system)
+  xencontrol = dependency('xencontrol', required: false,
+                          method: 'pkg-config', kwargs: static_kwargs)
+  if xencontrol.found()
+    xen_pc = declare_dependency(version: xencontrol.version(),
+      dependencies: [
+        xencontrol,
+        # disabler: true makes xen_pc.found() return false if any is not found
+        dependency('xenstore', required: false,
+                   method: 'pkg-config', kwargs: static_kwargs,
+                   disabler: true),
+        dependency('xenforeignmemory', required: false,
+                   method: 'pkg-config', kwargs: static_kwargs,
+                   disabler: true),
+        dependency('xengnttab', required: false,
+                   method: 'pkg-config', kwargs: static_kwargs,
+                   disabler: true),
+        dependency('xenevtchn', required: false,
+                   method: 'pkg-config', kwargs: static_kwargs,
+                   disabler: true),
+        dependency('xendevicemodel', required: false,
+                   method: 'pkg-config', kwargs: static_kwargs,
+                   disabler: true),
+        # optional, no "disabler: true"
+        dependency('xentoolcore', required: false,
+                   method: 'pkg-config', kwargs: static_kwargs)])
+    if xen_pc.found()
+      xen = xen_pc
+    endif
+  endif
+  if not xen.found()
+    xen_tests = [ '4.11.0', '4.10.0', '4.9.0', '4.8.0', '4.7.1', '4.6.0', '4.5.0', '4.2.0' ]
+    xen_libs = {
+      '4.11.0': [ 'xenstore', 'xenctrl', 'xendevicemodel', 'xenforeignmemory', 'xengnttab', 'xenevtchn', 'xentoolcore' ],
+      '4.10.0': [ 'xenstore', 'xenctrl', 'xendevicemodel', 'xenforeignmemory', 'xengnttab', 'xenevtchn', 'xentoolcore' ],
+      '4.9.0': [ 'xenstore', 'xenctrl', 'xendevicemodel', 'xenforeignmemory', 'xengnttab', 'xenevtchn' ],
+      '4.8.0': [ 'xenstore', 'xenctrl', 'xenforeignmemory', 'xengnttab', 'xenevtchn' ],
+      '4.7.1': [ 'xenstore', 'xenctrl', 'xenforeignmemory', 'xengnttab', 'xenevtchn' ],
+      '4.6.0': [ 'xenstore', 'xenctrl' ],
+      '4.5.0': [ 'xenstore', 'xenctrl' ],
+      '4.2.0': [ 'xenstore', 'xenctrl' ],
+    }
+    xen_deps = {}
+    foreach ver: xen_tests
+      # cache the various library tests to avoid polluting the logs
+      xen_test_deps = []
+      foreach l: xen_libs[ver]
+        if l not in xen_deps
+          xen_deps += { l: cc.find_library(l, required: false) }
+        endif
+        xen_test_deps += xen_deps[l]
+      endforeach
+
+      # Use -D to pick just one of the test programs in scripts/xen-detect.c
+      xen_version = ver.split('.')
+      xen_ctrl_version = xen_version[0] + \
+        ('0' + xen_version[1]).substring(-2) + \
+        ('0' + xen_version[2]).substring(-2)
+      if cc.links(files('scripts/xen-detect.c'),
+                  args: '-DCONFIG_XEN_CTRL_INTERFACE_VERSION=' + xen_ctrl_version,
+                  dependencies: xen_test_deps)
+        xen = declare_dependency(version: ver, dependencies: xen_test_deps)
+        break
+      endif
+    endforeach
+  endif
+  if xen.found()
+    accelerators += 'CONFIG_XEN'
+  elif get_option('xen').enabled()
+    error('could not compile and link Xen test program')
+  endif
 endif
+have_xen_pci_passthrough = get_option('xen_pci_passthrough') \
+  .require(xen.found(),
+           error_message: 'Xen PCI passthrough requested but Xen not enabled') \
+  .require(targetos == 'linux',
+           error_message: 'Xen PCI passthrough not available on this platform') \
+  .allowed()
+
+
 cacard = not_found
 if not get_option('smartcard').auto() or have_system
   cacard = dependency('libcacard', required: get_option('smartcard'),
@@ -1632,7 +1695,16 @@ config_host_data.set('CONFIG_X11', x11.found())
 config_host_data.set('CONFIG_DBUS_DISPLAY', dbus_display)
 config_host_data.set('CONFIG_CFI', get_option('cfi'))
 config_host_data.set('CONFIG_SELINUX', selinux.found())
-config_host_data.set('CONFIG_XEN_PCI_PASSTHROUGH', have_xen_pci_passthrough)
+config_host_data.set('CONFIG_XEN_BACKEND', xen.found())
+if xen.found()
+  # protect from xen.version() having less than three components
+  xen_version = xen.version().split('.') + ['0', '0']
+  xen_ctrl_version = xen_version[0] + \
+    ('0' + xen_version[1]).substring(-2) + \
+    ('0' + xen_version[2]).substring(-2)
+  config_host_data.set('CONFIG_XEN_CTRL_INTERFACE_VERSION', xen_ctrl_version)
+  config_host_data.set('CONFIG_XEN_PCI_PASSTHROUGH', have_xen_pci_passthrough)
+endif
 config_host_data.set('QEMU_VERSION', '"@0@"'.format(meson.project_version()))
 config_host_data.set('QEMU_VERSION_MAJOR', meson.project_version().split('.')[0])
 config_host_data.set('QEMU_VERSION_MINOR', meson.project_version().split('.')[1])
@@ -2345,7 +2417,7 @@ config_all += config_all_devices
 config_all += config_host
 config_all += config_all_disas
 config_all += {
-  'CONFIG_XEN': config_host.has_key('CONFIG_XEN_BACKEND'),
+  'CONFIG_XEN': xen.found(),
   'CONFIG_SOFTMMU': have_system,
   'CONFIG_USER_ONLY': have_user,
   'CONFIG_ALL': true,
@@ -3676,9 +3748,9 @@ if have_system
   summary_info += {'HVF support':       config_all.has_key('CONFIG_HVF')}
   summary_info += {'WHPX support':      config_all.has_key('CONFIG_WHPX')}
   summary_info += {'NVMM support':      config_all.has_key('CONFIG_NVMM')}
-  summary_info += {'Xen support':       config_host.has_key('CONFIG_XEN_BACKEND')}
-  if config_host.has_key('CONFIG_XEN_BACKEND')
-    summary_info += {'xen ctrl version':  config_host['CONFIG_XEN_CTRL_INTERFACE_VERSION']}
+  summary_info += {'Xen support':       xen.found()}
+  if xen.found()
+    summary_info += {'xen ctrl version':  xen.version()}
   endif
 endif
 summary_info += {'TCG support':       config_all.has_key('CONFIG_TCG')}
diff --git a/scripts/xen-detect.c b/scripts/xen-detect.c
new file mode 100644
index 0000000000..85e8206490
--- /dev/null
+++ b/scripts/xen-detect.c
@@ -0,0 +1,203 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+
+/* Test programs for various Xen versions that QEMU supports.  */
+#if CONFIG_XEN_CTRL_INTERFACE_VERSION == 41100
+  #undef XC_WANT_COMPAT_DEVICEMODEL_API
+  #define __XEN_TOOLS__
+  #include <xendevicemodel.h>
+  #include <xenforeignmemory.h>
+  int main(void) {
+    xendevicemodel_handle *xd;
+    xenforeignmemory_handle *xfmem;
+
+    xd = xendevicemodel_open(0, 0);
+    xendevicemodel_pin_memory_cacheattr(xd, 0, 0, 0, 0);
+
+    xfmem = xenforeignmemory_open(0, 0);
+    xenforeignmemory_map_resource(xfmem, 0, 0, 0, 0, 0, NULL, 0, 0);
+
+    return 0;
+  }
+
+#elif CONFIG_XEN_CTRL_INTERFACE_VERSION == 41000
+  #undef XC_WANT_COMPAT_MAP_FOREIGN_API
+  #include <xenforeignmemory.h>
+  #include <xentoolcore.h>
+  int main(void) {
+    xenforeignmemory_handle *xfmem;
+
+    xfmem = xenforeignmemory_open(0, 0);
+    xenforeignmemory_map2(xfmem, 0, 0, 0, 0, 0, 0, 0);
+    xentoolcore_restrict_all(0);
+
+    return 0;
+  }
+
+#elif CONFIG_XEN_CTRL_INTERFACE_VERSION == 40900
+  #undef XC_WANT_COMPAT_DEVICEMODEL_API
+  #define __XEN_TOOLS__
+  #include <xendevicemodel.h>
+  int main(void) {
+    xendevicemodel_handle *xd;
+
+    xd = xendevicemodel_open(0, 0);
+    xendevicemodel_close(xd);
+
+    return 0;
+  }
+
+#elif CONFIG_XEN_CTRL_INTERFACE_VERSION == 40800
+  /*
+   * If we have stable libs the we don't want the libxc compat
+   * layers, regardless of what CFLAGS we may have been given.
+   *
+   * Also, check if xengnttab_grant_copy_segment_t is defined and
+   * grant copy operation is implemented.
+   */
+  #undef XC_WANT_COMPAT_EVTCHN_API
+  #undef XC_WANT_COMPAT_GNTTAB_API
+  #undef XC_WANT_COMPAT_MAP_FOREIGN_API
+  #include <xenctrl.h>
+  #include <xenstore.h>
+  #include <xenevtchn.h>
+  #include <xengnttab.h>
+  #include <xenforeignmemory.h>
+  #include <stdint.h>
+  #include <xen/hvm/hvm_info_table.h>
+  #if !defined(HVM_MAX_VCPUS)
+  # error HVM_MAX_VCPUS not defined
+  #endif
+  int main(void) {
+    xc_interface *xc = NULL;
+    xenforeignmemory_handle *xfmem;
+    xenevtchn_handle *xe;
+    xengnttab_handle *xg;
+    xengnttab_grant_copy_segment_t* seg = NULL;
+
+    xs_daemon_open();
+
+    xc = xc_interface_open(0, 0, 0);
+    xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
+    xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
+    xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000);
+    xc_hvm_create_ioreq_server(xc, 0, HVM_IOREQSRV_BUFIOREQ_ATOMIC, NULL);
+
+    xfmem = xenforeignmemory_open(0, 0);
+    xenforeignmemory_map(xfmem, 0, 0, 0, 0, 0);
+
+    xe = xenevtchn_open(0, 0);
+    xenevtchn_fd(xe);
+
+    xg = xengnttab_open(0, 0);
+    xengnttab_grant_copy(xg, 0, seg);
+
+    return 0;
+  }
+
+#elif CONFIG_XEN_CTRL_INTERFACE_VERSION == 40701
+  /*
+   * If we have stable libs the we don't want the libxc compat
+   * layers, regardless of what CFLAGS we may have been given.
+   */
+  #undef XC_WANT_COMPAT_EVTCHN_API
+  #undef XC_WANT_COMPAT_GNTTAB_API
+  #undef XC_WANT_COMPAT_MAP_FOREIGN_API
+  #include <xenctrl.h>
+  #include <xenstore.h>
+  #include <xenevtchn.h>
+  #include <xengnttab.h>
+  #include <xenforeignmemory.h>
+  #include <stdint.h>
+  #include <xen/hvm/hvm_info_table.h>
+  #if !defined(HVM_MAX_VCPUS)
+  # error HVM_MAX_VCPUS not defined
+  #endif
+  int main(void) {
+    xc_interface *xc = NULL;
+    xenforeignmemory_handle *xfmem;
+    xenevtchn_handle *xe;
+    xengnttab_handle *xg;
+
+    xs_daemon_open();
+
+    xc = xc_interface_open(0, 0, 0);
+    xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
+    xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
+    xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000);
+    xc_hvm_create_ioreq_server(xc, 0, HVM_IOREQSRV_BUFIOREQ_ATOMIC, NULL);
+
+    xfmem = xenforeignmemory_open(0, 0);
+    xenforeignmemory_map(xfmem, 0, 0, 0, 0, 0);
+
+    xe = xenevtchn_open(0, 0);
+    xenevtchn_fd(xe);
+
+    xg = xengnttab_open(0, 0);
+    xengnttab_map_grant_ref(xg, 0, 0, 0);
+
+    return 0;
+  }
+
+#elif CONFIG_XEN_CTRL_INTERFACE_VERSION == 40600
+  #include <xenctrl.h>
+  #include <xenstore.h>
+  #include <stdint.h>
+  #include <xen/hvm/hvm_info_table.h>
+  #if !defined(HVM_MAX_VCPUS)
+  # error HVM_MAX_VCPUS not defined
+  #endif
+  int main(void) {
+    xc_interface *xc;
+    xs_daemon_open();
+    xc = xc_interface_open(0, 0, 0);
+    xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
+    xc_gnttab_open(NULL, 0);
+    xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
+    xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000);
+    xc_hvm_create_ioreq_server(xc, 0, HVM_IOREQSRV_BUFIOREQ_ATOMIC, NULL);
+    xc_reserved_device_memory_map(xc, 0, 0, 0, 0, NULL, 0);
+    return 0;
+  }
+
+#elif CONFIG_XEN_CTRL_INTERFACE_VERSION == 40500
+  #include <xenctrl.h>
+  #include <xenstore.h>
+  #include <stdint.h>
+  #include <xen/hvm/hvm_info_table.h>
+  #if !defined(HVM_MAX_VCPUS)
+  # error HVM_MAX_VCPUS not defined
+  #endif
+  int main(void) {
+    xc_interface *xc;
+    xs_daemon_open();
+    xc = xc_interface_open(0, 0, 0);
+    xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
+    xc_gnttab_open(NULL, 0);
+    xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
+    xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000);
+    xc_hvm_create_ioreq_server(xc, 0, 0, NULL);
+    return 0;
+  }
+
+#elif CONFIG_XEN_CTRL_INTERFACE_VERSION == 40200
+  #include <xenctrl.h>
+  #include <xenstore.h>
+  #include <stdint.h>
+  #include <xen/hvm/hvm_info_table.h>
+  #if !defined(HVM_MAX_VCPUS)
+  # error HVM_MAX_VCPUS not defined
+  #endif
+  int main(void) {
+    xc_interface *xc;
+    xs_daemon_open();
+    xc = xc_interface_open(0, 0, 0);
+    xc_hvm_set_mem_type(0, 0, HVMMEM_ram_ro, 0, 0);
+    xc_gnttab_open(NULL, 0);
+    xc_domain_add_to_physmap(0, 0, XENMAPSPACE_gmfn, 0, 0);
+    xc_hvm_inject_msi(xc, 0, 0xf0000000, 0x00000000);
+    return 0;
+  }
+
+#else
+#error invalid CONFIG_XEN_CTRL_INTERFACE_VERSION
+#endif
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 74+ messages in thread

* [PATCH 15/34] meson-buildoptions: add support for string options
  2022-04-20 15:33 [PATCH 00/34] Misc meson conversions for QEMU 7.1 Paolo Bonzini
                   ` (13 preceding siblings ...)
  2022-04-20 15:33 ` [PATCH 14/34] meson, configure: move Xen detection " Paolo Bonzini
@ 2022-04-20 15:33 ` Paolo Bonzini
  2022-04-20 18:14   ` Marc-André Lureau
  2022-04-20 15:33 ` [PATCH 16/34] configure, meson: move iasl detection to meson Paolo Bonzini
                   ` (18 subsequent siblings)
  33 siblings, 1 reply; 74+ messages in thread
From: Paolo Bonzini @ 2022-04-20 15:33 UTC (permalink / raw)
  To: qemu-devel

Allow using the buildoptions.json file for more options, namely anything
that is not a boolean or multiple-choice.

The mapping between configure and meson is messy for string options,
so allow configure to use to something other than the name in
meson_options.txt.  This will come in handy anyway for builtin
Meson options such as b_lto or b_coverage.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 meson_options.txt             |  2 +-
 scripts/meson-buildoptions.py | 65 ++++++++++++++++++++++++++++++-----
 scripts/meson-buildoptions.sh |  6 ++--
 3 files changed, 60 insertions(+), 13 deletions(-)

diff --git a/meson_options.txt b/meson_options.txt
index cf18663833..415fcc448e 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -11,7 +11,7 @@ option('qemu_firmwarepath', type : 'string', value : '',
 option('smbd', type : 'string', value : '',
        description: 'Path to smbd for slirp networking')
 option('sphinx_build', type : 'string', value : '',
-       description: 'Use specified sphinx-build [$sphinx_build] for building document (default to be empty)')
+       description: 'Use specified sphinx-build for building document')
 option('iasl', type : 'string', value : '',
        description: 'Path to ACPI disassembler')
 option('default_devices', type : 'boolean', value : true,
diff --git a/scripts/meson-buildoptions.py b/scripts/meson-buildoptions.py
index 693be7b966..4af8d6e732 100755
--- a/scripts/meson-buildoptions.py
+++ b/scripts/meson-buildoptions.py
@@ -38,6 +38,11 @@
     "trace_file",
 }
 
+OPTION_NAMES = {
+    "malloc": "enable-malloc",
+    "trace_backends": "enable-trace-backends",
+}
+
 BUILTIN_OPTIONS = {
     "strip",
 }
@@ -75,7 +80,7 @@ def help_line(left, opt, indent, long):
     right = f'{opt["description"]}'
     if long:
         value = value_to_help(opt["value"])
-        if value != "auto":
+        if value != "auto" and value != "":
             right += f" [{value}]"
     if "choices" in opt and long:
         choices = "/".join(sorted(opt["choices"]))
@@ -96,6 +101,18 @@ def allow_arg(opt):
     return not (set(opt["choices"]) <= {"auto", "disabled", "enabled"})
 
 
+# Return whether the option (a dictionary) can be used without
+# arguments.  Booleans can only be used without arguments;
+# combos require an argument if they accept neither "enabled"
+# nor "disabled"
+def require_arg(opt):
+    if opt["type"] == "boolean":
+        return False
+    if opt["type"] != "combo":
+        return True
+    return not ({"enabled", "disabled"}.intersection(opt["choices"]))
+
+
 def filter_options(json):
     if ":" in json["name"]:
         return False
@@ -110,20 +127,48 @@ def load_options(json):
     return sorted(json, key=lambda x: x["name"])
 
 
+def cli_option(opt):
+    name = opt["name"]
+    if name in OPTION_NAMES:
+        return OPTION_NAMES[name]
+    return name.replace("_", "-")
+
+
+def cli_help_key(opt):
+    key = cli_option(opt)
+    if require_arg(opt):
+        return key
+    if opt["type"] == "boolean" and opt["value"]:
+        return f"disable-{key}"
+    return f"enable-{key}"
+
+
+def cli_metavar(opt):
+    if opt["type"] == "string":
+        return "VALUE"
+    if opt["type"] == "array":
+        return "CHOICES"
+    return "CHOICE"
+
+
 def print_help(options):
     print("meson_options_help() {")
-    for opt in options:
-        key = opt["name"].replace("_", "-")
+    for opt in sorted(options, key=cli_help_key):
+        key = cli_help_key(opt)
         # The first section includes options that have an arguments,
         # and booleans (i.e., only one of enable/disable makes sense)
-        if opt["type"] == "boolean":
-            left = f"--disable-{key}" if opt["value"] else f"--enable-{key}"
+        if require_arg(opt):
+            metavar = cli_metavar(opt)
+            left = f"--{key}={metavar}"
+            help_line(left, opt, 27, True)
+        elif opt["type"] == "boolean":
+            left = f"--{key}"
             help_line(left, opt, 27, False)
         elif allow_arg(opt):
             if opt["type"] == "combo" and "enabled" in opt["choices"]:
-                left = f"--enable-{key}[=CHOICE]"
+                left = f"--{key}[=CHOICE]"
             else:
-                left = f"--enable-{key}=CHOICE"
+                left = f"--{key}=CHOICE"
             help_line(left, opt, 27, True)
 
     sh_print()
@@ -142,9 +187,11 @@ def print_parse(options):
     print("_meson_option_parse() {")
     print("  case $1 in")
     for opt in options:
-        key = opt["name"].replace("_", "-")
+        key = cli_option(opt)
         name = opt["name"]
-        if opt["type"] == "boolean":
+        if require_arg(opt):
+            print(f'    --{key}=*) quote_sh "-D{name}=$2" ;;')
+        elif opt["type"] == "boolean":
             print(f'    --enable-{key}) printf "%s" -D{name}=true ;;')
             print(f'    --disable-{key}) printf "%s" -D{name}=false ;;')
         else:
diff --git a/scripts/meson-buildoptions.sh b/scripts/meson-buildoptions.sh
index a269534394..5a06b7915c 100644
--- a/scripts/meson-buildoptions.sh
+++ b/scripts/meson-buildoptions.sh
@@ -1,5 +1,7 @@
 # This file is generated by meson-buildoptions.py, do not edit!
 meson_options_help() {
+  printf "%s\n" '  --disable-coroutine-pool coroutine freelist (better performance)'
+  printf "%s\n" '  --disable-install-blobs  install provided firmware blobs'
   printf "%s\n" '  --enable-block-drv-whitelist-in-tools'
   printf "%s\n" '                           use block whitelist also in tools instead of only'
   printf "%s\n" '                           QEMU'
@@ -8,7 +10,6 @@ meson_options_help() {
   printf "%s\n" '                           (choices: auto/disabled/enabled/internal/system)'
   printf "%s\n" '  --enable-cfi             Control-Flow Integrity (CFI)'
   printf "%s\n" '  --enable-cfi-debug       Verbose errors in case of CFI violation'
-  printf "%s\n" '  --disable-coroutine-pool coroutine freelist (better performance)'
   printf "%s\n" '  --enable-debug-mutex     mutex debugging support'
   printf "%s\n" '  --enable-debug-stack-usage'
   printf "%s\n" '                           measure coroutine stack usage'
@@ -16,7 +17,6 @@ meson_options_help() {
   printf "%s\n" '                           (choices: auto/disabled/enabled/internal/system)'
   printf "%s\n" '  --enable-fuzzing         build fuzzing targets'
   printf "%s\n" '  --enable-gprof           QEMU profiling with gprof'
-  printf "%s\n" '  --disable-install-blobs  install provided firmware blobs'
   printf "%s\n" '  --enable-malloc=CHOICE   choose memory allocator to use [system] (choices:'
   printf "%s\n" '                           jemalloc/system/tcmalloc)'
   printf "%s\n" '  --enable-module-upgrades try to load modules from alternate paths for'
@@ -29,7 +29,7 @@ meson_options_help() {
   printf "%s\n" '                           (choices: auto/disabled/enabled/internal/system)'
   printf "%s\n" '  --enable-strip           Strip targets on install'
   printf "%s\n" '  --enable-tcg-interpreter TCG with bytecode interpreter (slow)'
-  printf "%s\n" '  --enable-trace-backends=CHOICE'
+  printf "%s\n" '  --enable-trace-backends=CHOICES'
   printf "%s\n" '                           Set available tracing backends [log] (choices:'
   printf "%s\n" '                           dtrace/ftrace/log/nop/simple/syslog/ust)'
   printf "%s\n" ''
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 74+ messages in thread

* [PATCH 16/34] configure, meson: move iasl detection to meson
  2022-04-20 15:33 [PATCH 00/34] Misc meson conversions for QEMU 7.1 Paolo Bonzini
                   ` (14 preceding siblings ...)
  2022-04-20 15:33 ` [PATCH 15/34] meson-buildoptions: add support for string options Paolo Bonzini
@ 2022-04-20 15:33 ` Paolo Bonzini
  2022-04-20 18:17   ` Marc-André Lureau
  2022-04-20 15:33 ` [PATCH 17/34] configure: move Windows flags " Paolo Bonzini
                   ` (17 subsequent siblings)
  33 siblings, 1 reply; 74+ messages in thread
From: Paolo Bonzini @ 2022-04-20 15:33 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 configure   |  2 +-
 meson.build | 16 +++++++++-------
 2 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/configure b/configure
index 11d3cc19ca..772714d386 100755
--- a/configure
+++ b/configure
@@ -2507,7 +2507,7 @@ if test "$skip_meson" = no; then
         -Daudio_drv_list=$audio_drv_list \
         -Ddefault_devices=$default_devices \
         -Ddocdir="$docdir" \
-        -Diasl="$($iasl -h >/dev/null 2>&1 && printf %s "$iasl")" \
+        -Diasl="$iasl" \
         -Dqemu_firmwarepath="$firmwarepath" \
         -Dqemu_suffix="$qemu_suffix" \
         -Dsmbd="$smbd" \
diff --git a/meson.build b/meson.build
index 7cbb771393..d255facbfd 100644
--- a/meson.build
+++ b/meson.build
@@ -167,6 +167,12 @@ if 'dtrace' in get_option('trace_backends')
   endif
 endif
 
+if get_option('iasl') == ''
+  iasl = find_program('iasl', required: false)
+else
+  iasl = find_program(get_option('iasl'), required: true)
+endif
+
 ##################
 # Compiler flags #
 ##################
@@ -1582,8 +1588,8 @@ foreach k : get_option('trace_backends')
   config_host_data.set('CONFIG_TRACE_' + k.to_upper(), true)
 endforeach
 config_host_data.set_quoted('CONFIG_TRACE_FILE', get_option('trace_file'))
-if get_option('iasl') != ''
-  config_host_data.set_quoted('CONFIG_IASL', get_option('iasl'))
+if iasl.found()
+  config_host_data.set_quoted('CONFIG_IASL', iasl.full_path())
 endif
 config_host_data.set_quoted('CONFIG_BINDIR', get_option('prefix') / get_option('bindir'))
 config_host_data.set_quoted('CONFIG_PREFIX', get_option('prefix'))
@@ -3617,11 +3623,7 @@ summary_info += {'sphinx-build':      sphinx_build}
 if config_host.has_key('HAVE_GDB_BIN')
   summary_info += {'gdb':             config_host['HAVE_GDB_BIN']}
 endif
-if get_option('iasl') != ''
-  summary_info += {'iasl':            get_option('iasl')}
-else
-  summary_info += {'iasl':            false}
-endif
+summary_info += {'iasl':              iasl}
 summary_info += {'genisoimage':       config_host['GENISOIMAGE']}
 if targetos == 'windows' and have_ga
   summary_info += {'wixl':            wixl}
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 74+ messages in thread

* [PATCH 17/34] configure: move Windows flags detection to meson
  2022-04-20 15:33 [PATCH 00/34] Misc meson conversions for QEMU 7.1 Paolo Bonzini
                   ` (15 preceding siblings ...)
  2022-04-20 15:33 ` [PATCH 16/34] configure, meson: move iasl detection to meson Paolo Bonzini
@ 2022-04-20 15:33 ` Paolo Bonzini
  2022-04-20 18:20   ` Marc-André Lureau
  2022-04-20 15:33 ` [PATCH 18/34] configure: switch string options to automatic parsing Paolo Bonzini
                   ` (16 subsequent siblings)
  33 siblings, 1 reply; 74+ messages in thread
From: Paolo Bonzini @ 2022-04-20 15:33 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 configure   | 20 --------------------
 meson.build |  8 ++++++++
 2 files changed, 8 insertions(+), 20 deletions(-)

diff --git a/configure b/configure
index 772714d386..87ceb33917 100755
--- a/configure
+++ b/configure
@@ -224,10 +224,6 @@ glob() {
     eval test -z '"${1#'"$2"'}"'
 }
 
-ld_has() {
-    $ld --help 2>/dev/null | grep ".$1" >/dev/null 2>&1
-}
-
 if printf %s\\n "$source_path" "$PWD" | grep -q "[[:space:]:]";
 then
   error_exit "main directory cannot contain spaces nor colons"
@@ -2088,22 +2084,6 @@ if test "$solaris" = "no" && test "$tsan" = "no"; then
     fi
 fi
 
-# Use ASLR, no-SEH and DEP if available
-if test "$mingw32" = "yes" ; then
-    flags="--no-seh --nxcompat"
-
-    # Disable ASLR for debug builds to allow debugging with gdb
-    if test "$debug" = "no" ; then
-        flags="--dynamicbase $flags"
-    fi
-
-    for flag in $flags; do
-        if ld_has $flag ; then
-            QEMU_LDFLAGS="-Wl,$flag $QEMU_LDFLAGS"
-        fi
-    done
-fi
-
 # Guest agent Windows MSI package
 
 if test "$QEMU_GA_MANUFACTURER" = ""; then
diff --git a/meson.build b/meson.build
index d255facbfd..ffca473fbc 100644
--- a/meson.build
+++ b/meson.build
@@ -182,6 +182,14 @@ qemu_cxxflags = config_host['QEMU_CXXFLAGS'].split()
 qemu_objcflags = config_host['QEMU_OBJCFLAGS'].split()
 qemu_ldflags = config_host['QEMU_LDFLAGS'].split()
 
+if targetos == 'windows'
+  qemu_ldflags += cc.get_supported_link_arguments('-Wl,--no-seh', '-Wl,--nxcompat')
+  # Disable ASLR for debug builds to allow debugging with gdb
+  if get_option('optimization') == 0
+    qemu_ldflags += cc.get_supported_link_arguments('-Wl,--dynamicbase')
+  endif
+endif
+
 if get_option('gprof')
   qemu_cflags += ['-p']
   qemu_cxxflags += ['-p']
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 74+ messages in thread

* [PATCH 18/34] configure: switch string options to automatic parsing
  2022-04-20 15:33 [PATCH 00/34] Misc meson conversions for QEMU 7.1 Paolo Bonzini
                   ` (16 preceding siblings ...)
  2022-04-20 15:33 ` [PATCH 17/34] configure: move Windows flags " Paolo Bonzini
@ 2022-04-20 15:33 ` Paolo Bonzini
  2022-04-20 18:23   ` Marc-André Lureau
  2022-04-20 15:33 ` [PATCH 19/34] meson, configure: move --tls-priority to meson Paolo Bonzini
                   ` (15 subsequent siblings)
  33 siblings, 1 reply; 74+ messages in thread
From: Paolo Bonzini @ 2022-04-20 15:33 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 configure                     | 24 +-----------------------
 scripts/meson-buildoptions.py |  5 +----
 scripts/meson-buildoptions.sh |  9 +++++++++
 3 files changed, 11 insertions(+), 27 deletions(-)

diff --git a/configure b/configure
index 87ceb33917..8f34f2a061 100755
--- a/configure
+++ b/configure
@@ -231,12 +231,10 @@ fi
 
 # default parameters
 cpu=""
-iasl="iasl"
 interp_prefix="/usr/gnemul/qemu-%M"
 static="no"
 cross_compile="no"
 cross_prefix=""
-audio_drv_list="default"
 block_drv_rw_whitelist=""
 block_drv_ro_whitelist=""
 host_cc="cc"
@@ -312,7 +310,6 @@ linux_user=""
 bsd_user=""
 pkgversion=""
 pie=""
-trace_file="trace"
 coroutine=""
 tls_priority="NORMAL"
 plugins="$default_feature"
@@ -713,8 +710,6 @@ for opt do
   ;;
   --cxx=*)
   ;;
-  --iasl=*) iasl="$optarg"
-  ;;
   --objcc=*) objcc="$optarg"
   ;;
   --make=*) make="$optarg"
@@ -723,8 +718,6 @@ for opt do
   ;;
   --python=*) python="$optarg" ; explicit_python=yes
   ;;
-  --sphinx-build=*) sphinx_build="$optarg"
-  ;;
   --skip-meson) skip_meson=yes
   ;;
   --meson=*) meson="$optarg"
@@ -765,8 +758,6 @@ for opt do
                        error_exit "Can't mix --target-list-exclude with --target-list"
                    fi
   ;;
-  --with-trace-file=*) trace_file="$optarg"
-  ;;
   --with-default-devices) default_devices="true"
   ;;
   --without-default-devices) default_devices="false"
@@ -825,8 +816,6 @@ for opt do
     # configure to be used by RPM and similar macros that set
     # lots of directory switches by default.
   ;;
-  --audio-drv-list=*) audio_drv_list="$optarg"
-  ;;
   --block-drv-rw-whitelist=*|--block-drv-whitelist=*) block_drv_rw_whitelist=$(echo "$optarg" | sed -e 's/,/ /g')
   ;;
   --block-drv-ro-whitelist=*) block_drv_ro_whitelist=$(echo "$optarg" | sed -e 's/,/ /g')
@@ -1000,12 +989,7 @@ for opt do
   --enable-jemalloc) meson_option_parse --enable-malloc=jemalloc jemalloc
   ;;
   # everything else has the same name in configure and meson
-  --enable-* | --disable-*) meson_option_parse "$opt" "$optarg"
-  ;;
-  *)
-      echo "ERROR: unknown option $opt"
-      echo "Try '$0 --help' for more information"
-      exit 1
+  --*) meson_option_parse "$opt" "$optarg"
   ;;
   esac
 done
@@ -1128,7 +1112,6 @@ $(echo Available targets: $default_target_list | \
 Advanced options (experts only):
   --cross-prefix=PREFIX    use PREFIX for compile tools, PREFIX can be blank [$cross_prefix]
   --cc=CC                  use C compiler CC [$cc]
-  --iasl=IASL              use ACPI compiler IASL [$iasl]
   --host-cc=CC             use C compiler CC [$host_cc] for code run at
                            build time
   --cxx=CXX                use C++ compiler CXX [$cxx]
@@ -1141,7 +1124,6 @@ Advanced options (experts only):
   --cross-cc-cflags-ARCH=  use compiler flags when building ARCH guest tests
   --make=MAKE              use specified make [$make]
   --python=PYTHON          use specified python [$python]
-  --sphinx-build=SPHINX    use specified sphinx-build [$sphinx_build]
   --meson=MESON            use specified meson [$meson]
   --ninja=NINJA            use specified ninja [$ninja]
   --smbd=SMBD              use specified smbd [$smbd]
@@ -2484,15 +2466,11 @@ if test "$skip_meson" = no; then
         --sysconfdir "$sysconfdir" \
         --localedir "$localedir" \
         --localstatedir "$local_statedir" \
-        -Daudio_drv_list=$audio_drv_list \
         -Ddefault_devices=$default_devices \
         -Ddocdir="$docdir" \
-        -Diasl="$iasl" \
         -Dqemu_firmwarepath="$firmwarepath" \
         -Dqemu_suffix="$qemu_suffix" \
         -Dsmbd="$smbd" \
-        -Dsphinx_build="$sphinx_build" \
-        -Dtrace_file="$trace_file" \
         -Doptimization=$(if test "$debug" = yes; then echo 0; else echo 2; fi) \
         -Ddebug=$(if test "$debug_info" = yes; then echo true; else echo false; fi) \
         -Dwerror=$(if test "$werror" = yes; then echo true; else echo false; fi) \
diff --git a/scripts/meson-buildoptions.py b/scripts/meson-buildoptions.py
index 4af8d6e732..3e540e8bb3 100755
--- a/scripts/meson-buildoptions.py
+++ b/scripts/meson-buildoptions.py
@@ -26,21 +26,18 @@
 import sys
 
 SKIP_OPTIONS = {
-    "audio_drv_list",
     "default_devices",
     "docdir",
     "fuzzing_engine",
-    "iasl",
     "qemu_firmwarepath",
     "qemu_suffix",
     "smbd",
-    "sphinx_build",
-    "trace_file",
 }
 
 OPTION_NAMES = {
     "malloc": "enable-malloc",
     "trace_backends": "enable-trace-backends",
+    "trace_file": "with-trace-file",
 }
 
 BUILTIN_OPTIONS = {
diff --git a/scripts/meson-buildoptions.sh b/scripts/meson-buildoptions.sh
index 5a06b7915c..63f2f1abcf 100644
--- a/scripts/meson-buildoptions.sh
+++ b/scripts/meson-buildoptions.sh
@@ -1,5 +1,7 @@
 # This file is generated by meson-buildoptions.py, do not edit!
 meson_options_help() {
+  printf "%s\n" '  --audio-drv-list=CHOICES Set audio driver list [default] (choices:'
+  printf "%s\n" '                           alsa/coreaudio/default/dsound/jack/oss/pa/sdl)'
   printf "%s\n" '  --disable-coroutine-pool coroutine freelist (better performance)'
   printf "%s\n" '  --disable-install-blobs  install provided firmware blobs'
   printf "%s\n" '  --enable-block-drv-whitelist-in-tools'
@@ -32,6 +34,9 @@ meson_options_help() {
   printf "%s\n" '  --enable-trace-backends=CHOICES'
   printf "%s\n" '                           Set available tracing backends [log] (choices:'
   printf "%s\n" '                           dtrace/ftrace/log/nop/simple/syslog/ust)'
+  printf "%s\n" '  --iasl=VALUE             Path to ACPI disassembler'
+  printf "%s\n" '  --sphinx-build=VALUE     Use specified sphinx-build for building document'
+  printf "%s\n" '  --with-trace-file=VALUE  Trace file prefix for simple backend [trace]'
   printf "%s\n" ''
   printf "%s\n" 'Optional features, enabled with --enable-FEATURE and'
   printf "%s\n" 'disabled with --disable-FEATURE, default is enabled if available'
@@ -147,6 +152,7 @@ _meson_option_parse() {
     --disable-alsa) printf "%s" -Dalsa=disabled ;;
     --enable-attr) printf "%s" -Dattr=enabled ;;
     --disable-attr) printf "%s" -Dattr=disabled ;;
+    --audio-drv-list=*) quote_sh "-Daudio_drv_list=$2" ;;
     --enable-auth-pam) printf "%s" -Dauth_pam=enabled ;;
     --disable-auth-pam) printf "%s" -Dauth_pam=disabled ;;
     --enable-avx2) printf "%s" -Davx2=enabled ;;
@@ -229,6 +235,7 @@ _meson_option_parse() {
     --disable-hax) printf "%s" -Dhax=disabled ;;
     --enable-hvf) printf "%s" -Dhvf=enabled ;;
     --disable-hvf) printf "%s" -Dhvf=disabled ;;
+    --iasl=*) quote_sh "-Diasl=$2" ;;
     --enable-iconv) printf "%s" -Diconv=enabled ;;
     --disable-iconv) printf "%s" -Diconv=disabled ;;
     --enable-install-blobs) printf "%s" -Dinstall_blobs=true ;;
@@ -331,6 +338,7 @@ _meson_option_parse() {
     --disable-snappy) printf "%s" -Dsnappy=disabled ;;
     --enable-sparse) printf "%s" -Dsparse=enabled ;;
     --disable-sparse) printf "%s" -Dsparse=disabled ;;
+    --sphinx-build=*) quote_sh "-Dsphinx_build=$2" ;;
     --enable-spice) printf "%s" -Dspice=enabled ;;
     --disable-spice) printf "%s" -Dspice=disabled ;;
     --enable-spice-protocol) printf "%s" -Dspice_protocol=enabled ;;
@@ -346,6 +354,7 @@ _meson_option_parse() {
     --enable-tpm) printf "%s" -Dtpm=enabled ;;
     --disable-tpm) printf "%s" -Dtpm=disabled ;;
     --enable-trace-backends=*) quote_sh "-Dtrace_backends=$2" ;;
+    --with-trace-file=*) quote_sh "-Dtrace_file=$2" ;;
     --enable-u2f) printf "%s" -Du2f=enabled ;;
     --disable-u2f) printf "%s" -Du2f=disabled ;;
     --enable-usb-redir) printf "%s" -Dusb_redir=enabled ;;
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 74+ messages in thread

* [PATCH 19/34] meson, configure: move --tls-priority to meson
  2022-04-20 15:33 [PATCH 00/34] Misc meson conversions for QEMU 7.1 Paolo Bonzini
                   ` (17 preceding siblings ...)
  2022-04-20 15:33 ` [PATCH 18/34] configure: switch string options to automatic parsing Paolo Bonzini
@ 2022-04-20 15:33 ` Paolo Bonzini
  2022-04-20 18:25   ` Marc-André Lureau
  2022-04-20 15:33 ` [PATCH 20/34] meson, configure: move bdrv whitelists " Paolo Bonzini
                   ` (14 subsequent siblings)
  33 siblings, 1 reply; 74+ messages in thread
From: Paolo Bonzini @ 2022-04-20 15:33 UTC (permalink / raw)
  To: qemu-devel

Use the new support for string option parsing.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 configure                     | 5 -----
 meson.build                   | 3 ++-
 meson_options.txt             | 2 ++
 scripts/meson-buildoptions.sh | 3 +++
 4 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/configure b/configure
index 8f34f2a061..3327a4887a 100755
--- a/configure
+++ b/configure
@@ -311,7 +311,6 @@ bsd_user=""
 pkgversion=""
 pie=""
 coroutine=""
-tls_priority="NORMAL"
 plugins="$default_feature"
 meson=""
 meson_args=""
@@ -938,8 +937,6 @@ for opt do
   --enable-uuid|--disable-uuid)
       echo "$0: $opt is obsolete, UUID support is always built" >&2
   ;;
-  --tls-priority=*) tls_priority="$optarg"
-  ;;
   --disable-vhost-user) vhost_user="no"
   ;;
   --enable-vhost-user) vhost_user="yes"
@@ -1169,7 +1166,6 @@ Advanced options (experts only):
   --with-coroutine=BACKEND coroutine backend. Supported options:
                            ucontext, sigaltstack, windows
   --enable-gcov            enable test coverage analysis with gcov
-  --tls-priority           default TLS protocol/cipher priority string
   --enable-plugins
                            enable plugins via shared library loading
   --disable-containers     don't use containers for cross-building
@@ -2200,7 +2196,6 @@ if test "$modules" = "yes"; then
   echo "CONFIG_STAMP=_$( (echo $qemu_version; echo $pkgversion; cat $0) | $shacmd - | cut -f1 -d\ )" >> $config_host_mak
   echo "CONFIG_MODULES=y" >> $config_host_mak
 fi
-echo "CONFIG_TLS_PRIORITY=\"$tls_priority\"" >> $config_host_mak
 
 if test "$vhost_scsi" = "yes" ; then
   echo "CONFIG_VHOST_SCSI=y" >> $config_host_mak
diff --git a/meson.build b/meson.build
index ffca473fbc..8a7e4ab5c7 100644
--- a/meson.build
+++ b/meson.build
@@ -1596,6 +1596,7 @@ foreach k : get_option('trace_backends')
   config_host_data.set('CONFIG_TRACE_' + k.to_upper(), true)
 endforeach
 config_host_data.set_quoted('CONFIG_TRACE_FILE', get_option('trace_file'))
+config_host_data.set_quoted('CONFIG_TLS_PRIORITY', get_option('tls_priority'))
 if iasl.found()
   config_host_data.set_quoted('CONFIG_IASL', iasl.full_path())
 endif
@@ -3806,7 +3807,7 @@ summary(summary_info, bool_yn: true, section: 'Block layer support')
 
 # Crypto
 summary_info = {}
-summary_info += {'TLS priority':      config_host['CONFIG_TLS_PRIORITY']}
+summary_info += {'TLS priority':      get_option('tls_priority')}
 summary_info += {'GNUTLS support':    gnutls}
 if gnutls.found()
   summary_info += {'  GNUTLS crypto':   gnutls_crypto.found()}
diff --git a/meson_options.txt b/meson_options.txt
index 415fcc448e..891c0ec130 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -14,6 +14,8 @@ option('sphinx_build', type : 'string', value : '',
        description: 'Use specified sphinx-build for building document')
 option('iasl', type : 'string', value : '',
        description: 'Path to ACPI disassembler')
+option('tls_priority', type : 'string', value : 'NORMAL',
+       description: 'Default TLS protocol/cipher priority string')
 option('default_devices', type : 'boolean', value : true,
        description: 'Include a default selection of devices in emulators')
 option('audio_drv_list', type: 'array', value: ['default'],
diff --git a/scripts/meson-buildoptions.sh b/scripts/meson-buildoptions.sh
index 63f2f1abcf..0e0548aa87 100644
--- a/scripts/meson-buildoptions.sh
+++ b/scripts/meson-buildoptions.sh
@@ -36,6 +36,8 @@ meson_options_help() {
   printf "%s\n" '                           dtrace/ftrace/log/nop/simple/syslog/ust)'
   printf "%s\n" '  --iasl=VALUE             Path to ACPI disassembler'
   printf "%s\n" '  --sphinx-build=VALUE     Use specified sphinx-build for building document'
+  printf "%s\n" '  --tls-priority=VALUE     Default TLS protocol/cipher priority string'
+  printf "%s\n" '                           [NORMAL]'
   printf "%s\n" '  --with-trace-file=VALUE  Trace file prefix for simple backend [trace]'
   printf "%s\n" ''
   printf "%s\n" 'Optional features, enabled with --enable-FEATURE and'
@@ -349,6 +351,7 @@ _meson_option_parse() {
     --disable-tcg) printf "%s" -Dtcg=disabled ;;
     --enable-tcg-interpreter) printf "%s" -Dtcg_interpreter=true ;;
     --disable-tcg-interpreter) printf "%s" -Dtcg_interpreter=false ;;
+    --tls-priority=*) quote_sh "-Dtls_priority=$2" ;;
     --enable-tools) printf "%s" -Dtools=enabled ;;
     --disable-tools) printf "%s" -Dtools=disabled ;;
     --enable-tpm) printf "%s" -Dtpm=enabled ;;
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 74+ messages in thread

* [PATCH 20/34] meson, configure: move bdrv whitelists to meson
  2022-04-20 15:33 [PATCH 00/34] Misc meson conversions for QEMU 7.1 Paolo Bonzini
                   ` (18 preceding siblings ...)
  2022-04-20 15:33 ` [PATCH 19/34] meson, configure: move --tls-priority to meson Paolo Bonzini
@ 2022-04-20 15:33 ` Paolo Bonzini
  2022-04-20 18:28   ` Marc-André Lureau
  2022-04-20 15:33 ` [PATCH 21/34] meson, configure: move --with-pkgversion, CONFIG_STAMP " Paolo Bonzini
                   ` (13 subsequent siblings)
  33 siblings, 1 reply; 74+ messages in thread
From: Paolo Bonzini @ 2022-04-20 15:33 UTC (permalink / raw)
  To: qemu-devel

Use the new support for string option parsing.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 configure                     | 14 --------------
 meson.build                   | 27 ++++++++++++++++-----------
 meson_options.txt             |  4 ++++
 scripts/meson-buildoptions.sh |  8 ++++++++
 4 files changed, 28 insertions(+), 25 deletions(-)

diff --git a/configure b/configure
index 3327a4887a..bc15854578 100755
--- a/configure
+++ b/configure
@@ -235,8 +235,6 @@ interp_prefix="/usr/gnemul/qemu-%M"
 static="no"
 cross_compile="no"
 cross_prefix=""
-block_drv_rw_whitelist=""
-block_drv_ro_whitelist=""
 host_cc="cc"
 lto="false"
 stack_protector=""
@@ -815,10 +813,6 @@ for opt do
     # configure to be used by RPM and similar macros that set
     # lots of directory switches by default.
   ;;
-  --block-drv-rw-whitelist=*|--block-drv-whitelist=*) block_drv_rw_whitelist=$(echo "$optarg" | sed -e 's/,/ /g')
-  ;;
-  --block-drv-ro-whitelist=*) block_drv_ro_whitelist=$(echo "$optarg" | sed -e 's/,/ /g')
-  ;;
   --enable-debug-tcg) debug_tcg="yes"
   ;;
   --disable-debug-tcg) debug_tcg="no"
@@ -1154,12 +1148,6 @@ Advanced options (experts only):
   --disable-stack-protector disable compiler-provided stack protection
   --audio-drv-list=LIST    set audio drivers to try if -audiodev is not used
   --block-drv-whitelist=L  Same as --block-drv-rw-whitelist=L
-  --block-drv-rw-whitelist=L
-                           set block driver read-write whitelist
-                           (by default affects only QEMU, not tools like qemu-img)
-  --block-drv-ro-whitelist=L
-                           set block driver read-only whitelist
-                           (by default affects only QEMU, not tools like qemu-img)
   --with-trace-file=NAME   Full PATH,NAME of file to store traces
                            Default:trace-<pid>
   --cpu=CPU                Build for host CPU [$cpu]
@@ -2184,8 +2172,6 @@ fi
 if test "$static" = "yes" ; then
   echo "CONFIG_STATIC=y" >> $config_host_mak
 fi
-echo "CONFIG_BDRV_RW_WHITELIST=$block_drv_rw_whitelist" >> $config_host_mak
-echo "CONFIG_BDRV_RO_WHITELIST=$block_drv_ro_whitelist" >> $config_host_mak
 qemu_version=$(head $source_path/VERSION)
 echo "PKGVERSION=$pkgversion" >>$config_host_mak
 echo "SRC_PATH=$source_path" >> $config_host_mak
diff --git a/meson.build b/meson.build
index 8a7e4ab5c7..ee96cbc64e 100644
--- a/meson.build
+++ b/meson.build
@@ -1592,6 +1592,19 @@ have_virtfs = get_option('virtfs') \
 
 have_virtfs_proxy_helper = targetos != 'darwin' and have_virtfs and have_tools
 
+if get_option('block_drv_ro_whitelist') == ''
+  config_host_data.set('CONFIG_BDRV_RO_WHITELIST', '')
+else
+  config_host_data.set('CONFIG_BDRV_RO_WHITELIST',
+        '"' + get_option('block_drv_ro_whitelist').replace(',', '", "') + '"')
+endif
+if get_option('block_drv_rw_whitelist') == ''
+  config_host_data.set('CONFIG_BDRV_RW_WHITELIST', '')
+else
+  config_host_data.set('CONFIG_BDRV_RO_WHITELIST',
+        '"' + get_option('block_drv_rw_whitelist').replace(',', '", "') + '"')
+endif
+
 foreach k : get_option('trace_backends')
   config_host_data.set('CONFIG_TRACE_' + k.to_upper(), true)
 endforeach
@@ -2207,16 +2220,8 @@ config_host_data.set('HAVE_VSS_SDK', have_vss_sdk)
 
 ignored = ['CONFIG_QEMU_INTERP_PREFIX', # actually per-target
     'HAVE_GDB_BIN']
-arrays = ['CONFIG_BDRV_RW_WHITELIST', 'CONFIG_BDRV_RO_WHITELIST']
 foreach k, v: config_host
-  if ignored.contains(k)
-    # do nothing
-  elif arrays.contains(k)
-    if v != ''
-      v = '"' + '", "'.join(v.split()) + '", '
-    endif
-    config_host_data.set(k, v)
-  elif k.startswith('CONFIG_')
+  if k.startswith('CONFIG_') and not ignored.contains(k)
     config_host_data.set(k, v == 'y' ? 1 : v)
   endif
 endforeach
@@ -3786,8 +3791,8 @@ summary_info = {}
 summary_info += {'coroutine backend': config_host['CONFIG_COROUTINE_BACKEND']}
 summary_info += {'coroutine pool':    have_coroutine_pool}
 if have_block
-  summary_info += {'Block whitelist (rw)': config_host['CONFIG_BDRV_RW_WHITELIST']}
-  summary_info += {'Block whitelist (ro)': config_host['CONFIG_BDRV_RO_WHITELIST']}
+  summary_info += {'Block whitelist (rw)': get_option('block_drv_rw_whitelist')}
+  summary_info += {'Block whitelist (ro)': get_option('block_drv_ro_whitelist')}
   summary_info += {'Use block whitelist in tools': get_option('block_drv_whitelist_in_tools')}
   summary_info += {'VirtFS support':    have_virtfs}
   summary_info += {'build virtiofs daemon': have_virtiofsd}
diff --git a/meson_options.txt b/meson_options.txt
index 891c0ec130..ec974003b3 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -21,6 +21,10 @@ option('default_devices', type : 'boolean', value : true,
 option('audio_drv_list', type: 'array', value: ['default'],
        choices: ['alsa', 'coreaudio', 'default', 'dsound', 'jack', 'oss', 'pa', 'sdl'],
        description: 'Set audio driver list')
+option('block_drv_rw_whitelist', type : 'string', value : '',
+       description: 'set block driver read-write whitelist (by default affects only QEMU, not tools like qemu-img)')
+option('block_drv_ro_whitelist', type : 'string', value : '',
+       description: 'set block driver read-only whitelist (by default affects only QEMU, not tools like qemu-img)')
 option('fuzzing_engine', type : 'string', value : '',
        description: 'fuzzing engine library for OSS-Fuzz')
 option('trace_file', type: 'string', value: 'trace',
diff --git a/scripts/meson-buildoptions.sh b/scripts/meson-buildoptions.sh
index 0e0548aa87..4c49d4af08 100644
--- a/scripts/meson-buildoptions.sh
+++ b/scripts/meson-buildoptions.sh
@@ -2,6 +2,12 @@
 meson_options_help() {
   printf "%s\n" '  --audio-drv-list=CHOICES Set audio driver list [default] (choices:'
   printf "%s\n" '                           alsa/coreaudio/default/dsound/jack/oss/pa/sdl)'
+  printf "%s\n" '  --block-drv-ro-whitelist=VALUE'
+  printf "%s\n" '                           set block driver read-only whitelist (by default'
+  printf "%s\n" '                           affects only QEMU, not tools like qemu-img)'
+  printf "%s\n" '  --block-drv-rw-whitelist=VALUE'
+  printf "%s\n" '                           set block driver read-write whitelist (by default'
+  printf "%s\n" '                           affects only QEMU, not tools like qemu-img)'
   printf "%s\n" '  --disable-coroutine-pool coroutine freelist (better performance)'
   printf "%s\n" '  --disable-install-blobs  install provided firmware blobs'
   printf "%s\n" '  --enable-block-drv-whitelist-in-tools'
@@ -161,6 +167,8 @@ _meson_option_parse() {
     --disable-avx2) printf "%s" -Davx2=disabled ;;
     --enable-avx512f) printf "%s" -Davx512f=enabled ;;
     --disable-avx512f) printf "%s" -Davx512f=disabled ;;
+    --block-drv-ro-whitelist=*) quote_sh "-Dblock_drv_ro_whitelist=$2" ;;
+    --block-drv-rw-whitelist=*) quote_sh "-Dblock_drv_rw_whitelist=$2" ;;
     --enable-block-drv-whitelist-in-tools) printf "%s" -Dblock_drv_whitelist_in_tools=true ;;
     --disable-block-drv-whitelist-in-tools) printf "%s" -Dblock_drv_whitelist_in_tools=false ;;
     --enable-bochs) printf "%s" -Dbochs=enabled ;;
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 74+ messages in thread

* [PATCH 21/34] meson, configure: move --with-pkgversion, CONFIG_STAMP to meson
  2022-04-20 15:33 [PATCH 00/34] Misc meson conversions for QEMU 7.1 Paolo Bonzini
                   ` (19 preceding siblings ...)
  2022-04-20 15:33 ` [PATCH 20/34] meson, configure: move bdrv whitelists " Paolo Bonzini
@ 2022-04-20 15:33 ` Paolo Bonzini
  2022-04-20 18:34   ` Marc-André Lureau
  2022-04-20 15:33 ` [PATCH 22/34] meson, configure: move --interp-prefix " Paolo Bonzini
                   ` (12 subsequent siblings)
  33 siblings, 1 reply; 74+ messages in thread
From: Paolo Bonzini @ 2022-04-20 15:33 UTC (permalink / raw)
  To: qemu-devel

The hash is now generated with a Python script.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 configure                     | 23 -----------------------
 docs/meson.build              |  2 +-
 meson.build                   | 10 +++++++++-
 meson_options.txt             |  2 ++
 scripts/meson-buildoptions.py |  1 +
 scripts/meson-buildoptions.sh |  3 +++
 scripts/qemu-stamp.py         | 24 ++++++++++++++++++++++++
 7 files changed, 40 insertions(+), 25 deletions(-)
 create mode 100644 scripts/qemu-stamp.py

diff --git a/configure b/configure
index bc15854578..5bf0a7d69b 100755
--- a/configure
+++ b/configure
@@ -306,7 +306,6 @@ qemu_suffix="qemu"
 softmmu="yes"
 linux_user=""
 bsd_user=""
-pkgversion=""
 pie=""
 coroutine=""
 plugins="$default_feature"
@@ -896,8 +895,6 @@ for opt do
   ;;
   --enable-fdt=*) fdt="$optarg"
   ;;
-  --with-pkgversion=*) pkgversion="$optarg"
-  ;;
   --with-coroutine=*) coroutine="$optarg"
   ;;
   --disable-vhost-net) vhost_net="no"
@@ -1135,7 +1132,6 @@ Advanced options (experts only):
   --firmwarepath=PATH      search PATH for firmware files
   --efi-aarch64=PATH       PATH of efi file to use for aarch64 VMs.
   --with-suffix=SUFFIX     suffix for QEMU data inside datadir/libdir/sysconfdir/docdir [$qemu_suffix]
-  --with-pkgversion=VERS   use specified string as sub-version of the package
   --without-default-features default all --enable-* options to "disabled"
   --without-default-devices  do not include any device that is not needed to
                            start the emulator (only use if you are including
@@ -1722,21 +1718,6 @@ if ! compile_prog "$glib_cflags -Werror" "$glib_libs" ; then
     fi
 fi
 
-##########################################
-# SHA command probe for modules
-if test "$modules" = yes; then
-    shacmd_probe="sha1sum sha1 shasum"
-    for c in $shacmd_probe; do
-        if has $c; then
-            shacmd="$c"
-            break
-        fi
-    done
-    if test "$shacmd" = ""; then
-        error_exit "one of the checksum commands is required to enable modules: $shacmd_probe"
-    fi
-fi
-
 ##########################################
 # fdt probe
 
@@ -2173,13 +2154,9 @@ if test "$static" = "yes" ; then
   echo "CONFIG_STATIC=y" >> $config_host_mak
 fi
 qemu_version=$(head $source_path/VERSION)
-echo "PKGVERSION=$pkgversion" >>$config_host_mak
 echo "SRC_PATH=$source_path" >> $config_host_mak
 echo "TARGET_DIRS=$target_list" >> $config_host_mak
 if test "$modules" = "yes"; then
-  # $shacmd can generate a hash started with digit, which the compiler doesn't
-  # like as an symbol. So prefix it with an underscore
-  echo "CONFIG_STAMP=_$( (echo $qemu_version; echo $pkgversion; cat $0) | $shacmd - | cut -f1 -d\ )" >> $config_host_mak
   echo "CONFIG_MODULES=y" >> $config_host_mak
 fi
 
diff --git a/docs/meson.build b/docs/meson.build
index 831d4aea2b..9136fed3b7 100644
--- a/docs/meson.build
+++ b/docs/meson.build
@@ -35,7 +35,7 @@ if sphinx_build.found()
 endif
 
 if build_docs
-  SPHINX_ARGS += ['-Dversion=' + meson.project_version(), '-Drelease=' + config_host['PKGVERSION']]
+  SPHINX_ARGS += ['-Dversion=' + meson.project_version(), '-Drelease=' + get_option('pkgversion')]
 
   man_pages = {
         'qemu-ga.8': (have_ga ? 'man8' : ''),
diff --git a/meson.build b/meson.build
index ee96cbc64e..424ff454d2 100644
--- a/meson.build
+++ b/meson.build
@@ -1626,6 +1626,14 @@ config_host_data.set_quoted('CONFIG_QEMU_LOCALSTATEDIR', get_option('prefix') /
 config_host_data.set_quoted('CONFIG_QEMU_MODDIR', get_option('prefix') / qemu_moddir)
 config_host_data.set_quoted('CONFIG_SYSCONFDIR', get_option('prefix') / get_option('sysconfdir'))
 
+if config_host.has_key('CONFIG_MODULES')
+  config_host_data.set('CONFIG_STAMP', run_command(
+      meson.current_source_dir() / 'scripts/qemu-stamp.py',
+      meson.project_version(), get_option('pkgversion'), '--',
+      meson.current_source_dir() / 'configure',
+      capture: true, check: true).stdout().strip())
+endif
+
 have_slirp_smbd = get_option('slirp_smbd') \
   .require(targetos != 'windows', error_message: 'Host smbd not supported on this platform.') \
   .allowed()
@@ -2785,7 +2793,7 @@ tracetool_depends = files(
 
 qemu_version_cmd = [find_program('scripts/qemu-version.sh'),
                     meson.current_source_dir(),
-                    config_host['PKGVERSION'], meson.project_version()]
+                    get_option('pkgversion'), meson.project_version()]
 qemu_version = custom_target('qemu-version.h',
                              output: 'qemu-version.h',
                              command: qemu_version_cmd,
diff --git a/meson_options.txt b/meson_options.txt
index ec974003b3..dc6fb796c6 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -8,6 +8,8 @@ option('docdir', type : 'string', value : 'doc',
        description: 'Base directory for documentation installation (can be empty)')
 option('qemu_firmwarepath', type : 'string', value : '',
        description: 'search PATH for firmware files')
+option('pkgversion', type : 'string', value : '',
+       description: 'use specified string as sub-version of the package')
 option('smbd', type : 'string', value : '',
        description: 'Path to smbd for slirp networking')
 option('sphinx_build', type : 'string', value : '',
diff --git a/scripts/meson-buildoptions.py b/scripts/meson-buildoptions.py
index 3e540e8bb3..0f9603a7f6 100755
--- a/scripts/meson-buildoptions.py
+++ b/scripts/meson-buildoptions.py
@@ -36,6 +36,7 @@
 
 OPTION_NAMES = {
     "malloc": "enable-malloc",
+    "pkgversion": "with-pkgversion",
     "trace_backends": "enable-trace-backends",
     "trace_file": "with-trace-file",
 }
diff --git a/scripts/meson-buildoptions.sh b/scripts/meson-buildoptions.sh
index 4c49d4af08..bf9878e24f 100644
--- a/scripts/meson-buildoptions.sh
+++ b/scripts/meson-buildoptions.sh
@@ -44,6 +44,8 @@ meson_options_help() {
   printf "%s\n" '  --sphinx-build=VALUE     Use specified sphinx-build for building document'
   printf "%s\n" '  --tls-priority=VALUE     Default TLS protocol/cipher priority string'
   printf "%s\n" '                           [NORMAL]'
+  printf "%s\n" '  --with-pkgversion=VALUE  use specified string as sub-version of the'
+  printf "%s\n" '                           package'
   printf "%s\n" '  --with-trace-file=VALUE  Trace file prefix for simple backend [trace]'
   printf "%s\n" ''
   printf "%s\n" 'Optional features, enabled with --enable-FEATURE and'
@@ -309,6 +311,7 @@ _meson_option_parse() {
     --disable-pa) printf "%s" -Dpa=disabled ;;
     --enable-parallels) printf "%s" -Dparallels=enabled ;;
     --disable-parallels) printf "%s" -Dparallels=disabled ;;
+    --with-pkgversion=*) quote_sh "-Dpkgversion=$2" ;;
     --enable-profiler) printf "%s" -Dprofiler=true ;;
     --disable-profiler) printf "%s" -Dprofiler=false ;;
     --enable-pvrdma) printf "%s" -Dpvrdma=enabled ;;
diff --git a/scripts/qemu-stamp.py b/scripts/qemu-stamp.py
new file mode 100644
index 0000000000..7beeeb07ed
--- /dev/null
+++ b/scripts/qemu-stamp.py
@@ -0,0 +1,24 @@
+#! /usr/bin/env python3
+
+# Usage: scripts/qemu-stamp.py STRING1 STRING2... -- FILE1 FILE2...
+import hashlib
+import os
+import sys
+
+sha = hashlib.sha1()
+is_file = False
+for arg in sys.argv[1:]:
+    if arg == '--':
+        is_file = True
+        continue
+    if is_file:
+        with open(arg, 'rb') as f:
+            for chunk in iter(lambda: f.read(65536), b''):
+                sha.update(chunk)
+    else:
+        sha.update(os.fsencode(arg))
+        sha.update(b'\n')
+
+# The hash can start with a digit, which the compiler doesn't
+# like as an symbol. So prefix it with an underscore
+print("_" + sha.hexdigest())
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 74+ messages in thread

* [PATCH 22/34] meson, configure: move --interp-prefix to meson
  2022-04-20 15:33 [PATCH 00/34] Misc meson conversions for QEMU 7.1 Paolo Bonzini
                   ` (20 preceding siblings ...)
  2022-04-20 15:33 ` [PATCH 21/34] meson, configure: move --with-pkgversion, CONFIG_STAMP " Paolo Bonzini
@ 2022-04-20 15:33 ` Paolo Bonzini
  2022-04-20 18:40   ` Marc-André Lureau
  2022-04-20 15:33 ` [PATCH 23/34] meson: always combine directories with prefix Paolo Bonzini
                   ` (11 subsequent siblings)
  33 siblings, 1 reply; 74+ messages in thread
From: Paolo Bonzini @ 2022-04-20 15:33 UTC (permalink / raw)
  To: qemu-devel

This is the last CONFIG_* entry in config-host.mak that had to be
special cased.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 configure                     | 6 ------
 meson.build                   | 6 ++----
 meson_options.txt             | 2 ++
 scripts/meson-buildoptions.sh | 3 +++
 4 files changed, 7 insertions(+), 10 deletions(-)

diff --git a/configure b/configure
index 5bf0a7d69b..200ef3be23 100755
--- a/configure
+++ b/configure
@@ -231,7 +231,6 @@ fi
 
 # default parameters
 cpu=""
-interp_prefix="/usr/gnemul/qemu-%M"
 static="no"
 cross_compile="no"
 cross_prefix=""
@@ -696,8 +695,6 @@ for opt do
   ;;
   --prefix=*) prefix="$optarg"
   ;;
-  --interp-prefix=*) interp_prefix="$optarg"
-  ;;
   --cross-prefix=*)
   ;;
   --cc=*)
@@ -1090,8 +1087,6 @@ Options: [defaults in brackets after descriptions]
 Standard options:
   --help                   print this message
   --prefix=PREFIX          install in PREFIX [$prefix]
-  --interp-prefix=PREFIX   where to find shared libraries, etc.
-                           use %M for cpu name [$interp_prefix]
   --target-list=LIST       set target list (default: build all)
 $(echo Available targets: $default_target_list | \
   fold -s -w 53 | sed -e 's/^/                           /')
@@ -2289,7 +2284,6 @@ for target in $target_list; do
     esac
 done
 
-echo "CONFIG_QEMU_INTERP_PREFIX=$interp_prefix" | sed 's/%M/@0@/' >> $config_host_mak
 if test "$default_targets" = "yes"; then
   echo "CONFIG_DEFAULT_TARGETS=y" >> $config_host_mak
 fi
diff --git a/meson.build b/meson.build
index 424ff454d2..869cc10128 100644
--- a/meson.build
+++ b/meson.build
@@ -2226,10 +2226,8 @@ if targetos == 'windows' and link_language == 'cpp'
 endif
 config_host_data.set('HAVE_VSS_SDK', have_vss_sdk)
 
-ignored = ['CONFIG_QEMU_INTERP_PREFIX', # actually per-target
-    'HAVE_GDB_BIN']
 foreach k, v: config_host
-  if k.startswith('CONFIG_') and not ignored.contains(k)
+  if k.startswith('CONFIG_')
     config_host_data.set(k, v == 'y' ? 1 : v)
   endif
 endforeach
@@ -2323,7 +2321,7 @@ foreach target : target_dirs
     config_target += {
       'CONFIG_USER_ONLY': 'y',
       'CONFIG_QEMU_INTERP_PREFIX':
-        config_host['CONFIG_QEMU_INTERP_PREFIX'].format(config_target['TARGET_NAME'])
+        get_option('interp_prefix').replace('%M', config_target['TARGET_NAME'])
     }
   endif
 
diff --git a/meson_options.txt b/meson_options.txt
index dc6fb796c6..848426460c 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -27,6 +27,8 @@ option('block_drv_rw_whitelist', type : 'string', value : '',
        description: 'set block driver read-write whitelist (by default affects only QEMU, not tools like qemu-img)')
 option('block_drv_ro_whitelist', type : 'string', value : '',
        description: 'set block driver read-only whitelist (by default affects only QEMU, not tools like qemu-img)')
+option('interp_prefix', type : 'string', value : '/usr/gnemul/qemu-%M',
+       description: 'where to find shared libraries etc., use %M for cpu name')
 option('fuzzing_engine', type : 'string', value : '',
        description: 'fuzzing engine library for OSS-Fuzz')
 option('trace_file', type: 'string', value: 'trace',
diff --git a/scripts/meson-buildoptions.sh b/scripts/meson-buildoptions.sh
index bf9878e24f..a0c86db116 100644
--- a/scripts/meson-buildoptions.sh
+++ b/scripts/meson-buildoptions.sh
@@ -41,6 +41,8 @@ meson_options_help() {
   printf "%s\n" '                           Set available tracing backends [log] (choices:'
   printf "%s\n" '                           dtrace/ftrace/log/nop/simple/syslog/ust)'
   printf "%s\n" '  --iasl=VALUE             Path to ACPI disassembler'
+  printf "%s\n" '  --interp-prefix=VALUE    where to find shared libraries etc., use %M for'
+  printf "%s\n" '                           cpu name [/usr/gnemul/qemu-%M]'
   printf "%s\n" '  --sphinx-build=VALUE     Use specified sphinx-build for building document'
   printf "%s\n" '  --tls-priority=VALUE     Default TLS protocol/cipher priority string'
   printf "%s\n" '                           [NORMAL]'
@@ -252,6 +254,7 @@ _meson_option_parse() {
     --disable-iconv) printf "%s" -Diconv=disabled ;;
     --enable-install-blobs) printf "%s" -Dinstall_blobs=true ;;
     --disable-install-blobs) printf "%s" -Dinstall_blobs=false ;;
+    --interp-prefix=*) quote_sh "-Dinterp_prefix=$2" ;;
     --enable-jack) printf "%s" -Djack=enabled ;;
     --disable-jack) printf "%s" -Djack=disabled ;;
     --enable-keyring) printf "%s" -Dkeyring=enabled ;;
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 74+ messages in thread

* [PATCH 23/34] meson: always combine directories with prefix
  2022-04-20 15:33 [PATCH 00/34] Misc meson conversions for QEMU 7.1 Paolo Bonzini
                   ` (21 preceding siblings ...)
  2022-04-20 15:33 ` [PATCH 22/34] meson, configure: move --interp-prefix " Paolo Bonzini
@ 2022-04-20 15:33 ` Paolo Bonzini
  2022-04-20 18:43   ` Marc-André Lureau
  2022-04-20 15:33 ` [PATCH 24/34] configure: switch directory options to automatic parsing Paolo Bonzini
                   ` (10 subsequent siblings)
  33 siblings, 1 reply; 74+ messages in thread
From: Paolo Bonzini @ 2022-04-20 15:33 UTC (permalink / raw)
  To: qemu-devel

Meson allows directories such as "bindir" to be relative to the prefix.  Right
now configure is forcing an absolute path, but that is not really necessary:
just make sure all uses of the directory variables are prefixed appropriately.
Do the same also for the options that are custom for QEMU, i.e. docdir and
qemu_firmwarepath.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 meson.build | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/meson.build b/meson.build
index 869cc10128..2545ac2848 100644
--- a/meson.build
+++ b/meson.build
@@ -1618,7 +1618,7 @@ config_host_data.set_quoted('CONFIG_PREFIX', get_option('prefix'))
 config_host_data.set_quoted('CONFIG_QEMU_CONFDIR', get_option('prefix') / qemu_confdir)
 config_host_data.set_quoted('CONFIG_QEMU_DATADIR', get_option('prefix') / qemu_datadir)
 config_host_data.set_quoted('CONFIG_QEMU_DESKTOPDIR', get_option('prefix') / qemu_desktopdir)
-config_host_data.set_quoted('CONFIG_QEMU_FIRMWAREPATH', get_option('qemu_firmwarepath'))
+config_host_data.set_quoted('CONFIG_QEMU_FIRMWAREPATH', get_option('prefix') / get_option('qemu_firmwarepath'))
 config_host_data.set_quoted('CONFIG_QEMU_HELPERDIR', get_option('prefix') / get_option('libexecdir'))
 config_host_data.set_quoted('CONFIG_QEMU_ICONDIR', get_option('prefix') / qemu_icondir)
 config_host_data.set_quoted('CONFIG_QEMU_LOCALEDIR', get_option('prefix') / get_option('localedir'))
@@ -3615,20 +3615,20 @@ endif
 summary_info = {}
 summary_info += {'Install prefix':    get_option('prefix')}
 summary_info += {'BIOS directory':    qemu_datadir}
-summary_info += {'firmware path':     get_option('qemu_firmwarepath')}
-summary_info += {'binary directory':  get_option('bindir')}
-summary_info += {'library directory': get_option('libdir')}
+summary_info += {'firmware path':     get_option('prefix') / get_option('qemu_firmwarepath')}
+summary_info += {'binary directory':  get_option('prefix') / get_option('bindir')}
+summary_info += {'library directory': get_option('prefix') / get_option('libdir')}
 summary_info += {'module directory':  qemu_moddir}
-summary_info += {'libexec directory': get_option('libexecdir')}
-summary_info += {'include directory': get_option('includedir')}
-summary_info += {'config directory':  get_option('sysconfdir')}
+summary_info += {'libexec directory': get_option('prefix') / get_option('libexecdir')}
+summary_info += {'include directory': get_option('prefix') / get_option('includedir')}
+summary_info += {'config directory':  get_option('prefix') / get_option('sysconfdir')}
 if targetos != 'windows'
-  summary_info += {'local state directory': get_option('localstatedir')}
-  summary_info += {'Manual directory':      get_option('mandir')}
+  summary_info += {'local state directory': get_option('prefix') / get_option('localstatedir')}
+  summary_info += {'Manual directory':      get_option('prefix') / get_option('mandir')}
 else
   summary_info += {'local state directory': 'queried at runtime'}
 endif
-summary_info += {'Doc directory':     get_option('docdir')}
+summary_info += {'Doc directory':     get_option('prefix') / get_option('docdir')}
 summary_info += {'Build directory':   meson.current_build_dir()}
 summary_info += {'Source path':       meson.current_source_dir()}
 summary_info += {'GIT submodules':    config_host['GIT_SUBMODULES']}
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 74+ messages in thread

* [PATCH 24/34] configure: switch directory options to automatic parsing
  2022-04-20 15:33 [PATCH 00/34] Misc meson conversions for QEMU 7.1 Paolo Bonzini
                   ` (22 preceding siblings ...)
  2022-04-20 15:33 ` [PATCH 23/34] meson: always combine directories with prefix Paolo Bonzini
@ 2022-04-20 15:33 ` Paolo Bonzini
  2022-04-21  9:48   ` Marc-André Lureau
  2022-04-20 15:33 ` [PATCH 25/34] meson: pass more options directly as -D Paolo Bonzini
                   ` (9 subsequent siblings)
  33 siblings, 1 reply; 74+ messages in thread
From: Paolo Bonzini @ 2022-04-20 15:33 UTC (permalink / raw)
  To: qemu-devel

While prefix, bindir and qemu_suffix needs special treatment due to
differences between Windows and POSIX systems, everything else
needs no extra code in configure.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 configure                     | 58 ++---------------------------------
 meson_options.txt             |  4 +--
 scripts/meson-buildoptions.py | 11 +++++--
 scripts/meson-buildoptions.sh | 21 +++++++++++++
 4 files changed, 34 insertions(+), 60 deletions(-)

diff --git a/configure b/configure
index 200ef3be23..b704453c68 100755
--- a/configure
+++ b/configure
@@ -311,6 +311,7 @@ plugins="$default_feature"
 meson=""
 meson_args=""
 ninja=""
+bindir="bin"
 skip_meson=no
 
 # The following Meson options are handled manually (still they
@@ -669,6 +670,7 @@ if test "$mingw32" = "yes" ; then
   CONFIGURE_CFLAGS="-mthreads $CONFIGURE_CFLAGS"
   write_c_skeleton;
   prefix="/qemu"
+  bindir=""
   qemu_suffix=""
 fi
 
@@ -775,30 +777,10 @@ for opt do
     static="yes"
     QEMU_PKG_CONFIG_FLAGS="--static $QEMU_PKG_CONFIG_FLAGS"
   ;;
-  --mandir=*) mandir="$optarg"
-  ;;
   --bindir=*) bindir="$optarg"
   ;;
-  --libdir=*) libdir="$optarg"
-  ;;
-  --libexecdir=*) libexecdir="$optarg"
-  ;;
-  --includedir=*) includedir="$optarg"
-  ;;
-  --datadir=*) datadir="$optarg"
-  ;;
   --with-suffix=*) qemu_suffix="$optarg"
   ;;
-  --docdir=*) docdir="$optarg"
-  ;;
-  --localedir=*) localedir="$optarg"
-  ;;
-  --sysconfdir=*) sysconfdir="$optarg"
-  ;;
-  --localstatedir=*) local_statedir="$optarg"
-  ;;
-  --firmwarepath=*) firmwarepath="$optarg"
-  ;;
   --host=*|--build=*|\
   --disable-dependency-tracking|\
   --sbindir=*|--sharedstatedir=*|\
@@ -1021,23 +1003,6 @@ case $git_submodules_action in
     ;;
 esac
 
-libdir="${libdir:-$prefix/lib}"
-libexecdir="${libexecdir:-$prefix/libexec}"
-includedir="${includedir:-$prefix/include}"
-
-if test "$mingw32" = "yes" ; then
-    bindir="${bindir:-$prefix}"
-else
-    bindir="${bindir:-$prefix/bin}"
-fi
-mandir="${mandir:-$prefix/share/man}"
-datadir="${datadir:-$prefix/share}"
-docdir="${docdir:-$prefix/share/doc}"
-sysconfdir="${sysconfdir:-$prefix/etc}"
-local_statedir="${local_statedir:-$prefix/var}"
-firmwarepath="${firmwarepath:-$datadir/qemu-firmware}"
-localedir="${localedir:-$datadir/locale}"
-
 if eval test -z "\${cross_cc_$cpu}"; then
     eval "cross_cc_${cpu}=\$cc"
     cross_cc_vars="$cross_cc_vars cross_cc_${cpu}"
@@ -1115,16 +1080,7 @@ Advanced options (experts only):
   --with-git-submodules=validate fail if git submodules are not up to date
   --with-git-submodules=ignore   do not update or check git submodules (default if no .git dir)
   --static                 enable static build [$static]
-  --mandir=PATH            install man pages in PATH
-  --datadir=PATH           install firmware in PATH/$qemu_suffix
-  --localedir=PATH         install translation in PATH/$qemu_suffix
-  --docdir=PATH            install documentation in PATH/$qemu_suffix
   --bindir=PATH            install binaries in PATH
-  --libdir=PATH            install libraries in PATH
-  --libexecdir=PATH        install helper binaries in PATH
-  --sysconfdir=PATH        install config in PATH/$qemu_suffix
-  --localstatedir=PATH     install local state in PATH (set at runtime on win32)
-  --firmwarepath=PATH      search PATH for firmware files
   --efi-aarch64=PATH       PATH of efi file to use for aarch64 VMs.
   --with-suffix=SUFFIX     suffix for QEMU data inside datadir/libdir/sysconfdir/docdir [$qemu_suffix]
   --without-default-features default all --enable-* options to "disabled"
@@ -2409,18 +2365,8 @@ if test "$skip_meson" = no; then
   run_meson() {
     NINJA=$ninja $meson setup \
         --prefix "$prefix" \
-        --libdir "$libdir" \
-        --libexecdir "$libexecdir" \
         --bindir "$bindir" \
-        --includedir "$includedir" \
-        --datadir "$datadir" \
-        --mandir "$mandir" \
-        --sysconfdir "$sysconfdir" \
-        --localedir "$localedir" \
-        --localstatedir "$local_statedir" \
         -Ddefault_devices=$default_devices \
-        -Ddocdir="$docdir" \
-        -Dqemu_firmwarepath="$firmwarepath" \
         -Dqemu_suffix="$qemu_suffix" \
         -Dsmbd="$smbd" \
         -Doptimization=$(if test "$debug" = yes; then echo 0; else echo 2; fi) \
diff --git a/meson_options.txt b/meson_options.txt
index 848426460c..a76fadbd7d 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -4,9 +4,9 @@
 
 option('qemu_suffix', type : 'string', value: 'qemu',
        description: 'Suffix for QEMU data/modules/config directories (can be empty)')
-option('docdir', type : 'string', value : 'doc',
+option('docdir', type : 'string', value : 'share/doc',
        description: 'Base directory for documentation installation (can be empty)')
-option('qemu_firmwarepath', type : 'string', value : '',
+option('qemu_firmwarepath', type : 'string', value : 'qemu-firmware',
        description: 'search PATH for firmware files')
 option('pkgversion', type : 'string', value : '',
        description: 'use specified string as sub-version of the package')
diff --git a/scripts/meson-buildoptions.py b/scripts/meson-buildoptions.py
index 0f9603a7f6..45cda8cd84 100755
--- a/scripts/meson-buildoptions.py
+++ b/scripts/meson-buildoptions.py
@@ -27,9 +27,7 @@
 
 SKIP_OPTIONS = {
     "default_devices",
-    "docdir",
     "fuzzing_engine",
-    "qemu_firmwarepath",
     "qemu_suffix",
     "smbd",
 }
@@ -37,12 +35,21 @@
 OPTION_NAMES = {
     "malloc": "enable-malloc",
     "pkgversion": "with-pkgversion",
+    "qemu_firmwarepath": "firmwarepath",
     "trace_backends": "enable-trace-backends",
     "trace_file": "with-trace-file",
 }
 
 BUILTIN_OPTIONS = {
+    "datadir",
+    "includedir",
+    "libdir",
+    "libexecdir",
+    "localedir",
+    "localstatedir",
+    "mandir",
     "strip",
+    "sysconfdir",
 }
 
 LINE_WIDTH = 76
diff --git a/scripts/meson-buildoptions.sh b/scripts/meson-buildoptions.sh
index a0c86db116..a52cc14d13 100644
--- a/scripts/meson-buildoptions.sh
+++ b/scripts/meson-buildoptions.sh
@@ -8,8 +8,11 @@ meson_options_help() {
   printf "%s\n" '  --block-drv-rw-whitelist=VALUE'
   printf "%s\n" '                           set block driver read-write whitelist (by default'
   printf "%s\n" '                           affects only QEMU, not tools like qemu-img)'
+  printf "%s\n" '  --datadir=VALUE          Data file directory [share]'
   printf "%s\n" '  --disable-coroutine-pool coroutine freelist (better performance)'
   printf "%s\n" '  --disable-install-blobs  install provided firmware blobs'
+  printf "%s\n" '  --docdir=VALUE           Base directory for documentation installation'
+  printf "%s\n" '                           (can be empty) [share/doc]'
   printf "%s\n" '  --enable-block-drv-whitelist-in-tools'
   printf "%s\n" '                           use block whitelist also in tools instead of only'
   printf "%s\n" '                           QEMU'
@@ -40,10 +43,18 @@ meson_options_help() {
   printf "%s\n" '  --enable-trace-backends=CHOICES'
   printf "%s\n" '                           Set available tracing backends [log] (choices:'
   printf "%s\n" '                           dtrace/ftrace/log/nop/simple/syslog/ust)'
+  printf "%s\n" '  --firmwarepath=VALUE     search PATH for firmware files [qemu-firmware]'
   printf "%s\n" '  --iasl=VALUE             Path to ACPI disassembler'
+  printf "%s\n" '  --includedir=VALUE       Header file directory [include]'
   printf "%s\n" '  --interp-prefix=VALUE    where to find shared libraries etc., use %M for'
   printf "%s\n" '                           cpu name [/usr/gnemul/qemu-%M]'
+  printf "%s\n" '  --libdir=VALUE           Library directory [lib64]'
+  printf "%s\n" '  --libexecdir=VALUE       Library executable directory [libexec]'
+  printf "%s\n" '  --localedir=VALUE        Locale data directory [share/locale]'
+  printf "%s\n" '  --localstatedir=VALUE    Localstate data directory [/var/local]'
+  printf "%s\n" '  --mandir=VALUE           Manual page directory [share/man]'
   printf "%s\n" '  --sphinx-build=VALUE     Use specified sphinx-build for building document'
+  printf "%s\n" '  --sysconfdir=VALUE       Sysconf data directory [etc]'
   printf "%s\n" '  --tls-priority=VALUE     Default TLS protocol/cipher priority string'
   printf "%s\n" '                           [NORMAL]'
   printf "%s\n" '  --with-pkgversion=VALUE  use specified string as sub-version of the'
@@ -206,6 +217,7 @@ _meson_option_parse() {
     --disable-curl) printf "%s" -Dcurl=disabled ;;
     --enable-curses) printf "%s" -Dcurses=enabled ;;
     --disable-curses) printf "%s" -Dcurses=disabled ;;
+    --datadir=*) quote_sh "-Ddatadir=$2" ;;
     --enable-dbus-display) printf "%s" -Ddbus_display=enabled ;;
     --disable-dbus-display) printf "%s" -Ddbus_display=disabled ;;
     --enable-debug-mutex) printf "%s" -Ddebug_mutex=true ;;
@@ -214,6 +226,7 @@ _meson_option_parse() {
     --disable-debug-stack-usage) printf "%s" -Ddebug_stack_usage=false ;;
     --enable-dmg) printf "%s" -Ddmg=enabled ;;
     --disable-dmg) printf "%s" -Ddmg=disabled ;;
+    --docdir=*) quote_sh "-Ddocdir=$2" ;;
     --enable-docs) printf "%s" -Ddocs=enabled ;;
     --disable-docs) printf "%s" -Ddocs=disabled ;;
     --enable-dsound) printf "%s" -Ddsound=enabled ;;
@@ -252,6 +265,7 @@ _meson_option_parse() {
     --iasl=*) quote_sh "-Diasl=$2" ;;
     --enable-iconv) printf "%s" -Diconv=enabled ;;
     --disable-iconv) printf "%s" -Diconv=disabled ;;
+    --includedir=*) quote_sh "-Dincludedir=$2" ;;
     --enable-install-blobs) printf "%s" -Dinstall_blobs=true ;;
     --disable-install-blobs) printf "%s" -Dinstall_blobs=false ;;
     --interp-prefix=*) quote_sh "-Dinterp_prefix=$2" ;;
@@ -265,6 +279,8 @@ _meson_option_parse() {
     --disable-l2tpv3) printf "%s" -Dl2tpv3=disabled ;;
     --enable-libdaxctl) printf "%s" -Dlibdaxctl=enabled ;;
     --disable-libdaxctl) printf "%s" -Dlibdaxctl=disabled ;;
+    --libdir=*) quote_sh "-Dlibdir=$2" ;;
+    --libexecdir=*) quote_sh "-Dlibexecdir=$2" ;;
     --enable-libiscsi) printf "%s" -Dlibiscsi=enabled ;;
     --disable-libiscsi) printf "%s" -Dlibiscsi=disabled ;;
     --enable-libnfs) printf "%s" -Dlibnfs=enabled ;;
@@ -283,6 +299,8 @@ _meson_option_parse() {
     --disable-linux-io-uring) printf "%s" -Dlinux_io_uring=disabled ;;
     --enable-live-block-migration) printf "%s" -Dlive_block_migration=enabled ;;
     --disable-live-block-migration) printf "%s" -Dlive_block_migration=disabled ;;
+    --localedir=*) quote_sh "-Dlocaledir=$2" ;;
+    --localstatedir=*) quote_sh "-Dlocalstatedir=$2" ;;
     --enable-lzfse) printf "%s" -Dlzfse=enabled ;;
     --disable-lzfse) printf "%s" -Dlzfse=disabled ;;
     --enable-lzo) printf "%s" -Dlzo=enabled ;;
@@ -290,6 +308,7 @@ _meson_option_parse() {
     --enable-malloc=*) quote_sh "-Dmalloc=$2" ;;
     --enable-malloc-trim) printf "%s" -Dmalloc_trim=enabled ;;
     --disable-malloc-trim) printf "%s" -Dmalloc_trim=disabled ;;
+    --mandir=*) quote_sh "-Dmandir=$2" ;;
     --enable-membarrier) printf "%s" -Dmembarrier=enabled ;;
     --disable-membarrier) printf "%s" -Dmembarrier=disabled ;;
     --enable-module-upgrades) printf "%s" -Dmodule_upgrades=true ;;
@@ -323,6 +342,7 @@ _meson_option_parse() {
     --disable-qcow1) printf "%s" -Dqcow1=disabled ;;
     --enable-qed) printf "%s" -Dqed=enabled ;;
     --disable-qed) printf "%s" -Dqed=disabled ;;
+    --firmwarepath=*) quote_sh "-Dqemu_firmwarepath=$2" ;;
     --enable-qga-vss) printf "%s" -Dqga_vss=enabled ;;
     --disable-qga-vss) printf "%s" -Dqga_vss=disabled ;;
     --enable-qom-cast-debug) printf "%s" -Dqom_cast_debug=true ;;
@@ -361,6 +381,7 @@ _meson_option_parse() {
     --disable-spice-protocol) printf "%s" -Dspice_protocol=disabled ;;
     --enable-strip) printf "%s" -Dstrip=true ;;
     --disable-strip) printf "%s" -Dstrip=false ;;
+    --sysconfdir=*) quote_sh "-Dsysconfdir=$2" ;;
     --enable-tcg) printf "%s" -Dtcg=enabled ;;
     --disable-tcg) printf "%s" -Dtcg=disabled ;;
     --enable-tcg-interpreter) printf "%s" -Dtcg_interpreter=true ;;
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 74+ messages in thread

* [PATCH 25/34] meson: pass more options directly as -D
  2022-04-20 15:33 [PATCH 00/34] Misc meson conversions for QEMU 7.1 Paolo Bonzini
                   ` (23 preceding siblings ...)
  2022-04-20 15:33 ` [PATCH 24/34] configure: switch directory options to automatic parsing Paolo Bonzini
@ 2022-04-20 15:33 ` Paolo Bonzini
  2022-04-21  9:52   ` Marc-André Lureau
  2022-04-20 15:33 ` [PATCH 26/34] configure: omit options with default values from meson command line Paolo Bonzini
                   ` (8 subsequent siblings)
  33 siblings, 1 reply; 74+ messages in thread
From: Paolo Bonzini @ 2022-04-20 15:33 UTC (permalink / raw)
  To: qemu-devel

If an option is not used anywhere by the configure script, it can be just
added to $meson_options even if it is not parsed by the automatically
generated bits in scripts/meson-buildoptions.sh.

The only slightly tricky case is $debug, where the

  if test "$fortify_source" = "yes" ; then
    QEMU_CFLAGS="-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $QEMU_CFLAGS"
    debug=no
  fi

assignment is dead; configure sets fortify_source=no whenever debug=yes.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 configure                     | 39 ++++++++++-------------------------
 meson.build                   |  2 +-
 scripts/meson-buildoptions.py |  4 ++++
 scripts/meson-buildoptions.sh |  6 ++++++
 4 files changed, 22 insertions(+), 29 deletions(-)

diff --git a/configure b/configure
index b704453c68..4997983b5d 100755
--- a/configure
+++ b/configure
@@ -235,7 +235,6 @@ static="no"
 cross_compile="no"
 cross_prefix=""
 host_cc="cc"
-lto="false"
 stack_protector=""
 safe_stack=""
 use_containers="yes"
@@ -291,13 +290,10 @@ vhost_vsock="$default_feature"
 vhost_user="no"
 vhost_user_fs="$default_feature"
 vhost_vdpa="$default_feature"
-debug_info="yes"
 debug_tcg="no"
-debug="no"
 sanitizers="no"
 tsan="no"
 fortify_source="$default_feature"
-gcov="no"
 EXESUF=""
 modules="no"
 prefix="/usr/local"
@@ -327,10 +323,7 @@ else
 fi
 fdt="auto"
 
-# 2. Support --with/--without option
-default_devices="true"
-
-# 3. Automatically enable/disable other options
+# 2. Automatically enable/disable other options
 tcg="enabled"
 cfi="false"
 
@@ -679,6 +672,9 @@ werror=""
 . $source_path/scripts/meson-buildoptions.sh
 
 meson_options=
+meson_option_add() {
+  meson_options="$meson_options $(quote_sh "$1")"
+}
 meson_option_parse() {
   meson_options="$meson_options $(_meson_option_parse "$@")"
   if test $? -eq 1; then
@@ -731,9 +727,9 @@ for opt do
   ;;
   --cross-cc-*)
   ;;
-  --enable-debug-info) debug_info="yes"
+  --enable-debug-info) meson_option_add -Ddebug=true
   ;;
-  --disable-debug-info) debug_info="no"
+  --disable-debug-info) meson_option_add -Ddebug=false
   ;;
   --enable-modules)
       modules="yes"
@@ -753,9 +749,9 @@ for opt do
                        error_exit "Can't mix --target-list-exclude with --target-list"
                    fi
   ;;
-  --with-default-devices) default_devices="true"
+  --with-default-devices) meson_option_add -Ddefault_devices=true
   ;;
-  --without-default-devices) default_devices="false"
+  --without-default-devices) meson_option_add -Ddefault_devices=false
   ;;
   --with-devices-*[!a-zA-Z0-9_-]*=*) error_exit "Passed bad --with-devices-FOO option"
   ;;
@@ -771,8 +767,6 @@ for opt do
   ;;
   --without-default-features) # processed above
   ;;
-  --enable-gcov) gcov="yes"
-  ;;
   --static)
     static="yes"
     QEMU_PKG_CONFIG_FLAGS="--static $QEMU_PKG_CONFIG_FLAGS"
@@ -799,7 +793,7 @@ for opt do
       # Enable debugging options that aren't excessively noisy
       debug_tcg="yes"
       meson_option_parse --enable-debug-mutex ""
-      debug="yes"
+      meson_option_add -Doptimization=0
       fortify_source="no"
   ;;
   --enable-sanitizers) sanitizers="yes"
@@ -848,10 +842,6 @@ for opt do
   ;;
   --disable-werror) werror="no"
   ;;
-  --enable-lto) lto="true"
-  ;;
-  --disable-lto) lto="false"
-  ;;
   --enable-stack-protector) stack_protector="yes"
   ;;
   --disable-stack-protector) stack_protector="no"
@@ -862,7 +852,7 @@ for opt do
   ;;
   --enable-cfi)
       cfi="true";
-      lto="true";
+      meson_option_add -Db_lto=true
   ;;
   --disable-cfi) cfi="false"
   ;;
@@ -1100,7 +1090,6 @@ Advanced options (experts only):
   --cpu=CPU                Build for host CPU [$cpu]
   --with-coroutine=BACKEND coroutine backend. Supported options:
                            ucontext, sigaltstack, windows
-  --enable-gcov            enable test coverage analysis with gcov
   --enable-plugins
                            enable plugins via shared library loading
   --disable-containers     don't use containers for cross-building
@@ -1116,7 +1105,6 @@ cat << EOF
   modules         modules support (non-Windows)
   debug-tcg       TCG debugging (default is disabled)
   debug-info      debugging information
-  lto             Enable Link-Time Optimization.
   safe-stack      SafeStack Stack Smash Protection. Depends on
                   clang/llvm >= 3.7 and requires coroutine backend ucontext.
   vhost-net       vhost-net kernel acceleration support
@@ -1937,7 +1925,6 @@ write_c_skeleton
 
 if test "$fortify_source" = "yes" ; then
   QEMU_CFLAGS="-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $QEMU_CFLAGS"
-  debug=no
 fi
 
 case "$ARCH" in
@@ -2366,15 +2353,11 @@ if test "$skip_meson" = no; then
     NINJA=$ninja $meson setup \
         --prefix "$prefix" \
         --bindir "$bindir" \
-        -Ddefault_devices=$default_devices \
         -Dqemu_suffix="$qemu_suffix" \
         -Dsmbd="$smbd" \
-        -Doptimization=$(if test "$debug" = yes; then echo 0; else echo 2; fi) \
-        -Ddebug=$(if test "$debug_info" = yes; then echo true; else echo false; fi) \
         -Dwerror=$(if test "$werror" = yes; then echo true; else echo false; fi) \
         -Db_pie=$(if test "$pie" = yes; then echo true; else echo false; fi) \
-        -Db_coverage=$(if test "$gcov" = yes; then echo true; else echo false; fi) \
-        -Db_lto=$lto -Dcfi=$cfi -Dtcg=$tcg \
+        -Dcfi=$cfi -Dtcg=$tcg \
         -Dcapstone=$capstone -Dfdt=$fdt -Dslirp=$slirp \
         $(test -n "${LIB_FUZZING_ENGINE+xxx}" && echo "-Dfuzzing_engine=$LIB_FUZZING_ENGINE") \
         $(if test "$default_feature" = no; then echo "-Dauto_features=disabled"; fi) \
diff --git a/meson.build b/meson.build
index 2545ac2848..60e8c302e6 100644
--- a/meson.build
+++ b/meson.build
@@ -1,6 +1,6 @@
 project('qemu', ['c'], meson_version: '>=0.59.3',
         default_options: ['warning_level=1', 'c_std=gnu11', 'cpp_std=gnu++11', 'b_colorout=auto',
-                          'b_staticpic=false', 'stdsplit=false'],
+                          'b_staticpic=false', 'stdsplit=false', 'optimization=2'],
         version: files('VERSION'))
 
 add_test_setup('quick', exclude_suites: ['slow', 'thorough'], is_default: true)
diff --git a/scripts/meson-buildoptions.py b/scripts/meson-buildoptions.py
index 45cda8cd84..e624c16b01 100755
--- a/scripts/meson-buildoptions.py
+++ b/scripts/meson-buildoptions.py
@@ -33,6 +33,8 @@
 }
 
 OPTION_NAMES = {
+    "b_coverage": "gcov",
+    "b_lto": "lto",
     "malloc": "enable-malloc",
     "pkgversion": "with-pkgversion",
     "qemu_firmwarepath": "firmwarepath",
@@ -41,6 +43,8 @@
 }
 
 BUILTIN_OPTIONS = {
+    "b_coverage",
+    "b_lto",
     "datadir",
     "includedir",
     "libdir",
diff --git a/scripts/meson-buildoptions.sh b/scripts/meson-buildoptions.sh
index a52cc14d13..274639777e 100644
--- a/scripts/meson-buildoptions.sh
+++ b/scripts/meson-buildoptions.sh
@@ -27,7 +27,9 @@ meson_options_help() {
   printf "%s\n" '  --enable-fdt[=CHOICE]    Whether and how to find the libfdt library'
   printf "%s\n" '                           (choices: auto/disabled/enabled/internal/system)'
   printf "%s\n" '  --enable-fuzzing         build fuzzing targets'
+  printf "%s\n" '  --enable-gcov            Enable coverage tracking.'
   printf "%s\n" '  --enable-gprof           QEMU profiling with gprof'
+  printf "%s\n" '  --enable-lto             Use link time optimization'
   printf "%s\n" '  --enable-malloc=CHOICE   choose memory allocator to use [system] (choices:'
   printf "%s\n" '                           jemalloc/system/tcmalloc)'
   printf "%s\n" '  --enable-module-upgrades try to load modules from alternate paths for'
@@ -182,6 +184,10 @@ _meson_option_parse() {
     --disable-avx2) printf "%s" -Davx2=disabled ;;
     --enable-avx512f) printf "%s" -Davx512f=enabled ;;
     --disable-avx512f) printf "%s" -Davx512f=disabled ;;
+    --enable-gcov) printf "%s" -Db_coverage=true ;;
+    --disable-gcov) printf "%s" -Db_coverage=false ;;
+    --enable-lto) printf "%s" -Db_lto=true ;;
+    --disable-lto) printf "%s" -Db_lto=false ;;
     --block-drv-ro-whitelist=*) quote_sh "-Dblock_drv_ro_whitelist=$2" ;;
     --block-drv-rw-whitelist=*) quote_sh "-Dblock_drv_rw_whitelist=$2" ;;
     --enable-block-drv-whitelist-in-tools) printf "%s" -Dblock_drv_whitelist_in_tools=true ;;
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 74+ messages in thread

* [PATCH 26/34] configure: omit options with default values from meson command line
  2022-04-20 15:33 [PATCH 00/34] Misc meson conversions for QEMU 7.1 Paolo Bonzini
                   ` (24 preceding siblings ...)
  2022-04-20 15:33 ` [PATCH 25/34] meson: pass more options directly as -D Paolo Bonzini
@ 2022-04-20 15:33 ` Paolo Bonzini
  2022-04-21 10:04   ` Marc-André Lureau
  2022-04-20 15:34 ` [PATCH 27/34] meson, virtio: place all virtio-pci devices under virtio_pci_ss Paolo Bonzini
                   ` (7 subsequent siblings)
  33 siblings, 1 reply; 74+ messages in thread
From: Paolo Bonzini @ 2022-04-20 15:33 UTC (permalink / raw)
  To: qemu-devel

This has no functional change, it only makes the command line shorter
and nicer.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 configure         | 29 +++++++++++++++++------------
 meson.build       |  2 +-
 meson_options.txt |  2 +-
 3 files changed, 19 insertions(+), 14 deletions(-)

diff --git a/configure b/configure
index 4997983b5d..61b5acae10 100755
--- a/configure
+++ b/configure
@@ -2349,19 +2349,24 @@ if test "$skip_meson" = no; then
   mv $cross config-meson.cross
 
   rm -rf meson-private meson-info meson-logs
+
+  # Built-in options
+  test "$bindir" != "bin" && meson_option_add "-Dbindir=$bindir"
+  test "$default_feature" = no && meson_option_add -Dauto_features=disabled
+  test "$pie" = no && meson_option_add -Db_pie=false
+  test "$werror" = yes && meson_option_add -Dwerror=true
+
+  # QEMU options
+  test "$capstone" != auto && meson_option_add "-Dcapstone=$capstone"
+  test "$cfi" != false && meson_option_add "-Dcfi=$cfi"
+  test "$fdt" != auto && meson_option_add "-Dfdt=$fdt"
+  test -n "${LIB_FUZZING_ENGINE+xxx}" && meson_option_add "-Dfuzzing_engine=$LIB_FUZZING_ENGINE"
+  test "$qemu_suffix" != qemu && meson_option_add "-Dqemu_suffix=$qemu_suffix"
+  test "$slirp" != auto && meson_option_add "-Dslirp=$slirp"
+  test "$smbd" != '' && meson_option_add "-Dsmbd=$smbd"
+  test "$tcg" != enabled && meson_option_add "-Dtcg=$tcg"
   run_meson() {
-    NINJA=$ninja $meson setup \
-        --prefix "$prefix" \
-        --bindir "$bindir" \
-        -Dqemu_suffix="$qemu_suffix" \
-        -Dsmbd="$smbd" \
-        -Dwerror=$(if test "$werror" = yes; then echo true; else echo false; fi) \
-        -Db_pie=$(if test "$pie" = yes; then echo true; else echo false; fi) \
-        -Dcfi=$cfi -Dtcg=$tcg \
-        -Dcapstone=$capstone -Dfdt=$fdt -Dslirp=$slirp \
-        $(test -n "${LIB_FUZZING_ENGINE+xxx}" && echo "-Dfuzzing_engine=$LIB_FUZZING_ENGINE") \
-        $(if test "$default_feature" = no; then echo "-Dauto_features=disabled"; fi) \
-        "$@" $cross_arg "$PWD" "$source_path"
+    NINJA=$ninja $meson setup --prefix "$prefix" "$@" $cross_arg "$PWD" "$source_path"
   }
   eval run_meson $meson_options
   if test "$?" -ne 0 ; then
diff --git a/meson.build b/meson.build
index 60e8c302e6..ff5c076805 100644
--- a/meson.build
+++ b/meson.build
@@ -1,6 +1,6 @@
 project('qemu', ['c'], meson_version: '>=0.59.3',
         default_options: ['warning_level=1', 'c_std=gnu11', 'cpp_std=gnu++11', 'b_colorout=auto',
-                          'b_staticpic=false', 'stdsplit=false', 'optimization=2'],
+                          'b_staticpic=false', 'stdsplit=false', 'optimization=2', 'b_pie=true'],
         version: files('VERSION'))
 
 add_test_setup('quick', exclude_suites: ['slow', 'thorough'], is_default: true)
diff --git a/meson_options.txt b/meson_options.txt
index a76fadbd7d..8efd5f520c 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -78,7 +78,7 @@ option('xen', type: 'feature', value: 'auto',
        description: 'Xen backend support')
 option('xen_pci_passthrough', type: 'feature', value: 'auto',
        description: 'Xen PCI passthrough support')
-option('tcg', type: 'feature', value: 'auto',
+option('tcg', type: 'feature', value: 'enabled',
        description: 'TCG support')
 option('tcg_interpreter', type: 'boolean', value: false,
        description: 'TCG with bytecode interpreter (slow)')
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 74+ messages in thread

* [PATCH 27/34] meson, virtio: place all virtio-pci devices under virtio_pci_ss
  2022-04-20 15:33 [PATCH 00/34] Misc meson conversions for QEMU 7.1 Paolo Bonzini
                   ` (25 preceding siblings ...)
  2022-04-20 15:33 ` [PATCH 26/34] configure: omit options with default values from meson command line Paolo Bonzini
@ 2022-04-20 15:34 ` Paolo Bonzini
  2022-04-21 10:05   ` Marc-André Lureau
  2022-04-20 15:34 ` [PATCH 28/34] configure: simplify vhost-net-{user, vdpa} configuration Paolo Bonzini
                   ` (6 subsequent siblings)
  33 siblings, 1 reply; 74+ messages in thread
From: Paolo Bonzini @ 2022-04-20 15:34 UTC (permalink / raw)
  To: qemu-devel

Since a sourceset already exists for this, avoid unnecessary repeat
of CONFIG_VIRTIO_PCI.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/virtio/meson.build | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/hw/virtio/meson.build b/hw/virtio/meson.build
index 67dc77e00f..f371404b04 100644
--- a/hw/virtio/meson.build
+++ b/hw/virtio/meson.build
@@ -16,9 +16,7 @@ virtio_ss.add(when: 'CONFIG_VHOST_USER', if_true: files('vhost-user.c'))
 virtio_ss.add(when: 'CONFIG_VHOST_VDPA', if_true: files('vhost-shadow-virtqueue.c', 'vhost-vdpa.c'))
 virtio_ss.add(when: 'CONFIG_VIRTIO_BALLOON', if_true: files('virtio-balloon.c'))
 virtio_ss.add(when: 'CONFIG_VIRTIO_CRYPTO', if_true: files('virtio-crypto.c'))
-virtio_ss.add(when: ['CONFIG_VIRTIO_CRYPTO', 'CONFIG_VIRTIO_PCI'], if_true: files('virtio-crypto-pci.c'))
 virtio_ss.add(when: 'CONFIG_VHOST_USER_FS', if_true: files('vhost-user-fs.c'))
-virtio_ss.add(when: ['CONFIG_VHOST_USER_FS', 'CONFIG_VIRTIO_PCI'], if_true: files('vhost-user-fs-pci.c'))
 virtio_ss.add(when: 'CONFIG_VIRTIO_PMEM', if_true: files('virtio-pmem.c'))
 virtio_ss.add(when: 'CONFIG_VHOST_VSOCK', if_true: files('vhost-vsock.c', 'vhost-vsock-common.c'))
 virtio_ss.add(when: 'CONFIG_VHOST_USER_VSOCK', if_true: files('vhost-user-vsock.c', 'vhost-vsock-common.c'))
@@ -26,17 +24,20 @@ virtio_ss.add(when: 'CONFIG_VIRTIO_RNG', if_true: files('virtio-rng.c'))
 virtio_ss.add(when: 'CONFIG_VIRTIO_IOMMU', if_true: files('virtio-iommu.c'))
 virtio_ss.add(when: 'CONFIG_VIRTIO_MEM', if_true: files('virtio-mem.c'))
 virtio_ss.add(when: 'CONFIG_VHOST_USER_I2C', if_true: files('vhost-user-i2c.c'))
-virtio_ss.add(when: ['CONFIG_VIRTIO_PCI', 'CONFIG_VHOST_USER_I2C'], if_true: files('vhost-user-i2c-pci.c'))
 virtio_ss.add(when: 'CONFIG_VHOST_USER_RNG', if_true: files('vhost-user-rng.c'))
-virtio_ss.add(when: ['CONFIG_VHOST_USER_RNG', 'CONFIG_VIRTIO_PCI'], if_true: files('vhost-user-rng-pci.c'))
 
 virtio_pci_ss = ss.source_set()
 virtio_pci_ss.add(when: 'CONFIG_VHOST_VSOCK', if_true: files('vhost-vsock-pci.c'))
 virtio_pci_ss.add(when: 'CONFIG_VHOST_USER_VSOCK', if_true: files('vhost-user-vsock-pci.c'))
 virtio_pci_ss.add(when: 'CONFIG_VHOST_USER_BLK', if_true: files('vhost-user-blk-pci.c'))
+virtio_pci_ss.add(when: 'CONFIG_VHOST_USER_I2C', if_true: files('vhost-user-i2c-pci.c'))
 virtio_pci_ss.add(when: 'CONFIG_VHOST_USER_INPUT', if_true: files('vhost-user-input-pci.c'))
+virtio_pci_ss.add(when: 'CONFIG_VHOST_USER_RNG', if_true: files('vhost-user-rng-pci.c'))
 virtio_pci_ss.add(when: 'CONFIG_VHOST_USER_SCSI', if_true: files('vhost-user-scsi-pci.c'))
 virtio_pci_ss.add(when: 'CONFIG_VHOST_SCSI', if_true: files('vhost-scsi-pci.c'))
+virtio_pci_ss.add(when: 'CONFIG_VHOST_USER_FS', if_true: files('vhost-user-fs-pci.c'))
+
+virtio_pci_ss.add(when: 'CONFIG_VIRTIO_CRYPTO', if_true: files('virtio-crypto-pci.c'))
 virtio_pci_ss.add(when: 'CONFIG_VIRTIO_INPUT_HOST', if_true: files('virtio-input-host-pci.c'))
 virtio_pci_ss.add(when: 'CONFIG_VIRTIO_INPUT', if_true: files('virtio-input-pci.c'))
 virtio_pci_ss.add(when: 'CONFIG_VIRTIO_RNG', if_true: files('virtio-rng-pci.c'))
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 74+ messages in thread

* [PATCH 28/34] configure: simplify vhost-net-{user, vdpa} configuration
  2022-04-20 15:33 [PATCH 00/34] Misc meson conversions for QEMU 7.1 Paolo Bonzini
                   ` (26 preceding siblings ...)
  2022-04-20 15:34 ` [PATCH 27/34] meson, virtio: place all virtio-pci devices under virtio_pci_ss Paolo Bonzini
@ 2022-04-20 15:34 ` Paolo Bonzini
  2022-04-21 10:08   ` Marc-André Lureau
  2022-04-20 15:34 ` [PATCH 29/34] build: move vhost-vsock configuration to Kconfig Paolo Bonzini
                   ` (5 subsequent siblings)
  33 siblings, 1 reply; 74+ messages in thread
From: Paolo Bonzini @ 2022-04-20 15:34 UTC (permalink / raw)
  To: qemu-devel

Cleanup to ease review of the conversion to meson.  vhost_net_user and
vhost_net_vdpa are never assigned anything in the command line parsing
loop, so they are always equal to $vhost_user and $vhost_vdpa.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 configure | 17 ++++-------------
 1 file changed, 4 insertions(+), 13 deletions(-)

diff --git a/configure b/configure
index 61b5acae10..2aa4dc3ce1 100755
--- a/configure
+++ b/configure
@@ -1554,10 +1554,6 @@ if test "$vhost_vsock" = "yes" && test "$vhost_kernel" != "yes"; then
 fi
 
 # vhost-user backends
-test "$vhost_net_user" = "" && vhost_net_user=$vhost_user
-if test "$vhost_net_user" = "yes" && test "$vhost_user" = "no"; then
-  error_exit "--enable-vhost-net-user requires --enable-vhost-user"
-fi
 test "$vhost_crypto" = "" && vhost_crypto=$vhost_user
 if test "$vhost_crypto" = "yes" && test "$vhost_user" = "no"; then
   error_exit "--enable-vhost-crypto requires --enable-vhost-user"
@@ -1566,16 +1562,11 @@ test "$vhost_user_fs" = "" && vhost_user_fs=$vhost_user
 if test "$vhost_user_fs" = "yes" && test "$vhost_user" = "no"; then
   error_exit "--enable-vhost-user-fs requires --enable-vhost-user"
 fi
-#vhost-vdpa backends
-test "$vhost_net_vdpa" = "" && vhost_net_vdpa=$vhost_vdpa
-if test "$vhost_net_vdpa" = "yes" && test "$vhost_vdpa" = "no"; then
-  error_exit "--enable-vhost-net-vdpa requires --enable-vhost-vdpa"
-fi
 
 # OR the vhost-kernel, vhost-vdpa and vhost-user values for simplicity
 if test "$vhost_net" = ""; then
-  test "$vhost_net_user" = "yes" && vhost_net=yes
-  test "$vhost_net_vdpa" = "yes" && vhost_net=yes
+  test "$vhost_user" = "yes" && vhost_net=yes
+  test "$vhost_vdpa" = "yes" && vhost_net=yes
   test "$vhost_kernel" = "yes" && vhost_net=yes
 fi
 
@@ -2104,10 +2095,10 @@ fi
 if test "$vhost_net" = "yes" ; then
   echo "CONFIG_VHOST_NET=y" >> $config_host_mak
 fi
-if test "$vhost_net_user" = "yes" ; then
+if test "$vhost_user" = "yes" ; then
   echo "CONFIG_VHOST_NET_USER=y" >> $config_host_mak
 fi
-if test "$vhost_net_vdpa" = "yes" ; then
+if test "$vhost_vdpa" = "yes" ; then
   echo "CONFIG_VHOST_NET_VDPA=y" >> $config_host_mak
 fi
 if test "$vhost_crypto" = "yes" ; then
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 74+ messages in thread

* [PATCH 29/34] build: move vhost-vsock configuration to Kconfig
  2022-04-20 15:33 [PATCH 00/34] Misc meson conversions for QEMU 7.1 Paolo Bonzini
                   ` (27 preceding siblings ...)
  2022-04-20 15:34 ` [PATCH 28/34] configure: simplify vhost-net-{user, vdpa} configuration Paolo Bonzini
@ 2022-04-20 15:34 ` Paolo Bonzini
  2022-04-21 11:38   ` Marc-André Lureau
  2022-04-20 15:34 ` [PATCH 30/34] build: move vhost-scsi " Paolo Bonzini
                   ` (4 subsequent siblings)
  33 siblings, 1 reply; 74+ messages in thread
From: Paolo Bonzini @ 2022-04-20 15:34 UTC (permalink / raw)
  To: qemu-devel

vhost-vsock and vhost-user-vsock are two devices of their own; it should
be possible to enable/disable them with --without-default-devices, not
--without-default-features.  Compute their default value in Kconfig to
obtain the more intuitive behavior.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 configure         | 16 ----------------
 hw/virtio/Kconfig | 10 ++++++++++
 meson.build       |  1 -
 3 files changed, 10 insertions(+), 17 deletions(-)

diff --git a/configure b/configure
index 2aa4dc3ce1..a3b57877e5 100755
--- a/configure
+++ b/configure
@@ -286,7 +286,6 @@ vhost_kernel="$default_feature"
 vhost_net="$default_feature"
 vhost_crypto="$default_feature"
 vhost_scsi="$default_feature"
-vhost_vsock="$default_feature"
 vhost_user="no"
 vhost_user_fs="$default_feature"
 vhost_vdpa="$default_feature"
@@ -878,10 +877,6 @@ for opt do
   ;;
   --enable-vhost-scsi) vhost_scsi="yes"
   ;;
-  --disable-vhost-vsock) vhost_vsock="no"
-  ;;
-  --enable-vhost-vsock) vhost_vsock="yes"
-  ;;
   --disable-vhost-user-fs) vhost_user_fs="no"
   ;;
   --enable-vhost-user-fs) vhost_user_fs="yes"
@@ -1108,7 +1103,6 @@ cat << EOF
   safe-stack      SafeStack Stack Smash Protection. Depends on
                   clang/llvm >= 3.7 and requires coroutine backend ucontext.
   vhost-net       vhost-net kernel acceleration support
-  vhost-vsock     virtio sockets device support
   vhost-scsi      vhost-scsi kernel target support
   vhost-crypto    vhost-user-crypto backend support
   vhost-kernel    vhost kernel backend support
@@ -1548,10 +1542,6 @@ test "$vhost_scsi" = "" && vhost_scsi=$vhost_kernel
 if test "$vhost_scsi" = "yes" && test "$vhost_kernel" != "yes"; then
   error_exit "--enable-vhost-scsi requires --enable-vhost-kernel"
 fi
-test "$vhost_vsock" = "" && vhost_vsock=$vhost_kernel
-if test "$vhost_vsock" = "yes" && test "$vhost_kernel" != "yes"; then
-  error_exit "--enable-vhost-vsock requires --enable-vhost-kernel"
-fi
 
 # vhost-user backends
 test "$vhost_crypto" = "" && vhost_crypto=$vhost_user
@@ -2104,12 +2094,6 @@ fi
 if test "$vhost_crypto" = "yes" ; then
   echo "CONFIG_VHOST_CRYPTO=y" >> $config_host_mak
 fi
-if test "$vhost_vsock" = "yes" ; then
-  echo "CONFIG_VHOST_VSOCK=y" >> $config_host_mak
-  if test "$vhost_user" = "yes" ; then
-    echo "CONFIG_VHOST_USER_VSOCK=y" >> $config_host_mak
-  fi
-fi
 if test "$vhost_kernel" = "yes" ; then
   echo "CONFIG_VHOST_KERNEL=y" >> $config_host_mak
 fi
diff --git a/hw/virtio/Kconfig b/hw/virtio/Kconfig
index c144d42f9b..b642ae1081 100644
--- a/hw/virtio/Kconfig
+++ b/hw/virtio/Kconfig
@@ -59,6 +59,16 @@ config VIRTIO_MEM
     depends on VIRTIO_MEM_SUPPORTED
     select MEM_DEVICE
 
+config VHOST_VSOCK
+    bool
+    default y
+    depends on VIRTIO && VHOST_KERNEL
+
+config VHOST_USER_VSOCK
+    bool
+    default y
+    depends on VIRTIO && VHOST_USER
+
 config VHOST_USER_I2C
     bool
     default y
diff --git a/meson.build b/meson.build
index ff5c076805..033d0c9aa1 100644
--- a/meson.build
+++ b/meson.build
@@ -3678,7 +3678,6 @@ summary_info += {'vhost-kernel support': config_host.has_key('CONFIG_VHOST_KERNE
 summary_info += {'vhost-net support': config_host.has_key('CONFIG_VHOST_NET')}
 summary_info += {'vhost-crypto support': config_host.has_key('CONFIG_VHOST_CRYPTO')}
 summary_info += {'vhost-scsi support': config_host.has_key('CONFIG_VHOST_SCSI')}
-summary_info += {'vhost-vsock support': config_host.has_key('CONFIG_VHOST_VSOCK')}
 summary_info += {'vhost-user support': config_host.has_key('CONFIG_VHOST_USER')}
 summary_info += {'vhost-user-blk server support': have_vhost_user_blk_server}
 summary_info += {'vhost-user-fs support': config_host.has_key('CONFIG_VHOST_USER_FS')}
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 74+ messages in thread

* [PATCH 30/34] build: move vhost-scsi configuration to Kconfig
  2022-04-20 15:33 [PATCH 00/34] Misc meson conversions for QEMU 7.1 Paolo Bonzini
                   ` (28 preceding siblings ...)
  2022-04-20 15:34 ` [PATCH 29/34] build: move vhost-vsock configuration to Kconfig Paolo Bonzini
@ 2022-04-20 15:34 ` Paolo Bonzini
  2022-04-21 11:47   ` Marc-André Lureau
  2022-04-20 15:34 ` [PATCH 31/34] build: move vhost-user-fs " Paolo Bonzini
                   ` (3 subsequent siblings)
  33 siblings, 1 reply; 74+ messages in thread
From: Paolo Bonzini @ 2022-04-20 15:34 UTC (permalink / raw)
  To: qemu-devel

vhost-scsi and vhost-user-scsi are two devices of their own; it should
be possible to enable/disable them with --without-default-devices, not
--without-default-features.  Compute their default value in Kconfig to
obtain the more intuitive behavior.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 configure                       | 15 ---------------
 hw/scsi/Kconfig                 |  5 +++++
 include/hw/virtio/virtio-scsi.h |  2 --
 meson.build                     |  1 -
 4 files changed, 5 insertions(+), 18 deletions(-)

diff --git a/configure b/configure
index a3b57877e5..65ae2c0c1f 100755
--- a/configure
+++ b/configure
@@ -285,7 +285,6 @@ EXTRA_LDFLAGS=""
 vhost_kernel="$default_feature"
 vhost_net="$default_feature"
 vhost_crypto="$default_feature"
-vhost_scsi="$default_feature"
 vhost_user="no"
 vhost_user_fs="$default_feature"
 vhost_vdpa="$default_feature"
@@ -873,10 +872,6 @@ for opt do
   ;;
   --enable-vhost-crypto) vhost_crypto="yes"
   ;;
-  --disable-vhost-scsi) vhost_scsi="no"
-  ;;
-  --enable-vhost-scsi) vhost_scsi="yes"
-  ;;
   --disable-vhost-user-fs) vhost_user_fs="no"
   ;;
   --enable-vhost-user-fs) vhost_user_fs="yes"
@@ -1103,7 +1098,6 @@ cat << EOF
   safe-stack      SafeStack Stack Smash Protection. Depends on
                   clang/llvm >= 3.7 and requires coroutine backend ucontext.
   vhost-net       vhost-net kernel acceleration support
-  vhost-scsi      vhost-scsi kernel target support
   vhost-crypto    vhost-user-crypto backend support
   vhost-kernel    vhost kernel backend support
   vhost-user      vhost-user backend support
@@ -1537,12 +1531,6 @@ if test "$vhost_kernel" = "yes" && test "$linux" != "yes"; then
   error_exit "vhost-kernel is only available on Linux"
 fi
 
-# vhost-kernel devices
-test "$vhost_scsi" = "" && vhost_scsi=$vhost_kernel
-if test "$vhost_scsi" = "yes" && test "$vhost_kernel" != "yes"; then
-  error_exit "--enable-vhost-scsi requires --enable-vhost-kernel"
-fi
-
 # vhost-user backends
 test "$vhost_crypto" = "" && vhost_crypto=$vhost_user
 if test "$vhost_crypto" = "yes" && test "$vhost_user" = "no"; then
@@ -2079,9 +2067,6 @@ if test "$modules" = "yes"; then
   echo "CONFIG_MODULES=y" >> $config_host_mak
 fi
 
-if test "$vhost_scsi" = "yes" ; then
-  echo "CONFIG_VHOST_SCSI=y" >> $config_host_mak
-fi
 if test "$vhost_net" = "yes" ; then
   echo "CONFIG_VHOST_NET=y" >> $config_host_mak
 fi
diff --git a/hw/scsi/Kconfig b/hw/scsi/Kconfig
index 77d397c949..e7b34dc8e2 100644
--- a/hw/scsi/Kconfig
+++ b/hw/scsi/Kconfig
@@ -48,6 +48,11 @@ config VIRTIO_SCSI
     depends on VIRTIO
     select SCSI
 
+config VHOST_SCSI
+    bool
+    default y
+    depends on VIRTIO && VHOST_KERNEL
+
 config VHOST_USER_SCSI
     bool
     # Only PCI devices are provided for now
diff --git a/include/hw/virtio/virtio-scsi.h b/include/hw/virtio/virtio-scsi.h
index 543681bc18..0997313f0a 100644
--- a/include/hw/virtio/virtio-scsi.h
+++ b/include/hw/virtio/virtio-scsi.h
@@ -55,10 +55,8 @@ struct VirtIOSCSIConf {
     bool seg_max_adjust;
     uint32_t max_sectors;
     uint32_t cmd_per_lun;
-#ifdef CONFIG_VHOST_SCSI
     char *vhostfd;
     char *wwpn;
-#endif
     CharBackend chardev;
     uint32_t boot_tpgt;
     IOThread *iothread;
diff --git a/meson.build b/meson.build
index 033d0c9aa1..b18731ee84 100644
--- a/meson.build
+++ b/meson.build
@@ -3677,7 +3677,6 @@ summary_info += {'QOM debugging':     get_option('qom_cast_debug')}
 summary_info += {'vhost-kernel support': config_host.has_key('CONFIG_VHOST_KERNEL')}
 summary_info += {'vhost-net support': config_host.has_key('CONFIG_VHOST_NET')}
 summary_info += {'vhost-crypto support': config_host.has_key('CONFIG_VHOST_CRYPTO')}
-summary_info += {'vhost-scsi support': config_host.has_key('CONFIG_VHOST_SCSI')}
 summary_info += {'vhost-user support': config_host.has_key('CONFIG_VHOST_USER')}
 summary_info += {'vhost-user-blk server support': have_vhost_user_blk_server}
 summary_info += {'vhost-user-fs support': config_host.has_key('CONFIG_VHOST_USER_FS')}
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 74+ messages in thread

* [PATCH 31/34] build: move vhost-user-fs configuration to Kconfig
  2022-04-20 15:33 [PATCH 00/34] Misc meson conversions for QEMU 7.1 Paolo Bonzini
                   ` (29 preceding siblings ...)
  2022-04-20 15:34 ` [PATCH 30/34] build: move vhost-scsi " Paolo Bonzini
@ 2022-04-20 15:34 ` Paolo Bonzini
  2022-04-21 11:48   ` Marc-André Lureau
  2022-04-20 15:34 ` [PATCH 32/34] meson: create have_vhost_* variables Paolo Bonzini
                   ` (2 subsequent siblings)
  33 siblings, 1 reply; 74+ messages in thread
From: Paolo Bonzini @ 2022-04-20 15:34 UTC (permalink / raw)
  To: qemu-devel

vhost-user-fs is a device and it should be possible to enable/disable
it with --without-default-devices, not --without-default-features.
Compute its default value in Kconfig to obtain the more intuitive
behavior.

In this case the configure options were undocumented, too.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 configure         | 12 ------------
 hw/virtio/Kconfig |  5 +++++
 meson.build       |  1 -
 3 files changed, 5 insertions(+), 13 deletions(-)

diff --git a/configure b/configure
index 65ae2c0c1f..3b38ff3c63 100755
--- a/configure
+++ b/configure
@@ -286,7 +286,6 @@ vhost_kernel="$default_feature"
 vhost_net="$default_feature"
 vhost_crypto="$default_feature"
 vhost_user="no"
-vhost_user_fs="$default_feature"
 vhost_vdpa="$default_feature"
 debug_tcg="no"
 sanitizers="no"
@@ -872,10 +871,6 @@ for opt do
   ;;
   --enable-vhost-crypto) vhost_crypto="yes"
   ;;
-  --disable-vhost-user-fs) vhost_user_fs="no"
-  ;;
-  --enable-vhost-user-fs) vhost_user_fs="yes"
-  ;;
   --disable-zlib-test)
   ;;
   --disable-virtio-blk-data-plane|--enable-virtio-blk-data-plane)
@@ -1536,10 +1531,6 @@ test "$vhost_crypto" = "" && vhost_crypto=$vhost_user
 if test "$vhost_crypto" = "yes" && test "$vhost_user" = "no"; then
   error_exit "--enable-vhost-crypto requires --enable-vhost-user"
 fi
-test "$vhost_user_fs" = "" && vhost_user_fs=$vhost_user
-if test "$vhost_user_fs" = "yes" && test "$vhost_user" = "no"; then
-  error_exit "--enable-vhost-user-fs requires --enable-vhost-user"
-fi
 
 # OR the vhost-kernel, vhost-vdpa and vhost-user values for simplicity
 if test "$vhost_net" = ""; then
@@ -2088,9 +2079,6 @@ fi
 if test "$vhost_vdpa" = "yes" ; then
   echo "CONFIG_VHOST_VDPA=y" >> $config_host_mak
 fi
-if test "$vhost_user_fs" = "yes" ; then
-  echo "CONFIG_VHOST_USER_FS=y" >> $config_host_mak
-fi
 
 # XXX: suppress that
 if [ "$bsd" = "yes" ] ; then
diff --git a/hw/virtio/Kconfig b/hw/virtio/Kconfig
index b642ae1081..f8e235f814 100644
--- a/hw/virtio/Kconfig
+++ b/hw/virtio/Kconfig
@@ -78,3 +78,8 @@ config VHOST_USER_RNG
     bool
     default y
     depends on VIRTIO && VHOST_USER
+
+config VHOST_USER_FS
+    bool
+    default y
+    depends on VIRTIO && VHOST_USER
diff --git a/meson.build b/meson.build
index b18731ee84..870dd8dee0 100644
--- a/meson.build
+++ b/meson.build
@@ -3679,7 +3679,6 @@ summary_info += {'vhost-net support': config_host.has_key('CONFIG_VHOST_NET')}
 summary_info += {'vhost-crypto support': config_host.has_key('CONFIG_VHOST_CRYPTO')}
 summary_info += {'vhost-user support': config_host.has_key('CONFIG_VHOST_USER')}
 summary_info += {'vhost-user-blk server support': have_vhost_user_blk_server}
-summary_info += {'vhost-user-fs support': config_host.has_key('CONFIG_VHOST_USER_FS')}
 summary_info += {'vhost-vdpa support': config_host.has_key('CONFIG_VHOST_VDPA')}
 summary_info += {'build guest agent': have_ga}
 summary(summary_info, bool_yn: true, section: 'Configurable features')
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 74+ messages in thread

* [PATCH 32/34] meson: create have_vhost_* variables
  2022-04-20 15:33 [PATCH 00/34] Misc meson conversions for QEMU 7.1 Paolo Bonzini
                   ` (30 preceding siblings ...)
  2022-04-20 15:34 ` [PATCH 31/34] build: move vhost-user-fs " Paolo Bonzini
@ 2022-04-20 15:34 ` Paolo Bonzini
  2022-04-21 12:01   ` Marc-André Lureau
  2022-04-20 15:34 ` [PATCH 33/34] meson: use have_vhost_* variables to pick sources Paolo Bonzini
  2022-04-20 15:34 ` [PATCH 34/34] configure, meson: move vhost options to Meson Paolo Bonzini
  33 siblings, 1 reply; 74+ messages in thread
From: Paolo Bonzini @ 2022-04-20 15:34 UTC (permalink / raw)
  To: qemu-devel

When using Meson options rather than config-host.h, the "when" clauses
have to be changed to if statements (which is not necessarily great,
though at least it highlights which parts of the build are per-target
and which are not).

Do that before moving vhost logic to meson.build, though for now
the variables are just based on config-host.mak data.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 meson.build       | 31 ++++++++++++++++++++-----------
 tests/meson.build |  2 +-
 tools/meson.build |  2 +-
 3 files changed, 22 insertions(+), 13 deletions(-)

diff --git a/meson.build b/meson.build
index 870dd8dee0..5b5eb442c4 100644
--- a/meson.build
+++ b/meson.build
@@ -312,6 +312,15 @@ have_tpm = get_option('tpm') \
   .require(targetos != 'windows', error_message: 'TPM emulation only available on POSIX systems') \
   .allowed()
 
+# vhost
+have_vhost_user = 'CONFIG_VHOST_USER' in config_host
+have_vhost_vdpa = 'CONFIG_VHOST_VDPA' in config_host
+have_vhost_kernel = 'CONFIG_VHOST_KERNEL' in config_host
+have_vhost_net_user = 'CONFIG_VHOST_NET_USER' in config_host
+have_vhost_net_vdpa = 'CONFIG_VHOST_NET_VDPA' in config_host
+have_vhost_net = 'CONFIG_VHOST_NET' in config_host
+have_vhost_user_crypto = 'CONFIG_VHOST_CRYPTO' in config_host
+
 # Target-specific libraries and flags
 libm = cc.find_library('m', required: false)
 threads = dependency('threads')
@@ -1440,7 +1449,7 @@ has_statx_mnt_id = cc.links(statx_mnt_id_test)
 have_vhost_user_blk_server = get_option('vhost_user_blk_server') \
   .require(targetos == 'linux',
            error_message: 'vhost_user_blk_server requires linux') \
-  .require('CONFIG_VHOST_USER' in config_host,
+  .require(have_vhost_user,
            error_message: 'vhost_user_blk_server requires vhost-user support') \
   .disable_auto_if(not have_system) \
   .allowed()
@@ -2283,9 +2292,9 @@ host_kconfig = \
   (have_ivshmem ? ['CONFIG_IVSHMEM=y'] : []) + \
   (opengl.found() ? ['CONFIG_OPENGL=y'] : []) + \
   (x11.found() ? ['CONFIG_X11=y'] : []) + \
-  ('CONFIG_VHOST_USER' in config_host ? ['CONFIG_VHOST_USER=y'] : []) + \
-  ('CONFIG_VHOST_VDPA' in config_host ? ['CONFIG_VHOST_VDPA=y'] : []) + \
-  ('CONFIG_VHOST_KERNEL' in config_host ? ['CONFIG_VHOST_KERNEL=y'] : []) + \
+  (have_vhost_user ? ['CONFIG_VHOST_USER=y'] : []) + \
+  (have_vhost_vdpa ? ['CONFIG_VHOST_VDPA=y'] : []) + \
+  (have_vhost_kernel ? ['CONFIG_VHOST_KERNEL=y'] : []) + \
   (have_virtfs ? ['CONFIG_VIRTFS=y'] : []) + \
   ('CONFIG_LINUX' in config_host ? ['CONFIG_LINUX=y'] : []) + \
   (have_pvrdma ? ['CONFIG_PVRDMA=y'] : []) + \
@@ -2967,7 +2976,7 @@ if have_system or have_user
 endif
 
 vhost_user = not_found
-if targetos == 'linux' and 'CONFIG_VHOST_USER' in config_host
+if targetos == 'linux' and have_vhost_user
   libvhost_user = subproject('libvhost-user')
   vhost_user = libvhost_user.get_variable('vhost_user_dep')
 endif
@@ -3548,7 +3557,7 @@ if have_tools
              dependencies: qemuutil,
              install: true)
 
-  if 'CONFIG_VHOST_USER' in config_host
+  if have_vhost_user
     subdir('contrib/vhost-user-blk')
     subdir('contrib/vhost-user-gpu')
     subdir('contrib/vhost-user-input')
@@ -3674,12 +3683,12 @@ if 'simple' in get_option('trace_backends')
 endif
 summary_info += {'D-Bus display':     dbus_display}
 summary_info += {'QOM debugging':     get_option('qom_cast_debug')}
-summary_info += {'vhost-kernel support': config_host.has_key('CONFIG_VHOST_KERNEL')}
-summary_info += {'vhost-net support': config_host.has_key('CONFIG_VHOST_NET')}
-summary_info += {'vhost-crypto support': config_host.has_key('CONFIG_VHOST_CRYPTO')}
-summary_info += {'vhost-user support': config_host.has_key('CONFIG_VHOST_USER')}
+summary_info += {'vhost-kernel support': have_vhost_kernel}
+summary_info += {'vhost-net support': have_vhost_net}
+summary_info += {'vhost-user support': have_vhost_user}
+summary_info += {'vhost-user-crypto support': have_vhost_user_crypto}
 summary_info += {'vhost-user-blk server support': have_vhost_user_blk_server}
-summary_info += {'vhost-vdpa support': config_host.has_key('CONFIG_VHOST_VDPA')}
+summary_info += {'vhost-vdpa support': have_vhost_vdpa}
 summary_info += {'build guest agent': have_ga}
 summary(summary_info, bool_yn: true, section: 'Configurable features')
 
diff --git a/tests/meson.build b/tests/meson.build
index 4f691e8465..8e318ec513 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -68,7 +68,7 @@ test_deps = {
   'test-qht-par': qht_bench,
 }
 
-if have_tools and 'CONFIG_VHOST_USER' in config_host and 'CONFIG_LINUX' in config_host
+if have_tools and have_vhost_user and 'CONFIG_LINUX' in config_host
   executable('vhost-user-bridge',
              sources: files('vhost-user-bridge.c'),
              dependencies: [qemuutil, vhost_user])
diff --git a/tools/meson.build b/tools/meson.build
index 46977af84f..10eb3a043f 100644
--- a/tools/meson.build
+++ b/tools/meson.build
@@ -3,7 +3,7 @@ have_virtiofsd = get_option('virtiofsd') \
              error_message: 'virtiofsd requires Linux') \
     .require(seccomp.found() and libcap_ng.found(),
              error_message: 'virtiofsd requires libcap-ng-devel and seccomp-devel') \
-    .require('CONFIG_VHOST_USER' in config_host,
+    .require(have_vhost_user,
              error_message: 'virtiofsd needs vhost-user-support') \
     .disable_auto_if(not have_tools and not have_system) \
     .allowed()
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 74+ messages in thread

* [PATCH 33/34] meson: use have_vhost_* variables to pick sources
  2022-04-20 15:33 [PATCH 00/34] Misc meson conversions for QEMU 7.1 Paolo Bonzini
                   ` (31 preceding siblings ...)
  2022-04-20 15:34 ` [PATCH 32/34] meson: create have_vhost_* variables Paolo Bonzini
@ 2022-04-20 15:34 ` Paolo Bonzini
  2022-04-21 12:08   ` Marc-André Lureau
  2022-04-20 15:34 ` [PATCH 34/34] configure, meson: move vhost options to Meson Paolo Bonzini
  33 siblings, 1 reply; 74+ messages in thread
From: Paolo Bonzini @ 2022-04-20 15:34 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 Kconfig.host            |  3 ---
 backends/meson.build    |  8 ++++++--
 hw/net/meson.build      |  8 ++++++--
 hw/virtio/Kconfig       |  3 ---
 hw/virtio/meson.build   | 25 ++++++++++++++++---------
 meson.build             |  1 +
 net/meson.build         | 12 +++++++-----
 tests/qtest/meson.build |  4 +++-
 8 files changed, 39 insertions(+), 25 deletions(-)

diff --git a/Kconfig.host b/Kconfig.host
index 60b9c07b5e..1165c4eacd 100644
--- a/Kconfig.host
+++ b/Kconfig.host
@@ -22,15 +22,12 @@ config TPM
 
 config VHOST_USER
     bool
-    select VHOST
 
 config VHOST_VDPA
     bool
-    select VHOST
 
 config VHOST_KERNEL
     bool
-    select VHOST
 
 config VIRTFS
     bool
diff --git a/backends/meson.build b/backends/meson.build
index 535c3ca7dd..b1884a88ec 100644
--- a/backends/meson.build
+++ b/backends/meson.build
@@ -12,9 +12,13 @@ softmmu_ss.add([files(
 softmmu_ss.add(when: 'CONFIG_POSIX', if_true: files('rng-random.c'))
 softmmu_ss.add(when: 'CONFIG_POSIX', if_true: files('hostmem-file.c'))
 softmmu_ss.add(when: 'CONFIG_LINUX', if_true: files('hostmem-memfd.c'))
-softmmu_ss.add(when: ['CONFIG_VHOST_USER', 'CONFIG_VIRTIO'], if_true: files('vhost-user.c'))
+if have_vhost_user
+  softmmu_ss.add(when: 'CONFIG_VIRTIO', if_true: files('vhost-user.c'))
+endif
 softmmu_ss.add(when: 'CONFIG_VIRTIO_CRYPTO', if_true: files('cryptodev-vhost.c'))
-softmmu_ss.add(when: ['CONFIG_VIRTIO_CRYPTO', 'CONFIG_VHOST_CRYPTO'], if_true: files('cryptodev-vhost-user.c'))
+if have_vhost_user_crypto
+  softmmu_ss.add(when: 'CONFIG_VIRTIO_CRYPTO', if_true: files('cryptodev-vhost-user.c'))
+endif
 softmmu_ss.add(when: gio, if_true: files('dbus-vmstate.c'))
 softmmu_ss.add(when: 'CONFIG_SGX', if_true: files('hostmem-epc.c'))
 
diff --git a/hw/net/meson.build b/hw/net/meson.build
index 685b75badb..ebac261542 100644
--- a/hw/net/meson.build
+++ b/hw/net/meson.build
@@ -46,8 +46,12 @@ specific_ss.add(when: 'CONFIG_XILINX_ETHLITE', if_true: files('xilinx_ethlite.c'
 softmmu_ss.add(when: 'CONFIG_VIRTIO_NET', if_true: files('net_rx_pkt.c'))
 specific_ss.add(when: 'CONFIG_VIRTIO_NET', if_true: files('virtio-net.c'))
 
-softmmu_ss.add(when: ['CONFIG_VIRTIO_NET', 'CONFIG_VHOST_NET'], if_true: files('vhost_net.c'), if_false: files('vhost_net-stub.c'))
-softmmu_ss.add(when: 'CONFIG_ALL', if_true: files('vhost_net-stub.c'))
+if have_vhost_net
+  softmmu_ss.add(when: 'CONFIG_VIRTIO_NET', if_true: files('vhost_net.c'), if_false: files('vhost_net-stub.c'))
+  softmmu_ss.add(when: 'CONFIG_ALL', if_true: files('vhost_net-stub.c'))
+else
+  softmmu_ss.add(files('vhost_net-stub.c'))
+endif
 
 softmmu_ss.add(when: 'CONFIG_ETSEC', if_true: files(
   'fsl_etsec/etsec.c',
diff --git a/hw/virtio/Kconfig b/hw/virtio/Kconfig
index f8e235f814..e9ecae1f50 100644
--- a/hw/virtio/Kconfig
+++ b/hw/virtio/Kconfig
@@ -1,6 +1,3 @@
-config VHOST
-    bool
-
 config VIRTIO
     bool
 
diff --git a/hw/virtio/meson.build b/hw/virtio/meson.build
index f371404b04..7e8877fd64 100644
--- a/hw/virtio/meson.build
+++ b/hw/virtio/meson.build
@@ -2,18 +2,22 @@ softmmu_virtio_ss = ss.source_set()
 softmmu_virtio_ss.add(files('virtio-bus.c'))
 softmmu_virtio_ss.add(when: 'CONFIG_VIRTIO_PCI', if_true: files('virtio-pci.c'))
 softmmu_virtio_ss.add(when: 'CONFIG_VIRTIO_MMIO', if_true: files('virtio-mmio.c'))
-softmmu_virtio_ss.add(when: 'CONFIG_VHOST', if_false: files('vhost-stub.c'))
-
-softmmu_ss.add_all(when: 'CONFIG_VIRTIO', if_true: softmmu_virtio_ss)
-softmmu_ss.add(when: 'CONFIG_VIRTIO', if_false: files('vhost-stub.c'))
-
-softmmu_ss.add(when: 'CONFIG_ALL', if_true: files('vhost-stub.c'))
 
 virtio_ss = ss.source_set()
 virtio_ss.add(files('virtio.c'))
-virtio_ss.add(when: 'CONFIG_VHOST', if_true: files('vhost.c', 'vhost-backend.c', 'vhost-iova-tree.c'))
-virtio_ss.add(when: 'CONFIG_VHOST_USER', if_true: files('vhost-user.c'))
-virtio_ss.add(when: 'CONFIG_VHOST_VDPA', if_true: files('vhost-shadow-virtqueue.c', 'vhost-vdpa.c'))
+
+if have_vhost
+  virtio_ss.add(files('vhost.c', 'vhost-backend.c', 'vhost-iova-tree.c'))
+  if have_vhost_user
+    virtio_ss.add(files('vhost-user.c'))
+  endif
+  if have_vhost_vdpa
+    virtio_ss.add(files('vhost-vdpa.c', 'vhost-shadow-virtqueue.c'))
+  endif
+else
+  softmmu_virtio_ss.add(files('vhost-stub.c'))
+endif
+
 virtio_ss.add(when: 'CONFIG_VIRTIO_BALLOON', if_true: files('virtio-balloon.c'))
 virtio_ss.add(when: 'CONFIG_VIRTIO_CRYPTO', if_true: files('virtio-crypto.c'))
 virtio_ss.add(when: 'CONFIG_VHOST_USER_FS', if_true: files('vhost-user-fs.c'))
@@ -54,3 +58,6 @@ virtio_pci_ss.add(when: 'CONFIG_VIRTIO_MEM', if_true: files('virtio-mem-pci.c'))
 virtio_ss.add_all(when: 'CONFIG_VIRTIO_PCI', if_true: virtio_pci_ss)
 
 specific_ss.add_all(when: 'CONFIG_VIRTIO', if_true: virtio_ss)
+softmmu_ss.add_all(when: 'CONFIG_VIRTIO', if_true: softmmu_virtio_ss)
+softmmu_ss.add(when: 'CONFIG_VIRTIO', if_false: files('vhost-stub.c'))
+softmmu_ss.add(when: 'CONFIG_ALL', if_true: files('vhost-stub.c'))
diff --git a/meson.build b/meson.build
index 5b5eb442c4..e8446cf148 100644
--- a/meson.build
+++ b/meson.build
@@ -319,6 +319,7 @@ have_vhost_kernel = 'CONFIG_VHOST_KERNEL' in config_host
 have_vhost_net_user = 'CONFIG_VHOST_NET_USER' in config_host
 have_vhost_net_vdpa = 'CONFIG_VHOST_NET_VDPA' in config_host
 have_vhost_net = 'CONFIG_VHOST_NET' in config_host
+have_vhost = have_vhost_user or have_vhost_vdpa or have_vhost_kernel
 have_vhost_user_crypto = 'CONFIG_VHOST_CRYPTO' in config_host
 
 # Target-specific libraries and flags
diff --git a/net/meson.build b/net/meson.build
index 847bc2ac85..c965e83b26 100644
--- a/net/meson.build
+++ b/net/meson.build
@@ -26,10 +26,10 @@ softmmu_ss.add(when: vde, if_true: files('vde.c'))
 if have_netmap
   softmmu_ss.add(files('netmap.c'))
 endif
-vhost_user_ss = ss.source_set()
-vhost_user_ss.add(when: 'CONFIG_VIRTIO_NET', if_true: files('vhost-user.c'), if_false: files('vhost-user-stub.c'))
-softmmu_ss.add_all(when: 'CONFIG_VHOST_NET_USER', if_true: vhost_user_ss)
-softmmu_ss.add(when: 'CONFIG_ALL', if_true: files('vhost-user-stub.c'))
+if have_vhost_net_user
+  softmmu_ss.add(when: 'CONFIG_VIRTIO_NET', if_true: files('vhost-user.c'), if_false: files('vhost-user-stub.c'))
+  softmmu_ss.add(when: 'CONFIG_ALL', if_true: files('vhost-user-stub.c'))
+endif
 
 softmmu_ss.add(when: 'CONFIG_LINUX', if_true: files('tap-linux.c'))
 softmmu_ss.add(when: 'CONFIG_BSD', if_true: files('tap-bsd.c'))
@@ -40,6 +40,8 @@ if not config_host.has_key('CONFIG_LINUX') and not config_host.has_key('CONFIG_B
 endif
 softmmu_ss.add(when: 'CONFIG_POSIX', if_true: files(tap_posix))
 softmmu_ss.add(when: 'CONFIG_WIN32', if_true: files('tap-win32.c'))
-softmmu_ss.add(when: 'CONFIG_VHOST_NET_VDPA', if_true: files('vhost-vdpa.c'))
+if have_vhost_net_vdpa
+  softmmu_ss.add(files('vhost-vdpa.c'))
+endif
 
 subdir('can')
diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build
index 69f97b8992..2f2f08b442 100644
--- a/tests/qtest/meson.build
+++ b/tests/qtest/meson.build
@@ -272,7 +272,9 @@ qos_test_ss.add(
 if have_virtfs
   qos_test_ss.add(files('virtio-9p-test.c'))
 endif
-qos_test_ss.add(when: 'CONFIG_VHOST_USER', if_true: files('vhost-user-test.c'))
+if have_vhost_user
+  qos_test_ss.add(files('vhost-user-test.c'))
+endif
 if have_tools and have_vhost_user_blk_server
   qos_test_ss.add(files('vhost-user-blk-test.c'))
 endif
-- 
2.35.1




^ permalink raw reply related	[flat|nested] 74+ messages in thread

* [PATCH 34/34] configure, meson: move vhost options to Meson
  2022-04-20 15:33 [PATCH 00/34] Misc meson conversions for QEMU 7.1 Paolo Bonzini
                   ` (32 preceding siblings ...)
  2022-04-20 15:34 ` [PATCH 33/34] meson: use have_vhost_* variables to pick sources Paolo Bonzini
@ 2022-04-20 15:34 ` Paolo Bonzini
  2022-04-21 12:13   ` Marc-André Lureau
  33 siblings, 1 reply; 74+ messages in thread
From: Paolo Bonzini @ 2022-04-20 15:34 UTC (permalink / raw)
  To: qemu-devel

Finish the conversion by moving all the definitions and the constraint
checks to meson_options.txt and meson.build respectively.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 configure                     | 82 -----------------------------------
 meson.build                   | 33 +++++++++++---
 meson_options.txt             | 10 +++++
 scripts/meson-buildoptions.sh | 15 +++++++
 4 files changed, 51 insertions(+), 89 deletions(-)

diff --git a/configure b/configure
index 3b38ff3c63..0cedfcf5a9 100755
--- a/configure
+++ b/configure
@@ -282,11 +282,6 @@ EXTRA_CXXFLAGS=""
 EXTRA_OBJCFLAGS=""
 EXTRA_LDFLAGS=""
 
-vhost_kernel="$default_feature"
-vhost_net="$default_feature"
-vhost_crypto="$default_feature"
-vhost_user="no"
-vhost_vdpa="$default_feature"
 debug_tcg="no"
 sanitizers="no"
 tsan="no"
@@ -526,7 +521,6 @@ haiku)
 ;;
 linux)
   linux="yes"
-  vhost_user=${default_feature:-yes}
 ;;
 esac
 
@@ -863,14 +857,6 @@ for opt do
   ;;
   --with-coroutine=*) coroutine="$optarg"
   ;;
-  --disable-vhost-net) vhost_net="no"
-  ;;
-  --enable-vhost-net) vhost_net="yes"
-  ;;
-  --disable-vhost-crypto) vhost_crypto="no"
-  ;;
-  --enable-vhost-crypto) vhost_crypto="yes"
-  ;;
   --disable-zlib-test)
   ;;
   --disable-virtio-blk-data-plane|--enable-virtio-blk-data-plane)
@@ -882,18 +868,6 @@ for opt do
   --enable-uuid|--disable-uuid)
       echo "$0: $opt is obsolete, UUID support is always built" >&2
   ;;
-  --disable-vhost-user) vhost_user="no"
-  ;;
-  --enable-vhost-user) vhost_user="yes"
-  ;;
-  --disable-vhost-vdpa) vhost_vdpa="no"
-  ;;
-  --enable-vhost-vdpa) vhost_vdpa="yes"
-  ;;
-  --disable-vhost-kernel) vhost_kernel="no"
-  ;;
-  --enable-vhost-kernel) vhost_kernel="yes"
-  ;;
   --disable-capstone) capstone="disabled"
   ;;
   --enable-capstone) capstone="enabled"
@@ -1092,11 +1066,6 @@ cat << EOF
   debug-info      debugging information
   safe-stack      SafeStack Stack Smash Protection. Depends on
                   clang/llvm >= 3.7 and requires coroutine backend ucontext.
-  vhost-net       vhost-net kernel acceleration support
-  vhost-crypto    vhost-user-crypto backend support
-  vhost-kernel    vhost kernel backend support
-  vhost-user      vhost-user backend support
-  vhost-vdpa      vhost-vdpa kernel backend support
 
 NOTE: The object files are built at the place where configure is launched
 EOF
@@ -1510,35 +1479,6 @@ else
     exit 1
 fi
 
-#########################################
-# vhost interdependencies and host support
-
-# vhost backends
-if test "$vhost_user" = "yes" && test "$mingw32" = "yes"; then
-  error_exit "vhost-user is not available on Windows"
-fi
-test "$vhost_vdpa" = "" && vhost_vdpa=$linux
-if test "$vhost_vdpa" = "yes" && test "$linux" != "yes"; then
-  error_exit "vhost-vdpa is only available on Linux"
-fi
-test "$vhost_kernel" = "" && vhost_kernel=$linux
-if test "$vhost_kernel" = "yes" && test "$linux" != "yes"; then
-  error_exit "vhost-kernel is only available on Linux"
-fi
-
-# vhost-user backends
-test "$vhost_crypto" = "" && vhost_crypto=$vhost_user
-if test "$vhost_crypto" = "yes" && test "$vhost_user" = "no"; then
-  error_exit "--enable-vhost-crypto requires --enable-vhost-user"
-fi
-
-# OR the vhost-kernel, vhost-vdpa and vhost-user values for simplicity
-if test "$vhost_net" = ""; then
-  test "$vhost_user" = "yes" && vhost_net=yes
-  test "$vhost_vdpa" = "yes" && vhost_net=yes
-  test "$vhost_kernel" = "yes" && vhost_net=yes
-fi
-
 ##########################################
 # pkg-config probe
 
@@ -2058,28 +1998,6 @@ if test "$modules" = "yes"; then
   echo "CONFIG_MODULES=y" >> $config_host_mak
 fi
 
-if test "$vhost_net" = "yes" ; then
-  echo "CONFIG_VHOST_NET=y" >> $config_host_mak
-fi
-if test "$vhost_user" = "yes" ; then
-  echo "CONFIG_VHOST_NET_USER=y" >> $config_host_mak
-fi
-if test "$vhost_vdpa" = "yes" ; then
-  echo "CONFIG_VHOST_NET_VDPA=y" >> $config_host_mak
-fi
-if test "$vhost_crypto" = "yes" ; then
-  echo "CONFIG_VHOST_CRYPTO=y" >> $config_host_mak
-fi
-if test "$vhost_kernel" = "yes" ; then
-  echo "CONFIG_VHOST_KERNEL=y" >> $config_host_mak
-fi
-if test "$vhost_user" = "yes" ; then
-  echo "CONFIG_VHOST_USER=y" >> $config_host_mak
-fi
-if test "$vhost_vdpa" = "yes" ; then
-  echo "CONFIG_VHOST_VDPA=y" >> $config_host_mak
-fi
-
 # XXX: suppress that
 if [ "$bsd" = "yes" ] ; then
   echo "CONFIG_BSD=y" >> $config_host_mak
diff --git a/meson.build b/meson.build
index e8446cf148..499082bf55 100644
--- a/meson.build
+++ b/meson.build
@@ -313,14 +313,26 @@ have_tpm = get_option('tpm') \
   .allowed()
 
 # vhost
-have_vhost_user = 'CONFIG_VHOST_USER' in config_host
-have_vhost_vdpa = 'CONFIG_VHOST_VDPA' in config_host
-have_vhost_kernel = 'CONFIG_VHOST_KERNEL' in config_host
-have_vhost_net_user = 'CONFIG_VHOST_NET_USER' in config_host
-have_vhost_net_vdpa = 'CONFIG_VHOST_NET_VDPA' in config_host
-have_vhost_net = 'CONFIG_VHOST_NET' in config_host
+have_vhost_user = get_option('vhost_user') \
+  .disable_auto_if(targetos != 'linux') \
+  .require(targetos != 'windows',
+           error_message: 'vhost-user is not available on Windows').allowed()
+have_vhost_vdpa = get_option('vhost_vdpa') \
+  .require(targetos == 'linux',
+           error_message: 'vhost-vdpa is only available on Linux').allowed()
+have_vhost_kernel = get_option('vhost_kernel') \
+  .require(targetos == 'linux',
+           error_message: 'vhost-kernel is only available on Linux').allowed()
+have_vhost_user_crypto = get_option('vhost_crypto') \
+  .require(have_vhost_user,
+           error_message: 'vhost-crypto requires vhost-user to be enabled').allowed()
+
 have_vhost = have_vhost_user or have_vhost_vdpa or have_vhost_kernel
-have_vhost_user_crypto = 'CONFIG_VHOST_CRYPTO' in config_host
+
+have_vhost_net_user = have_vhost_user and get_option('vhost_net').allowed()
+have_vhost_net_vdpa = have_vhost_vdpa and get_option('vhost_net').allowed()
+have_vhost_net_kernel = have_vhost_kernel and get_option('vhost_net').allowed()
+have_vhost_net = have_vhost_net_kernel or have_vhost_net_user or have_vhost_net_vdpa
 
 # Target-specific libraries and flags
 libm = cc.find_library('m', required: false)
@@ -1709,6 +1721,13 @@ config_host_data.set('CONFIG_SNAPPY', snappy.found())
 config_host_data.set('CONFIG_TPM', have_tpm)
 config_host_data.set('CONFIG_USB_LIBUSB', libusb.found())
 config_host_data.set('CONFIG_VDE', vde.found())
+config_host_data.set('CONFIG_VHOST_NET', have_vhost_net)
+config_host_data.set('CONFIG_VHOST_NET_USER', have_vhost_net_user)
+config_host_data.set('CONFIG_VHOST_NET_VDPA', have_vhost_net_vdpa)
+config_host_data.set('CONFIG_VHOST_KERNEL', have_vhost_kernel)
+config_host_data.set('CONFIG_VHOST_USER', have_vhost_user)
+config_host_data.set('CONFIG_VHOST_CRYPTO', have_vhost_user_crypto)
+config_host_data.set('CONFIG_VHOST_VDPA', have_vhost_vdpa)
 config_host_data.set('CONFIG_VHOST_USER_BLK_SERVER', have_vhost_user_blk_server)
 config_host_data.set('CONFIG_VNC', vnc.found())
 config_host_data.set('CONFIG_VNC_JPEG', jpeg.found())
diff --git a/meson_options.txt b/meson_options.txt
index 8efd5f520c..24a2a593f0 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -235,6 +235,16 @@ option('oss', type: 'feature', value: 'auto',
 option('pa', type: 'feature', value: 'auto',
        description: 'PulseAudio sound support')
 
+option('vhost_kernel', type: 'feature', value: 'auto',
+       description: 'vhost kernel backend support')
+option('vhost_net', type: 'feature', value: 'auto',
+       description: 'vhost-net kernel acceleration support')
+option('vhost_user', type: 'feature', value: 'auto',
+       description: 'vhost-user backend support')
+option('vhost_crypto', type: 'feature', value: 'auto',
+       description: 'vhost-user crypto backend support')
+option('vhost_vdpa', type: 'feature', value: 'auto',
+       description: 'vhost-vdpa kernel backend support')
 option('vhost_user_blk_server', type: 'feature', value: 'auto',
        description: 'build vhost-user-blk server')
 option('virtfs', type: 'feature', value: 'auto',
diff --git a/scripts/meson-buildoptions.sh b/scripts/meson-buildoptions.sh
index 274639777e..28258e1478 100644
--- a/scripts/meson-buildoptions.sh
+++ b/scripts/meson-buildoptions.sh
@@ -153,8 +153,13 @@ meson_options_help() {
   printf "%s\n" '  usb-redir       libusbredir support'
   printf "%s\n" '  vde             vde network backend support'
   printf "%s\n" '  vdi             vdi image format support'
+  printf "%s\n" '  vhost-crypto    vhost-user crypto backend support'
+  printf "%s\n" '  vhost-kernel    vhost kernel backend support'
+  printf "%s\n" '  vhost-net       vhost-net kernel acceleration support'
+  printf "%s\n" '  vhost-user      vhost-user backend support'
   printf "%s\n" '  vhost-user-blk-server'
   printf "%s\n" '                  build vhost-user-blk server'
+  printf "%s\n" '  vhost-vdpa      vhost-vdpa kernel backend support'
   printf "%s\n" '  virglrenderer   virgl rendering support'
   printf "%s\n" '  virtfs          virtio-9p support'
   printf "%s\n" '  virtiofsd       build virtiofs daemon (virtiofsd)'
@@ -407,8 +412,18 @@ _meson_option_parse() {
     --disable-vde) printf "%s" -Dvde=disabled ;;
     --enable-vdi) printf "%s" -Dvdi=enabled ;;
     --disable-vdi) printf "%s" -Dvdi=disabled ;;
+    --enable-vhost-crypto) printf "%s" -Dvhost_crypto=enabled ;;
+    --disable-vhost-crypto) printf "%s" -Dvhost_crypto=disabled ;;
+    --enable-vhost-kernel) printf "%s" -Dvhost_kernel=enabled ;;
+    --disable-vhost-kernel) printf "%s" -Dvhost_kernel=disabled ;;
+    --enable-vhost-net) printf "%s" -Dvhost_net=enabled ;;
+    --disable-vhost-net) printf "%s" -Dvhost_net=disabled ;;
+    --enable-vhost-user) printf "%s" -Dvhost_user=enabled ;;
+    --disable-vhost-user) printf "%s" -Dvhost_user=disabled ;;
     --enable-vhost-user-blk-server) printf "%s" -Dvhost_user_blk_server=enabled ;;
     --disable-vhost-user-blk-server) printf "%s" -Dvhost_user_blk_server=disabled ;;
+    --enable-vhost-vdpa) printf "%s" -Dvhost_vdpa=enabled ;;
+    --disable-vhost-vdpa) printf "%s" -Dvhost_vdpa=disabled ;;
     --enable-virglrenderer) printf "%s" -Dvirglrenderer=enabled ;;
     --disable-virglrenderer) printf "%s" -Dvirglrenderer=disabled ;;
     --enable-virtfs) printf "%s" -Dvirtfs=enabled ;;
-- 
2.35.1



^ permalink raw reply related	[flat|nested] 74+ messages in thread

* Re: [PATCH 06/34] configure: move --enable/--disable-debug-info to second option parsing pass
  2022-04-20 15:33 ` [PATCH 06/34] configure: move --enable/--disable-debug-info to second option parsing pass Paolo Bonzini
@ 2022-04-20 15:42   ` Thomas Huth
  2022-04-20 16:08   ` Marc-André Lureau
  1 sibling, 0 replies; 74+ messages in thread
From: Thomas Huth @ 2022-04-20 15:42 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel

On 20/04/2022 17.33, Paolo Bonzini wrote:
> $debug_info is not needed anywhere except in the final meson invocation,
> no need to special case it.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>   configure | 14 +++++---------
>   1 file changed, 5 insertions(+), 9 deletions(-)
> 
> diff --git a/configure b/configure
> index 48ae18f47f..07053e7b27 100755
> --- a/configure
> +++ b/configure
> @@ -244,7 +244,6 @@ audio_drv_list="default"
>   block_drv_rw_whitelist=""
>   block_drv_ro_whitelist=""
>   host_cc="cc"
> -debug_info="yes"
>   lto="false"
>   stack_protector=""
>   safe_stack=""
> @@ -304,6 +303,7 @@ vhost_user_fs="$default_feature"
>   vhost_vdpa="$default_feature"
>   rdma="$default_feature"
>   pvrdma="$default_feature"
> +debug_info="yes"
>   debug_tcg="no"
>   debug="no"
>   sanitizers="no"
> @@ -379,10 +379,6 @@ for opt do
>     ;;
>     --extra-ldflags=*) EXTRA_LDFLAGS="$EXTRA_LDFLAGS $optarg"
>     ;;
> -  --enable-debug-info) debug_info="yes"
> -  ;;
> -  --disable-debug-info) debug_info="no"
> -  ;;
>     --cross-cc-*[!a-zA-Z0-9_-]*=*) error_exit "Passed bad --cross-cc-FOO option"
>     ;;
>     --cross-cc-cflags-*) cc_arch=${opt#--cross-cc-cflags-}; cc_arch=${cc_arch%%=*}
> @@ -759,12 +755,12 @@ for opt do
>     ;;
>     --extra-ldflags=*)
>     ;;
> -  --enable-debug-info)
> -  ;;
> -  --disable-debug-info)
> -  ;;
>     --cross-cc-*)
>     ;;
> +  --enable-debug-info) debug_info="yes"
> +  ;;
> +  --disable-debug-info) debug_info="no"
> +  ;;
>     --enable-modules)
>         modules="yes"
>     ;;

Reviewed-by: Thomas Huth <thuth@redhat.com>



^ permalink raw reply	[flat|nested] 74+ messages in thread

* Re: [PATCH 04/34] configure: pc-bios/qemu-icon.bmp does not exist
  2022-04-20 15:33 ` [PATCH 04/34] configure: pc-bios/qemu-icon.bmp does not exist Paolo Bonzini
@ 2022-04-20 15:47   ` Thomas Huth
  2022-04-20 16:05   ` Marc-André Lureau
  1 sibling, 0 replies; 74+ messages in thread
From: Thomas Huth @ 2022-04-20 15:47 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel; +Cc: Daniel P. Berrange, Gerd Hoffmann

On 20/04/2022 17.33, Paolo Bonzini wrote:
> The file has been removed in commit a8260d3876 ("ui: install logo icons to
> $prefix/share/icons", 2019-01-21), do not try to symlink it in the build tree.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>   configure | 1 -
>   1 file changed, 1 deletion(-)
> 
> diff --git a/configure b/configure
> index 2bc5a0b84f..7a89cb4123 100755
> --- a/configure
> +++ b/configure
> @@ -3020,7 +3020,6 @@ LINKS="Makefile"
>   LINKS="$LINKS tests/tcg/Makefile.target"
>   LINKS="$LINKS pc-bios/optionrom/Makefile"
>   LINKS="$LINKS pc-bios/s390-ccw/Makefile"
> -LINKS="$LINKS pc-bios/qemu-icon.bmp"
>   LINKS="$LINKS .gdbinit scripts" # scripts needed by relative path in .gdbinit
>   LINKS="$LINKS tests/avocado tests/data"
>   LINKS="$LINKS tests/qemu-iotests/check"

Reviewed-by: Thomas Huth <thuth@redhat.com>



^ permalink raw reply	[flat|nested] 74+ messages in thread

* Re: [PATCH 03/34] qga: wixl: get path to sysroot from pkg-config as intended
  2022-04-20 15:33 ` [PATCH 03/34] qga: wixl: get path to sysroot from pkg-config as intended Paolo Bonzini
@ 2022-04-20 15:47   ` Marc-André Lureau
  2022-04-21 14:18   ` Konstantin Kostiuk
  1 sibling, 0 replies; 74+ messages in thread
From: Marc-André Lureau @ 2022-04-20 15:47 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: QEMU

[-- Attachment #1: Type: text/plain, Size: 2199 bytes --]

On Wed, Apr 20, 2022 at 7:37 PM Paolo Bonzini <pbonzini@redhat.com> wrote:

> The .wxs file uses $(var.Mingw_bin) while configure/meson have always
> used Mingw_dlls.  Fix them to match what was probably intended.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>


> ---
>  configure       | 4 ++--
>  qga/meson.build | 2 +-
>  2 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/configure b/configure
> index 2fc860ed9a..2bc5a0b84f 100755
> --- a/configure
> +++ b/configure
> @@ -2702,7 +2702,7 @@ if test "$QEMU_GA_VERSION" = ""; then
>      QEMU_GA_VERSION=$(cat $source_path/VERSION)
>  fi
>
> -QEMU_GA_MSI_MINGW_DLL_PATH="$($pkg_config --variable=prefix glib-2.0)/bin"
> +QEMU_GA_MSI_MINGW_BIN_PATH="$($pkg_config --variable=prefix glib-2.0)/bin"
>
>  # Mac OS X ships with a broken assembler
>  roms=
> @@ -2790,7 +2790,7 @@ if test "$debug_tcg" = "yes" ; then
>  fi
>  if test "$mingw32" = "yes" ; then
>    echo "CONFIG_WIN32=y" >> $config_host_mak
> -  echo "QEMU_GA_MSI_MINGW_DLL_PATH=${QEMU_GA_MSI_MINGW_DLL_PATH}" >>
> $config_host_mak
> +  echo "QEMU_GA_MSI_MINGW_BIN_PATH=${QEMU_GA_MSI_MINGW_BIN_PATH}" >>
> $config_host_mak
>    echo "QEMU_GA_MANUFACTURER=${QEMU_GA_MANUFACTURER}" >> $config_host_mak
>    echo "QEMU_GA_DISTRO=${QEMU_GA_DISTRO}" >> $config_host_mak
>    echo "QEMU_GA_VERSION=${QEMU_GA_VERSION}" >> $config_host_mak
> diff --git a/qga/meson.build b/qga/meson.build
> index 392d560941..6d9f39bb32 100644
> --- a/qga/meson.build
> +++ b/qga/meson.build
> @@ -129,7 +129,7 @@ if targetos == 'windows'
>                                wixl, '-o', '@OUTPUT0@', '@INPUT0@',
>                                qemu_ga_msi_arch[cpu],
>                                qemu_ga_msi_vss,
> -                              '-D', 'Mingw_dlls=' +
> config_host['QEMU_GA_MSI_MINGW_DLL_PATH'],
> +                              '-D', 'Mingw_bin=' +
> config_host['QEMU_GA_MSI_MINGW_BIN_PATH'],
>                              ])
>      all_qga += [qga_msi]
>      alias_target('msi', qga_msi)
> --
> 2.35.1
>
>
>
>

-- 
Marc-André Lureau

[-- Attachment #2: Type: text/html, Size: 3334 bytes --]

^ permalink raw reply	[flat|nested] 74+ messages in thread

* Re: [PATCH 01/34] meson: show final set of compiler flags
  2022-04-20 15:33 ` [PATCH 01/34] meson: show final set of compiler flags Paolo Bonzini
@ 2022-04-20 15:57   ` Marc-André Lureau
  0 siblings, 0 replies; 74+ messages in thread
From: Marc-André Lureau @ 2022-04-20 15:57 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: QEMU

[-- Attachment #1: Type: text/plain, Size: 1579 bytes --]

On Wed, Apr 20, 2022 at 7:38 PM Paolo Bonzini <pbonzini@redhat.com> wrote:

> The actual set of compiler flags can grow beyond what is found by the
> configure
> script, for example if gprof is used.  Show the full set in the summary.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>


> ---
>  meson.build | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/meson.build b/meson.build
> index 6ba60950c8..cf3b1b39cf 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -3521,10 +3521,10 @@ link_args = get_option(link_language +
> '_link_args')
>  if link_args.length() > 0
>    summary_info += {'LDFLAGS':         ' '.join(link_args)}
>  endif
> -summary_info += {'QEMU_CFLAGS':       config_host['QEMU_CFLAGS']}
> -summary_info += {'QEMU_CXXFLAGS':     config_host['QEMU_CXXFLAGS']}
> -summary_info += {'QEMU_OBJCFLAGS':    config_host['QEMU_OBJCFLAGS']}
> -summary_info += {'QEMU_LDFLAGS':      config_host['QEMU_LDFLAGS']}
> +summary_info += {'QEMU_CFLAGS':       ' '.join(qemu_cflags)}
> +summary_info += {'QEMU_CXXFLAGS':     ' '.join(qemu_cxxflags)}
> +summary_info += {'QEMU_OBJCFLAGS':    ' '.join(qemu_objcflags)}
> +summary_info += {'QEMU_LDFLAGS':      ' '.join(qemu_ldflags)}
>  summary_info += {'profiler':          get_option('profiler')}
>  summary_info += {'link-time optimization (LTO)': get_option('b_lto')}
>  summary_info += {'PIE':               get_option('b_pie')}
> --
> 2.35.1
>
>
>
>

-- 
Marc-André Lureau

[-- Attachment #2: Type: text/html, Size: 2550 bytes --]

^ permalink raw reply	[flat|nested] 74+ messages in thread

* Re: [PATCH 02/34] configure: remove dead code
  2022-04-20 15:33 ` [PATCH 02/34] configure: remove dead code Paolo Bonzini
@ 2022-04-20 16:04   ` Marc-André Lureau
  0 siblings, 0 replies; 74+ messages in thread
From: Marc-André Lureau @ 2022-04-20 16:04 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: QEMU

[-- Attachment #1: Type: text/plain, Size: 3058 bytes --]

On Wed, Apr 20, 2022 at 7:45 PM Paolo Bonzini <pbonzini@redhat.com> wrote:

> tcg_interpreter is never written, it is purely a meson option;
> trace_backends is never read.
>
> And SeaBIOS is only build from the source tree with roms/Makefile,
> so the config.mak file is unused.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>


oh, that could easily be splitted, but looks good to me:

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>



> ---
>  configure | 24 ------------------------
>  1 file changed, 24 deletions(-)
>
> diff --git a/configure b/configure
> index 7c08c18358..2fc860ed9a 100755
> --- a/configure
> +++ b/configure
> @@ -320,7 +320,6 @@ linux_user=""
>  bsd_user=""
>  pkgversion=""
>  pie=""
> -trace_backends="log"
>  trace_file="trace"
>  opengl="$default_feature"
>  coroutine=""
> @@ -391,7 +390,6 @@ for opt do
>                        cross_cc_vars="$cross_cc_vars
> cross_cc_cflags_${cc_arch}"
>    ;;
>    --cross-cc-*) cc_arch=${opt#--cross-cc-}; cc_arch=${cc_arch%%=*}
> -                cc_archs="$cc_archs $cc_arch"
>                  eval "cross_cc_${cc_arch}=\$optarg"
>                  cross_cc_vars="$cross_cc_vars cross_cc_${cc_arch}"
>    ;;
> @@ -2881,9 +2879,6 @@ fi
>  if test "$vhost_user_fs" = "yes" ; then
>    echo "CONFIG_VHOST_USER_FS=y" >> $config_host_mak
>  fi
> -if test "$tcg" = "enabled" -a "$tcg_interpreter" = "true" ; then
> -  echo "CONFIG_TCG_INTERPRETER=y" >> $config_host_mak
> -fi
>
>  if test "$opengl" = "yes" ; then
>    echo "CONFIG_OPENGL=y" >> $config_host_mak
> @@ -3025,7 +3020,6 @@ LINKS="Makefile"
>  LINKS="$LINKS tests/tcg/Makefile.target"
>  LINKS="$LINKS pc-bios/optionrom/Makefile"
>  LINKS="$LINKS pc-bios/s390-ccw/Makefile"
> -LINKS="$LINKS roms/seabios/Makefile"
>  LINKS="$LINKS pc-bios/qemu-icon.bmp"
>  LINKS="$LINKS .gdbinit scripts" # scripts needed by relative path in
> .gdbinit
>  LINKS="$LINKS tests/avocado tests/data"
> @@ -3060,24 +3054,6 @@ done
>  export target_list source_path use_containers cpu
>  $source_path/tests/tcg/configure.sh)
>
> -# temporary config to build submodules
> -if test -f $source_path/roms/seabios/Makefile; then
> -  for rom in seabios; do
> -    config_mak=roms/$rom/config.mak
> -    echo "# Automatically generated by configure - do not modify" >
> $config_mak
> -    echo "SRC_PATH=$source_path/roms/$rom" >> $config_mak
> -    echo "AS=$as" >> $config_mak
> -    echo "CCAS=$ccas" >> $config_mak
> -    echo "CC=$cc" >> $config_mak
> -    echo "BCC=bcc" >> $config_mak
> -    echo "CPP=$cpp" >> $config_mak
> -    echo "OBJCOPY=objcopy" >> $config_mak
> -    echo "IASL=$iasl" >> $config_mak
> -    echo "LD=$ld" >> $config_mak
> -    echo "RANLIB=$ranlib" >> $config_mak
> -  done
> -fi
> -
>  config_mak=pc-bios/optionrom/config.mak
>  echo "# Automatically generated by configure - do not modify" >
> $config_mak
>  echo "TOPSRC_DIR=$source_path" >> $config_mak
> --
> 2.35.1
>
>
>
>

-- 
Marc-André Lureau

[-- Attachment #2: Type: text/html, Size: 4540 bytes --]

^ permalink raw reply	[flat|nested] 74+ messages in thread

* Re: [PATCH 04/34] configure: pc-bios/qemu-icon.bmp does not exist
  2022-04-20 15:33 ` [PATCH 04/34] configure: pc-bios/qemu-icon.bmp does not exist Paolo Bonzini
  2022-04-20 15:47   ` Thomas Huth
@ 2022-04-20 16:05   ` Marc-André Lureau
  1 sibling, 0 replies; 74+ messages in thread
From: Marc-André Lureau @ 2022-04-20 16:05 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: QEMU

[-- Attachment #1: Type: text/plain, Size: 996 bytes --]

On Wed, Apr 20, 2022 at 7:44 PM Paolo Bonzini <pbonzini@redhat.com> wrote:

> The file has been removed in commit a8260d3876 ("ui: install logo icons to
> $prefix/share/icons", 2019-01-21), do not try to symlink it in the build
> tree.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>


> ---
>  configure | 1 -
>  1 file changed, 1 deletion(-)
>
> diff --git a/configure b/configure
> index 2bc5a0b84f..7a89cb4123 100755
> --- a/configure
> +++ b/configure
> @@ -3020,7 +3020,6 @@ LINKS="Makefile"
>  LINKS="$LINKS tests/tcg/Makefile.target"
>  LINKS="$LINKS pc-bios/optionrom/Makefile"
>  LINKS="$LINKS pc-bios/s390-ccw/Makefile"
> -LINKS="$LINKS pc-bios/qemu-icon.bmp"
>  LINKS="$LINKS .gdbinit scripts" # scripts needed by relative path in
> .gdbinit
>  LINKS="$LINKS tests/avocado tests/data"
>  LINKS="$LINKS tests/qemu-iotests/check"
> --
> 2.35.1
>
>
>
>

-- 
Marc-André Lureau

[-- Attachment #2: Type: text/html, Size: 1808 bytes --]

^ permalink raw reply	[flat|nested] 74+ messages in thread

* Re: [PATCH 05/34] configure: gcov should not exclude fortify-source
  2022-04-20 15:33 ` [PATCH 05/34] configure: gcov should not exclude fortify-source Paolo Bonzini
@ 2022-04-20 16:06   ` Marc-André Lureau
  0 siblings, 0 replies; 74+ messages in thread
From: Marc-André Lureau @ 2022-04-20 16:06 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: QEMU

[-- Attachment #1: Type: text/plain, Size: 912 bytes --]

On Wed, Apr 20, 2022 at 7:49 PM Paolo Bonzini <pbonzini@redhat.com> wrote:

> There is no reason other than history (dating back to commit 1d728c3946,
> "tests: add gcov
> support", 2013-01-06) for this, remove this unnecessary conditional.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>


> ---
>  configure | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/configure b/configure
> index 7a89cb4123..48ae18f47f 100755
> --- a/configure
> +++ b/configure
> @@ -2625,9 +2625,7 @@ fi
>
>  write_c_skeleton
>
> -if test "$gcov" = "yes" ; then
> -  :
> -elif test "$fortify_source" = "yes" ; then
> +if test "$fortify_source" = "yes" ; then
>    QEMU_CFLAGS="-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $QEMU_CFLAGS"
>    debug=no
>  fi
> --
> 2.35.1
>
>
>
>

-- 
Marc-André Lureau

[-- Attachment #2: Type: text/html, Size: 1726 bytes --]

^ permalink raw reply	[flat|nested] 74+ messages in thread

* Re: [PATCH 06/34] configure: move --enable/--disable-debug-info to second option parsing pass
  2022-04-20 15:33 ` [PATCH 06/34] configure: move --enable/--disable-debug-info to second option parsing pass Paolo Bonzini
  2022-04-20 15:42   ` Thomas Huth
@ 2022-04-20 16:08   ` Marc-André Lureau
  1 sibling, 0 replies; 74+ messages in thread
From: Marc-André Lureau @ 2022-04-20 16:08 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: QEMU

[-- Attachment #1: Type: text/plain, Size: 1756 bytes --]

On Wed, Apr 20, 2022 at 7:40 PM Paolo Bonzini <pbonzini@redhat.com> wrote:

> $debug_info is not needed anywhere except in the final meson invocation,
> no need to special case it.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>


> ---
>  configure | 14 +++++---------
>  1 file changed, 5 insertions(+), 9 deletions(-)
>
> diff --git a/configure b/configure
> index 48ae18f47f..07053e7b27 100755
> --- a/configure
> +++ b/configure
> @@ -244,7 +244,6 @@ audio_drv_list="default"
>  block_drv_rw_whitelist=""
>  block_drv_ro_whitelist=""
>  host_cc="cc"
> -debug_info="yes"
>  lto="false"
>  stack_protector=""
>  safe_stack=""
> @@ -304,6 +303,7 @@ vhost_user_fs="$default_feature"
>  vhost_vdpa="$default_feature"
>  rdma="$default_feature"
>  pvrdma="$default_feature"
> +debug_info="yes"
>  debug_tcg="no"
>  debug="no"
>  sanitizers="no"
> @@ -379,10 +379,6 @@ for opt do
>    ;;
>    --extra-ldflags=*) EXTRA_LDFLAGS="$EXTRA_LDFLAGS $optarg"
>    ;;
> -  --enable-debug-info) debug_info="yes"
> -  ;;
> -  --disable-debug-info) debug_info="no"
> -  ;;
>    --cross-cc-*[!a-zA-Z0-9_-]*=*) error_exit "Passed bad --cross-cc-FOO
> option"
>    ;;
>    --cross-cc-cflags-*) cc_arch=${opt#--cross-cc-cflags-};
> cc_arch=${cc_arch%%=*}
> @@ -759,12 +755,12 @@ for opt do
>    ;;
>    --extra-ldflags=*)
>    ;;
> -  --enable-debug-info)
> -  ;;
> -  --disable-debug-info)
> -  ;;
>    --cross-cc-*)
>    ;;
> +  --enable-debug-info) debug_info="yes"
> +  ;;
> +  --disable-debug-info) debug_info="no"
> +  ;;
>    --enable-modules)
>        modules="yes"
>    ;;
> --
> 2.35.1
>
>
>
>

-- 
Marc-André Lureau

[-- Attachment #2: Type: text/html, Size: 2828 bytes --]

^ permalink raw reply	[flat|nested] 74+ messages in thread

* Re: [PATCH 07/34] configure, meson: move OpenGL check to meson
  2022-04-20 15:33 ` [PATCH 07/34] configure, meson: move OpenGL check to meson Paolo Bonzini
@ 2022-04-20 16:13   ` Marc-André Lureau
  2022-04-20 19:17     ` Paolo Bonzini
  0 siblings, 1 reply; 74+ messages in thread
From: Marc-André Lureau @ 2022-04-20 16:13 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: QEMU

[-- Attachment #1: Type: text/plain, Size: 9696 bytes --]

Hi

On Wed, Apr 20, 2022 at 7:52 PM Paolo Bonzini <pbonzini@redhat.com> wrote:

> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  configure                     | 40 -----------------------------------
>  meson.build                   | 16 +++++++++-----
>  meson_options.txt             |  2 ++
>  scripts/meson-buildoptions.sh |  3 +++
>  ui/meson.build                | 17 ++++++++-------
>  5 files changed, 25 insertions(+), 53 deletions(-)
>
> diff --git a/configure b/configure
> index 07053e7b27..c9be6eb04d 100755
> --- a/configure
> +++ b/configure
> @@ -321,7 +321,6 @@ bsd_user=""
>  pkgversion=""
>  pie=""
>  trace_file="trace"
> -opengl="$default_feature"
>  coroutine=""
>  tls_priority="NORMAL"
>  plugins="$default_feature"
> @@ -960,10 +959,6 @@ for opt do
>    ;;
>    --enable-vhost-user-fs) vhost_user_fs="yes"
>    ;;
> -  --disable-opengl) opengl="no"
> -  ;;
> -  --enable-opengl) opengl="yes"
> -  ;;
>    --disable-zlib-test)
>    ;;
>    --disable-virtio-blk-data-plane|--enable-virtio-blk-data-plane)
> @@ -1258,7 +1253,6 @@ cat << EOF
>    vhost-kernel    vhost kernel backend support
>    vhost-user      vhost-user backend support
>    vhost-vdpa      vhost-vdpa kernel backend support
> -  opengl          opengl support
>    gio             libgio support
>
>  NOTE: The object files are built at the place where configure is launched
> @@ -2278,34 +2272,6 @@ case "$fdt" in
>  esac
>
>  ##########################################
> -# opengl probe (for sdl2, gtk)
> -
> -if test "$opengl" != "no" ; then
> -  epoxy=no
> -  if $pkg_config epoxy; then
> -    cat > $TMPC << EOF
> -#include <epoxy/egl.h>
> -int main(void) { return 0; }
> -EOF
> -    if compile_prog "" "" ; then
> -      epoxy=yes
> -    fi
> -  fi
> -
> -  if test "$epoxy" = "yes" ; then
> -    opengl_cflags="$($pkg_config --cflags epoxy)"
> -    opengl_libs="$($pkg_config --libs epoxy)"
> -    opengl=yes
> -  else
> -    if test "$opengl" = "yes" ; then
> -      feature_not_found "opengl" "Please install epoxy with EGL"
> -    fi
> -    opengl_cflags=""
> -    opengl_libs=""
> -    opengl=no
> -  fi
> -fi
> -
>  # check for usbfs
>  have_usbfs=no
>  if test "$linux_user" = "yes"; then
> @@ -2874,12 +2840,6 @@ if test "$vhost_user_fs" = "yes" ; then
>    echo "CONFIG_VHOST_USER_FS=y" >> $config_host_mak
>  fi
>
> -if test "$opengl" = "yes" ; then
> -  echo "CONFIG_OPENGL=y" >> $config_host_mak
> -  echo "OPENGL_CFLAGS=$opengl_cflags" >> $config_host_mak
> -  echo "OPENGL_LIBS=$opengl_libs" >> $config_host_mak
> -fi
> -
>  # XXX: suppress that
>  if [ "$bsd" = "yes" ] ; then
>    echo "CONFIG_BSD=y" >> $config_host_mak
> diff --git a/meson.build b/meson.build
> index cf3b1b39cf..f53fd66716 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -1000,9 +1000,14 @@ if not get_option('coreaudio').auto() or (targetos
> == 'darwin' and have_system)
>  endif
>
>  opengl = not_found
> -if 'CONFIG_OPENGL' in config_host
> -  opengl = declare_dependency(compile_args:
> config_host['OPENGL_CFLAGS'].split(),
> -                              link_args:
> config_host['OPENGL_LIBS'].split())
> +if not get_option('opengl').auto() or have_system or have_vhost_user_gpu
> +  epoxy = dependency('epoxy', method: 'pkg-config',
> +                      required: get_option('opengl'), kwargs:
> static_kwargs)
> +  if cc.has_header('epoxy/egl.h', dependencies: epoxy)
> +    opengl = epoxy
> +  elif get_option('opengl').enabled()
> +    error('epoxy/egl.h not found')
> +  endif
>  endif
>  gbm = not_found
>  if (have_system or have_tools) and (virgl.found() or opengl.found())
> @@ -1544,6 +1549,7 @@ config_host_data.set('CONFIG_LINUX_AIO',
> libaio.found())
>  config_host_data.set('CONFIG_LINUX_IO_URING', linux_io_uring.found())
>  config_host_data.set('CONFIG_LIBPMEM', libpmem.found())
>  config_host_data.set('CONFIG_NUMA', numa.found())
> +config_host_data.set('CONFIG_OPENGL', opengl.found())
>  config_host_data.set('CONFIG_PROFILER', get_option('profiler'))
>  config_host_data.set('CONFIG_RBD', rbd.found())
>  config_host_data.set('CONFIG_SDL', sdl.found())
> @@ -2079,7 +2085,7 @@ host_kconfig = \
>    (have_tpm ? ['CONFIG_TPM=y'] : []) + \
>    (spice.found() ? ['CONFIG_SPICE=y'] : []) + \
>    (have_ivshmem ? ['CONFIG_IVSHMEM=y'] : []) + \
> -  ('CONFIG_OPENGL' in config_host ? ['CONFIG_OPENGL=y'] : []) + \
> +  (opengl.found() ? ['CONFIG_OPENGL=y'] : []) + \
>    (x11.found() ? ['CONFIG_X11=y'] : []) + \
>    ('CONFIG_VHOST_USER' in config_host ? ['CONFIG_VHOST_USER=y'] : []) + \
>    ('CONFIG_VHOST_VDPA' in config_host ? ['CONFIG_VHOST_VDPA=y'] : []) + \
> @@ -3694,7 +3700,7 @@ summary_info += {'smartcard support': cacard}
>  summary_info += {'U2F support':       u2f}
>  summary_info += {'libusb':            libusb}
>  summary_info += {'usb net redir':     usbredir}
> -summary_info += {'OpenGL support':
> config_host.has_key('CONFIG_OPENGL')}
> +summary_info += {'OpenGL support (epoxy)': opengl}
>  summary_info += {'GBM':               gbm}
>  summary_info += {'libiscsi support':  libiscsi}
>  summary_info += {'libnfs support':    libnfs}
> diff --git a/meson_options.txt b/meson_options.txt
> index 52b11cead4..bd8efe4fbf 100644
> --- a/meson_options.txt
> +++ b/meson_options.txt
> @@ -149,6 +149,8 @@ option('lzo', type : 'feature', value : 'auto',
>         description: 'lzo compression support')
>  option('rbd', type : 'feature', value : 'auto',
>         description: 'Ceph block device driver')
> +option('opengl', type : 'feature', value : 'auto',
> +       description: 'OpenGL support')
>  option('gtk', type : 'feature', value : 'auto',
>         description: 'GTK+ user interface')
>  option('sdl', type : 'feature', value : 'auto',
> diff --git a/scripts/meson-buildoptions.sh b/scripts/meson-buildoptions.sh
> index 1e26f4571e..f91bd9231b 100644
> --- a/scripts/meson-buildoptions.sh
> +++ b/scripts/meson-buildoptions.sh
> @@ -91,6 +91,7 @@ meson_options_help() {
>    printf "%s\n" '  nettle          nettle cryptography support'
>    printf "%s\n" '  numa            libnuma support'
>    printf "%s\n" '  nvmm            NVMM acceleration support'
> +  printf "%s\n" '  opengl          OpenGL support'
>    printf "%s\n" '  oss             OSS sound support'
>    printf "%s\n" '  pa              PulseAudio sound support'
>    printf "%s\n" '  parallels       parallels image format support'
> @@ -271,6 +272,8 @@ _meson_option_parse() {
>      --disable-numa) printf "%s" -Dnuma=disabled ;;
>      --enable-nvmm) printf "%s" -Dnvmm=enabled ;;
>      --disable-nvmm) printf "%s" -Dnvmm=disabled ;;
> +    --enable-opengl) printf "%s" -Dopengl=enabled ;;
> +    --disable-opengl) printf "%s" -Dopengl=disabled ;;
>      --enable-oss) printf "%s" -Doss=enabled ;;
>      --disable-oss) printf "%s" -Doss=disabled ;;
>      --enable-pa) printf "%s" -Dpa=enabled ;;
> diff --git a/ui/meson.build b/ui/meson.build
> index 64286ba150..b21d3d1534 100644
> --- a/ui/meson.build
> +++ b/ui/meson.build
> @@ -1,5 +1,6 @@
>  softmmu_ss.add(pixman)
>  specific_ss.add(when: ['CONFIG_SOFTMMU'], if_true: pixman)   # for the
> include path
> +specific_ss.add(when: ['CONFIG_SOFTMMU'], if_true: opengl)   # for the
> include path
>
>  softmmu_ss.add(files(
>    'clipboard.c',
> @@ -43,7 +44,6 @@ vnc_ss.add(zlib, png, jpeg, gnutls)
>  vnc_ss.add(when: sasl, if_true: files('vnc-auth-sasl.c'))
>  softmmu_ss.add_all(when: vnc, if_true: vnc_ss)
>  softmmu_ss.add(when: vnc, if_false: files('vnc-stubs.c'))
> -specific_ss.add(when: ['CONFIG_SOFTMMU'], if_true: opengl)
>
>  ui_modules = {}
>
> @@ -53,17 +53,18 @@ if curses.found()
>    ui_modules += {'curses' : curses_ss}
>  endif
>
> -if config_host.has_key('CONFIG_OPENGL')
> +softmmu_ss.add(opengl)
>

I guess this line is superfluous


> +if opengl.found()
>    opengl_ss = ss.source_set()
>    opengl_ss.add(gbm)
> -  opengl_ss.add(when: [opengl, pixman, 'CONFIG_OPENGL'],
> +  opengl_ss.add(when: [opengl, pixman],
>                 if_true: files('shader.c', 'console-gl.c',
> 'egl-helpers.c', 'egl-context.c'))
>    ui_modules += {'opengl' : opengl_ss}
>  endif
>
> -if config_host.has_key('CONFIG_OPENGL') and gbm.found()
> +if opengl.found() and gbm.found()
>    egl_headless_ss = ss.source_set()
> -  egl_headless_ss.add(when: [opengl, gbm, pixman, 'CONFIG_OPENGL'],
> +  egl_headless_ss.add(when: [opengl, gbm, pixman],
>                        if_true: files('egl-headless.c'))
>    ui_modules += {'egl-headless' : egl_headless_ss}
>  endif
> @@ -98,8 +99,8 @@ if gtk.found()
>    gtk_ss = ss.source_set()
>    gtk_ss.add(gtk, vte, pixman, files('gtk.c', 'gtk-clipboard.c'))
>    gtk_ss.add(when: x11, if_true: files('x_keymap.c'))
> -  gtk_ss.add(when: [opengl, 'CONFIG_OPENGL'], if_true:
> files('gtk-gl-area.c'))
> -  gtk_ss.add(when: [x11, opengl, 'CONFIG_OPENGL'], if_true:
> files('gtk-egl.c'))
> +  gtk_ss.add(when: opengl, if_true: files('gtk-gl-area.c'))
> +  gtk_ss.add(when: [x11, opengl], if_true: files('gtk-egl.c'))
>    ui_modules += {'gtk' : gtk_ss}
>  endif
>
> @@ -112,7 +113,7 @@ if sdl.found()
>      'sdl2-input.c',
>      'sdl2.c',
>    ))
> -  sdl_ss.add(when: [opengl, 'CONFIG_OPENGL'], if_true: files('sdl2-gl.c'))
> +  sdl_ss.add(when: opengl, if_true: files('sdl2-gl.c'))
>    sdl_ss.add(when: x11, if_true: files('x_keymap.c'))
>    ui_modules += {'sdl' : sdl_ss}
>  endif
> --
> 2.35.1
>
>
>
>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>

-- 
Marc-André Lureau

[-- Attachment #2: Type: text/html, Size: 12661 bytes --]

^ permalink raw reply	[flat|nested] 74+ messages in thread

* Re: [PATCH 08/34] meson, configure: move RDMA options to meson
  2022-04-20 15:33 ` [PATCH 08/34] meson, configure: move RDMA options " Paolo Bonzini
@ 2022-04-20 16:24   ` Marc-André Lureau
  0 siblings, 0 replies; 74+ messages in thread
From: Marc-André Lureau @ 2022-04-20 16:24 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: QEMU

[-- Attachment #1: Type: text/plain, Size: 13306 bytes --]

On Wed, Apr 20, 2022 at 7:55 PM Paolo Bonzini <pbonzini@redhat.com> wrote:

> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>

lgtm
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>


> ---
>  configure                      | 115 ---------------------------------
>  contrib/rdmacm-mux/meson.build |   4 +-
>  meson.build                    |  56 ++++++++++++++--
>  meson_options.txt              |   4 ++
>  migration/meson.build          |   2 +-
>  scripts/meson-buildoptions.sh  |   6 ++
>  6 files changed, 62 insertions(+), 125 deletions(-)
>
> diff --git a/configure b/configure
> index c9be6eb04d..cfd15c3518 100755
> --- a/configure
> +++ b/configure
> @@ -301,8 +301,6 @@ vhost_vsock="$default_feature"
>  vhost_user="no"
>  vhost_user_fs="$default_feature"
>  vhost_vdpa="$default_feature"
> -rdma="$default_feature"
> -pvrdma="$default_feature"
>  debug_info="yes"
>  debug_tcg="no"
>  debug="no"
> @@ -972,14 +970,6 @@ for opt do
>    ;;
>    --tls-priority=*) tls_priority="$optarg"
>    ;;
> -  --enable-rdma) rdma="yes"
> -  ;;
> -  --disable-rdma) rdma="no"
> -  ;;
> -  --enable-pvrdma) pvrdma="yes"
> -  ;;
> -  --disable-pvrdma) pvrdma="no"
> -  ;;
>    --disable-vhost-user) vhost_user="no"
>    ;;
>    --enable-vhost-user) vhost_user="yes"
> @@ -1244,8 +1234,6 @@ cat << EOF
>    lto             Enable Link-Time Optimization.
>    safe-stack      SafeStack Stack Smash Protection. Depends on
>                    clang/llvm >= 3.7 and requires coroutine backend
> ucontext.
> -  rdma            Enable RDMA-based migration
> -  pvrdma          Enable PVRDMA support
>    vhost-net       vhost-net kernel acceleration support
>    vhost-vsock     virtio sockets device support
>    vhost-scsi      vhost-scsi kernel target support
> @@ -2037,100 +2025,6 @@ EOF
>    fi
>  fi
>
> -##########################################
> -# RDMA needs OpenFabrics libraries
> -if test "$rdma" != "no" ; then
> -  cat > $TMPC <<EOF
> -#include <rdma/rdma_cma.h>
> -int main(void) { return 0; }
> -EOF
> -  rdma_libs="-lrdmacm -libverbs -libumad"
> -  if compile_prog "" "$rdma_libs" ; then
> -    rdma="yes"
> -  else
> -    if test "$rdma" = "yes" ; then
> -        error_exit \
> -            " OpenFabrics librdmacm/libibverbs/libibumad not present." \
> -            " Your options:" \
> -            "  (1) Fast: Install infiniband packages (devel) from your
> distro." \
> -            "  (2) Cleanest: Install libraries from www.openfabrics.org"
> \
> -            "  (3) Also: Install softiwarp if you don't have RDMA
> hardware"
> -    fi
> -    rdma="no"
> -  fi
> -fi
> -
> -##########################################
> -# PVRDMA detection
> -
> -cat > $TMPC <<EOF &&
> -#include <sys/mman.h>
> -
> -int
> -main(void)
> -{
> -    char buf = 0;
> -    void *addr = &buf;
> -    addr = mremap(addr, 0, 1, MREMAP_MAYMOVE | MREMAP_FIXED);
> -
> -    return 0;
> -}
> -EOF
> -
> -if test "$rdma" = "yes" ; then
> -    case "$pvrdma" in
> -    "")
> -        if compile_prog "" ""; then
> -            pvrdma="yes"
> -        else
> -            pvrdma="no"
> -        fi
> -        ;;
> -    "yes")
> -        if ! compile_prog "" ""; then
> -            error_exit "PVRDMA is not supported since mremap is not
> implemented"
> -        fi
> -        pvrdma="yes"
> -        ;;
> -    "no")
> -        pvrdma="no"
> -        ;;
> -    esac
> -else
> -    if test "$pvrdma" = "yes" ; then
> -        error_exit "PVRDMA requires rdma suppport"
> -    fi
> -    pvrdma="no"
> -fi
> -
> -# Let's see if enhanced reg_mr is supported
> -if test "$pvrdma" = "yes" ; then
> -
> -cat > $TMPC <<EOF &&
> -#include <infiniband/verbs.h>
> -
> -int
> -main(void)
> -{
> -    struct ibv_mr *mr;
> -    struct ibv_pd *pd = NULL;
> -    size_t length = 10;
> -    uint64_t iova = 0;
> -    int access = 0;
> -    void *addr = NULL;
> -
> -    mr = ibv_reg_mr_iova(pd, addr, length, iova, access);
> -
> -    ibv_dereg_mr(mr);
> -
> -    return 0;
> -}
> -EOF
> -    if ! compile_prog "" "-libverbs"; then
> -        QEMU_CFLAGS="$QEMU_CFLAGS -DLEGACY_RDMA_REG_MR"
> -    fi
> -fi
> -
>  ##########################################
>  # glib support probe
>
> @@ -2855,15 +2749,6 @@ if test "$have_tsan" = "yes" && test
> "$have_tsan_iface_fiber" = "yes" ; then
>      echo "CONFIG_TSAN=y" >> $config_host_mak
>  fi
>
> -if test "$rdma" = "yes" ; then
> -  echo "CONFIG_RDMA=y" >> $config_host_mak
> -  echo "RDMA_LIBS=$rdma_libs" >> $config_host_mak
> -fi
> -
> -if test "$pvrdma" = "yes" ; then
> -  echo "CONFIG_PVRDMA=y" >> $config_host_mak
> -fi
> -
>  if test "$plugins" = "yes" ; then
>      echo "CONFIG_PLUGIN=y" >> $config_host_mak
>  fi
> diff --git a/contrib/rdmacm-mux/meson.build
> b/contrib/rdmacm-mux/meson.build
> index 7674f54cc5..36c9c89630 100644
> --- a/contrib/rdmacm-mux/meson.build
> +++ b/contrib/rdmacm-mux/meson.build
> @@ -1,7 +1,5 @@
> -if 'CONFIG_PVRDMA' in config_host
> -  # if not found, CONFIG_PVRDMA should not be set
> +if have_pvrdma
>    # FIXME: broken on big endian architectures
> -  libumad = cc.find_library('ibumad', required: true)
>    executable('rdmacm-mux', files('main.c'), genh,
>               dependencies: [glib, libumad],
>               build_by_default: false,
> diff --git a/meson.build b/meson.build
> index f53fd66716..bdee186702 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -1217,9 +1217,22 @@ if numa.found() and not cc.links('''
>  endif
>
>  rdma = not_found
> -if 'CONFIG_RDMA' in config_host
> -  rdma = declare_dependency(link_args: config_host['RDMA_LIBS'].split())
> +if not get_option('rdma').auto() or have_system
> +  libumad = cc.find_library('ibumad', required: get_option('rdma'))
> +  rdma_libs = [cc.find_library('rdmacm', has_headers: ['rdma/rdma_cma.h'],
> +                               required: get_option('rdma'),
> +                               kwargs: static_kwargs),
> +               cc.find_library('ibverbs', required: get_option('rdma'),
> +                               kwargs: static_kwargs),
> +               libumad]
> +  rdma = declare_dependency(dependencies: rdma_libs)
> +  foreach lib: rdma_libs
> +    if not lib.found()
> +      rdma = not_found
> +    endif
> +  endforeach
>  endif
> +
>  xen = not_found
>  if 'CONFIG_XEN_BACKEND' in config_host
>    xen = declare_dependency(compile_args:
> config_host['XEN_CFLAGS'].split(),
> @@ -1552,6 +1565,7 @@ config_host_data.set('CONFIG_NUMA', numa.found())
>  config_host_data.set('CONFIG_OPENGL', opengl.found())
>  config_host_data.set('CONFIG_PROFILER', get_option('profiler'))
>  config_host_data.set('CONFIG_RBD', rbd.found())
> +config_host_data.set('CONFIG_RDMA', rdma.found())
>  config_host_data.set('CONFIG_SDL', sdl.found())
>  config_host_data.set('CONFIG_SDL_IMAGE', sdl_image.found())
>  config_host_data.set('CONFIG_SECCOMP', seccomp.found())
> @@ -1650,7 +1664,7 @@ config_host_data.set('HAVE_SYSTEM_FUNCTION',
> cc.has_function('system', prefix: '
>  if rdma.found()
>    config_host_data.set('HAVE_IBV_ADVISE_MR',
>                         cc.has_function('ibv_advise_mr',
> -                                       args:
> config_host['RDMA_LIBS'].split(),
> +                                       dependencies: rdma,
>                                         prefix: '#include
> <infiniband/verbs.h>'))
>  endif
>
> @@ -1970,6 +1984,36 @@ config_host_data.set('CONFIG_AVX512F_OPT',
> get_option('avx512f') \
>      int main(int argc, char *argv[]) { return bar(argv[0]); }
>    '''), error_message: 'AVX512F not available').allowed())
>
> +have_pvrdma = get_option('pvrdma') \
> +  .require(rdma.found(), error_message: 'PVRDMA requires OpenFabrics
> libraries') \
> +  .require(cc.compiles('''
> +    int main(void)
> +    {
> +      char buf = 0;
> +      void *addr = &buf;
> +      addr = mremap(addr, 0, 1, MREMAP_MAYMOVE | MREMAP_FIXED);
> +
> +      return 0;
> +    }'''), error_message: 'PVRDMA requires mremap').allowed()
> +
> +if have_pvrdma
> +  config_host_data.set('LEGACY_RDMA_REG_MR', not cc.compiles('''
> +    #include <infiniband/verbs.h>
> +    int main(void)
> +    {
> +      struct ibv_mr *mr;
> +      struct ibv_pd *pd = NULL;
> +      size_t length = 10;
> +      uint64_t iova = 0;
> +      int access = 0;
> +      void *addr = NULL;
> +
> +      mr = ibv_reg_mr_iova(pd, addr, length, iova, access);
> +      ibv_dereg_mr(mr);
> +      return 0;
> +    }'''))
> +endif
> +
>  if get_option('membarrier').disabled()
>    have_membarrier = false
>  elif targetos == 'windows'
> @@ -2092,7 +2136,7 @@ host_kconfig = \
>    ('CONFIG_VHOST_KERNEL' in config_host ? ['CONFIG_VHOST_KERNEL=y'] : [])
> + \
>    (have_virtfs ? ['CONFIG_VIRTFS=y'] : []) + \
>    ('CONFIG_LINUX' in config_host ? ['CONFIG_LINUX=y'] : []) + \
> -  ('CONFIG_PVRDMA' in config_host ? ['CONFIG_PVRDMA=y'] : []) + \
> +  (have_pvrdma ? ['CONFIG_PVRDMA=y'] : []) + \
>    (multiprocess_allowed ? ['CONFIG_MULTIPROCESS_ALLOWED=y'] : [])
>
>  ignored = [ 'TARGET_XML_FILES', 'TARGET_ABI_DIR', 'TARGET_ARCH' ]
> @@ -3686,8 +3730,8 @@ summary_info += {'l2tpv3 support':    have_l2tpv3}
>  summary_info += {'Linux AIO support': libaio}
>  summary_info += {'Linux io_uring support': linux_io_uring}
>  summary_info += {'ATTR/XATTR support': libattr}
> -summary_info += {'RDMA support':      config_host.has_key('CONFIG_RDMA')}
> -summary_info += {'PVRDMA support':
> config_host.has_key('CONFIG_PVRDMA')}
> +summary_info += {'RDMA support':      rdma}
> +summary_info += {'PVRDMA support':    have_pvrdma}
>  summary_info += {'fdt support':       fdt_opt == 'disabled' ? false :
> fdt_opt}
>  summary_info += {'libcap-ng support': libcap_ng}
>  summary_info += {'bpf support':       libbpf}
> diff --git a/meson_options.txt b/meson_options.txt
> index bd8efe4fbf..c00e0866e9 100644
> --- a/meson_options.txt
> +++ b/meson_options.txt
> @@ -151,6 +151,10 @@ option('rbd', type : 'feature', value : 'auto',
>         description: 'Ceph block device driver')
>  option('opengl', type : 'feature', value : 'auto',
>         description: 'OpenGL support')
> +option('rdma', type : 'feature', value : 'auto',
> +       description: 'Enable RDMA-based migration')
> +option('pvrdma', type : 'feature', value : 'auto',
> +       description: 'Enable PVRDMA support')
>  option('gtk', type : 'feature', value : 'auto',
>         description: 'GTK+ user interface')
>  option('sdl', type : 'feature', value : 'auto',
> diff --git a/migration/meson.build b/migration/meson.build
> index 8b5ca5c047..6880b61b10 100644
> --- a/migration/meson.build
> +++ b/migration/meson.build
> @@ -27,7 +27,7 @@ softmmu_ss.add(files(
>    'tls.c',
>  ), gnutls)
>
> -softmmu_ss.add(when: ['CONFIG_RDMA', rdma], if_true: files('rdma.c'))
> +softmmu_ss.add(when: rdma, if_true: files('rdma.c'))
>  if get_option('live_block_migration').allowed()
>    softmmu_ss.add(files('block.c'))
>  endif
> diff --git a/scripts/meson-buildoptions.sh b/scripts/meson-buildoptions.sh
> index f91bd9231b..cd922614e8 100644
> --- a/scripts/meson-buildoptions.sh
> +++ b/scripts/meson-buildoptions.sh
> @@ -95,10 +95,12 @@ meson_options_help() {
>    printf "%s\n" '  oss             OSS sound support'
>    printf "%s\n" '  pa              PulseAudio sound support'
>    printf "%s\n" '  parallels       parallels image format support'
> +  printf "%s\n" '  pvrdma          Enable PVRDMA support'
>    printf "%s\n" '  qcow1           qcow1 image format support'
>    printf "%s\n" '  qed             qed image format support'
>    printf "%s\n" '  qga-vss         build QGA VSS support (broken with
> MinGW)'
>    printf "%s\n" '  rbd             Ceph block device driver'
> +  printf "%s\n" '  rdma            Enable RDMA-based migration'
>    printf "%s\n" '  replication     replication support'
>    printf "%s\n" '  sdl             SDL user interface'
>    printf "%s\n" '  sdl-image       SDL Image support for icons'
> @@ -282,6 +284,8 @@ _meson_option_parse() {
>      --disable-parallels) printf "%s" -Dparallels=disabled ;;
>      --enable-profiler) printf "%s" -Dprofiler=true ;;
>      --disable-profiler) printf "%s" -Dprofiler=false ;;
> +    --enable-pvrdma) printf "%s" -Dpvrdma=enabled ;;
> +    --disable-pvrdma) printf "%s" -Dpvrdma=disabled ;;
>      --enable-qcow1) printf "%s" -Dqcow1=enabled ;;
>      --disable-qcow1) printf "%s" -Dqcow1=disabled ;;
>      --enable-qed) printf "%s" -Dqed=enabled ;;
> @@ -292,6 +296,8 @@ _meson_option_parse() {
>      --disable-qom-cast-debug) printf "%s" -Dqom_cast_debug=false ;;
>      --enable-rbd) printf "%s" -Drbd=enabled ;;
>      --disable-rbd) printf "%s" -Drbd=disabled ;;
> +    --enable-rdma) printf "%s" -Drdma=enabled ;;
> +    --disable-rdma) printf "%s" -Drdma=disabled ;;
>      --enable-replication) printf "%s" -Dreplication=enabled ;;
>      --disable-replication) printf "%s" -Dreplication=disabled ;;
>      --enable-rng-none) printf "%s" -Drng_none=true ;;
> --
> 2.35.1
>
>
>
>

-- 
Marc-André Lureau

[-- Attachment #2: Type: text/html, Size: 17528 bytes --]

^ permalink raw reply	[flat|nested] 74+ messages in thread

* Re: [PATCH 09/34] meson, configure: move keyctl test to meson
  2022-04-20 15:33 ` [PATCH 09/34] meson, configure: move keyctl test " Paolo Bonzini
@ 2022-04-20 16:27   ` Marc-André Lureau
  0 siblings, 0 replies; 74+ messages in thread
From: Marc-André Lureau @ 2022-04-20 16:27 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: QEMU

[-- Attachment #1: Type: text/plain, Size: 6165 bytes --]

On Wed, Apr 20, 2022 at 7:43 PM Paolo Bonzini <pbonzini@redhat.com> wrote:

> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>


> ---
>  configure                     | 44 -----------------------------------
>  crypto/meson.build            |  4 +++-
>  meson.build                   | 15 +++++++++++-
>  meson_options.txt             |  2 ++
>  scripts/meson-buildoptions.sh |  3 +++
>  5 files changed, 22 insertions(+), 46 deletions(-)
>
> diff --git a/configure b/configure
> index cfd15c3518..1c74d2c5f2 100755
> --- a/configure
> +++ b/configure
> @@ -322,7 +322,6 @@ trace_file="trace"
>  coroutine=""
>  tls_priority="NORMAL"
>  plugins="$default_feature"
> -secret_keyring="$default_feature"
>  meson=""
>  meson_args=""
>  ninja=""
> @@ -1009,10 +1008,6 @@ for opt do
>    ;;
>    --gdb=*) gdb_bin="$optarg"
>    ;;
> -  --enable-keyring) secret_keyring="yes"
> -  ;;
> -  --disable-keyring) secret_keyring="no"
> -  ;;
>    --enable-gio) gio=yes
>    ;;
>    --disable-gio) gio=no
> @@ -2440,41 +2435,6 @@ case "$slirp" in
>      ;;
>  esac
>
> -##########################################
> -# check for usable __NR_keyctl syscall
> -
> -if test "$linux" = "yes" ; then
> -
> -    have_keyring=no
> -    cat > $TMPC << EOF
> -#include <errno.h>
> -#include <asm/unistd.h>
> -#include <linux/keyctl.h>
> -#include <unistd.h>
> -int main(void) {
> -    return syscall(__NR_keyctl, KEYCTL_READ, 0, NULL, NULL, 0);
> -}
> -EOF
> -    if compile_prog "" "" ; then
> -        have_keyring=yes
> -    fi
> -fi
> -if test "$secret_keyring" != "no"
> -then
> -    if test "$have_keyring" = "yes"
> -    then
> -       secret_keyring=yes
> -    else
> -       if test "$secret_keyring" = "yes"
> -       then
> -           error_exit "syscall __NR_keyctl requested, \
> -but not implemented on your system"
> -       else
> -           secret_keyring=no
> -       fi
> -    fi
> -fi
> -
>  ##########################################
>  # End of CC checks
>  # After here, no more $cc or $ld runs
> @@ -2760,10 +2720,6 @@ if test -n "$gdb_bin"; then
>      fi
>  fi
>
> -if test "$secret_keyring" = "yes" ; then
> -  echo "CONFIG_SECRET_KEYRING=y" >> $config_host_mak
> -fi
> -
>  echo "ROMS=$roms" >> $config_host_mak
>  echo "MAKE=$make" >> $config_host_mak
>  echo "PYTHON=$python" >> $config_host_mak
> diff --git a/crypto/meson.build b/crypto/meson.build
> index 19c44bea89..f065f2f277 100644
> --- a/crypto/meson.build
> +++ b/crypto/meson.build
> @@ -34,7 +34,9 @@ else
>    crypto_ss.add(files('hash-glib.c', 'hmac-glib.c', 'pbkdf-stub.c'))
>  endif
>
> -crypto_ss.add(when: 'CONFIG_SECRET_KEYRING', if_true:
> files('secret_keyring.c'))
> +if have_keyring
> +  crypto_ss.add(files('secret_keyring.c'))
> +endif
>  if have_afalg
>    crypto_ss.add(if_true: files('afalg.c', 'cipher-afalg.c',
> 'hash-afalg.c'))
>  endif
> diff --git a/meson.build b/meson.build
> index bdee186702..066bb69174 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -1938,6 +1938,19 @@ config_host_data.set('CONFIG_GETAUXVAL',
> cc.links(gnu_source_prefix + '''
>      return getauxval(AT_HWCAP) == 0;
>    }'''))
>
> +have_keyring = get_option('keyring') \
> +  .require(targetos == 'linux', error_message: 'keyring is only available
> on Linux') \
> +  .require(cc.compiles('''
> +    #include <errno.h>
> +    #include <asm/unistd.h>
> +    #include <linux/keyctl.h>
> +    #include <sys/syscall.h>
> +    #include <unistd.h>
> +    int main(void) {
> +        return syscall(__NR_keyctl, KEYCTL_READ, 0, NULL, NULL, 0);
> +    }'''), error_message: 'keyctl syscall not available on this
> system').allowed()
> +config_host_data.set('CONFIG_SECRET_KEYRING', have_keyring)
> +
>  have_cpuid_h = cc.links('''
>    #include <cpuid.h>
>    int main(void) {
> @@ -3684,7 +3697,7 @@ if nettle.found()
>  endif
>  summary_info += {'AF_ALG support':    have_afalg}
>  summary_info += {'rng-none':          get_option('rng_none')}
> -summary_info += {'Linux keyring':
>  config_host.has_key('CONFIG_SECRET_KEYRING')}
> +summary_info += {'Linux keyring':     have_keyring}
>  summary(summary_info, bool_yn: true, section: 'Crypto')
>
>  # Libraries
> diff --git a/meson_options.txt b/meson_options.txt
> index c00e0866e9..d58c69315c 100644
> --- a/meson_options.txt
> +++ b/meson_options.txt
> @@ -90,6 +90,8 @@ option('avx2', type: 'feature', value: 'auto',
>         description: 'AVX2 optimizations')
>  option('avx512f', type: 'feature', value: 'disabled',
>         description: 'AVX512F optimizations')
> +option('keyring', type: 'feature', value: 'auto',
> +       description: 'Linux keyring support')
>
>  option('attr', type : 'feature', value : 'auto',
>         description: 'attr/xattr support')
> diff --git a/scripts/meson-buildoptions.sh b/scripts/meson-buildoptions.sh
> index cd922614e8..0daeb11fd3 100644
> --- a/scripts/meson-buildoptions.sh
> +++ b/scripts/meson-buildoptions.sh
> @@ -68,6 +68,7 @@ meson_options_help() {
>    printf "%s\n" '  hvf             HVF acceleration support'
>    printf "%s\n" '  iconv           Font glyph conversion support'
>    printf "%s\n" '  jack            JACK sound support'
> +  printf "%s\n" '  keyring         Linux keyring support'
>    printf "%s\n" '  kvm             KVM acceleration support'
>    printf "%s\n" '  l2tpv3          l2tpv3 network backend support'
>    printf "%s\n" '  libdaxctl       libdaxctl support'
> @@ -229,6 +230,8 @@ _meson_option_parse() {
>      --disable-install-blobs) printf "%s" -Dinstall_blobs=false ;;
>      --enable-jack) printf "%s" -Djack=enabled ;;
>      --disable-jack) printf "%s" -Djack=disabled ;;
> +    --enable-keyring) printf "%s" -Dkeyring=enabled ;;
> +    --disable-keyring) printf "%s" -Dkeyring=disabled ;;
>      --enable-kvm) printf "%s" -Dkvm=enabled ;;
>      --disable-kvm) printf "%s" -Dkvm=disabled ;;
>      --enable-l2tpv3) printf "%s" -Dl2tpv3=enabled ;;
> --
> 2.35.1
>
>
>
>

-- 
Marc-André Lureau

[-- Attachment #2: Type: text/html, Size: 8422 bytes --]

^ permalink raw reply	[flat|nested] 74+ messages in thread

* Re: [PATCH 10/34] meson, configure: move usbfs test to meson
  2022-04-20 15:33 ` [PATCH 10/34] meson, configure: move usbfs " Paolo Bonzini
@ 2022-04-20 16:35   ` Marc-André Lureau
  0 siblings, 0 replies; 74+ messages in thread
From: Marc-André Lureau @ 2022-04-20 16:35 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: QEMU

[-- Attachment #1: Type: text/plain, Size: 2611 bytes --]

On Wed, Apr 20, 2022 at 7:46 PM Paolo Bonzini <pbonzini@redhat.com> wrote:

> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>


> ---
>  configure   | 28 ----------------------------
>  meson.build | 13 +++++++++++++
>  2 files changed, 13 insertions(+), 28 deletions(-)
>
> diff --git a/configure b/configure
> index 1c74d2c5f2..d4d7c001f6 100755
> --- a/configure
> +++ b/configure
> @@ -2160,31 +2160,6 @@ case "$fdt" in
>      ;;
>  esac
>
> -##########################################
> -# check for usbfs
> -have_usbfs=no
> -if test "$linux_user" = "yes"; then
> -  cat > $TMPC << EOF
> -#include <linux/usbdevice_fs.h>
> -
> -#ifndef USBDEVFS_GET_CAPABILITIES
> -#error "USBDEVFS_GET_CAPABILITIES undefined"
> -#endif
> -
> -#ifndef USBDEVFS_DISCONNECT_CLAIM
> -#error "USBDEVFS_DISCONNECT_CLAIM undefined"
> -#endif
> -
> -int main(void)
> -{
> -    return 0;
> -}
> -EOF
> -  if compile_prog "" ""; then
> -    have_usbfs=yes
> -  fi
> -fi
> -
>  ##########################################
>  # capstone
>
> @@ -2641,9 +2616,6 @@ fi
>  if test "$module_upgrades" = "yes"; then
>    echo "CONFIG_MODULE_UPGRADES=y" >> $config_host_mak
>  fi
> -if test "$have_usbfs" = "yes" ; then
> -  echo "CONFIG_USBFS=y" >> $config_host_mak
> -fi
>  if test "$gio" = "yes" ; then
>      echo "CONFIG_GIO=y" >> $config_host_mak
>      echo "GIO_CFLAGS=$gio_cflags" >> $config_host_mak
> diff --git a/meson.build b/meson.build
> index 066bb69174..c0b2838d2e 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -1938,6 +1938,19 @@ config_host_data.set('CONFIG_GETAUXVAL',
> cc.links(gnu_source_prefix + '''
>      return getauxval(AT_HWCAP) == 0;
>    }'''))
>
> +config_host_data.set('CONFIG_USBFS', have_linux_user and cc.compiles('''
> +  #include <linux/usbdevice_fs.h>
> +
> +  #ifndef USBDEVFS_GET_CAPABILITIES
> +  #error "USBDEVFS_GET_CAPABILITIES undefined"
> +  #endif
> +
> +  #ifndef USBDEVFS_DISCONNECT_CLAIM
> +  #error "USBDEVFS_DISCONNECT_CLAIM undefined"
> +  #endif
> +
> +  int main(void) { return 0; }'''))
>


We could use cc.has_header_symbol(). Alternatively, drop the symbol checks?
They were added in Linux 3.6... (commit
0837e7e5270bd5547ba5763f11611dc43f677b3d &
19181bc50e1b8e92a7a3b3d78637c6dc5c0b5a1b)


> +
>  have_keyring = get_option('keyring') \
>    .require(targetos == 'linux', error_message: 'keyring is only available
> on Linux') \
>    .require(cc.compiles('''
> --
> 2.35.1
>
>
>
>

-- 
Marc-André Lureau

[-- Attachment #2: Type: text/html, Size: 3998 bytes --]

^ permalink raw reply	[flat|nested] 74+ messages in thread

* Re: [PATCH 11/34] meson, configure: move libgio test to meson
  2022-04-20 15:33 ` [PATCH 11/34] meson, configure: move libgio " Paolo Bonzini
@ 2022-04-20 16:40   ` Marc-André Lureau
  0 siblings, 0 replies; 74+ messages in thread
From: Marc-André Lureau @ 2022-04-20 16:40 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: QEMU

[-- Attachment #1: Type: text/plain, Size: 12601 bytes --]

On Wed, Apr 20, 2022 at 7:49 PM Paolo Bonzini <pbonzini@redhat.com> wrote:

> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>


> ---
>  backends/meson.build          |  2 +-
>  configure                     | 58 -----------------------------------
>  meson.build                   | 32 ++++++++++++++++---
>  meson_options.txt             |  2 ++
>  scripts/meson-buildoptions.sh |  3 ++
>  tests/qtest/meson.build       |  5 ++-
>  ui/meson.build                |  7 ++---
>  util/meson.build              |  2 +-
>  8 files changed, 39 insertions(+), 72 deletions(-)
>
> diff --git a/backends/meson.build b/backends/meson.build
> index 6e68945528..535c3ca7dd 100644
> --- a/backends/meson.build
> +++ b/backends/meson.build
> @@ -15,7 +15,7 @@ softmmu_ss.add(when: 'CONFIG_LINUX', if_true:
> files('hostmem-memfd.c'))
>  softmmu_ss.add(when: ['CONFIG_VHOST_USER', 'CONFIG_VIRTIO'], if_true:
> files('vhost-user.c'))
>  softmmu_ss.add(when: 'CONFIG_VIRTIO_CRYPTO', if_true:
> files('cryptodev-vhost.c'))
>  softmmu_ss.add(when: ['CONFIG_VIRTIO_CRYPTO', 'CONFIG_VHOST_CRYPTO'],
> if_true: files('cryptodev-vhost-user.c'))
> -softmmu_ss.add(when: 'CONFIG_GIO', if_true: [files('dbus-vmstate.c'),
> gio])
> +softmmu_ss.add(when: gio, if_true: files('dbus-vmstate.c'))
>  softmmu_ss.add(when: 'CONFIG_SGX', if_true: files('hostmem-epc.c'))
>
>  subdir('tpm')
> diff --git a/configure b/configure
> index d4d7c001f6..75e8b1e7aa 100755
> --- a/configure
> +++ b/configure
> @@ -325,7 +325,6 @@ plugins="$default_feature"
>  meson=""
>  meson_args=""
>  ninja=""
> -gio="$default_feature"
>  skip_meson=no
>
>  # The following Meson options are handled manually (still they
> @@ -1008,10 +1007,6 @@ for opt do
>    ;;
>    --gdb=*) gdb_bin="$optarg"
>    ;;
> -  --enable-gio) gio=yes
> -  ;;
> -  --disable-gio) gio=no
> -  ;;
>    # backwards compatibility options
>    --enable-trace-backend=*) meson_option_parse
> "--enable-trace-backends=$optarg" "$optarg"
>    ;;
> @@ -1236,7 +1231,6 @@ cat << EOF
>    vhost-kernel    vhost kernel backend support
>    vhost-user      vhost-user backend support
>    vhost-vdpa      vhost-vdpa kernel backend support
> -  gio             libgio support
>
>  NOTE: The object files are built at the place where configure is launched
>  EOF
> @@ -2047,50 +2041,6 @@ if test "$static" = yes && test "$mingw32" = yes;
> then
>      glib_cflags="-DGLIB_STATIC_COMPILATION $glib_cflags"
>  fi
>
> -if ! test "$gio" = "no"; then
> -    pass=no
> -    if $pkg_config --atleast-version=$glib_req_ver gio-2.0; then
> -        gio_cflags=$($pkg_config --cflags gio-2.0)
> -        gio_libs=$($pkg_config --libs gio-2.0)
> -        gdbus_codegen=$($pkg_config --variable=gdbus_codegen gio-2.0)
> -        if ! has "$gdbus_codegen"; then
> -            gdbus_codegen=
> -        fi
> -        # Check that the libraries actually work -- Ubuntu 18.04 ships
> -        # with pkg-config --static --libs data for gio-2.0 that is missing
> -        # -lblkid and will give a link error.
> -        cat > $TMPC <<EOF
> -#include <gio/gio.h>
> -int main(void)
> -{
> -    g_dbus_proxy_new_sync(0, 0, 0, 0, 0, 0, 0, 0);
> -    return 0;
> -}
> -EOF
> -        if compile_prog "$gio_cflags" "$gio_libs" ; then
> -            pass=yes
> -        else
> -            pass=no
> -        fi
> -
> -        if test "$pass" = "yes" &&
> -            $pkg_config --atleast-version=$glib_req_ver gio-unix-2.0; then
> -            gio_cflags="$gio_cflags $($pkg_config --cflags gio-unix-2.0)"
> -            gio_libs="$gio_libs $($pkg_config --libs gio-unix-2.0)"
> -        fi
> -    fi
> -
> -    if test "$pass" = "no"; then
> -        if test "$gio" = "yes"; then
> -            feature_not_found "gio" "Install libgio >= 2.0"
> -        else
> -            gio=no
> -        fi
> -    else
> -        gio=yes
> -    fi
> -fi
> -
>  # Sanity check that the current size_t matches the
>  # size that glib thinks it should be. This catches
>  # problems on multi-arch where people try to build
> @@ -2616,14 +2566,6 @@ fi
>  if test "$module_upgrades" = "yes"; then
>    echo "CONFIG_MODULE_UPGRADES=y" >> $config_host_mak
>  fi
> -if test "$gio" = "yes" ; then
> -    echo "CONFIG_GIO=y" >> $config_host_mak
> -    echo "GIO_CFLAGS=$gio_cflags" >> $config_host_mak
> -    echo "GIO_LIBS=$gio_libs" >> $config_host_mak
> -fi
> -if test "$gdbus_codegen" != "" ; then
> -    echo "GDBUS_CODEGEN=$gdbus_codegen" >> $config_host_mak
> -fi
>  echo "CONFIG_TLS_PRIORITY=\"$tls_priority\"" >> $config_host_mak
>
>  if test "$xen" = "enabled" ; then
> diff --git a/meson.build b/meson.build
> index c0b2838d2e..b8046efcf1 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -448,11 +448,32 @@ glib = declare_dependency(compile_args:
> config_host['GLIB_CFLAGS'].split(),
>  meson.override_dependency('glib-2.0', glib)
>
>  gio = not_found
> -if 'CONFIG_GIO' in config_host
> -  gio = declare_dependency(compile_args:
> config_host['GIO_CFLAGS'].split(),
> -                           link_args: config_host['GIO_LIBS'].split(),
> -                           version: config_host['GLIB_VERSION'])
> +gdbus_codegen = not_found
> +if not get_option('gio').auto() or have_system
> +  gio = dependency('gio-2.0', required: get_option('gio'),
> +                   method: 'pkg-config', kwargs: static_kwargs)
> +  if gio.found() and not cc.links('''
> +    #include <gio/gio.h>
> +    int main(void)
> +    {
> +      g_dbus_proxy_new_sync(0, 0, 0, 0, 0, 0, 0, 0);
> +      return 0;
> +    }''', dependencies: [glib, gio])
> +    if get_option('gio').enabled()
> +      error('The installed libgio is broken for static linking')
> +    endif
> +    gio = not_found
> +  endif
> +  if gio.found()
> +    gdbus_codegen = find_program(gio.get_variable('gdbus_codegen'),
> +                                 required: get_option('gio'))
> +    gio_unix = dependency('gio-unix-2.0', required: get_option('gio'),
> +                          method: 'pkg-config', kwargs: static_kwargs)
> +    gio = declare_dependency(dependencies: [gio, gio_unix],
> +                             version: gio.version())
> +  endif
>  endif
> +
>  lttng = not_found
>  if 'ust' in get_option('trace_backends')
>    lttng = dependency('lttng-ust', required: true, version: '>= 2.1',
> @@ -1478,7 +1499,7 @@ dbus_display = get_option('dbus_display') \
>             error_message: '-display dbus requires glib>=2.64') \
>    .require(enable_modules,
>             error_message: '-display dbus requires --enable-modules') \
> -  .require(config_host.has_key('GDBUS_CODEGEN'),
> +  .require(gdbus_codegen.found(),
>             error_message: '-display dbus requires gdbus-codegen') \
>    .allowed()
>
> @@ -1540,6 +1561,7 @@ config_host_data.set('CONFIG_MPATH_NEW_API',
> mpathpersist_new_api)
>  config_host_data.set('CONFIG_CURL', curl.found())
>  config_host_data.set('CONFIG_CURSES', curses.found())
>  config_host_data.set('CONFIG_GBM', gbm.found())
> +config_host_data.set('CONFIG_GIO', gio.found())
>  config_host_data.set('CONFIG_GLUSTERFS', glusterfs.found())
>  if glusterfs.found()
>    config_host_data.set('CONFIG_GLUSTERFS_XLATOR_OPT',
> glusterfs.version().version_compare('>=4'))
> diff --git a/meson_options.txt b/meson_options.txt
> index d58c69315c..d140c0ef89 100644
> --- a/meson_options.txt
> +++ b/meson_options.txt
> @@ -109,6 +109,8 @@ option('cocoa', type : 'feature', value : 'auto',
>         description: 'Cocoa user interface (macOS only)')
>  option('curl', type : 'feature', value : 'auto',
>         description: 'CURL block device driver')
> +option('gio', type : 'feature', value : 'auto',
> +       description: 'use libgio for D-Bus support')
>  option('glusterfs', type : 'feature', value : 'auto',
>         description: 'Glusterfs block device driver')
>  option('libiscsi', type : 'feature', value : 'auto',
> diff --git a/scripts/meson-buildoptions.sh b/scripts/meson-buildoptions.sh
> index 0daeb11fd3..92be3e6187 100644
> --- a/scripts/meson-buildoptions.sh
> +++ b/scripts/meson-buildoptions.sh
> @@ -59,6 +59,7 @@ meson_options_help() {
>    printf "%s\n" '  fuse-lseek      SEEK_HOLE/SEEK_DATA support for FUSE
> exports'
>    printf "%s\n" '  gcrypt          libgcrypt cryptography support'
>    printf "%s\n" '  gettext         Localization of the GTK+ user
> interface'
> +  printf "%s\n" '  gio             use libgio for D-Bus support'
>    printf "%s\n" '  glusterfs       Glusterfs block device driver'
>    printf "%s\n" '  gnutls          GNUTLS cryptography support'
>    printf "%s\n" '  gtk             GTK+ user interface'
> @@ -208,6 +209,8 @@ _meson_option_parse() {
>      --disable-gcrypt) printf "%s" -Dgcrypt=disabled ;;
>      --enable-gettext) printf "%s" -Dgettext=enabled ;;
>      --disable-gettext) printf "%s" -Dgettext=disabled ;;
> +    --enable-gio) printf "%s" -Dgio=enabled ;;
> +    --disable-gio) printf "%s" -Dgio=disabled ;;
>      --enable-glusterfs) printf "%s" -Dglusterfs=enabled ;;
>      --disable-glusterfs) printf "%s" -Dglusterfs=disabled ;;
>      --enable-gnutls) printf "%s" -Dgnutls=enabled ;;
> diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build
> index d25f82bb5a..69f97b8992 100644
> --- a/tests/qtest/meson.build
> +++ b/tests/qtest/meson.build
> @@ -99,14 +99,13 @@ if dbus_display
>  endif
>
>  dbus_daemon = find_program('dbus-daemon', required: false)
> -if dbus_daemon.found() and config_host.has_key('GDBUS_CODEGEN')
> +if dbus_daemon.found() and gdbus_codegen.found()
>    # Temporarily disabled due to Patchew failures:
>    #qtests_i386 += ['dbus-vmstate-test']
>    dbus_vmstate1 = custom_target('dbus-vmstate description',
>                                  output: ['dbus-vmstate1.h',
> 'dbus-vmstate1.c'],
>                                  input: meson.project_source_root() /
> 'backends/dbus-vmstate1.xml',
> -                                command: [config_host['GDBUS_CODEGEN'],
> -                                          '@INPUT@',
> +                                command: [gdbus_codegen, '@INPUT@',
>                                            '--interface-prefix',
> 'org.qemu',
>                                            '--generate-c-code', '@BASENAME@
> ']).to_list()
>  else
> diff --git a/ui/meson.build b/ui/meson.build
> index b21d3d1534..eba93b41e3 100644
> --- a/ui/meson.build
> +++ b/ui/meson.build
> @@ -74,14 +74,13 @@ if dbus_display
>    dbus_display1 = custom_target('dbus-display gdbus-codegen',
>                                  output: ['dbus-display1.h',
> 'dbus-display1.c'],
>                                  input: files('dbus-display1.xml'),
> -                                command: [config_host['GDBUS_CODEGEN'],
> -                                          '@INPUT@',
> +                                command: [gdbus_codegen, '@INPUT@',
>                                            '--glib-min-required', '2.64',
>                                            '--output-directory',
> meson.current_build_dir(),
>                                            '--interface-prefix',
> 'org.qemu.',
>                                            '--c-namespace', 'QemuDBus',
>                                            '--generate-c-code', '@BASENAME@
> '])
> -  dbus_ss.add(when: [gio, pixman, opengl, 'CONFIG_GIO'],
> +  dbus_ss.add(when: [gio, pixman, opengl],
>                if_true: [files(
>                  'dbus-chardev.c',
>                  'dbus-clipboard.c',
> @@ -128,7 +127,7 @@ if spice.found()
>    ui_modules += {'spice-core' : spice_core_ss}
>  endif
>
> -if spice.found() and config_host.has_key('CONFIG_GIO')
> +if spice.found() and gio.found()
>    spice_ss = ss.source_set()
>    spice_ss.add(spice, gio, pixman, files('spice-app.c'))
>    ui_modules += {'spice-app': spice_ss}
> diff --git a/util/meson.build b/util/meson.build
> index 82eec004e2..8f16018cd4 100644
> --- a/util/meson.build
> +++ b/util/meson.build
> @@ -61,7 +61,7 @@ endif
>
>  if have_system
>    util_ss.add(files('crc-ccitt.c'))
> -  util_ss.add(when: 'CONFIG_GIO', if_true: [files('dbus.c'), gio])
> +  util_ss.add(when: gio, if_true: files('dbus.c'))
>    util_ss.add(when: 'CONFIG_LINUX', if_true: files('userfaultfd.c'))
>  endif
>
> --
> 2.35.1
>
>
>
>

-- 
Marc-André Lureau

[-- Attachment #2: Type: text/html, Size: 16320 bytes --]

^ permalink raw reply	[flat|nested] 74+ messages in thread

* Re: [PATCH 12/34] meson: move CONFIG_XEN_PCI_PASSTHROUGH to config-host.h
  2022-04-20 15:33 ` [PATCH 12/34] meson: move CONFIG_XEN_PCI_PASSTHROUGH to config-host.h Paolo Bonzini
@ 2022-04-20 16:45   ` Marc-André Lureau
  0 siblings, 0 replies; 74+ messages in thread
From: Marc-André Lureau @ 2022-04-20 16:45 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: QEMU

[-- Attachment #1: Type: text/plain, Size: 2885 bytes --]

Hi

On Wed, Apr 20, 2022 at 8:02 PM Paolo Bonzini <pbonzini@redhat.com> wrote:

> CONFIG_XEN_PCI_PASSTHROUGH is just a global configuration option; the
> selection
> of the actual files in hw/xen/meson.build is also conditional on
> CONFIG_XEN,
> so there is no need to put CONFIG_XEN_PCI_PASSTHROUGH in config-target.h.
>
> This inaccuracy was copied over from the configure script in commit
> 8a19980e3f ("configure: move accelerator logic to meson", 2020-10-03).
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  hw/xen/meson.build | 20 ++++++++++++--------
>  meson.build        |  3 +--
>  2 files changed, 13 insertions(+), 10 deletions(-)
>
> diff --git a/hw/xen/meson.build b/hw/xen/meson.build
> index 076954b89c..08dc1f6857 100644
> --- a/hw/xen/meson.build
> +++ b/hw/xen/meson.build
> @@ -8,13 +8,17 @@ softmmu_ss.add(when: ['CONFIG_XEN', xen], if_true: files(
>  ))
>
>  xen_specific_ss = ss.source_set()
> -xen_specific_ss.add(when: 'CONFIG_XEN_PCI_PASSTHROUGH', if_true: files(
> -  'xen-host-pci-device.c',
> -  'xen_pt.c',
> -  'xen_pt_config_init.c',
> -  'xen_pt_graphics.c',
> -  'xen_pt_load_rom.c',
> -  'xen_pt_msi.c',
> -), if_false: files('xen_pt_stub.c'))
> +if have_xen_pci_passthrough
> +  xen_specific_ss.add(files(
> +    'xen-host-pci-device.c',
> +    'xen_pt.c',
> +    'xen_pt_config_init.c',
> +    'xen_pt_graphics.c',
> +    'xen_pt_load_rom.c',
> +    'xen_pt_msi.c',
> +  ))
> +else
> +  xen_specific_ss.add('xen_pt_stub.c')
> +endif
>
>  specific_ss.add_all(when: ['CONFIG_XEN', xen], if_true: xen_specific_ss)
> diff --git a/meson.build b/meson.build
> index b8046efcf1..84156df809 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -1627,6 +1627,7 @@ config_host_data.set('CONFIG_X11', x11.found())
>  config_host_data.set('CONFIG_DBUS_DISPLAY', dbus_display)
>  config_host_data.set('CONFIG_CFI', get_option('cfi'))
>  config_host_data.set('CONFIG_SELINUX', selinux.found())
> +config_host_data.set('CONFIG_XEN_PCI_PASSTHROUGH',
> have_xen_pci_passthrough)
>

afaict, nothing uses this then.


>  config_host_data.set('QEMU_VERSION', '"@0@
> "'.format(meson.project_version()))
>  config_host_data.set('QEMU_VERSION_MAJOR',
> meson.project_version().split('.')[0])
>  config_host_data.set('QEMU_VERSION_MINOR',
> meson.project_version().split('.')[1])
> @@ -2228,8 +2229,6 @@ foreach target : target_dirs
>        config_all += { sym: 'y' }
>        if sym == 'CONFIG_TCG' and tcg_arch == 'tci'
>          config_target += { 'CONFIG_TCG_INTERPRETER': 'y' }
> -      elif sym == 'CONFIG_XEN' and have_xen_pci_passthrough
> -        config_target += { 'CONFIG_XEN_PCI_PASSTHROUGH': 'y' }
>        endif
>        if target in modular_tcg
>          config_target += { 'CONFIG_TCG_MODULAR': 'y' }
> --
> 2.35.1
>
>
>
>

-- 
Marc-André Lureau

[-- Attachment #2: Type: text/html, Size: 4009 bytes --]

^ permalink raw reply	[flat|nested] 74+ messages in thread

* Re: [PATCH 13/34] meson, configure: move --enable-module-upgrades to meson
  2022-04-20 15:33 ` [PATCH 13/34] meson, configure: move --enable-module-upgrades to meson Paolo Bonzini
@ 2022-04-20 18:05   ` Marc-André Lureau
  0 siblings, 0 replies; 74+ messages in thread
From: Marc-André Lureau @ 2022-04-20 18:05 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: QEMU

[-- Attachment #1: Type: text/plain, Size: 5916 bytes --]

On Wed, Apr 20, 2022 at 7:54 PM Paolo Bonzini <pbonzini@redhat.com> wrote:

> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>


> ---
>  configure                     | 14 --------------
>  meson.build                   |  7 ++++++-
>  meson_options.txt             |  2 ++
>  scripts/meson-buildoptions.sh |  4 ++++
>  4 files changed, 12 insertions(+), 15 deletions(-)
>
> diff --git a/configure b/configure
> index 75e8b1e7aa..d4d51eff06 100755
> --- a/configure
> +++ b/configure
> @@ -310,7 +310,6 @@ fortify_source="$default_feature"
>  gcov="no"
>  EXESUF=""
>  modules="no"
> -module_upgrades="no"
>  prefix="/usr/local"
>  qemu_suffix="qemu"
>  softmmu="yes"
> @@ -762,10 +761,6 @@ for opt do
>    --disable-modules)
>        modules="no"
>    ;;
> -  --disable-module-upgrades) module_upgrades="no"
> -  ;;
> -  --enable-module-upgrades) module_upgrades="yes"
> -  ;;
>    --cpu=*)
>    ;;
>    --target-list=*) target_list="$optarg"
> @@ -1218,7 +1213,6 @@ cat << EOF
>    bsd-user        all BSD usermode emulation targets
>    pie             Position Independent Executables
>    modules         modules support (non-Windows)
> -  module-upgrades try to load modules from alternate paths for upgrades
>    debug-tcg       TCG debugging (default is disabled)
>    debug-info      debugging information
>    lto             Enable Link-Time Optimization.
> @@ -1487,11 +1481,6 @@ if test "$modules" = "yes" && test "$mingw32" =
> "yes" ; then
>    error_exit "Modules are not available for Windows"
>  fi
>
> -# module_upgrades is only reasonable if modules are enabled
> -if test "$modules" = "no" && test "$module_upgrades" = "yes" ; then
> -  error_exit "Can't enable module-upgrades as Modules are not enabled"
> -fi
> -
>  # Static linking is not possible with plugins, modules or PIE
>  if test "$static" = "yes" ; then
>    if test "$modules" = "yes" ; then
> @@ -2563,9 +2552,6 @@ if test "$modules" = "yes"; then
>    echo "CONFIG_STAMP=_$( (echo $qemu_version; echo $pkgversion; cat $0) |
> $shacmd - | cut -f1 -d\ )" >> $config_host_mak
>    echo "CONFIG_MODULES=y" >> $config_host_mak
>  fi
> -if test "$module_upgrades" = "yes"; then
> -  echo "CONFIG_MODULE_UPGRADES=y" >> $config_host_mak
> -fi
>  echo "CONFIG_TLS_PRIORITY=\"$tls_priority\"" >> $config_host_mak
>
>  if test "$xen" = "enabled" ; then
> diff --git a/meson.build b/meson.build
> index 84156df809..3c47d82180 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -1548,6 +1548,11 @@ endif
>
>  config_host_data.set('HOST_' + host_arch.to_upper(), 1)
>
> +if get_option('module_upgrades') and not enable_modules
> +  error('Cannot enable module-upgrades as modules are not enabled')
> +endif
> +config_host_data.set('CONFIG_MODULE_UPGRADES',
> get_option('module_upgrades'))
> +
>  config_host_data.set('CONFIG_ATTR', libattr.found())
>  config_host_data.set('CONFIG_BDRV_WHITELIST_TOOLS',
> get_option('block_drv_whitelist_in_tools'))
>  config_host_data.set('CONFIG_BRLAPI', brlapi.found())
> @@ -3563,7 +3568,7 @@ summary_info += {'block layer':       have_block}
>  summary_info += {'Install blobs':     get_option('install_blobs')}
>  summary_info += {'module support':
> config_host.has_key('CONFIG_MODULES')}
>  if config_host.has_key('CONFIG_MODULES')
> -  summary_info += {'alternative module path':
> config_host.has_key('CONFIG_MODULE_UPGRADES')}
> +  summary_info += {'alternative module path':
> get_option('module_upgrades')}
>  endif
>  summary_info += {'fuzzing support':   get_option('fuzzing')}
>  if have_system
> diff --git a/meson_options.txt b/meson_options.txt
> index d140c0ef89..cf18663833 100644
> --- a/meson_options.txt
> +++ b/meson_options.txt
> @@ -34,6 +34,8 @@ option('fuzzing', type : 'boolean', value: false,
>         description: 'build fuzzing targets')
>  option('gettext', type : 'feature', value : 'auto',
>         description: 'Localization of the GTK+ user interface')
> +option('module_upgrades', type : 'boolean', value : false,
> +       description: 'try to load modules from alternate paths for
> upgrades')
>  option('install_blobs', type : 'boolean', value : true,
>         description: 'install provided firmware blobs')
>  option('sparse', type : 'feature', value : 'auto',
> diff --git a/scripts/meson-buildoptions.sh b/scripts/meson-buildoptions.sh
> index 92be3e6187..a269534394 100644
> --- a/scripts/meson-buildoptions.sh
> +++ b/scripts/meson-buildoptions.sh
> @@ -19,6 +19,8 @@ meson_options_help() {
>    printf "%s\n" '  --disable-install-blobs  install provided firmware
> blobs'
>    printf "%s\n" '  --enable-malloc=CHOICE   choose memory allocator to
> use [system] (choices:'
>    printf "%s\n" '                           jemalloc/system/tcmalloc)'
> +  printf "%s\n" '  --enable-module-upgrades try to load modules from
> alternate paths for'
> +  printf "%s\n" '                           upgrades'
>    printf "%s\n" '  --enable-profiler        profiler support'
>    printf "%s\n" '  --enable-qom-cast-debug  cast debugging support'
>    printf "%s\n" '  --enable-rng-none        dummy RNG, avoid using
> /dev/(u)random and'
> @@ -268,6 +270,8 @@ _meson_option_parse() {
>      --disable-malloc-trim) printf "%s" -Dmalloc_trim=disabled ;;
>      --enable-membarrier) printf "%s" -Dmembarrier=enabled ;;
>      --disable-membarrier) printf "%s" -Dmembarrier=disabled ;;
> +    --enable-module-upgrades) printf "%s" -Dmodule_upgrades=true ;;
> +    --disable-module-upgrades) printf "%s" -Dmodule_upgrades=false ;;
>      --enable-mpath) printf "%s" -Dmpath=enabled ;;
>      --disable-mpath) printf "%s" -Dmpath=disabled ;;
>      --enable-multiprocess) printf "%s" -Dmultiprocess=enabled ;;
> --
> 2.35.1
>
>
>
>

-- 
Marc-André Lureau

[-- Attachment #2: Type: text/html, Size: 8001 bytes --]

^ permalink raw reply	[flat|nested] 74+ messages in thread

* Re: [PATCH 15/34] meson-buildoptions: add support for string options
  2022-04-20 15:33 ` [PATCH 15/34] meson-buildoptions: add support for string options Paolo Bonzini
@ 2022-04-20 18:14   ` Marc-André Lureau
  0 siblings, 0 replies; 74+ messages in thread
From: Marc-André Lureau @ 2022-04-20 18:14 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: QEMU

[-- Attachment #1: Type: text/plain, Size: 8152 bytes --]

On Wed, Apr 20, 2022 at 7:57 PM Paolo Bonzini <pbonzini@redhat.com> wrote:

> Allow using the buildoptions.json file for more options, namely anything
> that is not a boolean or multiple-choice.
>
> The mapping between configure and meson is messy for string options,
> so allow configure to use to something other than the name in
> meson_options.txt.  This will come in handy anyway for builtin
> Meson options such as b_lto or b_coverage.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>

lgtm
Tested-by: Marc-André Lureau <marcandre.lureau@redhat.com>



> ---
>  meson_options.txt             |  2 +-
>  scripts/meson-buildoptions.py | 65 ++++++++++++++++++++++++++++++-----
>  scripts/meson-buildoptions.sh |  6 ++--
>  3 files changed, 60 insertions(+), 13 deletions(-)
>
> diff --git a/meson_options.txt b/meson_options.txt
> index cf18663833..415fcc448e 100644
> --- a/meson_options.txt
> +++ b/meson_options.txt
> @@ -11,7 +11,7 @@ option('qemu_firmwarepath', type : 'string', value : '',
>  option('smbd', type : 'string', value : '',
>         description: 'Path to smbd for slirp networking')
>  option('sphinx_build', type : 'string', value : '',
> -       description: 'Use specified sphinx-build [$sphinx_build] for
> building document (default to be empty)')
> +       description: 'Use specified sphinx-build for building document')
>  option('iasl', type : 'string', value : '',
>         description: 'Path to ACPI disassembler')
>  option('default_devices', type : 'boolean', value : true,
> diff --git a/scripts/meson-buildoptions.py b/scripts/meson-buildoptions.py
> index 693be7b966..4af8d6e732 100755
> --- a/scripts/meson-buildoptions.py
> +++ b/scripts/meson-buildoptions.py
> @@ -38,6 +38,11 @@
>      "trace_file",
>  }
>
> +OPTION_NAMES = {
> +    "malloc": "enable-malloc",
> +    "trace_backends": "enable-trace-backends",
> +}
> +
>  BUILTIN_OPTIONS = {
>      "strip",
>  }
> @@ -75,7 +80,7 @@ def help_line(left, opt, indent, long):
>      right = f'{opt["description"]}'
>      if long:
>          value = value_to_help(opt["value"])
> -        if value != "auto":
> +        if value != "auto" and value != "":
>              right += f" [{value}]"
>      if "choices" in opt and long:
>          choices = "/".join(sorted(opt["choices"]))
> @@ -96,6 +101,18 @@ def allow_arg(opt):
>      return not (set(opt["choices"]) <= {"auto", "disabled", "enabled"})
>
>
> +# Return whether the option (a dictionary) can be used without
> +# arguments.  Booleans can only be used without arguments;
> +# combos require an argument if they accept neither "enabled"
> +# nor "disabled"
> +def require_arg(opt):
> +    if opt["type"] == "boolean":
> +        return False
> +    if opt["type"] != "combo":
> +        return True
> +    return not ({"enabled", "disabled"}.intersection(opt["choices"]))
> +
> +
>  def filter_options(json):
>      if ":" in json["name"]:
>          return False
> @@ -110,20 +127,48 @@ def load_options(json):
>      return sorted(json, key=lambda x: x["name"])
>
>
> +def cli_option(opt):
> +    name = opt["name"]
> +    if name in OPTION_NAMES:
> +        return OPTION_NAMES[name]
> +    return name.replace("_", "-")
> +
> +
> +def cli_help_key(opt):
> +    key = cli_option(opt)
> +    if require_arg(opt):
> +        return key
> +    if opt["type"] == "boolean" and opt["value"]:
> +        return f"disable-{key}"
> +    return f"enable-{key}"
> +
> +
> +def cli_metavar(opt):
> +    if opt["type"] == "string":
> +        return "VALUE"
> +    if opt["type"] == "array":
> +        return "CHOICES"
> +    return "CHOICE"
> +
> +
>  def print_help(options):
>      print("meson_options_help() {")
> -    for opt in options:
> -        key = opt["name"].replace("_", "-")
> +    for opt in sorted(options, key=cli_help_key):
> +        key = cli_help_key(opt)
>          # The first section includes options that have an arguments,
>          # and booleans (i.e., only one of enable/disable makes sense)
> -        if opt["type"] == "boolean":
> -            left = f"--disable-{key}" if opt["value"] else
> f"--enable-{key}"
> +        if require_arg(opt):
> +            metavar = cli_metavar(opt)
> +            left = f"--{key}={metavar}"
> +            help_line(left, opt, 27, True)
> +        elif opt["type"] == "boolean":
> +            left = f"--{key}"
>              help_line(left, opt, 27, False)
>          elif allow_arg(opt):
>              if opt["type"] == "combo" and "enabled" in opt["choices"]:
> -                left = f"--enable-{key}[=CHOICE]"
> +                left = f"--{key}[=CHOICE]"
>              else:
> -                left = f"--enable-{key}=CHOICE"
> +                left = f"--{key}=CHOICE"
>              help_line(left, opt, 27, True)
>
>      sh_print()
> @@ -142,9 +187,11 @@ def print_parse(options):
>      print("_meson_option_parse() {")
>      print("  case $1 in")
>      for opt in options:
> -        key = opt["name"].replace("_", "-")
> +        key = cli_option(opt)
>          name = opt["name"]
> -        if opt["type"] == "boolean":
> +        if require_arg(opt):
> +            print(f'    --{key}=*) quote_sh "-D{name}=$2" ;;')
> +        elif opt["type"] == "boolean":
>              print(f'    --enable-{key}) printf "%s" -D{name}=true ;;')
>              print(f'    --disable-{key}) printf "%s" -D{name}=false ;;')
>          else:
> diff --git a/scripts/meson-buildoptions.sh b/scripts/meson-buildoptions.sh
> index a269534394..5a06b7915c 100644
> --- a/scripts/meson-buildoptions.sh
> +++ b/scripts/meson-buildoptions.sh
> @@ -1,5 +1,7 @@
>  # This file is generated by meson-buildoptions.py, do not edit!
>  meson_options_help() {
> +  printf "%s\n" '  --disable-coroutine-pool coroutine freelist (better
> performance)'
> +  printf "%s\n" '  --disable-install-blobs  install provided firmware
> blobs'
>    printf "%s\n" '  --enable-block-drv-whitelist-in-tools'
>    printf "%s\n" '                           use block whitelist also in
> tools instead of only'
>    printf "%s\n" '                           QEMU'
> @@ -8,7 +10,6 @@ meson_options_help() {
>    printf "%s\n" '                           (choices:
> auto/disabled/enabled/internal/system)'
>    printf "%s\n" '  --enable-cfi             Control-Flow Integrity (CFI)'
>    printf "%s\n" '  --enable-cfi-debug       Verbose errors in case of CFI
> violation'
> -  printf "%s\n" '  --disable-coroutine-pool coroutine freelist (better
> performance)'
>    printf "%s\n" '  --enable-debug-mutex     mutex debugging support'
>    printf "%s\n" '  --enable-debug-stack-usage'
>    printf "%s\n" '                           measure coroutine stack usage'
> @@ -16,7 +17,6 @@ meson_options_help() {
>    printf "%s\n" '                           (choices:
> auto/disabled/enabled/internal/system)'
>    printf "%s\n" '  --enable-fuzzing         build fuzzing targets'
>    printf "%s\n" '  --enable-gprof           QEMU profiling with gprof'
> -  printf "%s\n" '  --disable-install-blobs  install provided firmware
> blobs'
>    printf "%s\n" '  --enable-malloc=CHOICE   choose memory allocator to
> use [system] (choices:'
>    printf "%s\n" '                           jemalloc/system/tcmalloc)'
>    printf "%s\n" '  --enable-module-upgrades try to load modules from
> alternate paths for'
> @@ -29,7 +29,7 @@ meson_options_help() {
>    printf "%s\n" '                           (choices:
> auto/disabled/enabled/internal/system)'
>    printf "%s\n" '  --enable-strip           Strip targets on install'
>    printf "%s\n" '  --enable-tcg-interpreter TCG with bytecode interpreter
> (slow)'
> -  printf "%s\n" '  --enable-trace-backends=CHOICE'
> +  printf "%s\n" '  --enable-trace-backends=CHOICES'
>    printf "%s\n" '                           Set available tracing
> backends [log] (choices:'
>    printf "%s\n" '
>  dtrace/ftrace/log/nop/simple/syslog/ust)'
>    printf "%s\n" ''
> --
> 2.35.1
>
>
>
>

-- 
Marc-André Lureau

[-- Attachment #2: Type: text/html, Size: 11228 bytes --]

^ permalink raw reply	[flat|nested] 74+ messages in thread

* Re: [PATCH 16/34] configure, meson: move iasl detection to meson
  2022-04-20 15:33 ` [PATCH 16/34] configure, meson: move iasl detection to meson Paolo Bonzini
@ 2022-04-20 18:17   ` Marc-André Lureau
  0 siblings, 0 replies; 74+ messages in thread
From: Marc-André Lureau @ 2022-04-20 18:17 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: QEMU

[-- Attachment #1: Type: text/plain, Size: 2528 bytes --]

On Wed, Apr 20, 2022 at 7:52 PM Paolo Bonzini <pbonzini@redhat.com> wrote:

> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>



> ---
>  configure   |  2 +-
>  meson.build | 16 +++++++++-------
>  2 files changed, 10 insertions(+), 8 deletions(-)
>
> diff --git a/configure b/configure
> index 11d3cc19ca..772714d386 100755
> --- a/configure
> +++ b/configure
> @@ -2507,7 +2507,7 @@ if test "$skip_meson" = no; then
>          -Daudio_drv_list=$audio_drv_list \
>          -Ddefault_devices=$default_devices \
>          -Ddocdir="$docdir" \
> -        -Diasl="$($iasl -h >/dev/null 2>&1 && printf %s "$iasl")" \
> +        -Diasl="$iasl" \
>          -Dqemu_firmwarepath="$firmwarepath" \
>          -Dqemu_suffix="$qemu_suffix" \
>          -Dsmbd="$smbd" \
> diff --git a/meson.build b/meson.build
> index 7cbb771393..d255facbfd 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -167,6 +167,12 @@ if 'dtrace' in get_option('trace_backends')
>    endif
>  endif
>
> +if get_option('iasl') == ''
> +  iasl = find_program('iasl', required: false)
> +else
> +  iasl = find_program(get_option('iasl'), required: true)
> +endif
> +
>  ##################
>  # Compiler flags #
>  ##################
> @@ -1582,8 +1588,8 @@ foreach k : get_option('trace_backends')
>    config_host_data.set('CONFIG_TRACE_' + k.to_upper(), true)
>  endforeach
>  config_host_data.set_quoted('CONFIG_TRACE_FILE', get_option('trace_file'))
> -if get_option('iasl') != ''
> -  config_host_data.set_quoted('CONFIG_IASL', get_option('iasl'))
> +if iasl.found()
> +  config_host_data.set_quoted('CONFIG_IASL', iasl.full_path())
>  endif
>  config_host_data.set_quoted('CONFIG_BINDIR', get_option('prefix') /
> get_option('bindir'))
>  config_host_data.set_quoted('CONFIG_PREFIX', get_option('prefix'))
> @@ -3617,11 +3623,7 @@ summary_info += {'sphinx-build':      sphinx_build}
>  if config_host.has_key('HAVE_GDB_BIN')
>    summary_info += {'gdb':             config_host['HAVE_GDB_BIN']}
>  endif
> -if get_option('iasl') != ''
> -  summary_info += {'iasl':            get_option('iasl')}
> -else
> -  summary_info += {'iasl':            false}
> -endif
> +summary_info += {'iasl':              iasl}
>  summary_info += {'genisoimage':       config_host['GENISOIMAGE']}
>  if targetos == 'windows' and have_ga
>    summary_info += {'wixl':            wixl}
> --
> 2.35.1
>
>
>
>

-- 
Marc-André Lureau

[-- Attachment #2: Type: text/html, Size: 3802 bytes --]

^ permalink raw reply	[flat|nested] 74+ messages in thread

* Re: [PATCH 17/34] configure: move Windows flags detection to meson
  2022-04-20 15:33 ` [PATCH 17/34] configure: move Windows flags " Paolo Bonzini
@ 2022-04-20 18:20   ` Marc-André Lureau
  2022-04-20 19:15     ` Paolo Bonzini
  0 siblings, 1 reply; 74+ messages in thread
From: Marc-André Lureau @ 2022-04-20 18:20 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: QEMU

[-- Attachment #1: Type: text/plain, Size: 2258 bytes --]

Hi

On Wed, Apr 20, 2022 at 7:59 PM Paolo Bonzini <pbonzini@redhat.com> wrote:

> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  configure   | 20 --------------------
>  meson.build |  8 ++++++++
>  2 files changed, 8 insertions(+), 20 deletions(-)
>
> diff --git a/configure b/configure
> index 772714d386..87ceb33917 100755
> --- a/configure
> +++ b/configure
> @@ -224,10 +224,6 @@ glob() {
>      eval test -z '"${1#'"$2"'}"'
>  }
>
> -ld_has() {
> -    $ld --help 2>/dev/null | grep ".$1" >/dev/null 2>&1
> -}
> -
>  if printf %s\\n "$source_path" "$PWD" | grep -q "[[:space:]:]";
>  then
>    error_exit "main directory cannot contain spaces nor colons"
> @@ -2088,22 +2084,6 @@ if test "$solaris" = "no" && test "$tsan" = "no";
> then
>      fi
>  fi
>
> -# Use ASLR, no-SEH and DEP if available
> -if test "$mingw32" = "yes" ; then
> -    flags="--no-seh --nxcompat"
> -
> -    # Disable ASLR for debug builds to allow debugging with gdb
> -    if test "$debug" = "no" ; then
> -        flags="--dynamicbase $flags"
> -    fi
> -
> -    for flag in $flags; do
> -        if ld_has $flag ; then
> -            QEMU_LDFLAGS="-Wl,$flag $QEMU_LDFLAGS"
> -        fi
> -    done
> -fi
> -
>  # Guest agent Windows MSI package
>
>  if test "$QEMU_GA_MANUFACTURER" = ""; then
> diff --git a/meson.build b/meson.build
> index d255facbfd..ffca473fbc 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -182,6 +182,14 @@ qemu_cxxflags = config_host['QEMU_CXXFLAGS'].split()
>  qemu_objcflags = config_host['QEMU_OBJCFLAGS'].split()
>  qemu_ldflags = config_host['QEMU_LDFLAGS'].split()
>
> +if targetos == 'windows'
> +  qemu_ldflags += cc.get_supported_link_arguments('-Wl,--no-seh',
> '-Wl,--nxcompat')
> +  # Disable ASLR for debug builds to allow debugging with gdb
> +  if get_option('optimization') == 0


../meson.build:188:5: ERROR: The `==` operator of str does not accept
objects of type int (0)

Why not check 'debug' ?


> +    qemu_ldflags += cc.get_supported_link_arguments('-Wl,--dynamicbase')
> +  endif
> +endif
> +
>  if get_option('gprof')
>    qemu_cflags += ['-p']
>    qemu_cxxflags += ['-p']
> --
> 2.35.1
>
>
>
>

-- 
Marc-André Lureau

[-- Attachment #2: Type: text/html, Size: 3406 bytes --]

^ permalink raw reply	[flat|nested] 74+ messages in thread

* Re: [PATCH 18/34] configure: switch string options to automatic parsing
  2022-04-20 15:33 ` [PATCH 18/34] configure: switch string options to automatic parsing Paolo Bonzini
@ 2022-04-20 18:23   ` Marc-André Lureau
  0 siblings, 0 replies; 74+ messages in thread
From: Marc-André Lureau @ 2022-04-20 18:23 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: QEMU

[-- Attachment #1: Type: text/plain, Size: 8486 bytes --]

On Wed, Apr 20, 2022 at 8:03 PM Paolo Bonzini <pbonzini@redhat.com> wrote:

> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>



> ---
>  configure                     | 24 +-----------------------
>  scripts/meson-buildoptions.py |  5 +----
>  scripts/meson-buildoptions.sh |  9 +++++++++
>  3 files changed, 11 insertions(+), 27 deletions(-)
>
> diff --git a/configure b/configure
> index 87ceb33917..8f34f2a061 100755
> --- a/configure
> +++ b/configure
> @@ -231,12 +231,10 @@ fi
>
>  # default parameters
>  cpu=""
> -iasl="iasl"
>  interp_prefix="/usr/gnemul/qemu-%M"
>  static="no"
>  cross_compile="no"
>  cross_prefix=""
> -audio_drv_list="default"
>  block_drv_rw_whitelist=""
>  block_drv_ro_whitelist=""
>  host_cc="cc"
> @@ -312,7 +310,6 @@ linux_user=""
>  bsd_user=""
>  pkgversion=""
>  pie=""
> -trace_file="trace"
>  coroutine=""
>  tls_priority="NORMAL"
>  plugins="$default_feature"
> @@ -713,8 +710,6 @@ for opt do
>    ;;
>    --cxx=*)
>    ;;
> -  --iasl=*) iasl="$optarg"
> -  ;;
>    --objcc=*) objcc="$optarg"
>    ;;
>    --make=*) make="$optarg"
> @@ -723,8 +718,6 @@ for opt do
>    ;;
>    --python=*) python="$optarg" ; explicit_python=yes
>    ;;
> -  --sphinx-build=*) sphinx_build="$optarg"
> -  ;;
>    --skip-meson) skip_meson=yes
>    ;;
>    --meson=*) meson="$optarg"
> @@ -765,8 +758,6 @@ for opt do
>                         error_exit "Can't mix --target-list-exclude with
> --target-list"
>                     fi
>    ;;
> -  --with-trace-file=*) trace_file="$optarg"
> -  ;;
>    --with-default-devices) default_devices="true"
>    ;;
>    --without-default-devices) default_devices="false"
> @@ -825,8 +816,6 @@ for opt do
>      # configure to be used by RPM and similar macros that set
>      # lots of directory switches by default.
>    ;;
> -  --audio-drv-list=*) audio_drv_list="$optarg"
> -  ;;
>    --block-drv-rw-whitelist=*|--block-drv-whitelist=*)
> block_drv_rw_whitelist=$(echo "$optarg" | sed -e 's/,/ /g')
>    ;;
>    --block-drv-ro-whitelist=*) block_drv_ro_whitelist=$(echo "$optarg" |
> sed -e 's/,/ /g')
> @@ -1000,12 +989,7 @@ for opt do
>    --enable-jemalloc) meson_option_parse --enable-malloc=jemalloc jemalloc
>    ;;
>    # everything else has the same name in configure and meson
> -  --enable-* | --disable-*) meson_option_parse "$opt" "$optarg"
> -  ;;
> -  *)
> -      echo "ERROR: unknown option $opt"
> -      echo "Try '$0 --help' for more information"
> -      exit 1
> +  --*) meson_option_parse "$opt" "$optarg"
>    ;;
>    esac
>  done
> @@ -1128,7 +1112,6 @@ $(echo Available targets: $default_target_list | \
>  Advanced options (experts only):
>    --cross-prefix=PREFIX    use PREFIX for compile tools, PREFIX can be
> blank [$cross_prefix]
>    --cc=CC                  use C compiler CC [$cc]
> -  --iasl=IASL              use ACPI compiler IASL [$iasl]
>    --host-cc=CC             use C compiler CC [$host_cc] for code run at
>                             build time
>    --cxx=CXX                use C++ compiler CXX [$cxx]
> @@ -1141,7 +1124,6 @@ Advanced options (experts only):
>    --cross-cc-cflags-ARCH=  use compiler flags when building ARCH guest
> tests
>    --make=MAKE              use specified make [$make]
>    --python=PYTHON          use specified python [$python]
> -  --sphinx-build=SPHINX    use specified sphinx-build [$sphinx_build]
>    --meson=MESON            use specified meson [$meson]
>    --ninja=NINJA            use specified ninja [$ninja]
>    --smbd=SMBD              use specified smbd [$smbd]
> @@ -2484,15 +2466,11 @@ if test "$skip_meson" = no; then
>          --sysconfdir "$sysconfdir" \
>          --localedir "$localedir" \
>          --localstatedir "$local_statedir" \
> -        -Daudio_drv_list=$audio_drv_list \
>          -Ddefault_devices=$default_devices \
>          -Ddocdir="$docdir" \
> -        -Diasl="$iasl" \
>          -Dqemu_firmwarepath="$firmwarepath" \
>          -Dqemu_suffix="$qemu_suffix" \
>          -Dsmbd="$smbd" \
> -        -Dsphinx_build="$sphinx_build" \
> -        -Dtrace_file="$trace_file" \
>          -Doptimization=$(if test "$debug" = yes; then echo 0; else echo
> 2; fi) \
>          -Ddebug=$(if test "$debug_info" = yes; then echo true; else echo
> false; fi) \
>          -Dwerror=$(if test "$werror" = yes; then echo true; else echo
> false; fi) \
> diff --git a/scripts/meson-buildoptions.py b/scripts/meson-buildoptions.py
> index 4af8d6e732..3e540e8bb3 100755
> --- a/scripts/meson-buildoptions.py
> +++ b/scripts/meson-buildoptions.py
> @@ -26,21 +26,18 @@
>  import sys
>
>  SKIP_OPTIONS = {
> -    "audio_drv_list",
>      "default_devices",
>      "docdir",
>      "fuzzing_engine",
> -    "iasl",
>      "qemu_firmwarepath",
>      "qemu_suffix",
>      "smbd",
> -    "sphinx_build",
> -    "trace_file",
>  }
>
>  OPTION_NAMES = {
>      "malloc": "enable-malloc",
>      "trace_backends": "enable-trace-backends",
> +    "trace_file": "with-trace-file",
>  }
>
>  BUILTIN_OPTIONS = {
> diff --git a/scripts/meson-buildoptions.sh b/scripts/meson-buildoptions.sh
> index 5a06b7915c..63f2f1abcf 100644
> --- a/scripts/meson-buildoptions.sh
> +++ b/scripts/meson-buildoptions.sh
> @@ -1,5 +1,7 @@
>  # This file is generated by meson-buildoptions.py, do not edit!
>  meson_options_help() {
> +  printf "%s\n" '  --audio-drv-list=CHOICES Set audio driver list
> [default] (choices:'
> +  printf "%s\n" '
>  alsa/coreaudio/default/dsound/jack/oss/pa/sdl)'
>    printf "%s\n" '  --disable-coroutine-pool coroutine freelist (better
> performance)'
>    printf "%s\n" '  --disable-install-blobs  install provided firmware
> blobs'
>    printf "%s\n" '  --enable-block-drv-whitelist-in-tools'
> @@ -32,6 +34,9 @@ meson_options_help() {
>    printf "%s\n" '  --enable-trace-backends=CHOICES'
>    printf "%s\n" '                           Set available tracing
> backends [log] (choices:'
>    printf "%s\n" '
>  dtrace/ftrace/log/nop/simple/syslog/ust)'
> +  printf "%s\n" '  --iasl=VALUE             Path to ACPI disassembler'
> +  printf "%s\n" '  --sphinx-build=VALUE     Use specified sphinx-build
> for building document'
> +  printf "%s\n" '  --with-trace-file=VALUE  Trace file prefix for simple
> backend [trace]'
>    printf "%s\n" ''
>    printf "%s\n" 'Optional features, enabled with --enable-FEATURE and'
>    printf "%s\n" 'disabled with --disable-FEATURE, default is enabled if
> available'
> @@ -147,6 +152,7 @@ _meson_option_parse() {
>      --disable-alsa) printf "%s" -Dalsa=disabled ;;
>      --enable-attr) printf "%s" -Dattr=enabled ;;
>      --disable-attr) printf "%s" -Dattr=disabled ;;
> +    --audio-drv-list=*) quote_sh "-Daudio_drv_list=$2" ;;
>      --enable-auth-pam) printf "%s" -Dauth_pam=enabled ;;
>      --disable-auth-pam) printf "%s" -Dauth_pam=disabled ;;
>      --enable-avx2) printf "%s" -Davx2=enabled ;;
> @@ -229,6 +235,7 @@ _meson_option_parse() {
>      --disable-hax) printf "%s" -Dhax=disabled ;;
>      --enable-hvf) printf "%s" -Dhvf=enabled ;;
>      --disable-hvf) printf "%s" -Dhvf=disabled ;;
> +    --iasl=*) quote_sh "-Diasl=$2" ;;
>      --enable-iconv) printf "%s" -Diconv=enabled ;;
>      --disable-iconv) printf "%s" -Diconv=disabled ;;
>      --enable-install-blobs) printf "%s" -Dinstall_blobs=true ;;
> @@ -331,6 +338,7 @@ _meson_option_parse() {
>      --disable-snappy) printf "%s" -Dsnappy=disabled ;;
>      --enable-sparse) printf "%s" -Dsparse=enabled ;;
>      --disable-sparse) printf "%s" -Dsparse=disabled ;;
> +    --sphinx-build=*) quote_sh "-Dsphinx_build=$2" ;;
>      --enable-spice) printf "%s" -Dspice=enabled ;;
>      --disable-spice) printf "%s" -Dspice=disabled ;;
>      --enable-spice-protocol) printf "%s" -Dspice_protocol=enabled ;;
> @@ -346,6 +354,7 @@ _meson_option_parse() {
>      --enable-tpm) printf "%s" -Dtpm=enabled ;;
>      --disable-tpm) printf "%s" -Dtpm=disabled ;;
>      --enable-trace-backends=*) quote_sh "-Dtrace_backends=$2" ;;
> +    --with-trace-file=*) quote_sh "-Dtrace_file=$2" ;;
>      --enable-u2f) printf "%s" -Du2f=enabled ;;
>      --disable-u2f) printf "%s" -Du2f=disabled ;;
>      --enable-usb-redir) printf "%s" -Dusb_redir=enabled ;;
> --
> 2.35.1
>
>
>
>

-- 
Marc-André Lureau

[-- Attachment #2: Type: text/html, Size: 11299 bytes --]

^ permalink raw reply	[flat|nested] 74+ messages in thread

* Re: [PATCH 19/34] meson, configure: move --tls-priority to meson
  2022-04-20 15:33 ` [PATCH 19/34] meson, configure: move --tls-priority to meson Paolo Bonzini
@ 2022-04-20 18:25   ` Marc-André Lureau
  0 siblings, 0 replies; 74+ messages in thread
From: Marc-André Lureau @ 2022-04-20 18:25 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: QEMU

[-- Attachment #1: Type: text/plain, Size: 5032 bytes --]

On Wed, Apr 20, 2022 at 7:45 PM Paolo Bonzini <pbonzini@redhat.com> wrote:

> Use the new support for string option parsing.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>



> ---
>  configure                     | 5 -----
>  meson.build                   | 3 ++-
>  meson_options.txt             | 2 ++
>  scripts/meson-buildoptions.sh | 3 +++
>  4 files changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/configure b/configure
> index 8f34f2a061..3327a4887a 100755
> --- a/configure
> +++ b/configure
> @@ -311,7 +311,6 @@ bsd_user=""
>  pkgversion=""
>  pie=""
>  coroutine=""
> -tls_priority="NORMAL"
>  plugins="$default_feature"
>  meson=""
>  meson_args=""
> @@ -938,8 +937,6 @@ for opt do
>    --enable-uuid|--disable-uuid)
>        echo "$0: $opt is obsolete, UUID support is always built" >&2
>    ;;
> -  --tls-priority=*) tls_priority="$optarg"
> -  ;;
>    --disable-vhost-user) vhost_user="no"
>    ;;
>    --enable-vhost-user) vhost_user="yes"
> @@ -1169,7 +1166,6 @@ Advanced options (experts only):
>    --with-coroutine=BACKEND coroutine backend. Supported options:
>                             ucontext, sigaltstack, windows
>    --enable-gcov            enable test coverage analysis with gcov
> -  --tls-priority           default TLS protocol/cipher priority string
>    --enable-plugins
>                             enable plugins via shared library loading
>    --disable-containers     don't use containers for cross-building
> @@ -2200,7 +2196,6 @@ if test "$modules" = "yes"; then
>    echo "CONFIG_STAMP=_$( (echo $qemu_version; echo $pkgversion; cat $0) |
> $shacmd - | cut -f1 -d\ )" >> $config_host_mak
>    echo "CONFIG_MODULES=y" >> $config_host_mak
>  fi
> -echo "CONFIG_TLS_PRIORITY=\"$tls_priority\"" >> $config_host_mak
>
>  if test "$vhost_scsi" = "yes" ; then
>    echo "CONFIG_VHOST_SCSI=y" >> $config_host_mak
> diff --git a/meson.build b/meson.build
> index ffca473fbc..8a7e4ab5c7 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -1596,6 +1596,7 @@ foreach k : get_option('trace_backends')
>    config_host_data.set('CONFIG_TRACE_' + k.to_upper(), true)
>  endforeach
>  config_host_data.set_quoted('CONFIG_TRACE_FILE', get_option('trace_file'))
> +config_host_data.set_quoted('CONFIG_TLS_PRIORITY',
> get_option('tls_priority'))
>  if iasl.found()
>    config_host_data.set_quoted('CONFIG_IASL', iasl.full_path())
>  endif
> @@ -3806,7 +3807,7 @@ summary(summary_info, bool_yn: true, section: 'Block
> layer support')
>
>  # Crypto
>  summary_info = {}
> -summary_info += {'TLS priority':      config_host['CONFIG_TLS_PRIORITY']}
> +summary_info += {'TLS priority':      get_option('tls_priority')}
>  summary_info += {'GNUTLS support':    gnutls}
>  if gnutls.found()
>    summary_info += {'  GNUTLS crypto':   gnutls_crypto.found()}
> diff --git a/meson_options.txt b/meson_options.txt
> index 415fcc448e..891c0ec130 100644
> --- a/meson_options.txt
> +++ b/meson_options.txt
> @@ -14,6 +14,8 @@ option('sphinx_build', type : 'string', value : '',
>         description: 'Use specified sphinx-build for building document')
>  option('iasl', type : 'string', value : '',
>         description: 'Path to ACPI disassembler')
> +option('tls_priority', type : 'string', value : 'NORMAL',
> +       description: 'Default TLS protocol/cipher priority string')
>  option('default_devices', type : 'boolean', value : true,
>         description: 'Include a default selection of devices in emulators')
>  option('audio_drv_list', type: 'array', value: ['default'],
> diff --git a/scripts/meson-buildoptions.sh b/scripts/meson-buildoptions.sh
> index 63f2f1abcf..0e0548aa87 100644
> --- a/scripts/meson-buildoptions.sh
> +++ b/scripts/meson-buildoptions.sh
> @@ -36,6 +36,8 @@ meson_options_help() {
>    printf "%s\n" '
>  dtrace/ftrace/log/nop/simple/syslog/ust)'
>    printf "%s\n" '  --iasl=VALUE             Path to ACPI disassembler'
>    printf "%s\n" '  --sphinx-build=VALUE     Use specified sphinx-build
> for building document'
> +  printf "%s\n" '  --tls-priority=VALUE     Default TLS protocol/cipher
> priority string'
> +  printf "%s\n" '                           [NORMAL]'
>    printf "%s\n" '  --with-trace-file=VALUE  Trace file prefix for simple
> backend [trace]'
>    printf "%s\n" ''
>    printf "%s\n" 'Optional features, enabled with --enable-FEATURE and'
> @@ -349,6 +351,7 @@ _meson_option_parse() {
>      --disable-tcg) printf "%s" -Dtcg=disabled ;;
>      --enable-tcg-interpreter) printf "%s" -Dtcg_interpreter=true ;;
>      --disable-tcg-interpreter) printf "%s" -Dtcg_interpreter=false ;;
> +    --tls-priority=*) quote_sh "-Dtls_priority=$2" ;;
>      --enable-tools) printf "%s" -Dtools=enabled ;;
>      --disable-tools) printf "%s" -Dtools=disabled ;;
>      --enable-tpm) printf "%s" -Dtpm=enabled ;;
> --
> 2.35.1
>
>
>
>

-- 
Marc-André Lureau

[-- Attachment #2: Type: text/html, Size: 6873 bytes --]

^ permalink raw reply	[flat|nested] 74+ messages in thread

* Re: [PATCH 20/34] meson, configure: move bdrv whitelists to meson
  2022-04-20 15:33 ` [PATCH 20/34] meson, configure: move bdrv whitelists " Paolo Bonzini
@ 2022-04-20 18:28   ` Marc-André Lureau
  0 siblings, 0 replies; 74+ messages in thread
From: Marc-André Lureau @ 2022-04-20 18:28 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: QEMU

[-- Attachment #1: Type: text/plain, Size: 7912 bytes --]

Hi

On Wed, Apr 20, 2022 at 7:57 PM Paolo Bonzini <pbonzini@redhat.com> wrote:

> Use the new support for string option parsing.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>





> ---
>  configure                     | 14 --------------
>  meson.build                   | 27 ++++++++++++++++-----------
>  meson_options.txt             |  4 ++++
>  scripts/meson-buildoptions.sh |  8 ++++++++
>  4 files changed, 28 insertions(+), 25 deletions(-)
>
> diff --git a/configure b/configure
> index 3327a4887a..bc15854578 100755
> --- a/configure
> +++ b/configure
> @@ -235,8 +235,6 @@ interp_prefix="/usr/gnemul/qemu-%M"
>  static="no"
>  cross_compile="no"
>  cross_prefix=""
> -block_drv_rw_whitelist=""
> -block_drv_ro_whitelist=""
>  host_cc="cc"
>  lto="false"
>  stack_protector=""
> @@ -815,10 +813,6 @@ for opt do
>      # configure to be used by RPM and similar macros that set
>      # lots of directory switches by default.
>    ;;
> -  --block-drv-rw-whitelist=*|--block-drv-whitelist=*)
> block_drv_rw_whitelist=$(echo "$optarg" | sed -e 's/,/ /g')
> -  ;;
> -  --block-drv-ro-whitelist=*) block_drv_ro_whitelist=$(echo "$optarg" |
> sed -e 's/,/ /g')
> -  ;;
>    --enable-debug-tcg) debug_tcg="yes"
>    ;;
>    --disable-debug-tcg) debug_tcg="no"
> @@ -1154,12 +1148,6 @@ Advanced options (experts only):
>    --disable-stack-protector disable compiler-provided stack protection
>    --audio-drv-list=LIST    set audio drivers to try if -audiodev is not
> used
>    --block-drv-whitelist=L  Same as --block-drv-rw-whitelist=L
> -  --block-drv-rw-whitelist=L
> -                           set block driver read-write whitelist
> -                           (by default affects only QEMU, not tools like
> qemu-img)
> -  --block-drv-ro-whitelist=L
> -                           set block driver read-only whitelist
> -                           (by default affects only QEMU, not tools like
> qemu-img)
>    --with-trace-file=NAME   Full PATH,NAME of file to store traces
>                             Default:trace-<pid>
>    --cpu=CPU                Build for host CPU [$cpu]
> @@ -2184,8 +2172,6 @@ fi
>  if test "$static" = "yes" ; then
>    echo "CONFIG_STATIC=y" >> $config_host_mak
>  fi
> -echo "CONFIG_BDRV_RW_WHITELIST=$block_drv_rw_whitelist" >>
> $config_host_mak
> -echo "CONFIG_BDRV_RO_WHITELIST=$block_drv_ro_whitelist" >>
> $config_host_mak
>  qemu_version=$(head $source_path/VERSION)
>  echo "PKGVERSION=$pkgversion" >>$config_host_mak
>  echo "SRC_PATH=$source_path" >> $config_host_mak
> diff --git a/meson.build b/meson.build
> index 8a7e4ab5c7..ee96cbc64e 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -1592,6 +1592,19 @@ have_virtfs = get_option('virtfs') \
>
>  have_virtfs_proxy_helper = targetos != 'darwin' and have_virtfs and
> have_tools
>
> +if get_option('block_drv_ro_whitelist') == ''
> +  config_host_data.set('CONFIG_BDRV_RO_WHITELIST', '')
> +else
> +  config_host_data.set('CONFIG_BDRV_RO_WHITELIST',
> +        '"' + get_option('block_drv_ro_whitelist').replace(',', '", "') +
> '"')
> +endif
> +if get_option('block_drv_rw_whitelist') == ''
> +  config_host_data.set('CONFIG_BDRV_RW_WHITELIST', '')
> +else
> +  config_host_data.set('CONFIG_BDRV_RO_WHITELIST',
>

RW

otherwise,
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>


> +        '"' + get_option('block_drv_rw_whitelist').replace(',', '", "') +
> '"')
> +endif
> +
>  foreach k : get_option('trace_backends')
>    config_host_data.set('CONFIG_TRACE_' + k.to_upper(), true)
>  endforeach
> @@ -2207,16 +2220,8 @@ config_host_data.set('HAVE_VSS_SDK', have_vss_sdk)
>
>  ignored = ['CONFIG_QEMU_INTERP_PREFIX', # actually per-target
>      'HAVE_GDB_BIN']
> -arrays = ['CONFIG_BDRV_RW_WHITELIST', 'CONFIG_BDRV_RO_WHITELIST']
>  foreach k, v: config_host
> -  if ignored.contains(k)
> -    # do nothing
> -  elif arrays.contains(k)
> -    if v != ''
> -      v = '"' + '", "'.join(v.split()) + '", '
> -    endif
> -    config_host_data.set(k, v)
> -  elif k.startswith('CONFIG_')
> +  if k.startswith('CONFIG_') and not ignored.contains(k)
>      config_host_data.set(k, v == 'y' ? 1 : v)
>    endif
>  endforeach
> @@ -3786,8 +3791,8 @@ summary_info = {}
>  summary_info += {'coroutine backend':
> config_host['CONFIG_COROUTINE_BACKEND']}
>  summary_info += {'coroutine pool':    have_coroutine_pool}
>  if have_block
> -  summary_info += {'Block whitelist (rw)':
> config_host['CONFIG_BDRV_RW_WHITELIST']}
> -  summary_info += {'Block whitelist (ro)':
> config_host['CONFIG_BDRV_RO_WHITELIST']}
> +  summary_info += {'Block whitelist (rw)':
> get_option('block_drv_rw_whitelist')}
> +  summary_info += {'Block whitelist (ro)':
> get_option('block_drv_ro_whitelist')}
>    summary_info += {'Use block whitelist in tools':
> get_option('block_drv_whitelist_in_tools')}
>    summary_info += {'VirtFS support':    have_virtfs}
>    summary_info += {'build virtiofs daemon': have_virtiofsd}
> diff --git a/meson_options.txt b/meson_options.txt
> index 891c0ec130..ec974003b3 100644
> --- a/meson_options.txt
> +++ b/meson_options.txt
> @@ -21,6 +21,10 @@ option('default_devices', type : 'boolean', value :
> true,
>  option('audio_drv_list', type: 'array', value: ['default'],
>         choices: ['alsa', 'coreaudio', 'default', 'dsound', 'jack', 'oss',
> 'pa', 'sdl'],
>         description: 'Set audio driver list')
> +option('block_drv_rw_whitelist', type : 'string', value : '',
> +       description: 'set block driver read-write whitelist (by default
> affects only QEMU, not tools like qemu-img)')
> +option('block_drv_ro_whitelist', type : 'string', value : '',
> +       description: 'set block driver read-only whitelist (by default
> affects only QEMU, not tools like qemu-img)')
>  option('fuzzing_engine', type : 'string', value : '',
>         description: 'fuzzing engine library for OSS-Fuzz')
>  option('trace_file', type: 'string', value: 'trace',
> diff --git a/scripts/meson-buildoptions.sh b/scripts/meson-buildoptions.sh
> index 0e0548aa87..4c49d4af08 100644
> --- a/scripts/meson-buildoptions.sh
> +++ b/scripts/meson-buildoptions.sh
> @@ -2,6 +2,12 @@
>  meson_options_help() {
>    printf "%s\n" '  --audio-drv-list=CHOICES Set audio driver list
> [default] (choices:'
>    printf "%s\n" '
>  alsa/coreaudio/default/dsound/jack/oss/pa/sdl)'
> +  printf "%s\n" '  --block-drv-ro-whitelist=VALUE'
> +  printf "%s\n" '                           set block driver read-only
> whitelist (by default'
> +  printf "%s\n" '                           affects only QEMU, not tools
> like qemu-img)'
> +  printf "%s\n" '  --block-drv-rw-whitelist=VALUE'
> +  printf "%s\n" '                           set block driver read-write
> whitelist (by default'
> +  printf "%s\n" '                           affects only QEMU, not tools
> like qemu-img)'
>    printf "%s\n" '  --disable-coroutine-pool coroutine freelist (better
> performance)'
>    printf "%s\n" '  --disable-install-blobs  install provided firmware
> blobs'
>    printf "%s\n" '  --enable-block-drv-whitelist-in-tools'
> @@ -161,6 +167,8 @@ _meson_option_parse() {
>      --disable-avx2) printf "%s" -Davx2=disabled ;;
>      --enable-avx512f) printf "%s" -Davx512f=enabled ;;
>      --disable-avx512f) printf "%s" -Davx512f=disabled ;;
> +    --block-drv-ro-whitelist=*) quote_sh "-Dblock_drv_ro_whitelist=$2" ;;
> +    --block-drv-rw-whitelist=*) quote_sh "-Dblock_drv_rw_whitelist=$2" ;;
>      --enable-block-drv-whitelist-in-tools) printf "%s"
> -Dblock_drv_whitelist_in_tools=true ;;
>      --disable-block-drv-whitelist-in-tools) printf "%s"
> -Dblock_drv_whitelist_in_tools=false ;;
>      --enable-bochs) printf "%s" -Dbochs=enabled ;;
> --
> 2.35.1
>
>
>
>

-- 
Marc-André Lureau

[-- Attachment #2: Type: text/html, Size: 10610 bytes --]

^ permalink raw reply	[flat|nested] 74+ messages in thread

* Re: [PATCH 21/34] meson, configure: move --with-pkgversion, CONFIG_STAMP to meson
  2022-04-20 15:33 ` [PATCH 21/34] meson, configure: move --with-pkgversion, CONFIG_STAMP " Paolo Bonzini
@ 2022-04-20 18:34   ` Marc-André Lureau
  0 siblings, 0 replies; 74+ messages in thread
From: Marc-André Lureau @ 2022-04-20 18:34 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: QEMU

[-- Attachment #1: Type: text/plain, Size: 8679 bytes --]

On Wed, Apr 20, 2022 at 8:07 PM Paolo Bonzini <pbonzini@redhat.com> wrote:

> The hash is now generated with a Python script.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>

It's kind of strange that it takes "configure" as an input for the stamp
computation, but that's the way it works apparently

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>

---
>  configure                     | 23 -----------------------
>  docs/meson.build              |  2 +-
>  meson.build                   | 10 +++++++++-
>  meson_options.txt             |  2 ++
>  scripts/meson-buildoptions.py |  1 +
>  scripts/meson-buildoptions.sh |  3 +++
>  scripts/qemu-stamp.py         | 24 ++++++++++++++++++++++++
>  7 files changed, 40 insertions(+), 25 deletions(-)
>  create mode 100644 scripts/qemu-stamp.py
>
> diff --git a/configure b/configure
> index bc15854578..5bf0a7d69b 100755
> --- a/configure
> +++ b/configure
> @@ -306,7 +306,6 @@ qemu_suffix="qemu"
>  softmmu="yes"
>  linux_user=""
>  bsd_user=""
> -pkgversion=""
>  pie=""
>  coroutine=""
>  plugins="$default_feature"
> @@ -896,8 +895,6 @@ for opt do
>    ;;
>    --enable-fdt=*) fdt="$optarg"
>    ;;
> -  --with-pkgversion=*) pkgversion="$optarg"
> -  ;;
>    --with-coroutine=*) coroutine="$optarg"
>    ;;
>    --disable-vhost-net) vhost_net="no"
> @@ -1135,7 +1132,6 @@ Advanced options (experts only):
>    --firmwarepath=PATH      search PATH for firmware files
>    --efi-aarch64=PATH       PATH of efi file to use for aarch64 VMs.
>    --with-suffix=SUFFIX     suffix for QEMU data inside
> datadir/libdir/sysconfdir/docdir [$qemu_suffix]
> -  --with-pkgversion=VERS   use specified string as sub-version of the
> package
>    --without-default-features default all --enable-* options to "disabled"
>    --without-default-devices  do not include any device that is not needed
> to
>                             start the emulator (only use if you are
> including
> @@ -1722,21 +1718,6 @@ if ! compile_prog "$glib_cflags -Werror"
> "$glib_libs" ; then
>      fi
>  fi
>
> -##########################################
> -# SHA command probe for modules
> -if test "$modules" = yes; then
> -    shacmd_probe="sha1sum sha1 shasum"
> -    for c in $shacmd_probe; do
> -        if has $c; then
> -            shacmd="$c"
> -            break
> -        fi
> -    done
> -    if test "$shacmd" = ""; then
> -        error_exit "one of the checksum commands is required to enable
> modules: $shacmd_probe"
> -    fi
> -fi
> -
>  ##########################################
>  # fdt probe
>
> @@ -2173,13 +2154,9 @@ if test "$static" = "yes" ; then
>    echo "CONFIG_STATIC=y" >> $config_host_mak
>  fi
>  qemu_version=$(head $source_path/VERSION)
> -echo "PKGVERSION=$pkgversion" >>$config_host_mak
>  echo "SRC_PATH=$source_path" >> $config_host_mak
>  echo "TARGET_DIRS=$target_list" >> $config_host_mak
>  if test "$modules" = "yes"; then
> -  # $shacmd can generate a hash started with digit, which the compiler
> doesn't
> -  # like as an symbol. So prefix it with an underscore
> -  echo "CONFIG_STAMP=_$( (echo $qemu_version; echo $pkgversion; cat $0) |
> $shacmd - | cut -f1 -d\ )" >> $config_host_mak
>    echo "CONFIG_MODULES=y" >> $config_host_mak
>  fi
>
> diff --git a/docs/meson.build b/docs/meson.build
> index 831d4aea2b..9136fed3b7 100644
> --- a/docs/meson.build
> +++ b/docs/meson.build
> @@ -35,7 +35,7 @@ if sphinx_build.found()
>  endif
>
>  if build_docs
> -  SPHINX_ARGS += ['-Dversion=' + meson.project_version(), '-Drelease=' +
> config_host['PKGVERSION']]
> +  SPHINX_ARGS += ['-Dversion=' + meson.project_version(), '-Drelease=' +
> get_option('pkgversion')]
>
>    man_pages = {
>          'qemu-ga.8': (have_ga ? 'man8' : ''),
> diff --git a/meson.build b/meson.build
> index ee96cbc64e..424ff454d2 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -1626,6 +1626,14 @@
> config_host_data.set_quoted('CONFIG_QEMU_LOCALSTATEDIR',
> get_option('prefix') /
>  config_host_data.set_quoted('CONFIG_QEMU_MODDIR', get_option('prefix') /
> qemu_moddir)
>  config_host_data.set_quoted('CONFIG_SYSCONFDIR', get_option('prefix') /
> get_option('sysconfdir'))
>
> +if config_host.has_key('CONFIG_MODULES')
> +  config_host_data.set('CONFIG_STAMP', run_command(
> +      meson.current_source_dir() / 'scripts/qemu-stamp.py',
> +      meson.project_version(), get_option('pkgversion'), '--',
> +      meson.current_source_dir() / 'configure',
> +      capture: true, check: true).stdout().strip())
> +endif
> +
>  have_slirp_smbd = get_option('slirp_smbd') \
>    .require(targetos != 'windows', error_message: 'Host smbd not supported
> on this platform.') \
>    .allowed()
> @@ -2785,7 +2793,7 @@ tracetool_depends = files(
>
>  qemu_version_cmd = [find_program('scripts/qemu-version.sh'),
>                      meson.current_source_dir(),
> -                    config_host['PKGVERSION'], meson.project_version()]
> +                    get_option('pkgversion'), meson.project_version()]
>  qemu_version = custom_target('qemu-version.h',
>                               output: 'qemu-version.h',
>                               command: qemu_version_cmd,
> diff --git a/meson_options.txt b/meson_options.txt
> index ec974003b3..dc6fb796c6 100644
> --- a/meson_options.txt
> +++ b/meson_options.txt
> @@ -8,6 +8,8 @@ option('docdir', type : 'string', value : 'doc',
>         description: 'Base directory for documentation installation (can
> be empty)')
>  option('qemu_firmwarepath', type : 'string', value : '',
>         description: 'search PATH for firmware files')
> +option('pkgversion', type : 'string', value : '',
> +       description: 'use specified string as sub-version of the package')
>  option('smbd', type : 'string', value : '',
>         description: 'Path to smbd for slirp networking')
>  option('sphinx_build', type : 'string', value : '',
> diff --git a/scripts/meson-buildoptions.py b/scripts/meson-buildoptions.py
> index 3e540e8bb3..0f9603a7f6 100755
> --- a/scripts/meson-buildoptions.py
> +++ b/scripts/meson-buildoptions.py
> @@ -36,6 +36,7 @@
>
>  OPTION_NAMES = {
>      "malloc": "enable-malloc",
> +    "pkgversion": "with-pkgversion",
>      "trace_backends": "enable-trace-backends",
>      "trace_file": "with-trace-file",
>  }
> diff --git a/scripts/meson-buildoptions.sh b/scripts/meson-buildoptions.sh
> index 4c49d4af08..bf9878e24f 100644
> --- a/scripts/meson-buildoptions.sh
> +++ b/scripts/meson-buildoptions.sh
> @@ -44,6 +44,8 @@ meson_options_help() {
>    printf "%s\n" '  --sphinx-build=VALUE     Use specified sphinx-build
> for building document'
>    printf "%s\n" '  --tls-priority=VALUE     Default TLS protocol/cipher
> priority string'
>    printf "%s\n" '                           [NORMAL]'
> +  printf "%s\n" '  --with-pkgversion=VALUE  use specified string as
> sub-version of the'
> +  printf "%s\n" '                           package'
>    printf "%s\n" '  --with-trace-file=VALUE  Trace file prefix for simple
> backend [trace]'
>    printf "%s\n" ''
>    printf "%s\n" 'Optional features, enabled with --enable-FEATURE and'
> @@ -309,6 +311,7 @@ _meson_option_parse() {
>      --disable-pa) printf "%s" -Dpa=disabled ;;
>      --enable-parallels) printf "%s" -Dparallels=enabled ;;
>      --disable-parallels) printf "%s" -Dparallels=disabled ;;
> +    --with-pkgversion=*) quote_sh "-Dpkgversion=$2" ;;
>      --enable-profiler) printf "%s" -Dprofiler=true ;;
>      --disable-profiler) printf "%s" -Dprofiler=false ;;
>      --enable-pvrdma) printf "%s" -Dpvrdma=enabled ;;
> diff --git a/scripts/qemu-stamp.py b/scripts/qemu-stamp.py
> new file mode 100644
> index 0000000000..7beeeb07ed
> --- /dev/null
> +++ b/scripts/qemu-stamp.py
> @@ -0,0 +1,24 @@
> +#! /usr/bin/env python3
> +
> +# Usage: scripts/qemu-stamp.py STRING1 STRING2... -- FILE1 FILE2...
> +import hashlib
> +import os
> +import sys
> +
> +sha = hashlib.sha1()
> +is_file = False
> +for arg in sys.argv[1:]:
> +    if arg == '--':
> +        is_file = True
> +        continue
> +    if is_file:
> +        with open(arg, 'rb') as f:
> +            for chunk in iter(lambda: f.read(65536), b''):
> +                sha.update(chunk)
> +    else:
> +        sha.update(os.fsencode(arg))
> +        sha.update(b'\n')
> +
> +# The hash can start with a digit, which the compiler doesn't
> +# like as an symbol. So prefix it with an underscore
> +print("_" + sha.hexdigest())
> --
> 2.35.1
>
>
>
>

-- 
Marc-André Lureau

[-- Attachment #2: Type: text/html, Size: 11218 bytes --]

^ permalink raw reply	[flat|nested] 74+ messages in thread

* Re: [PATCH 22/34] meson, configure: move --interp-prefix to meson
  2022-04-20 15:33 ` [PATCH 22/34] meson, configure: move --interp-prefix " Paolo Bonzini
@ 2022-04-20 18:40   ` Marc-André Lureau
  0 siblings, 0 replies; 74+ messages in thread
From: Marc-André Lureau @ 2022-04-20 18:40 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: QEMU

[-- Attachment #1: Type: text/plain, Size: 5146 bytes --]

Hi

On Wed, Apr 20, 2022 at 7:48 PM Paolo Bonzini <pbonzini@redhat.com> wrote:

> This is the last CONFIG_* entry in config-host.mak that had to be
> special cased.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>

A strange option, I wonder if it is really useful... anyway, for the move:

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>



> ---
>  configure                     | 6 ------
>  meson.build                   | 6 ++----
>  meson_options.txt             | 2 ++
>  scripts/meson-buildoptions.sh | 3 +++
>  4 files changed, 7 insertions(+), 10 deletions(-)
>
> diff --git a/configure b/configure
> index 5bf0a7d69b..200ef3be23 100755
> --- a/configure
> +++ b/configure
> @@ -231,7 +231,6 @@ fi
>
>  # default parameters
>  cpu=""
> -interp_prefix="/usr/gnemul/qemu-%M"
>  static="no"
>  cross_compile="no"
>  cross_prefix=""
> @@ -696,8 +695,6 @@ for opt do
>    ;;
>    --prefix=*) prefix="$optarg"
>    ;;
> -  --interp-prefix=*) interp_prefix="$optarg"
> -  ;;
>    --cross-prefix=*)
>    ;;
>    --cc=*)
> @@ -1090,8 +1087,6 @@ Options: [defaults in brackets after descriptions]
>  Standard options:
>    --help                   print this message
>    --prefix=PREFIX          install in PREFIX [$prefix]
> -  --interp-prefix=PREFIX   where to find shared libraries, etc.
> -                           use %M for cpu name [$interp_prefix]
>    --target-list=LIST       set target list (default: build all)
>  $(echo Available targets: $default_target_list | \
>    fold -s -w 53 | sed -e 's/^/                           /')
> @@ -2289,7 +2284,6 @@ for target in $target_list; do
>      esac
>  done
>
> -echo "CONFIG_QEMU_INTERP_PREFIX=$interp_prefix" | sed 's/%M/@0@/' >>
> $config_host_mak
>  if test "$default_targets" = "yes"; then
>    echo "CONFIG_DEFAULT_TARGETS=y" >> $config_host_mak
>  fi
> diff --git a/meson.build b/meson.build
> index 424ff454d2..869cc10128 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -2226,10 +2226,8 @@ if targetos == 'windows' and link_language == 'cpp'
>  endif
>  config_host_data.set('HAVE_VSS_SDK', have_vss_sdk)
>
> -ignored = ['CONFIG_QEMU_INTERP_PREFIX', # actually per-target
> -    'HAVE_GDB_BIN']
>  foreach k, v: config_host
> -  if k.startswith('CONFIG_') and not ignored.contains(k)
> +  if k.startswith('CONFIG_')
>      config_host_data.set(k, v == 'y' ? 1 : v)
>    endif
>  endforeach
> @@ -2323,7 +2321,7 @@ foreach target : target_dirs
>      config_target += {
>        'CONFIG_USER_ONLY': 'y',
>        'CONFIG_QEMU_INTERP_PREFIX':
> -
> config_host['CONFIG_QEMU_INTERP_PREFIX'].format(config_target['TARGET_NAME'])
> +        get_option('interp_prefix').replace('%M',
> config_target['TARGET_NAME'])
>      }
>    endif
>
> diff --git a/meson_options.txt b/meson_options.txt
> index dc6fb796c6..848426460c 100644
> --- a/meson_options.txt
> +++ b/meson_options.txt
> @@ -27,6 +27,8 @@ option('block_drv_rw_whitelist', type : 'string', value
> : '',
>         description: 'set block driver read-write whitelist (by default
> affects only QEMU, not tools like qemu-img)')
>  option('block_drv_ro_whitelist', type : 'string', value : '',
>         description: 'set block driver read-only whitelist (by default
> affects only QEMU, not tools like qemu-img)')
> +option('interp_prefix', type : 'string', value : '/usr/gnemul/qemu-%M',
> +       description: 'where to find shared libraries etc., use %M for cpu
> name')
>  option('fuzzing_engine', type : 'string', value : '',
>         description: 'fuzzing engine library for OSS-Fuzz')
>  option('trace_file', type: 'string', value: 'trace',
> diff --git a/scripts/meson-buildoptions.sh b/scripts/meson-buildoptions.sh
> index bf9878e24f..a0c86db116 100644
> --- a/scripts/meson-buildoptions.sh
> +++ b/scripts/meson-buildoptions.sh
> @@ -41,6 +41,8 @@ meson_options_help() {
>    printf "%s\n" '                           Set available tracing
> backends [log] (choices:'
>    printf "%s\n" '
>  dtrace/ftrace/log/nop/simple/syslog/ust)'
>    printf "%s\n" '  --iasl=VALUE             Path to ACPI disassembler'
> +  printf "%s\n" '  --interp-prefix=VALUE    where to find shared
> libraries etc., use %M for'
> +  printf "%s\n" '                           cpu name
> [/usr/gnemul/qemu-%M]'
>    printf "%s\n" '  --sphinx-build=VALUE     Use specified sphinx-build
> for building document'
>    printf "%s\n" '  --tls-priority=VALUE     Default TLS protocol/cipher
> priority string'
>    printf "%s\n" '                           [NORMAL]'
> @@ -252,6 +254,7 @@ _meson_option_parse() {
>      --disable-iconv) printf "%s" -Diconv=disabled ;;
>      --enable-install-blobs) printf "%s" -Dinstall_blobs=true ;;
>      --disable-install-blobs) printf "%s" -Dinstall_blobs=false ;;
> +    --interp-prefix=*) quote_sh "-Dinterp_prefix=$2" ;;
>      --enable-jack) printf "%s" -Djack=enabled ;;
>      --disable-jack) printf "%s" -Djack=disabled ;;
>      --enable-keyring) printf "%s" -Dkeyring=enabled ;;
> --
> 2.35.1
>
>
>
>

-- 
Marc-André Lureau

[-- Attachment #2: Type: text/html, Size: 6975 bytes --]

^ permalink raw reply	[flat|nested] 74+ messages in thread

* Re: [PATCH 23/34] meson: always combine directories with prefix
  2022-04-20 15:33 ` [PATCH 23/34] meson: always combine directories with prefix Paolo Bonzini
@ 2022-04-20 18:43   ` Marc-André Lureau
  0 siblings, 0 replies; 74+ messages in thread
From: Marc-André Lureau @ 2022-04-20 18:43 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: QEMU

[-- Attachment #1: Type: text/plain, Size: 3786 bytes --]

On Wed, Apr 20, 2022 at 7:51 PM Paolo Bonzini <pbonzini@redhat.com> wrote:

> Meson allows directories such as "bindir" to be relative to the prefix.
> Right
> now configure is forcing an absolute path, but that is not really
> necessary:
> just make sure all uses of the directory variables are prefixed
> appropriately.
> Do the same also for the options that are custom for QEMU, i.e. docdir and
> qemu_firmwarepath.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>


> ---
>  meson.build | 20 ++++++++++----------
>  1 file changed, 10 insertions(+), 10 deletions(-)
>
> diff --git a/meson.build b/meson.build
> index 869cc10128..2545ac2848 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -1618,7 +1618,7 @@ config_host_data.set_quoted('CONFIG_PREFIX',
> get_option('prefix'))
>  config_host_data.set_quoted('CONFIG_QEMU_CONFDIR', get_option('prefix') /
> qemu_confdir)
>  config_host_data.set_quoted('CONFIG_QEMU_DATADIR', get_option('prefix') /
> qemu_datadir)
>  config_host_data.set_quoted('CONFIG_QEMU_DESKTOPDIR',
> get_option('prefix') / qemu_desktopdir)
> -config_host_data.set_quoted('CONFIG_QEMU_FIRMWAREPATH',
> get_option('qemu_firmwarepath'))
> +config_host_data.set_quoted('CONFIG_QEMU_FIRMWAREPATH',
> get_option('prefix') / get_option('qemu_firmwarepath'))
>  config_host_data.set_quoted('CONFIG_QEMU_HELPERDIR', get_option('prefix')
> / get_option('libexecdir'))
>  config_host_data.set_quoted('CONFIG_QEMU_ICONDIR', get_option('prefix') /
> qemu_icondir)
>  config_host_data.set_quoted('CONFIG_QEMU_LOCALEDIR', get_option('prefix')
> / get_option('localedir'))
> @@ -3615,20 +3615,20 @@ endif
>  summary_info = {}
>  summary_info += {'Install prefix':    get_option('prefix')}
>  summary_info += {'BIOS directory':    qemu_datadir}
> -summary_info += {'firmware path':     get_option('qemu_firmwarepath')}
> -summary_info += {'binary directory':  get_option('bindir')}
> -summary_info += {'library directory': get_option('libdir')}
> +summary_info += {'firmware path':     get_option('prefix') /
> get_option('qemu_firmwarepath')}
> +summary_info += {'binary directory':  get_option('prefix') /
> get_option('bindir')}
> +summary_info += {'library directory': get_option('prefix') /
> get_option('libdir')}
>  summary_info += {'module directory':  qemu_moddir}
> -summary_info += {'libexec directory': get_option('libexecdir')}
> -summary_info += {'include directory': get_option('includedir')}
> -summary_info += {'config directory':  get_option('sysconfdir')}
> +summary_info += {'libexec directory': get_option('prefix') /
> get_option('libexecdir')}
> +summary_info += {'include directory': get_option('prefix') /
> get_option('includedir')}
> +summary_info += {'config directory':  get_option('prefix') /
> get_option('sysconfdir')}
>  if targetos != 'windows'
> -  summary_info += {'local state directory': get_option('localstatedir')}
> -  summary_info += {'Manual directory':      get_option('mandir')}
> +  summary_info += {'local state directory': get_option('prefix') /
> get_option('localstatedir')}
> +  summary_info += {'Manual directory':      get_option('prefix') /
> get_option('mandir')}
>  else
>    summary_info += {'local state directory': 'queried at runtime'}
>  endif
> -summary_info += {'Doc directory':     get_option('docdir')}
> +summary_info += {'Doc directory':     get_option('prefix') /
> get_option('docdir')}
>  summary_info += {'Build directory':   meson.current_build_dir()}
>  summary_info += {'Source path':       meson.current_source_dir()}
>  summary_info += {'GIT submodules':    config_host['GIT_SUBMODULES']}
> --
> 2.35.1
>
>
>
>

-- 
Marc-André Lureau

[-- Attachment #2: Type: text/html, Size: 5182 bytes --]

^ permalink raw reply	[flat|nested] 74+ messages in thread

* Re: [PATCH 17/34] configure: move Windows flags detection to meson
  2022-04-20 18:20   ` Marc-André Lureau
@ 2022-04-20 19:15     ` Paolo Bonzini
  0 siblings, 0 replies; 74+ messages in thread
From: Paolo Bonzini @ 2022-04-20 19:15 UTC (permalink / raw)
  To: Marc-André Lureau; +Cc: QEMU



Il 20 aprile 2022 20:20:20 CEST, "Marc-André Lureau" <marcandre.lureau@gmail.com> ha scritto:
>> +  # Disable ASLR for debug builds to allow debugging with gdb
>> +  if get_option('optimization') == 0
>
>
>../meson.build:188:5: ERROR: The `==` operator of str does not accept
>objects of type int (0)
>
>Why not check 'debug' ?

In Meson, -Ddebug governs whether debug info is included. In configure, --enable-debug disables optimization (and is a string apparently rather than an int...).

Paolo

>
>
>> +    qemu_ldflags += cc.get_supported_link_arguments('-Wl,--dynamicbase')
>> +  endif
>> +endif
>> +
>>  if get_option('gprof')
>>    qemu_cflags += ['-p']
>>    qemu_cxxflags += ['-p']
>> --
>> 2.35.1
>>
>>
>>
>>
>



^ permalink raw reply	[flat|nested] 74+ messages in thread

* Re: [PATCH 07/34] configure, meson: move OpenGL check to meson
  2022-04-20 16:13   ` Marc-André Lureau
@ 2022-04-20 19:17     ` Paolo Bonzini
  0 siblings, 0 replies; 74+ messages in thread
From: Paolo Bonzini @ 2022-04-20 19:17 UTC (permalink / raw)
  To: Marc-André Lureau; +Cc: QEMU



Il 20 aprile 2022 18:13:30 CEST, "Marc-André Lureau" <marcandre.lureau@gmail.com> ha scritto:
>> -if config_host.has_key('CONFIG_OPENGL')
>> +softmmu_ss.add(opengl)
>>
>
>I guess this line is superfluous

It's needed for the include path, iirc.

Paolo

>
>
>> +if opengl.found()
>>    opengl_ss = ss.source_set()
>>    opengl_ss.add(gbm)
>> -  opengl_ss.add(when: [opengl, pixman, 'CONFIG_OPENGL'],
>> +  opengl_ss.add(when: [opengl, pixman],
>>                 if_true: files('shader.c', 'console-gl.c',
>> 'egl-helpers.c', 'egl-context.c'))
>>    ui_modules += {'opengl' : opengl_ss}
>>  endif
>>
>> -if config_host.has_key('CONFIG_OPENGL') and gbm.found()
>> +if opengl.found() and gbm.found()
>>    egl_headless_ss = ss.source_set()
>> -  egl_headless_ss.add(when: [opengl, gbm, pixman, 'CONFIG_OPENGL'],
>> +  egl_headless_ss.add(when: [opengl, gbm, pixman],
>>                        if_true: files('egl-headless.c'))
>>    ui_modules += {'egl-headless' : egl_headless_ss}
>>  endif
>> @@ -98,8 +99,8 @@ if gtk.found()
>>    gtk_ss = ss.source_set()
>>    gtk_ss.add(gtk, vte, pixman, files('gtk.c', 'gtk-clipboard.c'))
>>    gtk_ss.add(when: x11, if_true: files('x_keymap.c'))
>> -  gtk_ss.add(when: [opengl, 'CONFIG_OPENGL'], if_true:
>> files('gtk-gl-area.c'))
>> -  gtk_ss.add(when: [x11, opengl, 'CONFIG_OPENGL'], if_true:
>> files('gtk-egl.c'))
>> +  gtk_ss.add(when: opengl, if_true: files('gtk-gl-area.c'))
>> +  gtk_ss.add(when: [x11, opengl], if_true: files('gtk-egl.c'))
>>    ui_modules += {'gtk' : gtk_ss}
>>  endif
>>
>> @@ -112,7 +113,7 @@ if sdl.found()
>>      'sdl2-input.c',
>>      'sdl2.c',
>>    ))
>> -  sdl_ss.add(when: [opengl, 'CONFIG_OPENGL'], if_true: files('sdl2-gl.c'))
>> +  sdl_ss.add(when: opengl, if_true: files('sdl2-gl.c'))
>>    sdl_ss.add(when: x11, if_true: files('x_keymap.c'))
>>    ui_modules += {'sdl' : sdl_ss}
>>  endif
>> --
>> 2.35.1
>>
>>
>>
>>
>Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
>



^ permalink raw reply	[flat|nested] 74+ messages in thread

* Re: [PATCH 24/34] configure: switch directory options to automatic parsing
  2022-04-20 15:33 ` [PATCH 24/34] configure: switch directory options to automatic parsing Paolo Bonzini
@ 2022-04-21  9:48   ` Marc-André Lureau
  2022-04-21 12:02     ` Paolo Bonzini
  0 siblings, 1 reply; 74+ messages in thread
From: Marc-André Lureau @ 2022-04-21  9:48 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: QEMU

[-- Attachment #1: Type: text/plain, Size: 13444 bytes --]

Hi

On Wed, Apr 20, 2022 at 8:11 PM Paolo Bonzini <pbonzini@redhat.com> wrote:

> While prefix, bindir and qemu_suffix needs special treatment due to
> differences between Windows and POSIX systems, everything else
> needs no extra code in configure.
>
>
Afaik, it's not common to install binaries under $prefix on Windows. I
don't know any open-source project doing that. msys2 explicitly change it
to bin again:
https://github.com/msys2/MINGW-packages/blob/master/mingw-w64-qemu/PKGBUILD#L94


> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>

 Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>

---
>  configure                     | 58 ++---------------------------------
>  meson_options.txt             |  4 +--
>  scripts/meson-buildoptions.py | 11 +++++--
>  scripts/meson-buildoptions.sh | 21 +++++++++++++
>  4 files changed, 34 insertions(+), 60 deletions(-)
>
> diff --git a/configure b/configure
> index 200ef3be23..b704453c68 100755
> --- a/configure
> +++ b/configure
> @@ -311,6 +311,7 @@ plugins="$default_feature"
>  meson=""
>  meson_args=""
>  ninja=""
> +bindir="bin"
>  skip_meson=no
>
>  # The following Meson options are handled manually (still they
> @@ -669,6 +670,7 @@ if test "$mingw32" = "yes" ; then
>    CONFIGURE_CFLAGS="-mthreads $CONFIGURE_CFLAGS"
>    write_c_skeleton;
>    prefix="/qemu"
> +  bindir=""
>    qemu_suffix=""
>  fi
>
> @@ -775,30 +777,10 @@ for opt do
>      static="yes"
>      QEMU_PKG_CONFIG_FLAGS="--static $QEMU_PKG_CONFIG_FLAGS"
>    ;;
> -  --mandir=*) mandir="$optarg"
> -  ;;
>    --bindir=*) bindir="$optarg"
>    ;;
> -  --libdir=*) libdir="$optarg"
> -  ;;
> -  --libexecdir=*) libexecdir="$optarg"
> -  ;;
> -  --includedir=*) includedir="$optarg"
> -  ;;
> -  --datadir=*) datadir="$optarg"
> -  ;;
>    --with-suffix=*) qemu_suffix="$optarg"
>    ;;
> -  --docdir=*) docdir="$optarg"
> -  ;;
> -  --localedir=*) localedir="$optarg"
> -  ;;
> -  --sysconfdir=*) sysconfdir="$optarg"
> -  ;;
> -  --localstatedir=*) local_statedir="$optarg"
> -  ;;
> -  --firmwarepath=*) firmwarepath="$optarg"
> -  ;;
>    --host=*|--build=*|\
>    --disable-dependency-tracking|\
>    --sbindir=*|--sharedstatedir=*|\
> @@ -1021,23 +1003,6 @@ case $git_submodules_action in
>      ;;
>  esac
>
> -libdir="${libdir:-$prefix/lib}"
> -libexecdir="${libexecdir:-$prefix/libexec}"
> -includedir="${includedir:-$prefix/include}"
> -
> -if test "$mingw32" = "yes" ; then
> -    bindir="${bindir:-$prefix}"
> -else
> -    bindir="${bindir:-$prefix/bin}"
> -fi
> -mandir="${mandir:-$prefix/share/man}"
> -datadir="${datadir:-$prefix/share}"
> -docdir="${docdir:-$prefix/share/doc}"
> -sysconfdir="${sysconfdir:-$prefix/etc}"
> -local_statedir="${local_statedir:-$prefix/var}"
> -firmwarepath="${firmwarepath:-$datadir/qemu-firmware}"
> -localedir="${localedir:-$datadir/locale}"
> -
>  if eval test -z "\${cross_cc_$cpu}"; then
>      eval "cross_cc_${cpu}=\$cc"
>      cross_cc_vars="$cross_cc_vars cross_cc_${cpu}"
> @@ -1115,16 +1080,7 @@ Advanced options (experts only):
>    --with-git-submodules=validate fail if git submodules are not up to date
>    --with-git-submodules=ignore   do not update or check git submodules
> (default if no .git dir)
>    --static                 enable static build [$static]
> -  --mandir=PATH            install man pages in PATH
> -  --datadir=PATH           install firmware in PATH/$qemu_suffix
> -  --localedir=PATH         install translation in PATH/$qemu_suffix
> -  --docdir=PATH            install documentation in PATH/$qemu_suffix
>    --bindir=PATH            install binaries in PATH
> -  --libdir=PATH            install libraries in PATH
> -  --libexecdir=PATH        install helper binaries in PATH
> -  --sysconfdir=PATH        install config in PATH/$qemu_suffix
> -  --localstatedir=PATH     install local state in PATH (set at runtime on
> win32)
> -  --firmwarepath=PATH      search PATH for firmware files
>    --efi-aarch64=PATH       PATH of efi file to use for aarch64 VMs.
>    --with-suffix=SUFFIX     suffix for QEMU data inside
> datadir/libdir/sysconfdir/docdir [$qemu_suffix]
>    --without-default-features default all --enable-* options to "disabled"
> @@ -2409,18 +2365,8 @@ if test "$skip_meson" = no; then
>    run_meson() {
>      NINJA=$ninja $meson setup \
>          --prefix "$prefix" \
> -        --libdir "$libdir" \
> -        --libexecdir "$libexecdir" \
>          --bindir "$bindir" \
> -        --includedir "$includedir" \
> -        --datadir "$datadir" \
> -        --mandir "$mandir" \
> -        --sysconfdir "$sysconfdir" \
> -        --localedir "$localedir" \
> -        --localstatedir "$local_statedir" \
>          -Ddefault_devices=$default_devices \
> -        -Ddocdir="$docdir" \
> -        -Dqemu_firmwarepath="$firmwarepath" \
>          -Dqemu_suffix="$qemu_suffix" \
>          -Dsmbd="$smbd" \
>          -Doptimization=$(if test "$debug" = yes; then echo 0; else echo
> 2; fi) \
> diff --git a/meson_options.txt b/meson_options.txt
> index 848426460c..a76fadbd7d 100644
> --- a/meson_options.txt
> +++ b/meson_options.txt
> @@ -4,9 +4,9 @@
>
>  option('qemu_suffix', type : 'string', value: 'qemu',
>         description: 'Suffix for QEMU data/modules/config directories (can
> be empty)')
> -option('docdir', type : 'string', value : 'doc',
> +option('docdir', type : 'string', value : 'share/doc',
>         description: 'Base directory for documentation installation (can
> be empty)')
> -option('qemu_firmwarepath', type : 'string', value : '',
> +option('qemu_firmwarepath', type : 'string', value : 'qemu-firmware',
>         description: 'search PATH for firmware files')
>  option('pkgversion', type : 'string', value : '',
>         description: 'use specified string as sub-version of the package')
> diff --git a/scripts/meson-buildoptions.py b/scripts/meson-buildoptions.py
> index 0f9603a7f6..45cda8cd84 100755
> --- a/scripts/meson-buildoptions.py
> +++ b/scripts/meson-buildoptions.py
> @@ -27,9 +27,7 @@
>
>  SKIP_OPTIONS = {
>      "default_devices",
> -    "docdir",
>      "fuzzing_engine",
> -    "qemu_firmwarepath",
>      "qemu_suffix",
>      "smbd",
>  }
> @@ -37,12 +35,21 @@
>  OPTION_NAMES = {
>      "malloc": "enable-malloc",
>      "pkgversion": "with-pkgversion",
> +    "qemu_firmwarepath": "firmwarepath",
>      "trace_backends": "enable-trace-backends",
>      "trace_file": "with-trace-file",
>  }
>
>  BUILTIN_OPTIONS = {
> +    "datadir",
> +    "includedir",
> +    "libdir",
> +    "libexecdir",
> +    "localedir",
> +    "localstatedir",
> +    "mandir",
>      "strip",
> +    "sysconfdir",
>  }
>
>  LINE_WIDTH = 76
> diff --git a/scripts/meson-buildoptions.sh b/scripts/meson-buildoptions.sh
> index a0c86db116..a52cc14d13 100644
> --- a/scripts/meson-buildoptions.sh
> +++ b/scripts/meson-buildoptions.sh
> @@ -8,8 +8,11 @@ meson_options_help() {
>    printf "%s\n" '  --block-drv-rw-whitelist=VALUE'
>    printf "%s\n" '                           set block driver read-write
> whitelist (by default'
>    printf "%s\n" '                           affects only QEMU, not tools
> like qemu-img)'
> +  printf "%s\n" '  --datadir=VALUE          Data file directory [share]'
>    printf "%s\n" '  --disable-coroutine-pool coroutine freelist (better
> performance)'
>    printf "%s\n" '  --disable-install-blobs  install provided firmware
> blobs'
> +  printf "%s\n" '  --docdir=VALUE           Base directory for
> documentation installation'
> +  printf "%s\n" '                           (can be empty) [share/doc]'
>    printf "%s\n" '  --enable-block-drv-whitelist-in-tools'
>    printf "%s\n" '                           use block whitelist also in
> tools instead of only'
>    printf "%s\n" '                           QEMU'
> @@ -40,10 +43,18 @@ meson_options_help() {
>    printf "%s\n" '  --enable-trace-backends=CHOICES'
>    printf "%s\n" '                           Set available tracing
> backends [log] (choices:'
>    printf "%s\n" '
>  dtrace/ftrace/log/nop/simple/syslog/ust)'
> +  printf "%s\n" '  --firmwarepath=VALUE     search PATH for firmware
> files [qemu-firmware]'
>    printf "%s\n" '  --iasl=VALUE             Path to ACPI disassembler'
> +  printf "%s\n" '  --includedir=VALUE       Header file directory
> [include]'
>    printf "%s\n" '  --interp-prefix=VALUE    where to find shared
> libraries etc., use %M for'
>    printf "%s\n" '                           cpu name
> [/usr/gnemul/qemu-%M]'
> +  printf "%s\n" '  --libdir=VALUE           Library directory [lib64]'
> +  printf "%s\n" '  --libexecdir=VALUE       Library executable directory
> [libexec]'
> +  printf "%s\n" '  --localedir=VALUE        Locale data directory
> [share/locale]'
> +  printf "%s\n" '  --localstatedir=VALUE    Localstate data directory
> [/var/local]'
> +  printf "%s\n" '  --mandir=VALUE           Manual page directory
> [share/man]'
>    printf "%s\n" '  --sphinx-build=VALUE     Use specified sphinx-build
> for building document'
> +  printf "%s\n" '  --sysconfdir=VALUE       Sysconf data directory [etc]'
>    printf "%s\n" '  --tls-priority=VALUE     Default TLS protocol/cipher
> priority string'
>    printf "%s\n" '                           [NORMAL]'
>    printf "%s\n" '  --with-pkgversion=VALUE  use specified string as
> sub-version of the'
> @@ -206,6 +217,7 @@ _meson_option_parse() {
>      --disable-curl) printf "%s" -Dcurl=disabled ;;
>      --enable-curses) printf "%s" -Dcurses=enabled ;;
>      --disable-curses) printf "%s" -Dcurses=disabled ;;
> +    --datadir=*) quote_sh "-Ddatadir=$2" ;;
>      --enable-dbus-display) printf "%s" -Ddbus_display=enabled ;;
>      --disable-dbus-display) printf "%s" -Ddbus_display=disabled ;;
>      --enable-debug-mutex) printf "%s" -Ddebug_mutex=true ;;
> @@ -214,6 +226,7 @@ _meson_option_parse() {
>      --disable-debug-stack-usage) printf "%s" -Ddebug_stack_usage=false ;;
>      --enable-dmg) printf "%s" -Ddmg=enabled ;;
>      --disable-dmg) printf "%s" -Ddmg=disabled ;;
> +    --docdir=*) quote_sh "-Ddocdir=$2" ;;
>      --enable-docs) printf "%s" -Ddocs=enabled ;;
>      --disable-docs) printf "%s" -Ddocs=disabled ;;
>      --enable-dsound) printf "%s" -Ddsound=enabled ;;
> @@ -252,6 +265,7 @@ _meson_option_parse() {
>      --iasl=*) quote_sh "-Diasl=$2" ;;
>      --enable-iconv) printf "%s" -Diconv=enabled ;;
>      --disable-iconv) printf "%s" -Diconv=disabled ;;
> +    --includedir=*) quote_sh "-Dincludedir=$2" ;;
>      --enable-install-blobs) printf "%s" -Dinstall_blobs=true ;;
>      --disable-install-blobs) printf "%s" -Dinstall_blobs=false ;;
>      --interp-prefix=*) quote_sh "-Dinterp_prefix=$2" ;;
> @@ -265,6 +279,8 @@ _meson_option_parse() {
>      --disable-l2tpv3) printf "%s" -Dl2tpv3=disabled ;;
>      --enable-libdaxctl) printf "%s" -Dlibdaxctl=enabled ;;
>      --disable-libdaxctl) printf "%s" -Dlibdaxctl=disabled ;;
> +    --libdir=*) quote_sh "-Dlibdir=$2" ;;
> +    --libexecdir=*) quote_sh "-Dlibexecdir=$2" ;;
>      --enable-libiscsi) printf "%s" -Dlibiscsi=enabled ;;
>      --disable-libiscsi) printf "%s" -Dlibiscsi=disabled ;;
>      --enable-libnfs) printf "%s" -Dlibnfs=enabled ;;
> @@ -283,6 +299,8 @@ _meson_option_parse() {
>      --disable-linux-io-uring) printf "%s" -Dlinux_io_uring=disabled ;;
>      --enable-live-block-migration) printf "%s"
> -Dlive_block_migration=enabled ;;
>      --disable-live-block-migration) printf "%s"
> -Dlive_block_migration=disabled ;;
> +    --localedir=*) quote_sh "-Dlocaledir=$2" ;;
> +    --localstatedir=*) quote_sh "-Dlocalstatedir=$2" ;;
>      --enable-lzfse) printf "%s" -Dlzfse=enabled ;;
>      --disable-lzfse) printf "%s" -Dlzfse=disabled ;;
>      --enable-lzo) printf "%s" -Dlzo=enabled ;;
> @@ -290,6 +308,7 @@ _meson_option_parse() {
>      --enable-malloc=*) quote_sh "-Dmalloc=$2" ;;
>      --enable-malloc-trim) printf "%s" -Dmalloc_trim=enabled ;;
>      --disable-malloc-trim) printf "%s" -Dmalloc_trim=disabled ;;
> +    --mandir=*) quote_sh "-Dmandir=$2" ;;
>      --enable-membarrier) printf "%s" -Dmembarrier=enabled ;;
>      --disable-membarrier) printf "%s" -Dmembarrier=disabled ;;
>      --enable-module-upgrades) printf "%s" -Dmodule_upgrades=true ;;
> @@ -323,6 +342,7 @@ _meson_option_parse() {
>      --disable-qcow1) printf "%s" -Dqcow1=disabled ;;
>      --enable-qed) printf "%s" -Dqed=enabled ;;
>      --disable-qed) printf "%s" -Dqed=disabled ;;
> +    --firmwarepath=*) quote_sh "-Dqemu_firmwarepath=$2" ;;
>      --enable-qga-vss) printf "%s" -Dqga_vss=enabled ;;
>      --disable-qga-vss) printf "%s" -Dqga_vss=disabled ;;
>      --enable-qom-cast-debug) printf "%s" -Dqom_cast_debug=true ;;
> @@ -361,6 +381,7 @@ _meson_option_parse() {
>      --disable-spice-protocol) printf "%s" -Dspice_protocol=disabled ;;
>      --enable-strip) printf "%s" -Dstrip=true ;;
>      --disable-strip) printf "%s" -Dstrip=false ;;
> +    --sysconfdir=*) quote_sh "-Dsysconfdir=$2" ;;
>      --enable-tcg) printf "%s" -Dtcg=enabled ;;
>      --disable-tcg) printf "%s" -Dtcg=disabled ;;
>      --enable-tcg-interpreter) printf "%s" -Dtcg_interpreter=true ;;
> --
> 2.35.1
>
>
>
>

-- 
Marc-André Lureau

[-- Attachment #2: Type: text/html, Size: 17756 bytes --]

^ permalink raw reply	[flat|nested] 74+ messages in thread

* Re: [PATCH 25/34] meson: pass more options directly as -D
  2022-04-20 15:33 ` [PATCH 25/34] meson: pass more options directly as -D Paolo Bonzini
@ 2022-04-21  9:52   ` Marc-André Lureau
  0 siblings, 0 replies; 74+ messages in thread
From: Marc-André Lureau @ 2022-04-21  9:52 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: QEMU

[-- Attachment #1: Type: text/plain, Size: 9261 bytes --]

On Wed, Apr 20, 2022 at 8:00 PM Paolo Bonzini <pbonzini@redhat.com> wrote:

> If an option is not used anywhere by the configure script, it can be just
> added to $meson_options even if it is not parsed by the automatically
> generated bits in scripts/meson-buildoptions.sh.
>
> The only slightly tricky case is $debug, where the
>
>   if test "$fortify_source" = "yes" ; then
>     QEMU_CFLAGS="-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $QEMU_CFLAGS"
>     debug=no
>   fi
>
> assignment is dead; configure sets fortify_source=no whenever debug=yes.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>

 Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>




> ---
>  configure                     | 39 ++++++++++-------------------------
>  meson.build                   |  2 +-
>  scripts/meson-buildoptions.py |  4 ++++
>  scripts/meson-buildoptions.sh |  6 ++++++
>  4 files changed, 22 insertions(+), 29 deletions(-)
>
> diff --git a/configure b/configure
> index b704453c68..4997983b5d 100755
> --- a/configure
> +++ b/configure
> @@ -235,7 +235,6 @@ static="no"
>  cross_compile="no"
>  cross_prefix=""
>  host_cc="cc"
> -lto="false"
>  stack_protector=""
>  safe_stack=""
>  use_containers="yes"
> @@ -291,13 +290,10 @@ vhost_vsock="$default_feature"
>  vhost_user="no"
>  vhost_user_fs="$default_feature"
>  vhost_vdpa="$default_feature"
> -debug_info="yes"
>  debug_tcg="no"
> -debug="no"
>  sanitizers="no"
>  tsan="no"
>  fortify_source="$default_feature"
> -gcov="no"
>  EXESUF=""
>  modules="no"
>  prefix="/usr/local"
> @@ -327,10 +323,7 @@ else
>  fi
>  fdt="auto"
>
> -# 2. Support --with/--without option
> -default_devices="true"
> -
> -# 3. Automatically enable/disable other options
> +# 2. Automatically enable/disable other options
>  tcg="enabled"
>  cfi="false"
>
> @@ -679,6 +672,9 @@ werror=""
>  . $source_path/scripts/meson-buildoptions.sh
>
>  meson_options=
> +meson_option_add() {
> +  meson_options="$meson_options $(quote_sh "$1")"
> +}
>  meson_option_parse() {
>    meson_options="$meson_options $(_meson_option_parse "$@")"
>    if test $? -eq 1; then
> @@ -731,9 +727,9 @@ for opt do
>    ;;
>    --cross-cc-*)
>    ;;
> -  --enable-debug-info) debug_info="yes"
> +  --enable-debug-info) meson_option_add -Ddebug=true
>    ;;
> -  --disable-debug-info) debug_info="no"
> +  --disable-debug-info) meson_option_add -Ddebug=false
>    ;;
>    --enable-modules)
>        modules="yes"
> @@ -753,9 +749,9 @@ for opt do
>                         error_exit "Can't mix --target-list-exclude with
> --target-list"
>                     fi
>    ;;
> -  --with-default-devices) default_devices="true"
> +  --with-default-devices) meson_option_add -Ddefault_devices=true
>    ;;
> -  --without-default-devices) default_devices="false"
> +  --without-default-devices) meson_option_add -Ddefault_devices=false
>    ;;
>    --with-devices-*[!a-zA-Z0-9_-]*=*) error_exit "Passed bad
> --with-devices-FOO option"
>    ;;
> @@ -771,8 +767,6 @@ for opt do
>    ;;
>    --without-default-features) # processed above
>    ;;
> -  --enable-gcov) gcov="yes"
> -  ;;
>    --static)
>      static="yes"
>      QEMU_PKG_CONFIG_FLAGS="--static $QEMU_PKG_CONFIG_FLAGS"
> @@ -799,7 +793,7 @@ for opt do
>        # Enable debugging options that aren't excessively noisy
>        debug_tcg="yes"
>        meson_option_parse --enable-debug-mutex ""
> -      debug="yes"
> +      meson_option_add -Doptimization=0
>        fortify_source="no"
>    ;;
>    --enable-sanitizers) sanitizers="yes"
> @@ -848,10 +842,6 @@ for opt do
>    ;;
>    --disable-werror) werror="no"
>    ;;
> -  --enable-lto) lto="true"
> -  ;;
> -  --disable-lto) lto="false"
> -  ;;
>    --enable-stack-protector) stack_protector="yes"
>    ;;
>    --disable-stack-protector) stack_protector="no"
> @@ -862,7 +852,7 @@ for opt do
>    ;;
>    --enable-cfi)
>        cfi="true";
> -      lto="true";
> +      meson_option_add -Db_lto=true
>    ;;
>    --disable-cfi) cfi="false"
>    ;;
> @@ -1100,7 +1090,6 @@ Advanced options (experts only):
>    --cpu=CPU                Build for host CPU [$cpu]
>    --with-coroutine=BACKEND coroutine backend. Supported options:
>                             ucontext, sigaltstack, windows
> -  --enable-gcov            enable test coverage analysis with gcov
>    --enable-plugins
>                             enable plugins via shared library loading
>    --disable-containers     don't use containers for cross-building
> @@ -1116,7 +1105,6 @@ cat << EOF
>    modules         modules support (non-Windows)
>    debug-tcg       TCG debugging (default is disabled)
>    debug-info      debugging information
> -  lto             Enable Link-Time Optimization.
>    safe-stack      SafeStack Stack Smash Protection. Depends on
>                    clang/llvm >= 3.7 and requires coroutine backend
> ucontext.
>    vhost-net       vhost-net kernel acceleration support
> @@ -1937,7 +1925,6 @@ write_c_skeleton
>
>  if test "$fortify_source" = "yes" ; then
>    QEMU_CFLAGS="-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $QEMU_CFLAGS"
> -  debug=no
>  fi
>
>  case "$ARCH" in
> @@ -2366,15 +2353,11 @@ if test "$skip_meson" = no; then
>      NINJA=$ninja $meson setup \
>          --prefix "$prefix" \
>          --bindir "$bindir" \
> -        -Ddefault_devices=$default_devices \
>          -Dqemu_suffix="$qemu_suffix" \
>          -Dsmbd="$smbd" \
> -        -Doptimization=$(if test "$debug" = yes; then echo 0; else echo
> 2; fi) \
> -        -Ddebug=$(if test "$debug_info" = yes; then echo true; else echo
> false; fi) \
>          -Dwerror=$(if test "$werror" = yes; then echo true; else echo
> false; fi) \
>          -Db_pie=$(if test "$pie" = yes; then echo true; else echo false;
> fi) \
> -        -Db_coverage=$(if test "$gcov" = yes; then echo true; else echo
> false; fi) \
> -        -Db_lto=$lto -Dcfi=$cfi -Dtcg=$tcg \
> +        -Dcfi=$cfi -Dtcg=$tcg \
>          -Dcapstone=$capstone -Dfdt=$fdt -Dslirp=$slirp \
>          $(test -n "${LIB_FUZZING_ENGINE+xxx}" && echo
> "-Dfuzzing_engine=$LIB_FUZZING_ENGINE") \
>          $(if test "$default_feature" = no; then echo
> "-Dauto_features=disabled"; fi) \
> diff --git a/meson.build b/meson.build
> index 2545ac2848..60e8c302e6 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -1,6 +1,6 @@
>  project('qemu', ['c'], meson_version: '>=0.59.3',
>          default_options: ['warning_level=1', 'c_std=gnu11',
> 'cpp_std=gnu++11', 'b_colorout=auto',
> -                          'b_staticpic=false', 'stdsplit=false'],
> +                          'b_staticpic=false', 'stdsplit=false',
> 'optimization=2'],
>          version: files('VERSION'))
>
>  add_test_setup('quick', exclude_suites: ['slow', 'thorough'], is_default:
> true)
> diff --git a/scripts/meson-buildoptions.py b/scripts/meson-buildoptions.py
> index 45cda8cd84..e624c16b01 100755
> --- a/scripts/meson-buildoptions.py
> +++ b/scripts/meson-buildoptions.py
> @@ -33,6 +33,8 @@
>  }
>
>  OPTION_NAMES = {
> +    "b_coverage": "gcov",
> +    "b_lto": "lto",
>      "malloc": "enable-malloc",
>      "pkgversion": "with-pkgversion",
>      "qemu_firmwarepath": "firmwarepath",
> @@ -41,6 +43,8 @@
>  }
>
>  BUILTIN_OPTIONS = {
> +    "b_coverage",
> +    "b_lto",
>      "datadir",
>      "includedir",
>      "libdir",
> diff --git a/scripts/meson-buildoptions.sh b/scripts/meson-buildoptions.sh
> index a52cc14d13..274639777e 100644
> --- a/scripts/meson-buildoptions.sh
> +++ b/scripts/meson-buildoptions.sh
> @@ -27,7 +27,9 @@ meson_options_help() {
>    printf "%s\n" '  --enable-fdt[=CHOICE]    Whether and how to find the
> libfdt library'
>    printf "%s\n" '                           (choices:
> auto/disabled/enabled/internal/system)'
>    printf "%s\n" '  --enable-fuzzing         build fuzzing targets'
> +  printf "%s\n" '  --enable-gcov            Enable coverage tracking.'
>    printf "%s\n" '  --enable-gprof           QEMU profiling with gprof'
> +  printf "%s\n" '  --enable-lto             Use link time optimization'
>    printf "%s\n" '  --enable-malloc=CHOICE   choose memory allocator to
> use [system] (choices:'
>    printf "%s\n" '                           jemalloc/system/tcmalloc)'
>    printf "%s\n" '  --enable-module-upgrades try to load modules from
> alternate paths for'
> @@ -182,6 +184,10 @@ _meson_option_parse() {
>      --disable-avx2) printf "%s" -Davx2=disabled ;;
>      --enable-avx512f) printf "%s" -Davx512f=enabled ;;
>      --disable-avx512f) printf "%s" -Davx512f=disabled ;;
> +    --enable-gcov) printf "%s" -Db_coverage=true ;;
> +    --disable-gcov) printf "%s" -Db_coverage=false ;;
> +    --enable-lto) printf "%s" -Db_lto=true ;;
> +    --disable-lto) printf "%s" -Db_lto=false ;;
>      --block-drv-ro-whitelist=*) quote_sh "-Dblock_drv_ro_whitelist=$2" ;;
>      --block-drv-rw-whitelist=*) quote_sh "-Dblock_drv_rw_whitelist=$2" ;;
>      --enable-block-drv-whitelist-in-tools) printf "%s"
> -Dblock_drv_whitelist_in_tools=true ;;
> --
> 2.35.1
>
>
>
>

-- 
Marc-André Lureau

[-- Attachment #2: Type: text/html, Size: 12231 bytes --]

^ permalink raw reply	[flat|nested] 74+ messages in thread

* Re: [PATCH 26/34] configure: omit options with default values from meson command line
  2022-04-20 15:33 ` [PATCH 26/34] configure: omit options with default values from meson command line Paolo Bonzini
@ 2022-04-21 10:04   ` Marc-André Lureau
  0 siblings, 0 replies; 74+ messages in thread
From: Marc-André Lureau @ 2022-04-21 10:04 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: QEMU

[-- Attachment #1: Type: text/plain, Size: 3851 bytes --]

On Wed, Apr 20, 2022 at 8:13 PM Paolo Bonzini <pbonzini@redhat.com> wrote:

> This has no functional change, it only makes the command line shorter
> and nicer.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>

 Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>



> ---
>  configure         | 29 +++++++++++++++++------------
>  meson.build       |  2 +-
>  meson_options.txt |  2 +-
>  3 files changed, 19 insertions(+), 14 deletions(-)
>
> diff --git a/configure b/configure
> index 4997983b5d..61b5acae10 100755
> --- a/configure
> +++ b/configure
> @@ -2349,19 +2349,24 @@ if test "$skip_meson" = no; then
>    mv $cross config-meson.cross
>
>    rm -rf meson-private meson-info meson-logs
> +
> +  # Built-in options
> +  test "$bindir" != "bin" && meson_option_add "-Dbindir=$bindir"
> +  test "$default_feature" = no && meson_option_add
> -Dauto_features=disabled
> +  test "$pie" = no && meson_option_add -Db_pie=false
> +  test "$werror" = yes && meson_option_add -Dwerror=true
> +
> +  # QEMU options
> +  test "$capstone" != auto && meson_option_add "-Dcapstone=$capstone"
> +  test "$cfi" != false && meson_option_add "-Dcfi=$cfi"
> +  test "$fdt" != auto && meson_option_add "-Dfdt=$fdt"
> +  test -n "${LIB_FUZZING_ENGINE+xxx}" && meson_option_add
> "-Dfuzzing_engine=$LIB_FUZZING_ENGINE"
> +  test "$qemu_suffix" != qemu && meson_option_add
> "-Dqemu_suffix=$qemu_suffix"
> +  test "$slirp" != auto && meson_option_add "-Dslirp=$slirp"
> +  test "$smbd" != '' && meson_option_add "-Dsmbd=$smbd"
> +  test "$tcg" != enabled && meson_option_add "-Dtcg=$tcg"
>    run_meson() {
> -    NINJA=$ninja $meson setup \
> -        --prefix "$prefix" \
> -        --bindir "$bindir" \
> -        -Dqemu_suffix="$qemu_suffix" \
> -        -Dsmbd="$smbd" \
> -        -Dwerror=$(if test "$werror" = yes; then echo true; else echo
> false; fi) \
> -        -Db_pie=$(if test "$pie" = yes; then echo true; else echo false;
> fi) \
> -        -Dcfi=$cfi -Dtcg=$tcg \
> -        -Dcapstone=$capstone -Dfdt=$fdt -Dslirp=$slirp \
> -        $(test -n "${LIB_FUZZING_ENGINE+xxx}" && echo
> "-Dfuzzing_engine=$LIB_FUZZING_ENGINE") \
> -        $(if test "$default_feature" = no; then echo
> "-Dauto_features=disabled"; fi) \
> -        "$@" $cross_arg "$PWD" "$source_path"
> +    NINJA=$ninja $meson setup --prefix "$prefix" "$@" $cross_arg "$PWD"
> "$source_path"
>    }
>    eval run_meson $meson_options
>    if test "$?" -ne 0 ; then
> diff --git a/meson.build b/meson.build
> index 60e8c302e6..ff5c076805 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -1,6 +1,6 @@
>  project('qemu', ['c'], meson_version: '>=0.59.3',
>          default_options: ['warning_level=1', 'c_std=gnu11',
> 'cpp_std=gnu++11', 'b_colorout=auto',
> -                          'b_staticpic=false', 'stdsplit=false',
> 'optimization=2'],
> +                          'b_staticpic=false', 'stdsplit=false',
> 'optimization=2', 'b_pie=true'],
>          version: files('VERSION'))
>
>  add_test_setup('quick', exclude_suites: ['slow', 'thorough'], is_default:
> true)
> diff --git a/meson_options.txt b/meson_options.txt
> index a76fadbd7d..8efd5f520c 100644
> --- a/meson_options.txt
> +++ b/meson_options.txt
> @@ -78,7 +78,7 @@ option('xen', type: 'feature', value: 'auto',
>         description: 'Xen backend support')
>  option('xen_pci_passthrough', type: 'feature', value: 'auto',
>         description: 'Xen PCI passthrough support')
> -option('tcg', type: 'feature', value: 'auto',
> +option('tcg', type: 'feature', value: 'enabled',
>         description: 'TCG support')
>  option('tcg_interpreter', type: 'boolean', value: false,
>         description: 'TCG with bytecode interpreter (slow)')
> --
> 2.35.1
>
>
>
>

-- 
Marc-André Lureau

[-- Attachment #2: Type: text/html, Size: 5605 bytes --]

^ permalink raw reply	[flat|nested] 74+ messages in thread

* Re: [PATCH 27/34] meson, virtio: place all virtio-pci devices under virtio_pci_ss
  2022-04-20 15:34 ` [PATCH 27/34] meson, virtio: place all virtio-pci devices under virtio_pci_ss Paolo Bonzini
@ 2022-04-21 10:05   ` Marc-André Lureau
  0 siblings, 0 replies; 74+ messages in thread
From: Marc-André Lureau @ 2022-04-21 10:05 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: QEMU

[-- Attachment #1: Type: text/plain, Size: 3564 bytes --]

On Wed, Apr 20, 2022 at 8:14 PM Paolo Bonzini <pbonzini@redhat.com> wrote:

> Since a sourceset already exists for this, avoid unnecessary repeat
> of CONFIG_VIRTIO_PCI.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>

 Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>




> ---
>  hw/virtio/meson.build | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/hw/virtio/meson.build b/hw/virtio/meson.build
> index 67dc77e00f..f371404b04 100644
> --- a/hw/virtio/meson.build
> +++ b/hw/virtio/meson.build
> @@ -16,9 +16,7 @@ virtio_ss.add(when: 'CONFIG_VHOST_USER', if_true:
> files('vhost-user.c'))
>  virtio_ss.add(when: 'CONFIG_VHOST_VDPA', if_true:
> files('vhost-shadow-virtqueue.c', 'vhost-vdpa.c'))
>  virtio_ss.add(when: 'CONFIG_VIRTIO_BALLOON', if_true:
> files('virtio-balloon.c'))
>  virtio_ss.add(when: 'CONFIG_VIRTIO_CRYPTO', if_true:
> files('virtio-crypto.c'))
> -virtio_ss.add(when: ['CONFIG_VIRTIO_CRYPTO', 'CONFIG_VIRTIO_PCI'],
> if_true: files('virtio-crypto-pci.c'))
>  virtio_ss.add(when: 'CONFIG_VHOST_USER_FS', if_true:
> files('vhost-user-fs.c'))
> -virtio_ss.add(when: ['CONFIG_VHOST_USER_FS', 'CONFIG_VIRTIO_PCI'],
> if_true: files('vhost-user-fs-pci.c'))
>  virtio_ss.add(when: 'CONFIG_VIRTIO_PMEM', if_true: files('virtio-pmem.c'))
>  virtio_ss.add(when: 'CONFIG_VHOST_VSOCK', if_true: files('vhost-vsock.c',
> 'vhost-vsock-common.c'))
>  virtio_ss.add(when: 'CONFIG_VHOST_USER_VSOCK', if_true:
> files('vhost-user-vsock.c', 'vhost-vsock-common.c'))
> @@ -26,17 +24,20 @@ virtio_ss.add(when: 'CONFIG_VIRTIO_RNG', if_true:
> files('virtio-rng.c'))
>  virtio_ss.add(when: 'CONFIG_VIRTIO_IOMMU', if_true:
> files('virtio-iommu.c'))
>  virtio_ss.add(when: 'CONFIG_VIRTIO_MEM', if_true: files('virtio-mem.c'))
>  virtio_ss.add(when: 'CONFIG_VHOST_USER_I2C', if_true:
> files('vhost-user-i2c.c'))
> -virtio_ss.add(when: ['CONFIG_VIRTIO_PCI', 'CONFIG_VHOST_USER_I2C'],
> if_true: files('vhost-user-i2c-pci.c'))
>  virtio_ss.add(when: 'CONFIG_VHOST_USER_RNG', if_true:
> files('vhost-user-rng.c'))
> -virtio_ss.add(when: ['CONFIG_VHOST_USER_RNG', 'CONFIG_VIRTIO_PCI'],
> if_true: files('vhost-user-rng-pci.c'))
>
>  virtio_pci_ss = ss.source_set()
>  virtio_pci_ss.add(when: 'CONFIG_VHOST_VSOCK', if_true:
> files('vhost-vsock-pci.c'))
>  virtio_pci_ss.add(when: 'CONFIG_VHOST_USER_VSOCK', if_true:
> files('vhost-user-vsock-pci.c'))
>  virtio_pci_ss.add(when: 'CONFIG_VHOST_USER_BLK', if_true:
> files('vhost-user-blk-pci.c'))
> +virtio_pci_ss.add(when: 'CONFIG_VHOST_USER_I2C', if_true:
> files('vhost-user-i2c-pci.c'))
>  virtio_pci_ss.add(when: 'CONFIG_VHOST_USER_INPUT', if_true:
> files('vhost-user-input-pci.c'))
> +virtio_pci_ss.add(when: 'CONFIG_VHOST_USER_RNG', if_true:
> files('vhost-user-rng-pci.c'))
>  virtio_pci_ss.add(when: 'CONFIG_VHOST_USER_SCSI', if_true:
> files('vhost-user-scsi-pci.c'))
>  virtio_pci_ss.add(when: 'CONFIG_VHOST_SCSI', if_true:
> files('vhost-scsi-pci.c'))
> +virtio_pci_ss.add(when: 'CONFIG_VHOST_USER_FS', if_true:
> files('vhost-user-fs-pci.c'))
> +
> +virtio_pci_ss.add(when: 'CONFIG_VIRTIO_CRYPTO', if_true:
> files('virtio-crypto-pci.c'))
>  virtio_pci_ss.add(when: 'CONFIG_VIRTIO_INPUT_HOST', if_true:
> files('virtio-input-host-pci.c'))
>  virtio_pci_ss.add(when: 'CONFIG_VIRTIO_INPUT', if_true:
> files('virtio-input-pci.c'))
>  virtio_pci_ss.add(when: 'CONFIG_VIRTIO_RNG', if_true:
> files('virtio-rng-pci.c'))
> --
> 2.35.1
>
>
>
>

-- 
Marc-André Lureau

[-- Attachment #2: Type: text/html, Size: 4810 bytes --]

^ permalink raw reply	[flat|nested] 74+ messages in thread

* Re: [PATCH 28/34] configure: simplify vhost-net-{user, vdpa} configuration
  2022-04-20 15:34 ` [PATCH 28/34] configure: simplify vhost-net-{user, vdpa} configuration Paolo Bonzini
@ 2022-04-21 10:08   ` Marc-André Lureau
  0 siblings, 0 replies; 74+ messages in thread
From: Marc-André Lureau @ 2022-04-21 10:08 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: QEMU

[-- Attachment #1: Type: text/plain, Size: 2573 bytes --]

On Wed, Apr 20, 2022 at 8:16 PM Paolo Bonzini <pbonzini@redhat.com> wrote:

> Cleanup to ease review of the conversion to meson.  vhost_net_user and
> vhost_net_vdpa are never assigned anything in the command line parsing
> loop, so they are always equal to $vhost_user and $vhost_vdpa.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>

 Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>



> ---
>  configure | 17 ++++-------------
>  1 file changed, 4 insertions(+), 13 deletions(-)
>
> diff --git a/configure b/configure
> index 61b5acae10..2aa4dc3ce1 100755
> --- a/configure
> +++ b/configure
> @@ -1554,10 +1554,6 @@ if test "$vhost_vsock" = "yes" && test
> "$vhost_kernel" != "yes"; then
>  fi
>
>  # vhost-user backends
> -test "$vhost_net_user" = "" && vhost_net_user=$vhost_user
> -if test "$vhost_net_user" = "yes" && test "$vhost_user" = "no"; then
> -  error_exit "--enable-vhost-net-user requires --enable-vhost-user"
> -fi
>  test "$vhost_crypto" = "" && vhost_crypto=$vhost_user
>  if test "$vhost_crypto" = "yes" && test "$vhost_user" = "no"; then
>    error_exit "--enable-vhost-crypto requires --enable-vhost-user"
> @@ -1566,16 +1562,11 @@ test "$vhost_user_fs" = "" &&
> vhost_user_fs=$vhost_user
>  if test "$vhost_user_fs" = "yes" && test "$vhost_user" = "no"; then
>    error_exit "--enable-vhost-user-fs requires --enable-vhost-user"
>  fi
> -#vhost-vdpa backends
> -test "$vhost_net_vdpa" = "" && vhost_net_vdpa=$vhost_vdpa
> -if test "$vhost_net_vdpa" = "yes" && test "$vhost_vdpa" = "no"; then
> -  error_exit "--enable-vhost-net-vdpa requires --enable-vhost-vdpa"
> -fi
>
>  # OR the vhost-kernel, vhost-vdpa and vhost-user values for simplicity
>  if test "$vhost_net" = ""; then
> -  test "$vhost_net_user" = "yes" && vhost_net=yes
> -  test "$vhost_net_vdpa" = "yes" && vhost_net=yes
> +  test "$vhost_user" = "yes" && vhost_net=yes
> +  test "$vhost_vdpa" = "yes" && vhost_net=yes
>    test "$vhost_kernel" = "yes" && vhost_net=yes
>  fi
>
> @@ -2104,10 +2095,10 @@ fi
>  if test "$vhost_net" = "yes" ; then
>    echo "CONFIG_VHOST_NET=y" >> $config_host_mak
>  fi
> -if test "$vhost_net_user" = "yes" ; then
> +if test "$vhost_user" = "yes" ; then
>    echo "CONFIG_VHOST_NET_USER=y" >> $config_host_mak
>  fi
> -if test "$vhost_net_vdpa" = "yes" ; then
> +if test "$vhost_vdpa" = "yes" ; then
>    echo "CONFIG_VHOST_NET_VDPA=y" >> $config_host_mak
>  fi
>  if test "$vhost_crypto" = "yes" ; then
> --
> 2.35.1
>
>
>
>

-- 
Marc-André Lureau

[-- Attachment #2: Type: text/html, Size: 4115 bytes --]

^ permalink raw reply	[flat|nested] 74+ messages in thread

* Re: [PATCH 29/34] build: move vhost-vsock configuration to Kconfig
  2022-04-20 15:34 ` [PATCH 29/34] build: move vhost-vsock configuration to Kconfig Paolo Bonzini
@ 2022-04-21 11:38   ` Marc-André Lureau
  0 siblings, 0 replies; 74+ messages in thread
From: Marc-André Lureau @ 2022-04-21 11:38 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: QEMU

[-- Attachment #1: Type: text/plain, Size: 4287 bytes --]

On Wed, Apr 20, 2022 at 8:19 PM Paolo Bonzini <pbonzini@redhat.com> wrote:

> vhost-vsock and vhost-user-vsock are two devices of their own; it should
> be possible to enable/disable them with --without-default-devices, not
> --without-default-features.  Compute their default value in Kconfig to
> obtain the more intuitive behavior.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>

We also lose the configure options, but it is overdue

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>


> ---
>  configure         | 16 ----------------
>  hw/virtio/Kconfig | 10 ++++++++++
>  meson.build       |  1 -
>  3 files changed, 10 insertions(+), 17 deletions(-)
>
> diff --git a/configure b/configure
> index 2aa4dc3ce1..a3b57877e5 100755
> --- a/configure
> +++ b/configure
> @@ -286,7 +286,6 @@ vhost_kernel="$default_feature"
>  vhost_net="$default_feature"
>  vhost_crypto="$default_feature"
>  vhost_scsi="$default_feature"
> -vhost_vsock="$default_feature"
>  vhost_user="no"
>  vhost_user_fs="$default_feature"
>  vhost_vdpa="$default_feature"
> @@ -878,10 +877,6 @@ for opt do
>    ;;
>    --enable-vhost-scsi) vhost_scsi="yes"
>    ;;
> -  --disable-vhost-vsock) vhost_vsock="no"
> -  ;;
> -  --enable-vhost-vsock) vhost_vsock="yes"
> -  ;;
>    --disable-vhost-user-fs) vhost_user_fs="no"
>    ;;
>    --enable-vhost-user-fs) vhost_user_fs="yes"
> @@ -1108,7 +1103,6 @@ cat << EOF
>    safe-stack      SafeStack Stack Smash Protection. Depends on
>                    clang/llvm >= 3.7 and requires coroutine backend
> ucontext.
>    vhost-net       vhost-net kernel acceleration support
> -  vhost-vsock     virtio sockets device support
>    vhost-scsi      vhost-scsi kernel target support
>    vhost-crypto    vhost-user-crypto backend support
>    vhost-kernel    vhost kernel backend support
> @@ -1548,10 +1542,6 @@ test "$vhost_scsi" = "" && vhost_scsi=$vhost_kernel
>  if test "$vhost_scsi" = "yes" && test "$vhost_kernel" != "yes"; then
>    error_exit "--enable-vhost-scsi requires --enable-vhost-kernel"
>  fi
> -test "$vhost_vsock" = "" && vhost_vsock=$vhost_kernel
> -if test "$vhost_vsock" = "yes" && test "$vhost_kernel" != "yes"; then
> -  error_exit "--enable-vhost-vsock requires --enable-vhost-kernel"
> -fi
>
>  # vhost-user backends
>  test "$vhost_crypto" = "" && vhost_crypto=$vhost_user
> @@ -2104,12 +2094,6 @@ fi
>  if test "$vhost_crypto" = "yes" ; then
>    echo "CONFIG_VHOST_CRYPTO=y" >> $config_host_mak
>  fi
> -if test "$vhost_vsock" = "yes" ; then
> -  echo "CONFIG_VHOST_VSOCK=y" >> $config_host_mak
> -  if test "$vhost_user" = "yes" ; then
> -    echo "CONFIG_VHOST_USER_VSOCK=y" >> $config_host_mak
> -  fi
> -fi
>  if test "$vhost_kernel" = "yes" ; then
>    echo "CONFIG_VHOST_KERNEL=y" >> $config_host_mak
>  fi
> diff --git a/hw/virtio/Kconfig b/hw/virtio/Kconfig
> index c144d42f9b..b642ae1081 100644
> --- a/hw/virtio/Kconfig
> +++ b/hw/virtio/Kconfig
> @@ -59,6 +59,16 @@ config VIRTIO_MEM
>      depends on VIRTIO_MEM_SUPPORTED
>      select MEM_DEVICE
>
> +config VHOST_VSOCK
> +    bool
> +    default y
> +    depends on VIRTIO && VHOST_KERNEL
> +
> +config VHOST_USER_VSOCK
> +    bool
> +    default y
> +    depends on VIRTIO && VHOST_USER
> +
>  config VHOST_USER_I2C
>      bool
>      default y
> diff --git a/meson.build b/meson.build
> index ff5c076805..033d0c9aa1 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -3678,7 +3678,6 @@ summary_info += {'vhost-kernel support':
> config_host.has_key('CONFIG_VHOST_KERNE
>  summary_info += {'vhost-net support':
> config_host.has_key('CONFIG_VHOST_NET')}
>  summary_info += {'vhost-crypto support':
> config_host.has_key('CONFIG_VHOST_CRYPTO')}
>  summary_info += {'vhost-scsi support':
> config_host.has_key('CONFIG_VHOST_SCSI')}
> -summary_info += {'vhost-vsock support':
> config_host.has_key('CONFIG_VHOST_VSOCK')}
>  summary_info += {'vhost-user support':
> config_host.has_key('CONFIG_VHOST_USER')}
>  summary_info += {'vhost-user-blk server support':
> have_vhost_user_blk_server}
>  summary_info += {'vhost-user-fs support':
> config_host.has_key('CONFIG_VHOST_USER_FS')}
> --
> 2.35.1
>
>
>
>

-- 
Marc-André Lureau

[-- Attachment #2: Type: text/html, Size: 5968 bytes --]

^ permalink raw reply	[flat|nested] 74+ messages in thread

* Re: [PATCH 30/34] build: move vhost-scsi configuration to Kconfig
  2022-04-20 15:34 ` [PATCH 30/34] build: move vhost-scsi " Paolo Bonzini
@ 2022-04-21 11:47   ` Marc-André Lureau
  0 siblings, 0 replies; 74+ messages in thread
From: Marc-André Lureau @ 2022-04-21 11:47 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: QEMU

[-- Attachment #1: Type: text/plain, Size: 4579 bytes --]

On Wed, Apr 20, 2022 at 8:23 PM Paolo Bonzini <pbonzini@redhat.com> wrote:

> vhost-scsi and vhost-user-scsi are two devices of their own; it should
> be possible to enable/disable them with --without-default-devices, not
> --without-default-features.  Compute their default value in Kconfig to
> obtain the more intuitive behavior.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>



> ---
>  configure                       | 15 ---------------
>  hw/scsi/Kconfig                 |  5 +++++
>  include/hw/virtio/virtio-scsi.h |  2 --
>  meson.build                     |  1 -
>  4 files changed, 5 insertions(+), 18 deletions(-)
>
> diff --git a/configure b/configure
> index a3b57877e5..65ae2c0c1f 100755
> --- a/configure
> +++ b/configure
> @@ -285,7 +285,6 @@ EXTRA_LDFLAGS=""
>  vhost_kernel="$default_feature"
>  vhost_net="$default_feature"
>  vhost_crypto="$default_feature"
> -vhost_scsi="$default_feature"
>  vhost_user="no"
>  vhost_user_fs="$default_feature"
>  vhost_vdpa="$default_feature"
> @@ -873,10 +872,6 @@ for opt do
>    ;;
>    --enable-vhost-crypto) vhost_crypto="yes"
>    ;;
> -  --disable-vhost-scsi) vhost_scsi="no"
> -  ;;
> -  --enable-vhost-scsi) vhost_scsi="yes"
> -  ;;
>    --disable-vhost-user-fs) vhost_user_fs="no"
>    ;;
>    --enable-vhost-user-fs) vhost_user_fs="yes"
> @@ -1103,7 +1098,6 @@ cat << EOF
>    safe-stack      SafeStack Stack Smash Protection. Depends on
>                    clang/llvm >= 3.7 and requires coroutine backend
> ucontext.
>    vhost-net       vhost-net kernel acceleration support
> -  vhost-scsi      vhost-scsi kernel target support
>    vhost-crypto    vhost-user-crypto backend support
>    vhost-kernel    vhost kernel backend support
>    vhost-user      vhost-user backend support
> @@ -1537,12 +1531,6 @@ if test "$vhost_kernel" = "yes" && test "$linux" !=
> "yes"; then
>    error_exit "vhost-kernel is only available on Linux"
>  fi
>
> -# vhost-kernel devices
> -test "$vhost_scsi" = "" && vhost_scsi=$vhost_kernel
> -if test "$vhost_scsi" = "yes" && test "$vhost_kernel" != "yes"; then
> -  error_exit "--enable-vhost-scsi requires --enable-vhost-kernel"
> -fi
> -
>  # vhost-user backends
>  test "$vhost_crypto" = "" && vhost_crypto=$vhost_user
>  if test "$vhost_crypto" = "yes" && test "$vhost_user" = "no"; then
> @@ -2079,9 +2067,6 @@ if test "$modules" = "yes"; then
>    echo "CONFIG_MODULES=y" >> $config_host_mak
>  fi
>
> -if test "$vhost_scsi" = "yes" ; then
> -  echo "CONFIG_VHOST_SCSI=y" >> $config_host_mak
> -fi
>  if test "$vhost_net" = "yes" ; then
>    echo "CONFIG_VHOST_NET=y" >> $config_host_mak
>  fi
> diff --git a/hw/scsi/Kconfig b/hw/scsi/Kconfig
> index 77d397c949..e7b34dc8e2 100644
> --- a/hw/scsi/Kconfig
> +++ b/hw/scsi/Kconfig
> @@ -48,6 +48,11 @@ config VIRTIO_SCSI
>      depends on VIRTIO
>      select SCSI
>
> +config VHOST_SCSI
> +    bool
> +    default y
> +    depends on VIRTIO && VHOST_KERNEL
> +
>  config VHOST_USER_SCSI
>      bool
>      # Only PCI devices are provided for now
> diff --git a/include/hw/virtio/virtio-scsi.h
> b/include/hw/virtio/virtio-scsi.h
> index 543681bc18..0997313f0a 100644
> --- a/include/hw/virtio/virtio-scsi.h
> +++ b/include/hw/virtio/virtio-scsi.h
> @@ -55,10 +55,8 @@ struct VirtIOSCSIConf {
>      bool seg_max_adjust;
>      uint32_t max_sectors;
>      uint32_t cmd_per_lun;
> -#ifdef CONFIG_VHOST_SCSI
>      char *vhostfd;
>      char *wwpn;
> -#endif
>      CharBackend chardev;
>      uint32_t boot_tpgt;
>      IOThread *iothread;
> diff --git a/meson.build b/meson.build
> index 033d0c9aa1..b18731ee84 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -3677,7 +3677,6 @@ summary_info += {'QOM debugging':
>  get_option('qom_cast_debug')}
>  summary_info += {'vhost-kernel support':
> config_host.has_key('CONFIG_VHOST_KERNEL')}
>  summary_info += {'vhost-net support':
> config_host.has_key('CONFIG_VHOST_NET')}
>  summary_info += {'vhost-crypto support':
> config_host.has_key('CONFIG_VHOST_CRYPTO')}
> -summary_info += {'vhost-scsi support':
> config_host.has_key('CONFIG_VHOST_SCSI')}
>  summary_info += {'vhost-user support':
> config_host.has_key('CONFIG_VHOST_USER')}
>  summary_info += {'vhost-user-blk server support':
> have_vhost_user_blk_server}
>  summary_info += {'vhost-user-fs support':
> config_host.has_key('CONFIG_VHOST_USER_FS')}
> --
> 2.35.1
>
>
>
>

-- 
Marc-André Lureau

[-- Attachment #2: Type: text/html, Size: 6201 bytes --]

^ permalink raw reply	[flat|nested] 74+ messages in thread

* Re: [PATCH 31/34] build: move vhost-user-fs configuration to Kconfig
  2022-04-20 15:34 ` [PATCH 31/34] build: move vhost-user-fs " Paolo Bonzini
@ 2022-04-21 11:48   ` Marc-André Lureau
  0 siblings, 0 replies; 74+ messages in thread
From: Marc-André Lureau @ 2022-04-21 11:48 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: QEMU

[-- Attachment #1: Type: text/plain, Size: 3425 bytes --]

On Wed, Apr 20, 2022 at 8:24 PM Paolo Bonzini <pbonzini@redhat.com> wrote:

> vhost-user-fs is a device and it should be possible to enable/disable
> it with --without-default-devices, not --without-default-features.
> Compute its default value in Kconfig to obtain the more intuitive
> behavior.
>
> In this case the configure options were undocumented, too.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>

---
>  configure         | 12 ------------
>  hw/virtio/Kconfig |  5 +++++
>  meson.build       |  1 -
>  3 files changed, 5 insertions(+), 13 deletions(-)
>
> diff --git a/configure b/configure
> index 65ae2c0c1f..3b38ff3c63 100755
> --- a/configure
> +++ b/configure
> @@ -286,7 +286,6 @@ vhost_kernel="$default_feature"
>  vhost_net="$default_feature"
>  vhost_crypto="$default_feature"
>  vhost_user="no"
> -vhost_user_fs="$default_feature"
>  vhost_vdpa="$default_feature"
>  debug_tcg="no"
>  sanitizers="no"
> @@ -872,10 +871,6 @@ for opt do
>    ;;
>    --enable-vhost-crypto) vhost_crypto="yes"
>    ;;
> -  --disable-vhost-user-fs) vhost_user_fs="no"
> -  ;;
> -  --enable-vhost-user-fs) vhost_user_fs="yes"
> -  ;;
>    --disable-zlib-test)
>    ;;
>    --disable-virtio-blk-data-plane|--enable-virtio-blk-data-plane)
> @@ -1536,10 +1531,6 @@ test "$vhost_crypto" = "" &&
> vhost_crypto=$vhost_user
>  if test "$vhost_crypto" = "yes" && test "$vhost_user" = "no"; then
>    error_exit "--enable-vhost-crypto requires --enable-vhost-user"
>  fi
> -test "$vhost_user_fs" = "" && vhost_user_fs=$vhost_user
> -if test "$vhost_user_fs" = "yes" && test "$vhost_user" = "no"; then
> -  error_exit "--enable-vhost-user-fs requires --enable-vhost-user"
> -fi
>
>  # OR the vhost-kernel, vhost-vdpa and vhost-user values for simplicity
>  if test "$vhost_net" = ""; then
> @@ -2088,9 +2079,6 @@ fi
>  if test "$vhost_vdpa" = "yes" ; then
>    echo "CONFIG_VHOST_VDPA=y" >> $config_host_mak
>  fi
> -if test "$vhost_user_fs" = "yes" ; then
> -  echo "CONFIG_VHOST_USER_FS=y" >> $config_host_mak
> -fi
>
>  # XXX: suppress that
>  if [ "$bsd" = "yes" ] ; then
> diff --git a/hw/virtio/Kconfig b/hw/virtio/Kconfig
> index b642ae1081..f8e235f814 100644
> --- a/hw/virtio/Kconfig
> +++ b/hw/virtio/Kconfig
> @@ -78,3 +78,8 @@ config VHOST_USER_RNG
>      bool
>      default y
>      depends on VIRTIO && VHOST_USER
> +
> +config VHOST_USER_FS
> +    bool
> +    default y
> +    depends on VIRTIO && VHOST_USER
> diff --git a/meson.build b/meson.build
> index b18731ee84..870dd8dee0 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -3679,7 +3679,6 @@ summary_info += {'vhost-net support':
> config_host.has_key('CONFIG_VHOST_NET')}
>  summary_info += {'vhost-crypto support':
> config_host.has_key('CONFIG_VHOST_CRYPTO')}
>  summary_info += {'vhost-user support':
> config_host.has_key('CONFIG_VHOST_USER')}
>  summary_info += {'vhost-user-blk server support':
> have_vhost_user_blk_server}
> -summary_info += {'vhost-user-fs support':
> config_host.has_key('CONFIG_VHOST_USER_FS')}
>  summary_info += {'vhost-vdpa support':
> config_host.has_key('CONFIG_VHOST_VDPA')}
>  summary_info += {'build guest agent': have_ga}
>  summary(summary_info, bool_yn: true, section: 'Configurable features')
> --
> 2.35.1
>
>
>
>

-- 
Marc-André Lureau

[-- Attachment #2: Type: text/html, Size: 4846 bytes --]

^ permalink raw reply	[flat|nested] 74+ messages in thread

* Re: [PATCH 32/34] meson: create have_vhost_* variables
  2022-04-20 15:34 ` [PATCH 32/34] meson: create have_vhost_* variables Paolo Bonzini
@ 2022-04-21 12:01   ` Marc-André Lureau
  0 siblings, 0 replies; 74+ messages in thread
From: Marc-André Lureau @ 2022-04-21 12:01 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: QEMU

[-- Attachment #1: Type: text/plain, Size: 5981 bytes --]

On Wed, Apr 20, 2022 at 8:16 PM Paolo Bonzini <pbonzini@redhat.com> wrote:

> When using Meson options rather than config-host.h, the "when" clauses
> have to be changed to if statements (which is not necessarily great,
> though at least it highlights which parts of the build are per-target
> and which are not).
>
> Do that before moving vhost logic to meson.build, though for now
> the variables are just based on config-host.mak data.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>

---
>  meson.build       | 31 ++++++++++++++++++++-----------
>  tests/meson.build |  2 +-
>  tools/meson.build |  2 +-
>  3 files changed, 22 insertions(+), 13 deletions(-)
>
> diff --git a/meson.build b/meson.build
> index 870dd8dee0..5b5eb442c4 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -312,6 +312,15 @@ have_tpm = get_option('tpm') \
>    .require(targetos != 'windows', error_message: 'TPM emulation only
> available on POSIX systems') \
>    .allowed()
>
> +# vhost
> +have_vhost_user = 'CONFIG_VHOST_USER' in config_host
> +have_vhost_vdpa = 'CONFIG_VHOST_VDPA' in config_host
> +have_vhost_kernel = 'CONFIG_VHOST_KERNEL' in config_host
> +have_vhost_net_user = 'CONFIG_VHOST_NET_USER' in config_host
> +have_vhost_net_vdpa = 'CONFIG_VHOST_NET_VDPA' in config_host
> +have_vhost_net = 'CONFIG_VHOST_NET' in config_host
> +have_vhost_user_crypto = 'CONFIG_VHOST_CRYPTO' in config_host
> +
>  # Target-specific libraries and flags
>  libm = cc.find_library('m', required: false)
>  threads = dependency('threads')
> @@ -1440,7 +1449,7 @@ has_statx_mnt_id = cc.links(statx_mnt_id_test)
>  have_vhost_user_blk_server = get_option('vhost_user_blk_server') \
>    .require(targetos == 'linux',
>             error_message: 'vhost_user_blk_server requires linux') \
> -  .require('CONFIG_VHOST_USER' in config_host,
> +  .require(have_vhost_user,
>             error_message: 'vhost_user_blk_server requires vhost-user
> support') \
>    .disable_auto_if(not have_system) \
>    .allowed()
> @@ -2283,9 +2292,9 @@ host_kconfig = \
>    (have_ivshmem ? ['CONFIG_IVSHMEM=y'] : []) + \
>    (opengl.found() ? ['CONFIG_OPENGL=y'] : []) + \
>    (x11.found() ? ['CONFIG_X11=y'] : []) + \
> -  ('CONFIG_VHOST_USER' in config_host ? ['CONFIG_VHOST_USER=y'] : []) + \
> -  ('CONFIG_VHOST_VDPA' in config_host ? ['CONFIG_VHOST_VDPA=y'] : []) + \
> -  ('CONFIG_VHOST_KERNEL' in config_host ? ['CONFIG_VHOST_KERNEL=y'] : [])
> + \
> +  (have_vhost_user ? ['CONFIG_VHOST_USER=y'] : []) + \
> +  (have_vhost_vdpa ? ['CONFIG_VHOST_VDPA=y'] : []) + \
> +  (have_vhost_kernel ? ['CONFIG_VHOST_KERNEL=y'] : []) + \
>    (have_virtfs ? ['CONFIG_VIRTFS=y'] : []) + \
>    ('CONFIG_LINUX' in config_host ? ['CONFIG_LINUX=y'] : []) + \
>    (have_pvrdma ? ['CONFIG_PVRDMA=y'] : []) + \
> @@ -2967,7 +2976,7 @@ if have_system or have_user
>  endif
>
>  vhost_user = not_found
> -if targetos == 'linux' and 'CONFIG_VHOST_USER' in config_host
> +if targetos == 'linux' and have_vhost_user
>    libvhost_user = subproject('libvhost-user')
>    vhost_user = libvhost_user.get_variable('vhost_user_dep')
>  endif
> @@ -3548,7 +3557,7 @@ if have_tools
>               dependencies: qemuutil,
>               install: true)
>
> -  if 'CONFIG_VHOST_USER' in config_host
> +  if have_vhost_user
>      subdir('contrib/vhost-user-blk')
>      subdir('contrib/vhost-user-gpu')
>      subdir('contrib/vhost-user-input')
> @@ -3674,12 +3683,12 @@ if 'simple' in get_option('trace_backends')
>  endif
>  summary_info += {'D-Bus display':     dbus_display}
>  summary_info += {'QOM debugging':     get_option('qom_cast_debug')}
> -summary_info += {'vhost-kernel support':
> config_host.has_key('CONFIG_VHOST_KERNEL')}
> -summary_info += {'vhost-net support':
> config_host.has_key('CONFIG_VHOST_NET')}
> -summary_info += {'vhost-crypto support':
> config_host.has_key('CONFIG_VHOST_CRYPTO')}
> -summary_info += {'vhost-user support':
> config_host.has_key('CONFIG_VHOST_USER')}
> +summary_info += {'vhost-kernel support': have_vhost_kernel}
> +summary_info += {'vhost-net support': have_vhost_net}
> +summary_info += {'vhost-user support': have_vhost_user}
> +summary_info += {'vhost-user-crypto support': have_vhost_user_crypto}
>  summary_info += {'vhost-user-blk server support':
> have_vhost_user_blk_server}
> -summary_info += {'vhost-vdpa support':
> config_host.has_key('CONFIG_VHOST_VDPA')}
> +summary_info += {'vhost-vdpa support': have_vhost_vdpa}
>  summary_info += {'build guest agent': have_ga}
>  summary(summary_info, bool_yn: true, section: 'Configurable features')
>
> diff --git a/tests/meson.build b/tests/meson.build
> index 4f691e8465..8e318ec513 100644
> --- a/tests/meson.build
> +++ b/tests/meson.build
> @@ -68,7 +68,7 @@ test_deps = {
>    'test-qht-par': qht_bench,
>  }
>
> -if have_tools and 'CONFIG_VHOST_USER' in config_host and 'CONFIG_LINUX'
> in config_host
> +if have_tools and have_vhost_user and 'CONFIG_LINUX' in config_host
>    executable('vhost-user-bridge',
>               sources: files('vhost-user-bridge.c'),
>               dependencies: [qemuutil, vhost_user])
> diff --git a/tools/meson.build b/tools/meson.build
> index 46977af84f..10eb3a043f 100644
> --- a/tools/meson.build
> +++ b/tools/meson.build
> @@ -3,7 +3,7 @@ have_virtiofsd = get_option('virtiofsd') \
>               error_message: 'virtiofsd requires Linux') \
>      .require(seccomp.found() and libcap_ng.found(),
>               error_message: 'virtiofsd requires libcap-ng-devel and
> seccomp-devel') \
> -    .require('CONFIG_VHOST_USER' in config_host,
> +    .require(have_vhost_user,
>               error_message: 'virtiofsd needs vhost-user-support') \
>      .disable_auto_if(not have_tools and not have_system) \
>      .allowed()
> --
> 2.35.1
>
>
>
>

-- 
Marc-André Lureau

[-- Attachment #2: Type: text/html, Size: 7650 bytes --]

^ permalink raw reply	[flat|nested] 74+ messages in thread

* Re: [PATCH 24/34] configure: switch directory options to automatic parsing
  2022-04-21  9:48   ` Marc-André Lureau
@ 2022-04-21 12:02     ` Paolo Bonzini
  0 siblings, 0 replies; 74+ messages in thread
From: Paolo Bonzini @ 2022-04-21 12:02 UTC (permalink / raw)
  To: Marc-André Lureau; +Cc: Stefan Weil, QEMU

On 4/21/22 11:48, Marc-André Lureau wrote:
>     While prefix, bindir and qemu_suffix needs special treatment due to
>     differences between Windows and POSIX systems, everything else
>     needs no extra code in configure.
> 
> 
> Afaik, it's not common to install binaries under $prefix on Windows. I 
> don't know any open-source project doing that. msys2 explicitly change 
> it to bin again: 
> https://github.com/msys2/MINGW-packages/blob/master/mingw-w64-qemu/PKGBUILD#L94 
> <https://github.com/msys2/MINGW-packages/blob/master/mingw-w64-qemu/PKGBUILD#L94>

It's not, but it's been done like this forever in QEMU for the sake of installing
in "C:\Program Files".

I didn't want to introduce visible changes with this patch, but we could
remove this special casing, and apply it instead when building the NSIS
installers.

Paolo


^ permalink raw reply	[flat|nested] 74+ messages in thread

* Re: [PATCH 33/34] meson: use have_vhost_* variables to pick sources
  2022-04-20 15:34 ` [PATCH 33/34] meson: use have_vhost_* variables to pick sources Paolo Bonzini
@ 2022-04-21 12:08   ` Marc-André Lureau
  0 siblings, 0 replies; 74+ messages in thread
From: Marc-André Lureau @ 2022-04-21 12:08 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: QEMU

[-- Attachment #1: Type: text/plain, Size: 8178 bytes --]

On Wed, Apr 20, 2022 at 8:28 PM Paolo Bonzini <pbonzini@redhat.com> wrote:

> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>


> ---
>  Kconfig.host            |  3 ---
>  backends/meson.build    |  8 ++++++--
>  hw/net/meson.build      |  8 ++++++--
>  hw/virtio/Kconfig       |  3 ---
>  hw/virtio/meson.build   | 25 ++++++++++++++++---------
>  meson.build             |  1 +
>  net/meson.build         | 12 +++++++-----
>  tests/qtest/meson.build |  4 +++-
>  8 files changed, 39 insertions(+), 25 deletions(-)
>
> diff --git a/Kconfig.host b/Kconfig.host
> index 60b9c07b5e..1165c4eacd 100644
> --- a/Kconfig.host
> +++ b/Kconfig.host
> @@ -22,15 +22,12 @@ config TPM
>
>  config VHOST_USER
>      bool
> -    select VHOST
>
>  config VHOST_VDPA
>      bool
> -    select VHOST
>
>  config VHOST_KERNEL
>      bool
> -    select VHOST
>
>  config VIRTFS
>      bool
> diff --git a/backends/meson.build b/backends/meson.build
> index 535c3ca7dd..b1884a88ec 100644
> --- a/backends/meson.build
> +++ b/backends/meson.build
> @@ -12,9 +12,13 @@ softmmu_ss.add([files(
>  softmmu_ss.add(when: 'CONFIG_POSIX', if_true: files('rng-random.c'))
>  softmmu_ss.add(when: 'CONFIG_POSIX', if_true: files('hostmem-file.c'))
>  softmmu_ss.add(when: 'CONFIG_LINUX', if_true: files('hostmem-memfd.c'))
> -softmmu_ss.add(when: ['CONFIG_VHOST_USER', 'CONFIG_VIRTIO'], if_true:
> files('vhost-user.c'))
> +if have_vhost_user
> +  softmmu_ss.add(when: 'CONFIG_VIRTIO', if_true: files('vhost-user.c'))
> +endif
>  softmmu_ss.add(when: 'CONFIG_VIRTIO_CRYPTO', if_true:
> files('cryptodev-vhost.c'))
> -softmmu_ss.add(when: ['CONFIG_VIRTIO_CRYPTO', 'CONFIG_VHOST_CRYPTO'],
> if_true: files('cryptodev-vhost-user.c'))
> +if have_vhost_user_crypto
> +  softmmu_ss.add(when: 'CONFIG_VIRTIO_CRYPTO', if_true:
> files('cryptodev-vhost-user.c'))
> +endif
>  softmmu_ss.add(when: gio, if_true: files('dbus-vmstate.c'))
>  softmmu_ss.add(when: 'CONFIG_SGX', if_true: files('hostmem-epc.c'))
>
> diff --git a/hw/net/meson.build b/hw/net/meson.build
> index 685b75badb..ebac261542 100644
> --- a/hw/net/meson.build
> +++ b/hw/net/meson.build
> @@ -46,8 +46,12 @@ specific_ss.add(when: 'CONFIG_XILINX_ETHLITE', if_true:
> files('xilinx_ethlite.c'
>  softmmu_ss.add(when: 'CONFIG_VIRTIO_NET', if_true: files('net_rx_pkt.c'))
>  specific_ss.add(when: 'CONFIG_VIRTIO_NET', if_true: files('virtio-net.c'))
>
> -softmmu_ss.add(when: ['CONFIG_VIRTIO_NET', 'CONFIG_VHOST_NET'], if_true:
> files('vhost_net.c'), if_false: files('vhost_net-stub.c'))
> -softmmu_ss.add(when: 'CONFIG_ALL', if_true: files('vhost_net-stub.c'))
> +if have_vhost_net
> +  softmmu_ss.add(when: 'CONFIG_VIRTIO_NET', if_true:
> files('vhost_net.c'), if_false: files('vhost_net-stub.c'))
> +  softmmu_ss.add(when: 'CONFIG_ALL', if_true: files('vhost_net-stub.c'))
> +else
> +  softmmu_ss.add(files('vhost_net-stub.c'))
> +endif
>
>  softmmu_ss.add(when: 'CONFIG_ETSEC', if_true: files(
>    'fsl_etsec/etsec.c',
> diff --git a/hw/virtio/Kconfig b/hw/virtio/Kconfig
> index f8e235f814..e9ecae1f50 100644
> --- a/hw/virtio/Kconfig
> +++ b/hw/virtio/Kconfig
> @@ -1,6 +1,3 @@
> -config VHOST
> -    bool
> -
>  config VIRTIO
>      bool
>
> diff --git a/hw/virtio/meson.build b/hw/virtio/meson.build
> index f371404b04..7e8877fd64 100644
> --- a/hw/virtio/meson.build
> +++ b/hw/virtio/meson.build
> @@ -2,18 +2,22 @@ softmmu_virtio_ss = ss.source_set()
>  softmmu_virtio_ss.add(files('virtio-bus.c'))
>  softmmu_virtio_ss.add(when: 'CONFIG_VIRTIO_PCI', if_true:
> files('virtio-pci.c'))
>  softmmu_virtio_ss.add(when: 'CONFIG_VIRTIO_MMIO', if_true:
> files('virtio-mmio.c'))
> -softmmu_virtio_ss.add(when: 'CONFIG_VHOST', if_false:
> files('vhost-stub.c'))
> -
> -softmmu_ss.add_all(when: 'CONFIG_VIRTIO', if_true: softmmu_virtio_ss)
> -softmmu_ss.add(when: 'CONFIG_VIRTIO', if_false: files('vhost-stub.c'))
> -
> -softmmu_ss.add(when: 'CONFIG_ALL', if_true: files('vhost-stub.c'))
>
>  virtio_ss = ss.source_set()
>  virtio_ss.add(files('virtio.c'))
> -virtio_ss.add(when: 'CONFIG_VHOST', if_true: files('vhost.c',
> 'vhost-backend.c', 'vhost-iova-tree.c'))
> -virtio_ss.add(when: 'CONFIG_VHOST_USER', if_true: files('vhost-user.c'))
> -virtio_ss.add(when: 'CONFIG_VHOST_VDPA', if_true:
> files('vhost-shadow-virtqueue.c', 'vhost-vdpa.c'))
> +
> +if have_vhost
> +  virtio_ss.add(files('vhost.c', 'vhost-backend.c', 'vhost-iova-tree.c'))
> +  if have_vhost_user
> +    virtio_ss.add(files('vhost-user.c'))
> +  endif
> +  if have_vhost_vdpa
> +    virtio_ss.add(files('vhost-vdpa.c', 'vhost-shadow-virtqueue.c'))
> +  endif
> +else
> +  softmmu_virtio_ss.add(files('vhost-stub.c'))
> +endif
> +
>  virtio_ss.add(when: 'CONFIG_VIRTIO_BALLOON', if_true:
> files('virtio-balloon.c'))
>  virtio_ss.add(when: 'CONFIG_VIRTIO_CRYPTO', if_true:
> files('virtio-crypto.c'))
>  virtio_ss.add(when: 'CONFIG_VHOST_USER_FS', if_true:
> files('vhost-user-fs.c'))
> @@ -54,3 +58,6 @@ virtio_pci_ss.add(when: 'CONFIG_VIRTIO_MEM', if_true:
> files('virtio-mem-pci.c'))
>  virtio_ss.add_all(when: 'CONFIG_VIRTIO_PCI', if_true: virtio_pci_ss)
>
>  specific_ss.add_all(when: 'CONFIG_VIRTIO', if_true: virtio_ss)
> +softmmu_ss.add_all(when: 'CONFIG_VIRTIO', if_true: softmmu_virtio_ss)
> +softmmu_ss.add(when: 'CONFIG_VIRTIO', if_false: files('vhost-stub.c'))
> +softmmu_ss.add(when: 'CONFIG_ALL', if_true: files('vhost-stub.c'))
> diff --git a/meson.build b/meson.build
> index 5b5eb442c4..e8446cf148 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -319,6 +319,7 @@ have_vhost_kernel = 'CONFIG_VHOST_KERNEL' in
> config_host
>  have_vhost_net_user = 'CONFIG_VHOST_NET_USER' in config_host
>  have_vhost_net_vdpa = 'CONFIG_VHOST_NET_VDPA' in config_host
>  have_vhost_net = 'CONFIG_VHOST_NET' in config_host
> +have_vhost = have_vhost_user or have_vhost_vdpa or have_vhost_kernel
>  have_vhost_user_crypto = 'CONFIG_VHOST_CRYPTO' in config_host
>
>  # Target-specific libraries and flags
> diff --git a/net/meson.build b/net/meson.build
> index 847bc2ac85..c965e83b26 100644
> --- a/net/meson.build
> +++ b/net/meson.build
> @@ -26,10 +26,10 @@ softmmu_ss.add(when: vde, if_true: files('vde.c'))
>  if have_netmap
>    softmmu_ss.add(files('netmap.c'))
>  endif
> -vhost_user_ss = ss.source_set()
> -vhost_user_ss.add(when: 'CONFIG_VIRTIO_NET', if_true:
> files('vhost-user.c'), if_false: files('vhost-user-stub.c'))
> -softmmu_ss.add_all(when: 'CONFIG_VHOST_NET_USER', if_true: vhost_user_ss)
> -softmmu_ss.add(when: 'CONFIG_ALL', if_true: files('vhost-user-stub.c'))
> +if have_vhost_net_user
> +  softmmu_ss.add(when: 'CONFIG_VIRTIO_NET', if_true:
> files('vhost-user.c'), if_false: files('vhost-user-stub.c'))
> +  softmmu_ss.add(when: 'CONFIG_ALL', if_true: files('vhost-user-stub.c'))
> +endif
>
>  softmmu_ss.add(when: 'CONFIG_LINUX', if_true: files('tap-linux.c'))
>  softmmu_ss.add(when: 'CONFIG_BSD', if_true: files('tap-bsd.c'))
> @@ -40,6 +40,8 @@ if not config_host.has_key('CONFIG_LINUX') and not
> config_host.has_key('CONFIG_B
>  endif
>  softmmu_ss.add(when: 'CONFIG_POSIX', if_true: files(tap_posix))
>  softmmu_ss.add(when: 'CONFIG_WIN32', if_true: files('tap-win32.c'))
> -softmmu_ss.add(when: 'CONFIG_VHOST_NET_VDPA', if_true:
> files('vhost-vdpa.c'))
> +if have_vhost_net_vdpa
> +  softmmu_ss.add(files('vhost-vdpa.c'))
> +endif
>
>  subdir('can')
> diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build
> index 69f97b8992..2f2f08b442 100644
> --- a/tests/qtest/meson.build
> +++ b/tests/qtest/meson.build
> @@ -272,7 +272,9 @@ qos_test_ss.add(
>  if have_virtfs
>    qos_test_ss.add(files('virtio-9p-test.c'))
>  endif
> -qos_test_ss.add(when: 'CONFIG_VHOST_USER', if_true:
> files('vhost-user-test.c'))
> +if have_vhost_user
> +  qos_test_ss.add(files('vhost-user-test.c'))
> +endif
>  if have_tools and have_vhost_user_blk_server
>    qos_test_ss.add(files('vhost-user-blk-test.c'))
>  endif
> --
> 2.35.1
>
>
>
>

-- 
Marc-André Lureau

[-- Attachment #2: Type: text/html, Size: 10265 bytes --]

^ permalink raw reply	[flat|nested] 74+ messages in thread

* Re: [PATCH 34/34] configure, meson: move vhost options to Meson
  2022-04-20 15:34 ` [PATCH 34/34] configure, meson: move vhost options to Meson Paolo Bonzini
@ 2022-04-21 12:13   ` Marc-André Lureau
  0 siblings, 0 replies; 74+ messages in thread
From: Marc-André Lureau @ 2022-04-21 12:13 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: QEMU

[-- Attachment #1: Type: text/plain, Size: 11296 bytes --]

On Wed, Apr 20, 2022 at 8:05 PM Paolo Bonzini <pbonzini@redhat.com> wrote:

> Finish the conversion by moving all the definitions and the constraint
> checks to meson_options.txt and meson.build respectively.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>

lgtm
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>


> ---
>  configure                     | 82 -----------------------------------
>  meson.build                   | 33 +++++++++++---
>  meson_options.txt             | 10 +++++
>  scripts/meson-buildoptions.sh | 15 +++++++
>  4 files changed, 51 insertions(+), 89 deletions(-)
>
> diff --git a/configure b/configure
> index 3b38ff3c63..0cedfcf5a9 100755
> --- a/configure
> +++ b/configure
> @@ -282,11 +282,6 @@ EXTRA_CXXFLAGS=""
>  EXTRA_OBJCFLAGS=""
>  EXTRA_LDFLAGS=""
>
> -vhost_kernel="$default_feature"
> -vhost_net="$default_feature"
> -vhost_crypto="$default_feature"
> -vhost_user="no"
> -vhost_vdpa="$default_feature"
>  debug_tcg="no"
>  sanitizers="no"
>  tsan="no"
> @@ -526,7 +521,6 @@ haiku)
>  ;;
>  linux)
>    linux="yes"
> -  vhost_user=${default_feature:-yes}
>  ;;
>  esac
>
> @@ -863,14 +857,6 @@ for opt do
>    ;;
>    --with-coroutine=*) coroutine="$optarg"
>    ;;
> -  --disable-vhost-net) vhost_net="no"
> -  ;;
> -  --enable-vhost-net) vhost_net="yes"
> -  ;;
> -  --disable-vhost-crypto) vhost_crypto="no"
> -  ;;
> -  --enable-vhost-crypto) vhost_crypto="yes"
> -  ;;
>    --disable-zlib-test)
>    ;;
>    --disable-virtio-blk-data-plane|--enable-virtio-blk-data-plane)
> @@ -882,18 +868,6 @@ for opt do
>    --enable-uuid|--disable-uuid)
>        echo "$0: $opt is obsolete, UUID support is always built" >&2
>    ;;
> -  --disable-vhost-user) vhost_user="no"
> -  ;;
> -  --enable-vhost-user) vhost_user="yes"
> -  ;;
> -  --disable-vhost-vdpa) vhost_vdpa="no"
> -  ;;
> -  --enable-vhost-vdpa) vhost_vdpa="yes"
> -  ;;
> -  --disable-vhost-kernel) vhost_kernel="no"
> -  ;;
> -  --enable-vhost-kernel) vhost_kernel="yes"
> -  ;;
>    --disable-capstone) capstone="disabled"
>    ;;
>    --enable-capstone) capstone="enabled"
> @@ -1092,11 +1066,6 @@ cat << EOF
>    debug-info      debugging information
>    safe-stack      SafeStack Stack Smash Protection. Depends on
>                    clang/llvm >= 3.7 and requires coroutine backend
> ucontext.
> -  vhost-net       vhost-net kernel acceleration support
> -  vhost-crypto    vhost-user-crypto backend support
> -  vhost-kernel    vhost kernel backend support
> -  vhost-user      vhost-user backend support
> -  vhost-vdpa      vhost-vdpa kernel backend support
>
>  NOTE: The object files are built at the place where configure is launched
>  EOF
> @@ -1510,35 +1479,6 @@ else
>      exit 1
>  fi
>
> -#########################################
> -# vhost interdependencies and host support
> -
> -# vhost backends
> -if test "$vhost_user" = "yes" && test "$mingw32" = "yes"; then
> -  error_exit "vhost-user is not available on Windows"
> -fi
> -test "$vhost_vdpa" = "" && vhost_vdpa=$linux
> -if test "$vhost_vdpa" = "yes" && test "$linux" != "yes"; then
> -  error_exit "vhost-vdpa is only available on Linux"
> -fi
> -test "$vhost_kernel" = "" && vhost_kernel=$linux
> -if test "$vhost_kernel" = "yes" && test "$linux" != "yes"; then
> -  error_exit "vhost-kernel is only available on Linux"
> -fi
> -
> -# vhost-user backends
> -test "$vhost_crypto" = "" && vhost_crypto=$vhost_user
> -if test "$vhost_crypto" = "yes" && test "$vhost_user" = "no"; then
> -  error_exit "--enable-vhost-crypto requires --enable-vhost-user"
> -fi
> -
> -# OR the vhost-kernel, vhost-vdpa and vhost-user values for simplicity
> -if test "$vhost_net" = ""; then
> -  test "$vhost_user" = "yes" && vhost_net=yes
> -  test "$vhost_vdpa" = "yes" && vhost_net=yes
> -  test "$vhost_kernel" = "yes" && vhost_net=yes
> -fi
> -
>  ##########################################
>  # pkg-config probe
>
> @@ -2058,28 +1998,6 @@ if test "$modules" = "yes"; then
>    echo "CONFIG_MODULES=y" >> $config_host_mak
>  fi
>
> -if test "$vhost_net" = "yes" ; then
> -  echo "CONFIG_VHOST_NET=y" >> $config_host_mak
> -fi
> -if test "$vhost_user" = "yes" ; then
> -  echo "CONFIG_VHOST_NET_USER=y" >> $config_host_mak
> -fi
> -if test "$vhost_vdpa" = "yes" ; then
> -  echo "CONFIG_VHOST_NET_VDPA=y" >> $config_host_mak
> -fi
> -if test "$vhost_crypto" = "yes" ; then
> -  echo "CONFIG_VHOST_CRYPTO=y" >> $config_host_mak
> -fi
> -if test "$vhost_kernel" = "yes" ; then
> -  echo "CONFIG_VHOST_KERNEL=y" >> $config_host_mak
> -fi
> -if test "$vhost_user" = "yes" ; then
> -  echo "CONFIG_VHOST_USER=y" >> $config_host_mak
> -fi
> -if test "$vhost_vdpa" = "yes" ; then
> -  echo "CONFIG_VHOST_VDPA=y" >> $config_host_mak
> -fi
> -
>  # XXX: suppress that
>  if [ "$bsd" = "yes" ] ; then
>    echo "CONFIG_BSD=y" >> $config_host_mak
> diff --git a/meson.build b/meson.build
> index e8446cf148..499082bf55 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -313,14 +313,26 @@ have_tpm = get_option('tpm') \
>    .allowed()
>
>  # vhost
> -have_vhost_user = 'CONFIG_VHOST_USER' in config_host
> -have_vhost_vdpa = 'CONFIG_VHOST_VDPA' in config_host
> -have_vhost_kernel = 'CONFIG_VHOST_KERNEL' in config_host
> -have_vhost_net_user = 'CONFIG_VHOST_NET_USER' in config_host
> -have_vhost_net_vdpa = 'CONFIG_VHOST_NET_VDPA' in config_host
> -have_vhost_net = 'CONFIG_VHOST_NET' in config_host
> +have_vhost_user = get_option('vhost_user') \
> +  .disable_auto_if(targetos != 'linux') \
> +  .require(targetos != 'windows',
> +           error_message: 'vhost-user is not available on
> Windows').allowed()
> +have_vhost_vdpa = get_option('vhost_vdpa') \
> +  .require(targetos == 'linux',
> +           error_message: 'vhost-vdpa is only available on
> Linux').allowed()
> +have_vhost_kernel = get_option('vhost_kernel') \
> +  .require(targetos == 'linux',
> +           error_message: 'vhost-kernel is only available on
> Linux').allowed()
> +have_vhost_user_crypto = get_option('vhost_crypto') \
> +  .require(have_vhost_user,
> +           error_message: 'vhost-crypto requires vhost-user to be
> enabled').allowed()
> +
>  have_vhost = have_vhost_user or have_vhost_vdpa or have_vhost_kernel
> -have_vhost_user_crypto = 'CONFIG_VHOST_CRYPTO' in config_host
> +
> +have_vhost_net_user = have_vhost_user and
> get_option('vhost_net').allowed()
> +have_vhost_net_vdpa = have_vhost_vdpa and
> get_option('vhost_net').allowed()
> +have_vhost_net_kernel = have_vhost_kernel and
> get_option('vhost_net').allowed()
> +have_vhost_net = have_vhost_net_kernel or have_vhost_net_user or
> have_vhost_net_vdpa
>
>  # Target-specific libraries and flags
>  libm = cc.find_library('m', required: false)
> @@ -1709,6 +1721,13 @@ config_host_data.set('CONFIG_SNAPPY',
> snappy.found())
>  config_host_data.set('CONFIG_TPM', have_tpm)
>  config_host_data.set('CONFIG_USB_LIBUSB', libusb.found())
>  config_host_data.set('CONFIG_VDE', vde.found())
> +config_host_data.set('CONFIG_VHOST_NET', have_vhost_net)
> +config_host_data.set('CONFIG_VHOST_NET_USER', have_vhost_net_user)
> +config_host_data.set('CONFIG_VHOST_NET_VDPA', have_vhost_net_vdpa)
> +config_host_data.set('CONFIG_VHOST_KERNEL', have_vhost_kernel)
> +config_host_data.set('CONFIG_VHOST_USER', have_vhost_user)
> +config_host_data.set('CONFIG_VHOST_CRYPTO', have_vhost_user_crypto)
> +config_host_data.set('CONFIG_VHOST_VDPA', have_vhost_vdpa)
>  config_host_data.set('CONFIG_VHOST_USER_BLK_SERVER',
> have_vhost_user_blk_server)
>  config_host_data.set('CONFIG_VNC', vnc.found())
>  config_host_data.set('CONFIG_VNC_JPEG', jpeg.found())
> diff --git a/meson_options.txt b/meson_options.txt
> index 8efd5f520c..24a2a593f0 100644
> --- a/meson_options.txt
> +++ b/meson_options.txt
> @@ -235,6 +235,16 @@ option('oss', type: 'feature', value: 'auto',
>  option('pa', type: 'feature', value: 'auto',
>         description: 'PulseAudio sound support')
>
> +option('vhost_kernel', type: 'feature', value: 'auto',
> +       description: 'vhost kernel backend support')
> +option('vhost_net', type: 'feature', value: 'auto',
> +       description: 'vhost-net kernel acceleration support')
> +option('vhost_user', type: 'feature', value: 'auto',
> +       description: 'vhost-user backend support')
> +option('vhost_crypto', type: 'feature', value: 'auto',
> +       description: 'vhost-user crypto backend support')
> +option('vhost_vdpa', type: 'feature', value: 'auto',
> +       description: 'vhost-vdpa kernel backend support')
>  option('vhost_user_blk_server', type: 'feature', value: 'auto',
>         description: 'build vhost-user-blk server')
>  option('virtfs', type: 'feature', value: 'auto',
> diff --git a/scripts/meson-buildoptions.sh b/scripts/meson-buildoptions.sh
> index 274639777e..28258e1478 100644
> --- a/scripts/meson-buildoptions.sh
> +++ b/scripts/meson-buildoptions.sh
> @@ -153,8 +153,13 @@ meson_options_help() {
>    printf "%s\n" '  usb-redir       libusbredir support'
>    printf "%s\n" '  vde             vde network backend support'
>    printf "%s\n" '  vdi             vdi image format support'
> +  printf "%s\n" '  vhost-crypto    vhost-user crypto backend support'
> +  printf "%s\n" '  vhost-kernel    vhost kernel backend support'
> +  printf "%s\n" '  vhost-net       vhost-net kernel acceleration support'
> +  printf "%s\n" '  vhost-user      vhost-user backend support'
>    printf "%s\n" '  vhost-user-blk-server'
>    printf "%s\n" '                  build vhost-user-blk server'
> +  printf "%s\n" '  vhost-vdpa      vhost-vdpa kernel backend support'
>    printf "%s\n" '  virglrenderer   virgl rendering support'
>    printf "%s\n" '  virtfs          virtio-9p support'
>    printf "%s\n" '  virtiofsd       build virtiofs daemon (virtiofsd)'
> @@ -407,8 +412,18 @@ _meson_option_parse() {
>      --disable-vde) printf "%s" -Dvde=disabled ;;
>      --enable-vdi) printf "%s" -Dvdi=enabled ;;
>      --disable-vdi) printf "%s" -Dvdi=disabled ;;
> +    --enable-vhost-crypto) printf "%s" -Dvhost_crypto=enabled ;;
> +    --disable-vhost-crypto) printf "%s" -Dvhost_crypto=disabled ;;
> +    --enable-vhost-kernel) printf "%s" -Dvhost_kernel=enabled ;;
> +    --disable-vhost-kernel) printf "%s" -Dvhost_kernel=disabled ;;
> +    --enable-vhost-net) printf "%s" -Dvhost_net=enabled ;;
> +    --disable-vhost-net) printf "%s" -Dvhost_net=disabled ;;
> +    --enable-vhost-user) printf "%s" -Dvhost_user=enabled ;;
> +    --disable-vhost-user) printf "%s" -Dvhost_user=disabled ;;
>      --enable-vhost-user-blk-server) printf "%s"
> -Dvhost_user_blk_server=enabled ;;
>      --disable-vhost-user-blk-server) printf "%s"
> -Dvhost_user_blk_server=disabled ;;
> +    --enable-vhost-vdpa) printf "%s" -Dvhost_vdpa=enabled ;;
> +    --disable-vhost-vdpa) printf "%s" -Dvhost_vdpa=disabled ;;
>      --enable-virglrenderer) printf "%s" -Dvirglrenderer=enabled ;;
>      --disable-virglrenderer) printf "%s" -Dvirglrenderer=disabled ;;
>      --enable-virtfs) printf "%s" -Dvirtfs=enabled ;;
> --
> 2.35.1
>
>
>

-- 
Marc-André Lureau

[-- Attachment #2: Type: text/html, Size: 14838 bytes --]

^ permalink raw reply	[flat|nested] 74+ messages in thread

* Re: [PATCH 03/34] qga: wixl: get path to sysroot from pkg-config as intended
  2022-04-20 15:33 ` [PATCH 03/34] qga: wixl: get path to sysroot from pkg-config as intended Paolo Bonzini
  2022-04-20 15:47   ` Marc-André Lureau
@ 2022-04-21 14:18   ` Konstantin Kostiuk
  1 sibling, 0 replies; 74+ messages in thread
From: Konstantin Kostiuk @ 2022-04-21 14:18 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: QEMU

[-- Attachment #1: Type: text/plain, Size: 2099 bytes --]

Reviewed-by: Konstantin Kostiuk <kkostiuk@redhat.com>

On Wed, Apr 20, 2022 at 6:37 PM Paolo Bonzini <pbonzini@redhat.com> wrote:

> The .wxs file uses $(var.Mingw_bin) while configure/meson have always
> used Mingw_dlls.  Fix them to match what was probably intended.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  configure       | 4 ++--
>  qga/meson.build | 2 +-
>  2 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/configure b/configure
> index 2fc860ed9a..2bc5a0b84f 100755
> --- a/configure
> +++ b/configure
> @@ -2702,7 +2702,7 @@ if test "$QEMU_GA_VERSION" = ""; then
>      QEMU_GA_VERSION=$(cat $source_path/VERSION)
>  fi
>
> -QEMU_GA_MSI_MINGW_DLL_PATH="$($pkg_config --variable=prefix glib-2.0)/bin"
> +QEMU_GA_MSI_MINGW_BIN_PATH="$($pkg_config --variable=prefix glib-2.0)/bin"
>
>  # Mac OS X ships with a broken assembler
>  roms=
> @@ -2790,7 +2790,7 @@ if test "$debug_tcg" = "yes" ; then
>  fi
>  if test "$mingw32" = "yes" ; then
>    echo "CONFIG_WIN32=y" >> $config_host_mak
> -  echo "QEMU_GA_MSI_MINGW_DLL_PATH=${QEMU_GA_MSI_MINGW_DLL_PATH}" >>
> $config_host_mak
> +  echo "QEMU_GA_MSI_MINGW_BIN_PATH=${QEMU_GA_MSI_MINGW_BIN_PATH}" >>
> $config_host_mak
>    echo "QEMU_GA_MANUFACTURER=${QEMU_GA_MANUFACTURER}" >> $config_host_mak
>    echo "QEMU_GA_DISTRO=${QEMU_GA_DISTRO}" >> $config_host_mak
>    echo "QEMU_GA_VERSION=${QEMU_GA_VERSION}" >> $config_host_mak
> diff --git a/qga/meson.build b/qga/meson.build
> index 392d560941..6d9f39bb32 100644
> --- a/qga/meson.build
> +++ b/qga/meson.build
> @@ -129,7 +129,7 @@ if targetos == 'windows'
>                                wixl, '-o', '@OUTPUT0@', '@INPUT0@',
>                                qemu_ga_msi_arch[cpu],
>                                qemu_ga_msi_vss,
> -                              '-D', 'Mingw_dlls=' +
> config_host['QEMU_GA_MSI_MINGW_DLL_PATH'],
> +                              '-D', 'Mingw_bin=' +
> config_host['QEMU_GA_MSI_MINGW_BIN_PATH'],
>                              ])
>      all_qga += [qga_msi]
>      alias_target('msi', qga_msi)
> --
> 2.35.1
>
>
>
>

[-- Attachment #2: Type: text/html, Size: 3054 bytes --]

^ permalink raw reply	[flat|nested] 74+ messages in thread

end of thread, other threads:[~2022-04-21 14:37 UTC | newest]

Thread overview: 74+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-20 15:33 [PATCH 00/34] Misc meson conversions for QEMU 7.1 Paolo Bonzini
2022-04-20 15:33 ` [PATCH 01/34] meson: show final set of compiler flags Paolo Bonzini
2022-04-20 15:57   ` Marc-André Lureau
2022-04-20 15:33 ` [PATCH 02/34] configure: remove dead code Paolo Bonzini
2022-04-20 16:04   ` Marc-André Lureau
2022-04-20 15:33 ` [PATCH 03/34] qga: wixl: get path to sysroot from pkg-config as intended Paolo Bonzini
2022-04-20 15:47   ` Marc-André Lureau
2022-04-21 14:18   ` Konstantin Kostiuk
2022-04-20 15:33 ` [PATCH 04/34] configure: pc-bios/qemu-icon.bmp does not exist Paolo Bonzini
2022-04-20 15:47   ` Thomas Huth
2022-04-20 16:05   ` Marc-André Lureau
2022-04-20 15:33 ` [PATCH 05/34] configure: gcov should not exclude fortify-source Paolo Bonzini
2022-04-20 16:06   ` Marc-André Lureau
2022-04-20 15:33 ` [PATCH 06/34] configure: move --enable/--disable-debug-info to second option parsing pass Paolo Bonzini
2022-04-20 15:42   ` Thomas Huth
2022-04-20 16:08   ` Marc-André Lureau
2022-04-20 15:33 ` [PATCH 07/34] configure, meson: move OpenGL check to meson Paolo Bonzini
2022-04-20 16:13   ` Marc-André Lureau
2022-04-20 19:17     ` Paolo Bonzini
2022-04-20 15:33 ` [PATCH 08/34] meson, configure: move RDMA options " Paolo Bonzini
2022-04-20 16:24   ` Marc-André Lureau
2022-04-20 15:33 ` [PATCH 09/34] meson, configure: move keyctl test " Paolo Bonzini
2022-04-20 16:27   ` Marc-André Lureau
2022-04-20 15:33 ` [PATCH 10/34] meson, configure: move usbfs " Paolo Bonzini
2022-04-20 16:35   ` Marc-André Lureau
2022-04-20 15:33 ` [PATCH 11/34] meson, configure: move libgio " Paolo Bonzini
2022-04-20 16:40   ` Marc-André Lureau
2022-04-20 15:33 ` [PATCH 12/34] meson: move CONFIG_XEN_PCI_PASSTHROUGH to config-host.h Paolo Bonzini
2022-04-20 16:45   ` Marc-André Lureau
2022-04-20 15:33 ` [PATCH 13/34] meson, configure: move --enable-module-upgrades to meson Paolo Bonzini
2022-04-20 18:05   ` Marc-André Lureau
2022-04-20 15:33 ` [PATCH 14/34] meson, configure: move Xen detection " Paolo Bonzini
2022-04-20 15:33 ` [PATCH 15/34] meson-buildoptions: add support for string options Paolo Bonzini
2022-04-20 18:14   ` Marc-André Lureau
2022-04-20 15:33 ` [PATCH 16/34] configure, meson: move iasl detection to meson Paolo Bonzini
2022-04-20 18:17   ` Marc-André Lureau
2022-04-20 15:33 ` [PATCH 17/34] configure: move Windows flags " Paolo Bonzini
2022-04-20 18:20   ` Marc-André Lureau
2022-04-20 19:15     ` Paolo Bonzini
2022-04-20 15:33 ` [PATCH 18/34] configure: switch string options to automatic parsing Paolo Bonzini
2022-04-20 18:23   ` Marc-André Lureau
2022-04-20 15:33 ` [PATCH 19/34] meson, configure: move --tls-priority to meson Paolo Bonzini
2022-04-20 18:25   ` Marc-André Lureau
2022-04-20 15:33 ` [PATCH 20/34] meson, configure: move bdrv whitelists " Paolo Bonzini
2022-04-20 18:28   ` Marc-André Lureau
2022-04-20 15:33 ` [PATCH 21/34] meson, configure: move --with-pkgversion, CONFIG_STAMP " Paolo Bonzini
2022-04-20 18:34   ` Marc-André Lureau
2022-04-20 15:33 ` [PATCH 22/34] meson, configure: move --interp-prefix " Paolo Bonzini
2022-04-20 18:40   ` Marc-André Lureau
2022-04-20 15:33 ` [PATCH 23/34] meson: always combine directories with prefix Paolo Bonzini
2022-04-20 18:43   ` Marc-André Lureau
2022-04-20 15:33 ` [PATCH 24/34] configure: switch directory options to automatic parsing Paolo Bonzini
2022-04-21  9:48   ` Marc-André Lureau
2022-04-21 12:02     ` Paolo Bonzini
2022-04-20 15:33 ` [PATCH 25/34] meson: pass more options directly as -D Paolo Bonzini
2022-04-21  9:52   ` Marc-André Lureau
2022-04-20 15:33 ` [PATCH 26/34] configure: omit options with default values from meson command line Paolo Bonzini
2022-04-21 10:04   ` Marc-André Lureau
2022-04-20 15:34 ` [PATCH 27/34] meson, virtio: place all virtio-pci devices under virtio_pci_ss Paolo Bonzini
2022-04-21 10:05   ` Marc-André Lureau
2022-04-20 15:34 ` [PATCH 28/34] configure: simplify vhost-net-{user, vdpa} configuration Paolo Bonzini
2022-04-21 10:08   ` Marc-André Lureau
2022-04-20 15:34 ` [PATCH 29/34] build: move vhost-vsock configuration to Kconfig Paolo Bonzini
2022-04-21 11:38   ` Marc-André Lureau
2022-04-20 15:34 ` [PATCH 30/34] build: move vhost-scsi " Paolo Bonzini
2022-04-21 11:47   ` Marc-André Lureau
2022-04-20 15:34 ` [PATCH 31/34] build: move vhost-user-fs " Paolo Bonzini
2022-04-21 11:48   ` Marc-André Lureau
2022-04-20 15:34 ` [PATCH 32/34] meson: create have_vhost_* variables Paolo Bonzini
2022-04-21 12:01   ` Marc-André Lureau
2022-04-20 15:34 ` [PATCH 33/34] meson: use have_vhost_* variables to pick sources Paolo Bonzini
2022-04-21 12:08   ` Marc-André Lureau
2022-04-20 15:34 ` [PATCH 34/34] configure, meson: move vhost options to Meson Paolo Bonzini
2022-04-21 12:13   ` Marc-André Lureau

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.