Skip to contentSkip to conversation

Misc patches for 2021-12-20

GIT PULL Applied Paolo Bonzini 4 participants 23 messages Dec 19, 2021 – Jul 20, 2022 Arm/Amlogic Meson SoC support

lore
Share & tools
lore
#0 lore raw

The following changes since commit 90978e15bc9a23c208b25bf7ea697a5d0925562b:

Merge tag 'trivial-branch-for-7.0-pull-request' of https://gitlab.com/laurent_vivier/qemu into staging (2021-12-17 13:15:38 -0800)

are available in the Git repository at:

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

for you to fetch changes up to 5a3a2eb3b1096a52580c1b8c3eb0739714e7d941:

hw/i386/vmmouse: Require 'i8042' property to be set (2021-12-18 10:57:37 +0100)

----------------------------------------------------------------
* configure and meson cleanups and fixes
* remove unnecessary #ifdef
* SCSI and i386 fixes

----------------------------------------------------------------
Paolo Bonzini (12):
configure: make $targetos lowercase, use windows instead of MINGW32
configure: move target detection before CPU detection
configure: unify two case statements on $cpu
configure: unify ppc64 and ppc64le
configure: unify x86_64 and x32
meson: rename "arch" variable
configure, meson: move ARCH to meson.build
configure: remove unnecessary symlinks
configure: remove DIRS
meson: reenable test-fdmon-epoll
cpu: remove unnecessary #ifdef CONFIG_TCG
meson: add "check" argument to run_command

Philippe Mathieu-Daudé (4):
hw/scsi: Fix scsi_bus_init_named() docstring hw/scsi/megasas: Fails command if SGL buffer overflows tests/qtest/fuzz-megasas-test: Add test for GitLab issue #521 hw/i386/vmmouse: Require 'i8042' property to be set

 configure                       | 253 +++++++++++++++++-----------------------
 cpu.c                           |   5 -
 docs/meson.build                |   6 +-
 hw/i386/vmmouse.c               |   4 +
 hw/scsi/megasas.c               |   1 +
 include/exec/cpu-all.h          |   2 -
 include/hw/scsi/scsi.h          |   2 +-
 meson.build                     |  39 ++++---
 pc-bios/meson.build             |   2 +-
 tests/qtest/fuzz-megasas-test.c |  30 +++++
 tests/tcg/configure.sh          |   4 +-
 tests/unit/meson.build          |   2 +-
 12 files changed, 173 insertions(+), 177 deletions(-)
Signature · 1 line
2.33.1
#1 lore raw

[PULL 03/16] configure: unify two case statements on $cpu

---
 configure | 67 ++++++++++++++++++++++++++-----------------------------
 1 file changed, 32 insertions(+), 35 deletions(-)
configure +32 -35
index f0a82dd8f5..77ccc15b73 100755
@@ -636,32 +636,47 @@ else
 fi
 
 ARCH=
-# Normalise host CPU name and set ARCH.
+# Normalise host CPU name, set ARCH and multilib cflags
 # Note that this case should only have supported host CPUs, not guests.
 case "$cpu" in
-  ppc|ppc64|s390x|sparc64|x32|riscv)
-  ;;
-  ppc64le)
-    ARCH="ppc64"
-  ;;
+  aarch64|riscv) ;;
+  armv*b|armv*l|arm)
+    cpu="arm" ;;
+
   i386|i486|i586|i686|i86pc|BePC)
     cpu="i386"
-  ;;
+    CPU_CFLAGS="-m32" ;;
+  x32)
+    CPU_CFLAGS="-mx32" ;;
   x86_64|amd64)
     cpu="x86_64"
-  ;;
-  armv*b|armv*l|arm)
-    cpu="arm"
-  ;;
-  aarch64)
-    cpu="aarch64"
-  ;;
+    # ??? Only extremely old AMD cpus do not have cmpxchg16b.
+    # If we truly care, we should simply detect this case at
+    # runtime and generate the fallback to serial emulation.
+    CPU_CFLAGS="-m64 -mcx16" ;;
+
   mips*)
-    cpu="mips"
-  ;;
+    cpu="mips" ;;
+
+  ppc)
+    CPU_CFLAGS="-m32" ;;
+  ppc64)
+    CPU_CFLAGS="-m64" ;;
+  ppc64le)
+    ARCH="ppc64" ;;
+
+  s390)
+    CPU_CFLAGS="-m31"
+    ARCH=unknown ;;
+  s390x)
+    CPU_CFLAGS="-m64" ;;
+
   sparc|sun4[cdmuv])
     cpu="sparc"
-  ;;
+    CPU_CFLAGS="-m32 -mv8plus -mcpu=ultrasparc" ;;
+  sparc64)
+    CPU_CFLAGS="-m64 -mcpu=ultrasparc" ;;
+
   *)
     # This will result in either an error or falling back to TCI later
     ARCH=unknown
@@ -1252,24 +1267,6 @@ local_statedir="${local_statedir:-$prefix/var}"
 firmwarepath="${firmwarepath:-$datadir/qemu-firmware}"
 localedir="${localedir:-$datadir/locale}"
 
-case "$cpu" in
-    ppc) CPU_CFLAGS="-m32" ;;
-    ppc64) CPU_CFLAGS="-m64" ;;
-    sparc) CPU_CFLAGS="-m32 -mv8plus -mcpu=ultrasparc" ;;
-    sparc64) CPU_CFLAGS="-m64 -mcpu=ultrasparc" ;;
-    s390) CPU_CFLAGS="-m31" ;;
-    s390x) CPU_CFLAGS="-m64" ;;
-    i386) CPU_CFLAGS="-m32" ;;
-    x32) CPU_CFLAGS="-mx32" ;;
-
-    # ??? Only extremely old AMD cpus do not have cmpxchg16b.
-    # If we truly care, we should simply detect this case at
-    # runtime and generate the fallback to serial emulation.
-    x86_64) CPU_CFLAGS="-m64 -mcx16" ;;
-
-    # No special flags required for other host CPUs
-esac
-
 if eval test -z "\${cross_cc_$cpu}"; then
     eval "cross_cc_${cpu}=\$cc"
     cross_cc_vars="$cross_cc_vars cross_cc_${cpu}"
Signature · 1 line
2.33.1
#2 lore raw

[PULL 01/16] configure: make $targetos lowercase, use windows instead of MINGW32

In reply to Paolo Bonzini

targetos is already mostly the same as Meson host_machine.system(), just in CamelCase. Adjust Windows, which is different, and switch to lowercase to match Meson.

---
 configure | 58 ++++++++++++++++++++++++-------------------------------
 1 file changed, 25 insertions(+), 33 deletions(-)
configure +25 -33
index 28e1cf6291..e72e34b684 100755
@@ -501,30 +501,30 @@ EOF
 }
 
 if check_define __linux__ ; then
-  targetos="Linux"
+  targetos=linux
 elif check_define _WIN32 ; then
-  targetos='MINGW32'
+  targetos=windows
 elif check_define __OpenBSD__ ; then
-  targetos='OpenBSD'
+  targetos=openbsd
 elif check_define __sun__ ; then
-  targetos='SunOS'
+  targetos=sunos
 elif check_define __HAIKU__ ; then
-  targetos='Haiku'
+  targetos=haiku
 elif check_define __FreeBSD__ ; then
-  targetos='FreeBSD'
+  targetos=freebsd
 elif check_define __FreeBSD_kernel__ && check_define __GLIBC__; then
-  targetos='GNU/kFreeBSD'
+  targetos=gnu/kfreebsd
 elif check_define __DragonFly__ ; then
-  targetos='DragonFly'
+  targetos=dragonfly
 elif check_define __NetBSD__; then
-  targetos='NetBSD'
+  targetos=netbsd
 elif check_define __APPLE__; then
-  targetos='Darwin'
+  targetos=darwin
 else
   # This is a fatal error, but don't report it yet, because we
   # might be going to just print the --help text, or it might
   # be the result of a missing compiler.
-  targetos='bogus'
+  targetos=bogus
 fi
 
 # Some host OSes need non-standard checks for which CPU to use.
@@ -532,7 +532,7 @@ fi
 # cross-compiling to one of these OSes then you'll need to specify
 # the correct CPU with the --cpu option.
 case $targetos in
-SunOS)
+sunos)
   # $(uname -m) returns i86pc even on an x86_64 box, so default based on isainfo
   if test -z "$cpu" && test "$(isainfo -k)" = "amd64"; then
     cpu="x86_64"
@@ -623,40 +623,40 @@ fi
 # OS specific
 
 case $targetos in
-MINGW32*)
+windows)
   mingw32="yes"
   plugins="no"
   pie="no"
 ;;
-GNU/kFreeBSD)
+gnu/kfreebsd)
   bsd="yes"
 ;;
-FreeBSD)
+freebsd)
   bsd="yes"
   bsd_user="yes"
   make="${MAKE-gmake}"
   # needed for kinfo_getvmmap(3) in libutil.h
 ;;
-DragonFly)
+dragonfly)
   bsd="yes"
   make="${MAKE-gmake}"
 ;;
-NetBSD)
+netbsd)
   bsd="yes"
   make="${MAKE-gmake}"
 ;;
-OpenBSD)
+openbsd)
   bsd="yes"
   make="${MAKE-gmake}"
 ;;
-Darwin)
+darwin)
   bsd="yes"
   darwin="yes"
   # Disable attempts to use ObjectiveC features in os/object.h since they
   # won't work when we're compiling with gcc as a C compiler.
   QEMU_CFLAGS="-DOS_OBJECT_USE_OBJC=0 $QEMU_CFLAGS"
 ;;
-SunOS)
+sunos)
   solaris="yes"
   make="${MAKE-gmake}"
   smbd="${SMBD-/usr/sfw/sbin/smbd}"
@@ -665,11 +665,11 @@ SunOS)
 # needed for TIOCWIN* defines in termios.h
   QEMU_CFLAGS="-D__EXTENSIONS__ $QEMU_CFLAGS"
 ;;
-Haiku)
+haiku)
   pie="no"
   QEMU_CFLAGS="-DB_USE_POSITIVE_POSIX_ERRORS -D_BSD_SOURCE -fPIC $QEMU_CFLAGS"
 ;;
-Linux)
+linux)
   linux="yes"
   linux_user="yes"
   vhost_user=${default_feature:-yes}
@@ -3334,8 +3334,8 @@ QEMU_GA_MSI_MINGW_DLL_PATH="$($pkg_config --variable=prefix glib-2.0)/bin"
 # Mac OS X ships with a broken assembler
 roms=
 if { test "$cpu" = "i386" || test "$cpu" = "x86_64"; } && \
-        test "$targetos" != "Darwin" && test "$targetos" != "SunOS" && \
-        test "$targetos" != "Haiku" && test "$softmmu" = yes ; then
+        test "$targetos" != "darwin" && test "$targetos" != "sunos" && \
+        test "$targetos" != "haiku" && test "$softmmu" = yes ; then
     # Different host OS linkers have different ideas about the name of the ELF
     # emulation. Linux and OpenBSD/amd64 use 'elf_i386'; FreeBSD uses the _fbsd
     # variant; OpenBSD/i386 uses the _obsd variant; and Windows uses i386pe.
@@ -3903,15 +3903,7 @@ if test "$skip_meson" = no; then
   if test "$cross_compile" = "yes"; then
     cross_arg="--cross-file config-meson.cross"
     echo "[host_machine]" >> $cross
-    if test "$mingw32" = "yes" ; then
-        echo "system = 'windows'" >> $cross
-    fi
-    if test "$linux" = "yes" ; then
-        echo "system = 'linux'" >> $cross
-    fi
-    if test "$darwin" = "yes" ; then
-        echo "system = 'darwin'" >> $cross
-    fi
+    echo "system = '$targetos'" >> $cross
     case "$ARCH" in
         i386)
             echo "cpu_family = 'x86'" >> $cross
Signature · 1 line
2.33.1
#3 lore raw

[PULL 02/16] configure: move target detection before CPU detection

In reply to Paolo Bonzini

This makes more sense, since target detection can affect CPU detection on Solaris.

---
 configure | 115 ++++++++++++++++++++++++++----------------------------
 1 file changed, 55 insertions(+), 60 deletions(-)
configure +55 -60
index e72e34b684..f0a82dd8f5 100755
@@ -527,16 +527,67 @@ else
   targetos=bogus
 fi
 
-# Some host OSes need non-standard checks for which CPU to use.
-# Note that these checks are broken for cross-compilation: if you're
-# cross-compiling to one of these OSes then you'll need to specify
-# the correct CPU with the --cpu option.
+# OS specific
+
 case $targetos in
+windows)
+  mingw32="yes"
+  plugins="no"
+  pie="no"
+;;
+gnu/kfreebsd)
+  bsd="yes"
+;;
+freebsd)
+  bsd="yes"
+  bsd_user="yes"
+  make="${MAKE-gmake}"
+  # needed for kinfo_getvmmap(3) in libutil.h
+;;
+dragonfly)
+  bsd="yes"
+  make="${MAKE-gmake}"
+;;
+netbsd)
+  bsd="yes"
+  make="${MAKE-gmake}"
+;;
+openbsd)
+  bsd="yes"
+  make="${MAKE-gmake}"
+;;
+darwin)
+  bsd="yes"
+  darwin="yes"
+  # Disable attempts to use ObjectiveC features in os/object.h since they
+  # won't work when we're compiling with gcc as a C compiler.
+  QEMU_CFLAGS="-DOS_OBJECT_USE_OBJC=0 $QEMU_CFLAGS"
+;;
 sunos)
+  solaris="yes"
+  make="${MAKE-gmake}"
+  smbd="${SMBD-/usr/sfw/sbin/smbd}"
+# needed for CMSG_ macros in sys/socket.h
+  QEMU_CFLAGS="-D_XOPEN_SOURCE=600 $QEMU_CFLAGS"
+# needed for TIOCWIN* defines in termios.h
+  QEMU_CFLAGS="-D__EXTENSIONS__ $QEMU_CFLAGS"
   # $(uname -m) returns i86pc even on an x86_64 box, so default based on isainfo
+  # Note that this check is broken for cross-compilation: if you're
+  # cross-compiling to one of these OSes then you'll need to specify
+  # the correct CPU with the --cpu option.
   if test -z "$cpu" && test "$(isainfo -k)" = "amd64"; then
     cpu="x86_64"
   fi
+;;
+haiku)
+  pie="no"
+  QEMU_CFLAGS="-DB_USE_POSITIVE_POSIX_ERRORS -D_BSD_SOURCE -fPIC $QEMU_CFLAGS"
+;;
+linux)
+  linux="yes"
+  linux_user="yes"
+  vhost_user=${default_feature:-yes}
+;;
 esac
 
 if test ! -z "$cpu" ; then
@@ -620,62 +671,6 @@ if test -z "$ARCH"; then
   ARCH="$cpu"
 fi
 
-# OS specific
-
-case $targetos in
-windows)
-  mingw32="yes"
-  plugins="no"
-  pie="no"
-;;
-gnu/kfreebsd)
-  bsd="yes"
-;;
-freebsd)
-  bsd="yes"
-  bsd_user="yes"
-  make="${MAKE-gmake}"
-  # needed for kinfo_getvmmap(3) in libutil.h
-;;
-dragonfly)
-  bsd="yes"
-  make="${MAKE-gmake}"
-;;
-netbsd)
-  bsd="yes"
-  make="${MAKE-gmake}"
-;;
-openbsd)
-  bsd="yes"
-  make="${MAKE-gmake}"
-;;
-darwin)
-  bsd="yes"
-  darwin="yes"
-  # Disable attempts to use ObjectiveC features in os/object.h since they
-  # won't work when we're compiling with gcc as a C compiler.
-  QEMU_CFLAGS="-DOS_OBJECT_USE_OBJC=0 $QEMU_CFLAGS"
-;;
-sunos)
-  solaris="yes"
-  make="${MAKE-gmake}"
-  smbd="${SMBD-/usr/sfw/sbin/smbd}"
-# needed for CMSG_ macros in sys/socket.h
-  QEMU_CFLAGS="-D_XOPEN_SOURCE=600 $QEMU_CFLAGS"
-# needed for TIOCWIN* defines in termios.h
-  QEMU_CFLAGS="-D__EXTENSIONS__ $QEMU_CFLAGS"
-;;
-haiku)
-  pie="no"
-  QEMU_CFLAGS="-DB_USE_POSITIVE_POSIX_ERRORS -D_BSD_SOURCE -fPIC $QEMU_CFLAGS"
-;;
-linux)
-  linux="yes"
-  linux_user="yes"
-  vhost_user=${default_feature:-yes}
-;;
-esac
-
 : ${make=${MAKE-make}}
 
 # We prefer python 3.x. A bare 'python' is traditionally
Signature · 1 line
2.33.1
#4 lore raw

[PULL 05/16] configure: unify x86_64 and x32

In reply to Paolo Bonzini

The only difference between the two, as far as either configure or Meson are concerned, is in the multilib flags passed to the compiler.

For QEMU, this fixes the handling of TYPE_OLDDEVT in include/exec/user/thunk.h and enables testing of dirty ring buffer, because both are using HOST_X86_64.

For tests/tcg, this means that on a hypothetical x32 host the cross compiler will not be used to build the tests.

---
 configure   | 6 ++----
 meson.build | 3 +--
 2 files changed, 3 insertions(+), 6 deletions(-)
configure +2 -4
index 85caf2e9ef..108b7621e2 100755
@@ -647,6 +647,7 @@ case "$cpu" in
     cpu="i386"
     CPU_CFLAGS="-m32" ;;
   x32)
+    cpu="x86_64"
     CPU_CFLAGS="-mx32" ;;
   x86_64|amd64)
     cpu="x86_64"
@@ -3719,7 +3720,7 @@ fi
 if test "$linux" = "yes" ; then
   mkdir -p linux-headers
   case "$cpu" in
-  i386|x86_64|x32)
+  i386|x86_64)
     linux_arch=x86
     ;;
   ppc|ppc64)
@@ -3901,9 +3902,6 @@ if test "$skip_meson" = no; then
         i386)
             echo "cpu_family = 'x86'" >> $cross
             ;;
-        x86_64|x32)
-            echo "cpu_family = 'x86_64'" >> $cross
-            ;;
         *)
             echo "cpu_family = '$ARCH'" >> $cross
             ;;
meson.build +1 -2
index ae67ca28ab..69cca2aa9f 100644
@@ -355,7 +355,7 @@ if not get_option('tcg').disabled()
     tcg_arch = 'tci'
   elif config_host['ARCH'] == 'sparc64'
     tcg_arch = 'sparc'
-  elif config_host['ARCH'] in ['x86_64', 'x32']
+  elif config_host['ARCH'] == 'x86_64'
     tcg_arch = 'i386'
   elif config_host['ARCH'] == 'ppc64'
     tcg_arch = 'ppc'
@@ -1806,7 +1806,6 @@ disassemblers = {
   'hppa' : ['CONFIG_HPPA_DIS'],
   'i386' : ['CONFIG_I386_DIS'],
   'x86_64' : ['CONFIG_I386_DIS'],
-  'x32' : ['CONFIG_I386_DIS'],
   'm68k' : ['CONFIG_M68K_DIS'],
   'microblaze' : ['CONFIG_MICROBLAZE_DIS'],
   'mips' : ['CONFIG_MIPS_DIS'],
Signature · 1 line
2.33.1
#5 lore raw

[PULL 04/16] configure: unify ppc64 and ppc64le

In reply to Paolo Bonzini

The only difference between the two, as far as either configure or Meson are concerned, is the default endianness of the compiler.

For tests/tcg, specify the endianness explicitly on the command line; for configure, do the same so that it is possible to have --cpu=ppc64le on a bigendian system or vice versa. Apart from this, cpu=ppc64le can be normalized to ppc64 also in configure and not just in the meson cross file.

---
 configure              | 10 ++++------
 tests/tcg/configure.sh |  4 +++-
 2 files changed, 7 insertions(+), 7 deletions(-)
configure +4 -6
index 77ccc15b73..85caf2e9ef 100755
@@ -661,9 +661,10 @@ case "$cpu" in
   ppc)
     CPU_CFLAGS="-m32" ;;
   ppc64)
-    CPU_CFLAGS="-m64" ;;
+    CPU_CFLAGS="-m64 -mbig" ;;
   ppc64le)
-    ARCH="ppc64" ;;
+    cpu="ppc64"
+    CPU_CFLAGS="-m64 -mlittle" ;;
 
   s390)
     CPU_CFLAGS="-m31"
@@ -3721,7 +3722,7 @@ if test "$linux" = "yes" ; then
   i386|x86_64|x32)
     linux_arch=x86
     ;;
-  ppc|ppc64|ppc64le)
+  ppc|ppc64)
     linux_arch=powerpc
     ;;
   s390x)
@@ -3903,9 +3904,6 @@ if test "$skip_meson" = no; then
         x86_64|x32)
             echo "cpu_family = 'x86_64'" >> $cross
             ;;
-        ppc64le)
-            echo "cpu_family = 'ppc64'" >> $cross
-            ;;
         *)
             echo "cpu_family = '$ARCH'" >> $cross
             ;;
tests/tcg/configure.sh +3 -1
index 9b76f58258..9ef913df5b 100755
@@ -64,7 +64,9 @@ fi
 : ${cross_cc_ppc="powerpc-linux-gnu-gcc"}
 : ${cross_cc_cflags_ppc="-m32"}
 : ${cross_cc_ppc64="powerpc64-linux-gnu-gcc"}
-: ${cross_cc_ppc64le="powerpc64le-linux-gnu-gcc"}
+: ${cross_cc_cflags_ppc64="-m64 -mbig"}
+: ${cross_cc_ppc64le="$cross_cc_ppc64"}
+: ${cross_cc_cflags_ppc64le="-m64 -mlittle"}
 : ${cross_cc_riscv64="riscv64-linux-gnu-gcc"}
 : ${cross_cc_s390x="s390x-linux-gnu-gcc"}
 : ${cross_cc_sh4="sh4-linux-gnu-gcc"}
Signature · 1 line
2.33.1
#6 lore raw

[PULL 06/16] meson: rename "arch" variable

In reply to Paolo Bonzini

Avoid confusion between the ARCH variable of configure/config-host.mak and the same-named variable of meson.build.

---
 meson.build | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
meson.build +6 -6
index 69cca2aa9f..4fdaa65b05 100644
@@ -2850,7 +2850,7 @@ emulators = {}
 foreach target : target_dirs
   config_target = config_target_mak[target]
   target_name = config_target['TARGET_NAME']
-  arch = config_target['TARGET_BASE_ARCH']
+  target_base_arch = config_target['TARGET_BASE_ARCH']
   arch_srcs = [config_target_h[target]]
   arch_deps = []
   c_args = ['-DNEED_CPU_H',
@@ -2866,11 +2866,11 @@ foreach target : target_dirs
   if target.endswith('-softmmu')
     qemu_target_name = 'qemu-system-' + target_name
     target_type='system'
-    t = target_softmmu_arch[arch].apply(config_target, strict: false)
+    t = target_softmmu_arch[target_base_arch].apply(config_target, strict: false)
     arch_srcs += t.sources()
     arch_deps += t.dependencies()
 
-    hw_dir = target_name == 'sparc64' ? 'sparc64' : arch
+    hw_dir = target_name == 'sparc64' ? 'sparc64' : target_base_arch
     hw = hw_arch[hw_dir].apply(config_target, strict: false)
     arch_srcs += hw.sources()
     arch_deps += hw.dependencies()
@@ -2881,8 +2881,8 @@ foreach target : target_dirs
     abi = config_target['TARGET_ABI_DIR']
     target_type='user'
     qemu_target_name = 'qemu-' + target_name
-    if arch in target_user_arch
-      t = target_user_arch[arch].apply(config_target, strict: false)
+    if target_base_arch in target_user_arch
+      t = target_user_arch[target_base_arch].apply(config_target, strict: false)
       arch_srcs += t.sources()
       arch_deps += t.dependencies()
     endif
@@ -2920,7 +2920,7 @@ foreach target : target_dirs
     arch_srcs += gdbstub_xml
   endif
 
-  t = target_arch[arch].apply(config_target, strict: false)
+  t = target_arch[target_base_arch].apply(config_target, strict: false)
   arch_srcs += t.sources()
   arch_deps += t.dependencies()
 
Signature · 1 line
2.33.1
#7 lore raw

[PULL 12/16] meson: add "check" argument to run_command

In reply to Paolo Bonzini

Meson is planning to change the default of the "check" argument to run_command (from false to true). Be explicit and include it in all invocations.

---
 docs/meson.build | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
docs/meson.build +3 -3
index 27c6e156ff..57b28a3146 100644
@@ -18,12 +18,12 @@ if sphinx_build.found()
   # This is a bit awkward but works: create a trivial document and
   # try to run it with our configuration file (which enforces a
   # version requirement). This will fail if sphinx-build is too old.
-  run_command('mkdir', ['-p', tmpdir / 'sphinx'])
-  run_command('touch', [tmpdir / 'sphinx/index.rst'])
+  run_command('mkdir', ['-p', tmpdir / 'sphinx'], check: true)
+  run_command('touch', [tmpdir / 'sphinx/index.rst'], check: true)
   sphinx_build_test_out = run_command(SPHINX_ARGS + [
     '-c', meson.current_source_dir(),
     '-b', 'html', tmpdir / 'sphinx',
-    tmpdir / 'sphinx/out'])
+    tmpdir / 'sphinx/out'], check: false)
   build_docs = (sphinx_build_test_out.returncode() == 0)
 
   if not build_docs
Signature · 1 line
2.33.1
#8 lore raw

[PULL 08/16] configure: remove unnecessary symlinks

In reply to Paolo Bonzini

Make pc-bios/meson.build use the files in the source tree as inputs to bzip2.

---
 configure           | 1 -
 pc-bios/meson.build | 2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)
configure +0 -1
index 6e06ac6161..ba85bbb54b 100755
@@ -3801,7 +3801,6 @@ for bios_file in \
     $source_path/pc-bios/*.img \
     $source_path/pc-bios/openbios-* \
     $source_path/pc-bios/u-boot.* \
-    $source_path/pc-bios/edk2-*.fd.bz2 \
     $source_path/pc-bios/palcode-* \
     $source_path/pc-bios/qemu_vga.ndrv
 
pc-bios/meson.build +1 -1
index b40ff3f2bd..1812a4084f 100644
@@ -15,7 +15,7 @@ if unpack_edk2_blobs
     roms += custom_target(f,
                   build_by_default: have_system,
                   output: f,
-                  input: '@[email protected]'.format(f),
+                  input: files('@[email protected]'.format(f)),
                   capture: true,
                   install: get_option('install_blobs'),
                   install_dir: qemu_datadir,
Signature · 1 line
2.33.1
#9 lore raw

[PULL 11/16] cpu: remove unnecessary #ifdef CONFIG_TCG

In reply to Paolo Bonzini

"if (tcg_enabled())" allows elision of the code inside it; we only need the prototype to exist, so that the code compile even for the --disable-tcg case.

---
 cpu.c                  | 5 -----
 include/exec/cpu-all.h | 2 --
 2 files changed, 7 deletions(-)
cpu.c +0 -5
index 9bce67ef55..945dd3dded 100644
@@ -137,12 +137,10 @@ void cpu_exec_realizefn(CPUState *cpu, Error **errp)
     if (!accel_cpu_realizefn(cpu, errp)) {
         return;
     }
-#ifdef CONFIG_TCG
     /* NB: errp parameter is unused currently */
     if (tcg_enabled()) {
         tcg_exec_realizefn(cpu, errp);
     }
-#endif /* CONFIG_TCG */
 
 #ifdef CONFIG_USER_ONLY
     assert(qdev_get_vmsd(DEVICE(cpu)) == NULL ||
@@ -169,12 +167,9 @@ void cpu_exec_unrealizefn(CPUState *cpu)
         vmstate_unregister(NULL, &vmstate_cpu_common, cpu);
     }
 #endif
-#ifdef CONFIG_TCG
-    /* NB: errp parameter is unused currently */
     if (tcg_enabled()) {
         tcg_exec_unrealizefn(cpu);
     }
-#endif /* CONFIG_TCG */
 
     cpu_list_remove(cpu);
 }
include/exec/cpu-all.h +0 -2
index 3c8e24292b..bb37239efa 100644
@@ -437,12 +437,10 @@ void dump_opcount_info(GString *buf);
 
 #endif /* !CONFIG_USER_ONLY */
 
-#ifdef CONFIG_TCG
 /* accel/tcg/cpu-exec.c */
 int cpu_exec(CPUState *cpu);
 void tcg_exec_realizefn(CPUState *cpu, Error **errp);
 void tcg_exec_unrealizefn(CPUState *cpu);
-#endif /* CONFIG_TCG */
 
 /* Returns: 0 on success, -1 on error */
 int cpu_memory_rw_debug(CPUState *cpu, target_ulong addr,
Signature · 1 line
2.33.1
#10 lore raw

[PULL 07/16] configure, meson: move ARCH to meson.build

In reply to Paolo Bonzini

$ARCH and the HOST_* symbols are only used by the QEMU build; configure uses $cpu instead. Remove it from config-host.mak.

---
 configure   | 21 ++++-----------------
 meson.build | 26 +++++++++++++++++---------
 2 files changed, 21 insertions(+), 26 deletions(-)
configure +4 -17
index 108b7621e2..6e06ac6161 100755
@@ -635,11 +635,9 @@ else
   cpu=$(uname -m)
 fi
 
-ARCH=
-# Normalise host CPU name, set ARCH and multilib cflags
+# Normalise host CPU name, set multilib cflags
 # Note that this case should only have supported host CPUs, not guests.
 case "$cpu" in
-  aarch64|riscv) ;;
   armv*b|armv*l|arm)
     cpu="arm" ;;
 
@@ -668,8 +666,7 @@ case "$cpu" in
     CPU_CFLAGS="-m64 -mlittle" ;;
 
   s390)
-    CPU_CFLAGS="-m31"
-    ARCH=unknown ;;
+    CPU_CFLAGS="-m31" ;;
   s390x)
     CPU_CFLAGS="-m64" ;;
 
@@ -678,15 +675,7 @@ case "$cpu" in
     CPU_CFLAGS="-m32 -mv8plus -mcpu=ultrasparc" ;;
   sparc64)
     CPU_CFLAGS="-m64 -mcpu=ultrasparc" ;;
-
-  *)
-    # This will result in either an error or falling back to TCI later
-    ARCH=unknown
-  ;;
 esac
-if test -z "$ARCH"; then
-  ARCH="$cpu"
-fi
 
 : ${make=${MAKE-make}}
 
@@ -3406,8 +3395,6 @@ echo "GIT=$git" >> $config_host_mak
 echo "GIT_SUBMODULES=$git_submodules" >> $config_host_mak
 echo "GIT_SUBMODULES_ACTION=$git_submodules_action" >> $config_host_mak
 
-echo "ARCH=$ARCH" >> $config_host_mak
-
 if test "$debug_tcg" = "yes" ; then
   echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak
 fi
@@ -3898,12 +3885,12 @@ if test "$skip_meson" = no; then
     cross_arg="--cross-file config-meson.cross"
     echo "[host_machine]" >> $cross
     echo "system = '$targetos'" >> $cross
-    case "$ARCH" in
+    case "$cpu" in
         i386)
             echo "cpu_family = 'x86'" >> $cross
             ;;
         *)
-            echo "cpu_family = '$ARCH'" >> $cross
+            echo "cpu_family = '$cpu'" >> $cross
             ;;
     esac
     echo "cpu = '$cpu'" >> $cross
meson.build +17 -9
index 4fdaa65b05..2495360fd0 100644
@@ -67,6 +67,14 @@ endif
 
 targetos = host_machine.system()
 
+if cpu not in supported_cpus
+  host_arch = 'unknown'
+elif cpu == 'x86'
+  host_arch = 'i386'
+else
+  host_arch = cpu
+endif
+
 if cpu in ['x86', 'x86_64']
   kvm_targets = ['i386-softmmu', 'x86_64-softmmu']
 elif cpu == 'aarch64'
@@ -335,9 +343,9 @@ if targetos == 'netbsd'
   endif
 endif
 
-tcg_arch = config_host['ARCH']
+tcg_arch = host_arch
 if not get_option('tcg').disabled()
-  if cpu not in supported_cpus
+  if host_arch == 'unknown'
     if get_option('tcg_interpreter')
       warning('Unsupported CPU @0@, will use TCG with TCI (slow)'.format(cpu))
     else
@@ -353,11 +361,11 @@ if not get_option('tcg').disabled()
   endif
   if get_option('tcg_interpreter')
     tcg_arch = 'tci'
-  elif config_host['ARCH'] == 'sparc64'
+  elif host_arch == 'sparc64'
     tcg_arch = 'sparc'
-  elif config_host['ARCH'] == 'x86_64'
+  elif host_arch == 'x86_64'
     tcg_arch = 'i386'
-  elif config_host['ARCH'] == 'ppc64'
+  elif host_arch == 'ppc64'
     tcg_arch = 'ppc'
   endif
   add_project_arguments('-iquote', meson.current_source_dir() / 'tcg' / tcg_arch,
@@ -1426,6 +1434,8 @@ 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('HOST_' + host_arch.to_upper(), 1)
+
 config_host_data.set('CONFIG_ATTR', libattr.found())
 config_host_data.set('CONFIG_BRLAPI', brlapi.found())
 config_host_data.set('CONFIG_COCOA', cocoa.found())
@@ -1775,8 +1785,6 @@ foreach k, v: config_host
       v = '"' + '", "'.join(v.split()) + '", '
     endif
     config_host_data.set(k, v)
-  elif k == 'ARCH'
-    config_host_data.set('HOST_' + v.to_upper(), 1)
   elif strings.contains(k)
     config_host_data.set_quoted(k, v)
   elif k.startswith('CONFIG_')
@@ -1919,7 +1927,7 @@ foreach target : target_dirs
   endif
 
   foreach k, v: disassemblers
-    if config_host['ARCH'].startswith(k) or config_target['TARGET_BASE_ARCH'].startswith(k)
+    if host_arch.startswith(k) or config_target['TARGET_BASE_ARCH'].startswith(k)
       foreach sym: v
         config_target += { sym: 'y' }
         config_all_disas += { sym: 'y' }
@@ -2888,7 +2896,7 @@ foreach target : target_dirs
     endif
     if 'CONFIG_LINUX_USER' in config_target
       base_dir = 'linux-user'
-      target_inc += include_directories('linux-user/host/' / config_host['ARCH'])
+      target_inc += include_directories('linux-user/host/' / host_arch)
     endif
     if 'CONFIG_BSD_USER' in config_target
       base_dir = 'bsd-user'
Signature · 1 line
2.33.1
#11 lore raw

Re: [PULL 07/16] configure, meson: move ARCH to meson.build

Quoted 9 lines · Paolo Bonzini

$ARCH and the HOST_* symbols are only used by the QEMU build; configure uses $cpu instead. Remove it from config-host.mak.

---
  configure   | 21 ++++-----------------
  meson.build | 26 +++++++++++++++++---------
  2 files changed, 21 insertions(+), 26 deletions(-)

This broke the cross-compiler infrastructure for tests, because tests/tcg/configure.sh uses $ARCH, which is no longer defined.

r~

Quoted 151 lines
configure +4 -17
index 108b7621e2..6e06ac6161 100755
@@ -635,11 +635,9 @@ else
    cpu=$(uname -m)
  fi
 
-ARCH=
-# Normalise host CPU name, set ARCH and multilib cflags
+# Normalise host CPU name, set multilib cflags
  # Note that this case should only have supported host CPUs, not guests.
  case "$cpu" in
-  aarch64|riscv) ;;
    armv*b|armv*l|arm)
      cpu="arm" ;;
 
@@ -668,8 +666,7 @@ case "$cpu" in
      CPU_CFLAGS="-m64 -mlittle" ;;
 
    s390)
-    CPU_CFLAGS="-m31"
-    ARCH=unknown ;;
+    CPU_CFLAGS="-m31" ;;
    s390x)
      CPU_CFLAGS="-m64" ;;
 
@@ -678,15 +675,7 @@ case "$cpu" in
      CPU_CFLAGS="-m32 -mv8plus -mcpu=ultrasparc" ;;
    sparc64)
      CPU_CFLAGS="-m64 -mcpu=ultrasparc" ;;
-
-  *)
-    # This will result in either an error or falling back to TCI later
-    ARCH=unknown
-  ;;
  esac
-if test -z "$ARCH"; then
-  ARCH="$cpu"
-fi
 
  : ${make=${MAKE-make}}
 
@@ -3406,8 +3395,6 @@ echo "GIT=$git" >> $config_host_mak
  echo "GIT_SUBMODULES=$git_submodules" >> $config_host_mak
  echo "GIT_SUBMODULES_ACTION=$git_submodules_action" >> $config_host_mak
 
-echo "ARCH=$ARCH" >> $config_host_mak
-
  if test "$debug_tcg" = "yes" ; then
    echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak
  fi
@@ -3898,12 +3885,12 @@ if test "$skip_meson" = no; then
      cross_arg="--cross-file config-meson.cross"
      echo "[host_machine]" >> $cross
      echo "system = '$targetos'" >> $cross
-    case "$ARCH" in
+    case "$cpu" in
          i386)
              echo "cpu_family = 'x86'" >> $cross
              ;;
          *)
-            echo "cpu_family = '$ARCH'" >> $cross
+            echo "cpu_family = '$cpu'" >> $cross
              ;;
      esac
      echo "cpu = '$cpu'" >> $cross
meson.build +17 -9
index 4fdaa65b05..2495360fd0 100644
@@ -67,6 +67,14 @@ endif
 
  targetos = host_machine.system()
 
+if cpu not in supported_cpus
+  host_arch = 'unknown'
+elif cpu == 'x86'
+  host_arch = 'i386'
+else
+  host_arch = cpu
+endif
+
  if cpu in ['x86', 'x86_64']
    kvm_targets = ['i386-softmmu', 'x86_64-softmmu']
  elif cpu == 'aarch64'
@@ -335,9 +343,9 @@ if targetos == 'netbsd'
    endif
  endif
 
-tcg_arch = config_host['ARCH']
+tcg_arch = host_arch
  if not get_option('tcg').disabled()
-  if cpu not in supported_cpus
+  if host_arch == 'unknown'
      if get_option('tcg_interpreter')
        warning('Unsupported CPU @0@, will use TCG with TCI (slow)'.format(cpu))
      else
@@ -353,11 +361,11 @@ if not get_option('tcg').disabled()
    endif
    if get_option('tcg_interpreter')
      tcg_arch = 'tci'
-  elif config_host['ARCH'] == 'sparc64'
+  elif host_arch == 'sparc64'
      tcg_arch = 'sparc'
-  elif config_host['ARCH'] == 'x86_64'
+  elif host_arch == 'x86_64'
      tcg_arch = 'i386'
-  elif config_host['ARCH'] == 'ppc64'
+  elif host_arch == 'ppc64'
      tcg_arch = 'ppc'
    endif
    add_project_arguments('-iquote', meson.current_source_dir() / 'tcg' / tcg_arch,
@@ -1426,6 +1434,8 @@ 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('HOST_' + host_arch.to_upper(), 1)
+
  config_host_data.set('CONFIG_ATTR', libattr.found())
  config_host_data.set('CONFIG_BRLAPI', brlapi.found())
  config_host_data.set('CONFIG_COCOA', cocoa.found())
@@ -1775,8 +1785,6 @@ foreach k, v: config_host
        v = '"' + '", "'.join(v.split()) + '", '
      endif
      config_host_data.set(k, v)
-  elif k == 'ARCH'
-    config_host_data.set('HOST_' + v.to_upper(), 1)
    elif strings.contains(k)
      config_host_data.set_quoted(k, v)
    elif k.startswith('CONFIG_')
@@ -1919,7 +1927,7 @@ foreach target : target_dirs
    endif
 
    foreach k, v: disassemblers
-    if config_host['ARCH'].startswith(k) or config_target['TARGET_BASE_ARCH'].startswith(k)
+    if host_arch.startswith(k) or config_target['TARGET_BASE_ARCH'].startswith(k)
        foreach sym: v
          config_target += { sym: 'y' }
          config_all_disas += { sym: 'y' }
@@ -2888,7 +2896,7 @@ foreach target : target_dirs
      endif
      if 'CONFIG_LINUX_USER' in config_target
        base_dir = 'linux-user'
-      target_inc += include_directories('linux-user/host/' / config_host['ARCH'])
+      target_inc += include_directories('linux-user/host/' / host_arch)
      endif
      if 'CONFIG_BSD_USER' in config_target
        base_dir = 'bsd-user'
#12 lore raw

Re: [PULL 07/16] configure, meson: move ARCH to meson.build

In reply to Paolo Bonzini
Quoted 43 lines · Paolo Bonzini

$ARCH and the HOST_* symbols are only used by the QEMU build; configure uses $cpu instead. Remove it from config-host.mak.

---
 configure   | 21 ++++-----------------
 meson.build | 26 +++++++++++++++++---------
 2 files changed, 21 insertions(+), 26 deletions(-)
configure +2 -6
index 108b7621e2..6e06ac6161 100755
@@ -635,11 +635,9 @@ else
   cpu=$(uname -m)
 fi
 
-ARCH=
-# Normalise host CPU name, set ARCH and multilib cflags
+# Normalise host CPU name, set multilib cflags
 # Note that this case should only have supported host CPUs, not guests.
 case "$cpu" in
-  aarch64|riscv) ;;
   armv*b|armv*l|arm)
     cpu="arm" ;;
 
@@ -668,8 +666,7 @@ case "$cpu" in
     CPU_CFLAGS="-m64 -mlittle" ;;
 
   s390)
-    CPU_CFLAGS="-m31"
-    ARCH=unknown ;;
+    CPU_CFLAGS="-m31" ;;
   s390x)
     CPU_CFLAGS="-m64" ;;
 
@@ -678,15 +675,7 @@ case "$cpu" in
     CPU_CFLAGS="-m32 -mv8plus -mcpu=ultrasparc" ;;
   sparc64)
     CPU_CFLAGS="-m64 -mcpu=ultrasparc" ;;
-

configure case "$cpu" in · line 680

Quoted 10 lines
configure +0 -7
-  *)
-    # This will result in either an error or falling back to TCI later
-    ARCH=unknown
-  ;;
 esac
-if test -z "$ARCH"; then
-  ARCH="$cpu"
-fi
 
 : ${make=${MAKE-make}}

shellcheck points out that this (old) commit removed the code setting ARCH from configure, but left behind a use of it:

case "$ARCH" in
alpha)
# Ensure there's only a single GP
QEMU_CFLAGS="-msmall-data $QEMU_CFLAGS"
;;
esac

Presumably meson.build needs to do some equivalent of this ?

thanks
-- PMM

#13 lore raw

Re: [PULL 07/16] configure, meson: move ARCH to meson.build

Quoted 11 lines · Peter Maydell

shellcheck points out that this (old) commit removed the code setting ARCH from configure, but left behind a use of it:

case "$ARCH" in
alpha)
# Ensure there's only a single GP
QEMU_CFLAGS="-msmall-data $QEMU_CFLAGS"
;;
esac

Presumably meson.build needs to do some equivalent of this ?

Yeah, I'll send a patch before 7.1 gets out (Richard, as the resident Alpha guy do you why it is needed?).

Paolo

#14 lore raw

Re: [PULL 07/16] configure, meson: move ARCH to meson.build

Quoted 11 lines · Paolo Bonzini
Quoted 10 lines · Peter Maydell

shellcheck points out that this (old) commit removed the code setting ARCH from configure, but left behind a use of it:

case "$ARCH" in
alpha)
   # Ensure there's only a single GP
   QEMU_CFLAGS="-msmall-data $QEMU_CFLAGS"
;;
esac

Quoted 3 lines
Quoted 1 line

Presumably meson.build needs to do some equivalent of this ?

Yeah, I'll send a patch before 7.1 gets out (Richard, as the resident Alpha guy do you why it is needed?).

It was to allow simplifying assumptions in the jit for tcg/alpha, the patches for which were on list but never committed.

This can be dropped.

r~

#15 lore raw

[PULL 14/16] hw/scsi/megasas: Fails command if SGL buffer overflows

In reply to Paolo Bonzini

From: Philippe Mathieu-Daudé <[email protected]>

If we detect an overflow on the SGL buffer, do not keep processing the command: discard it. TARGET_FAILURE sense code will be returned (MFI_STAT_SCSI_DONE_WITH_ERROR).

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/521

Message-Id: <[email protected]>

---
 hw/scsi/megasas.c | 1 +
 1 file changed, 1 insertion(+)
hw/scsi/megasas.c +1 -0
index 4ff51221d4..8f35784100 100644
@@ -303,6 +303,7 @@ static int megasas_map_sgl(MegasasState *s, MegasasCmd *cmd, union mfi_sgl *sgl)
     }
     if (cmd->iov_size > iov_size) {
         trace_megasas_iovec_overflow(cmd->index, iov_size, cmd->iov_size);
+        goto unmap;
     } else if (cmd->iov_size < iov_size) {
         trace_megasas_iovec_underflow(cmd->index, iov_size, cmd->iov_size);
     }
Signature · 1 line
2.33.1
#16 lore raw

[PULL 09/16] configure: remove DIRS

In reply to Paolo Bonzini

DIRS is used to create the directory in which the LINKS symbolic links reside, or to create directories for object files. The former can be done directly in the symlinking loop, while the latter is done by Meson already, so DIRS is not necessary.

---
 configure | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)
configure +1 -8
index ba85bbb54b..8ccfe51673 100755
@@ -3762,7 +3762,6 @@ if test "$safe_stack" = "yes"; then
 fi
 
 # If we're using a separate build tree, set it up now.
-# DIRS are directories which we simply mkdir in the build tree;
 # LINKS are things to symlink back into the source tree
 # (these can be both files and directories).
 # Caution: do not add files or directories here using wildcards. This
@@ -3774,12 +3773,6 @@ fi
 # UNLINK is used to remove symlinks from older development versions
 # that might get into the way when doing "git update" without doing
 # a "make distclean" in between.
-DIRS="tests tests/tcg tests/qapi-schema tests/qtest/libqos"
-DIRS="$DIRS tests/qtest tests/qemu-iotests tests/vm tests/fp tests/qgraph"
-DIRS="$DIRS docs docs/interop fsdev scsi"
-DIRS="$DIRS pc-bios/optionrom pc-bios/s390-ccw"
-DIRS="$DIRS roms/seabios"
-DIRS="$DIRS contrib/plugins/"
 LINKS="Makefile"
 LINKS="$LINKS tests/tcg/Makefile.target"
 LINKS="$LINKS pc-bios/optionrom/Makefile"
@@ -3807,9 +3800,9 @@ for bios_file in \
 do
     LINKS="$LINKS pc-bios/$(basename $bios_file)"
 done
-mkdir -p $DIRS
 for f in $LINKS ; do
     if [ -e "$source_path/$f" ]; then
+        mkdir -p `dirname ./$f`
         symlink "$source_path/$f" "$f"
     fi
 done
Signature · 1 line
2.33.1
#17 lore raw

Re: [PULL 09/16] configure: remove DIRS

Quoted 39 lines · Paolo Bonzini

DIRS is used to create the directory in which the LINKS symbolic links reside, or to create directories for object files. The former can be done directly in the symlinking loop, while the latter is done by Meson already, so DIRS is not necessary.

---
  configure | 9 +--------
  1 file changed, 1 insertion(+), 8 deletions(-)
configure +0 -7
index ba85bbb54b..8ccfe51673 100755
@@ -3762,7 +3762,6 @@ if test "$safe_stack" = "yes"; then
  fi
 
  # If we're using a separate build tree, set it up now.
-# DIRS are directories which we simply mkdir in the build tree;
  # LINKS are things to symlink back into the source tree
  # (these can be both files and directories).
  # Caution: do not add files or directories here using wildcards. This
@@ -3774,12 +3773,6 @@ fi
  # UNLINK is used to remove symlinks from older development versions
  # that might get into the way when doing "git update" without doing
  # a "make distclean" in between.
-DIRS="tests tests/tcg tests/qapi-schema tests/qtest/libqos"
-DIRS="$DIRS tests/qtest tests/qemu-iotests tests/vm tests/fp tests/qgraph"
-DIRS="$DIRS docs docs/interop fsdev scsi"
-DIRS="$DIRS pc-bios/optionrom pc-bios/s390-ccw"
-DIRS="$DIRS roms/seabios"
-DIRS="$DIRS contrib/plugins/"
  LINKS="Makefile"
  LINKS="$LINKS tests/tcg/Makefile.target"
  LINKS="$LINKS pc-bios/optionrom/Makefile"

configure for bios_file in \ · line 3808

Quoted 10 lines
configure +1 -1
@@ -3807,9 +3800,9 @@ for bios_file in \
  do
      LINKS="$LINKS pc-bios/$(basename $bios_file)"
  done
-mkdir -p $DIRS
  for f in $LINKS ; do
      if [ -e "$source_path/$f" ]; then
+        mkdir -p `dirname ./$f`
          symlink "$source_path/$f" "$f"
      fi
  done

Hi Paolo,

I think this patch created some warnings with fresh build directories on git checkouts where roms/seabios is not initialized:

.../qemu/configure: line 3778: roms/seabios/config.mak: No such file or directory .../qemu/configure: line 3779: roms/seabios/config.mak: No such file or directory .../qemu/configure: line 3780: roms/seabios/config.mak: No such file or directory .../qemu/configure: line 3781: roms/seabios/config.mak: No such file or directory .../qemu/configure: line 3782: roms/seabios/config.mak: No such file or directory .../qemu/configure: line 3783: roms/seabios/config.mak: No such file or directory .../qemu/configure: line 3784: roms/seabios/config.mak: No such file or directory .../qemu/configure: line 3785: roms/seabios/config.mak: No such file or directory .../qemu/configure: line 3786: roms/seabios/config.mak: No such file or directory .../qemu/configure: line 3787: roms/seabios/config.mak: No such file or directory .../qemu/configure: line 3788: roms/seabios/config.mak: No such file or directory

It's this block in the configure script which now does not find the roms/seabios directory anymore:

# temporary config to build submodules
for rom in seabios; do
    config_mak=roms/$rom/config.mak
    echo "# Automatically generated by configure - do not modify" > $config_mak
    echo "SRC_PATH=$source_path/roms/$rom" >> $config_mak
    echo "AS=$as" >> $config_mak
    echo "CCAS=$ccas" >> $config_mak
    echo "CC=$cc" >> $config_mak
    echo "BCC=bcc" >> $config_mak
    echo "CPP=$cpp" >> $config_mak
    echo "OBJCOPY=objcopy" >> $config_mak
    echo "IASL=$iasl" >> $config_mak
    echo "LD=$ld" >> $config_mak
    echo "RANLIB=$ranlib" >> $config_mak
done

If I get that right, we only need config.mak if the seabios submodule has been checked out? So the right fix might be to skip the creation of config.mak here if roms/seabios is not available?

Thomas

#18 lore raw

[PULL 10/16] meson: reenable test-fdmon-epoll

In reply to Paolo Bonzini

The test was disabled when CONFIG_EPOLL_CREATE1 was moved out of config-host.mak. Fix the condition.

---
 tests/unit/meson.build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/unit/meson.build +1 -1
index acac3622ed..90acf5b0da 100644
@@ -112,7 +112,7 @@ if have_block
   if nettle.found() or gcrypt.found()
     tests += {'test-crypto-pbkdf': [io]}
   endif
-  if 'CONFIG_EPOLL_CREATE1' in config_host
+  if config_host_data.get('CONFIG_EPOLL_CREATE1')
     tests += {'test-fdmon-epoll': [testblock]}
   endif
 endif
Signature · 1 line
2.33.1
#19 lore raw

[PULL 13/16] hw/scsi: Fix scsi_bus_init_named() docstring

In reply to Paolo Bonzini

From: Philippe Mathieu-Daudé <[email protected]>

Commit 739e95f5741 ("scsi: Replace scsi_bus_new() with scsi_bus_init(), scsi_bus_init_named()") forgot to rename scsi_bus_init() in the function documentation string.

Message-Id: <[email protected]>

---
 include/hw/scsi/scsi.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/hw/scsi/scsi.h +1 -1
index a567a5ed86..2ef80af6dc 100644
@@ -158,7 +158,7 @@ struct SCSIBus {
  * provided by the caller. It is the caller's responsibility to make
  * sure that name does not clash with the name of any other bus in the
  * system. Unless you need the new bus to have a specific name, you
- * should use scsi_bus_new() instead.
+ * should use scsi_bus_init() instead.
  */
 void scsi_bus_init_named(SCSIBus *bus, size_t bus_size, DeviceState *host,
                          const SCSIBusInfo *info, const char *bus_name);
Signature · 1 line
2.33.1
#20 lore raw

[PULL 16/16] hw/i386/vmmouse: Require 'i8042' property to be set

In reply to Paolo Bonzini

From: Philippe Mathieu-Daudé <[email protected]>

If the 'i8042' property is not set, mouse events handled by vmmouse_mouse_event() end calling i8042_isa_mouse_fake_event() with a NULL argument, resulting in ps2_mouse_fake_event() being called with invalid PS2MouseState pointer. Fix by requiring the 'i8042' property to be always set:

  $ qemu-system-x86_64 -device vmmouse
  qemu-system-x86_64: -device vmmouse: 'i8042' link is not set
Fixes 91c9e09147b ("vmmouse: convert to qdev")

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/752

Message-Id: <[email protected]>

---
 hw/i386/vmmouse.c | 4 ++++
 1 file changed, 4 insertions(+)
hw/i386/vmmouse.c +4 -0
index 3d66368286..a56c185f15 100644
@@ -286,6 +286,10 @@ static void vmmouse_realizefn(DeviceState *dev, Error **errp)
 
     DPRINTF("vmmouse_init\n");
 
+    if (!s->i8042) {
+        error_setg(errp, "'i8042' link is not set");
+        return;
+    }
     if (!object_resolve_path_type("", TYPE_VMPORT, NULL)) {
         error_setg(errp, "vmmouse needs a machine with vmport");
         return;
Signature · 1 line
2.33.1
#21 lore raw

[PULL 15/16] tests/qtest/fuzz-megasas-test: Add test for GitLab issue #521

In reply to Paolo Bonzini

From: Philippe Mathieu-Daudé <[email protected]>

Without the previous commit, this test triggers:

  $ make check-qtest-x86_64
  [...]
  Running test qtest-x86_64/fuzz-megasas-test
  qemu-system-x86_64: softmmu/physmem.c:3229: address_space_unmap: Assertion `mr != NULL' failed.
  Broken pipe
  ERROR qtest-x86_64/fuzz-megasas-test - too few tests run (expected 2, got 1)

Message-Id: <[email protected]>

---
 tests/qtest/fuzz-megasas-test.c | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)
tests/qtest/fuzz-megasas-test.c +30 -0
index 940a76bf25..e1141c58a4 100644
@@ -34,6 +34,34 @@ static void test_lp1878263_megasas_zero_iov_cnt(void)
     qtest_quit(s);
 }
 
+/*
+ * Overflow SGL buffer.
+ * https://gitlab.com/qemu-project/qemu/-/issues/521
+ */
+static void test_gitlab_issue521_megasas_sgl_ovf(void)
+{
+    QTestState *s = qtest_init("-display none -m 32M -machine q35 "
+                               "-nodefaults -device megasas "
+                               "-device scsi-cd,drive=null0 "
+                               "-blockdev "
+                               "driver=null-co,read-zeroes=on,node-name=null0");
+    qtest_outl(s, 0xcf8, 0x80000818);
+    qtest_outl(s, 0xcfc, 0xc000);
+    qtest_outl(s, 0xcf8, 0x80000804);
+    qtest_outw(s, 0xcfc, 0x05);
+    qtest_bufwrite(s, 0x0, "\x01", 0x1);
+    qtest_bufwrite(s, 0x7, "\x01", 0x1);
+    qtest_bufwrite(s, 0x10, "\x02", 0x1);
+    qtest_bufwrite(s, 0x16, "\x01", 0x1);
+    qtest_bufwrite(s, 0x28, "\x01", 0x1);
+    qtest_bufwrite(s, 0x33, "\x01", 0x1);
+    qtest_outb(s, 0xc040, 0x0);
+    qtest_outb(s, 0xc040, 0x20);
+    qtest_outl(s, 0xc040, 0x20000000);
+    qtest_outb(s, 0xc040, 0x20);
+    qtest_quit(s);
+}
+
 int main(int argc, char **argv)
 {
     const char *arch = qtest_get_arch();
@@ -43,6 +71,8 @@ int main(int argc, char **argv)
     if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) {
         qtest_add_func("fuzz/test_lp1878263_megasas_zero_iov_cnt",
                        test_lp1878263_megasas_zero_iov_cnt);
+        qtest_add_func("fuzz/gitlab_issue521_megasas_sgl_ovf",
+                       test_gitlab_issue521_megasas_sgl_ovf);
     }
 
     return g_test_run();
Signature · 1 line
2.33.1
#22 lore raw
In reply to Paolo Bonzini
Quoted 38 lines · Paolo Bonzini

The following changes since commit 90978e15bc9a23c208b25bf7ea697a5d0925562b:

   Merge tag 'trivial-branch-for-7.0-pull-request' of https://gitlab.com/laurent_vivier/qemu into staging (2021-12-17 13:15:38 -0800)

are available in the Git repository at:

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

for you to fetch changes up to 5a3a2eb3b1096a52580c1b8c3eb0739714e7d941:

   hw/i386/vmmouse: Require 'i8042' property to be set (2021-12-18 10:57:37 +0100)

----------------------------------------------------------------
* configure and meson cleanups and fixes
* remove unnecessary #ifdef
* SCSI and i386 fixes

----------------------------------------------------------------
Paolo Bonzini (12):
configure: make $targetos lowercase, use windows instead of MINGW32
configure: move target detection before CPU detection
configure: unify two case statements on $cpu
configure: unify ppc64 and ppc64le
configure: unify x86_64 and x32
meson: rename "arch" variable
configure, meson: move ARCH to meson.build
configure: remove unnecessary symlinks
configure: remove DIRS
meson: reenable test-fdmon-epoll
cpu: remove unnecessary #ifdef CONFIG_TCG
meson: add "check" argument to run_command

Philippe Mathieu-Daudé (4):
hw/scsi: Fix scsi_bus_init_named() docstring hw/scsi/megasas: Fails command if SGL buffer overflows tests/qtest/fuzz-megasas-test: Add test for GitLab issue #521 hw/i386/vmmouse: Require 'i8042' property to be set

Quoted 13 lines
  configure                       | 253 +++++++++++++++++-----------------------
  cpu.c                           |   5 -
  docs/meson.build                |   6 +-
  hw/i386/vmmouse.c               |   4 +
  hw/scsi/megasas.c               |   1 +
  include/exec/cpu-all.h          |   2 -
  include/hw/scsi/scsi.h          |   2 +-
  meson.build                     |  39 ++++---
  pc-bios/meson.build             |   2 +-
  tests/qtest/fuzz-megasas-test.c |  30 +++++
  tests/tcg/configure.sh          |   4 +-
  tests/unit/meson.build          |   2 +-
  12 files changed, 173 insertions(+), 177 deletions(-)

Applied, thanks.

r~