qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PULL 00/55] Misc patches for 2020-12-21
@ 2020-12-21 14:43 Paolo Bonzini
  2020-12-21 14:43 ` [PULL 01/55] gitlab: include aarch64-softmmu and ppc64-softmmu cross-system-build Paolo Bonzini
                   ` (55 more replies)
  0 siblings, 56 replies; 61+ messages in thread
From: Paolo Bonzini @ 2020-12-21 14:43 UTC (permalink / raw)
  To: qemu-devel

The following changes since commit a05f8ecd88f15273d033b6f044b850a8af84a5b8:

  Merge remote-tracking branch 'remotes/alistair/tags/pull-riscv-to-apply-20201217-1' into staging (2020-12-18 11:12:35 +0000)

are available in the Git repository at:

  https://gitlab.com/bonzini/qemu.git tags/for-upstream

for you to fetch changes up to 16efbeeb765944fdda71862b40d60f0abeb1e200:

  win32: drop fd registration to the main-loop on setting non-block (2020-12-21 13:53:24 +0100)

----------------------------------------------------------------
From Alex's pull request:
* improve cross-build KVM coverage
* new --without-default-features configure flag
* add __repr__ for ConsoleSocket for debugging
* build tcg tests with -Werror
* test 32 bit builds with fedora
* remove last traces of debian9
* hotfix for centos8 powertools repo

* Move lots of feature detection code to meson (Alex, myself)
* CFI and LTO support (Daniele)
* test-char dangling pointer (Eduardo)
* Build system and win32 fixes (Marc-André)
* Initialization fixes (myself)
* TCG include cleanup (Richard, myself)
* x86 'int N' fix (Peter)

----------------------------------------------------------------
Alex Bennée (7):
      gitlab: include aarch64-softmmu and ppc64-softmmu cross-system-build
      configure: move gettext detection to meson.build
      configure: add --without-default-features
      python: add __repr__ to ConsoleSocket to aid debugging
      gitlab: move --without-default-devices build from Travis
      gitlab: add --without-default-features build
      tests/tcg: build tests with -Werror

Daniel P. Berrangé (1):
      tests: update for rename of CentOS8 PowerTools repo

Daniele Buono (5):
      configure,meson: add option to enable LTO
      cfi: Initial support for cfi-icall in QEMU
      check-block: enable iotests with cfi-icall
      configure,meson: support Control-Flow Integrity
      docs: Add CFI Documentation

Eduardo Habkost (2):
      test-char: Destroy chardev correctly at char_file_test_internal()
      qom: Assert that objects being destroyed have no parent

Marc-André Lureau (2):
      build-sys: fix -static linking of libvhost-user
      win32: drop fd registration to the main-loop on setting non-block

Paolo Bonzini (34):
      configure: document --without-default-{features,devices}
      vl: initialize displays _after_ exiting preconfiguration
      remove TCG includes from common code
      trace: do not include TCG helper tracepoints in no-TCG builds
      Makefile: add dummy target for build.ninja dependencies
      meson: update submodule to 0.56.0
      meson: switch minimum meson version to 0.56.0
      meson: fix detection of curses with pkgconfig
      meson: use pkg-config method for libudev
      meson: use dependency to gate block modules
      meson: cleanup Kconfig.host handling
      configure: remove useless code to check for Xen PCI passthrough
      configure: remove variable bogus_os
      configure: accept --enable-slirp
      configure: remove CONFIG_FILEVERSION and CONFIG_PRODUCTVERSION
      brlapi: convert to meson
      curl: remove compatibility code, require 7.29.0
      curl: convert to meson
      glusterfs: convert to meson
      bzip2: convert to meson
      libiscsi: convert to meson
      libnfs: convert to meson
      libssh: convert to meson
      rbd: convert to meson
      lzo: convert to meson
      snappy: convert to meson
      lzfse: convert to meson
      zstd: convert to meson
      seccomp: convert to meson
      virtfs: convert to meson
      cap_ng: convert to meson
      libattr: convert to meson
      meson.build: convert --with-default-devices to meson
      configure: move tests/qemu-iotests/common.env generation to meson

Peter Maydell (1):
      target/i386: Check privilege level for protected mode 'int N' task gate

Richard Henderson (1):
      util: Extract flush_icache_range to cacheflush.c

Thomas Huth (2):
      gitlab-CI: Test 32-bit builds with the fedora-i386-cross container
      tests/docker: Remove the remainders of debian9 containers from the Makefile

 .gitlab-ci.d/crossbuilds.yml                      |  22 +-
 .gitlab-ci.yml                                    |  14 +
 .travis.yml                                       |   8 -
 MAINTAINERS                                       |   2 +
 Makefile                                          |   1 +
 accel/Kconfig                                     |   9 +
 accel/stubs/tcg-stub.c                            |   1 -
 accel/tcg/cpu-exec.c                              |  11 +
 accel/tcg/cputlb.c                                |   2 +-
 accel/tcg/translate-all.c                         |   2 +-
 accel/tcg/user-exec.c                             |   2 +-
 block/curl.c                                      |  28 -
 block/meson.build                                 |  22 +-
 chardev/meson.build                               |   2 +-
 configure                                         | 805 +++++-----------------
 contrib/elf2dmp/meson.build                       |   2 +-
 contrib/vhost-user-scsi/meson.build               |   2 +-
 cpu.c                                             |   2 +-
 docs/devel/control-flow-integrity.rst             | 137 ++++
 docs/devel/index.rst                              |   5 +-
 docs/devel/kconfig.rst                            |  19 +-
 docs/meson.build                                  |  12 +-
 hw/i386/kvmvapic.c                                |   1 -
 {accel/tcg => include/exec}/translate-all.h       |   0
 include/qemu/cacheflush.h                         |  24 +
 include/qemu/compiler.h                           |  12 +
 meson                                             |   2 +-
 meson.build                                       | 484 +++++++++----
 meson_options.txt                                 |  49 +-
 migration/meson.build                             |   2 +-
 monitor/misc.c                                    |   1 -
 plugins/core.c                                    |  37 +
 plugins/loader.c                                  |   7 +
 plugins/meson.build                               |   4 +-
 po/meson.build                                    |   2 +-
 python/qemu/console_socket.py                     |   7 +
 qom/object.c                                      |   1 +
 softmmu/meson.build                               |   2 +-
 softmmu/physmem.c                                 |   4 +-
 softmmu/qemu-seccomp.c                            |   2 -
 softmmu/vl.c                                      |   2 +-
 target/i386/tcg/seg_helper.c                      |  35 +-
 tcg/aarch64/tcg-target.h                          |   5 -
 tcg/arm/tcg-target.h                              |   5 -
 tcg/i386/tcg-target.h                             |   4 -
 tcg/mips/tcg-target.h                             |  11 -
 tcg/ppc/tcg-target.c.inc                          |  22 -
 tcg/ppc/tcg-target.h                              |   1 -
 tcg/riscv/tcg-target.h                            |   5 -
 tcg/s390/tcg-target.h                             |   4 -
 tcg/sparc/tcg-target.h                            |   8 -
 tcg/tcg.c                                         |   1 +
 tcg/tci.c                                         |   7 +
 tcg/tci/tcg-target.h                              |   4 -
 tests/check-block.sh                              |  18 +-
 tests/docker/Makefile.include                     |   6 +-
 tests/docker/dockerfiles/centos8.docker           |   5 +-
 tests/docker/dockerfiles/fedora-i386-cross.docker |  18 +-
 tests/meson.build                                 |   2 +-
 tests/qapi-schema/meson.build                     |   4 +-
 tests/qemu-iotests/common.env.in                  |   3 +
 tests/qemu-iotests/meson.build                    |   3 +
 tests/qtest/meson.build                           |   2 +-
 tests/tcg/Makefile.target                         |   2 +-
 tests/test-char.c                                 |   2 +-
 tools/meson.build                                 |   6 +-
 trace/meson.build                                 |   6 +-
 util/cacheflush.c                                 |  71 ++
 util/main-loop.c                                  |  11 +
 util/meson.build                                  |   2 +-
 util/oslib-posix.c                                |  11 +
 util/oslib-win32.c                                |   1 -
 version.rc                                        |   4 +-
 73 files changed, 1069 insertions(+), 973 deletions(-)
 create mode 100644 docs/devel/control-flow-integrity.rst
 rename {accel/tcg => include/exec}/translate-all.h (100%)
 create mode 100644 include/qemu/cacheflush.h
 create mode 100644 tests/qemu-iotests/common.env.in
 create mode 100644 util/cacheflush.c
-- 
2.29.2



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

* [PULL 01/55] gitlab: include aarch64-softmmu and ppc64-softmmu cross-system-build
  2020-12-21 14:43 [PULL 00/55] Misc patches for 2020-12-21 Paolo Bonzini
@ 2020-12-21 14:43 ` Paolo Bonzini
  2020-12-21 14:43 ` [PULL 02/55] configure: move gettext detection to meson.build Paolo Bonzini
                   ` (54 subsequent siblings)
  55 siblings, 0 replies; 61+ messages in thread
From: Paolo Bonzini @ 2020-12-21 14:43 UTC (permalink / raw)
  To: qemu-devel; +Cc: Thomas Huth, Alex Bennée, Wainer dos Santos Moschetta

From: Alex Bennée <alex.bennee@linaro.org>

Otherwise we miss coverage of KVM support in the cross build. To
balance it out add arm-softmmu (no kvm, subset of aarch64),
cris-softmmu and ppc-softmmu to the exclude list which do get coverage
elsewhere.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
Message-Id: <20201210190417.31673-3-alex.bennee@linaro.org>
---
 .gitlab-ci.d/crossbuilds.yml | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/.gitlab-ci.d/crossbuilds.yml b/.gitlab-ci.d/crossbuilds.yml
index bd6473a75a..fcc1b95290 100644
--- a/.gitlab-ci.d/crossbuilds.yml
+++ b/.gitlab-ci.d/crossbuilds.yml
@@ -7,9 +7,9 @@
     - cd build
     - PKG_CONFIG_PATH=$PKG_CONFIG_PATH
       ../configure --enable-werror $QEMU_CONFIGURE_OPTS --disable-user
-        --target-list-exclude="aarch64-softmmu i386-softmmu microblaze-softmmu
-          mips-softmmu mipsel-softmmu mips64-softmmu ppc64-softmmu sh4-softmmu
-          xtensa-softmmu"
+        --target-list-exclude="arm-softmmu cris-softmmu i386-softmmu
+          microblaze-softmmu mips-softmmu mipsel-softmmu mips64-softmmu
+          ppc-softmmu sh4-softmmu xtensa-softmmu"
     - make -j$(expr $(nproc) + 1) all check-build
 
 # Job to cross-build specific accelerators.
-- 
2.29.2




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

* [PULL 02/55] configure: move gettext detection to meson.build
  2020-12-21 14:43 [PULL 00/55] Misc patches for 2020-12-21 Paolo Bonzini
  2020-12-21 14:43 ` [PULL 01/55] gitlab: include aarch64-softmmu and ppc64-softmmu cross-system-build Paolo Bonzini
@ 2020-12-21 14:43 ` Paolo Bonzini
  2020-12-21 14:43 ` [PULL 03/55] configure: add --without-default-features Paolo Bonzini
                   ` (53 subsequent siblings)
  55 siblings, 0 replies; 61+ messages in thread
From: Paolo Bonzini @ 2020-12-21 14:43 UTC (permalink / raw)
  To: qemu-devel; +Cc: Alex Bennée

From: Alex Bennée <alex.bennee@linaro.org>

This will allow meson to honour -Dauto_features=disabled later.

Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20201210190417.31673-4-alex.bennee@linaro.org>
---
 configure         | 19 +++----------------
 meson_options.txt |  2 +-
 po/meson.build    |  2 +-
 3 files changed, 5 insertions(+), 18 deletions(-)

diff --git a/configure b/configure
index c228f7c21e..134f5de5ab 100755
--- a/configure
+++ b/configure
@@ -448,7 +448,7 @@ libdaxctl=""
 meson=""
 ninja=""
 skip_meson=no
-gettext=""
+gettext="auto"
 fuse="auto"
 fuse_lseek="auto"
 
@@ -1016,9 +1016,9 @@ for opt do
   ;;
   --enable-vnc) vnc="enabled"
   ;;
-  --disable-gettext) gettext="false"
+  --disable-gettext) gettext="disabled"
   ;;
-  --enable-gettext) gettext="true"
+  --enable-gettext) gettext="enabled"
   ;;
   --oss-lib=*) oss_lib="$optarg"
   ;;
@@ -2847,19 +2847,6 @@ if test "$xen_pci_passthrough" != "disabled"; then
   fi
 fi
 
-##########################################
-# gettext probe
-if test "$gettext" != "false" ; then
-  if has xgettext; then
-    gettext=true
-  else
-    if test "$gettext" = "true" ; then
-      feature_not_found "gettext" "Install xgettext binary"
-    fi
-    gettext=false
-  fi
-fi
-
 ##########################################
 # X11 probe
 if $pkg_config --exists "x11"; then
diff --git a/meson_options.txt b/meson_options.txt
index 74ac853548..f8f053b5c8 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -9,7 +9,7 @@ option('sphinx_build', type : 'string', value : '',
 
 option('docs', type : 'feature', value : 'auto',
        description: 'Documentations build support')
-option('gettext', type : 'boolean', value : true,
+option('gettext', type : 'feature', value : 'auto',
        description: 'Localization of the GTK+ user interface')
 option('install_blobs', type : 'boolean', value : true,
        description: 'install provided firmware blobs')
diff --git a/po/meson.build b/po/meson.build
index 1387fd979a..a863f0575f 100644
--- a/po/meson.build
+++ b/po/meson.build
@@ -1,6 +1,6 @@
 i18n = import('i18n')
 
-if get_option('gettext')
+if find_program('xgettext', required: get_option('gettext')).found()
   i18n.gettext(meson.project_name(),
                args: '--msgid-bugs-address=qemu-devel@nongnu.org',
                preset: 'glib')
-- 
2.29.2




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

* [PULL 03/55] configure: add --without-default-features
  2020-12-21 14:43 [PULL 00/55] Misc patches for 2020-12-21 Paolo Bonzini
  2020-12-21 14:43 ` [PULL 01/55] gitlab: include aarch64-softmmu and ppc64-softmmu cross-system-build Paolo Bonzini
  2020-12-21 14:43 ` [PULL 02/55] configure: move gettext detection to meson.build Paolo Bonzini
@ 2020-12-21 14:43 ` Paolo Bonzini
  2020-12-21 14:43 ` [PULL 04/55] python: add __repr__ to ConsoleSocket to aid debugging Paolo Bonzini
                   ` (52 subsequent siblings)
  55 siblings, 0 replies; 61+ messages in thread
From: Paolo Bonzini @ 2020-12-21 14:43 UTC (permalink / raw)
  To: qemu-devel; +Cc: Thomas Huth, Alex Bennée

From: Alex Bennée <alex.bennee@linaro.org>

By default QEMU enables a lot of features if it can probe and find the
support libraries. It also enables a bunch of features by default.
This patch adds the ability to build --without-default-features which
can be paired with a --without-default-devices for a barely functional
build.

The main use case for this is testing our build assumptions and for
minimising the amount of stuff you build if you just want to test a
particular feature on your relatively slow emulated test system. On
it's own I go from:

  $ ls -lh qemu-system-aarch64
  -rwxr-xr-x 1 alex alex 120M Dec 10 12:45 qemu-system-aarch64*
  $ ldd qemu-system-aarch64 | wc -l
  170

to:

  $ ls -lh qemu-aarch64
  -rwxr-xr-x 1 alex alex 43M Dec 10 12:41 qemu-aarch64*
  $ ldd qemu-system-aarch64 | wc -l
  57

which is still able to run my default Debian ARM64 machine with a lot
less fat involved.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Acked-by: Thomas Huth <thuth@redhat.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20201210190417.31673-5-alex.bennee@linaro.org>
---
 configure | 155 ++++++++++++++++++++++++++++++------------------------
 1 file changed, 85 insertions(+), 70 deletions(-)

diff --git a/configure b/configure
index 134f5de5ab..a5ee2d2a06 100755
--- a/configure
+++ b/configure
@@ -293,8 +293,19 @@ unset target_list_exclude
 # Distributions want to ensure that several features are compiled in, and it
 # is impossible without a --enable-foo that exits if a feature is not found.
 
-brlapi=""
-curl=""
+default_feature=""
+# parse CC options second
+for opt do
+  optarg=$(expr "x$opt" : 'x[^=]*=\(.*\)')
+  case "$opt" in
+      --without-default-features)
+          default_feature="no"
+  ;;
+  esac
+done
+
+brlapi="$default_feature"
+curl="$default_feature"
 iconv="auto"
 curses="auto"
 docs="auto"
@@ -303,52 +314,52 @@ netmap="no"
 sdl="auto"
 sdl_image="auto"
 virtiofsd="auto"
-virtfs=""
+virtfs="$default_feature"
 libudev="auto"
 mpath="auto"
 vnc="enabled"
 sparse="auto"
-vde=""
+vde="$default_feature"
 vnc_sasl="auto"
 vnc_jpeg="auto"
 vnc_png="auto"
 xkbcommon="auto"
-xen=""
-xen_ctrl_version=""
+xen="$default_feature"
+xen_ctrl_version="$default_feature"
 xen_pci_passthrough="auto"
-linux_aio=""
-linux_io_uring=""
-cap_ng=""
-attr=""
-libattr=""
-xfs=""
+linux_aio="$default_feature"
+linux_io_uring="$default_feature"
+cap_ng="$default_feature"
+attr="$default_feature"
+libattr="$default_feature"
+xfs="$default_feature"
 tcg="enabled"
-membarrier=""
-vhost_net=""
-vhost_crypto=""
-vhost_scsi=""
-vhost_vsock=""
+membarrier="$default_feature"
+vhost_net="$default_feature"
+vhost_crypto="$default_feature"
+vhost_scsi="$default_feature"
+vhost_vsock="$default_feature"
 vhost_user="no"
 vhost_user_blk_server="auto"
-vhost_user_fs=""
+vhost_user_fs="$default_feature"
 kvm="auto"
 hax="auto"
 hvf="auto"
 whpx="auto"
-rdma=""
-pvrdma=""
+rdma="$default_feature"
+pvrdma="$default_feature"
 gprof="no"
 debug_tcg="no"
 debug="no"
 sanitizers="no"
 tsan="no"
-fortify_source=""
+fortify_source="$default_feature"
 strip_opt="yes"
 tcg_interpreter="no"
 bigendian="no"
 mingw32="no"
 gcov="no"
-EXESUF=""
+EXESUF="$default_feature"
 HOST_DSOSUF=".so"
 modules="no"
 module_upgrades="no"
@@ -370,81 +381,81 @@ pie=""
 qom_cast_debug="yes"
 trace_backends="log"
 trace_file="trace"
-spice=""
-rbd=""
-smartcard=""
+spice="$default_feature"
+rbd="$default_feature"
+smartcard="$default_feature"
 u2f="auto"
-libusb=""
-usb_redir=""
-opengl=""
+libusb="$default_feature"
+usb_redir="$default_feature"
+opengl="$default_feature"
 opengl_dmabuf="no"
 cpuid_h="no"
-avx2_opt=""
+avx2_opt="$default_feature"
 capstone="auto"
-lzo=""
-snappy=""
-bzip2=""
-lzfse=""
-zstd=""
-guest_agent=""
+lzo="$default_feature"
+snappy="$default_feature"
+bzip2="$default_feature"
+lzfse="$default_feature"
+zstd="$default_feature"
+guest_agent="$default_feature"
 guest_agent_with_vss="no"
 guest_agent_ntddscsi="no"
-guest_agent_msi=""
-vss_win32_sdk=""
+guest_agent_msi="$default_feature"
+vss_win32_sdk="$default_feature"
 win_sdk="no"
-want_tools=""
-libiscsi=""
-libnfs=""
+want_tools="$default_feature"
+libiscsi="$default_feature"
+libnfs="$default_feature"
 coroutine=""
-coroutine_pool=""
+coroutine_pool="$default_feature"
 debug_stack_usage="no"
 crypto_afalg="no"
-seccomp=""
-glusterfs=""
+seccomp="$default_feature"
+glusterfs="$default_feature"
 glusterfs_xlator_opt="no"
 glusterfs_discard="no"
 glusterfs_fallocate="no"
 glusterfs_zerofill="no"
 glusterfs_ftruncate_has_stat="no"
 glusterfs_iocb_has_stat="no"
-gtk=""
+gtk="$default_feature"
 gtk_gl="no"
 tls_priority="NORMAL"
-gnutls=""
-nettle=""
+gnutls="$default_feature"
+nettle="$default_feature"
 nettle_xts="no"
-gcrypt=""
+gcrypt="$default_feature"
 gcrypt_hmac="no"
 gcrypt_xts="no"
 qemu_private_xts="yes"
-auth_pam=""
-vte=""
-virglrenderer=""
-tpm=""
-libssh=""
-live_block_migration="yes"
-numa=""
+auth_pam="$default_feature"
+vte="$default_feature"
+virglrenderer="$default_feature"
+tpm="$default_feature"
+libssh="$default_feature"
+live_block_migration=${default_feature:-yes}
+numa="$default_feature"
 tcmalloc="no"
 jemalloc="no"
-replication="yes"
-bochs="yes"
-cloop="yes"
-dmg="yes"
-qcow1="yes"
-vdi="yes"
-vvfat="yes"
-qed="yes"
-parallels="yes"
+replication=${default_feature:-yes}
+bochs=${default_feature:-yes}
+cloop=${default_feature:-yes}
+dmg=${default_feature:-yes}
+qcow1=${default_feature:-yes}
+vdi=${default_feature:-yes}
+vvfat=${default_feature:-yes}
+qed=${default_feature:-yes}
+parallels=${default_feature:-yes}
 sheepdog="no"
-libxml2=""
+libxml2="$default_feature"
 debug_mutex="no"
-libpmem=""
+libpmem="$default_feature"
 default_devices="yes"
 plugins="no"
 fuzzing="no"
 rng_none="no"
-secret_keyring=""
-libdaxctl=""
+secret_keyring="$default_feature"
+libdaxctl="$default_feature"
 meson=""
 ninja=""
 skip_meson=no
@@ -455,7 +466,7 @@ fuse_lseek="auto"
 bogus_os="no"
 malloc_trim="auto"
 
-# parse CC options first
+# parse CC options second
 for opt do
   optarg=$(expr "x$opt" : 'x[^=]*=\(.*\)')
   case "$opt" in
@@ -798,7 +809,7 @@ Linux)
   audio_possible_drivers="oss alsa sdl pa"
   linux="yes"
   linux_user="yes"
-  vhost_user="yes"
+  vhost_user=${default_feature:-yes}
 ;;
 esac
 
@@ -942,6 +953,8 @@ for opt do
   ;;
   --without-default-devices) default_devices="no"
   ;;
+  --without-default-features) # processed above
+  ;;
   --enable-gprof) gprof="yes"
   ;;
   --enable-gcov) gcov="yes"
@@ -1747,7 +1760,8 @@ Advanced options (experts only):
   --gdb=GDB-path           gdb to use for gdbstub tests [$gdb_bin]
 
 Optional features, enabled with --enable-FEATURE and
-disabled with --disable-FEATURE, default is enabled if available:
+disabled with --disable-FEATURE, default is enabled if available
+(unless built with --without-default-features):
 
   system          all system emulation targets
   user            supported user emulation targets
@@ -6957,6 +6971,7 @@ NINJA=$ninja $meson setup \
         -Ddocs=$docs -Dsphinx_build=$sphinx_build -Dinstall_blobs=$blobs \
         -Dvhost_user_blk_server=$vhost_user_blk_server \
         -Dfuse=$fuse -Dfuse_lseek=$fuse_lseek \
+        $(if test "$default_features" = no; then echo "-Dauto_features=disabled"; fi) \
         $cross_arg \
         "$PWD" "$source_path"
 
-- 
2.29.2




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

* [PULL 04/55] python: add __repr__ to ConsoleSocket to aid debugging
  2020-12-21 14:43 [PULL 00/55] Misc patches for 2020-12-21 Paolo Bonzini
                   ` (2 preceding siblings ...)
  2020-12-21 14:43 ` [PULL 03/55] configure: add --without-default-features Paolo Bonzini
@ 2020-12-21 14:43 ` Paolo Bonzini
  2020-12-21 14:43 ` [PULL 05/55] gitlab: move --without-default-devices build from Travis Paolo Bonzini
                   ` (51 subsequent siblings)
  55 siblings, 0 replies; 61+ messages in thread
From: Paolo Bonzini @ 2020-12-21 14:43 UTC (permalink / raw)
  To: qemu-devel; +Cc: Willian Rampazzo, John Snow, Alex Bennée

From: Alex Bennée <alex.bennee@linaro.org>

While attempting to debug some console weirdness I thought it would be
worth making it easier to see what it had inside.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: John Snow <jsnow@redhat.com>
Reviewed-by: Willian Rampazzo <willianr@redhat.com>
Message-Id: <20201210190417.31673-6-alex.bennee@linaro.org>
---
 python/qemu/console_socket.py | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/python/qemu/console_socket.py b/python/qemu/console_socket.py
index f060d79e06..ac21130e44 100644
--- a/python/qemu/console_socket.py
+++ b/python/qemu/console_socket.py
@@ -45,6 +45,13 @@ class ConsoleSocket(socket.socket):
         if drain:
             self._drain_thread = self._thread_start()
 
+    def __repr__(self) -> str:
+        s = super().__repr__()
+        s = s.rstrip(">")
+        s = "%s,  logfile=%s, drain_thread=%s>" % (s, self._logfile,
+                                                   self._drain_thread)
+        return s
+
     def _drain_fn(self) -> None:
         """Drains the socket and runs while the socket is open."""
         while self._open:
-- 
2.29.2




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

* [PULL 05/55] gitlab: move --without-default-devices build from Travis
  2020-12-21 14:43 [PULL 00/55] Misc patches for 2020-12-21 Paolo Bonzini
                   ` (3 preceding siblings ...)
  2020-12-21 14:43 ` [PULL 04/55] python: add __repr__ to ConsoleSocket to aid debugging Paolo Bonzini
@ 2020-12-21 14:43 ` Paolo Bonzini
  2020-12-21 14:43 ` [PULL 06/55] gitlab: add --without-default-features build Paolo Bonzini
                   ` (50 subsequent siblings)
  55 siblings, 0 replies; 61+ messages in thread
From: Paolo Bonzini @ 2020-12-21 14:43 UTC (permalink / raw)
  To: qemu-devel; +Cc: Thomas Huth, Alex Bennée, Wainer dos Santos Moschetta

From: Alex Bennée <alex.bennee@linaro.org>

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
Message-Id: <20201210190417.31673-7-alex.bennee@linaro.org>
---
 .gitlab-ci.yml | 7 +++++++
 .travis.yml    | 8 --------
 2 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 98bff03b47..495ff59340 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -514,6 +514,13 @@ build-trace-ust-system:
     IMAGE: ubuntu2004
     CONFIGURE_ARGS: --enable-trace-backends=ust --target-list=x86_64-softmmu
 
+# Check our reduced build configurations
+build-without-default-devices:
+  <<: *native_build_job_definition
+  variables:
+    IMAGE: centos8
+    CONFIGURE_ARGS: --without-default-devices --disable-user
+
 check-patch:
   stage: build
   image: $CI_REGISTRY_IMAGE/qemu/centos8:latest
diff --git a/.travis.yml b/.travis.yml
index d01714a5ae..f2a101936c 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -205,14 +205,6 @@ jobs:
         - ${SRC_DIR}/scripts/travis/coverage-summary.sh
 
 
-    # We manually include builds which we disable "make check" for
-    - name: "GCC without-default-devices (softmmu)"
-      env:
-        - CONFIG="--without-default-devices --disable-user"
-        - CACHE_NAME="${TRAVIS_BRANCH}-linux-gcc-default"
-        - TEST_CMD=""
-
-
     # Using newer GCC with sanitizers
     - name: "GCC9 with sanitizers (softmmu)"
       dist: bionic
-- 
2.29.2




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

* [PULL 06/55] gitlab: add --without-default-features build
  2020-12-21 14:43 [PULL 00/55] Misc patches for 2020-12-21 Paolo Bonzini
                   ` (4 preceding siblings ...)
  2020-12-21 14:43 ` [PULL 05/55] gitlab: move --without-default-devices build from Travis Paolo Bonzini
@ 2020-12-21 14:43 ` Paolo Bonzini
  2020-12-21 14:43 ` [PULL 07/55] tests/tcg: build tests with -Werror Paolo Bonzini
                   ` (49 subsequent siblings)
  55 siblings, 0 replies; 61+ messages in thread
From: Paolo Bonzini @ 2020-12-21 14:43 UTC (permalink / raw)
  To: qemu-devel; +Cc: Thomas Huth, Alex Bennée

From: Alex Bennée <alex.bennee@linaro.org>

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20201210190417.31673-8-alex.bennee@linaro.org>
---
 .gitlab-ci.yml | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 495ff59340..6af8af371e 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -521,6 +521,13 @@ build-without-default-devices:
     IMAGE: centos8
     CONFIGURE_ARGS: --without-default-devices --disable-user
 
+build-without-default-features:
+  <<: *native_build_job_definition
+  variables:
+    IMAGE: debian-amd64
+    CONFIGURE_ARGS: --without-default-features --disable-user
+    MAKE_CHECK_ARGS: check-unit
+
 check-patch:
   stage: build
   image: $CI_REGISTRY_IMAGE/qemu/centos8:latest
-- 
2.29.2




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

* [PULL 07/55] tests/tcg: build tests with -Werror
  2020-12-21 14:43 [PULL 00/55] Misc patches for 2020-12-21 Paolo Bonzini
                   ` (5 preceding siblings ...)
  2020-12-21 14:43 ` [PULL 06/55] gitlab: add --without-default-features build Paolo Bonzini
@ 2020-12-21 14:43 ` Paolo Bonzini
  2020-12-21 14:44 ` [PULL 08/55] gitlab-CI: Test 32-bit builds with the fedora-i386-cross container Paolo Bonzini
                   ` (48 subsequent siblings)
  55 siblings, 0 replies; 61+ messages in thread
From: Paolo Bonzini @ 2020-12-21 14:43 UTC (permalink / raw)
  To: qemu-devel; +Cc: Thomas Huth, Alex Bennée, Philippe Mathieu-Daudé

From: Alex Bennée <alex.bennee@linaro.org>

Hopefully this will guard against sloppy code getting into our tests.

Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20201210190417.31673-9-alex.bennee@linaro.org>
---
 tests/tcg/Makefile.target | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/tcg/Makefile.target b/tests/tcg/Makefile.target
index 2ae86776cd..24d75a5801 100644
--- a/tests/tcg/Makefile.target
+++ b/tests/tcg/Makefile.target
@@ -94,7 +94,7 @@ ifdef CONFIG_USER_ONLY
 -include $(SRC_PATH)/tests/tcg/$(TARGET_NAME)/Makefile.target
 
 # Add the common build options
-CFLAGS+=-Wall -O0 -g -fno-strict-aliasing
+CFLAGS+=-Wall -Werror -O0 -g -fno-strict-aliasing
 ifeq ($(BUILD_STATIC),y)
 LDFLAGS+=-static
 endif
-- 
2.29.2




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

* [PULL 08/55] gitlab-CI: Test 32-bit builds with the fedora-i386-cross container
  2020-12-21 14:43 [PULL 00/55] Misc patches for 2020-12-21 Paolo Bonzini
                   ` (6 preceding siblings ...)
  2020-12-21 14:43 ` [PULL 07/55] tests/tcg: build tests with -Werror Paolo Bonzini
@ 2020-12-21 14:44 ` Paolo Bonzini
  2020-12-21 14:44 ` [PULL 09/55] tests/docker: Remove the remainders of debian9 containers from the Makefile Paolo Bonzini
                   ` (47 subsequent siblings)
  55 siblings, 0 replies; 61+ messages in thread
From: Paolo Bonzini @ 2020-12-21 14:44 UTC (permalink / raw)
  To: qemu-devel; +Cc: Thomas Huth, Alex Bennée, Wainer dos Santos Moschetta

From: Thomas Huth <thuth@redhat.com>

After adding some missing packages, it's possible to check 32-bit
builds and tests with the fedora-i386-cross container in the gitlab-CI,
too. Unfortunately, the code in subprojects/ ignores the --extra-cflags
(on purpose), so the vhost-user part has to be disabled for this.

While we're at it, update the container to Fedora 31. Unfortunately the
gcc from the later versions emits some very dubious format-truncation
warnings, so Fedora 32 and 33 are currently unsuitable for this job.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
Message-Id: <20201215083451.92322-1-thuth@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
 .gitlab-ci.d/crossbuilds.yml                   | 16 ++++++++++++++--
 .../dockerfiles/fedora-i386-cross.docker       | 18 +++++++++++++++---
 2 files changed, 29 insertions(+), 5 deletions(-)

diff --git a/.gitlab-ci.d/crossbuilds.yml b/.gitlab-ci.d/crossbuilds.yml
index fcc1b95290..66547b6683 100644
--- a/.gitlab-ci.d/crossbuilds.yml
+++ b/.gitlab-ci.d/crossbuilds.yml
@@ -10,7 +10,7 @@
         --target-list-exclude="arm-softmmu cris-softmmu i386-softmmu
           microblaze-softmmu mips-softmmu mipsel-softmmu mips64-softmmu
           ppc-softmmu sh4-softmmu xtensa-softmmu"
-    - make -j$(expr $(nproc) + 1) all check-build
+    - make -j$(expr $(nproc) + 1) all check-build $MAKE_CHECK_ARGS
 
 # Job to cross-build specific accelerators.
 #
@@ -37,7 +37,7 @@
     - cd build
     - PKG_CONFIG_PATH=$PKG_CONFIG_PATH
       ../configure --enable-werror $QEMU_CONFIGURE_OPTS --disable-system
-    - make -j$(expr $(nproc) + 1) all check-build
+    - make -j$(expr $(nproc) + 1) all check-build $MAKE_CHECK_ARGS
 
 cross-armel-system:
   extends: .cross_system_build_job
@@ -69,6 +69,18 @@ cross-arm64-user:
   variables:
     IMAGE: debian-arm64-cross
 
+cross-i386-system:
+  extends: .cross_system_build_job
+  variables:
+    IMAGE: fedora-i386-cross
+    MAKE_CHECK_ARGS: check-qtest
+
+cross-i386-user:
+  extends: .cross_user_build_job
+  variables:
+    IMAGE: fedora-i386-cross
+    MAKE_CHECK_ARGS: check
+
 cross-mips-system:
   extends: .cross_system_build_job
   variables:
diff --git a/tests/docker/dockerfiles/fedora-i386-cross.docker b/tests/docker/dockerfiles/fedora-i386-cross.docker
index cd16cd1bfa..a6e411291b 100644
--- a/tests/docker/dockerfiles/fedora-i386-cross.docker
+++ b/tests/docker/dockerfiles/fedora-i386-cross.docker
@@ -1,14 +1,26 @@
-FROM fedora:30
+FROM fedora:31
 ENV PACKAGES \
+    bzip2 \
+    diffutils \
+    findutils \
     gcc \
+    git \
+    libtasn1-devel.i686 \
+    libzstd-devel.i686 \
+    make \
+    meson \
+    ninja-build \
     glib2-devel.i686 \
     glibc-devel.i686 \
     glibc-static.i686 \
     gnutls-devel.i686 \
     nettle-devel.i686 \
+    perl-Test-Harness \
     pixman-devel.i686 \
-    zlib-devel.i686 \
-    libzstd-devel.i686
+    zlib-devel.i686
+
+ENV QEMU_CONFIGURE_OPTS --extra-cflags=-m32 --disable-vhost-user
+ENV PKG_CONFIG_PATH /usr/lib/pkgconfig
 
 RUN dnf install -y $PACKAGES
 RUN rpm -q $PACKAGES | sort > /packages.txt
-- 
2.29.2




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

* [PULL 09/55] tests/docker: Remove the remainders of debian9 containers from the Makefile
  2020-12-21 14:43 [PULL 00/55] Misc patches for 2020-12-21 Paolo Bonzini
                   ` (7 preceding siblings ...)
  2020-12-21 14:44 ` [PULL 08/55] gitlab-CI: Test 32-bit builds with the fedora-i386-cross container Paolo Bonzini
@ 2020-12-21 14:44 ` Paolo Bonzini
  2020-12-21 14:44 ` [PULL 10/55] tests: update for rename of CentOS8 PowerTools repo Paolo Bonzini
                   ` (46 subsequent siblings)
  55 siblings, 0 replies; 61+ messages in thread
From: Paolo Bonzini @ 2020-12-21 14:44 UTC (permalink / raw)
  To: qemu-devel; +Cc: Thomas Huth, Alex Bennée, Wainer dos Santos Moschetta

From: Thomas Huth <thuth@redhat.com>

The Debian 9 containers have been removed a while ago, so we can
delete the corresponding entries in the Makefile, too.

Fixes: e3755276d1 ("tests/docker: Remove old Debian 9 containers")
Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
Message-Id: <20201215083318.92205-1-thuth@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
 tests/docker/Makefile.include | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/tests/docker/Makefile.include b/tests/docker/Makefile.include
index 02ec92830b..c254ac38d0 100644
--- a/tests/docker/Makefile.include
+++ b/tests/docker/Makefile.include
@@ -11,8 +11,7 @@ HOST_ARCH = $(if $(ARCH),$(ARCH),$(shell uname -m))
 DOCKER_SUFFIX := .docker
 DOCKER_FILES_DIR := $(SRC_PATH)/tests/docker/dockerfiles
 # we don't run tests on intermediate images (used as base by another image)
-DOCKER_PARTIAL_IMAGES := debian9 debian10 debian11
-DOCKER_PARTIAL_IMAGES += debian9-mxe debian-bootstrap
+DOCKER_PARTIAL_IMAGES := debian10 debian11 debian-bootstrap
 DOCKER_IMAGES := $(sort $(notdir $(basename $(wildcard $(DOCKER_FILES_DIR)/*.docker))))
 DOCKER_TARGETS := $(patsubst %,docker-image-%,$(DOCKER_IMAGES))
 # Use a global constant ccache directory to speed up repetitive builds
@@ -96,7 +95,6 @@ docker-binfmt-image-debian-%: $(DOCKER_FILES_DIR)/debian-bootstrap.docker
 endif
 
 # Enforce dependencies for composite images
-docker-image-debian9-mxe: docker-image-debian9
 ifeq ($(HOST_ARCH),x86_64)
 docker-image-debian-amd64: docker-image-debian10
 DOCKER_PARTIAL_IMAGES += debian-amd64-cross
@@ -104,8 +102,6 @@ else
 docker-image-debian-amd64-cross: docker-image-debian10
 DOCKER_PARTIAL_IMAGES += debian-amd64
 endif
-docker-image-debian-win32-cross: docker-image-debian9-mxe
-docker-image-debian-win64-cross: docker-image-debian9-mxe
 
 # For non-x86 hosts not all cross-compilers have been packaged
 ifneq ($(HOST_ARCH),x86_64)
-- 
2.29.2




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

* [PULL 10/55] tests: update for rename of CentOS8 PowerTools repo
  2020-12-21 14:43 [PULL 00/55] Misc patches for 2020-12-21 Paolo Bonzini
                   ` (8 preceding siblings ...)
  2020-12-21 14:44 ` [PULL 09/55] tests/docker: Remove the remainders of debian9 containers from the Makefile Paolo Bonzini
@ 2020-12-21 14:44 ` Paolo Bonzini
  2020-12-21 14:44 ` [PULL 11/55] configure: document --without-default-{features, devices} Paolo Bonzini
                   ` (45 subsequent siblings)
  55 siblings, 0 replies; 61+ messages in thread
From: Paolo Bonzini @ 2020-12-21 14:44 UTC (permalink / raw)
  To: qemu-devel; +Cc: Willian Rampazzo, Alex Bennée, Daniel P. Berrangé

From: Daniel P. Berrangé <berrange@redhat.com>

This was intentionally renamed recently to be all lowercase:

https://bugs.centos.org/view.php?id=17920
https://wiki.centos.org/Manuals/ReleaseNotes/CentOS8.2011#Yum_repo_file_and_repoid_changes

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Willian Rampazzo <willianr@redhat.com>
Message-Id: <20201216141653.213980-1-berrange@redhat.com>
[AJB: bump up FROM to trigger re-build, add diffutils]
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
 tests/docker/dockerfiles/centos8.docker | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tests/docker/dockerfiles/centos8.docker b/tests/docker/dockerfiles/centos8.docker
index 54bc6d54cd..64cb7a6eda 100644
--- a/tests/docker/dockerfiles/centos8.docker
+++ b/tests/docker/dockerfiles/centos8.docker
@@ -1,4 +1,4 @@
-FROM centos:8.1.1911
+FROM centos:8.3.2011
 
 RUN dnf -y update
 ENV PACKAGES \
@@ -6,6 +6,7 @@ ENV PACKAGES \
     bzip2 \
     bzip2-devel \
     dbus-daemon \
+    diffutils \
     gcc \
     gcc-c++ \
     genisoimage \
@@ -31,6 +32,6 @@ ENV PACKAGES \
     zlib-devel
 
 RUN dnf install -y dnf-plugins-core && \
-  dnf config-manager --set-enabled PowerTools && \
+  dnf config-manager --set-enabled powertools && \
   dnf install -y $PACKAGES
 RUN rpm -q $PACKAGES | sort > /packages.txt
-- 
2.29.2




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

* [PULL 11/55] configure: document --without-default-{features, devices}
  2020-12-21 14:43 [PULL 00/55] Misc patches for 2020-12-21 Paolo Bonzini
                   ` (9 preceding siblings ...)
  2020-12-21 14:44 ` [PULL 10/55] tests: update for rename of CentOS8 PowerTools repo Paolo Bonzini
@ 2020-12-21 14:44 ` Paolo Bonzini
  2020-12-21 14:44 ` [PULL 12/55] vl: initialize displays _after_ exiting preconfiguration Paolo Bonzini
                   ` (44 subsequent siblings)
  55 siblings, 0 replies; 61+ messages in thread
From: Paolo Bonzini @ 2020-12-21 14:44 UTC (permalink / raw)
  To: qemu-devel

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

diff --git a/configure b/configure
index a5ee2d2a06..7ec4a11d1f 100755
--- a/configure
+++ b/configure
@@ -1719,6 +1719,10 @@ Advanced options (experts only):
   --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
+                           desired devices in default-configs/devices/)
   --enable-debug           enable common debug build options
   --enable-sanitizers      enable default sanitizers
   --enable-tsan            enable thread sanitizer
-- 
2.29.2




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

* [PULL 12/55] vl: initialize displays _after_ exiting preconfiguration
  2020-12-21 14:43 [PULL 00/55] Misc patches for 2020-12-21 Paolo Bonzini
                   ` (10 preceding siblings ...)
  2020-12-21 14:44 ` [PULL 11/55] configure: document --without-default-{features, devices} Paolo Bonzini
@ 2020-12-21 14:44 ` Paolo Bonzini
  2020-12-21 14:44 ` [PULL 13/55] test-char: Destroy chardev correctly at char_file_test_internal() Paolo Bonzini
                   ` (43 subsequent siblings)
  55 siblings, 0 replies; 61+ messages in thread
From: Paolo Bonzini @ 2020-12-21 14:44 UTC (permalink / raw)
  To: qemu-devel; +Cc: Howard Spoelstra

Due to the renumbering of text consoles when graphical consoles are
created, init_displaystate must be called after all QemuConsoles are
created, i.e. after devices are created.

vl.c calls it from qemu_init_displays, while qmp_x_exit_preconfig is
where devices are created.  If qemu_init_displays is called before it,
the VGA graphical console does not come up.

Reported-by: Howard Spoelstra <hsp.cat7@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 softmmu/vl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/softmmu/vl.c b/softmmu/vl.c
index 0ed5c5ba93..7ddf405d76 100644
--- a/softmmu/vl.c
+++ b/softmmu/vl.c
@@ -3529,10 +3529,10 @@ void qemu_init(int argc, char **argv, char **envp)
         exit(0);
     }
 
-    qemu_init_displays();
     if (!preconfig_requested) {
         qmp_x_exit_preconfig(&error_fatal);
     }
+    qemu_init_displays();
     accel_setup_post(current_machine);
     os_setup_post();
     resume_mux_open();
-- 
2.29.2




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

* [PULL 13/55] test-char: Destroy chardev correctly at char_file_test_internal()
  2020-12-21 14:43 [PULL 00/55] Misc patches for 2020-12-21 Paolo Bonzini
                   ` (11 preceding siblings ...)
  2020-12-21 14:44 ` [PULL 12/55] vl: initialize displays _after_ exiting preconfiguration Paolo Bonzini
@ 2020-12-21 14:44 ` Paolo Bonzini
  2020-12-21 14:44 ` [PULL 14/55] qom: Assert that objects being destroyed have no parent Paolo Bonzini
                   ` (42 subsequent siblings)
  55 siblings, 0 replies; 61+ messages in thread
From: Paolo Bonzini @ 2020-12-21 14:44 UTC (permalink / raw)
  To: qemu-devel; +Cc: Eduardo Habkost

From: Eduardo Habkost <ehabkost@redhat.com>

commit 1e419ee68fa5 ("chardev: generate an internal id when none
given") changed the reference ownership semantics of
qemu_chardev_new(NULL, ...): now all chardevs created using
qemu_chardev_new() are added to the /chardevs QOM container, and
the caller does not own a reference to the newly created object.

However, the code at char_file_test_internal() had not been
updated and was calling object_unref() on a chardev object it
didn't own.  This makes the chardev be destroyed, but leaves a
dangling pointer in the /chardev container children list, and
seems to be the cause of the following char_serial_test() crash:

  Unexpected error in object_property_try_add() at ../qom/object.c:1220: \
      attempt to add duplicate property 'serial-id' to object (type 'container')
  ERROR test-char - too few tests run (expected 38, got 9)

Update the code to use object_unparent() at the end of
char_file_test_internal(), to make sure the chardev will be
correctly removed from the QOM tree.

Fixes: 1e419ee68fa5 ("chardev: generate an internal id when none given")
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <20201215224133.3545901-2-ehabkost@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 tests/test-char.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/test-char.c b/tests/test-char.c
index 953e0d1c1f..06102977b6 100644
--- a/tests/test-char.c
+++ b/tests/test-char.c
@@ -1298,7 +1298,7 @@ static void char_file_test_internal(Chardev *ext_chr, const char *filepath)
     g_assert(strncmp(contents, "hello!", 6) == 0);
 
     if (!ext_chr) {
-        object_unref(OBJECT(chr));
+        object_unparent(OBJECT(chr));
         g_unlink(out);
     }
     g_free(contents);
-- 
2.29.2




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

* [PULL 14/55] qom: Assert that objects being destroyed have no parent
  2020-12-21 14:43 [PULL 00/55] Misc patches for 2020-12-21 Paolo Bonzini
                   ` (12 preceding siblings ...)
  2020-12-21 14:44 ` [PULL 13/55] test-char: Destroy chardev correctly at char_file_test_internal() Paolo Bonzini
@ 2020-12-21 14:44 ` Paolo Bonzini
  2020-12-21 14:44 ` [PULL 15/55] target/i386: Check privilege level for protected mode 'int N' task gate Paolo Bonzini
                   ` (41 subsequent siblings)
  55 siblings, 0 replies; 61+ messages in thread
From: Paolo Bonzini @ 2020-12-21 14:44 UTC (permalink / raw)
  To: qemu-devel; +Cc: Eduardo Habkost

From: Eduardo Habkost <ehabkost@redhat.com>

QOM reference counting bugs are often hard to detect, but there's
one kind of bug that's easier: if we are freeing an object but is
still attached to a parent, it means the reference count is wrong
(because the parent always hold a reference to their children).

Add an assertion to make sure we detect those cases.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <20201215224133.3545901-3-ehabkost@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 qom/object.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/qom/object.c b/qom/object.c
index f2ae6e6b2a..5cfed6d7c6 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -685,6 +685,7 @@ static void object_finalize(void *data)
     object_deinit(obj, ti);
 
     g_assert(obj->ref == 0);
+    g_assert(obj->parent == NULL);
     if (obj->free) {
         obj->free(obj);
     }
-- 
2.29.2




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

* [PULL 15/55] target/i386: Check privilege level for protected mode 'int N' task gate
  2020-12-21 14:43 [PULL 00/55] Misc patches for 2020-12-21 Paolo Bonzini
                   ` (13 preceding siblings ...)
  2020-12-21 14:44 ` [PULL 14/55] qom: Assert that objects being destroyed have no parent Paolo Bonzini
@ 2020-12-21 14:44 ` Paolo Bonzini
  2020-12-21 14:44 ` [PULL 16/55] configure,meson: add option to enable LTO Paolo Bonzini
                   ` (40 subsequent siblings)
  55 siblings, 0 replies; 61+ messages in thread
From: Paolo Bonzini @ 2020-12-21 14:44 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Richard Henderson

From: Peter Maydell <peter.maydell@linaro.org>

When the 'int N' instruction is executed in protected mode, the
pseudocode in the architecture manual specifies that we need to check:

 * vector number within IDT limits
 * selected IDT descriptor is a valid type (interrupt, trap or task gate)
 * if this was a software interrupt then gate DPL < CPL

The way we had structured the code meant that the privilege check for
software interrupts ended up not in the code path taken for task gate
handling, because all of the task gate handling code was in the 'case 5'
of the switch which was checking "is this descriptor a valid type".

Move the task gate handling code out of that switch (so that it is now
purely doing the "valid type?" check) and below the software interrupt
privilege check.

The effect of this missing check was that in a guest userspace binary
executing 'int 8' would cause a guest kernel panic rather than the
userspace binary being handed a SEGV.

This is essentially the same bug fixed in VirtualBox in 2012:
https://www.halfdog.net/Security/2012/VirtualBoxSoftwareInterrupt0x8GuestCrash/

Note that for QEMU this is not a security issue because it is only
present when using TCG.

Fixes: https://bugs.launchpad.net/qemu/+bug/1813201
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20201121224445.16236-1-peter.maydell@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
---
 target/i386/tcg/seg_helper.c | 35 +++++++++++++++++++++--------------
 1 file changed, 21 insertions(+), 14 deletions(-)

diff --git a/target/i386/tcg/seg_helper.c b/target/i386/tcg/seg_helper.c
index 1255efe7e0..5f2ee6aa7e 100644
--- a/target/i386/tcg/seg_helper.c
+++ b/target/i386/tcg/seg_helper.c
@@ -634,6 +634,24 @@ static void do_interrupt_protected(CPUX86State *env, int intno, int is_int,
     type = (e2 >> DESC_TYPE_SHIFT) & 0x1f;
     switch (type) {
     case 5: /* task gate */
+    case 6: /* 286 interrupt gate */
+    case 7: /* 286 trap gate */
+    case 14: /* 386 interrupt gate */
+    case 15: /* 386 trap gate */
+        break;
+    default:
+        raise_exception_err(env, EXCP0D_GPF, intno * 8 + 2);
+        break;
+    }
+    dpl = (e2 >> DESC_DPL_SHIFT) & 3;
+    cpl = env->hflags & HF_CPL_MASK;
+    /* check privilege if software int */
+    if (is_int && dpl < cpl) {
+        raise_exception_err(env, EXCP0D_GPF, intno * 8 + 2);
+    }
+
+    if (type == 5) {
+        /* task gate */
         /* must do that check here to return the correct error code */
         if (!(e2 & DESC_P_MASK)) {
             raise_exception_err(env, EXCP0B_NOSEG, intno * 8 + 2);
@@ -661,21 +679,10 @@ static void do_interrupt_protected(CPUX86State *env, int intno, int is_int,
             SET_ESP(esp, mask);
         }
         return;
-    case 6: /* 286 interrupt gate */
-    case 7: /* 286 trap gate */
-    case 14: /* 386 interrupt gate */
-    case 15: /* 386 trap gate */
-        break;
-    default:
-        raise_exception_err(env, EXCP0D_GPF, intno * 8 + 2);
-        break;
-    }
-    dpl = (e2 >> DESC_DPL_SHIFT) & 3;
-    cpl = env->hflags & HF_CPL_MASK;
-    /* check privilege if software int */
-    if (is_int && dpl < cpl) {
-        raise_exception_err(env, EXCP0D_GPF, intno * 8 + 2);
     }
+
+    /* Otherwise, trap or interrupt gate */
+
     /* check valid bit */
     if (!(e2 & DESC_P_MASK)) {
         raise_exception_err(env, EXCP0B_NOSEG, intno * 8 + 2);
-- 
2.29.2




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

* [PULL 16/55] configure,meson: add option to enable LTO
  2020-12-21 14:43 [PULL 00/55] Misc patches for 2020-12-21 Paolo Bonzini
                   ` (14 preceding siblings ...)
  2020-12-21 14:44 ` [PULL 15/55] target/i386: Check privilege level for protected mode 'int N' task gate Paolo Bonzini
@ 2020-12-21 14:44 ` Paolo Bonzini
  2020-12-21 14:44 ` [PULL 17/55] cfi: Initial support for cfi-icall in QEMU Paolo Bonzini
                   ` (39 subsequent siblings)
  55 siblings, 0 replies; 61+ messages in thread
From: Paolo Bonzini @ 2020-12-21 14:44 UTC (permalink / raw)
  To: qemu-devel; +Cc: Daniele Buono

From: Daniele Buono <dbuono@linux.vnet.ibm.com>

This patch allows to compile QEMU with link-time optimization (LTO).
Compilation with LTO is handled directly by meson. This patch only
adds the option in configure and forwards the request to meson

Tested with all major versions of clang from 6 to 12

Signed-off-by: Daniele Buono <dbuono@linux.vnet.ibm.com>
Message-Id: <20201204230615.2392-2-dbuono@linux.vnet.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 configure   | 7 +++++++
 meson.build | 1 +
 2 files changed, 8 insertions(+)

diff --git a/configure b/configure
index 7ec4a11d1f..55e77bf289 100755
--- a/configure
+++ b/configure
@@ -242,6 +242,7 @@ host_cc="cc"
 audio_win_int=""
 libs_qga=""
 debug_info="yes"
+lto="false"
 stack_protector=""
 safe_stack=""
 use_containers="yes"
@@ -1182,6 +1183,10 @@ 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"
@@ -1779,6 +1784,7 @@ disabled with --disable-FEATURE, default is enabled if available
   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.
   sparse          sparse checker
   safe-stack      SafeStack Stack Smash Protection. Depends on
                   clang/llvm >= 3.7 and requires coroutine backend ucontext.
@@ -6964,6 +6970,7 @@ NINJA=$ninja $meson setup \
         -Db_pie=$(if test "$pie" = yes; then echo true; else echo false; fi) \
         ${staticpic:+-Db_staticpic=$staticpic} \
         -Db_coverage=$(if test "$gcov" = yes; then echo true; else echo false; fi) \
+        -Db_lto=$lto \
         -Dmalloc=$malloc -Dmalloc_trim=$malloc_trim -Dsparse=$sparse \
         -Dkvm=$kvm -Dhax=$hax -Dwhpx=$whpx -Dhvf=$hvf \
         -Dxen=$xen -Dxen_pci_passthrough=$xen_pci_passthrough -Dtcg=$tcg \
diff --git a/meson.build b/meson.build
index 372576f82c..d05d880114 100644
--- a/meson.build
+++ b/meson.build
@@ -2080,6 +2080,7 @@ summary_info += {'gprof enabled':     config_host.has_key('CONFIG_GPROF')}
 summary_info += {'sparse enabled':    sparse.found()}
 summary_info += {'strip binaries':    get_option('strip')}
 summary_info += {'profiler':          config_host.has_key('CONFIG_PROFILER')}
+summary_info += {'link-time optimization (LTO)': get_option('b_lto')}
 summary_info += {'static build':      config_host.has_key('CONFIG_STATIC')}
 if targetos == 'darwin'
   summary_info += {'Cocoa support': config_host.has_key('CONFIG_COCOA')}
-- 
2.29.2




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

* [PULL 17/55] cfi: Initial support for cfi-icall in QEMU
  2020-12-21 14:43 [PULL 00/55] Misc patches for 2020-12-21 Paolo Bonzini
                   ` (15 preceding siblings ...)
  2020-12-21 14:44 ` [PULL 16/55] configure,meson: add option to enable LTO Paolo Bonzini
@ 2020-12-21 14:44 ` Paolo Bonzini
  2020-12-21 14:44 ` [PULL 18/55] check-block: enable iotests with cfi-icall Paolo Bonzini
                   ` (38 subsequent siblings)
  55 siblings, 0 replies; 61+ messages in thread
From: Paolo Bonzini @ 2020-12-21 14:44 UTC (permalink / raw)
  To: qemu-devel; +Cc: Daniele Buono

From: Daniele Buono <dbuono@linux.vnet.ibm.com>

LLVM/Clang, supports runtime checks for forward-edge Control-Flow
Integrity (CFI).

CFI on indirect function calls (cfi-icall) ensures that, in indirect
function calls, the function called is of the right signature for the
pointer type defined at compile time.

For this check to work, the code must always respect the function
signature when using function pointer, the function must be defined
at compile time, and be compiled with link-time optimization.

This rules out, for example, shared libraries that are dynamically loaded
(given that functions are not known at compile time), and code that is
dynamically generated at run-time.

This patch:

1) Introduces the CONFIG_CFI flag to support cfi in QEMU

2) Introduces a decorator to allow the definition of "sensitive"
functions, where a non-instrumented function may be called at runtime
through a pointer. The decorator will take care of disabling cfi-icall
checks on such functions, when cfi is enabled.

3) Marks functions currently in QEMU that exhibit such behavior,
in particular:
- The function in TCG that calls pre-compiled TBs
- The function in TCI that interprets instructions
- Functions in the plugin infrastructures that jump to callbacks
- Functions in util that directly call a signal handler

Signed-off-by: Daniele Buono <dbuono@linux.vnet.ibm.com>
Acked-by: Alex Bennée <alex.bennee@linaro.org
Message-Id: <20201204230615.2392-3-dbuono@linux.vnet.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 accel/tcg/cpu-exec.c    | 11 +++++++++++
 include/qemu/compiler.h | 12 ++++++++++++
 plugins/core.c          | 37 +++++++++++++++++++++++++++++++++++++
 plugins/loader.c        |  7 +++++++
 tcg/tci.c               |  7 +++++++
 util/main-loop.c        | 11 +++++++++++
 util/oslib-posix.c      | 11 +++++++++++
 7 files changed, 96 insertions(+)

diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c
index 8689c54499..fa325bb3d8 100644
--- a/accel/tcg/cpu-exec.c
+++ b/accel/tcg/cpu-exec.c
@@ -26,6 +26,7 @@
 #include "exec/exec-all.h"
 #include "tcg/tcg.h"
 #include "qemu/atomic.h"
+#include "qemu/compiler.h"
 #include "sysemu/qtest.h"
 #include "qemu/timer.h"
 #include "qemu/rcu.h"
@@ -144,6 +145,16 @@ static void init_delay_params(SyncClocks *sc, const CPUState *cpu)
 #endif /* CONFIG USER ONLY */
 
 /* Execute a TB, and fix up the CPU state afterwards if necessary */
+/*
+ * Disable CFI checks.
+ * TCG creates binary blobs at runtime, with the transformed code.
+ * A TB is a blob of binary code, created at runtime and called with an
+ * indirect function call. Since such function did not exist at compile time,
+ * the CFI runtime has no way to verify its signature and would fail.
+ * TCG is not considered a security-sensitive part of QEMU so this does not
+ * affect the impact of CFI in environment with high security requirements
+ */
+QEMU_DISABLE_CFI
 static inline tcg_target_ulong cpu_tb_exec(CPUState *cpu, TranslationBlock *itb)
 {
     CPUArchState *env = cpu->env_ptr;
diff --git a/include/qemu/compiler.h b/include/qemu/compiler.h
index 1b9e58e82b..ad4a02db36 100644
--- a/include/qemu/compiler.h
+++ b/include/qemu/compiler.h
@@ -222,4 +222,16 @@ extern void QEMU_NORETURN QEMU_ERROR("code path is reachable")
 #define qemu_build_not_reached()  g_assert_not_reached()
 #endif
 
+#ifdef CONFIG_CFI
+/*
+ * If CFI is enabled, use an attribute to disable cfi-icall on the following
+ * function
+ */
+#define QEMU_DISABLE_CFI __attribute__((no_sanitize("cfi-icall")))
+#else
+/* If CFI is not enabled, use an empty define to not change the behavior */
+#define QEMU_DISABLE_CFI
+#endif
+
+
 #endif /* COMPILER_H */
diff --git a/plugins/core.c b/plugins/core.c
index 51bfc94787..87b823bbc4 100644
--- a/plugins/core.c
+++ b/plugins/core.c
@@ -31,6 +31,7 @@
 #include "tcg/tcg-op.h"
 #include "trace/mem-internal.h" /* mem_info macros */
 #include "plugin.h"
+#include "qemu/compiler.h"
 
 struct qemu_plugin_cb {
     struct qemu_plugin_ctx *ctx;
@@ -90,6 +91,12 @@ void plugin_unregister_cb__locked(struct qemu_plugin_ctx *ctx,
     }
 }
 
+/*
+ * Disable CFI checks.
+ * The callback function has been loaded from an external library so we do not
+ * have type information
+ */
+QEMU_DISABLE_CFI
 static void plugin_vcpu_cb__simple(CPUState *cpu, enum qemu_plugin_event ev)
 {
     struct qemu_plugin_cb *cb, *next;
@@ -111,6 +118,12 @@ static void plugin_vcpu_cb__simple(CPUState *cpu, enum qemu_plugin_event ev)
     }
 }
 
+/*
+ * Disable CFI checks.
+ * The callback function has been loaded from an external library so we do not
+ * have type information
+ */
+QEMU_DISABLE_CFI
 static void plugin_cb__simple(enum qemu_plugin_event ev)
 {
     struct qemu_plugin_cb *cb, *next;
@@ -128,6 +141,12 @@ static void plugin_cb__simple(enum qemu_plugin_event ev)
     }
 }
 
+/*
+ * Disable CFI checks.
+ * The callback function has been loaded from an external library so we do not
+ * have type information
+ */
+QEMU_DISABLE_CFI
 static void plugin_cb__udata(enum qemu_plugin_event ev)
 {
     struct qemu_plugin_cb *cb, *next;
@@ -325,6 +344,12 @@ void plugin_register_vcpu_mem_cb(GArray **arr,
     dyn_cb->f.generic = cb;
 }
 
+/*
+ * Disable CFI checks.
+ * The callback function has been loaded from an external library so we do not
+ * have type information
+ */
+QEMU_DISABLE_CFI
 void qemu_plugin_tb_trans_cb(CPUState *cpu, struct qemu_plugin_tb *tb)
 {
     struct qemu_plugin_cb *cb, *next;
@@ -339,6 +364,12 @@ void qemu_plugin_tb_trans_cb(CPUState *cpu, struct qemu_plugin_tb *tb)
     }
 }
 
+/*
+ * Disable CFI checks.
+ * The callback function has been loaded from an external library so we do not
+ * have type information
+ */
+QEMU_DISABLE_CFI
 void
 qemu_plugin_vcpu_syscall(CPUState *cpu, int64_t num, uint64_t a1, uint64_t a2,
                          uint64_t a3, uint64_t a4, uint64_t a5,
@@ -358,6 +389,12 @@ qemu_plugin_vcpu_syscall(CPUState *cpu, int64_t num, uint64_t a1, uint64_t a2,
     }
 }
 
+/*
+ * Disable CFI checks.
+ * The callback function has been loaded from an external library so we do not
+ * have type information
+ */
+QEMU_DISABLE_CFI
 void qemu_plugin_vcpu_syscall_ret(CPUState *cpu, int64_t num, int64_t ret)
 {
     struct qemu_plugin_cb *cb, *next;
diff --git a/plugins/loader.c b/plugins/loader.c
index 5cb9794fda..8550e61184 100644
--- a/plugins/loader.c
+++ b/plugins/loader.c
@@ -32,6 +32,7 @@
 #ifndef CONFIG_USER_ONLY
 #include "hw/boards.h"
 #endif
+#include "qemu/compiler.h"
 
 #include "plugin.h"
 
@@ -150,6 +151,12 @@ static uint64_t xorshift64star(uint64_t x)
     return x * UINT64_C(2685821657736338717);
 }
 
+/*
+ * Disable CFI checks.
+ * The install and version functions have been loaded from an external library
+ * so we do not have type information
+ */
+QEMU_DISABLE_CFI
 static int plugin_load(struct qemu_plugin_desc *desc, const qemu_info_t *info, Error **errp)
 {
     qemu_plugin_install_func_t install;
diff --git a/tcg/tci.c b/tcg/tci.c
index 82039fd163..5d97b7c71c 100644
--- a/tcg/tci.c
+++ b/tcg/tci.c
@@ -31,6 +31,7 @@
 #include "tcg/tcg.h"           /* MAX_OPC_PARAM_IARGS */
 #include "exec/cpu_ldst.h"
 #include "tcg/tcg-op.h"
+#include "qemu/compiler.h"
 
 /* Marker for missing code. */
 #define TODO() \
@@ -475,6 +476,12 @@ static bool tci_compare64(uint64_t u0, uint64_t u1, TCGCond condition)
 #endif
 
 /* Interpret pseudo code in tb. */
+/*
+ * Disable CFI checks.
+ * One possible operation in the pseudo code is a call to binary code.
+ * Therefore, disable CFI checks in the interpreter function
+ */
+QEMU_DISABLE_CFI
 uintptr_t tcg_qemu_tb_exec(CPUArchState *env, uint8_t *tb_ptr)
 {
     tcg_target_ulong regs[TCG_TARGET_NB_REGS];
diff --git a/util/main-loop.c b/util/main-loop.c
index 6470f8eae3..6bfc7c46f5 100644
--- a/util/main-loop.c
+++ b/util/main-loop.c
@@ -33,6 +33,7 @@
 #include "block/aio.h"
 #include "qemu/error-report.h"
 #include "qemu/queue.h"
+#include "qemu/compiler.h"
 
 #ifndef _WIN32
 #include <sys/wait.h>
@@ -44,6 +45,16 @@
  * use signalfd to listen for them.  We rely on whatever the current signal
  * handler is to dispatch the signals when we receive them.
  */
+/*
+ * Disable CFI checks.
+ * We are going to call a signal hander directly. Such handler may or may not
+ * have been defined in our binary, so there's no guarantee that the pointer
+ * used to set the handler is a cfi-valid pointer. Since the handlers are
+ * stored in kernel memory, changing the handler to an attacker-defined
+ * function requires being able to call a sigaction() syscall,
+ * which is not as easy as overwriting a pointer in memory.
+ */
+QEMU_DISABLE_CFI
 static void sigfd_handler(void *opaque)
 {
     int fd = (intptr_t)opaque;
diff --git a/util/oslib-posix.c b/util/oslib-posix.c
index f15234b5c0..f1e2801b11 100644
--- a/util/oslib-posix.c
+++ b/util/oslib-posix.c
@@ -39,6 +39,7 @@
 #include "qemu/thread.h"
 #include <libgen.h>
 #include "qemu/cutils.h"
+#include "qemu/compiler.h"
 
 #ifdef CONFIG_LINUX
 #include <sys/syscall.h>
@@ -773,6 +774,16 @@ void qemu_free_stack(void *stack, size_t sz)
     munmap(stack, sz);
 }
 
+/*
+ * Disable CFI checks.
+ * We are going to call a signal hander directly. Such handler may or may not
+ * have been defined in our binary, so there's no guarantee that the pointer
+ * used to set the handler is a cfi-valid pointer. Since the handlers are
+ * stored in kernel memory, changing the handler to an attacker-defined
+ * function requires being able to call a sigaction() syscall,
+ * which is not as easy as overwriting a pointer in memory.
+ */
+QEMU_DISABLE_CFI
 void sigaction_invoke(struct sigaction *action,
                       struct qemu_signalfd_siginfo *info)
 {
-- 
2.29.2




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

* [PULL 18/55] check-block: enable iotests with cfi-icall
  2020-12-21 14:43 [PULL 00/55] Misc patches for 2020-12-21 Paolo Bonzini
                   ` (16 preceding siblings ...)
  2020-12-21 14:44 ` [PULL 17/55] cfi: Initial support for cfi-icall in QEMU Paolo Bonzini
@ 2020-12-21 14:44 ` Paolo Bonzini
  2020-12-21 14:44 ` [PULL 19/55] configure,meson: support Control-Flow Integrity Paolo Bonzini
                   ` (37 subsequent siblings)
  55 siblings, 0 replies; 61+ messages in thread
From: Paolo Bonzini @ 2020-12-21 14:44 UTC (permalink / raw)
  To: qemu-devel; +Cc: Daniele Buono

From: Daniele Buono <dbuono@linux.vnet.ibm.com>

cfi-icall is a form of Control-Flow Integrity for indirect function
calls implemented by llvm. It is enabled with a -fsanitize flag.

iotests are currently disabled when -fsanitize options is used, with the
exception of SafeStack.

This patch implements a generic filtering mechanism to allow iotests
with a set of known-to-be-safe -fsanitize option. Then marks SafeStack
and the new options used for cfi-icall safe for iotests

Signed-off-by: Daniele Buono <dbuono@linux.vnet.ibm.com>
Message-Id: <20201204230615.2392-4-dbuono@linux.vnet.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 tests/check-block.sh | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/tests/check-block.sh b/tests/check-block.sh
index f6b1bda7b9..fb4c1baae9 100755
--- a/tests/check-block.sh
+++ b/tests/check-block.sh
@@ -21,14 +21,18 @@ if grep -q "CONFIG_GPROF=y" config-host.mak 2>/dev/null ; then
     exit 0
 fi
 
-# Disable tests with any sanitizer except for SafeStack
-CFLAGS=$( grep "CFLAGS.*-fsanitize" config-host.mak 2>/dev/null )
-SANITIZE_FLAGS=""
-#Remove all occurrencies of -fsanitize=safe-stack
-for i in ${CFLAGS}; do
-        if [ "${i}" != "-fsanitize=safe-stack" ]; then
-                SANITIZE_FLAGS="${SANITIZE_FLAGS} ${i}"
+# Disable tests with any sanitizer except for specific ones
+SANITIZE_FLAGS=$( grep "CFLAGS.*-fsanitize" config-host.mak 2>/dev/null )
+ALLOWED_SANITIZE_FLAGS="safe-stack cfi-icall"
+#Remove all occurrencies of allowed Sanitize flags
+for j in ${ALLOWED_SANITIZE_FLAGS}; do
+    TMP_FLAGS=${SANITIZE_FLAGS}
+    SANITIZE_FLAGS=""
+    for i in ${TMP_FLAGS}; do
+        if ! echo ${i} | grep -q "${j}" 2>/dev/null; then
+            SANITIZE_FLAGS="${SANITIZE_FLAGS} ${i}"
         fi
+    done
 done
 if echo ${SANITIZE_FLAGS} | grep -q "\-fsanitize" 2>/dev/null; then
     # Have a sanitize flag that is not allowed, stop
-- 
2.29.2




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

* [PULL 19/55] configure,meson: support Control-Flow Integrity
  2020-12-21 14:43 [PULL 00/55] Misc patches for 2020-12-21 Paolo Bonzini
                   ` (17 preceding siblings ...)
  2020-12-21 14:44 ` [PULL 18/55] check-block: enable iotests with cfi-icall Paolo Bonzini
@ 2020-12-21 14:44 ` Paolo Bonzini
  2020-12-21 14:44 ` [PULL 20/55] docs: Add CFI Documentation Paolo Bonzini
                   ` (36 subsequent siblings)
  55 siblings, 0 replies; 61+ messages in thread
From: Paolo Bonzini @ 2020-12-21 14:44 UTC (permalink / raw)
  To: qemu-devel; +Cc: Daniele Buono

From: Daniele Buono <dbuono@linux.vnet.ibm.com>

This patch adds a flag to enable/disable control flow integrity checks
on indirect function calls.
This feature only allows indirect function calls at runtime to functions
with compatible signatures.

This feature is only provided by LLVM/Clang, and depends on link-time
optimization which is currently supported only with LLVM/Clang >= 6.0

We also add an option to enable a debugging version of cfi, with verbose
output in case of a CFI violation.

CFI on indirect function calls does not support calls to functions in
shared libraries (since they were not known at compile time), and such
calls are forbidden. QEMU relies on dlopen/dlsym when using modules,
so we make modules incompatible with CFI.

All the checks are performed in meson.build. configure is only used to
forward the flags to meson

Signed-off-by: Daniele Buono <dbuono@linux.vnet.ibm.com>
Message-Id: <20201204230615.2392-5-dbuono@linux.vnet.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 configure         | 22 ++++++++++++++++++++--
 meson.build       | 44 ++++++++++++++++++++++++++++++++++++++++++++
 meson_options.txt |  4 ++++
 3 files changed, 68 insertions(+), 2 deletions(-)

diff --git a/configure b/configure
index 55e77bf289..f470cdbe50 100755
--- a/configure
+++ b/configure
@@ -411,6 +411,8 @@ coroutine=""
 coroutine_pool="$default_feature"
 debug_stack_usage="no"
 crypto_afalg="no"
+cfi="false"
+cfi_debug="false"
 seccomp="$default_feature"
 glusterfs="$default_feature"
 glusterfs_xlator_opt="no"
@@ -1195,6 +1197,16 @@ for opt do
   ;;
   --disable-safe-stack) safe_stack="no"
   ;;
+  --enable-cfi)
+      cfi="true";
+      lto="true";
+  ;;
+  --disable-cfi) cfi="false"
+  ;;
+  --enable-cfi-debug) cfi_debug="true"
+  ;;
+  --disable-cfi-debug) cfi_debug="false"
+  ;;
   --disable-curses) curses="disabled"
   ;;
   --enable-curses) curses="enabled"
@@ -1788,7 +1800,13 @@ disabled with --disable-FEATURE, default is enabled if available
   sparse          sparse checker
   safe-stack      SafeStack Stack Smash Protection. Depends on
                   clang/llvm >= 3.7 and requires coroutine backend ucontext.
-
+  cfi             Enable Control-Flow Integrity for indirect function calls.
+                  In case of a cfi violation, QEMU is terminated with SIGILL
+                  Depends on lto and is incompatible with modules
+                  Automatically enables Link-Time Optimization (lto)
+  cfi-debug       In case of a cfi violation, a message containing the line that
+                  triggered the error is written to stderr. After the error,
+                  QEMU is still terminated with SIGILL
   gnutls          GNUTLS cryptography support
   nettle          nettle cryptography support
   gcrypt          libgcrypt cryptography support
@@ -6970,7 +6988,7 @@ NINJA=$ninja $meson setup \
         -Db_pie=$(if test "$pie" = yes; then echo true; else echo false; fi) \
         ${staticpic:+-Db_staticpic=$staticpic} \
         -Db_coverage=$(if test "$gcov" = yes; then echo true; else echo false; fi) \
-        -Db_lto=$lto \
+        -Db_lto=$lto -Dcfi=$cfi -Dcfi_debug=$cfi_debug \
         -Dmalloc=$malloc -Dmalloc_trim=$malloc_trim -Dsparse=$sparse \
         -Dkvm=$kvm -Dhax=$hax -Dwhpx=$whpx -Dhvf=$hvf \
         -Dxen=$xen -Dxen_pci_passthrough=$xen_pci_passthrough -Dtcg=$tcg \
diff --git a/meson.build b/meson.build
index d05d880114..94ef023ad1 100644
--- a/meson.build
+++ b/meson.build
@@ -773,6 +773,7 @@ elif get_option('vhost_user_blk_server').disabled() or not have_system
     have_vhost_user_blk_server = false
 endif
 
+
 if get_option('fuse').disabled() and get_option('fuse_lseek').enabled()
   error('Cannot enable fuse-lseek while fuse is disabled')
 endif
@@ -795,6 +796,46 @@ if not get_option('fuse_lseek').disabled()
   endif
 endif
 
+if get_option('cfi')
+  cfi_flags=[]
+  # Check for dependency on LTO
+  if not get_option('b_lto')
+    error('Selected Control-Flow Integrity but LTO is disabled')
+  endif
+  if config_host.has_key('CONFIG_MODULES')
+    error('Selected Control-Flow Integrity is not compatible with modules')
+  endif
+  # Check for cfi flags. CFI requires LTO so we can't use
+  # get_supported_arguments, but need a more complex "compiles" which allows
+  # custom arguments
+  if cc.compiles('int main () { return 0; }', name: '-fsanitize=cfi-icall',
+                 args: ['-flto', '-fsanitize=cfi-icall'] )
+    cfi_flags += '-fsanitize=cfi-icall'
+  else
+    error('-fsanitize=cfi-icall is not supported by the compiler')
+  endif
+  if cc.compiles('int main () { return 0; }',
+                 name: '-fsanitize-cfi-icall-generalize-pointers',
+                 args: ['-flto', '-fsanitize=cfi-icall',
+                        '-fsanitize-cfi-icall-generalize-pointers'] )
+    cfi_flags += '-fsanitize-cfi-icall-generalize-pointers'
+  else
+    error('-fsanitize-cfi-icall-generalize-pointers is not supported by the compiler')
+  endif
+  if get_option('cfi_debug')
+    if cc.compiles('int main () { return 0; }',
+                   name: '-fno-sanitize-trap=cfi-icall',
+                   args: ['-flto', '-fsanitize=cfi-icall',
+                          '-fno-sanitize-trap=cfi-icall'] )
+      cfi_flags += '-fno-sanitize-trap=cfi-icall'
+    else
+      error('-fno-sanitize-trap=cfi-icall is not supported by the compiler')
+    endif
+  endif
+  add_project_arguments(cfi_flags, native: false, language: ['c', 'cpp', 'objc'])
+  add_project_link_arguments(cfi_flags, native: false, language: ['c', 'cpp', 'objc'])
+endif
+
 #################
 # config-host.h #
 #################
@@ -831,6 +872,7 @@ config_host_data.set('CONFIG_MALLOC_TRIM', has_malloc_trim)
 config_host_data.set('CONFIG_STATX', has_statx)
 config_host_data.set('CONFIG_FUSE', fuse.found())
 config_host_data.set('CONFIG_FUSE_LSEEK', fuse_lseek.found())
+config_host_data.set('CONFIG_CFI', get_option('cfi'))
 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])
@@ -2195,6 +2237,8 @@ if targetos == 'windows'
   summary_info += {'QGA MSI support':   config_host.has_key('CONFIG_QGA_MSI')}
 endif
 summary_info += {'seccomp support':   config_host.has_key('CONFIG_SECCOMP')}
+summary_info += {'CFI support':       get_option('cfi')}
+summary_info += {'CFI debug support': get_option('cfi_debug')}
 summary_info += {'coroutine backend': config_host['CONFIG_COROUTINE_BACKEND']}
 summary_info += {'coroutine pool':    config_host['CONFIG_COROUTINE_POOL'] == '1'}
 summary_info += {'debug stack usage': config_host.has_key('CONFIG_DEBUG_STACK_USAGE')}
diff --git a/meson_options.txt b/meson_options.txt
index f8f053b5c8..242e0769fb 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -35,6 +35,10 @@ option('xen_pci_passthrough', type: 'feature', value: 'auto',
        description: 'Xen PCI passthrough support')
 option('tcg', type: 'feature', value: 'auto',
        description: 'TCG support')
+option('cfi', type: 'boolean', value: 'false',
+       description: 'Control-Flow Integrity (CFI)')
+option('cfi_debug', type: 'boolean', value: 'false',
+       description: 'Verbose errors in case of CFI violation')
 
 option('cocoa', type : 'feature', value : 'auto',
        description: 'Cocoa user interface (macOS only)')
-- 
2.29.2




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

* [PULL 20/55] docs: Add CFI Documentation
  2020-12-21 14:43 [PULL 00/55] Misc patches for 2020-12-21 Paolo Bonzini
                   ` (18 preceding siblings ...)
  2020-12-21 14:44 ` [PULL 19/55] configure,meson: support Control-Flow Integrity Paolo Bonzini
@ 2020-12-21 14:44 ` Paolo Bonzini
  2020-12-21 14:44 ` [PULL 21/55] build-sys: fix -static linking of libvhost-user Paolo Bonzini
                   ` (35 subsequent siblings)
  55 siblings, 0 replies; 61+ messages in thread
From: Paolo Bonzini @ 2020-12-21 14:44 UTC (permalink / raw)
  To: qemu-devel; +Cc: Daniele Buono

From: Daniele Buono <dbuono@linux.vnet.ibm.com>

Document how to compile with CFI and how to maintain CFI-safe code

Signed-off-by: Daniele Buono <dbuono@linux.vnet.ibm.com>
Message-Id: <20201204230615.2392-6-dbuono@linux.vnet.ibm.com>
[Make build system section in index.rst and add the new file. - Paolo]
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 docs/devel/control-flow-integrity.rst | 137 ++++++++++++++++++++++++++
 docs/devel/index.rst                  |   5 +-
 2 files changed, 140 insertions(+), 2 deletions(-)
 create mode 100644 docs/devel/control-flow-integrity.rst

diff --git a/docs/devel/control-flow-integrity.rst b/docs/devel/control-flow-integrity.rst
new file mode 100644
index 0000000000..d89d70733d
--- /dev/null
+++ b/docs/devel/control-flow-integrity.rst
@@ -0,0 +1,137 @@
+============================
+Control-Flow Integrity (CFI)
+============================
+
+This document describes the current control-flow integrity (CFI) mechanism in
+QEMU. How it can be enabled, its benefits and deficiencies, and how it affects
+new and existing code in QEMU
+
+Basics
+------
+
+CFI is a hardening technique that focusing on guaranteeing that indirect
+function calls have not been altered by an attacker.
+The type used in QEMU is a forward-edge control-flow integrity that ensures
+function calls performed through function pointers, always call a "compatible"
+function. A compatible function is a function with the same signature of the
+function pointer declared in the source code.
+
+This type of CFI is entirely compiler-based and relies on the compiler knowing
+the signature of every function and every function pointer used in the code.
+As of now, the only compiler that provides support for CFI is Clang.
+
+CFI is best used on production binaries, to protect against unknown attack
+vectors.
+
+In case of a CFI violation (i.e. call to a non-compatible function) QEMU will
+terminate abruptly, to stop the possible attack.
+
+Building with CFI
+-----------------
+
+NOTE: CFI requires the use of link-time optimization. Therefore, when CFI is
+selected, LTO will be automatically enabled.
+
+To build with CFI, the minimum requirement is Clang 6+. If you
+are planning to also enable fuzzing, then Clang 11+ is needed (more on this
+later).
+
+Given the use of LTO, a version of AR that supports LLVM IR is required.
+The easies way of doing this is by selecting the AR provided by LLVM::
+
+ AR=llvm-ar-9 CC=clang-9 CXX=lang++-9 /path/to/configure --enable-cfi
+
+CFI is enabled on every binary produced.
+
+If desired, an additional flag to increase the verbosity of the output in case
+of a CFI violation is offered (``--enable-debug-cfi``).
+
+Using QEMU built with CFI
+-------------------------
+
+A binary with CFI will work exactly like a standard binary. In case of a CFI
+violation, the binary will terminate with an illegal instruction signal.
+
+Incompatible code with CFI
+--------------------------
+
+As mentioned above, CFI is entirely compiler-based and therefore relies on
+compile-time knowledge of the code. This means that, while generally supported
+for most code, some specific use pattern can break CFI compatibility, and
+create false-positives. The two main patterns that can cause issues are:
+
+* Just-in-time compiled code: since such code is created at runtime, the jump
+  to the buffer containing JIT code will fail.
+
+* Libraries loaded dynamically, e.g. with dlopen/dlsym, since the library was
+  not known at compile time.
+
+Current areas of QEMU that are not entirely compatible with CFI are:
+
+1. TCG, since the idea of TCG is to pre-compile groups of instructions at
+   runtime to speed-up interpretation, quite similarly to a JIT compiler
+
+2. TCI, where the interpreter has to interpret the generic *call* operation
+
+3. Plugins, since a plugin is implemented as an external library
+
+4. Modules, since they are implemented as an external library
+
+5. Directly calling signal handlers from the QEMU source code, since the
+   signal handler may have been provided by an external library or even plugged
+   at runtime.
+
+Disabling CFI for a specific function
+-------------------------------------
+
+If you are working on function that is performing a call using an
+incompatible way, as described before, you can selectively disable CFI checks
+for such function by using the decorator ``QEMU_DISABLE_CFI`` at function
+definition, and add an explanation on why the function is not compatible
+with CFI. An example of the use of ``QEMU_DISABLE_CFI`` is provided here::
+
+	/*
+	 * Disable CFI checks.
+	 * TCG creates binary blobs at runtime, with the transformed code.
+	 * A TB is a blob of binary code, created at runtime and called with an
+	 * indirect function call. Since such function did not exist at compile time,
+	 * the CFI runtime has no way to verify its signature and would fail.
+	 * TCG is not considered a security-sensitive part of QEMU so this does not
+	 * affect the impact of CFI in environment with high security requirements
+	 */
+	QEMU_DISABLE_CFI
+	static inline tcg_target_ulong cpu_tb_exec(CPUState *cpu, TranslationBlock *itb)
+
+NOTE: CFI needs to be disabled at the **caller** function, (i.e. a compatible
+cfi function that calls a non-compatible one), since the check is performed
+when the function call is performed.
+
+CFI and fuzzing
+---------------
+
+There is generally no advantage of using CFI and fuzzing together, because
+they target different environments (production for CFI, debug for fuzzing).
+
+CFI could be used in conjunction with fuzzing to identify a broader set of
+bugs that may not end immediately in a segmentation fault or triggering
+an assertion. However, other sanitizers such as address and ub sanitizers
+can identify such bugs in a more precise way than CFI.
+
+There is, however, an interesting use case in using CFI in conjunction with
+fuzzing, that is to make sure that CFI is not triggering any false positive
+in remote-but-possible parts of the code.
+
+CFI can be enabled with fuzzing, but with some caveats:
+1. Fuzzing relies on the linker performing function wrapping at link-time.
+The standard BFD linker does not support function wrapping when LTO is
+also enabled. The workaround is to use LLVM's lld linker.
+2. Fuzzing also relies on a custom linker script, which is only supported by
+lld with version 11+.
+
+In other words, to compile with fuzzing and CFI, clang 11+ is required, and
+lld needs to be used as a linker::
+
+ AR=llvm-ar-11 CC=clang-11 CXX=lang++-11 /path/to/configure --enable-cfi \
+                           -enable-fuzzing --extra-ldflags="-fuse-ld=lld"
+
+and then, compile the fuzzers as usual.
diff --git a/docs/devel/index.rst b/docs/devel/index.rst
index f10ed77e4c..ea0e1e17ae 100644
--- a/docs/devel/index.rst
+++ b/docs/devel/index.rst
@@ -15,14 +15,15 @@ Contents:
 
    build-system
    kconfig
+   testing
+   fuzzing
+   control-flow-integrity
    loads-stores
    memory
    migration
    atomics
    stable-process
-   testing
    qtest
-   fuzzing
    decodetree
    secure-coding-practices
    tcg
-- 
2.29.2




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

* [PULL 21/55] build-sys: fix -static linking of libvhost-user
  2020-12-21 14:43 [PULL 00/55] Misc patches for 2020-12-21 Paolo Bonzini
                   ` (19 preceding siblings ...)
  2020-12-21 14:44 ` [PULL 20/55] docs: Add CFI Documentation Paolo Bonzini
@ 2020-12-21 14:44 ` Paolo Bonzini
  2020-12-21 14:44 ` [PULL 22/55] remove TCG includes from common code Paolo Bonzini
                   ` (34 subsequent siblings)
  55 siblings, 0 replies; 61+ messages in thread
From: Paolo Bonzini @ 2020-12-21 14:44 UTC (permalink / raw)
  To: qemu-devel; +Cc: Marc-André Lureau, Peter Maydell

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

Fix linking vhost-user binaries with with ./configure -static, by
overriding glib-2.0 dependency with configure results.

Fixes: 0df750e9d3a5fea5e1 ("libvhost-user: make it a meson subproject")
Reported-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20201215080319.136228-1-marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 meson.build | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/meson.build b/meson.build
index 94ef023ad1..ada35d56e1 100644
--- a/meson.build
+++ b/meson.build
@@ -268,7 +268,11 @@ endif
 # grandfathered in from the QEMU Makefiles.
 add_project_arguments(config_host['GLIB_CFLAGS'].split(),
                       native: false, language: ['c', 'cpp', 'objc'])
-glib = declare_dependency(link_args: config_host['GLIB_LIBS'].split())
+glib = declare_dependency(compile_args: config_host['GLIB_CFLAGS'].split(),
+                          link_args: config_host['GLIB_LIBS'].split())
+# override glib dep with the configure results (for subprojects)
+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(),
-- 
2.29.2




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

* [PULL 22/55] remove TCG includes from common code
  2020-12-21 14:43 [PULL 00/55] Misc patches for 2020-12-21 Paolo Bonzini
                   ` (20 preceding siblings ...)
  2020-12-21 14:44 ` [PULL 21/55] build-sys: fix -static linking of libvhost-user Paolo Bonzini
@ 2020-12-21 14:44 ` Paolo Bonzini
  2020-12-21 14:44 ` [PULL 23/55] util: Extract flush_icache_range to cacheflush.c Paolo Bonzini
                   ` (33 subsequent siblings)
  55 siblings, 0 replies; 61+ messages in thread
From: Paolo Bonzini @ 2020-12-21 14:44 UTC (permalink / raw)
  To: qemu-devel

Enable removing tcg/$tcg_arch from the include path when TCG is disabled.
Move translate-all.h to include/exec, since stubs exist for the functions
defined therein.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 accel/stubs/tcg-stub.c                      | 1 -
 accel/tcg/cputlb.c                          | 2 +-
 accel/tcg/translate-all.c                   | 2 +-
 accel/tcg/user-exec.c                       | 2 +-
 cpu.c                                       | 2 +-
 hw/i386/kvmvapic.c                          | 1 -
 {accel/tcg => include/exec}/translate-all.h | 0
 monitor/misc.c                              | 1 -
 softmmu/physmem.c                           | 3 +--
 9 files changed, 5 insertions(+), 9 deletions(-)
 rename {accel/tcg => include/exec}/translate-all.h (100%)

diff --git a/accel/stubs/tcg-stub.c b/accel/stubs/tcg-stub.c
index e4bbf997aa..8c18d3eabd 100644
--- a/accel/stubs/tcg-stub.c
+++ b/accel/stubs/tcg-stub.c
@@ -12,7 +12,6 @@
 
 #include "qemu/osdep.h"
 #include "cpu.h"
-#include "tcg/tcg.h"
 #include "exec/exec-all.h"
 
 void tb_flush(CPUState *cpu)
diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c
index 42ab79c1a5..ced3dc077e 100644
--- a/accel/tcg/cputlb.c
+++ b/accel/tcg/cputlb.c
@@ -33,7 +33,7 @@
 #include "exec/helper-proto.h"
 #include "qemu/atomic.h"
 #include "qemu/atomic128.h"
-#include "translate-all.h"
+#include "exec/translate-all.h"
 #include "trace/trace-root.h"
 #include "trace/mem.h"
 #ifdef CONFIG_PLUGIN
diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c
index b7d50a73d4..a1803a1026 100644
--- a/accel/tcg/translate-all.c
+++ b/accel/tcg/translate-all.c
@@ -49,7 +49,7 @@
 
 #include "exec/cputlb.h"
 #include "exec/tb-hash.h"
-#include "translate-all.h"
+#include "exec/translate-all.h"
 #include "qemu/bitmap.h"
 #include "qemu/error-report.h"
 #include "qemu/qemu-print.h"
diff --git a/accel/tcg/user-exec.c b/accel/tcg/user-exec.c
index 4ebe25461a..abb9555201 100644
--- a/accel/tcg/user-exec.c
+++ b/accel/tcg/user-exec.c
@@ -23,7 +23,7 @@
 #include "tcg/tcg.h"
 #include "qemu/bitops.h"
 #include "exec/cpu_ldst.h"
-#include "translate-all.h"
+#include "exec/translate-all.h"
 #include "exec/helper-proto.h"
 #include "qemu/atomic128.h"
 #include "trace/trace-root.h"
diff --git a/cpu.c b/cpu.c
index 0c485cdf2d..0b245cda2e 100644
--- a/cpu.c
+++ b/cpu.c
@@ -34,7 +34,7 @@
 #include "sysemu/tcg.h"
 #include "sysemu/kvm.h"
 #include "sysemu/replay.h"
-#include "translate-all.h"
+#include "exec/translate-all.h"
 #include "exec/log.h"
 
 uintptr_t qemu_host_page_size;
diff --git a/hw/i386/kvmvapic.c b/hw/i386/kvmvapic.c
index 077c3f4866..2c1898032e 100644
--- a/hw/i386/kvmvapic.c
+++ b/hw/i386/kvmvapic.c
@@ -21,7 +21,6 @@
 #include "hw/sysbus.h"
 #include "hw/boards.h"
 #include "migration/vmstate.h"
-#include "tcg/tcg.h"
 #include "qom/object.h"
 
 #define VAPIC_IO_PORT           0x7e
diff --git a/accel/tcg/translate-all.h b/include/exec/translate-all.h
similarity index 100%
rename from accel/tcg/translate-all.h
rename to include/exec/translate-all.h
diff --git a/monitor/misc.c b/monitor/misc.c
index fde6e36a0b..9a132f73d1 100644
--- a/monitor/misc.c
+++ b/monitor/misc.c
@@ -77,7 +77,6 @@
 #include "qapi/qmp-event.h"
 #include "sysemu/cpus.h"
 #include "qemu/cutils.h"
-#include "tcg/tcg.h"
 
 #if defined(TARGET_S390X)
 #include "hw/s390x/storage-keys.h"
diff --git a/softmmu/physmem.c b/softmmu/physmem.c
index 2cd1de4a2c..67b53d39e4 100644
--- a/softmmu/physmem.c
+++ b/softmmu/physmem.c
@@ -25,7 +25,6 @@
 #include "cpu.h"
 #include "exec/exec-all.h"
 #include "exec/target_page.h"
-#include "tcg/tcg.h"
 #include "hw/qdev-core.h"
 #include "hw/qdev-properties.h"
 #include "hw/boards.h"
@@ -53,7 +52,7 @@
 
 #include "qemu/rcu_queue.h"
 #include "qemu/main-loop.h"
-#include "translate-all.h"
+#include "exec/translate-all.h"
 #include "sysemu/replay.h"
 
 #include "exec/memory-internal.h"
-- 
2.29.2




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

* [PULL 23/55] util: Extract flush_icache_range to cacheflush.c
  2020-12-21 14:43 [PULL 00/55] Misc patches for 2020-12-21 Paolo Bonzini
                   ` (21 preceding siblings ...)
  2020-12-21 14:44 ` [PULL 22/55] remove TCG includes from common code Paolo Bonzini
@ 2020-12-21 14:44 ` Paolo Bonzini
  2020-12-21 14:44 ` [PULL 24/55] trace: do not include TCG helper tracepoints in no-TCG builds Paolo Bonzini
                   ` (32 subsequent siblings)
  55 siblings, 0 replies; 61+ messages in thread
From: Paolo Bonzini @ 2020-12-21 14:44 UTC (permalink / raw)
  To: qemu-devel
  Cc: Richard Henderson, Joelle van Dyne, Philippe Mathieu-Daudé

From: Richard Henderson <richard.henderson@linaro.org>

This has been a tcg-specific function, but is also in use
by hardware accelerators via physmem.c.  This can cause
link errors when tcg is disabled.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Joelle van Dyne <j@getutm.app>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20201214140314.18544-3-richard.henderson@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 MAINTAINERS               |  2 ++
 include/qemu/cacheflush.h | 24 +++++++++++++
 softmmu/physmem.c         |  1 +
 tcg/aarch64/tcg-target.h  |  5 ---
 tcg/arm/tcg-target.h      |  5 ---
 tcg/i386/tcg-target.h     |  4 ---
 tcg/mips/tcg-target.h     | 11 ------
 tcg/ppc/tcg-target.c.inc  | 22 ------------
 tcg/ppc/tcg-target.h      |  1 -
 tcg/riscv/tcg-target.h    |  5 ---
 tcg/s390/tcg-target.h     |  4 ---
 tcg/sparc/tcg-target.h    |  8 -----
 tcg/tcg.c                 |  1 +
 tcg/tci/tcg-target.h      |  4 ---
 util/cacheflush.c         | 71 +++++++++++++++++++++++++++++++++++++++
 util/meson.build          |  2 +-
 16 files changed, 100 insertions(+), 70 deletions(-)
 create mode 100644 include/qemu/cacheflush.h
 create mode 100644 util/cacheflush.c

diff --git a/MAINTAINERS b/MAINTAINERS
index 1e7c8f0488..d7ff660c1e 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -119,6 +119,8 @@ F: softmmu/cpus.c
 F: cpus-common.c
 F: accel/tcg/
 F: accel/stubs/tcg-stub.c
+F: util/cacheinfo.c
+F: util/cacheflush.c
 F: scripts/decodetree.py
 F: docs/devel/decodetree.rst
 F: include/exec/cpu*.h
diff --git a/include/qemu/cacheflush.h b/include/qemu/cacheflush.h
new file mode 100644
index 0000000000..58ae488491
--- /dev/null
+++ b/include/qemu/cacheflush.h
@@ -0,0 +1,24 @@
+/*
+ * Flush the host cpu caches.
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#ifndef QEMU_CACHEFLUSH_H
+#define QEMU_CACHEFLUSH_H
+
+#if defined(__i386__) || defined(__x86_64__) || defined(__s390__)
+
+static inline void flush_icache_range(uintptr_t start, uintptr_t stop)
+{
+    /* icache is coherent and does not require flushing. */
+}
+
+#else
+
+void flush_icache_range(uintptr_t start, uintptr_t stop);
+
+#endif
+
+#endif /* QEMU_CACHEFLUSH_H */
diff --git a/softmmu/physmem.c b/softmmu/physmem.c
index 67b53d39e4..8b9ffc41c2 100644
--- a/softmmu/physmem.c
+++ b/softmmu/physmem.c
@@ -22,6 +22,7 @@
 #include "qapi/error.h"
 
 #include "qemu/cutils.h"
+#include "qemu/cacheflush.h"
 #include "cpu.h"
 #include "exec/exec-all.h"
 #include "exec/target_page.h"
diff --git a/tcg/aarch64/tcg-target.h b/tcg/aarch64/tcg-target.h
index 663dd0b95e..8a6b97598e 100644
--- a/tcg/aarch64/tcg-target.h
+++ b/tcg/aarch64/tcg-target.h
@@ -148,11 +148,6 @@ typedef enum {
 #define TCG_TARGET_DEFAULT_MO (0)
 #define TCG_TARGET_HAS_MEMORY_BSWAP     1
 
-static inline void flush_icache_range(uintptr_t start, uintptr_t stop)
-{
-    __builtin___clear_cache((char *)start, (char *)stop);
-}
-
 void tb_target_set_jmp_target(uintptr_t, uintptr_t, uintptr_t);
 
 #ifdef CONFIG_SOFTMMU
diff --git a/tcg/arm/tcg-target.h b/tcg/arm/tcg-target.h
index 17e771374d..f1955ce4ac 100644
--- a/tcg/arm/tcg-target.h
+++ b/tcg/arm/tcg-target.h
@@ -134,11 +134,6 @@ enum {
 #define TCG_TARGET_DEFAULT_MO (0)
 #define TCG_TARGET_HAS_MEMORY_BSWAP     1
 
-static inline void flush_icache_range(uintptr_t start, uintptr_t stop)
-{
-    __builtin___clear_cache((char *) start, (char *) stop);
-}
-
 /* not defined -- call should be eliminated at compile time */
 void tb_target_set_jmp_target(uintptr_t, uintptr_t, uintptr_t);
 
diff --git a/tcg/i386/tcg-target.h b/tcg/i386/tcg-target.h
index abd4ac7fc0..cd067e0b30 100644
--- a/tcg/i386/tcg-target.h
+++ b/tcg/i386/tcg-target.h
@@ -206,10 +206,6 @@ extern bool have_avx2;
 #define TCG_TARGET_extract_i64_valid(ofs, len) \
     (((ofs) == 8 && (len) == 8) || ((ofs) + (len)) == 32)
 
-static inline void flush_icache_range(uintptr_t start, uintptr_t stop)
-{
-}
-
 static inline void tb_target_set_jmp_target(uintptr_t tc_ptr,
                                             uintptr_t jmp_addr, uintptr_t addr)
 {
diff --git a/tcg/mips/tcg-target.h b/tcg/mips/tcg-target.h
index c6b091d849..92c1d63da3 100644
--- a/tcg/mips/tcg-target.h
+++ b/tcg/mips/tcg-target.h
@@ -198,20 +198,9 @@ extern bool use_mips32r2_instructions;
 #define TCG_TARGET_HAS_ext16u_i64       0 /* andi rt, rs, 0xffff */
 #endif
 
-#ifdef __OpenBSD__
-#include <machine/sysarch.h>
-#else
-#include <sys/cachectl.h>
-#endif
-
 #define TCG_TARGET_DEFAULT_MO (0)
 #define TCG_TARGET_HAS_MEMORY_BSWAP     1
 
-static inline void flush_icache_range(uintptr_t start, uintptr_t stop)
-{
-    cacheflush ((void *)start, stop-start, ICACHE);
-}
-
 void tb_target_set_jmp_target(uintptr_t, uintptr_t, uintptr_t);
 
 #ifdef CONFIG_SOFTMMU
diff --git a/tcg/ppc/tcg-target.c.inc b/tcg/ppc/tcg-target.c.inc
index 18ee989f95..0d068ec8ab 100644
--- a/tcg/ppc/tcg-target.c.inc
+++ b/tcg/ppc/tcg-target.c.inc
@@ -3863,25 +3863,3 @@ void tcg_register_jit(void *buf, size_t buf_size)
     tcg_register_jit_int(buf, buf_size, &debug_frame, sizeof(debug_frame));
 }
 #endif /* __ELF__ */
-
-void flush_icache_range(uintptr_t start, uintptr_t stop)
-{
-    uintptr_t p, start1, stop1;
-    size_t dsize = qemu_dcache_linesize;
-    size_t isize = qemu_icache_linesize;
-
-    start1 = start & ~(dsize - 1);
-    stop1 = (stop + dsize - 1) & ~(dsize - 1);
-    for (p = start1; p < stop1; p += dsize) {
-        asm volatile ("dcbst 0,%0" : : "r"(p) : "memory");
-    }
-    asm volatile ("sync" : : : "memory");
-
-    start &= start & ~(isize - 1);
-    stop1 = (stop + isize - 1) & ~(isize - 1);
-    for (p = start1; p < stop1; p += isize) {
-        asm volatile ("icbi 0,%0" : : "r"(p) : "memory");
-    }
-    asm volatile ("sync" : : : "memory");
-    asm volatile ("isync" : : : "memory");
-}
diff --git a/tcg/ppc/tcg-target.h b/tcg/ppc/tcg-target.h
index be10363956..a509a19628 100644
--- a/tcg/ppc/tcg-target.h
+++ b/tcg/ppc/tcg-target.h
@@ -175,7 +175,6 @@ extern bool have_vsx;
 #define TCG_TARGET_HAS_bitsel_vec       have_vsx
 #define TCG_TARGET_HAS_cmpsel_vec       0
 
-void flush_icache_range(uintptr_t start, uintptr_t stop);
 void tb_target_set_jmp_target(uintptr_t, uintptr_t, uintptr_t);
 
 #define TCG_TARGET_DEFAULT_MO (0)
diff --git a/tcg/riscv/tcg-target.h b/tcg/riscv/tcg-target.h
index 032439d806..c1bd52bb9a 100644
--- a/tcg/riscv/tcg-target.h
+++ b/tcg/riscv/tcg-target.h
@@ -159,11 +159,6 @@ typedef enum {
 #define TCG_TARGET_HAS_mulsh_i64        1
 #endif
 
-static inline void flush_icache_range(uintptr_t start, uintptr_t stop)
-{
-    __builtin___clear_cache((char *)start, (char *)stop);
-}
-
 /* not defined -- call should be eliminated at compile time */
 void tb_target_set_jmp_target(uintptr_t, uintptr_t, uintptr_t);
 
diff --git a/tcg/s390/tcg-target.h b/tcg/s390/tcg-target.h
index 63c8797bd3..b4feb2f55a 100644
--- a/tcg/s390/tcg-target.h
+++ b/tcg/s390/tcg-target.h
@@ -145,10 +145,6 @@ enum {
     TCG_AREG0 = TCG_REG_R10,
 };
 
-static inline void flush_icache_range(uintptr_t start, uintptr_t stop)
-{
-}
-
 static inline void tb_target_set_jmp_target(uintptr_t tc_ptr,
                                             uintptr_t jmp_addr, uintptr_t addr)
 {
diff --git a/tcg/sparc/tcg-target.h b/tcg/sparc/tcg-target.h
index 633841ebf2..d8b0e32e2e 100644
--- a/tcg/sparc/tcg-target.h
+++ b/tcg/sparc/tcg-target.h
@@ -168,14 +168,6 @@ extern bool use_vis3_instructions;
 #define TCG_TARGET_DEFAULT_MO (0)
 #define TCG_TARGET_HAS_MEMORY_BSWAP     1
 
-static inline void flush_icache_range(uintptr_t start, uintptr_t stop)
-{
-    uintptr_t p;
-    for (p = start & -8; p < ((stop + 7) & -8); p += 8) {
-        __asm__ __volatile__("flush\t%0" : : "r" (p));
-    }
-}
-
 void tb_target_set_jmp_target(uintptr_t, uintptr_t, uintptr_t);
 
 #define TCG_TARGET_NEED_POOL_LABELS
diff --git a/tcg/tcg.c b/tcg/tcg.c
index 43c6cf8f52..ebb9466ffc 100644
--- a/tcg/tcg.c
+++ b/tcg/tcg.c
@@ -35,6 +35,7 @@
 #include "qemu/host-utils.h"
 #include "qemu/qemu-print.h"
 #include "qemu/timer.h"
+#include "qemu/cacheflush.h"
 
 /* Note: the long term plan is to reduce the dependencies on the QEMU
    CPU definitions. Currently they are used for qemu_ld/st
diff --git a/tcg/tci/tcg-target.h b/tcg/tci/tcg-target.h
index 8c1c1d265d..b84480f989 100644
--- a/tcg/tci/tcg-target.h
+++ b/tcg/tci/tcg-target.h
@@ -191,10 +191,6 @@ void tci_disas(uint8_t opc);
 
 #define HAVE_TCG_QEMU_TB_EXEC
 
-static inline void flush_icache_range(uintptr_t start, uintptr_t stop)
-{
-}
-
 /* We could notice __i386__ or __s390x__ and reduce the barriers depending
    on the host.  But if you want performance, you use the normal backend.
    We prefer consistency across hosts on this.  */
diff --git a/util/cacheflush.c b/util/cacheflush.c
new file mode 100644
index 0000000000..2881832a38
--- /dev/null
+++ b/util/cacheflush.c
@@ -0,0 +1,71 @@
+/*
+ * Flush the host cpu caches.
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#include "qemu/osdep.h"
+#include "qemu/cacheflush.h"
+
+
+#if defined(__i386__) || defined(__x86_64__) || defined(__s390__)
+
+/* Caches are coherent and do not require flushing; symbol inline. */
+
+#elif defined(__mips__)
+
+#ifdef __OpenBSD__
+#include <machine/sysarch.h>
+#else
+#include <sys/cachectl.h>
+#endif
+
+void flush_icache_range(uintptr_t start, uintptr_t stop)
+{
+    cacheflush((void *)start, stop - start, ICACHE);
+}
+
+#elif defined(__powerpc__)
+
+void flush_icache_range(uintptr_t start, uintptr_t stop)
+{
+    uintptr_t p, start1, stop1;
+    size_t dsize = qemu_dcache_linesize;
+    size_t isize = qemu_icache_linesize;
+
+    start1 = start & ~(dsize - 1);
+    stop1 = (stop + dsize - 1) & ~(dsize - 1);
+    for (p = start1; p < stop1; p += dsize) {
+        asm volatile ("dcbst 0,%0" : : "r"(p) : "memory");
+    }
+    asm volatile ("sync" : : : "memory");
+
+    start &= start & ~(isize - 1);
+    stop1 = (stop + isize - 1) & ~(isize - 1);
+    for (p = start1; p < stop1; p += isize) {
+        asm volatile ("icbi 0,%0" : : "r"(p) : "memory");
+    }
+    asm volatile ("sync" : : : "memory");
+    asm volatile ("isync" : : : "memory");
+}
+
+#elif defined(__sparc__)
+
+void flush_icache_range(uintptr_t start, uintptr_t stop)
+{
+    uintptr_t p;
+
+    for (p = start & -8; p < ((stop + 7) & -8); p += 8) {
+        __asm__ __volatile__("flush\t%0" : : "r" (p));
+    }
+}
+
+#else
+
+void flush_icache_range(uintptr_t start, uintptr_t stop)
+{
+    __builtin___clear_cache((char *)start, (char *)stop);
+}
+
+#endif
diff --git a/util/meson.build b/util/meson.build
index f359af0d46..a3dfc0f966 100644
--- a/util/meson.build
+++ b/util/meson.build
@@ -21,7 +21,7 @@ util_ss.add(files('envlist.c', 'path.c', 'module.c'))
 util_ss.add(files('host-utils.c'))
 util_ss.add(files('bitmap.c', 'bitops.c'))
 util_ss.add(files('fifo8.c'))
-util_ss.add(files('cacheinfo.c'))
+util_ss.add(files('cacheinfo.c', 'cacheflush.c'))
 util_ss.add(files('error.c', 'qemu-error.c'))
 util_ss.add(files('qemu-print.c'))
 util_ss.add(files('id.c'))
-- 
2.29.2




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

* [PULL 24/55] trace: do not include TCG helper tracepoints in no-TCG builds
  2020-12-21 14:43 [PULL 00/55] Misc patches for 2020-12-21 Paolo Bonzini
                   ` (22 preceding siblings ...)
  2020-12-21 14:44 ` [PULL 23/55] util: Extract flush_icache_range to cacheflush.c Paolo Bonzini
@ 2020-12-21 14:44 ` Paolo Bonzini
  2020-12-21 14:44 ` [PULL 25/55] Makefile: add dummy target for build.ninja dependencies Paolo Bonzini
                   ` (31 subsequent siblings)
  55 siblings, 0 replies; 61+ messages in thread
From: Paolo Bonzini @ 2020-12-21 14:44 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 trace/meson.build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/trace/meson.build b/trace/meson.build
index 843ea14495..b19309b327 100644
--- a/trace/meson.build
+++ b/trace/meson.build
@@ -71,7 +71,7 @@ foreach d : [
                 input: meson.source_root() / 'trace-events',
                 command: [ tracetool, '--group=root', '--format=@0@'.format(d[1]), '@INPUT@' ],
                 capture: true)
-  specific_ss.add(gen)
+  specific_ss.add(when: 'CONFIG_TCG', if_true: gen)
 endforeach
 
 if 'CONFIG_TRACE_UST' in config_host
-- 
2.29.2




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

* [PULL 25/55] Makefile: add dummy target for build.ninja dependencies
  2020-12-21 14:43 [PULL 00/55] Misc patches for 2020-12-21 Paolo Bonzini
                   ` (23 preceding siblings ...)
  2020-12-21 14:44 ` [PULL 24/55] trace: do not include TCG helper tracepoints in no-TCG builds Paolo Bonzini
@ 2020-12-21 14:44 ` Paolo Bonzini
  2020-12-21 14:44 ` [PULL 26/55] meson: update submodule to 0.56.0 Paolo Bonzini
                   ` (30 subsequent siblings)
  55 siblings, 0 replies; 61+ messages in thread
From: Paolo Bonzini @ 2020-12-21 14:44 UTC (permalink / raw)
  To: qemu-devel

The dummy targets ensure that incremental build can be done after
deleting a meson.build file.

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

diff --git a/Makefile b/Makefile
index 76dbb917f5..fb9923ff22 100644
--- a/Makefile
+++ b/Makefile
@@ -133,6 +133,7 @@ Makefile.ninja: build.ninja
 
 # A separate rule is needed for Makefile dependencies to avoid -n
 build.ninja: build.ninja.stamp
+$(build-files):
 build.ninja.stamp: meson.stamp $(build-files)
 	$(NINJA) $(if $V,-v,) build.ninja && touch $@
 endif
-- 
2.29.2




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

* [PULL 26/55] meson: update submodule to 0.56.0
  2020-12-21 14:43 [PULL 00/55] Misc patches for 2020-12-21 Paolo Bonzini
                   ` (24 preceding siblings ...)
  2020-12-21 14:44 ` [PULL 25/55] Makefile: add dummy target for build.ninja dependencies Paolo Bonzini
@ 2020-12-21 14:44 ` Paolo Bonzini
  2020-12-21 14:44 ` [PULL 27/55] meson: switch minimum meson version " Paolo Bonzini
                   ` (29 subsequent siblings)
  55 siblings, 0 replies; 61+ messages in thread
From: Paolo Bonzini @ 2020-12-21 14:44 UTC (permalink / raw)
  To: qemu-devel; +Cc: Marc-André Lureau

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 configure | 2 +-
 meson     | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/configure b/configure
index f470cdbe50..0a6de3b8ef 100755
--- a/configure
+++ b/configure
@@ -1936,7 +1936,7 @@ python_version=$($python -c 'import sys; print("%d.%d.%d" % (sys.version_info[0]
 python="$python -B"
 
 if test -z "$meson"; then
-    if test "$explicit_python" = no && has meson && version_ge "$(meson --version)" 0.55.3; then
+    if test "$explicit_python" = no && has meson && version_ge "$(meson --version)" 0.56.0; then
         meson=meson
     elif test -e "${source_path}/.git" && test $git_update = 'yes' ; then
         meson=git
diff --git a/meson b/meson
index 776acd2a80..f16d31607e 160000
--- a/meson
+++ b/meson
@@ -1 +1 @@
-Subproject commit 776acd2a805c9b42b4f0375150977df42130317f
+Subproject commit f16d31607eb3cd0f281758bd0944e206ef6be387
-- 
2.29.2




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

* [PULL 27/55] meson: switch minimum meson version to 0.56.0
  2020-12-21 14:43 [PULL 00/55] Misc patches for 2020-12-21 Paolo Bonzini
                   ` (25 preceding siblings ...)
  2020-12-21 14:44 ` [PULL 26/55] meson: update submodule to 0.56.0 Paolo Bonzini
@ 2020-12-21 14:44 ` Paolo Bonzini
  2020-12-21 14:44 ` [PULL 28/55] meson: fix detection of curses with pkgconfig Paolo Bonzini
                   ` (28 subsequent siblings)
  55 siblings, 0 replies; 61+ messages in thread
From: Paolo Bonzini @ 2020-12-21 14:44 UTC (permalink / raw)
  To: qemu-devel; +Cc: Marc-André Lureau

Meson 0.56.0 does not need b_staticpic=$pie anymore, and has
stabilized the keyval module.  Remove the workaround and use a few
replacements for features deprecated in that release cycle.

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 configure                     |  5 ----
 docs/meson.build              | 12 ++++----
 meson.build                   | 54 ++++++++++++++++-------------------
 plugins/meson.build           |  4 +--
 tests/meson.build             |  2 +-
 tests/qapi-schema/meson.build |  4 +--
 tests/qtest/meson.build       |  2 +-
 trace/meson.build             |  4 +--
 8 files changed, 39 insertions(+), 48 deletions(-)

diff --git a/configure b/configure
index 0a6de3b8ef..ce4f365231 100755
--- a/configure
+++ b/configure
@@ -6963,10 +6963,6 @@ fi
 mv $cross config-meson.cross
 
 rm -rf meson-private meson-info meson-logs
-unset staticpic
-if ! version_ge "$($meson --version)" 0.56.0; then
-  staticpic=$(if test "$pie" = yes; then echo true; else echo false; fi)
-fi
 NINJA=$ninja $meson setup \
         --prefix "$prefix" \
         --libdir "$libdir" \
@@ -6986,7 +6982,6 @@ NINJA=$ninja $meson setup \
         -Dwerror=$(if test "$werror" = yes; then echo true; else echo false; fi) \
         -Dstrip=$(if test "$strip_opt" = yes; then echo true; else echo false; fi) \
         -Db_pie=$(if test "$pie" = yes; then echo true; else echo false; fi) \
-        ${staticpic:+-Db_staticpic=$staticpic} \
         -Db_coverage=$(if test "$gcov" = yes; then echo true; else echo false; fi) \
         -Db_lto=$lto -Dcfi=$cfi -Dcfi_debug=$cfi_debug \
         -Dmalloc=$malloc -Dmalloc_trim=$malloc_trim -Dsparse=$sparse \
diff --git a/docs/meson.build b/docs/meson.build
index bb8fe4c9e4..4e88ed7516 100644
--- a/docs/meson.build
+++ b/docs/meson.build
@@ -38,12 +38,12 @@ endif
 if build_docs
   SPHINX_ARGS += ['-Dversion=' + meson.project_version(), '-Drelease=' + config_host['PKGVERSION']]
 
-  sphinx_extn_depends = [ meson.source_root() / 'docs/sphinx/depfile.py',
-                          meson.source_root() / 'docs/sphinx/hxtool.py',
-                          meson.source_root() / 'docs/sphinx/kerneldoc.py',
-                          meson.source_root() / 'docs/sphinx/kernellog.py',
-                          meson.source_root() / 'docs/sphinx/qapidoc.py',
-                          meson.source_root() / 'docs/sphinx/qmp_lexer.py',
+  sphinx_extn_depends = [ meson.current_source_dir() / 'sphinx/depfile.py',
+                          meson.current_source_dir() / 'sphinx/hxtool.py',
+                          meson.current_source_dir() / 'sphinx/kerneldoc.py',
+                          meson.current_source_dir() / 'sphinx/kernellog.py',
+                          meson.current_source_dir() / 'sphinx/qapidoc.py',
+                          meson.current_source_dir() / 'sphinx/qmp_lexer.py',
                           qapi_gen_depends ]
 
   configure_file(output: 'index.html',
diff --git a/meson.build b/meson.build
index ada35d56e1..34ecb93b03 100644
--- a/meson.build
+++ b/meson.build
@@ -1,14 +1,10 @@
-project('qemu', ['c'], meson_version: '>=0.55.0',
-        default_options: ['warning_level=1', 'c_std=gnu99', 'cpp_std=gnu++11', 'b_colorout=auto'] +
-                         (meson.version().version_compare('>=0.56.0') ? [ 'b_staticpic=false' ] : []),
-        version: run_command('head', meson.source_root() / 'VERSION').stdout().strip())
+project('qemu', ['c'], meson_version: '>=0.56.0',
+        default_options: ['warning_level=1', 'c_std=gnu99', 'cpp_std=gnu++11', 'b_colorout=auto',
+                          'b_staticpic=false'],
+        version: run_command('head', meson.project_source_root() / 'VERSION').stdout().strip())
 
 not_found = dependency('', required: false)
-if meson.version().version_compare('>=0.56.0')
-  keyval = import('keyval')
-else
-  keyval = import('unstable-keyval')
-endif
+keyval = import('keyval')
 ss = import('sourceset')
 fs = import('fs')
 
@@ -1372,21 +1368,21 @@ genh += configure_file(output: 'config-host.h', configuration: config_host_data)
 hxtool = find_program('scripts/hxtool')
 shaderinclude = find_program('scripts/shaderinclude.pl')
 qapi_gen = find_program('scripts/qapi-gen.py')
-qapi_gen_depends = [ meson.source_root() / 'scripts/qapi/__init__.py',
-                     meson.source_root() / 'scripts/qapi/commands.py',
-                     meson.source_root() / 'scripts/qapi/common.py',
-                     meson.source_root() / 'scripts/qapi/error.py',
-                     meson.source_root() / 'scripts/qapi/events.py',
-                     meson.source_root() / 'scripts/qapi/expr.py',
-                     meson.source_root() / 'scripts/qapi/gen.py',
-                     meson.source_root() / 'scripts/qapi/introspect.py',
-                     meson.source_root() / 'scripts/qapi/parser.py',
-                     meson.source_root() / 'scripts/qapi/schema.py',
-                     meson.source_root() / 'scripts/qapi/source.py',
-                     meson.source_root() / 'scripts/qapi/types.py',
-                     meson.source_root() / 'scripts/qapi/visit.py',
-                     meson.source_root() / 'scripts/qapi/common.py',
-                     meson.source_root() / 'scripts/qapi-gen.py'
+qapi_gen_depends = [ meson.current_source_dir() / 'scripts/qapi/__init__.py',
+                     meson.current_source_dir() / 'scripts/qapi/commands.py',
+                     meson.current_source_dir() / 'scripts/qapi/common.py',
+                     meson.current_source_dir() / 'scripts/qapi/error.py',
+                     meson.current_source_dir() / 'scripts/qapi/events.py',
+                     meson.current_source_dir() / 'scripts/qapi/expr.py',
+                     meson.current_source_dir() / 'scripts/qapi/gen.py',
+                     meson.current_source_dir() / 'scripts/qapi/introspect.py',
+                     meson.current_source_dir() / 'scripts/qapi/parser.py',
+                     meson.current_source_dir() / 'scripts/qapi/schema.py',
+                     meson.current_source_dir() / 'scripts/qapi/source.py',
+                     meson.current_source_dir() / 'scripts/qapi/types.py',
+                     meson.current_source_dir() / 'scripts/qapi/visit.py',
+                     meson.current_source_dir() / 'scripts/qapi/common.py',
+                     meson.current_source_dir() / 'scripts/qapi-gen.py'
 ]
 
 tracetool = [
@@ -1895,14 +1891,14 @@ foreach target : target_dirs
   if target.endswith('-softmmu')
     execs = [{
       'name': 'qemu-system-' + target_name,
-      'gui': false,
+      'win_subsystem': 'console',
       'sources': files('softmmu/main.c'),
       'dependencies': []
     }]
     if targetos == 'windows' and (sdl.found() or gtk.found())
       execs += [{
         'name': 'qemu-system-' + target_name + 'w',
-        'gui': true,
+        'win_subsystem': 'windows',
         'sources': files('softmmu/main.c'),
         'dependencies': []
       }]
@@ -1911,7 +1907,7 @@ foreach target : target_dirs
       specific_fuzz = specific_fuzz_ss.apply(config_target, strict: false)
       execs += [{
         'name': 'qemu-fuzz-' + target_name,
-        'gui': false,
+        'win_subsystem': 'console',
         'sources': specific_fuzz.sources(),
         'dependencies': specific_fuzz.dependencies(),
       }]
@@ -1919,7 +1915,7 @@ foreach target : target_dirs
   else
     execs = [{
       'name': 'qemu-' + target_name,
-      'gui': false,
+      'win_subsystem': 'console',
       'sources': [],
       'dependencies': []
     }]
@@ -1934,7 +1930,7 @@ foreach target : target_dirs
                link_language: link_language,
                link_depends: [block_syms, qemu_syms] + exe.get('link_depends', []),
                link_args: link_args,
-               gui_app: exe['gui'])
+               win_subsystem: exe['win_subsystem'])
     }
 
     if 'CONFIG_TRACE_SYSTEMTAP' in config_host
diff --git a/plugins/meson.build b/plugins/meson.build
index e77723010e..d58efc980e 100644
--- a/plugins/meson.build
+++ b/plugins/meson.build
@@ -1,7 +1,7 @@
 if 'CONFIG_HAS_LD_DYNAMIC_LIST' in config_host
-  plugin_ldflags = ['-Wl,--dynamic-list=' + (meson.build_root() / 'qemu-plugins-ld.symbols')]
+  plugin_ldflags = ['-Wl,--dynamic-list=' + (meson.project_build_root() / 'qemu-plugins-ld.symbols')]
 elif 'CONFIG_HAS_LD_EXPORTED_SYMBOLS_LIST' in config_host
-  plugin_ldflags = ['-Wl,-exported_symbols_list,' + (meson.build_root() / 'qemu-plugins-ld64.symbols')]
+  plugin_ldflags = ['-Wl,-exported_symbols_list,' + (meson.project_build_root() / 'qemu-plugins-ld64.symbols')]
 else
   plugin_ldflags = []
 endif
diff --git a/tests/meson.build b/tests/meson.build
index 1fa068f27b..0b8c3c6f32 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -113,7 +113,7 @@ tests = {
   'test-keyval': [testqapi],
   'test-logging': [],
   'test-uuid': [],
-  'ptimer-test': ['ptimer-test-stubs.c', meson.source_root() / 'hw/core/ptimer.c'],
+  'ptimer-test': ['ptimer-test-stubs.c', meson.project_source_root() / 'hw/core/ptimer.c'],
   'test-qapi-util': [],
 }
 
diff --git a/tests/qapi-schema/meson.build b/tests/qapi-schema/meson.build
index 304ef939bd..26588396d2 100644
--- a/tests/qapi-schema/meson.build
+++ b/tests/qapi-schema/meson.build
@@ -1,5 +1,5 @@
 test_env = environment()
-test_env.set('PYTHONPATH', meson.source_root() / 'scripts')
+test_env.set('PYTHONPATH', meson.project_source_root() / 'scripts')
 test_env.set('PYTHONIOENCODING', 'utf-8')
 
 schemas = [
@@ -240,7 +240,7 @@ if build_docs
                                # clutter up the build dir with the cache.
                                command: [SPHINX_ARGS,
                                          '-b', 'text', '-E',
-                                         '-c', meson.source_root() / 'docs',
+                                         '-c', meson.project_source_root() / 'docs',
                                          '-D', 'master_doc=doc-good',
                                          meson.current_source_dir(),
                                          meson.current_build_dir()])
diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build
index 6a67c538be..450af3e51c 100644
--- a/tests/qtest/meson.build
+++ b/tests/qtest/meson.build
@@ -237,7 +237,7 @@ foreach dir : target_dirs
     qtest_env.set('QTEST_QEMU_IMG', './qemu-img')
     test_deps += [qemu_img]
   endif
-  qtest_env.set('G_TEST_DBUS_DAEMON', meson.source_root() / 'tests/dbus-vmstate-daemon.sh')
+  qtest_env.set('G_TEST_DBUS_DAEMON', meson.project_source_root() / 'tests/dbus-vmstate-daemon.sh')
   qtest_env.set('QTEST_QEMU_BINARY', './qemu-system-' + target_base)
   
   foreach test : target_qtests
diff --git a/trace/meson.build b/trace/meson.build
index b19309b327..012d0dbceb 100644
--- a/trace/meson.build
+++ b/trace/meson.build
@@ -2,7 +2,7 @@ specific_ss.add(files('control-target.c'))
 
 trace_events_files = []
 foreach dir : [ '.' ] + trace_events_subdirs
-  trace_events_file = meson.source_root() / dir / 'trace-events'
+  trace_events_file = meson.project_source_root() / dir / 'trace-events'
   trace_events_files += [ trace_events_file ]
   group_name = dir == '.' ? 'root' : dir.underscorify()
   group = '--group=' + group_name
@@ -68,7 +68,7 @@ foreach d : [
 ]
   gen = custom_target(d[0],
                 output: d[0],
-                input: meson.source_root() / 'trace-events',
+                input: meson.project_source_root() / 'trace-events',
                 command: [ tracetool, '--group=root', '--format=@0@'.format(d[1]), '@INPUT@' ],
                 capture: true)
   specific_ss.add(when: 'CONFIG_TCG', if_true: gen)
-- 
2.29.2




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

* [PULL 28/55] meson: fix detection of curses with pkgconfig
  2020-12-21 14:43 [PULL 00/55] Misc patches for 2020-12-21 Paolo Bonzini
                   ` (26 preceding siblings ...)
  2020-12-21 14:44 ` [PULL 27/55] meson: switch minimum meson version " Paolo Bonzini
@ 2020-12-21 14:44 ` Paolo Bonzini
  2020-12-21 14:44 ` [PULL 29/55] meson: use pkg-config method for libudev Paolo Bonzini
                   ` (27 subsequent siblings)
  55 siblings, 0 replies; 61+ messages in thread
From: Paolo Bonzini @ 2020-12-21 14:44 UTC (permalink / raw)
  To: qemu-devel; +Cc: Marc-André Lureau

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 meson.build | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/meson.build b/meson.build
index 34ecb93b03..d5d08c8b6b 100644
--- a/meson.build
+++ b/meson.build
@@ -500,16 +500,16 @@ if have_system and not get_option('curses').disabled()
     endif
   endforeach
   msg = get_option('curses').enabled() ? 'curses library not found' : ''
+  curses_compile_args = ['-DNCURSES_WIDECHAR']
   if curses.found()
-    if cc.links(curses_test, dependencies: [curses])
-      curses = declare_dependency(compile_args: '-DNCURSES_WIDECHAR', dependencies: [curses])
+    if cc.links(curses_test, args: curses_compile_args, dependencies: [curses])
+      curses = declare_dependency(compile_args: curses_compile_args, dependencies: [curses])
     else
       msg = 'curses package not usable'
       curses = not_found
     endif
   endif
   if not curses.found()
-    curses_compile_args = ['-DNCURSES_WIDECHAR']
     has_curses_h = cc.has_header('curses.h', args: curses_compile_args)
     if targetos != 'windows' and not has_curses_h
       message('Trying with /usr/include/ncursesw')
-- 
2.29.2




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

* [PULL 29/55] meson: use pkg-config method for libudev
  2020-12-21 14:43 [PULL 00/55] Misc patches for 2020-12-21 Paolo Bonzini
                   ` (27 preceding siblings ...)
  2020-12-21 14:44 ` [PULL 28/55] meson: fix detection of curses with pkgconfig Paolo Bonzini
@ 2020-12-21 14:44 ` Paolo Bonzini
  2020-12-21 14:44 ` [PULL 30/55] meson: use dependency to gate block modules Paolo Bonzini
                   ` (26 subsequent siblings)
  55 siblings, 0 replies; 61+ messages in thread
From: Paolo Bonzini @ 2020-12-21 14:44 UTC (permalink / raw)
  To: qemu-devel; +Cc: Marc-André Lureau

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 meson.build | 1 +
 1 file changed, 1 insertion(+)

diff --git a/meson.build b/meson.build
index d5d08c8b6b..45155114d3 100644
--- a/meson.build
+++ b/meson.build
@@ -399,6 +399,7 @@ endif
 libudev = not_found
 if targetos == 'linux' and (have_system or have_tools)
   libudev = dependency('libudev',
+                       method: 'pkg-config',
                        required: get_option('libudev'),
                        static: enable_static)
 endif
-- 
2.29.2




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

* [PULL 30/55] meson: use dependency to gate block modules
  2020-12-21 14:43 [PULL 00/55] Misc patches for 2020-12-21 Paolo Bonzini
                   ` (28 preceding siblings ...)
  2020-12-21 14:44 ` [PULL 29/55] meson: use pkg-config method for libudev Paolo Bonzini
@ 2020-12-21 14:44 ` Paolo Bonzini
  2020-12-21 14:44 ` [PULL 31/55] meson: cleanup Kconfig.host handling Paolo Bonzini
                   ` (25 subsequent siblings)
  55 siblings, 0 replies; 61+ messages in thread
From: Paolo Bonzini @ 2020-12-21 14:44 UTC (permalink / raw)
  To: qemu-devel; +Cc: Marc-André Lureau

This allows converting the dependencies to meson options one by one.

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 block/meson.build | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/block/meson.build b/block/meson.build
index 5dcc1e5cce..b02cb14aad 100644
--- a/block/meson.build
+++ b/block/meson.build
@@ -70,14 +70,14 @@ block_modules = {}
 
 modsrc = []
 foreach m : [
-  ['CONFIG_CURL', 'curl', [curl, glib], 'curl.c'],
-  ['CONFIG_GLUSTERFS', 'gluster', glusterfs, 'gluster.c'],
-  ['CONFIG_LIBISCSI', 'iscsi', libiscsi, 'iscsi.c'],
-  ['CONFIG_LIBNFS', 'nfs', libnfs, 'nfs.c'],
-  ['CONFIG_LIBSSH', 'ssh', libssh, 'ssh.c'],
-  ['CONFIG_RBD', 'rbd', rbd, 'rbd.c'],
+  [curl, 'curl', [curl, glib], 'curl.c'],
+  [glusterfs, 'gluster', glusterfs, 'gluster.c'],
+  [libiscsi, 'iscsi', libiscsi, 'iscsi.c'],
+  [libnfs, 'nfs', libnfs, 'nfs.c'],
+  [libssh, 'ssh', libssh, 'ssh.c'],
+  [rbd, 'rbd', rbd, 'rbd.c'],
 ]
-  if config_host.has_key(m[0])
+  if m[0].found()
     if enable_modules
       modsrc += files(m[3])
     endif
@@ -90,10 +90,10 @@ endforeach
 # those are not exactly regular block modules, so treat them apart
 if 'CONFIG_DMG' in config_host
   foreach m : [
-    ['CONFIG_LZFSE', 'dmg-lzfse', liblzfse, 'dmg-lzfse.c'],
-    ['CONFIG_BZIP2', 'dmg-bz2', [glib, libbzip2], 'dmg-bz2.c']
+    [liblzfse, 'dmg-lzfse', liblzfse, 'dmg-lzfse.c'],
+    [libbzip2, 'dmg-bz2', [glib, libbzip2], 'dmg-bz2.c']
   ]
-    if config_host.has_key(m[0])
+    if m[0].found()
       module_ss = ss.source_set()
       module_ss.add(when: m[2], if_true: files(m[3]))
       block_modules += {m[1] : module_ss}
-- 
2.29.2




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

* [PULL 31/55] meson: cleanup Kconfig.host handling
  2020-12-21 14:43 [PULL 00/55] Misc patches for 2020-12-21 Paolo Bonzini
                   ` (29 preceding siblings ...)
  2020-12-21 14:44 ` [PULL 30/55] meson: use dependency to gate block modules Paolo Bonzini
@ 2020-12-21 14:44 ` Paolo Bonzini
  2020-12-21 14:44 ` [PULL 32/55] configure: remove useless code to check for Xen PCI passthrough Paolo Bonzini
                   ` (24 subsequent siblings)
  55 siblings, 0 replies; 61+ messages in thread
From: Paolo Bonzini @ 2020-12-21 14:44 UTC (permalink / raw)
  To: qemu-devel; +Cc: Marc-André Lureau

Build the array of command line arguments coming from config_host
once for all targets.  Add all accelerators to accel/Kconfig so
that the command line arguments for accelerators can be computed
easily in the existing "foreach sym: accelerators" loop.

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 accel/Kconfig          |  9 +++++++++
 docs/devel/kconfig.rst | 19 +++++++++----------
 meson.build            | 43 +++++++++++++++++-------------------------
 3 files changed, 35 insertions(+), 36 deletions(-)

diff --git a/accel/Kconfig b/accel/Kconfig
index 2ad94a3839..461104c771 100644
--- a/accel/Kconfig
+++ b/accel/Kconfig
@@ -1,3 +1,12 @@
+config WHPX
+    bool
+
+config HAX
+    bool
+
+config HVF
+    bool
+
 config TCG
     bool
 
diff --git a/docs/devel/kconfig.rst b/docs/devel/kconfig.rst
index 336ba0e8e5..cb2d7ffac0 100644
--- a/docs/devel/kconfig.rst
+++ b/docs/devel/kconfig.rst
@@ -288,21 +288,20 @@ they will include all these symbols and some help text on what they do.
 ----------------
 
 In some special cases, a configurable element depends on host features
-that are detected by QEMU's configure script; for example some devices
-depend on the availability of KVM or on the presence of a library on
-the host.
+that are detected by QEMU's configure or ``meson.build`` scripts; for
+example some devices depend on the availability of KVM or on the presence
+of a library on the host.
 
 These symbols should be listed in ``Kconfig.host`` like this::
 
-    config KVM
+    config TPM
       bool
 
-and also listed as follows in the top-level Makefile's ``MINIKCONF_ARGS``
+and also listed as follows in the top-level meson.build's host_kconfig
 variable::
 
-    MINIKCONF_ARGS = \
-      $@ $*/config-devices.mak.d $< $(MINIKCONF_INPUTS) \
-      CONFIG_KVM=$(CONFIG_KVM) \
-      CONFIG_SPICE=$(CONFIG_SPICE) \
-      CONFIG_TPM=$(CONFIG_TPM) \
+    host_kconfig = \
+      ('CONFIG_TPM' in config_host ? ['CONFIG_TPM=y'] : []) + \
+      ('CONFIG_SPICE' in config_host ? ['CONFIG_SPICE=y'] : []) + \
+      ('CONFIG_IVSHMEM' in config_host ? ['CONFIG_IVSHMEM=y'] : []) + \
       ...
diff --git a/meson.build b/meson.build
index 45155114d3..3e584499bc 100644
--- a/meson.build
+++ b/meson.build
@@ -954,21 +954,19 @@ if link_language == 'cpp'
   }
 endif
 
-kconfig_external_symbols = [
-  'CONFIG_KVM',
-  'CONFIG_XEN',
-  'CONFIG_TPM',
-  'CONFIG_SPICE',
-  'CONFIG_IVSHMEM',
-  'CONFIG_OPENGL',
-  'CONFIG_X11',
-  'CONFIG_VHOST_USER',
-  'CONFIG_VHOST_VDPA',
-  'CONFIG_VHOST_KERNEL',
-  'CONFIG_VIRTFS',
-  'CONFIG_LINUX',
-  'CONFIG_PVRDMA',
-]
+host_kconfig = \
+  ('CONFIG_TPM' in config_host ? ['CONFIG_TPM=y'] : []) + \
+  ('CONFIG_SPICE' in config_host ? ['CONFIG_SPICE=y'] : []) + \
+  ('CONFIG_IVSHMEM' in config_host ? ['CONFIG_IVSHMEM=y'] : []) + \
+  ('CONFIG_OPENGL' in config_host ? ['CONFIG_OPENGL=y'] : []) + \
+  ('CONFIG_X11' in config_host ? ['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'] : []) + \
+  ('CONFIG_VIRTFS' in config_host ? ['CONFIG_VIRTFS=y'] : []) + \
+  ('CONFIG_LINUX' in config_host ? ['CONFIG_LINUX=y'] : []) + \
+  ('CONFIG_PVRDMA' in config_host ? ['CONFIG_PVRDMA=y'] : [])
+
 ignored = [ 'TARGET_XML_FILES', 'TARGET_ABI_DIR', 'TARGET_ARCH' ]
 
 default_targets = 'CONFIG_DEFAULT_TARGETS' in config_host
@@ -1003,7 +1001,7 @@ foreach target : target_dirs
     }
   endif
 
-  have_accel = false
+  accel_kconfig = []
   foreach sym: accelerators
     if sym == 'CONFIG_TCG' or target in accelerator_targets.get(sym, [])
       config_target += { sym: 'y' }
@@ -1011,10 +1009,10 @@ foreach target : target_dirs
       if sym == 'CONFIG_XEN' and have_xen_pci_passthrough
         config_target += { 'CONFIG_XEN_PCI_PASSTHROUGH': 'y' }
       endif
-      have_accel = true
+      accel_kconfig += [ sym + '=y' ]
     endif
   endforeach
-  if not have_accel
+  if accel_kconfig.length() == 0
     if default_targets
       continue
     endif
@@ -1068,13 +1066,6 @@ foreach target : target_dirs
                                                configuration: config_target_data)}
 
   if target.endswith('-softmmu')
-    base_kconfig = []
-    foreach sym : kconfig_external_symbols
-      if sym in config_target or sym in config_host
-        base_kconfig += '@0@=y'.format(sym)
-      endif
-    endforeach
-
     config_devices_mak = target + '-config-devices.mak'
     config_devices_mak = configure_file(
       input: ['default-configs/devices' / target + '.mak', 'Kconfig'],
@@ -1083,7 +1074,7 @@ foreach target : target_dirs
       capture: true,
       command: [minikconf, config_host['CONFIG_MINIKCONF_MODE'],
                 config_devices_mak, '@DEPFILE@', '@INPUT@',
-                base_kconfig])
+                host_kconfig, accel_kconfig])
 
     config_devices_data = configuration_data()
     config_devices = keyval.load(config_devices_mak)
-- 
2.29.2




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

* [PULL 32/55] configure: remove useless code to check for Xen PCI passthrough
  2020-12-21 14:43 [PULL 00/55] Misc patches for 2020-12-21 Paolo Bonzini
                   ` (30 preceding siblings ...)
  2020-12-21 14:44 ` [PULL 31/55] meson: cleanup Kconfig.host handling Paolo Bonzini
@ 2020-12-21 14:44 ` Paolo Bonzini
  2020-12-21 14:44 ` [PULL 33/55] configure: remove variable bogus_os Paolo Bonzini
                   ` (23 subsequent siblings)
  55 siblings, 0 replies; 61+ messages in thread
From: Paolo Bonzini @ 2020-12-21 14:44 UTC (permalink / raw)
  To: qemu-devel; +Cc: Marc-André Lureau

meson.build is already doing the same check, so remove it from
configure.

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 configure | 12 ------------
 1 file changed, 12 deletions(-)

diff --git a/configure b/configure
index ce4f365231..ca8496b607 100755
--- a/configure
+++ b/configure
@@ -2877,18 +2877,6 @@ EOF
   fi
 fi
 
-if test "$xen_pci_passthrough" != "disabled"; then
-  if test "$xen" = "enabled" && test "$linux" = "yes"; then
-    xen_pci_passthrough=enabled
-  else
-    if test "$xen_pci_passthrough" = "enabled"; then
-      error_exit "User requested feature Xen PCI Passthrough" \
-          " but this feature requires /sys from Linux"
-    fi
-    xen_pci_passthrough=disabled
-  fi
-fi
-
 ##########################################
 # X11 probe
 if $pkg_config --exists "x11"; then
-- 
2.29.2




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

* [PULL 33/55] configure: remove variable bogus_os
  2020-12-21 14:43 [PULL 00/55] Misc patches for 2020-12-21 Paolo Bonzini
                   ` (31 preceding siblings ...)
  2020-12-21 14:44 ` [PULL 32/55] configure: remove useless code to check for Xen PCI passthrough Paolo Bonzini
@ 2020-12-21 14:44 ` Paolo Bonzini
  2020-12-21 14:44 ` [PULL 34/55] configure: accept --enable-slirp Paolo Bonzini
                   ` (22 subsequent siblings)
  55 siblings, 0 replies; 61+ messages in thread
From: Paolo Bonzini @ 2020-12-21 14:44 UTC (permalink / raw)
  To: qemu-devel; +Cc: Marc-André Lureau, Thomas Huth

The condition can be tested also from $targetos, clean up.

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 configure | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/configure b/configure
index ca8496b607..d5d630c0ee 100755
--- a/configure
+++ b/configure
@@ -466,7 +466,6 @@ gettext="auto"
 fuse="auto"
 fuse_lseek="auto"
 
-bogus_os="no"
 malloc_trim="auto"
 
 # parse CC options second
@@ -619,7 +618,6 @@ else
   # might be going to just print the --help text, or it might
   # be the result of a missing compiler.
   targetos='bogus'
-  bogus_os='yes'
 fi
 
 # Some host OSes need non-standard checks for which CPU to use.
@@ -2014,7 +2012,7 @@ if test -z "$werror" ; then
     fi
 fi
 
-if test "$bogus_os" = "yes"; then
+if test "$targetos" = "bogus"; then
     # Now that we know that we're not printing the help and that
     # the compiler works (so the results of the check_defines we used
     # to identify the OS are reliable), if we didn't recognize the
-- 
2.29.2




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

* [PULL 34/55] configure: accept --enable-slirp
  2020-12-21 14:43 [PULL 00/55] Misc patches for 2020-12-21 Paolo Bonzini
                   ` (32 preceding siblings ...)
  2020-12-21 14:44 ` [PULL 33/55] configure: remove variable bogus_os Paolo Bonzini
@ 2020-12-21 14:44 ` Paolo Bonzini
  2020-12-21 14:44 ` [PULL 35/55] configure: remove CONFIG_FILEVERSION and CONFIG_PRODUCTVERSION Paolo Bonzini
                   ` (21 subsequent siblings)
  55 siblings, 0 replies; 61+ messages in thread
From: Paolo Bonzini @ 2020-12-21 14:44 UTC (permalink / raw)
  To: qemu-devel; +Cc: Marc-André Lureau, Thomas Huth

Meson understands -Dslirp=enabled, so there is no reason not to
accept the configure option as well.

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 configure | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/configure b/configure
index d5d630c0ee..16b609a984 100755
--- a/configure
+++ b/configure
@@ -1082,6 +1082,8 @@ for opt do
   ;;
   --disable-slirp) slirp="disabled"
   ;;
+  --enable-slirp) slirp="enabled"
+  ;;
   --enable-slirp=git) slirp="internal"
   ;;
   --enable-slirp=system) slirp="system"
-- 
2.29.2




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

* [PULL 35/55] configure: remove CONFIG_FILEVERSION and CONFIG_PRODUCTVERSION
  2020-12-21 14:43 [PULL 00/55] Misc patches for 2020-12-21 Paolo Bonzini
                   ` (33 preceding siblings ...)
  2020-12-21 14:44 ` [PULL 34/55] configure: accept --enable-slirp Paolo Bonzini
@ 2020-12-21 14:44 ` Paolo Bonzini
  2020-12-21 14:44 ` [PULL 36/55] brlapi: convert to meson Paolo Bonzini
                   ` (20 subsequent siblings)
  55 siblings, 0 replies; 61+ messages in thread
From: Paolo Bonzini @ 2020-12-21 14:44 UTC (permalink / raw)
  To: qemu-devel; +Cc: Marc-André Lureau

version.rc can just use existing preprocessor symbols.

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 configure  | 9 ---------
 version.rc | 4 ++--
 2 files changed, 2 insertions(+), 11 deletions(-)

diff --git a/configure b/configure
index 16b609a984..61ae342a58 100755
--- a/configure
+++ b/configure
@@ -5927,15 +5927,6 @@ if test "$bigendian" = "yes" ; then
 fi
 if test "$mingw32" = "yes" ; then
   echo "CONFIG_WIN32=y" >> $config_host_mak
-  rc_version=$(cat $source_path/VERSION)
-  version_major=${rc_version%%.*}
-  rc_version=${rc_version#*.}
-  version_minor=${rc_version%%.*}
-  rc_version=${rc_version#*.}
-  version_subminor=${rc_version%%.*}
-  version_micro=0
-  echo "CONFIG_FILEVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak
-  echo "CONFIG_PRODUCTVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak
   if test "$guest_agent_with_vss" = "yes" ; then
     echo "CONFIG_QGA_VSS=y" >> $config_host_mak
     echo "QGA_VSS_PROVIDER=$qga_vss_provider" >> $config_host_mak
diff --git a/version.rc b/version.rc
index d8e1569991..0daadbf981 100644
--- a/version.rc
+++ b/version.rc
@@ -2,8 +2,8 @@
 #include "config-host.h"
 
 VS_VERSION_INFO VERSIONINFO
-FILEVERSION CONFIG_FILEVERSION
-PRODUCTVERSION CONFIG_PRODUCTVERSION
+FILEVERSION QEMU_VERSION_MAJOR,QEMU_VERSION_MINOR,QEMU_VERSION_MICRO,0
+PRODUCTVERSION QEMU_VERSION_MAJOR,QEMU_VERSION_MINOR,QEMU_VERSION_MICRO,0
 FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
 FILEOS VOS_NT_WINDOWS32
 FILETYPE VFT_APP
-- 
2.29.2




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

* [PULL 36/55] brlapi: convert to meson
  2020-12-21 14:43 [PULL 00/55] Misc patches for 2020-12-21 Paolo Bonzini
                   ` (34 preceding siblings ...)
  2020-12-21 14:44 ` [PULL 35/55] configure: remove CONFIG_FILEVERSION and CONFIG_PRODUCTVERSION Paolo Bonzini
@ 2020-12-21 14:44 ` Paolo Bonzini
  2020-12-21 14:44 ` [PULL 37/55] curl: remove compatibility code, require 7.29.0 Paolo Bonzini
                   ` (19 subsequent siblings)
  55 siblings, 0 replies; 61+ messages in thread
From: Paolo Bonzini @ 2020-12-21 14:44 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 chardev/meson.build |  2 +-
 configure           | 32 ++++----------------------------
 meson.build         | 20 +++++++++++++++++---
 meson_options.txt   |  2 ++
 4 files changed, 24 insertions(+), 32 deletions(-)

diff --git a/chardev/meson.build b/chardev/meson.build
index 4e19722c5e..32377af383 100644
--- a/chardev/meson.build
+++ b/chardev/meson.build
@@ -29,7 +29,7 @@ softmmu_ss.add(files('msmouse.c', 'wctablet.c', 'testdev.c'))
 
 chardev_modules = {}
 
-if config_host.has_key('CONFIG_BRLAPI')
+if brlapi.found()
   module_ss = ss.source_set()
   module_ss.add(when: [brlapi], if_true: [files('baum.c'), pixman])
   chardev_modules += { 'baum': module_ss }
diff --git a/configure b/configure
index 61ae342a58..8dd9c33685 100755
--- a/configure
+++ b/configure
@@ -305,7 +305,7 @@ for opt do
   esac
 done
 
-brlapi="$default_feature"
+brlapi="auto"
 curl="$default_feature"
 iconv="auto"
 curses="auto"
@@ -1104,9 +1104,9 @@ for opt do
   ;;
   --enable-xen-pci-passthrough) xen_pci_passthrough="enabled"
   ;;
-  --disable-brlapi) brlapi="no"
+  --disable-brlapi) brlapi="disabled"
   ;;
-  --enable-brlapi) brlapi="yes"
+  --enable-brlapi) brlapi="enabled"
   ;;
   --disable-kvm) kvm="disabled"
   ;;
@@ -3423,26 +3423,6 @@ for drv in $audio_drv_list; do
     esac
 done
 
-##########################################
-# BrlAPI probe
-
-if test "$brlapi" != "no" ; then
-  brlapi_libs="-lbrlapi"
-  cat > $TMPC << EOF
-#include <brlapi.h>
-#include <stddef.h>
-int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
-EOF
-  if compile_prog "" "$brlapi_libs" ; then
-    brlapi=yes
-  else
-    if test "$brlapi" = "yes" ; then
-      feature_not_found "brlapi" "Install brlapi devel"
-    fi
-    brlapi=no
-  fi
-fi
-
 ##########################################
 # curl probe
 if test "$curl" != "no" ; then
@@ -6132,10 +6112,6 @@ if test "$curl" = "yes" ; then
   echo "CURL_CFLAGS=$curl_cflags" >> $config_host_mak
   echo "CURL_LIBS=$curl_libs" >> $config_host_mak
 fi
-if test "$brlapi" = "yes" ; then
-  echo "CONFIG_BRLAPI=y" >> $config_host_mak
-  echo "BRLAPI_LIBS=$brlapi_libs" >> $config_host_mak
-fi
 if test "$gtk" = "yes" ; then
   echo "CONFIG_GTK=y" >> $config_host_mak
   echo "GTK_CFLAGS=$gtk_cflags" >> $config_host_mak
@@ -6969,7 +6945,7 @@ NINJA=$ninja $meson setup \
         -Dcocoa=$cocoa -Dmpath=$mpath -Dsdl=$sdl -Dsdl_image=$sdl_image \
         -Dvnc=$vnc -Dvnc_sasl=$vnc_sasl -Dvnc_jpeg=$vnc_jpeg -Dvnc_png=$vnc_png \
         -Dgettext=$gettext -Dxkbcommon=$xkbcommon -Du2f=$u2f -Dvirtiofsd=$virtiofsd \
-        -Dcapstone=$capstone -Dslirp=$slirp -Dfdt=$fdt \
+        -Dcapstone=$capstone -Dslirp=$slirp -Dfdt=$fdt -Dbrlapi=$brlapi \
         -Diconv=$iconv -Dcurses=$curses -Dlibudev=$libudev\
         -Ddocs=$docs -Dsphinx_build=$sphinx_build -Dinstall_blobs=$blobs \
         -Dvhost_user_blk_server=$vhost_user_blk_server \
diff --git a/meson.build b/meson.build
index 3e584499bc..ecc95207e5 100644
--- a/meson.build
+++ b/meson.build
@@ -570,8 +570,21 @@ if have_system and not get_option('curses').disabled()
 endif
 
 brlapi = not_found
-if 'CONFIG_BRLAPI' in config_host
-  brlapi = declare_dependency(link_args: config_host['BRLAPI_LIBS'].split())
+if not get_option('brlapi').auto() or have_system
+  brlapi = cc.find_library('brlapi', has_headers: ['brlapi.h'],
+                         required: get_option('brlapi'),
+                         static: enable_static)
+  if brlapi.found() and not cc.links('''
+     #include <brlapi.h>
+     #include <stddef.h>
+     int main(void) { return brlapi__openConnection (NULL, NULL, NULL); }''', dependencies: brlapi)
+    brlapi = not_found
+    if get_option('brlapi').enabled()
+      error('could not link brlapi')
+    else
+      warning('could not link brlapi, disabling')
+    endif
+  endif
 endif
 
 sdl = not_found
@@ -854,6 +867,7 @@ 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'))
 
+config_host_data.set('CONFIG_BRLAPI', brlapi.found())
 config_host_data.set('CONFIG_COCOA', cocoa.found())
 config_host_data.set('CONFIG_LIBUDEV', libudev.found())
 config_host_data.set('CONFIG_MPATH', mpathpersist.found())
@@ -2165,7 +2179,7 @@ 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']}
 endif
-summary_info += {'brlapi support':    config_host.has_key('CONFIG_BRLAPI')}
+summary_info += {'brlapi support':    brlapi.found()}
 summary_info += {'Documentation':     build_docs}
 summary_info += {'PIE':               get_option('b_pie')}
 summary_info += {'vde support':       config_host.has_key('CONFIG_VDE')}
diff --git a/meson_options.txt b/meson_options.txt
index 242e0769fb..62efe96a91 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -40,6 +40,8 @@ option('cfi', type: 'boolean', value: 'false',
 option('cfi_debug', type: 'boolean', value: 'false',
        description: 'Verbose errors in case of CFI violation')
 
+option('brlapi', type : 'feature', value : 'auto',
+       description: 'brlapi character device driver')
 option('cocoa', type : 'feature', value : 'auto',
        description: 'Cocoa user interface (macOS only)')
 option('mpath', type : 'feature', value : 'auto',
-- 
2.29.2




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

* [PULL 37/55] curl: remove compatibility code, require 7.29.0
  2020-12-21 14:43 [PULL 00/55] Misc patches for 2020-12-21 Paolo Bonzini
                   ` (35 preceding siblings ...)
  2020-12-21 14:44 ` [PULL 36/55] brlapi: convert to meson Paolo Bonzini
@ 2020-12-21 14:44 ` Paolo Bonzini
  2020-12-21 14:44 ` [PULL 38/55] curl: convert to meson Paolo Bonzini
                   ` (18 subsequent siblings)
  55 siblings, 0 replies; 61+ messages in thread
From: Paolo Bonzini @ 2020-12-21 14:44 UTC (permalink / raw)
  To: qemu-devel; +Cc: Daniel Berrangé

cURL 7.16.0 was released in October 2006.  Just remove code that is
in all likelihood not being used anywhere, and require the oldest version
found in currently supported distros, which is 7.29.0 from CentOS 7.

pkg-config is enough for QEMU, since it does not need extra information
such as the path for certicate authorities.  All supported platforms
today will all have pkg-config for curl, so we can drop curl-config.

Suggested-by: Daniel Berrangé <berrange@redhat.com>
Reviewed-by: Daniel Berrangé <berrange@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 block/curl.c | 28 ----------------------------
 configure    |  9 ++-------
 2 files changed, 2 insertions(+), 35 deletions(-)

diff --git a/block/curl.c b/block/curl.c
index d24a4c5897..4ff895df8f 100644
--- a/block/curl.c
+++ b/block/curl.c
@@ -37,26 +37,6 @@
 
 // #define DEBUG_VERBOSE
 
-#if LIBCURL_VERSION_NUM >= 0x071000
-/* The multi interface timer callback was introduced in 7.16.0 */
-#define NEED_CURL_TIMER_CALLBACK
-#define HAVE_SOCKET_ACTION
-#endif
-
-#ifndef HAVE_SOCKET_ACTION
-/* If curl_multi_socket_action isn't available, define it statically here in
- * terms of curl_multi_socket. Note that ev_bitmask will be ignored, which is
- * less efficient but still safe. */
-static CURLMcode __curl_multi_socket_action(CURLM *multi_handle,
-                                            curl_socket_t sockfd,
-                                            int ev_bitmask,
-                                            int *running_handles)
-{
-    return curl_multi_socket(multi_handle, sockfd, running_handles);
-}
-#define curl_multi_socket_action __curl_multi_socket_action
-#endif
-
 #define PROTOCOLS (CURLPROTO_HTTP | CURLPROTO_HTTPS | \
                    CURLPROTO_FTP | CURLPROTO_FTPS)
 
@@ -140,7 +120,6 @@ typedef struct BDRVCURLState {
 static void curl_clean_state(CURLState *s);
 static void curl_multi_do(void *arg);
 
-#ifdef NEED_CURL_TIMER_CALLBACK
 /* Called from curl_multi_do_locked, with s->mutex held.  */
 static int curl_timer_cb(CURLM *multi, long timeout_ms, void *opaque)
 {
@@ -156,7 +135,6 @@ static int curl_timer_cb(CURLM *multi, long timeout_ms, void *opaque)
     }
     return 0;
 }
-#endif
 
 /* Called from curl_multi_do_locked, with s->mutex held.  */
 static int curl_sock_cb(CURL *curl, curl_socket_t fd, int action,
@@ -433,7 +411,6 @@ static void curl_multi_do(void *arg)
 
 static void curl_multi_timeout_do(void *arg)
 {
-#ifdef NEED_CURL_TIMER_CALLBACK
     BDRVCURLState *s = (BDRVCURLState *)arg;
     int running;
 
@@ -446,9 +423,6 @@ static void curl_multi_timeout_do(void *arg)
 
     curl_multi_check_completion(s);
     qemu_mutex_unlock(&s->mutex);
-#else
-    abort();
-#endif
 }
 
 /* Called with s->mutex held.  */
@@ -598,10 +572,8 @@ static void curl_attach_aio_context(BlockDriverState *bs,
     s->multi = curl_multi_init();
     s->aio_context = new_context;
     curl_multi_setopt(s->multi, CURLMOPT_SOCKETFUNCTION, curl_sock_cb);
-#ifdef NEED_CURL_TIMER_CALLBACK
     curl_multi_setopt(s->multi, CURLMOPT_TIMERDATA, s);
     curl_multi_setopt(s->multi, CURLMOPT_TIMERFUNCTION, curl_timer_cb);
-#endif
 }
 
 static QemuOptsList runtime_opts = {
diff --git a/configure b/configure
index 8dd9c33685..c75196beb1 100755
--- a/configure
+++ b/configure
@@ -3426,17 +3426,12 @@ done
 ##########################################
 # curl probe
 if test "$curl" != "no" ; then
-  if $pkg_config libcurl --exists; then
-    curlconfig="$pkg_config libcurl"
-  else
-    curlconfig=curl-config
-  fi
   cat > $TMPC << EOF
 #include <curl/curl.h>
 int main(void) { curl_easy_init(); curl_multi_setopt(0, 0, 0); return 0; }
 EOF
-  curl_cflags=$($curlconfig --cflags 2>/dev/null)
-  curl_libs=$($curlconfig --libs 2>/dev/null)
+  curl_cflags=$($pkg_config libcurl --cflags 2>/dev/null)
+  curl_libs=$($pkg_config libcurl --libs 2>/dev/null)
   if compile_prog "$curl_cflags" "$curl_libs" ; then
     curl=yes
   else
-- 
2.29.2




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

* [PULL 38/55] curl: convert to meson
  2020-12-21 14:43 [PULL 00/55] Misc patches for 2020-12-21 Paolo Bonzini
                   ` (36 preceding siblings ...)
  2020-12-21 14:44 ` [PULL 37/55] curl: remove compatibility code, require 7.29.0 Paolo Bonzini
@ 2020-12-21 14:44 ` Paolo Bonzini
  2020-12-21 14:44 ` [PULL 39/55] glusterfs: " Paolo Bonzini
                   ` (17 subsequent siblings)
  55 siblings, 0 replies; 61+ messages in thread
From: Paolo Bonzini @ 2020-12-21 14:44 UTC (permalink / raw)
  To: qemu-devel; +Cc: Daniel Berrangé

Reviewed-by: Daniel Berrangé <berrange@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 configure                   | 31 ++++---------------------------
 contrib/elf2dmp/meson.build |  2 +-
 meson.build                 | 11 +++++++----
 meson_options.txt           |  2 ++
 4 files changed, 14 insertions(+), 32 deletions(-)

diff --git a/configure b/configure
index c75196beb1..bb6b8eefdb 100755
--- a/configure
+++ b/configure
@@ -306,7 +306,7 @@ for opt do
 done
 
 brlapi="auto"
-curl="$default_feature"
+curl="auto"
 iconv="auto"
 curses="auto"
 docs="auto"
@@ -1215,9 +1215,9 @@ for opt do
   ;;
   --enable-iconv) iconv="enabled"
   ;;
-  --disable-curl) curl="no"
+  --disable-curl) curl="disabled"
   ;;
-  --enable-curl) curl="yes"
+  --enable-curl) curl="enabled"
   ;;
   --disable-fdt) fdt="disabled"
   ;;
@@ -3423,25 +3423,6 @@ for drv in $audio_drv_list; do
     esac
 done
 
-##########################################
-# curl probe
-if test "$curl" != "no" ; then
-  cat > $TMPC << EOF
-#include <curl/curl.h>
-int main(void) { curl_easy_init(); curl_multi_setopt(0, 0, 0); return 0; }
-EOF
-  curl_cflags=$($pkg_config libcurl --cflags 2>/dev/null)
-  curl_libs=$($pkg_config libcurl --libs 2>/dev/null)
-  if compile_prog "$curl_cflags" "$curl_libs" ; then
-    curl=yes
-  else
-    if test "$curl" = "yes" ; then
-      feature_not_found "curl" "Install libcurl devel"
-    fi
-    curl=no
-  fi
-fi # test "$curl"
-
 ##########################################
 # glib support probe
 
@@ -6102,11 +6083,6 @@ fi
 if test "$bswap_h" = "yes" ; then
   echo "CONFIG_MACHINE_BSWAP_H=y" >> $config_host_mak
 fi
-if test "$curl" = "yes" ; then
-  echo "CONFIG_CURL=y" >> $config_host_mak
-  echo "CURL_CFLAGS=$curl_cflags" >> $config_host_mak
-  echo "CURL_LIBS=$curl_libs" >> $config_host_mak
-fi
 if test "$gtk" = "yes" ; then
   echo "CONFIG_GTK=y" >> $config_host_mak
   echo "GTK_CFLAGS=$gtk_cflags" >> $config_host_mak
@@ -6941,6 +6917,7 @@ NINJA=$ninja $meson setup \
         -Dvnc=$vnc -Dvnc_sasl=$vnc_sasl -Dvnc_jpeg=$vnc_jpeg -Dvnc_png=$vnc_png \
         -Dgettext=$gettext -Dxkbcommon=$xkbcommon -Du2f=$u2f -Dvirtiofsd=$virtiofsd \
         -Dcapstone=$capstone -Dslirp=$slirp -Dfdt=$fdt -Dbrlapi=$brlapi \
+        -Dcurl=$curl \
         -Diconv=$iconv -Dcurses=$curses -Dlibudev=$libudev\
         -Ddocs=$docs -Dsphinx_build=$sphinx_build -Dinstall_blobs=$blobs \
         -Dvhost_user_blk_server=$vhost_user_blk_server \
diff --git a/contrib/elf2dmp/meson.build b/contrib/elf2dmp/meson.build
index b3de173316..4d86cb390a 100644
--- a/contrib/elf2dmp/meson.build
+++ b/contrib/elf2dmp/meson.build
@@ -1,4 +1,4 @@
-if 'CONFIG_CURL' in config_host
+if curl.found()
   executable('elf2dmp', files('main.c', 'addrspace.c', 'download.c', 'pdb.c', 'qemu_elf.c'),
              dependencies: [glib, curl],
              install: true)
diff --git a/meson.build b/meson.build
index ecc95207e5..1d5b00aef1 100644
--- a/meson.build
+++ b/meson.build
@@ -392,9 +392,11 @@ if 'CONFIG_VIRGL' in config_host
                              link_args: config_host['VIRGL_LIBS'].split())
 endif
 curl = not_found
-if 'CONFIG_CURL' in config_host
-  curl = declare_dependency(compile_args: config_host['CURL_CFLAGS'].split(),
-                            link_args: config_host['CURL_LIBS'].split())
+if not get_option('curl').auto() or have_block
+  curl = dependency('libcurl', version: '>=7.29.0',
+                    method: 'pkg-config',
+                    required: get_option('curl'),
+                    static: enable_static)
 endif
 libudev = not_found
 if targetos == 'linux' and (have_system or have_tools)
@@ -872,6 +874,7 @@ config_host_data.set('CONFIG_COCOA', cocoa.found())
 config_host_data.set('CONFIG_LIBUDEV', libudev.found())
 config_host_data.set('CONFIG_MPATH', mpathpersist.found())
 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_SDL', sdl.found())
 config_host_data.set('CONFIG_SDL_IMAGE', sdl_image.found())
@@ -2161,7 +2164,7 @@ summary_info += {'iconv support':     iconv.found()}
 summary_info += {'curses support':    curses.found()}
 # TODO: add back version
 summary_info += {'virgl support':     config_host.has_key('CONFIG_VIRGL')}
-summary_info += {'curl support':      config_host.has_key('CONFIG_CURL')}
+summary_info += {'curl support':      curl.found()}
 summary_info += {'mingw32 support':   targetos == 'windows'}
 summary_info += {'Audio drivers':     config_host['CONFIG_AUDIO_DRIVERS']}
 summary_info += {'Block whitelist (rw)': config_host['CONFIG_BDRV_RW_WHITELIST']}
diff --git a/meson_options.txt b/meson_options.txt
index 62efe96a91..2b845ac62b 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -44,6 +44,8 @@ option('brlapi', type : 'feature', value : 'auto',
        description: 'brlapi character device driver')
 option('cocoa', type : 'feature', value : 'auto',
        description: 'Cocoa user interface (macOS only)')
+option('curl', type : 'feature', value : 'auto',
+       description: 'CURL block device driver')
 option('mpath', type : 'feature', value : 'auto',
        description: 'Multipath persistent reservation passthrough')
 option('iconv', type : 'feature', value : 'auto',
-- 
2.29.2




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

* [PULL 39/55] glusterfs: convert to meson
  2020-12-21 14:43 [PULL 00/55] Misc patches for 2020-12-21 Paolo Bonzini
                   ` (37 preceding siblings ...)
  2020-12-21 14:44 ` [PULL 38/55] curl: convert to meson Paolo Bonzini
@ 2020-12-21 14:44 ` Paolo Bonzini
  2020-12-21 14:44 ` [PULL 40/55] bzip2: " Paolo Bonzini
                   ` (16 subsequent siblings)
  55 siblings, 0 replies; 61+ messages in thread
From: Paolo Bonzini @ 2020-12-21 14:44 UTC (permalink / raw)
  To: qemu-devel

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

diff --git a/configure b/configure
index bb6b8eefdb..b7644cfbd9 100755
--- a/configure
+++ b/configure
@@ -414,13 +414,7 @@ crypto_afalg="no"
 cfi="false"
 cfi_debug="false"
 seccomp="$default_feature"
-glusterfs="$default_feature"
-glusterfs_xlator_opt="no"
-glusterfs_discard="no"
-glusterfs_fallocate="no"
-glusterfs_zerofill="no"
-glusterfs_ftruncate_has_stat="no"
-glusterfs_iocb_has_stat="no"
+glusterfs="auto"
 gtk="$default_feature"
 gtk_gl="no"
 tls_priority="NORMAL"
@@ -1365,7 +1359,7 @@ for opt do
   ;;
   --disable-seccomp) seccomp="no"
   ;;
-  --disable-glusterfs) glusterfs="no"
+  --disable-glusterfs) glusterfs="disabled"
   ;;
   --disable-avx2) avx2_opt="no"
   ;;
@@ -1376,7 +1370,7 @@ for opt do
   --enable-avx512f) avx512f_opt="yes"
   ;;
 
-  --enable-glusterfs) glusterfs="yes"
+  --enable-glusterfs) glusterfs="enabled"
   ;;
   --disable-virtio-blk-data-plane|--enable-virtio-blk-data-plane)
       echo "$0: $opt is obsolete, virtio-blk data-plane is always on" >&2
@@ -3869,64 +3863,6 @@ if test "$libxml2" != "no" ; then
     fi
 fi
 
-##########################################
-# glusterfs probe
-if test "$glusterfs" != "no" ; then
-  if $pkg_config --atleast-version=3 glusterfs-api; then
-    glusterfs="yes"
-    glusterfs_cflags=$($pkg_config --cflags glusterfs-api)
-    glusterfs_libs=$($pkg_config --libs glusterfs-api)
-    if $pkg_config --atleast-version=4 glusterfs-api; then
-      glusterfs_xlator_opt="yes"
-    fi
-    if $pkg_config --atleast-version=5 glusterfs-api; then
-      glusterfs_discard="yes"
-    fi
-    if $pkg_config --atleast-version=6 glusterfs-api; then
-      glusterfs_fallocate="yes"
-      glusterfs_zerofill="yes"
-    fi
-    cat > $TMPC << EOF
-#include <glusterfs/api/glfs.h>
-
-int
-main(void)
-{
-	/* new glfs_ftruncate() passes two additional args */
-	return glfs_ftruncate(NULL, 0, NULL, NULL);
-}
-EOF
-    if compile_prog "$glusterfs_cflags" "$glusterfs_libs" ; then
-      glusterfs_ftruncate_has_stat="yes"
-    fi
-    cat > $TMPC << EOF
-#include <glusterfs/api/glfs.h>
-
-/* new glfs_io_cbk() passes two additional glfs_stat structs */
-static void
-glusterfs_iocb(glfs_fd_t *fd, ssize_t ret, struct glfs_stat *prestat, struct glfs_stat *poststat, void *data)
-{}
-
-int
-main(void)
-{
-	glfs_io_cbk iocb = &glusterfs_iocb;
-	iocb(NULL, 0 , NULL, NULL, NULL);
-	return 0;
-}
-EOF
-    if compile_prog "$glusterfs_cflags" "$glusterfs_libs" ; then
-      glusterfs_iocb_has_stat="yes"
-    fi
-  else
-    if test "$glusterfs" = "yes" ; then
-      feature_not_found "GlusterFS backend support" \
-          "Install glusterfs-api devel >= 3"
-    fi
-    glusterfs="no"
-  fi
-fi
-
 # Check for inotify functions when we are building linux-user
 # emulator.  This is done because older glibc versions don't
 # have syscall stubs for these implemented.  In that case we
@@ -6413,36 +6349,6 @@ if test "$getauxval" = "yes" ; then
   echo "CONFIG_GETAUXVAL=y" >> $config_host_mak
 fi
 
-if test "$glusterfs" = "yes" ; then
-  echo "CONFIG_GLUSTERFS=y" >> $config_host_mak
-  echo "GLUSTERFS_CFLAGS=$glusterfs_cflags" >> $config_host_mak
-  echo "GLUSTERFS_LIBS=$glusterfs_libs" >> $config_host_mak
-fi
-
-if test "$glusterfs_xlator_opt" = "yes" ; then
-  echo "CONFIG_GLUSTERFS_XLATOR_OPT=y" >> $config_host_mak
-fi
-
-if test "$glusterfs_discard" = "yes" ; then
-  echo "CONFIG_GLUSTERFS_DISCARD=y" >> $config_host_mak
-fi
-
-if test "$glusterfs_fallocate" = "yes" ; then
-  echo "CONFIG_GLUSTERFS_FALLOCATE=y" >> $config_host_mak
-fi
-
-if test "$glusterfs_zerofill" = "yes" ; then
-  echo "CONFIG_GLUSTERFS_ZEROFILL=y" >> $config_host_mak
-fi
-
-if test "$glusterfs_ftruncate_has_stat" = "yes" ; then
-  echo "CONFIG_GLUSTERFS_FTRUNCATE_HAS_STAT=y" >> $config_host_mak
-fi
-
-if test "$glusterfs_iocb_has_stat" = "yes" ; then
-  echo "CONFIG_GLUSTERFS_IOCB_HAS_STAT=y" >> $config_host_mak
-fi
-
 if test "$libssh" = "yes" ; then
   echo "CONFIG_LIBSSH=y" >> $config_host_mak
   echo "LIBSSH_CFLAGS=$libssh_cflags" >> $config_host_mak
@@ -6917,7 +6823,7 @@ NINJA=$ninja $meson setup \
         -Dvnc=$vnc -Dvnc_sasl=$vnc_sasl -Dvnc_jpeg=$vnc_jpeg -Dvnc_png=$vnc_png \
         -Dgettext=$gettext -Dxkbcommon=$xkbcommon -Du2f=$u2f -Dvirtiofsd=$virtiofsd \
         -Dcapstone=$capstone -Dslirp=$slirp -Dfdt=$fdt -Dbrlapi=$brlapi \
-        -Dcurl=$curl \
+        -Dcurl=$curl -Dglusterfs=$glusterfs \
         -Diconv=$iconv -Dcurses=$curses -Dlibudev=$libudev\
         -Ddocs=$docs -Dsphinx_build=$sphinx_build -Dinstall_blobs=$blobs \
         -Dvhost_user_blk_server=$vhost_user_blk_server \
diff --git a/meson.build b/meson.build
index 1d5b00aef1..db52ac6bdf 100644
--- a/meson.build
+++ b/meson.build
@@ -613,9 +613,40 @@ if 'CONFIG_RBD' in config_host
   rbd = declare_dependency(link_args: config_host['RBD_LIBS'].split())
 endif
 glusterfs = not_found
-if 'CONFIG_GLUSTERFS' in config_host
-  glusterfs = declare_dependency(compile_args: config_host['GLUSTERFS_CFLAGS'].split(),
-                                 link_args: config_host['GLUSTERFS_LIBS'].split())
+glusterfs_ftruncate_has_stat = false
+glusterfs_iocb_has_stat = false
+if not get_option('glusterfs').auto() or have_block
+  glusterfs = dependency('glusterfs-api', version: '>=3',
+                         required: get_option('glusterfs'),
+                         method: 'pkg-config', static: enable_static)
+  if glusterfs.found()
+    glusterfs_ftruncate_has_stat = cc.links('''
+      #include <glusterfs/api/glfs.h>
+
+      int
+      main(void)
+      {
+          /* new glfs_ftruncate() passes two additional args */
+          return glfs_ftruncate(NULL, 0, NULL, NULL);
+      }
+    ''', dependencies: glusterfs)
+    glusterfs_iocb_has_stat = cc.links('''
+      #include <glusterfs/api/glfs.h>
+
+      /* new glfs_io_cbk() passes two additional glfs_stat structs */
+      static void
+      glusterfs_iocb(glfs_fd_t *fd, ssize_t ret, struct glfs_stat *prestat, struct glfs_stat *poststat, void *data)
+      {}
+
+      int
+      main(void)
+      {
+          glfs_io_cbk iocb = &glusterfs_iocb;
+          iocb(NULL, 0 , NULL, NULL, NULL);
+          return 0;
+      }
+    ''', dependencies: glusterfs)
+  endif
 endif
 libssh = not_found
 if 'CONFIG_LIBSSH' in config_host
@@ -876,6 +907,15 @@ config_host_data.set('CONFIG_MPATH', mpathpersist.found())
 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_GLUSTERFS', glusterfs.found())
+if glusterfs.found()
+  config_host_data.set('CONFIG_GLUSTERFS_XLATOR_OPT', glusterfs.version().version_compare('>=4'))
+  config_host_data.set('CONFIG_GLUSTERFS_DISCARD', glusterfs.version().version_compare('>=5'))
+  config_host_data.set('CONFIG_GLUSTERFS_FALLOCATE', glusterfs.version().version_compare('>=6'))
+  config_host_data.set('CONFIG_GLUSTERFS_ZEROFILL', glusterfs.version().version_compare('>=6'))
+  config_host_data.set('CONFIG_GLUSTERFS_FTRUNCATE_HAS_STAT', glusterfs_ftruncate_has_stat)
+  config_host_data.set('CONFIG_GLUSTERFS_IOCB_HAS_STAT', glusterfs_iocb_has_stat)
+endif
 config_host_data.set('CONFIG_SDL', sdl.found())
 config_host_data.set('CONFIG_SDL_IMAGE', sdl_image.found())
 config_host_data.set('CONFIG_VHOST_USER_BLK_SERVER', have_vhost_user_blk_server)
@@ -2253,7 +2293,7 @@ summary_info += {'coroutine pool':    config_host['CONFIG_COROUTINE_POOL'] == '1
 summary_info += {'debug stack usage': config_host.has_key('CONFIG_DEBUG_STACK_USAGE')}
 summary_info += {'mutex debugging':   config_host.has_key('CONFIG_DEBUG_MUTEX')}
 summary_info += {'crypto afalg':      config_host.has_key('CONFIG_AF_ALG')}
-summary_info += {'GlusterFS support': config_host.has_key('CONFIG_GLUSTERFS')}
+summary_info += {'GlusterFS support': glusterfs.found()}
 summary_info += {'gcov':              get_option('b_coverage')}
 summary_info += {'TPM support':       config_host.has_key('CONFIG_TPM')}
 summary_info += {'libssh support':    config_host.has_key('CONFIG_LIBSSH')}
diff --git a/meson_options.txt b/meson_options.txt
index 2b845ac62b..b5d84bb88b 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -46,6 +46,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('glusterfs', type : 'feature', value : 'auto',
+       description: 'Glusterfs block device driver')
 option('mpath', type : 'feature', value : 'auto',
        description: 'Multipath persistent reservation passthrough')
 option('iconv', type : 'feature', value : 'auto',
-- 
2.29.2




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

* [PULL 40/55] bzip2: convert to meson
  2020-12-21 14:43 [PULL 00/55] Misc patches for 2020-12-21 Paolo Bonzini
                   ` (38 preceding siblings ...)
  2020-12-21 14:44 ` [PULL 39/55] glusterfs: " Paolo Bonzini
@ 2020-12-21 14:44 ` Paolo Bonzini
  2020-12-21 14:44 ` [PULL 41/55] libiscsi: " Paolo Bonzini
                   ` (15 subsequent siblings)
  55 siblings, 0 replies; 61+ messages in thread
From: Paolo Bonzini @ 2020-12-21 14:44 UTC (permalink / raw)
  To: qemu-devel

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

diff --git a/configure b/configure
index b7644cfbd9..3d65c1e196 100755
--- a/configure
+++ b/configure
@@ -395,7 +395,7 @@ avx2_opt="$default_feature"
 capstone="auto"
 lzo="$default_feature"
 snappy="$default_feature"
-bzip2="$default_feature"
+bzip2="auto"
 lzfse="$default_feature"
 zstd="$default_feature"
 guest_agent="$default_feature"
@@ -1319,9 +1319,9 @@ for opt do
   ;;
   --enable-snappy) snappy="yes"
   ;;
-  --disable-bzip2) bzip2="no"
+  --disable-bzip2) bzip2="disabled"
   ;;
-  --enable-bzip2) bzip2="yes"
+  --enable-bzip2) bzip2="enabled"
   ;;
   --enable-lzfse) lzfse="yes"
   ;;
@@ -2494,24 +2494,6 @@ EOF
     fi
 fi
 
-##########################################
-# bzip2 check
-
-if test "$bzip2" != "no" ; then
-    cat > $TMPC << EOF
-#include <bzlib.h>
-int main(void) { BZ2_bzlibVersion(); return 0; }
-EOF
-    if compile_prog "" "-lbz2" ; then
-        bzip2="yes"
-    else
-        if test "$bzip2" = "yes"; then
-            feature_not_found "libbzip2" "Install libbzip2 devel"
-        fi
-        bzip2="no"
-    fi
-fi
-
 ##########################################
 # lzfse check
 
@@ -6236,11 +6218,6 @@ if test "$snappy" = "yes" ; then
   echo "SNAPPY_LIBS=$snappy_libs" >> $config_host_mak
 fi
 
-if test "$bzip2" = "yes" ; then
-  echo "CONFIG_BZIP2=y" >> $config_host_mak
-  echo "BZIP2_LIBS=-lbz2" >> $config_host_mak
-fi
-
 if test "$lzfse" = "yes" ; then
   echo "CONFIG_LZFSE=y" >> $config_host_mak
   echo "LZFSE_LIBS=-llzfse" >> $config_host_mak
@@ -6823,7 +6800,7 @@ NINJA=$ninja $meson setup \
         -Dvnc=$vnc -Dvnc_sasl=$vnc_sasl -Dvnc_jpeg=$vnc_jpeg -Dvnc_png=$vnc_png \
         -Dgettext=$gettext -Dxkbcommon=$xkbcommon -Du2f=$u2f -Dvirtiofsd=$virtiofsd \
         -Dcapstone=$capstone -Dslirp=$slirp -Dfdt=$fdt -Dbrlapi=$brlapi \
-        -Dcurl=$curl -Dglusterfs=$glusterfs \
+        -Dcurl=$curl -Dglusterfs=$glusterfs -Dbzip2=$bzip2 \
         -Diconv=$iconv -Dcurses=$curses -Dlibudev=$libudev\
         -Ddocs=$docs -Dsphinx_build=$sphinx_build -Dinstall_blobs=$blobs \
         -Dvhost_user_blk_server=$vhost_user_blk_server \
diff --git a/meson.build b/meson.build
index db52ac6bdf..66e35598ce 100644
--- a/meson.build
+++ b/meson.build
@@ -654,8 +654,20 @@ if 'CONFIG_LIBSSH' in config_host
                               link_args: config_host['LIBSSH_LIBS'].split())
 endif
 libbzip2 = not_found
-if 'CONFIG_BZIP2' in config_host
-  libbzip2 = declare_dependency(link_args: config_host['BZIP2_LIBS'].split())
+if not get_option('bzip2').auto() or have_block
+  libbzip2 = cc.find_library('bz2', has_headers: ['bzlib.h'],
+                             required: get_option('bzip2'),
+                             static: enable_static)
+  if libbzip2.found() and not cc.links('''
+     #include <bzlib.h>
+     int main(void) { BZ2_bzlibVersion(); return 0; }''', dependencies: libbzip2)
+    libbzip2 = not_found
+    if get_option('bzip2').enabled()
+      error('could not link libbzip2')
+    else
+      warning('could not link libbzip2, disabling')
+    endif
+  endif
 endif
 liblzfse = not_found
 if 'CONFIG_LZFSE' in config_host
@@ -2301,7 +2313,7 @@ summary_info += {'QOM debugging':     config_host.has_key('CONFIG_QOM_CAST_DEBUG
 summary_info += {'Live block migration': config_host.has_key('CONFIG_LIVE_BLOCK_MIGRATION')}
 summary_info += {'lzo support':       config_host.has_key('CONFIG_LZO')}
 summary_info += {'snappy support':    config_host.has_key('CONFIG_SNAPPY')}
-summary_info += {'bzip2 support':     config_host.has_key('CONFIG_BZIP2')}
+summary_info += {'bzip2 support':     libbzip2.found()}
 summary_info += {'lzfse support':     config_host.has_key('CONFIG_LZFSE')}
 summary_info += {'zstd support':      config_host.has_key('CONFIG_ZSTD')}
 summary_info += {'NUMA host support': config_host.has_key('CONFIG_NUMA')}
diff --git a/meson_options.txt b/meson_options.txt
index b5d84bb88b..fd16f3b399 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -42,6 +42,8 @@ option('cfi_debug', type: 'boolean', value: 'false',
 
 option('brlapi', type : 'feature', value : 'auto',
        description: 'brlapi character device driver')
+option('bzip2', type : 'feature', value : 'auto',
+       description: 'bzip2 support for DMG images')
 option('cocoa', type : 'feature', value : 'auto',
        description: 'Cocoa user interface (macOS only)')
 option('curl', type : 'feature', value : 'auto',
-- 
2.29.2




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

* [PULL 41/55] libiscsi: convert to meson
  2020-12-21 14:43 [PULL 00/55] Misc patches for 2020-12-21 Paolo Bonzini
                   ` (39 preceding siblings ...)
  2020-12-21 14:44 ` [PULL 40/55] bzip2: " Paolo Bonzini
@ 2020-12-21 14:44 ` Paolo Bonzini
  2020-12-21 14:44 ` [PULL 42/55] libnfs: " Paolo Bonzini
                   ` (14 subsequent siblings)
  55 siblings, 0 replies; 61+ messages in thread
From: Paolo Bonzini @ 2020-12-21 14:44 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 block/meson.build                   |  2 +-
 configure                           | 29 ++++-------------------------
 contrib/vhost-user-scsi/meson.build |  2 +-
 meson.build                         | 10 ++++++----
 meson_options.txt                   |  2 ++
 5 files changed, 14 insertions(+), 31 deletions(-)

diff --git a/block/meson.build b/block/meson.build
index b02cb14aad..134034abb4 100644
--- a/block/meson.build
+++ b/block/meson.build
@@ -59,7 +59,7 @@ block_ss.add(when: 'CONFIG_QED', if_true: files(
 block_ss.add(when: [libxml2, 'CONFIG_PARALLELS'], if_true: files('parallels.c'))
 block_ss.add(when: 'CONFIG_WIN32', if_true: files('file-win32.c', 'win32-aio.c'))
 block_ss.add(when: 'CONFIG_POSIX', if_true: [files('file-posix.c'), coref, iokit])
-block_ss.add(when: 'CONFIG_LIBISCSI', if_true: files('iscsi-opts.c'))
+block_ss.add(when: libiscsi, if_true: files('iscsi-opts.c'))
 block_ss.add(when: 'CONFIG_LINUX', if_true: files('nvme.c'))
 block_ss.add(when: 'CONFIG_REPLICATION', if_true: files('replication.c'))
 block_ss.add(when: 'CONFIG_SHEEPDOG', if_true: files('sheepdog.c'))
diff --git a/configure b/configure
index 3d65c1e196..30084af631 100755
--- a/configure
+++ b/configure
@@ -405,7 +405,7 @@ guest_agent_msi="$default_feature"
 vss_win32_sdk="$default_feature"
 win_sdk="no"
 want_tools="$default_feature"
-libiscsi="$default_feature"
+libiscsi="auto"
 libnfs="$default_feature"
 coroutine=""
 coroutine_pool="$default_feature"
@@ -1138,9 +1138,9 @@ for opt do
   ;;
   --enable-spice) spice="yes"
   ;;
-  --disable-libiscsi) libiscsi="no"
+  --disable-libiscsi) libiscsi="disabled"
   ;;
-  --enable-libiscsi) libiscsi="yes"
+  --enable-libiscsi) libiscsi="enabled"
   ;;
   --disable-libnfs) libnfs="no"
   ;;
@@ -4313,21 +4313,6 @@ if compile_prog "" "" ; then
   bswap_h=yes
 fi
 
-##########################################
-# Do we have libiscsi >= 1.9.0
-if test "$libiscsi" != "no" ; then
-  if $pkg_config --atleast-version=1.9.0 libiscsi; then
-    libiscsi="yes"
-    libiscsi_cflags=$($pkg_config --cflags libiscsi)
-    libiscsi_libs=$($pkg_config --libs libiscsi)
-  else
-    if test "$libiscsi" = "yes" ; then
-      feature_not_found "libiscsi" "Install libiscsi >= 1.9.0"
-    fi
-    libiscsi="no"
-  fi
-fi
-
 ##########################################
 # Do we need librt
 # uClibc provides 2 versions of clock_gettime(), one with realtime
@@ -6229,12 +6214,6 @@ if test "$zstd" = "yes" ; then
   echo "ZSTD_LIBS=$zstd_libs" >> $config_host_mak
 fi
 
-if test "$libiscsi" = "yes" ; then
-  echo "CONFIG_LIBISCSI=y" >> $config_host_mak
-  echo "LIBISCSI_CFLAGS=$libiscsi_cflags" >> $config_host_mak
-  echo "LIBISCSI_LIBS=$libiscsi_libs" >> $config_host_mak
-fi
-
 if test "$libnfs" = "yes" ; then
   echo "CONFIG_LIBNFS=y" >> $config_host_mak
   echo "LIBNFS_LIBS=$libnfs_libs" >> $config_host_mak
@@ -6800,7 +6779,7 @@ NINJA=$ninja $meson setup \
         -Dvnc=$vnc -Dvnc_sasl=$vnc_sasl -Dvnc_jpeg=$vnc_jpeg -Dvnc_png=$vnc_png \
         -Dgettext=$gettext -Dxkbcommon=$xkbcommon -Du2f=$u2f -Dvirtiofsd=$virtiofsd \
         -Dcapstone=$capstone -Dslirp=$slirp -Dfdt=$fdt -Dbrlapi=$brlapi \
-        -Dcurl=$curl -Dglusterfs=$glusterfs -Dbzip2=$bzip2 \
+        -Dcurl=$curl -Dglusterfs=$glusterfs -Dbzip2=$bzip2 -Dlibiscsi=$libiscsi \
         -Diconv=$iconv -Dcurses=$curses -Dlibudev=$libudev\
         -Ddocs=$docs -Dsphinx_build=$sphinx_build -Dinstall_blobs=$blobs \
         -Dvhost_user_blk_server=$vhost_user_blk_server \
diff --git a/contrib/vhost-user-scsi/meson.build b/contrib/vhost-user-scsi/meson.build
index 044c50bf43..cc893f6f20 100644
--- a/contrib/vhost-user-scsi/meson.build
+++ b/contrib/vhost-user-scsi/meson.build
@@ -1,4 +1,4 @@
-if 'CONFIG_LIBISCSI' in config_host
+if libiscsi.found()
   executable('vhost-user-scsi', files('vhost-user-scsi.c'),
              dependencies: [qemuutil, libiscsi, vhost_user],
              build_by_default: targetos == 'linux',
diff --git a/meson.build b/meson.build
index 66e35598ce..d1cbea169c 100644
--- a/meson.build
+++ b/meson.build
@@ -372,9 +372,10 @@ if 'CONFIG_PLUGIN' in config_host
   libdl = cc.find_library('dl', required: true)
 endif
 libiscsi = not_found
-if 'CONFIG_LIBISCSI' in config_host
-  libiscsi = declare_dependency(compile_args: config_host['LIBISCSI_CFLAGS'].split(),
-                                link_args: config_host['LIBISCSI_LIBS'].split())
+if not get_option('libiscsi').auto() or have_block
+  libiscsi = dependency('libiscsi', version: '>=1.9.0',
+                         required: get_option('libiscsi'),
+                         method: 'pkg-config', static: enable_static)
 endif
 zstd = not_found
 if 'CONFIG_ZSTD' in config_host
@@ -928,6 +929,7 @@ if glusterfs.found()
   config_host_data.set('CONFIG_GLUSTERFS_FTRUNCATE_HAS_STAT', glusterfs_ftruncate_has_stat)
   config_host_data.set('CONFIG_GLUSTERFS_IOCB_HAS_STAT', glusterfs_iocb_has_stat)
 endif
+config_host_data.set('CONFIG_LIBISCSI', libiscsi.found())
 config_host_data.set('CONFIG_SDL', sdl.found())
 config_host_data.set('CONFIG_SDL_IMAGE', sdl_image.found())
 config_host_data.set('CONFIG_VHOST_USER_BLK_SERVER', have_vhost_user_blk_server)
@@ -2286,7 +2288,7 @@ summary_info += {'libusb':            config_host.has_key('CONFIG_USB_LIBUSB')}
 summary_info += {'usb net redir':     config_host.has_key('CONFIG_USB_REDIR')}
 summary_info += {'OpenGL support':    config_host.has_key('CONFIG_OPENGL')}
 summary_info += {'OpenGL dmabufs':    config_host.has_key('CONFIG_OPENGL_DMABUF')}
-summary_info += {'libiscsi support':  config_host.has_key('CONFIG_LIBISCSI')}
+summary_info += {'libiscsi support':  libiscsi.found()}
 summary_info += {'libnfs support':    config_host.has_key('CONFIG_LIBNFS')}
 summary_info += {'build guest agent': config_host.has_key('CONFIG_GUEST_AGENT')}
 if targetos == 'windows'
diff --git a/meson_options.txt b/meson_options.txt
index fd16f3b399..b562d4f1a6 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -50,6 +50,8 @@ option('curl', type : 'feature', value : 'auto',
        description: 'CURL block device driver')
 option('glusterfs', type : 'feature', value : 'auto',
        description: 'Glusterfs block device driver')
+option('libiscsi', type : 'feature', value : 'auto',
+       description: 'libiscsi userspace initiator')
 option('mpath', type : 'feature', value : 'auto',
        description: 'Multipath persistent reservation passthrough')
 option('iconv', type : 'feature', value : 'auto',
-- 
2.29.2




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

* [PULL 42/55] libnfs: convert to meson
  2020-12-21 14:43 [PULL 00/55] Misc patches for 2020-12-21 Paolo Bonzini
                   ` (40 preceding siblings ...)
  2020-12-21 14:44 ` [PULL 41/55] libiscsi: " Paolo Bonzini
@ 2020-12-21 14:44 ` Paolo Bonzini
  2020-12-21 14:44 ` [PULL 43/55] libssh: " Paolo Bonzini
                   ` (13 subsequent siblings)
  55 siblings, 0 replies; 61+ messages in thread
From: Paolo Bonzini @ 2020-12-21 14:44 UTC (permalink / raw)
  To: qemu-devel

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

diff --git a/configure b/configure
index 30084af631..9b38368427 100755
--- a/configure
+++ b/configure
@@ -406,7 +406,7 @@ vss_win32_sdk="$default_feature"
 win_sdk="no"
 want_tools="$default_feature"
 libiscsi="auto"
-libnfs="$default_feature"
+libnfs="auto"
 coroutine=""
 coroutine_pool="$default_feature"
 debug_stack_usage="no"
@@ -1142,9 +1142,9 @@ for opt do
   ;;
   --enable-libiscsi) libiscsi="enabled"
   ;;
-  --disable-libnfs) libnfs="no"
+  --disable-libnfs) libnfs="disabled"
   ;;
-  --enable-libnfs) libnfs="yes"
+  --enable-libnfs) libnfs="enabled"
   ;;
   --enable-profiler) profiler="yes"
   ;;
@@ -5559,20 +5559,6 @@ if test "$have_ubsan" = "yes"; then
   QEMU_LDFLAGS="-fsanitize=undefined $QEMU_LDFLAGS"
 fi
 
-##########################################
-# Do we have libnfs
-if test "$libnfs" != "no" ; then
-  if $pkg_config --atleast-version=1.9.3 libnfs; then
-    libnfs="yes"
-    libnfs_libs=$($pkg_config --libs libnfs)
-  else
-    if test "$libnfs" = "yes" ; then
-      feature_not_found "libnfs" "Install libnfs devel >= 1.9.3"
-    fi
-    libnfs="no"
-  fi
-fi
-
 ##########################################
 
 # Exclude --warn-common with TSan to suppress warnings from the TSan libraries.
@@ -6214,11 +6200,6 @@ if test "$zstd" = "yes" ; then
   echo "ZSTD_LIBS=$zstd_libs" >> $config_host_mak
 fi
 
-if test "$libnfs" = "yes" ; then
-  echo "CONFIG_LIBNFS=y" >> $config_host_mak
-  echo "LIBNFS_LIBS=$libnfs_libs" >> $config_host_mak
-fi
-
 if test "$seccomp" = "yes"; then
   echo "CONFIG_SECCOMP=y" >> $config_host_mak
   echo "SECCOMP_CFLAGS=$seccomp_cflags" >> $config_host_mak
@@ -6780,7 +6761,7 @@ NINJA=$ninja $meson setup \
         -Dgettext=$gettext -Dxkbcommon=$xkbcommon -Du2f=$u2f -Dvirtiofsd=$virtiofsd \
         -Dcapstone=$capstone -Dslirp=$slirp -Dfdt=$fdt -Dbrlapi=$brlapi \
         -Dcurl=$curl -Dglusterfs=$glusterfs -Dbzip2=$bzip2 -Dlibiscsi=$libiscsi \
-        -Diconv=$iconv -Dcurses=$curses -Dlibudev=$libudev\
+        -Dlibnfs=$libnfs -Diconv=$iconv -Dcurses=$curses -Dlibudev=$libudev\
         -Ddocs=$docs -Dsphinx_build=$sphinx_build -Dinstall_blobs=$blobs \
         -Dvhost_user_blk_server=$vhost_user_blk_server \
         -Dfuse=$fuse -Dfuse_lseek=$fuse_lseek \
diff --git a/meson.build b/meson.build
index d1cbea169c..9ed3ee31f9 100644
--- a/meson.build
+++ b/meson.build
@@ -319,8 +319,10 @@ if 'CONFIG_LIBXML2' in config_host
                                link_args: config_host['LIBXML2_LIBS'].split())
 endif
 libnfs = not_found
-if 'CONFIG_LIBNFS' in config_host
-  libnfs = declare_dependency(link_args: config_host['LIBNFS_LIBS'].split())
+if not get_option('libnfs').auto() or have_block
+  libnfs = dependency('libnfs', version: '>=1.9.3',
+                      required: get_option('libnfs'),
+                      method: 'pkg-config', static: enable_static)
 endif
 libattr = not_found
 if 'CONFIG_ATTR' in config_host
@@ -930,6 +932,7 @@ if glusterfs.found()
   config_host_data.set('CONFIG_GLUSTERFS_IOCB_HAS_STAT', glusterfs_iocb_has_stat)
 endif
 config_host_data.set('CONFIG_LIBISCSI', libiscsi.found())
+config_host_data.set('CONFIG_LIBNFS', libnfs.found())
 config_host_data.set('CONFIG_SDL', sdl.found())
 config_host_data.set('CONFIG_SDL_IMAGE', sdl_image.found())
 config_host_data.set('CONFIG_VHOST_USER_BLK_SERVER', have_vhost_user_blk_server)
@@ -2289,7 +2292,7 @@ summary_info += {'usb net redir':     config_host.has_key('CONFIG_USB_REDIR')}
 summary_info += {'OpenGL support':    config_host.has_key('CONFIG_OPENGL')}
 summary_info += {'OpenGL dmabufs':    config_host.has_key('CONFIG_OPENGL_DMABUF')}
 summary_info += {'libiscsi support':  libiscsi.found()}
-summary_info += {'libnfs support':    config_host.has_key('CONFIG_LIBNFS')}
+summary_info += {'libnfs support':    libnfs.found()}
 summary_info += {'build guest agent': config_host.has_key('CONFIG_GUEST_AGENT')}
 if targetos == 'windows'
   if 'WIN_SDK' in config_host
diff --git a/meson_options.txt b/meson_options.txt
index b562d4f1a6..4535bc4dc2 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -52,6 +52,8 @@ option('glusterfs', type : 'feature', value : 'auto',
        description: 'Glusterfs block device driver')
 option('libiscsi', type : 'feature', value : 'auto',
        description: 'libiscsi userspace initiator')
+option('libnfs', type : 'feature', value : 'auto',
+       description: 'libnfs block device driver')
 option('mpath', type : 'feature', value : 'auto',
        description: 'Multipath persistent reservation passthrough')
 option('iconv', type : 'feature', value : 'auto',
-- 
2.29.2




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

* [PULL 43/55] libssh: convert to meson
  2020-12-21 14:43 [PULL 00/55] Misc patches for 2020-12-21 Paolo Bonzini
                   ` (41 preceding siblings ...)
  2020-12-21 14:44 ` [PULL 42/55] libnfs: " Paolo Bonzini
@ 2020-12-21 14:44 ` Paolo Bonzini
  2020-12-21 14:44 ` [PULL 44/55] rbd: " Paolo Bonzini
                   ` (12 subsequent siblings)
  55 siblings, 0 replies; 61+ messages in thread
From: Paolo Bonzini @ 2020-12-21 14:44 UTC (permalink / raw)
  To: qemu-devel

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

diff --git a/configure b/configure
index 9b38368427..0350b59624 100755
--- a/configure
+++ b/configure
@@ -429,7 +429,7 @@ auth_pam="$default_feature"
 vte="$default_feature"
 virglrenderer="$default_feature"
 tpm="$default_feature"
-libssh="$default_feature"
+libssh="auto"
 live_block_migration=${default_feature:-yes}
 numa="$default_feature"
 tcmalloc="no"
@@ -1423,9 +1423,9 @@ for opt do
   ;;
   --enable-tpm) tpm="yes"
   ;;
-  --disable-libssh) libssh="no"
+  --disable-libssh) libssh="disabled"
   ;;
-  --enable-libssh) libssh="yes"
+  --enable-libssh) libssh="enabled"
   ;;
   --disable-live-block-migration) live_block_migration="no"
   ;;
@@ -3628,38 +3628,6 @@ EOF
   fi
 fi
 
-##########################################
-# libssh probe
-if test "$libssh" != "no" ; then
-  if $pkg_config --exists libssh; then
-    libssh_cflags=$($pkg_config libssh --cflags)
-    libssh_libs=$($pkg_config libssh --libs)
-    libssh=yes
-  else
-    if test "$libssh" = "yes" ; then
-      error_exit "libssh required for --enable-libssh"
-    fi
-    libssh=no
-  fi
-fi
-
-##########################################
-# Check for libssh 0.8
-# This is done like this instead of using the LIBSSH_VERSION_* and
-# SSH_VERSION_* macros because some distributions in the past shipped
-# snapshots of the future 0.8 from Git, and those snapshots did not
-# have updated version numbers (still referring to 0.7.0).
-
-if test "$libssh" = "yes"; then
-  cat > $TMPC <<EOF
-#include <libssh/libssh.h>
-int main(void) { return ssh_get_server_publickey(NULL, NULL); }
-EOF
-  if compile_prog "$libssh_cflags" "$libssh_libs"; then
-    libssh_cflags="-DHAVE_LIBSSH_0_8 $libssh_cflags"
-  fi
-fi
-
 ##########################################
 # linux-aio probe
 
@@ -6286,12 +6254,6 @@ if test "$getauxval" = "yes" ; then
   echo "CONFIG_GETAUXVAL=y" >> $config_host_mak
 fi
 
-if test "$libssh" = "yes" ; then
-  echo "CONFIG_LIBSSH=y" >> $config_host_mak
-  echo "LIBSSH_CFLAGS=$libssh_cflags" >> $config_host_mak
-  echo "LIBSSH_LIBS=$libssh_libs" >> $config_host_mak
-fi
-
 if test "$live_block_migration" = "yes" ; then
   echo "CONFIG_LIVE_BLOCK_MIGRATION=y" >> $config_host_mak
 fi
@@ -6762,6 +6724,7 @@ NINJA=$ninja $meson setup \
         -Dcapstone=$capstone -Dslirp=$slirp -Dfdt=$fdt -Dbrlapi=$brlapi \
         -Dcurl=$curl -Dglusterfs=$glusterfs -Dbzip2=$bzip2 -Dlibiscsi=$libiscsi \
         -Dlibnfs=$libnfs -Diconv=$iconv -Dcurses=$curses -Dlibudev=$libudev\
+        -Dlibssh=$libssh \
         -Ddocs=$docs -Dsphinx_build=$sphinx_build -Dinstall_blobs=$blobs \
         -Dvhost_user_blk_server=$vhost_user_blk_server \
         -Dfuse=$fuse -Dfuse_lseek=$fuse_lseek \
diff --git a/meson.build b/meson.build
index 9ed3ee31f9..e448624212 100644
--- a/meson.build
+++ b/meson.build
@@ -652,9 +652,21 @@ if not get_option('glusterfs').auto() or have_block
   endif
 endif
 libssh = not_found
-if 'CONFIG_LIBSSH' in config_host
-  libssh = declare_dependency(compile_args: config_host['LIBSSH_CFLAGS'].split(),
-                              link_args: config_host['LIBSSH_LIBS'].split())
+have_libssh_0_8 = false
+if not get_option('libssh').auto() or have_block
+  libssh = dependency('libssh',
+                      required: get_option('libssh'),
+                      method: 'pkg-config', static: enable_static)
+  # This is done like this instead of using the LIBSSH_VERSION_* and
+  # SSH_VERSION_* macros because some distributions in the past shipped
+  # snapshots of the future 0.8 from Git, and those snapshots did not
+  # have updated version numbers (still referring to 0.7.0).
+  if libssh.found()
+    have_libssh_0_8 = cc.links('''
+      #include <libssh/libssh.h>
+      int main(void) { return ssh_get_server_publickey(NULL, NULL); }
+    ''', dependencies: libssh)
+  endif
 endif
 libbzip2 = not_found
 if not get_option('bzip2').auto() or have_block
@@ -933,6 +945,8 @@ if glusterfs.found()
 endif
 config_host_data.set('CONFIG_LIBISCSI', libiscsi.found())
 config_host_data.set('CONFIG_LIBNFS', libnfs.found())
+config_host_data.set('CONFIG_LIBSSH', libssh.found())
+config_host_data.set('HAVE_LIBSSH_0_8', have_libssh_0_8)
 config_host_data.set('CONFIG_SDL', sdl.found())
 config_host_data.set('CONFIG_SDL_IMAGE', sdl_image.found())
 config_host_data.set('CONFIG_VHOST_USER_BLK_SERVER', have_vhost_user_blk_server)
@@ -2313,7 +2327,7 @@ summary_info += {'crypto afalg':      config_host.has_key('CONFIG_AF_ALG')}
 summary_info += {'GlusterFS support': glusterfs.found()}
 summary_info += {'gcov':              get_option('b_coverage')}
 summary_info += {'TPM support':       config_host.has_key('CONFIG_TPM')}
-summary_info += {'libssh support':    config_host.has_key('CONFIG_LIBSSH')}
+summary_info += {'libssh support':    libssh.found()}
 summary_info += {'QOM debugging':     config_host.has_key('CONFIG_QOM_CAST_DEBUG')}
 summary_info += {'Live block migration': config_host.has_key('CONFIG_LIVE_BLOCK_MIGRATION')}
 summary_info += {'lzo support':       config_host.has_key('CONFIG_LZO')}
diff --git a/meson_options.txt b/meson_options.txt
index 4535bc4dc2..6466dc67f6 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -54,6 +54,8 @@ option('libiscsi', type : 'feature', value : 'auto',
        description: 'libiscsi userspace initiator')
 option('libnfs', type : 'feature', value : 'auto',
        description: 'libnfs block device driver')
+option('libssh', type : 'feature', value : 'auto',
+       description: 'libssh block device driver')
 option('mpath', type : 'feature', value : 'auto',
        description: 'Multipath persistent reservation passthrough')
 option('iconv', type : 'feature', value : 'auto',
-- 
2.29.2




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

* [PULL 44/55] rbd: convert to meson
  2020-12-21 14:43 [PULL 00/55] Misc patches for 2020-12-21 Paolo Bonzini
                   ` (42 preceding siblings ...)
  2020-12-21 14:44 ` [PULL 43/55] libssh: " Paolo Bonzini
@ 2020-12-21 14:44 ` Paolo Bonzini
  2020-12-21 14:44 ` [PULL 45/55] lzo: " Paolo Bonzini
                   ` (11 subsequent siblings)
  55 siblings, 0 replies; 61+ messages in thread
From: Paolo Bonzini @ 2020-12-21 14:44 UTC (permalink / raw)
  To: qemu-devel

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

diff --git a/configure b/configure
index 0350b59624..a2e4796053 100755
--- a/configure
+++ b/configure
@@ -383,7 +383,7 @@ qom_cast_debug="yes"
 trace_backends="log"
 trace_file="trace"
 spice="$default_feature"
-rbd="$default_feature"
+rbd="auto"
 smartcard="$default_feature"
 u2f="auto"
 libusb="$default_feature"
@@ -1285,9 +1285,9 @@ for opt do
   ;;
   --enable-opengl) opengl="yes"
   ;;
-  --disable-rbd) rbd="no"
+  --disable-rbd) rbd="disabled"
   ;;
-  --enable-rbd) rbd="yes"
+  --enable-rbd) rbd="enabled"
   ;;
   --disable-xfsctl) xfs="no"
   ;;
@@ -3605,29 +3605,6 @@ if compile_prog "" "$pthread_lib" ; then
   pthread_setname_np_wo_tid=yes
 fi
 
-##########################################
-# rbd probe
-if test "$rbd" != "no" ; then
-  cat > $TMPC <<EOF
-#include <stdio.h>
-#include <rbd/librbd.h>
-int main(void) {
-    rados_t cluster;
-    rados_create(&cluster, NULL);
-    return 0;
-}
-EOF
-  rbd_libs="-lrbd -lrados"
-  if compile_prog "" "$rbd_libs" ; then
-    rbd=yes
-  else
-    if test "$rbd" = "yes" ; then
-      feature_not_found "rados block device" "Install librbd/ceph devel"
-    fi
-    rbd=no
-  fi
-fi
-
 ##########################################
 # linux-aio probe
 
@@ -6182,10 +6159,6 @@ fi
 if test "$qom_cast_debug" = "yes" ; then
   echo "CONFIG_QOM_CAST_DEBUG=y" >> $config_host_mak
 fi
-if test "$rbd" = "yes" ; then
-  echo "CONFIG_RBD=y" >> $config_host_mak
-  echo "RBD_LIBS=$rbd_libs" >> $config_host_mak
-fi
 
 echo "CONFIG_COROUTINE_BACKEND=$coroutine" >> $config_host_mak
 if test "$coroutine_pool" = "yes" ; then
@@ -6724,7 +6697,7 @@ NINJA=$ninja $meson setup \
         -Dcapstone=$capstone -Dslirp=$slirp -Dfdt=$fdt -Dbrlapi=$brlapi \
         -Dcurl=$curl -Dglusterfs=$glusterfs -Dbzip2=$bzip2 -Dlibiscsi=$libiscsi \
         -Dlibnfs=$libnfs -Diconv=$iconv -Dcurses=$curses -Dlibudev=$libudev\
-        -Dlibssh=$libssh \
+        -Dlibssh=$libssh -Drbd=$rbd \
         -Ddocs=$docs -Dsphinx_build=$sphinx_build -Dinstall_blobs=$blobs \
         -Dvhost_user_blk_server=$vhost_user_blk_server \
         -Dfuse=$fuse -Dfuse_lseek=$fuse_lseek \
diff --git a/meson.build b/meson.build
index e448624212..92fe7007ef 100644
--- a/meson.build
+++ b/meson.build
@@ -612,9 +612,24 @@ else
 endif
 
 rbd = not_found
-if 'CONFIG_RBD' in config_host
-  rbd = declare_dependency(link_args: config_host['RBD_LIBS'].split())
+if not get_option('rbd').auto() or have_block
+  librados = cc.find_library('rados', required: get_option('rbd'),
+                             static: enable_static)
+  librbd = cc.find_library('rbd', has_headers: ['rbd/librbd.h'],
+                           required: get_option('rbd'),
+                           static: enable_static)
+  if librados.found() and librbd.found() and cc.links('''
+    #include <stdio.h>
+    #include <rbd/librbd.h>
+    int main(void) {
+      rados_t cluster;
+      rados_create(&cluster, NULL);
+      return 0;
+    }''', dependencies: [librbd, librados])
+    rbd = declare_dependency(dependencies: [librbd, librados])
+  endif
 endif
+
 glusterfs = not_found
 glusterfs_ftruncate_has_stat = false
 glusterfs_iocb_has_stat = false
@@ -947,6 +962,7 @@ config_host_data.set('CONFIG_LIBISCSI', libiscsi.found())
 config_host_data.set('CONFIG_LIBNFS', libnfs.found())
 config_host_data.set('CONFIG_LIBSSH', libssh.found())
 config_host_data.set('HAVE_LIBSSH_0_8', have_libssh_0_8)
+config_host_data.set('CONFIG_RBD', rbd.found())
 config_host_data.set('CONFIG_SDL', sdl.found())
 config_host_data.set('CONFIG_SDL_IMAGE', sdl_image.found())
 config_host_data.set('CONFIG_VHOST_USER_BLK_SERVER', have_vhost_user_blk_server)
@@ -2297,7 +2313,7 @@ if config_host['TRACE_BACKENDS'].split().contains('simple')
 endif
 # TODO: add back protocol and server version
 summary_info += {'spice support':     config_host.has_key('CONFIG_SPICE')}
-summary_info += {'rbd support':       config_host.has_key('CONFIG_RBD')}
+summary_info += {'rbd support':       rbd.found()}
 summary_info += {'xfsctl support':    config_host.has_key('CONFIG_XFS')}
 summary_info += {'smartcard support': config_host.has_key('CONFIG_SMARTCARD')}
 summary_info += {'U2F support':       u2f.found()}
diff --git a/meson_options.txt b/meson_options.txt
index 6466dc67f6..630c9dceb7 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -64,6 +64,8 @@ option('curses', type : 'feature', value : 'auto',
        description: 'curses UI')
 option('libudev', type : 'feature', value : 'auto',
        description: 'Use libudev to enumerate host devices')
+option('rbd', type : 'feature', value : 'auto',
+       description: 'Ceph block device driver')
 option('sdl', type : 'feature', value : 'auto',
        description: 'SDL user interface')
 option('sdl_image', type : 'feature', value : 'auto',
-- 
2.29.2




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

* [PULL 45/55] lzo: convert to meson
  2020-12-21 14:43 [PULL 00/55] Misc patches for 2020-12-21 Paolo Bonzini
                   ` (43 preceding siblings ...)
  2020-12-21 14:44 ` [PULL 44/55] rbd: " Paolo Bonzini
@ 2020-12-21 14:44 ` Paolo Bonzini
  2020-12-21 14:44 ` [PULL 46/55] snappy: " Paolo Bonzini
                   ` (10 subsequent siblings)
  55 siblings, 0 replies; 61+ messages in thread
From: Paolo Bonzini @ 2020-12-21 14:44 UTC (permalink / raw)
  To: qemu-devel

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

diff --git a/configure b/configure
index a2e4796053..1574ea8456 100755
--- a/configure
+++ b/configure
@@ -393,7 +393,7 @@ opengl_dmabuf="no"
 cpuid_h="no"
 avx2_opt="$default_feature"
 capstone="auto"
-lzo="$default_feature"
+lzo="auto"
 snappy="$default_feature"
 bzip2="auto"
 lzfse="$default_feature"
@@ -1311,9 +1311,9 @@ for opt do
   ;;
   --disable-zlib-test)
   ;;
-  --disable-lzo) lzo="no"
+  --disable-lzo) lzo="disabled"
   ;;
-  --enable-lzo) lzo="yes"
+  --enable-lzo) lzo="enabled"
   ;;
   --disable-snappy) snappy="no"
   ;;
@@ -2456,25 +2456,6 @@ EOF
   fi
 fi
 
-##########################################
-# lzo check
-
-if test "$lzo" != "no" ; then
-    cat > $TMPC << EOF
-#include <lzo/lzo1x.h>
-int main(void) { lzo_version(); return 0; }
-EOF
-    if compile_prog "" "-llzo2" ; then
-        lzo_libs="-llzo2"
-        lzo="yes"
-    else
-        if test "$lzo" = "yes"; then
-            feature_not_found "liblzo2" "Install liblzo2 devel"
-        fi
-        lzo="no"
-    fi
-fi
-
 ##########################################
 # snappy check
 
@@ -6124,11 +6105,6 @@ if test "$avx512f_opt" = "yes" ; then
   echo "CONFIG_AVX512F_OPT=y" >> $config_host_mak
 fi
 
-if test "$lzo" = "yes" ; then
-  echo "CONFIG_LZO=y" >> $config_host_mak
-  echo "LZO_LIBS=$lzo_libs" >> $config_host_mak
-fi
-
 if test "$snappy" = "yes" ; then
   echo "CONFIG_SNAPPY=y" >> $config_host_mak
   echo "SNAPPY_LIBS=$snappy_libs" >> $config_host_mak
@@ -6697,7 +6673,7 @@ NINJA=$ninja $meson setup \
         -Dcapstone=$capstone -Dslirp=$slirp -Dfdt=$fdt -Dbrlapi=$brlapi \
         -Dcurl=$curl -Dglusterfs=$glusterfs -Dbzip2=$bzip2 -Dlibiscsi=$libiscsi \
         -Dlibnfs=$libnfs -Diconv=$iconv -Dcurses=$curses -Dlibudev=$libudev\
-        -Dlibssh=$libssh -Drbd=$rbd \
+        -Dlibssh=$libssh -Drbd=$rbd -Dlzo=$lzo \
         -Ddocs=$docs -Dsphinx_build=$sphinx_build -Dinstall_blobs=$blobs \
         -Dvhost_user_blk_server=$vhost_user_blk_server \
         -Dfuse=$fuse -Dfuse_lseek=$fuse_lseek \
diff --git a/meson.build b/meson.build
index 92fe7007ef..2a2f7d0039 100644
--- a/meson.build
+++ b/meson.build
@@ -757,10 +757,21 @@ snappy = not_found
 if 'CONFIG_SNAPPY' in config_host
   snappy = declare_dependency(link_args: config_host['SNAPPY_LIBS'].split())
 endif
-lzo = not_found
-if 'CONFIG_LZO' in config_host
-  lzo = declare_dependency(link_args: config_host['LZO_LIBS'].split())
+
+lzo = cc.find_library('lzo2', has_headers: ['lzo/lzo1x.h'],
+                      required: get_option('lzo'),
+                      static: enable_static)
+if lzo.found() and not cc.links('''
+   #include <lzo/lzo1x.h>
+   int main(void) { lzo_version(); return 0; }''', dependencies: lzo)
+  lzo = not_found
+  if get_option('lzo').enabled()
+    error('could not link liblzo2')
+  else
+    warning('could not link liblzo2, disabling')
+  endif
 endif
+
 rdma = not_found
 if 'CONFIG_RDMA' in config_host
   rdma = declare_dependency(link_args: config_host['RDMA_LIBS'].split())
@@ -945,6 +956,7 @@ config_host_data.set_quoted('CONFIG_SYSCONFDIR', get_option('prefix') / get_opti
 config_host_data.set('CONFIG_BRLAPI', brlapi.found())
 config_host_data.set('CONFIG_COCOA', cocoa.found())
 config_host_data.set('CONFIG_LIBUDEV', libudev.found())
+config_host_data.set('CONFIG_LZO', lzo.found())
 config_host_data.set('CONFIG_MPATH', mpathpersist.found())
 config_host_data.set('CONFIG_MPATH_NEW_API', mpathpersist_new_api)
 config_host_data.set('CONFIG_CURL', curl.found())
@@ -2346,7 +2358,7 @@ summary_info += {'TPM support':       config_host.has_key('CONFIG_TPM')}
 summary_info += {'libssh support':    libssh.found()}
 summary_info += {'QOM debugging':     config_host.has_key('CONFIG_QOM_CAST_DEBUG')}
 summary_info += {'Live block migration': config_host.has_key('CONFIG_LIVE_BLOCK_MIGRATION')}
-summary_info += {'lzo support':       config_host.has_key('CONFIG_LZO')}
+summary_info += {'lzo support':       lzo.found()}
 summary_info += {'snappy support':    config_host.has_key('CONFIG_SNAPPY')}
 summary_info += {'bzip2 support':     libbzip2.found()}
 summary_info += {'lzfse support':     config_host.has_key('CONFIG_LZFSE')}
diff --git a/meson_options.txt b/meson_options.txt
index 630c9dceb7..00a5ec55bd 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -64,6 +64,8 @@ option('curses', type : 'feature', value : 'auto',
        description: 'curses UI')
 option('libudev', type : 'feature', value : 'auto',
        description: 'Use libudev to enumerate host devices')
+option('lzo', type : 'feature', value : 'auto',
+       description: 'lzo compression support')
 option('rbd', type : 'feature', value : 'auto',
        description: 'Ceph block device driver')
 option('sdl', type : 'feature', value : 'auto',
-- 
2.29.2




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

* [PULL 46/55] snappy: convert to meson
  2020-12-21 14:43 [PULL 00/55] Misc patches for 2020-12-21 Paolo Bonzini
                   ` (44 preceding siblings ...)
  2020-12-21 14:44 ` [PULL 45/55] lzo: " Paolo Bonzini
@ 2020-12-21 14:44 ` Paolo Bonzini
  2020-12-21 14:44 ` [PULL 47/55] lzfse: " Paolo Bonzini
                   ` (9 subsequent siblings)
  55 siblings, 0 replies; 61+ messages in thread
From: Paolo Bonzini @ 2020-12-21 14:44 UTC (permalink / raw)
  To: qemu-devel

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

diff --git a/configure b/configure
index 1574ea8456..9166347739 100755
--- a/configure
+++ b/configure
@@ -394,7 +394,7 @@ cpuid_h="no"
 avx2_opt="$default_feature"
 capstone="auto"
 lzo="auto"
-snappy="$default_feature"
+snappy="auto"
 bzip2="auto"
 lzfse="$default_feature"
 zstd="$default_feature"
@@ -1315,9 +1315,9 @@ for opt do
   ;;
   --enable-lzo) lzo="enabled"
   ;;
-  --disable-snappy) snappy="no"
+  --disable-snappy) snappy="disabled"
   ;;
-  --enable-snappy) snappy="yes"
+  --enable-snappy) snappy="enabled"
   ;;
   --disable-bzip2) bzip2="disabled"
   ;;
@@ -2456,25 +2456,6 @@ EOF
   fi
 fi
 
-##########################################
-# snappy check
-
-if test "$snappy" != "no" ; then
-    cat > $TMPC << EOF
-#include <snappy-c.h>
-int main(void) { snappy_max_compressed_length(4096); return 0; }
-EOF
-    if compile_prog "" "-lsnappy" ; then
-        snappy_libs='-lsnappy'
-        snappy="yes"
-    else
-        if test "$snappy" = "yes"; then
-            feature_not_found "libsnappy" "Install libsnappy devel"
-        fi
-        snappy="no"
-    fi
-fi
-
 ##########################################
 # lzfse check
 
@@ -6105,11 +6086,6 @@ if test "$avx512f_opt" = "yes" ; then
   echo "CONFIG_AVX512F_OPT=y" >> $config_host_mak
 fi
 
-if test "$snappy" = "yes" ; then
-  echo "CONFIG_SNAPPY=y" >> $config_host_mak
-  echo "SNAPPY_LIBS=$snappy_libs" >> $config_host_mak
-fi
-
 if test "$lzfse" = "yes" ; then
   echo "CONFIG_LZFSE=y" >> $config_host_mak
   echo "LZFSE_LIBS=-llzfse" >> $config_host_mak
@@ -6673,7 +6649,7 @@ NINJA=$ninja $meson setup \
         -Dcapstone=$capstone -Dslirp=$slirp -Dfdt=$fdt -Dbrlapi=$brlapi \
         -Dcurl=$curl -Dglusterfs=$glusterfs -Dbzip2=$bzip2 -Dlibiscsi=$libiscsi \
         -Dlibnfs=$libnfs -Diconv=$iconv -Dcurses=$curses -Dlibudev=$libudev\
-        -Dlibssh=$libssh -Drbd=$rbd -Dlzo=$lzo \
+        -Dlibssh=$libssh -Drbd=$rbd -Dlzo=$lzo -Dsnappy=$snappy \
         -Ddocs=$docs -Dsphinx_build=$sphinx_build -Dinstall_blobs=$blobs \
         -Dvhost_user_blk_server=$vhost_user_blk_server \
         -Dfuse=$fuse -Dfuse_lseek=$fuse_lseek \
diff --git a/meson.build b/meson.build
index 2a2f7d0039..02a9f914be 100644
--- a/meson.build
+++ b/meson.build
@@ -753,9 +753,19 @@ if get_option('vnc').enabled()
                               compile_args: '-DSTRUCT_IOVEC_DEFINED')
   endif
 endif
-snappy = not_found
-if 'CONFIG_SNAPPY' in config_host
-  snappy = declare_dependency(link_args: config_host['SNAPPY_LIBS'].split())
+
+snappy = cc.find_library('snappy', has_headers: ['snappy-c.h'],
+                      required: get_option('snappy'),
+                      static: enable_static)
+if snappy.found() and not cc.links('''
+   #include <snappy-c.h>
+   int main(void) { snappy_max_compressed_length(4096); return 0; }''', dependencies: snappy)
+  snappy = not_found
+  if get_option('snappy').enabled()
+    error('could not link libsnappy')
+  else
+    warning('could not link libsnappy, disabling')
+  endif
 endif
 
 lzo = cc.find_library('lzo2', has_headers: ['lzo/lzo1x.h'],
@@ -977,6 +987,7 @@ config_host_data.set('HAVE_LIBSSH_0_8', have_libssh_0_8)
 config_host_data.set('CONFIG_RBD', rbd.found())
 config_host_data.set('CONFIG_SDL', sdl.found())
 config_host_data.set('CONFIG_SDL_IMAGE', sdl_image.found())
+config_host_data.set('CONFIG_SNAPPY', snappy.found())
 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())
@@ -2359,7 +2370,7 @@ summary_info += {'libssh support':    libssh.found()}
 summary_info += {'QOM debugging':     config_host.has_key('CONFIG_QOM_CAST_DEBUG')}
 summary_info += {'Live block migration': config_host.has_key('CONFIG_LIVE_BLOCK_MIGRATION')}
 summary_info += {'lzo support':       lzo.found()}
-summary_info += {'snappy support':    config_host.has_key('CONFIG_SNAPPY')}
+summary_info += {'snappy support':    snappy.found()}
 summary_info += {'bzip2 support':     libbzip2.found()}
 summary_info += {'lzfse support':     config_host.has_key('CONFIG_LZFSE')}
 summary_info += {'zstd support':      config_host.has_key('CONFIG_ZSTD')}
diff --git a/meson_options.txt b/meson_options.txt
index 00a5ec55bd..e2b7e23887 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -72,6 +72,8 @@ option('sdl', type : 'feature', value : 'auto',
        description: 'SDL user interface')
 option('sdl_image', type : 'feature', value : 'auto',
        description: 'SDL Image support for icons')
+option('snappy', type : 'feature', value : 'auto',
+       description: 'snappy compression support')
 option('u2f', type : 'feature', value : 'auto',
        description: 'U2F emulation support')
 option('vnc', type : 'feature', value : 'enabled',
-- 
2.29.2




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

* [PULL 47/55] lzfse: convert to meson
  2020-12-21 14:43 [PULL 00/55] Misc patches for 2020-12-21 Paolo Bonzini
                   ` (45 preceding siblings ...)
  2020-12-21 14:44 ` [PULL 46/55] snappy: " Paolo Bonzini
@ 2020-12-21 14:44 ` Paolo Bonzini
  2020-12-21 14:44 ` [PULL 48/55] zstd: " Paolo Bonzini
                   ` (8 subsequent siblings)
  55 siblings, 0 replies; 61+ messages in thread
From: Paolo Bonzini @ 2020-12-21 14:44 UTC (permalink / raw)
  To: qemu-devel

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

diff --git a/configure b/configure
index 9166347739..6224279e44 100755
--- a/configure
+++ b/configure
@@ -396,7 +396,7 @@ capstone="auto"
 lzo="auto"
 snappy="auto"
 bzip2="auto"
-lzfse="$default_feature"
+lzfse="auto"
 zstd="$default_feature"
 guest_agent="$default_feature"
 guest_agent_with_vss="no"
@@ -1323,9 +1323,9 @@ for opt do
   ;;
   --enable-bzip2) bzip2="enabled"
   ;;
-  --enable-lzfse) lzfse="yes"
+  --enable-lzfse) lzfse="enabled"
   ;;
-  --disable-lzfse) lzfse="no"
+  --disable-lzfse) lzfse="disabled"
   ;;
   --disable-zstd) zstd="no"
   ;;
@@ -2456,24 +2456,6 @@ EOF
   fi
 fi
 
-##########################################
-# lzfse check
-
-if test "$lzfse" != "no" ; then
-    cat > $TMPC << EOF
-#include <lzfse.h>
-int main(void) { lzfse_decode_scratch_size(); return 0; }
-EOF
-    if compile_prog "" "-llzfse" ; then
-        lzfse="yes"
-    else
-        if test "$lzfse" = "yes"; then
-            feature_not_found "lzfse" "Install lzfse devel"
-        fi
-        lzfse="no"
-    fi
-fi
-
 ##########################################
 # zstd check
 
@@ -6086,11 +6068,6 @@ if test "$avx512f_opt" = "yes" ; then
   echo "CONFIG_AVX512F_OPT=y" >> $config_host_mak
 fi
 
-if test "$lzfse" = "yes" ; then
-  echo "CONFIG_LZFSE=y" >> $config_host_mak
-  echo "LZFSE_LIBS=-llzfse" >> $config_host_mak
-fi
-
 if test "$zstd" = "yes" ; then
   echo "CONFIG_ZSTD=y" >> $config_host_mak
   echo "ZSTD_CFLAGS=$zstd_cflags" >> $config_host_mak
@@ -6649,7 +6626,7 @@ NINJA=$ninja $meson setup \
         -Dcapstone=$capstone -Dslirp=$slirp -Dfdt=$fdt -Dbrlapi=$brlapi \
         -Dcurl=$curl -Dglusterfs=$glusterfs -Dbzip2=$bzip2 -Dlibiscsi=$libiscsi \
         -Dlibnfs=$libnfs -Diconv=$iconv -Dcurses=$curses -Dlibudev=$libudev\
-        -Dlibssh=$libssh -Drbd=$rbd -Dlzo=$lzo -Dsnappy=$snappy \
+        -Dlibssh=$libssh -Drbd=$rbd -Dlzo=$lzo -Dsnappy=$snappy -Dlzfse=$lzfse \
         -Ddocs=$docs -Dsphinx_build=$sphinx_build -Dinstall_blobs=$blobs \
         -Dvhost_user_blk_server=$vhost_user_blk_server \
         -Dfuse=$fuse -Dfuse_lseek=$fuse_lseek \
diff --git a/meson.build b/meson.build
index 02a9f914be..550df12432 100644
--- a/meson.build
+++ b/meson.build
@@ -699,10 +699,21 @@ if not get_option('bzip2').auto() or have_block
     endif
   endif
 endif
-liblzfse = not_found
-if 'CONFIG_LZFSE' in config_host
-  liblzfse = declare_dependency(link_args: config_host['LZFSE_LIBS'].split())
+
+liblzfse = cc.find_library('lzfse', has_headers: ['lzfse.h'],
+                      required: get_option('lzfse'),
+                      static: enable_static)
+if liblzfse.found() and not cc.links('''
+   #include <lzfse.h>
+   int main(void) { lzfse_decode_scratch_size(); return 0; }''', dependencies: liblzfse)
+  liblzfse = not_found
+  if get_option('lzfse').enabled()
+    error('could not link liblzfse')
+  else
+    warning('could not link liblzfse, disabling')
+  endif
 endif
+
 oss = not_found
 if 'CONFIG_AUDIO_OSS' in config_host
   oss = declare_dependency(link_args: config_host['OSS_LIBS'].split())
@@ -2372,7 +2383,7 @@ summary_info += {'Live block migration': config_host.has_key('CONFIG_LIVE_BLOCK_
 summary_info += {'lzo support':       lzo.found()}
 summary_info += {'snappy support':    snappy.found()}
 summary_info += {'bzip2 support':     libbzip2.found()}
-summary_info += {'lzfse support':     config_host.has_key('CONFIG_LZFSE')}
+summary_info += {'lzfse support':     liblzfse.found()}
 summary_info += {'zstd support':      config_host.has_key('CONFIG_ZSTD')}
 summary_info += {'NUMA host support': config_host.has_key('CONFIG_NUMA')}
 summary_info += {'libxml2':           config_host.has_key('CONFIG_LIBXML2')}
diff --git a/meson_options.txt b/meson_options.txt
index e2b7e23887..f74a3d78c4 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -64,6 +64,8 @@ option('curses', type : 'feature', value : 'auto',
        description: 'curses UI')
 option('libudev', type : 'feature', value : 'auto',
        description: 'Use libudev to enumerate host devices')
+option('lzfse', type : 'feature', value : 'auto',
+       description: 'lzfse support for DMG images')
 option('lzo', type : 'feature', value : 'auto',
        description: 'lzo compression support')
 option('rbd', type : 'feature', value : 'auto',
-- 
2.29.2




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

* [PULL 48/55] zstd: convert to meson
  2020-12-21 14:43 [PULL 00/55] Misc patches for 2020-12-21 Paolo Bonzini
                   ` (46 preceding siblings ...)
  2020-12-21 14:44 ` [PULL 47/55] lzfse: " Paolo Bonzini
@ 2020-12-21 14:44 ` Paolo Bonzini
  2020-12-21 14:44 ` [PULL 49/55] seccomp: " Paolo Bonzini
                   ` (7 subsequent siblings)
  55 siblings, 0 replies; 61+ messages in thread
From: Paolo Bonzini @ 2020-12-21 14:44 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 configure             | 30 ++++--------------------------
 meson.build           | 10 ++++++----
 meson_options.txt     |  2 ++
 migration/meson.build |  2 +-
 4 files changed, 13 insertions(+), 31 deletions(-)

diff --git a/configure b/configure
index 6224279e44..0c0eef7713 100755
--- a/configure
+++ b/configure
@@ -397,7 +397,7 @@ lzo="auto"
 snappy="auto"
 bzip2="auto"
 lzfse="auto"
-zstd="$default_feature"
+zstd="auto"
 guest_agent="$default_feature"
 guest_agent_with_vss="no"
 guest_agent_ntddscsi="no"
@@ -1327,9 +1327,9 @@ for opt do
   ;;
   --disable-lzfse) lzfse="disabled"
   ;;
-  --disable-zstd) zstd="no"
+  --disable-zstd) zstd="disabled"
   ;;
-  --enable-zstd) zstd="yes"
+  --enable-zstd) zstd="enabled"
   ;;
   --enable-guest-agent) guest_agent="yes"
   ;;
@@ -2456,23 +2456,6 @@ EOF
   fi
 fi
 
-##########################################
-# zstd check
-
-if test "$zstd" != "no" ; then
-    libzstd_minver="1.4.0"
-    if $pkg_config --atleast-version=$libzstd_minver libzstd ; then
-        zstd_cflags="$($pkg_config --cflags libzstd)"
-        zstd_libs="$($pkg_config --libs libzstd)"
-        zstd="yes"
-    else
-        if test "$zstd" = "yes" ; then
-            feature_not_found "libzstd" "Install libzstd devel"
-        fi
-        zstd="no"
-    fi
-fi
-
 ##########################################
 # libseccomp check
 
@@ -6068,12 +6051,6 @@ if test "$avx512f_opt" = "yes" ; then
   echo "CONFIG_AVX512F_OPT=y" >> $config_host_mak
 fi
 
-if test "$zstd" = "yes" ; then
-  echo "CONFIG_ZSTD=y" >> $config_host_mak
-  echo "ZSTD_CFLAGS=$zstd_cflags" >> $config_host_mak
-  echo "ZSTD_LIBS=$zstd_libs" >> $config_host_mak
-fi
-
 if test "$seccomp" = "yes"; then
   echo "CONFIG_SECCOMP=y" >> $config_host_mak
   echo "SECCOMP_CFLAGS=$seccomp_cflags" >> $config_host_mak
@@ -6627,6 +6604,7 @@ NINJA=$ninja $meson setup \
         -Dcurl=$curl -Dglusterfs=$glusterfs -Dbzip2=$bzip2 -Dlibiscsi=$libiscsi \
         -Dlibnfs=$libnfs -Diconv=$iconv -Dcurses=$curses -Dlibudev=$libudev\
         -Dlibssh=$libssh -Drbd=$rbd -Dlzo=$lzo -Dsnappy=$snappy -Dlzfse=$lzfse \
+        -Dzstd=$zstd \
         -Ddocs=$docs -Dsphinx_build=$sphinx_build -Dinstall_blobs=$blobs \
         -Dvhost_user_blk_server=$vhost_user_blk_server \
         -Dfuse=$fuse -Dfuse_lseek=$fuse_lseek \
diff --git a/meson.build b/meson.build
index 550df12432..b4313951a6 100644
--- a/meson.build
+++ b/meson.build
@@ -380,9 +380,10 @@ if not get_option('libiscsi').auto() or have_block
                          method: 'pkg-config', static: enable_static)
 endif
 zstd = not_found
-if 'CONFIG_ZSTD' in config_host
-  zstd = declare_dependency(compile_args: config_host['ZSTD_CFLAGS'].split(),
-                            link_args: config_host['ZSTD_LIBS'].split())
+if not get_option('zstd').auto() or have_block
+  zstd = dependency('libzstd', version: '>=1.4.0',
+                    required: get_option('zstd'),
+                    method: 'pkg-config', static: enable_static)
 endif
 gbm = not_found
 if 'CONFIG_GBM' in config_host
@@ -1009,6 +1010,7 @@ config_host_data.set('CONFIG_KEYUTILS', keyutils.found())
 config_host_data.set('CONFIG_GETTID', has_gettid)
 config_host_data.set('CONFIG_MALLOC_TRIM', has_malloc_trim)
 config_host_data.set('CONFIG_STATX', has_statx)
+config_host_data.set('CONFIG_ZSTD', zstd.found())
 config_host_data.set('CONFIG_FUSE', fuse.found())
 config_host_data.set('CONFIG_FUSE_LSEEK', fuse_lseek.found())
 config_host_data.set('CONFIG_CFI', get_option('cfi'))
@@ -2384,7 +2386,7 @@ summary_info += {'lzo support':       lzo.found()}
 summary_info += {'snappy support':    snappy.found()}
 summary_info += {'bzip2 support':     libbzip2.found()}
 summary_info += {'lzfse support':     liblzfse.found()}
-summary_info += {'zstd support':      config_host.has_key('CONFIG_ZSTD')}
+summary_info += {'zstd support':      zstd.found()}
 summary_info += {'NUMA host support': config_host.has_key('CONFIG_NUMA')}
 summary_info += {'libxml2':           config_host.has_key('CONFIG_LIBXML2')}
 summary_info += {'memory allocator':  get_option('malloc')}
diff --git a/meson_options.txt b/meson_options.txt
index f74a3d78c4..5a1de9b1fe 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -92,6 +92,8 @@ option('virtiofsd', type: 'feature', value: 'auto',
        description: 'build virtiofs daemon (virtiofsd)')
 option('vhost_user_blk_server', type: 'feature', value: 'auto',
        description: 'build vhost-user-blk server')
+option('zstd', type : 'feature', value : 'auto',
+       description: 'zstd compression support')
 option('fuse', type: 'feature', value: 'auto',
        description: 'FUSE block device export')
 option('fuse_lseek', type : 'feature', value : 'auto',
diff --git a/migration/meson.build b/migration/meson.build
index 980e37865c..c783f2f2ae 100644
--- a/migration/meson.build
+++ b/migration/meson.build
@@ -29,6 +29,6 @@ softmmu_ss.add(files(
 
 softmmu_ss.add(when: ['CONFIG_RDMA', rdma], if_true: files('rdma.c'))
 softmmu_ss.add(when: 'CONFIG_LIVE_BLOCK_MIGRATION', if_true: files('block.c'))
-softmmu_ss.add(when: 'CONFIG_ZSTD', if_true: [files('multifd-zstd.c'), zstd])
+softmmu_ss.add(when: zstd, if_true: files('multifd-zstd.c'))
 
 specific_ss.add(when: 'CONFIG_SOFTMMU', if_true: files('dirtyrate.c', 'ram.c'))
-- 
2.29.2




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

* [PULL 49/55] seccomp: convert to meson
  2020-12-21 14:43 [PULL 00/55] Misc patches for 2020-12-21 Paolo Bonzini
                   ` (47 preceding siblings ...)
  2020-12-21 14:44 ` [PULL 48/55] zstd: " Paolo Bonzini
@ 2020-12-21 14:44 ` Paolo Bonzini
  2020-12-21 14:44 ` [PULL 50/55] virtfs: " Paolo Bonzini
                   ` (6 subsequent siblings)
  55 siblings, 0 replies; 61+ messages in thread
From: Paolo Bonzini @ 2020-12-21 14:44 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 configure              | 32 ++++----------------------------
 meson.build            | 10 ++++++----
 meson_options.txt      |  2 ++
 softmmu/meson.build    |  2 +-
 softmmu/qemu-seccomp.c |  2 --
 tools/meson.build      |  4 ++--
 6 files changed, 15 insertions(+), 37 deletions(-)

diff --git a/configure b/configure
index 0c0eef7713..ba8c6e74be 100755
--- a/configure
+++ b/configure
@@ -413,7 +413,7 @@ debug_stack_usage="no"
 crypto_afalg="no"
 cfi="false"
 cfi_debug="false"
-seccomp="$default_feature"
+seccomp="auto"
 glusterfs="auto"
 gtk="$default_feature"
 gtk_gl="no"
@@ -1355,9 +1355,9 @@ for opt do
   ;;
   --disable-tools) want_tools="no"
   ;;
-  --enable-seccomp) seccomp="yes"
+  --enable-seccomp) seccomp="enabled"
   ;;
-  --disable-seccomp) seccomp="no"
+  --disable-seccomp) seccomp="disabled"
   ;;
   --disable-glusterfs) glusterfs="disabled"
   ;;
@@ -2456,24 +2456,6 @@ EOF
   fi
 fi
 
-##########################################
-# libseccomp check
-
-if test "$seccomp" != "no" ; then
-    libseccomp_minver="2.3.0"
-    if $pkg_config --atleast-version=$libseccomp_minver libseccomp ; then
-        seccomp_cflags="$($pkg_config --cflags libseccomp)"
-        seccomp_libs="$($pkg_config --libs libseccomp)"
-        seccomp="yes"
-    else
-        if test "$seccomp" = "yes" ; then
-            feature_not_found "libseccomp" \
-                 "Install libseccomp devel >= $libseccomp_minver"
-        fi
-        seccomp="no"
-    fi
-fi
-
 ##########################################
 # xen probe
 
@@ -6051,12 +6033,6 @@ if test "$avx512f_opt" = "yes" ; then
   echo "CONFIG_AVX512F_OPT=y" >> $config_host_mak
 fi
 
-if test "$seccomp" = "yes"; then
-  echo "CONFIG_SECCOMP=y" >> $config_host_mak
-  echo "SECCOMP_CFLAGS=$seccomp_cflags" >> $config_host_mak
-  echo "SECCOMP_LIBS=$seccomp_libs" >> $config_host_mak
-fi
-
 # XXX: suppress that
 if [ "$bsd" = "yes" ] ; then
   echo "CONFIG_BSD=y" >> $config_host_mak
@@ -6604,7 +6580,7 @@ NINJA=$ninja $meson setup \
         -Dcurl=$curl -Dglusterfs=$glusterfs -Dbzip2=$bzip2 -Dlibiscsi=$libiscsi \
         -Dlibnfs=$libnfs -Diconv=$iconv -Dcurses=$curses -Dlibudev=$libudev\
         -Dlibssh=$libssh -Drbd=$rbd -Dlzo=$lzo -Dsnappy=$snappy -Dlzfse=$lzfse \
-        -Dzstd=$zstd \
+        -Dzstd=$zstd -Dseccomp=$seccomp \
         -Ddocs=$docs -Dsphinx_build=$sphinx_build -Dinstall_blobs=$blobs \
         -Dvhost_user_blk_server=$vhost_user_blk_server \
         -Dfuse=$fuse -Dfuse_lseek=$fuse_lseek \
diff --git a/meson.build b/meson.build
index b4313951a6..99c4d0dd1a 100644
--- a/meson.build
+++ b/meson.build
@@ -329,9 +329,10 @@ if 'CONFIG_ATTR' in config_host
   libattr = declare_dependency(link_args: config_host['LIBATTR_LIBS'].split())
 endif
 seccomp = not_found
-if 'CONFIG_SECCOMP' in config_host
-  seccomp = declare_dependency(compile_args: config_host['SECCOMP_CFLAGS'].split(),
-                               link_args: config_host['SECCOMP_LIBS'].split())
+if not get_option('libiscsi').auto() or have_system or have_tools
+  seccomp = dependency('libseccomp', version: '>=2.3.0',
+                       required: get_option('seccomp'),
+                       method: 'pkg-config', static: enable_static)
 endif
 libcap_ng = not_found
 if 'CONFIG_LIBCAP_NG' in config_host
@@ -999,6 +1000,7 @@ config_host_data.set('HAVE_LIBSSH_0_8', have_libssh_0_8)
 config_host_data.set('CONFIG_RBD', rbd.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())
 config_host_data.set('CONFIG_SNAPPY', snappy.found())
 config_host_data.set('CONFIG_VHOST_USER_BLK_SERVER', have_vhost_user_blk_server)
 config_host_data.set('CONFIG_VNC', vnc.found())
@@ -2368,7 +2370,7 @@ if targetos == 'windows'
   summary_info += {'QGA w32 disk info': config_host.has_key('CONFIG_QGA_NTDDSCSI')}
   summary_info += {'QGA MSI support':   config_host.has_key('CONFIG_QGA_MSI')}
 endif
-summary_info += {'seccomp support':   config_host.has_key('CONFIG_SECCOMP')}
+summary_info += {'seccomp support':   seccomp.found()}
 summary_info += {'CFI support':       get_option('cfi')}
 summary_info += {'CFI debug support': get_option('cfi_debug')}
 summary_info += {'coroutine backend': config_host['CONFIG_COROUTINE_BACKEND']}
diff --git a/meson_options.txt b/meson_options.txt
index 5a1de9b1fe..1854a9639f 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -74,6 +74,8 @@ option('sdl', type : 'feature', value : 'auto',
        description: 'SDL user interface')
 option('sdl_image', type : 'feature', value : 'auto',
        description: 'SDL Image support for icons')
+option('seccomp', type : 'feature', value : 'auto',
+       description: 'seccomp support')
 option('snappy', type : 'feature', value : 'auto',
        description: 'snappy compression support')
 option('u2f', type : 'feature', value : 'auto',
diff --git a/softmmu/meson.build b/softmmu/meson.build
index 2dab6c7eb6..d8e03018ab 100644
--- a/softmmu/meson.build
+++ b/softmmu/meson.build
@@ -28,5 +28,5 @@ softmmu_ss.add(files(
 ), sdl, libpmem, libdaxctl)
 
 softmmu_ss.add(when: 'CONFIG_TPM', if_true: files('tpm.c'))
-softmmu_ss.add(when: 'CONFIG_SECCOMP', if_true: [files('qemu-seccomp.c'), seccomp])
+softmmu_ss.add(when: seccomp, if_true: files('qemu-seccomp.c'))
 softmmu_ss.add(when: fdt, if_true: files('device_tree.c'))
diff --git a/softmmu/qemu-seccomp.c b/softmmu/qemu-seccomp.c
index 8325ecb766..377ef6937c 100644
--- a/softmmu/qemu-seccomp.c
+++ b/softmmu/qemu-seccomp.c
@@ -202,7 +202,6 @@ static int seccomp_start(uint32_t seccomp_opts, Error **errp)
     return rc < 0 ? -1 : 0;
 }
 
-#ifdef CONFIG_SECCOMP
 int parse_sandbox(void *opaque, QemuOpts *opts, Error **errp)
 {
     if (qemu_opt_get_bool(opts, "enable", false)) {
@@ -328,4 +327,3 @@ static void seccomp_register(void)
     }
 }
 opts_init(seccomp_register);
-#endif
diff --git a/tools/meson.build b/tools/meson.build
index 76bf84df52..5c52d79fe4 100644
--- a/tools/meson.build
+++ b/tools/meson.build
@@ -1,6 +1,6 @@
 have_virtiofsd = (targetos == 'linux' and
     have_tools and
-    'CONFIG_SECCOMP' in config_host and
+    seccomp.found() and
     'CONFIG_LIBCAP_NG' in config_host and
     'CONFIG_VHOST_USER' in config_host)
 
@@ -8,7 +8,7 @@ if get_option('virtiofsd').enabled()
   if not have_virtiofsd
     if targetos != 'linux'
       error('virtiofsd requires Linux')
-    elif 'CONFIG_SECCOMP' not in config_host or 'CONFIG_LIBCAP_NG' not in config_host
+    elif not seccomp.found() or 'CONFIG_LIBCAP_NG' not in config_host
       error('virtiofsd requires libcap-ng-devel and seccomp-devel')
     elif not have_tools or 'CONFIG_VHOST_USER' not in config_host
       error('virtiofsd needs tools and vhost-user support')
-- 
2.29.2




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

* [PULL 50/55] virtfs: convert to meson
  2020-12-21 14:43 [PULL 00/55] Misc patches for 2020-12-21 Paolo Bonzini
                   ` (48 preceding siblings ...)
  2020-12-21 14:44 ` [PULL 49/55] seccomp: " Paolo Bonzini
@ 2020-12-21 14:44 ` Paolo Bonzini
  2021-01-07 13:58   ` Bruce Rogers
  2020-12-21 14:44 ` [PULL 51/55] cap_ng: " Paolo Bonzini
                   ` (5 subsequent siblings)
  55 siblings, 1 reply; 61+ messages in thread
From: Paolo Bonzini @ 2020-12-21 14:44 UTC (permalink / raw)
  To: qemu-devel

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

diff --git a/configure b/configure
index ba8c6e74be..46ee3da40e 100755
--- a/configure
+++ b/configure
@@ -315,7 +315,7 @@ netmap="no"
 sdl="auto"
 sdl_image="auto"
 virtiofsd="auto"
-virtfs="$default_feature"
+virtfs="auto"
 libudev="auto"
 mpath="auto"
 vnc="enabled"
@@ -1004,9 +1004,9 @@ for opt do
   ;;
   --enable-qom-cast-debug) qom_cast_debug="yes"
   ;;
-  --disable-virtfs) virtfs="no"
+  --disable-virtfs) virtfs="disabled"
   ;;
-  --enable-virtfs) virtfs="yes"
+  --enable-virtfs) virtfs="enabled"
   ;;
   --disable-libudev) libudev="disabled"
   ;;
@@ -5443,24 +5443,6 @@ if [ "$eventfd" = "yes" ]; then
   ivshmem=yes
 fi
 
-if test "$softmmu" = yes ; then
-  if test "$linux" = yes; then
-    if test "$virtfs" != no && test "$cap_ng" = yes && test "$attr" = yes ; then
-      virtfs=yes
-    else
-      if test "$virtfs" = yes; then
-        error_exit "VirtFS requires libcap-ng devel and libattr devel"
-      fi
-      virtfs=no
-    fi
-  else
-    if test "$virtfs" = yes; then
-      error_exit "VirtFS is supported only on Linux"
-    fi
-    virtfs=no
-  fi
-fi
-
 # Probe for guest agent support/options
 
 if [ "$guest_agent" != "no" ]; then
@@ -5917,9 +5899,6 @@ fi
 if test "$libattr" = "yes" ; then
   echo "CONFIG_LIBATTR=y" >> $config_host_mak
 fi
-if test "$virtfs" = "yes" ; then
-  echo "CONFIG_VIRTFS=y" >> $config_host_mak
-fi
 if test "$vhost_scsi" = "yes" ; then
   echo "CONFIG_VHOST_SCSI=y" >> $config_host_mak
 fi
@@ -6580,7 +6559,7 @@ NINJA=$ninja $meson setup \
         -Dcurl=$curl -Dglusterfs=$glusterfs -Dbzip2=$bzip2 -Dlibiscsi=$libiscsi \
         -Dlibnfs=$libnfs -Diconv=$iconv -Dcurses=$curses -Dlibudev=$libudev\
         -Dlibssh=$libssh -Drbd=$rbd -Dlzo=$lzo -Dsnappy=$snappy -Dlzfse=$lzfse \
-        -Dzstd=$zstd -Dseccomp=$seccomp \
+        -Dzstd=$zstd -Dseccomp=$seccomp -Dvirtfs=$virtfs \
         -Ddocs=$docs -Dsphinx_build=$sphinx_build -Dinstall_blobs=$blobs \
         -Dvhost_user_blk_server=$vhost_user_blk_server \
         -Dfuse=$fuse -Dfuse_lseek=$fuse_lseek \
diff --git a/meson.build b/meson.build
index 99c4d0dd1a..22413b4f16 100644
--- a/meson.build
+++ b/meson.build
@@ -963,6 +963,25 @@ endif
 # config-host.h #
 #################
 
+have_virtfs = (targetos == 'linux' and
+    have_system and
+    libattr.found() and
+    libcap_ng.found())
+
+if get_option('virtfs').enabled()
+  if not have_virtfs
+    if targetos != 'linux'
+      error('virtio-9p (virtfs) requires Linux')
+    elif not libcap_ng.found() or not libattr.found()
+      error('virtio-9p (virtfs) requires libcap-ng-devel and libattr-devel')
+    elif not have_system
+      error('virtio-9p (virtfs) needs system emulation support')
+    endif
+  endif
+elif get_option('virtfs').disabled()
+  have_virtfs = false
+endif
+
 config_host_data.set_quoted('CONFIG_BINDIR', get_option('prefix') / get_option('bindir'))
 config_host_data.set_quoted('CONFIG_PREFIX', get_option('prefix'))
 config_host_data.set_quoted('CONFIG_QEMU_CONFDIR', get_option('prefix') / qemu_confdir)
@@ -1007,6 +1026,7 @@ config_host_data.set('CONFIG_VNC', vnc.found())
 config_host_data.set('CONFIG_VNC_JPEG', jpeg.found())
 config_host_data.set('CONFIG_VNC_PNG', png.found())
 config_host_data.set('CONFIG_VNC_SASL', sasl.found())
+config_host_data.set('CONFIG_VIRTFS', have_virtfs)
 config_host_data.set('CONFIG_XKBCOMMON', xkbcommon.found())
 config_host_data.set('CONFIG_KEYUTILS', keyutils.found())
 config_host_data.set('CONFIG_GETTID', has_gettid)
@@ -1105,7 +1125,7 @@ host_kconfig = \
   ('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'] : []) + \
-  ('CONFIG_VIRTFS' in config_host ? ['CONFIG_VIRTFS=y'] : []) + \
+  (have_virtfs ? ['CONFIG_VIRTFS=y'] : []) + \
   ('CONFIG_LINUX' in config_host ? ['CONFIG_LINUX=y'] : []) + \
   ('CONFIG_PVRDMA' in config_host ? ['CONFIG_PVRDMA=y'] : [])
 
@@ -2294,7 +2314,7 @@ summary_info += {'mingw32 support':   targetos == 'windows'}
 summary_info += {'Audio drivers':     config_host['CONFIG_AUDIO_DRIVERS']}
 summary_info += {'Block whitelist (rw)': config_host['CONFIG_BDRV_RW_WHITELIST']}
 summary_info += {'Block whitelist (ro)': config_host['CONFIG_BDRV_RO_WHITELIST']}
-summary_info += {'VirtFS support':    config_host.has_key('CONFIG_VIRTFS')}
+summary_info += {'VirtFS support':    have_virtfs}
 summary_info += {'build virtiofs daemon': have_virtiofsd}
 summary_info += {'Multipath support': mpathpersist.found()}
 summary_info += {'VNC support':       vnc.found()}
diff --git a/meson_options.txt b/meson_options.txt
index 1854a9639f..59a8a50e5b 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -90,10 +90,6 @@ option('vnc_sasl', type : 'feature', value : 'auto',
        description: 'SASL authentication for VNC server')
 option('xkbcommon', type : 'feature', value : 'auto',
        description: 'xkbcommon support')
-option('virtiofsd', type: 'feature', value: 'auto',
-       description: 'build virtiofs daemon (virtiofsd)')
-option('vhost_user_blk_server', type: 'feature', value: 'auto',
-       description: 'build vhost-user-blk server')
 option('zstd', type : 'feature', value : 'auto',
        description: 'zstd compression support')
 option('fuse', type: 'feature', value: 'auto',
@@ -101,6 +97,13 @@ option('fuse', type: 'feature', value: 'auto',
 option('fuse_lseek', type : 'feature', value : 'auto',
        description: 'SEEK_HOLE/SEEK_DATA support for FUSE exports')
 
+option('vhost_user_blk_server', type: 'feature', value: 'auto',
+       description: 'build vhost-user-blk server')
+option('virtfs', type: 'feature', value: 'auto',
+       description: 'virtio-9p support')
+option('virtiofsd', type: 'feature', value: 'auto',
+       description: 'build virtiofs daemon (virtiofsd)')
+
 option('capstone', type: 'combo', value: 'auto',
        choices: ['disabled', 'enabled', 'auto', 'system', 'internal'],
        description: 'Whether and how to find the capstone library')
-- 
2.29.2




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

* [PULL 51/55] cap_ng: convert to meson
  2020-12-21 14:43 [PULL 00/55] Misc patches for 2020-12-21 Paolo Bonzini
                   ` (49 preceding siblings ...)
  2020-12-21 14:44 ` [PULL 50/55] virtfs: " Paolo Bonzini
@ 2020-12-21 14:44 ` Paolo Bonzini
  2020-12-21 14:44 ` [PULL 52/55] libattr: " Paolo Bonzini
                   ` (4 subsequent siblings)
  55 siblings, 0 replies; 61+ messages in thread
From: Paolo Bonzini @ 2020-12-21 14:44 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 configure         | 34 ++++------------------------------
 meson.build       | 24 ++++++++++++++++++++----
 meson_options.txt |  2 ++
 tools/meson.build |  4 ++--
 4 files changed, 28 insertions(+), 36 deletions(-)

diff --git a/configure b/configure
index 46ee3da40e..569396248b 100755
--- a/configure
+++ b/configure
@@ -330,7 +330,7 @@ xen_ctrl_version="$default_feature"
 xen_pci_passthrough="auto"
 linux_aio="$default_feature"
 linux_io_uring="$default_feature"
-cap_ng="$default_feature"
+cap_ng="auto"
 attr="$default_feature"
 libattr="$default_feature"
 xfs="$default_feature"
@@ -1122,9 +1122,9 @@ for opt do
   ;;
   --enable-tcg-interpreter) tcg_interpreter="yes"
   ;;
-  --disable-cap-ng)  cap_ng="no"
+  --disable-cap-ng)  cap_ng="disabled"
   ;;
-  --enable-cap-ng) cap_ng="yes"
+  --enable-cap-ng) cap_ng="enabled"
   ;;
   --disable-tcg) tcg="disabled"
   ;;
@@ -3191,28 +3191,6 @@ EOF
   fi
 fi
 
-##########################################
-# libcap-ng library probe
-if test "$cap_ng" != "no" ; then
-  cap_libs="-lcap-ng"
-  cat > $TMPC << EOF
-#include <cap-ng.h>
-int main(void)
-{
-    capng_capability_to_name(CAPNG_EFFECTIVE);
-    return 0;
-}
-EOF
-  if compile_prog "" "$cap_libs" ; then
-    cap_ng=yes
-  else
-    if test "$cap_ng" = "yes" ; then
-      feature_not_found "cap_ng" "Install libcap-ng devel"
-    fi
-    cap_ng=no
-  fi
-fi
-
 ##########################################
 # Sound support libraries probe
 
@@ -5669,10 +5647,6 @@ fi
 if test "$gprof" = "yes" ; then
   echo "CONFIG_GPROF=y" >> $config_host_mak
 fi
-if test "$cap_ng" = "yes" ; then
-  echo "CONFIG_LIBCAP_NG=y" >> $config_host_mak
-  echo "LIBCAP_NG_LIBS=$cap_libs" >> $config_host_mak
-fi
 echo "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak
 for drv in $audio_drv_list; do
     def=CONFIG_AUDIO_$(echo $drv | LC_ALL=C tr '[a-z]' '[A-Z]')
@@ -6559,7 +6533,7 @@ NINJA=$ninja $meson setup \
         -Dcurl=$curl -Dglusterfs=$glusterfs -Dbzip2=$bzip2 -Dlibiscsi=$libiscsi \
         -Dlibnfs=$libnfs -Diconv=$iconv -Dcurses=$curses -Dlibudev=$libudev\
         -Dlibssh=$libssh -Drbd=$rbd -Dlzo=$lzo -Dsnappy=$snappy -Dlzfse=$lzfse \
-        -Dzstd=$zstd -Dseccomp=$seccomp -Dvirtfs=$virtfs \
+        -Dzstd=$zstd -Dseccomp=$seccomp -Dvirtfs=$virtfs -Dcap_ng=$cap_ng \
         -Ddocs=$docs -Dsphinx_build=$sphinx_build -Dinstall_blobs=$blobs \
         -Dvhost_user_blk_server=$vhost_user_blk_server \
         -Dfuse=$fuse -Dfuse_lseek=$fuse_lseek \
diff --git a/meson.build b/meson.build
index 22413b4f16..f580f2f67f 100644
--- a/meson.build
+++ b/meson.build
@@ -334,10 +334,25 @@ if not get_option('libiscsi').auto() or have_system or have_tools
                        required: get_option('seccomp'),
                        method: 'pkg-config', static: enable_static)
 endif
-libcap_ng = not_found
-if 'CONFIG_LIBCAP_NG' in config_host
-  libcap_ng = declare_dependency(link_args: config_host['LIBCAP_NG_LIBS'].split())
+
+libcap_ng = cc.find_library('cap-ng', has_headers: ['cap-ng.h'],
+                      required: get_option('cap_ng'),
+                      static: enable_static)
+if libcap_ng.found() and not cc.links('''
+   #include <cap-ng.h>
+   int main(void)
+   {
+     capng_capability_to_name(CAPNG_EFFECTIVE);
+     return 0;
+   }''', dependencies: libcap_ng)
+  libcap_ng = not_found
+  if get_option('cap_ng').enabled()
+    error('could not link libcap-ng')
+  else
+    warning('could not link libcap-ng, disabling')
+  endif
 endif
+
 if get_option('xkbcommon').auto() and not have_system and not have_tools
   xkbcommon = not_found
 else
@@ -1012,6 +1027,7 @@ if glusterfs.found()
   config_host_data.set('CONFIG_GLUSTERFS_FTRUNCATE_HAS_STAT', glusterfs_ftruncate_has_stat)
   config_host_data.set('CONFIG_GLUSTERFS_IOCB_HAS_STAT', glusterfs_iocb_has_stat)
 endif
+config_host_data.set('CONFIG_LIBCAP_NG', libcap_ng.found())
 config_host_data.set('CONFIG_LIBISCSI', libiscsi.found())
 config_host_data.set('CONFIG_LIBNFS', libnfs.found())
 config_host_data.set('CONFIG_LIBSSH', libssh.found())
@@ -2355,7 +2371,7 @@ summary_info += {'fdatasync':         config_host.has_key('CONFIG_FDATASYNC')}
 summary_info += {'madvise':           config_host.has_key('CONFIG_MADVISE')}
 summary_info += {'posix_madvise':     config_host.has_key('CONFIG_POSIX_MADVISE')}
 summary_info += {'posix_memalign':    config_host.has_key('CONFIG_POSIX_MEMALIGN')}
-summary_info += {'libcap-ng support': config_host.has_key('CONFIG_LIBCAP_NG')}
+summary_info += {'libcap-ng support': libcap_ng.found()}
 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')}
diff --git a/meson_options.txt b/meson_options.txt
index 59a8a50e5b..12a1872f20 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -44,6 +44,8 @@ option('brlapi', type : 'feature', value : 'auto',
        description: 'brlapi character device driver')
 option('bzip2', type : 'feature', value : 'auto',
        description: 'bzip2 support for DMG images')
+option('cap_ng', type : 'feature', value : 'auto',
+       description: 'cap_ng support')
 option('cocoa', type : 'feature', value : 'auto',
        description: 'Cocoa user interface (macOS only)')
 option('curl', type : 'feature', value : 'auto',
diff --git a/tools/meson.build b/tools/meson.build
index 5c52d79fe4..fdce66857d 100644
--- a/tools/meson.build
+++ b/tools/meson.build
@@ -1,14 +1,14 @@
 have_virtiofsd = (targetos == 'linux' and
     have_tools and
     seccomp.found() and
-    'CONFIG_LIBCAP_NG' in config_host and
+    libcap_ng.found() and
     'CONFIG_VHOST_USER' in config_host)
 
 if get_option('virtiofsd').enabled()
   if not have_virtiofsd
     if targetos != 'linux'
       error('virtiofsd requires Linux')
-    elif not seccomp.found() or 'CONFIG_LIBCAP_NG' not in config_host
+    elif not seccomp.found() or not libcap_ng.found()
       error('virtiofsd requires libcap-ng-devel and seccomp-devel')
     elif not have_tools or 'CONFIG_VHOST_USER' not in config_host
       error('virtiofsd needs tools and vhost-user support')
-- 
2.29.2




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

* [PULL 52/55] libattr: convert to meson
  2020-12-21 14:43 [PULL 00/55] Misc patches for 2020-12-21 Paolo Bonzini
                   ` (50 preceding siblings ...)
  2020-12-21 14:44 ` [PULL 51/55] cap_ng: " Paolo Bonzini
@ 2020-12-21 14:44 ` Paolo Bonzini
  2020-12-21 14:44 ` [PULL 53/55] meson.build: convert --with-default-devices " Paolo Bonzini
                   ` (3 subsequent siblings)
  55 siblings, 0 replies; 61+ messages in thread
From: Paolo Bonzini @ 2020-12-21 14:44 UTC (permalink / raw)
  To: qemu-devel

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

diff --git a/configure b/configure
index 569396248b..18af62a3e0 100755
--- a/configure
+++ b/configure
@@ -331,8 +331,7 @@ xen_pci_passthrough="auto"
 linux_aio="$default_feature"
 linux_io_uring="$default_feature"
 cap_ng="auto"
-attr="$default_feature"
-libattr="$default_feature"
+attr="auto"
 xfs="$default_feature"
 tcg="enabled"
 membarrier="$default_feature"
@@ -1229,9 +1228,9 @@ for opt do
   ;;
   --enable-linux-io-uring) linux_io_uring="yes"
   ;;
-  --disable-attr) attr="no"
+  --disable-attr) attr="disabled"
   ;;
-  --enable-attr) attr="yes"
+  --enable-attr) attr="enabled"
   ;;
   --disable-membarrier) membarrier="no"
   ;;
@@ -3542,36 +3541,6 @@ elif test "$tpm" = "yes"; then
   fi
 fi
 
-##########################################
-# attr probe
-
-libattr_libs=
-if test "$attr" != "no" ; then
-  cat > $TMPC <<EOF
-#include <stdio.h>
-#include <sys/types.h>
-#ifdef CONFIG_LIBATTR
-#include <attr/xattr.h>
-#else
-#include <sys/xattr.h>
-#endif
-int main(void) { getxattr(NULL, NULL, NULL, 0); setxattr(NULL, NULL, NULL, 0, 0); return 0; }
-EOF
-  if compile_prog "" "" ; then
-    attr=yes
-  # Older distros have <attr/xattr.h>, and need -lattr:
-  elif compile_prog "-DCONFIG_LIBATTR" "-lattr" ; then
-    attr=yes
-    libattr_libs="-lattr"
-    libattr=yes
-  else
-    if test "$attr" = "yes" ; then
-      feature_not_found "ATTR" "Install libc6 or libattr devel"
-    fi
-    attr=no
-  fi
-fi
-
 ##########################################
 # iovec probe
 cat > $TMPC <<EOF
@@ -5866,13 +5835,6 @@ if test "$linux_io_uring" = "yes" ; then
   echo "LINUX_IO_URING_CFLAGS=$linux_io_uring_cflags" >> $config_host_mak
   echo "LINUX_IO_URING_LIBS=$linux_io_uring_libs" >> $config_host_mak
 fi
-if test "$attr" = "yes" ; then
-  echo "CONFIG_ATTR=y" >> $config_host_mak
-  echo "LIBATTR_LIBS=$libattr_libs" >> $config_host_mak
-fi
-if test "$libattr" = "yes" ; then
-  echo "CONFIG_LIBATTR=y" >> $config_host_mak
-fi
 if test "$vhost_scsi" = "yes" ; then
   echo "CONFIG_VHOST_SCSI=y" >> $config_host_mak
 fi
@@ -6534,6 +6496,7 @@ NINJA=$ninja $meson setup \
         -Dlibnfs=$libnfs -Diconv=$iconv -Dcurses=$curses -Dlibudev=$libudev\
         -Dlibssh=$libssh -Drbd=$rbd -Dlzo=$lzo -Dsnappy=$snappy -Dlzfse=$lzfse \
         -Dzstd=$zstd -Dseccomp=$seccomp -Dvirtfs=$virtfs -Dcap_ng=$cap_ng \
+        -Dattr=$attr \
         -Ddocs=$docs -Dsphinx_build=$sphinx_build -Dinstall_blobs=$blobs \
         -Dvhost_user_blk_server=$vhost_user_blk_server \
         -Dfuse=$fuse -Dfuse_lseek=$fuse_lseek \
diff --git a/meson.build b/meson.build
index f580f2f67f..fef0c0f013 100644
--- a/meson.build
+++ b/meson.build
@@ -324,10 +324,40 @@ if not get_option('libnfs').auto() or have_block
                       required: get_option('libnfs'),
                       method: 'pkg-config', static: enable_static)
 endif
+
+libattr_test = '''
+  #include <stddef.h>
+  #include <sys/types.h>
+  #ifdef CONFIG_LIBATTR
+  #include <attr/xattr.h>
+  #else
+  #include <sys/xattr.h>
+  #endif
+  int main(void) { getxattr(NULL, NULL, NULL, 0); setxattr(NULL, NULL, NULL, 0, 0); return 0; }'''
+
 libattr = not_found
-if 'CONFIG_ATTR' in config_host
-  libattr = declare_dependency(link_args: config_host['LIBATTR_LIBS'].split())
+have_old_libattr = false
+if not get_option('attr').disabled()
+  if cc.links(libattr_test)
+    libattr = declare_dependency()
+  else
+    libattr = cc.find_library('attr', has_headers: ['attr/xattr.h'],
+                              required: get_option('attr'),
+                              static: enable_static)
+    if libattr.found() and not \
+      cc.links(libattr_test, dependencies: libattr, args: '-DCONFIG_LIBATTR')
+      libattr = not_found
+      if get_option('attr').enabled()
+        error('could not link libattr')
+      else
+        warning('could not link libattr, disabling')
+      endif
+    else
+      have_old_libattr = libattr.found()
+    endif
+  endif
 endif
+
 seccomp = not_found
 if not get_option('libiscsi').auto() or have_system or have_tools
   seccomp = dependency('libseccomp', version: '>=2.3.0',
@@ -1010,6 +1040,7 @@ 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'))
 
+config_host_data.set('CONFIG_ATTR', libattr.found())
 config_host_data.set('CONFIG_BRLAPI', brlapi.found())
 config_host_data.set('CONFIG_COCOA', cocoa.found())
 config_host_data.set('CONFIG_LIBUDEV', libudev.found())
@@ -1027,6 +1058,7 @@ if glusterfs.found()
   config_host_data.set('CONFIG_GLUSTERFS_FTRUNCATE_HAS_STAT', glusterfs_ftruncate_has_stat)
   config_host_data.set('CONFIG_GLUSTERFS_IOCB_HAS_STAT', glusterfs_iocb_has_stat)
 endif
+config_host_data.set('CONFIG_LIBATTR', have_old_libattr)
 config_host_data.set('CONFIG_LIBCAP_NG', libcap_ng.found())
 config_host_data.set('CONFIG_LIBISCSI', libiscsi.found())
 config_host_data.set('CONFIG_LIBNFS', libnfs.found())
@@ -2350,7 +2382,7 @@ summary_info += {'vde support':       config_host.has_key('CONFIG_VDE')}
 summary_info += {'netmap support':    config_host.has_key('CONFIG_NETMAP')}
 summary_info += {'Linux AIO support': config_host.has_key('CONFIG_LINUX_AIO')}
 summary_info += {'Linux io_uring support': config_host.has_key('CONFIG_LINUX_IO_URING')}
-summary_info += {'ATTR/XATTR support': config_host.has_key('CONFIG_ATTR')}
+summary_info += {'ATTR/XATTR support': libattr.found()}
 summary_info += {'Install blobs':     get_option('install_blobs')}
 summary_info += {'KVM support':       config_all.has_key('CONFIG_KVM')}
 summary_info += {'HAX support':       config_all.has_key('CONFIG_HAX')}
diff --git a/meson_options.txt b/meson_options.txt
index 12a1872f20..8fcec056cd 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -40,6 +40,8 @@ option('cfi', type: 'boolean', value: 'false',
 option('cfi_debug', type: 'boolean', value: 'false',
        description: 'Verbose errors in case of CFI violation')
 
+option('attr', type : 'feature', value : 'auto',
+       description: 'attr/xattr support')
 option('brlapi', type : 'feature', value : 'auto',
        description: 'brlapi character device driver')
 option('bzip2', type : 'feature', value : 'auto',
-- 
2.29.2




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

* [PULL 53/55] meson.build: convert --with-default-devices to meson
  2020-12-21 14:43 [PULL 00/55] Misc patches for 2020-12-21 Paolo Bonzini
                   ` (51 preceding siblings ...)
  2020-12-21 14:44 ` [PULL 52/55] libattr: " Paolo Bonzini
@ 2020-12-21 14:44 ` Paolo Bonzini
  2020-12-21 14:44 ` [PULL 54/55] configure: move tests/qemu-iotests/common.env generation " Paolo Bonzini
                   ` (2 subsequent siblings)
  55 siblings, 0 replies; 61+ messages in thread
From: Paolo Bonzini @ 2020-12-21 14:44 UTC (permalink / raw)
  To: qemu-devel

Pass the boolean option directly instead of writing
CONFIG_MINIKCONF_MODE to config-host.mak.

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

diff --git a/configure b/configure
index 18af62a3e0..63ac12d5b8 100755
--- a/configure
+++ b/configure
@@ -446,7 +446,7 @@ sheepdog="no"
 libxml2="$default_feature"
 debug_mutex="no"
 libpmem="$default_feature"
-default_devices="yes"
+default_devices="true"
 plugins="no"
 fuzzing="no"
 rng_none="no"
@@ -943,9 +943,9 @@ for opt do
   ;;
   --with-trace-file=*) trace_file="$optarg"
   ;;
-  --with-default-devices) default_devices="yes"
+  --with-default-devices) default_devices="true"
   ;;
-  --without-default-devices) default_devices="no"
+  --without-default-devices) default_devices="false"
   ;;
   --without-default-features) # processed above
   ;;
@@ -5539,11 +5539,6 @@ echo "GIT_UPDATE=$git_update" >> $config_host_mak
 
 echo "ARCH=$ARCH" >> $config_host_mak
 
-if test "$default_devices" = "yes" ; then
-  echo "CONFIG_MINIKCONF_MODE=--defconfig" >> $config_host_mak
-else
-  echo "CONFIG_MINIKCONF_MODE=--allnoconfig" >> $config_host_mak
-fi
 if test "$debug_tcg" = "yes" ; then
   echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak
 fi
@@ -6496,7 +6491,7 @@ NINJA=$ninja $meson setup \
         -Dlibnfs=$libnfs -Diconv=$iconv -Dcurses=$curses -Dlibudev=$libudev\
         -Dlibssh=$libssh -Drbd=$rbd -Dlzo=$lzo -Dsnappy=$snappy -Dlzfse=$lzfse \
         -Dzstd=$zstd -Dseccomp=$seccomp -Dvirtfs=$virtfs -Dcap_ng=$cap_ng \
-        -Dattr=$attr \
+        -Dattr=$attr -Ddefault_devices=$default_devices \
         -Ddocs=$docs -Dsphinx_build=$sphinx_build -Dinstall_blobs=$blobs \
         -Dvhost_user_blk_server=$vhost_user_blk_server \
         -Dfuse=$fuse -Dfuse_lseek=$fuse_lseek \
diff --git a/meson.build b/meson.build
index fef0c0f013..98d302cb22 100644
--- a/meson.build
+++ b/meson.build
@@ -1282,7 +1282,8 @@ foreach target : target_dirs
       output: config_devices_mak,
       depfile: config_devices_mak + '.d',
       capture: true,
-      command: [minikconf, config_host['CONFIG_MINIKCONF_MODE'],
+      command: [minikconf,
+                get_option('default_devices') ? '--defconfig' : '--allnoconfig',
                 config_devices_mak, '@DEPFILE@', '@INPUT@',
                 host_kconfig, accel_kconfig])
 
@@ -2476,7 +2477,7 @@ summary_info += {'capstone':          capstone_opt == 'disabled' ? false : capst
 summary_info += {'libpmem support':   config_host.has_key('CONFIG_LIBPMEM')}
 summary_info += {'libdaxctl support': config_host.has_key('CONFIG_LIBDAXCTL')}
 summary_info += {'libudev':           libudev.found()}
-summary_info += {'default devices':   config_host['CONFIG_MINIKCONF_MODE'] == '--defconfig'}
+summary_info += {'default devices':   get_option('default_devices')}
 summary_info += {'plugin support':    config_host.has_key('CONFIG_PLUGIN')}
 summary_info += {'fuzzing support':   config_host.has_key('CONFIG_FUZZ')}
 if config_host.has_key('HAVE_GDB_BIN')
diff --git a/meson_options.txt b/meson_options.txt
index 8fcec056cd..1d4a71772e 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -7,6 +7,8 @@ option('qemu_firmwarepath', type : 'string', value : '',
 option('sphinx_build', type : 'string', value : '',
        description: 'Use specified sphinx-build [$sphinx_build] for building document (default to be empty)')
 
+option('default_devices', type : 'boolean', value : true,
+       description: 'Include a default selection of devices in emulators')
 option('docs', type : 'feature', value : 'auto',
        description: 'Documentations build support')
 option('gettext', type : 'feature', value : 'auto',
-- 
2.29.2




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

* [PULL 54/55] configure: move tests/qemu-iotests/common.env generation to meson
  2020-12-21 14:43 [PULL 00/55] Misc patches for 2020-12-21 Paolo Bonzini
                   ` (52 preceding siblings ...)
  2020-12-21 14:44 ` [PULL 53/55] meson.build: convert --with-default-devices " Paolo Bonzini
@ 2020-12-21 14:44 ` Paolo Bonzini
  2020-12-21 14:44 ` [PULL 55/55] win32: drop fd registration to the main-loop on setting non-block Paolo Bonzini
  2021-01-01 17:05 ` [PULL 00/55] Misc patches for 2020-12-21 Peter Maydell
  55 siblings, 0 replies; 61+ messages in thread
From: Paolo Bonzini @ 2020-12-21 14:44 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 configure                        | 7 -------
 tests/qemu-iotests/common.env.in | 3 +++
 tests/qemu-iotests/meson.build   | 3 +++
 3 files changed, 6 insertions(+), 7 deletions(-)
 create mode 100644 tests/qemu-iotests/common.env.in

diff --git a/configure b/configure
index 63ac12d5b8..c8e30ba1c7 100755
--- a/configure
+++ b/configure
@@ -6394,13 +6394,6 @@ for rom in seabios; do
     echo "RANLIB=$ranlib" >> $config_mak
 done
 
-# set up qemu-iotests in this build directory
-iotests_common_env="tests/qemu-iotests/common.env"
-
-echo "# Automatically generated by configure - do not modify" > "$iotests_common_env"
-echo >> "$iotests_common_env"
-echo "export PYTHON='$python'" >> "$iotests_common_env"
-
 if test "$skip_meson" = no; then
 cross="config-meson.cross.new"
 meson_quote() {
diff --git a/tests/qemu-iotests/common.env.in b/tests/qemu-iotests/common.env.in
new file mode 100644
index 0000000000..e565cdf40c
--- /dev/null
+++ b/tests/qemu-iotests/common.env.in
@@ -0,0 +1,3 @@
+# Automatically generated by configure - do not modify
+
+export PYTHON='@PYTHON@'
diff --git a/tests/qemu-iotests/meson.build b/tests/qemu-iotests/meson.build
index 67aed1e492..26658ce25c 100644
--- a/tests/qemu-iotests/meson.build
+++ b/tests/qemu-iotests/meson.build
@@ -3,3 +3,6 @@ if 'CONFIG_LINUX' in config_host
 else
     socket_scm_helper = []
 endif
+configure_file(output: 'common.env',
+               input: files('common.env.in'),
+               configuration: {'PYTHON': python.full_path()})
-- 
2.29.2




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

* [PULL 55/55] win32: drop fd registration to the main-loop on setting non-block
  2020-12-21 14:43 [PULL 00/55] Misc patches for 2020-12-21 Paolo Bonzini
                   ` (53 preceding siblings ...)
  2020-12-21 14:44 ` [PULL 54/55] configure: move tests/qemu-iotests/common.env generation " Paolo Bonzini
@ 2020-12-21 14:44 ` Paolo Bonzini
  2021-01-01 17:05 ` [PULL 00/55] Misc patches for 2020-12-21 Peter Maydell
  55 siblings, 0 replies; 61+ messages in thread
From: Paolo Bonzini @ 2020-12-21 14:44 UTC (permalink / raw)
  To: qemu-devel; +Cc: Marc-André Lureau

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

Low-level fd users from QEMU use aio_set_fd_handler(), which handles
event registration with the main loop; qemu_fd_register() is only
needed together with the main loop's poll notifiers, of which SLIRP
is the only user.

This removes a dependency from oslib-win32.c to main-loop.c.

Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20201218135712.674094-1-marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 util/oslib-win32.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/util/oslib-win32.c b/util/oslib-win32.c
index 23a7c7320b..01787df74c 100644
--- a/util/oslib-win32.c
+++ b/util/oslib-win32.c
@@ -221,7 +221,6 @@ int qemu_try_set_nonblock(int fd)
     if (ioctlsocket(fd, FIONBIO, &opt) != NO_ERROR) {
         return -socket_error();
     }
-    qemu_fd_register(fd);
     return 0;
 }
 
-- 
2.29.2



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

* Re: [PULL 00/55] Misc patches for 2020-12-21
  2020-12-21 14:43 [PULL 00/55] Misc patches for 2020-12-21 Paolo Bonzini
                   ` (54 preceding siblings ...)
  2020-12-21 14:44 ` [PULL 55/55] win32: drop fd registration to the main-loop on setting non-block Paolo Bonzini
@ 2021-01-01 17:05 ` Peter Maydell
  2021-01-01 19:59   ` Paolo Bonzini
  55 siblings, 1 reply; 61+ messages in thread
From: Peter Maydell @ 2021-01-01 17:05 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: QEMU Developers

On Mon, 21 Dec 2020 at 14:51, Paolo Bonzini <pbonzini@redhat.com> wrote:
>
> The following changes since commit a05f8ecd88f15273d033b6f044b850a8af84a5b8:
>
>   Merge remote-tracking branch 'remotes/alistair/tags/pull-riscv-to-apply-20201217-1' into staging (2020-12-18 11:12:35 +0000)
>
> are available in the Git repository at:
>
>   https://gitlab.com/bonzini/qemu.git tags/for-upstream
>
> for you to fetch changes up to 16efbeeb765944fdda71862b40d60f0abeb1e200:
>
>   win32: drop fd registration to the main-loop on setting non-block (2020-12-21 13:53:24 +0100)
>
> ----------------------------------------------------------------
> From Alex's pull request:
> * improve cross-build KVM coverage
> * new --without-default-features configure flag
> * add __repr__ for ConsoleSocket for debugging
> * build tcg tests with -Werror
> * test 32 bit builds with fedora
> * remove last traces of debian9
> * hotfix for centos8 powertools repo
>
> * Move lots of feature detection code to meson (Alex, myself)
> * CFI and LTO support (Daniele)
> * test-char dangling pointer (Eduardo)
> * Build system and win32 fixes (Marc-André)
> * Initialization fixes (myself)
> * TCG include cleanup (Richard, myself)
> * x86 'int N' fix (Peter)

Fails to build, all hosts:

make: Entering directory '/home/ubuntu/qemu/build/all'
(cd /home/ubuntu/qemu && GIT="git" ./scripts/git-submodule.sh update
ui/keycodemapdb tests/fp/berkeley-testfloat-3 te
sts/fp/berkeley-softfloat-3 meson dtc capstone slirp roms/SLOF)
config-host.mak is out-of-date, running configure
cross containers  no

NOTE: guest cross-compilers enabled: cc cc
/usr/bin/ninja -v build.ninja && touch build.ninja.stamp
[0/1] /usr/bin/python3 /home/ubuntu/qemu/meson/meson.py --internal
regenerate /home/ubuntu/qemu /home/ubuntu/qemu/bui
ld/all --backend ninja
WARNING: Regenerating configuration from scratch.
Reason: Coredata file
'/home/ubuntu/qemu/build/all/meson-private/coredata.dat' references
functions or classes that d
on't exist. This probably means that it was generated with an old
version of meson.
The Meson build system
Version: 0.56.0
Source dir: /home/ubuntu/qemu
Build dir: /home/ubuntu/qemu/build/all
Build type: native build

../../meson.build:1:0: ERROR: Value "true" (of type "string") for
combo option "Localization of the GTK+ user interface" is not one of
the choices. Possible choices are (as string): "enabled", "disabled",
"auto".

A full log can be found at /home/ubuntu/qemu/build/all/meson-logs/meson-log.txt
FAILED: build.ninja
/usr/bin/python3 /home/ubuntu/qemu/meson/meson.py --internal
regenerate /home/ubuntu/qemu /home/ubuntu/qemu/build/all --backend
ninja
ninja: error: rebuilding 'build.ninja': subcommand failed
/usr/bin/ninja -v build.ninja && touch build.ninja.stamp
[0/1] /usr/bin/python3 /home/ubuntu/qemu/meson/meson.py --internal
regenerate /home/ubuntu/qemu /home/ubuntu/qemu/build/all --backend
ninja
WARNING: Regenerating configuration from scratch.
Reason: Coredata file
'/home/ubuntu/qemu/build/all/meson-private/coredata.dat' references
functions or classes that don't exist. This probably means that it was
generated with an old version of meson.
The Meson build system
Version: 0.56.0
Source dir: /home/ubuntu/qemu
Build dir: /home/ubuntu/qemu/build/all
Build type: native build

../../meson.build:1:0: ERROR: Value "true" (of type "string") for
combo option "Localization of the GTK+ user interface" is not one of
the choices. Possible choices are (as string): "enabled", "disabled",
"auto".

A full log can be found at /home/ubuntu/qemu/build/all/meson-logs/meson-log.txt
FAILED: build.ninja
/usr/bin/python3 /home/ubuntu/qemu/meson/meson.py --internal
regenerate /home/ubuntu/qemu /home/ubuntu/qemu/build/all --backend
ninja
ninja: error: rebuilding 'build.ninja': subcommand failed
/usr/bin/ninja -v     all | cat
make  -C pc-bios/s390-ccw/ V="1" TARGET_DIR="pc-bios/s390-ccw/" all
make[1]: Entering directory '/home/ubuntu/qemu/build/all/pc-bios/s390-ccw'
make[1]: Leaving directory '/home/ubuntu/qemu/build/all/pc-bios/s390-ccw'
[0/1] /usr/bin/python3 /home/ubuntu/qemu/meson/meson.py --internal
regenerate /home/ubuntu/qemu /home/ubuntu/qemu/build/all --backend
ninja
WARNING: Regenerating configuration from scratch.
Reason: Coredata file
'/home/ubuntu/qemu/build/all/meson-private/coredata.dat' references
functions or classes that don't exist. This probably means that it was
generated with an old version of meson.
The Meson build system
Version: 0.56.0
Source dir: /home/ubuntu/qemu
Build dir: /home/ubuntu/qemu/build/all
Build type: native build

../../meson.build:1:0: ERROR: Value "true" (of type "string") for
combo option "Localization of the GTK+ user interface" is not one of
the choices. Possible choices are (as string): "enabled", "disabled",
"auto".

A full log can be found at /home/ubuntu/qemu/build/all/meson-logs/meson-log.txt
ninja: error: rebuilding 'build.ninja': subcommand failed
FAILED: build.ninja
/usr/bin/python3 /home/ubuntu/qemu/meson/meson.py --internal
regenerate /home/ubuntu/qemu /home/ubuntu/qemu/build/all --backend
ninja
Makefile:172: recipe for target 'run-ninja' failed
make: *** [run-ninja] Error 1
make: Leaving directory '/home/ubuntu/qemu/build/all'


(why does it print the same failure three times rather than
stopping after the first one?)

thanks
-- PMM


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

* Re: [PULL 00/55] Misc patches for 2020-12-21
  2021-01-01 17:05 ` [PULL 00/55] Misc patches for 2020-12-21 Peter Maydell
@ 2021-01-01 19:59   ` Paolo Bonzini
  0 siblings, 0 replies; 61+ messages in thread
From: Paolo Bonzini @ 2021-01-01 19:59 UTC (permalink / raw)
  To: Peter Maydell; +Cc: QEMU Developers

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

Il ven 1 gen 2021, 18:05 Peter Maydell <peter.maydell@linaro.org> ha
scritto:

> (why does it print the same failure three times rather than
> stopping after the first one?)
>

It probably has something to do with how make processes rules to rebuild
makefiles.

I will remove the patch that moves xgettext from boolean to feature and
then try to reproduce the failure.

Paolo


> thanks
> -- PMM
>
>

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

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

* Re: [PULL 50/55] virtfs: convert to meson
  2020-12-21 14:44 ` [PULL 50/55] virtfs: " Paolo Bonzini
@ 2021-01-07 13:58   ` Bruce Rogers
  2021-01-07 14:49     ` Paolo Bonzini
  0 siblings, 1 reply; 61+ messages in thread
From: Bruce Rogers @ 2021-01-07 13:58 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel

On Mon, 2020-12-21 at 15:44 +0100, Paolo Bonzini wrote:
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  configure         | 29 ++++-------------------------
>  meson.build       | 24 ++++++++++++++++++++++--
>  meson_options.txt | 11 +++++++----
>  3 files changed, 33 insertions(+), 31 deletions(-)
> 
> diff --git a/configure b/configure
> index ba8c6e74be..46ee3da40e 100755
> --- a/configure
> +++ b/configure
> @@ -315,7 +315,7 @@ netmap="no"
>  sdl="auto"
>  sdl_image="auto"
>  virtiofsd="auto"
> -virtfs="$default_feature"
> +virtfs="auto"
>  libudev="auto"
>  mpath="auto"
>  vnc="enabled"
> @@ -1004,9 +1004,9 @@ for opt do
>    ;;
>    --enable-qom-cast-debug) qom_cast_debug="yes"
>    ;;
> -  --disable-virtfs) virtfs="no"
> +  --disable-virtfs) virtfs="disabled"
>    ;;
> -  --enable-virtfs) virtfs="yes"
> +  --enable-virtfs) virtfs="enabled"
>    ;;
>    --disable-libudev) libudev="disabled"
>    ;;
> @@ -5443,24 +5443,6 @@ if [ "$eventfd" = "yes" ]; then
>    ivshmem=yes
>  fi
>  
> -if test "$softmmu" = yes ; then
> -  if test "$linux" = yes; then
> -    if test "$virtfs" != no && test "$cap_ng" = yes && test "$attr"
> = yes ; then
> -      virtfs=yes
> -    else
> -      if test "$virtfs" = yes; then
> -        error_exit "VirtFS requires libcap-ng devel and libattr
> devel"
> -      fi
> -      virtfs=no
> -    fi
> -  else
> -    if test "$virtfs" = yes; then
> -      error_exit "VirtFS is supported only on Linux"
> -    fi
> -    virtfs=no
> -  fi
> -fi
> -
>  # Probe for guest agent support/options
>  
>  if [ "$guest_agent" != "no" ]; then
> @@ -5917,9 +5899,6 @@ fi
>  if test "$libattr" = "yes" ; then
>    echo "CONFIG_LIBATTR=y" >> $config_host_mak
>  fi
> -if test "$virtfs" = "yes" ; then
> -  echo "CONFIG_VIRTFS=y" >> $config_host_mak
> -fi
>  if test "$vhost_scsi" = "yes" ; then
>    echo "CONFIG_VHOST_SCSI=y" >> $config_host_mak
>  fi
> @@ -6580,7 +6559,7 @@ NINJA=$ninja $meson setup \
>          -Dcurl=$curl -Dglusterfs=$glusterfs -Dbzip2=$bzip2 -
> Dlibiscsi=$libiscsi \
>          -Dlibnfs=$libnfs -Diconv=$iconv -Dcurses=$curses -
> Dlibudev=$libudev\
>          -Dlibssh=$libssh -Drbd=$rbd -Dlzo=$lzo -Dsnappy=$snappy -
> Dlzfse=$lzfse \
> -        -Dzstd=$zstd -Dseccomp=$seccomp \
> +        -Dzstd=$zstd -Dseccomp=$seccomp -Dvirtfs=$virtfs \
>          -Ddocs=$docs -Dsphinx_build=$sphinx_build -
> Dinstall_blobs=$blobs \
>          -Dvhost_user_blk_server=$vhost_user_blk_server \
>          -Dfuse=$fuse -Dfuse_lseek=$fuse_lseek \
> diff --git a/meson.build b/meson.build
> index 99c4d0dd1a..22413b4f16 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -963,6 +963,25 @@ endif
>  # config-host.h #
>  #################
>  
> +have_virtfs = (targetos == 'linux' and
> +    have_system and
> +    libattr.found() and
> +    libcap_ng.found())
> +
> +if get_option('virtfs').enabled()
> +  if not have_virtfs
> +    if targetos != 'linux'
> +      error('virtio-9p (virtfs) requires Linux')
> +    elif not libcap_ng.found() or not libattr.found()
> +      error('virtio-9p (virtfs) requires libcap-ng-devel and
> libattr-devel')
> +    elif not have_system
> +      error('virtio-9p (virtfs) needs system emulation support')
> +    endif
> +  endif
> +elif get_option('virtfs').disabled()
> +  have_virtfs = false
> +endif
> +
>  config_host_data.set_quoted('CONFIG_BINDIR', get_option('prefix') /
> get_option('bindir'))
>  config_host_data.set_quoted('CONFIG_PREFIX', get_option('prefix'))
>  config_host_data.set_quoted('CONFIG_QEMU_CONFDIR',
> get_option('prefix') / qemu_confdir)
> @@ -1007,6 +1026,7 @@ config_host_data.set('CONFIG_VNC', vnc.found())
>  config_host_data.set('CONFIG_VNC_JPEG', jpeg.found())
>  config_host_data.set('CONFIG_VNC_PNG', png.found())
>  config_host_data.set('CONFIG_VNC_SASL', sasl.found())
> +config_host_data.set('CONFIG_VIRTFS', have_virtfs)
>  config_host_data.set('CONFIG_XKBCOMMON', xkbcommon.found())
>  config_host_data.set('CONFIG_KEYUTILS', keyutils.found())
>  config_host_data.set('CONFIG_GETTID', has_gettid)
> @@ -1105,7 +1125,7 @@ host_kconfig = \
>    ('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']
> : []) + \
> -  ('CONFIG_VIRTFS' in config_host ? ['CONFIG_VIRTFS=y'] : []) + \
> +  (have_virtfs ? ['CONFIG_VIRTFS=y'] : []) + \
>    ('CONFIG_LINUX' in config_host ? ['CONFIG_LINUX=y'] : []) + \
>    ('CONFIG_PVRDMA' in config_host ? ['CONFIG_PVRDMA=y'] : [])
>  
> @@ -2294,7 +2314,7 @@ summary_info += {'mingw32 support':   targetos
> == 'windows'}
>  summary_info += {'Audio drivers':    
> config_host['CONFIG_AUDIO_DRIVERS']}
>  summary_info += {'Block whitelist (rw)':
> config_host['CONFIG_BDRV_RW_WHITELIST']}
>  summary_info += {'Block whitelist (ro)':
> config_host['CONFIG_BDRV_RO_WHITELIST']}
> -summary_info += {'VirtFS support':   
> config_host.has_key('CONFIG_VIRTFS')}
> +summary_info += {'VirtFS support':    have_virtfs}
>  summary_info += {'build virtiofs daemon': have_virtiofsd}
>  summary_info += {'Multipath support': mpathpersist.found()}
>  summary_info += {'VNC support':       vnc.found()}
> diff --git a/meson_options.txt b/meson_options.txt
> index 1854a9639f..59a8a50e5b 100644
> --- a/meson_options.txt
> +++ b/meson_options.txt
> @@ -90,10 +90,6 @@ option('vnc_sasl', type : 'feature', value :
> 'auto',
>         description: 'SASL authentication for VNC server')
>  option('xkbcommon', type : 'feature', value : 'auto',
>         description: 'xkbcommon support')
> -option('virtiofsd', type: 'feature', value: 'auto',
> -       description: 'build virtiofs daemon (virtiofsd)')
> -option('vhost_user_blk_server', type: 'feature', value: 'auto',
> -       description: 'build vhost-user-blk server')
>  option('zstd', type : 'feature', value : 'auto',
>         description: 'zstd compression support')
>  option('fuse', type: 'feature', value: 'auto',
> @@ -101,6 +97,13 @@ option('fuse', type: 'feature', value: 'auto',
>  option('fuse_lseek', type : 'feature', value : 'auto',
>         description: 'SEEK_HOLE/SEEK_DATA support for FUSE exports')
>  
> +option('vhost_user_blk_server', type: 'feature', value: 'auto',
> +       description: 'build vhost-user-blk server')
> +option('virtfs', type: 'feature', value: 'auto',
> +       description: 'virtio-9p support')
> +option('virtiofsd', type: 'feature', value: 'auto',
> +       description: 'build virtiofs daemon (virtiofsd)')
> +
>  option('capstone', type: 'combo', value: 'auto',
>         choices: ['disabled', 'enabled', 'auto', 'system',
> 'internal'],
>         description: 'Whether and how to find the capstone library')

I noticed that for me, this broke the building of virtfs-proxy-helper.
I've not yet figured out what the fix should be, but thought you'd want
to know.

-Bruce



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

* Re: [PULL 50/55] virtfs: convert to meson
  2021-01-07 13:58   ` Bruce Rogers
@ 2021-01-07 14:49     ` Paolo Bonzini
  2021-01-07 15:31       ` Bruce Rogers
  0 siblings, 1 reply; 61+ messages in thread
From: Paolo Bonzini @ 2021-01-07 14:49 UTC (permalink / raw)
  To: Bruce Rogers, qemu-devel

On 07/01/21 14:58, Bruce Rogers wrote:
> I noticed that for me, this broke the building of virtfs-proxy-helper.
> I've not yet figured out what the fix should be, but thought you'd want
> to know.

Possibly:

diff --git a/fsdev/meson.build b/fsdev/meson.build
index 7dd1cc9bfb..65455a179e 100644
--- a/fsdev/meson.build
+++ b/fsdev/meson.build
@@ -8,7 +8,7 @@ fsdev_ss.add(when: ['CONFIG_FSDEV_9P'], if_true: files(
  ), if_false: files('qemu-fsdev-dummy.c'))
  softmmu_ss.add_all(when: 'CONFIG_LINUX', if_true: fsdev_ss)

-have_virtfs_proxy_helper = have_tools and libattr.found() and 
libcap_ng.found() and 'CONFIG_VIRTFS' in config_host
+have_virtfs_proxy_helper = have_tools and libattr.found() and 
libcap_ng.found() and have_virtfs
  if have_virtfs_proxy_helper
    executable('virtfs-proxy-helper',
               files('virtfs-proxy-helper.c', '9p-marshal.c', 
'9p-iov-marshal.c'),
diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build
index 450af3e51c..b8e19bbc81 100644
--- a/tests/qtest/meson.build
+++ b/tests/qtest/meson.build
@@ -199,7 +199,9 @@ qos_test_ss.add(
    'virtio-serial-test.c',
    'vmxnet3-test.c',
  )
-qos_test_ss.add(when: 'CONFIG_VIRTFS', if_true: files('virtio-9p-test.c'))
+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'))

  tpmemu_files = ['tpm-emu.c', 'tpm-util.c', 'tpm-tests.c']

Since CONFIG_VIRTFS does not exist anymore.  Sorry.

Paolo



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

* Re: [PULL 50/55] virtfs: convert to meson
  2021-01-07 14:49     ` Paolo Bonzini
@ 2021-01-07 15:31       ` Bruce Rogers
  0 siblings, 0 replies; 61+ messages in thread
From: Bruce Rogers @ 2021-01-07 15:31 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel

On Thu, 2021-01-07 at 15:49 +0100, Paolo Bonzini wrote:
> On 07/01/21 14:58, Bruce Rogers wrote:
> > I noticed that for me, this broke the building of virtfs-proxy-
> > helper.
> > I've not yet figured out what the fix should be, but thought you'd
> > want
> > to know.
> 
> Possibly:
> 
> diff --git a/fsdev/meson.build b/fsdev/meson.build
> index 7dd1cc9bfb..65455a179e 100644
> --- a/fsdev/meson.build
> +++ b/fsdev/meson.build
> @@ -8,7 +8,7 @@ fsdev_ss.add(when: ['CONFIG_FSDEV_9P'], if_true:
> files(
>   ), if_false: files('qemu-fsdev-dummy.c'))
>   softmmu_ss.add_all(when: 'CONFIG_LINUX', if_true: fsdev_ss)
> 
> -have_virtfs_proxy_helper = have_tools and libattr.found() and 
> libcap_ng.found() and 'CONFIG_VIRTFS' in config_host
> +have_virtfs_proxy_helper = have_tools and libattr.found() and 
> libcap_ng.found() and have_virtfs
>   if have_virtfs_proxy_helper
>     executable('virtfs-proxy-helper',
>                files('virtfs-proxy-helper.c', '9p-marshal.c', 
> '9p-iov-marshal.c'),
> diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build
> index 450af3e51c..b8e19bbc81 100644
> --- a/tests/qtest/meson.build
> +++ b/tests/qtest/meson.build
> @@ -199,7 +199,9 @@ qos_test_ss.add(
>     'virtio-serial-test.c',
>     'vmxnet3-test.c',
>   )
> -qos_test_ss.add(when: 'CONFIG_VIRTFS', if_true: files('virtio-9p-
> test.c'))
> +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'))
> 
>   tpmemu_files = ['tpm-emu.c', 'tpm-util.c', 'tpm-tests.c']
> 
> Since CONFIG_VIRTFS does not exist anymore.  Sorry.
> 
> Paolo
> 

Looks like that solves the issue. Thanks.
- Bruce



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

end of thread, other threads:[~2021-01-07 15:32 UTC | newest]

Thread overview: 61+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-21 14:43 [PULL 00/55] Misc patches for 2020-12-21 Paolo Bonzini
2020-12-21 14:43 ` [PULL 01/55] gitlab: include aarch64-softmmu and ppc64-softmmu cross-system-build Paolo Bonzini
2020-12-21 14:43 ` [PULL 02/55] configure: move gettext detection to meson.build Paolo Bonzini
2020-12-21 14:43 ` [PULL 03/55] configure: add --without-default-features Paolo Bonzini
2020-12-21 14:43 ` [PULL 04/55] python: add __repr__ to ConsoleSocket to aid debugging Paolo Bonzini
2020-12-21 14:43 ` [PULL 05/55] gitlab: move --without-default-devices build from Travis Paolo Bonzini
2020-12-21 14:43 ` [PULL 06/55] gitlab: add --without-default-features build Paolo Bonzini
2020-12-21 14:43 ` [PULL 07/55] tests/tcg: build tests with -Werror Paolo Bonzini
2020-12-21 14:44 ` [PULL 08/55] gitlab-CI: Test 32-bit builds with the fedora-i386-cross container Paolo Bonzini
2020-12-21 14:44 ` [PULL 09/55] tests/docker: Remove the remainders of debian9 containers from the Makefile Paolo Bonzini
2020-12-21 14:44 ` [PULL 10/55] tests: update for rename of CentOS8 PowerTools repo Paolo Bonzini
2020-12-21 14:44 ` [PULL 11/55] configure: document --without-default-{features, devices} Paolo Bonzini
2020-12-21 14:44 ` [PULL 12/55] vl: initialize displays _after_ exiting preconfiguration Paolo Bonzini
2020-12-21 14:44 ` [PULL 13/55] test-char: Destroy chardev correctly at char_file_test_internal() Paolo Bonzini
2020-12-21 14:44 ` [PULL 14/55] qom: Assert that objects being destroyed have no parent Paolo Bonzini
2020-12-21 14:44 ` [PULL 15/55] target/i386: Check privilege level for protected mode 'int N' task gate Paolo Bonzini
2020-12-21 14:44 ` [PULL 16/55] configure,meson: add option to enable LTO Paolo Bonzini
2020-12-21 14:44 ` [PULL 17/55] cfi: Initial support for cfi-icall in QEMU Paolo Bonzini
2020-12-21 14:44 ` [PULL 18/55] check-block: enable iotests with cfi-icall Paolo Bonzini
2020-12-21 14:44 ` [PULL 19/55] configure,meson: support Control-Flow Integrity Paolo Bonzini
2020-12-21 14:44 ` [PULL 20/55] docs: Add CFI Documentation Paolo Bonzini
2020-12-21 14:44 ` [PULL 21/55] build-sys: fix -static linking of libvhost-user Paolo Bonzini
2020-12-21 14:44 ` [PULL 22/55] remove TCG includes from common code Paolo Bonzini
2020-12-21 14:44 ` [PULL 23/55] util: Extract flush_icache_range to cacheflush.c Paolo Bonzini
2020-12-21 14:44 ` [PULL 24/55] trace: do not include TCG helper tracepoints in no-TCG builds Paolo Bonzini
2020-12-21 14:44 ` [PULL 25/55] Makefile: add dummy target for build.ninja dependencies Paolo Bonzini
2020-12-21 14:44 ` [PULL 26/55] meson: update submodule to 0.56.0 Paolo Bonzini
2020-12-21 14:44 ` [PULL 27/55] meson: switch minimum meson version " Paolo Bonzini
2020-12-21 14:44 ` [PULL 28/55] meson: fix detection of curses with pkgconfig Paolo Bonzini
2020-12-21 14:44 ` [PULL 29/55] meson: use pkg-config method for libudev Paolo Bonzini
2020-12-21 14:44 ` [PULL 30/55] meson: use dependency to gate block modules Paolo Bonzini
2020-12-21 14:44 ` [PULL 31/55] meson: cleanup Kconfig.host handling Paolo Bonzini
2020-12-21 14:44 ` [PULL 32/55] configure: remove useless code to check for Xen PCI passthrough Paolo Bonzini
2020-12-21 14:44 ` [PULL 33/55] configure: remove variable bogus_os Paolo Bonzini
2020-12-21 14:44 ` [PULL 34/55] configure: accept --enable-slirp Paolo Bonzini
2020-12-21 14:44 ` [PULL 35/55] configure: remove CONFIG_FILEVERSION and CONFIG_PRODUCTVERSION Paolo Bonzini
2020-12-21 14:44 ` [PULL 36/55] brlapi: convert to meson Paolo Bonzini
2020-12-21 14:44 ` [PULL 37/55] curl: remove compatibility code, require 7.29.0 Paolo Bonzini
2020-12-21 14:44 ` [PULL 38/55] curl: convert to meson Paolo Bonzini
2020-12-21 14:44 ` [PULL 39/55] glusterfs: " Paolo Bonzini
2020-12-21 14:44 ` [PULL 40/55] bzip2: " Paolo Bonzini
2020-12-21 14:44 ` [PULL 41/55] libiscsi: " Paolo Bonzini
2020-12-21 14:44 ` [PULL 42/55] libnfs: " Paolo Bonzini
2020-12-21 14:44 ` [PULL 43/55] libssh: " Paolo Bonzini
2020-12-21 14:44 ` [PULL 44/55] rbd: " Paolo Bonzini
2020-12-21 14:44 ` [PULL 45/55] lzo: " Paolo Bonzini
2020-12-21 14:44 ` [PULL 46/55] snappy: " Paolo Bonzini
2020-12-21 14:44 ` [PULL 47/55] lzfse: " Paolo Bonzini
2020-12-21 14:44 ` [PULL 48/55] zstd: " Paolo Bonzini
2020-12-21 14:44 ` [PULL 49/55] seccomp: " Paolo Bonzini
2020-12-21 14:44 ` [PULL 50/55] virtfs: " Paolo Bonzini
2021-01-07 13:58   ` Bruce Rogers
2021-01-07 14:49     ` Paolo Bonzini
2021-01-07 15:31       ` Bruce Rogers
2020-12-21 14:44 ` [PULL 51/55] cap_ng: " Paolo Bonzini
2020-12-21 14:44 ` [PULL 52/55] libattr: " Paolo Bonzini
2020-12-21 14:44 ` [PULL 53/55] meson.build: convert --with-default-devices " Paolo Bonzini
2020-12-21 14:44 ` [PULL 54/55] configure: move tests/qemu-iotests/common.env generation " Paolo Bonzini
2020-12-21 14:44 ` [PULL 55/55] win32: drop fd registration to the main-loop on setting non-block Paolo Bonzini
2021-01-01 17:05 ` [PULL 00/55] Misc patches for 2020-12-21 Peter Maydell
2021-01-01 19:59   ` Paolo Bonzini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).