Skip to contentSkip to conversation

s390x and qtest patches

GIT PULL Applied Thomas Huth 3 participants 24 messages Oct 28, 2022 – Oct 31, 2022 Arm/Amlogic Meson SoC support

lore
Share & tools
lore
#0 lore raw

Hello Stefan!

The following changes since commit 344744e148e6e865f5a57e745b02a87e5ea534ad:

Merge tag 'dump-pull-request' of https://gitlab.com/marcandre.lureau/qemu into staging (2022-10-26 10:53:49 -0400)

are available in the Git repository at:

https://gitlab.com/thuth/qemu.git tags/pull-request-2022-10-28

for you to fetch changes up to db8fca024fa98241ed40470f87b8ecfb82c57d32:

tests/qtest: libqtest: Correct the timeout unit of blocking receive calls for win32 (2022-10-28 14:32:09 +0200)

----------------------------------------------------------------
* Fix and test the VISTR instruction on s390x
* Some more small s390x fixes and maintainer updates
* Make sure to remove all temporary files from qtests
* OpenBSD VM test update to version 7.2
* Add sndio to FreeBSD tests
* More patches to enable the qtests on Windows

----------------------------------------------------------------
Akihiko Odaki (1):

      tests/qtest/libqos/e1000e: Use e1000_regs.h

Bin Meng (6):
tests/qtest: Support libqtest to build and run on Windows tests/qtest: device-plug-test: Reverse the usage of double/single quotes tests/qtest: Use EXIT_FAILURE instead of magic number
tests/qtest: libqtest: Introduce qtest_wait_qemu()
tests/qtest: libqos: Do not build virtio-9p unconditionally tests/qtest: libqtest: Correct the timeout unit of blocking receive calls for win32

Brad Smith (2):
tests/vm: update openbsd to release 7.2
tests: Add sndio to the FreeBSD CI containers / VM

Christian Borntraeger (1):

      MAINTAINERS: target/s390x/: add Ilya as reviewer

Claudio Imbrenda (1):

      s390x/pv: remove semicolon from macro definition

Cornelia Huck (1):

      s390x: step down as general arch maintainer

Nico Boehr (1):

      s390x/tod-kvm: don't save/restore the TOD in PV guests

Thomas Huth (5):

      tests/tcg/s390x: Test compiler flags only once, not every time
      target/s390x: Fix emulation of the VISTR instruction
      tests/tcg/s390x: Add a test for the vistr instruction
      tests/qtest/tpm: Clean up remainders of swtpm
      tests/qtest/cxl-test: Remove temporary directories after testing

Xuzhou Cheng (3):
accel/qtest: Support qtest accelerator for Windows
tests/qtest: Use send/recv for socket communication
tests/qtest: migration-test: Make sure QEMU process "to" exited after migration is canceled

 hw/net/e1000_regs.h                                |   1 +
 include/hw/core/cpu.h                              |   1 +
 include/qemu/sockets.h                             |  13 ++
 tests/qtest/libqtest.h                             |   9 +
 tests/qtest/tpm-util.h                             |   1 +
 accel/dummy-cpus.c                                 |  14 +-
 hw/s390x/pv.c                                      |   2 +-
 hw/s390x/tod-kvm.c                                 |   9 +
 softmmu/cpus.c                                     |   9 +-
 tests/qtest/cxl-test.c                             |   3 +
 tests/qtest/dbus-vmstate-test.c                    |   2 +-
 tests/qtest/device-plug-test.c                     |  16 +-
 tests/qtest/libqmp.c                               |   5 +-
 tests/qtest/libqos/e1000e.c                        | 119 ++++-------
 tests/qtest/libqtest.c                             | 151 +++++++++++--
 tests/qtest/migration-test.c                       |   8 +-
 tests/qtest/tpm-crb-swtpm-test.c                   |   5 +-
 tests/qtest/tpm-tis-device-swtpm-test.c            |   5 +-
 tests/qtest/tpm-tis-swtpm-test.c                   |   5 +-
 tests/qtest/tpm-util.c                             |  19 ++
 tests/tcg/s390x/vistr.c                            |  45 ++++
 util/osdep.c                                       |  22 ++
 target/s390x/tcg/translate_vx.c.inc                |   2 +-
 .gitlab-ci.d/cirrus/freebsd-12.vars                |   2 +-
 .gitlab-ci.d/cirrus/freebsd-13.vars                |   2 +-
 MAINTAINERS                                        |   3 +-
 accel/meson.build                                  |   2 +-
 accel/qtest/meson.build                            |   3 +-
 tests/docker/dockerfiles/alpine.docker             |   3 +-
 tests/docker/dockerfiles/centos8.docker            |   2 +-
 tests/docker/dockerfiles/debian-amd64-cross.docker | 235 ++++++++++----------
 tests/docker/dockerfiles/debian-amd64.docker       | 237 +++++++++++----------
 tests/docker/dockerfiles/debian-arm64-cross.docker | 233 ++++++++++----------
 tests/docker/dockerfiles/debian-armel-cross.docker | 231 ++++++++++----------
 tests/docker/dockerfiles/debian-armhf-cross.docker | 233 ++++++++++----------
 .../dockerfiles/debian-mips64el-cross.docker       | 227 ++++++++++----------
 .../docker/dockerfiles/debian-mipsel-cross.docker  | 227 ++++++++++----------
 .../docker/dockerfiles/debian-ppc64el-cross.docker | 231 ++++++++++----------
 tests/docker/dockerfiles/debian-s390x-cross.docker | 229 ++++++++++----------
 tests/docker/dockerfiles/fedora.docker             | 230 ++++++++++----------
 tests/docker/dockerfiles/opensuse-leap.docker      |   3 +-
 tests/docker/dockerfiles/ubuntu2004.docker         | 235 ++++++++++----------
 tests/lcitool/libvirt-ci                           |   2 +-
 tests/lcitool/projects/qemu.yml                    |   1 +
 tests/qtest/libqos/meson.build                     |   6 +-
 tests/tcg/s390x/Makefile.target                    |  31 ++-
 tests/vm/freebsd                                   |   3 +
 tests/vm/openbsd                                   |   7 +-
 48 files changed, 1667 insertions(+), 1417 deletions(-)
 create mode 100644 tests/tcg/s390x/vistr.c
#1 lore raw

[PULL 01/21] s390x/pv: remove semicolon from macro definition

From: Claudio Imbrenda <[email protected]>

Remove spurious semicolon at the end of the macro s390_pv_cmd

Message-Id: <[email protected]>

---
 hw/s390x/pv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/s390x/pv.c +1 -1
index 728ba24547..8dfe92d8df 100644
@@ -50,7 +50,7 @@ static int __s390_pv_cmd(uint32_t cmd, const char *cmdname, void *data)
  * This macro lets us pass the command as a string to the function so
  * we can print it on an error.
  */
-#define s390_pv_cmd(cmd, data) __s390_pv_cmd(cmd, #cmd, data);
+#define s390_pv_cmd(cmd, data) __s390_pv_cmd(cmd, #cmd, data)
 #define s390_pv_cmd_exit(cmd, data)    \
 {                                      \
     int rc;                            \
Signature · 1 line
2.31.1
#2 lore raw

[PULL 02/21] s390x: step down as general arch maintainer

In reply to Thomas Huth

From: Cornelia Huck <[email protected]>

I haven't really been working on s390x for some time now, and in practice, I don't have time for it, either. So let's remove myself from this entry.

Message-Id: <[email protected]>

---
 MAINTAINERS | 2 --
 1 file changed, 2 deletions(-)
MAINTAINERS +0 -2
index 32e495e165..17ff0a0138 100644
@@ -84,7 +84,6 @@ T: git https://github.com/vivier/qemu.git trivial-patches
 Architecture support
 --------------------
 S390 general architecture support
-M: Cornelia Huck <[email protected]>
 M: Thomas Huth <[email protected]>
 S: Supported
 F: configs/devices/s390x-softmmu/default.mak
@@ -106,7 +105,6 @@ F: docs/system/target-s390x.rst
 F: docs/system/s390x/
 F: tests/migration/s390x/
 K: ^Subject:.*(?i)s390x?
-T: git https://gitlab.com/cohuck/qemu.git s390-next
 L: [email protected]
 
 MIPS general architecture support
Signature · 1 line
2.31.1
#3 lore raw

[PULL 04/21] tests/tcg/s390x: Test compiler flags only once, not every time

In reply to Thomas Huth

This is common practice, see the Makefile.target in the aarch64 folder for example.

Message-Id: <[email protected]>

---
 tests/tcg/s390x/Makefile.target | 27 +++++++++++++++++----------
 1 file changed, 17 insertions(+), 10 deletions(-)
tests/tcg/s390x/Makefile.target +17 -10
index c830313e67..29c8af8207 100644
@@ -1,6 +1,13 @@
 S390X_SRC=$(SRC_PATH)/tests/tcg/s390x
 VPATH+=$(S390X_SRC)
 CFLAGS+=-march=zEC12 -m64
+
+config-cc.mak: Makefile
+	$(quiet-@)( \
+	    $(call cc-option,-march=z14, CROSS_CC_HAS_Z14); \
+	    $(call cc-option,-march=z15, CROSS_CC_HAS_Z15)) 3> config-cc.mak
+-include config-cc.mak
+
 TESTS+=hello-s390x
 TESTS+=csst
 TESTS+=ipm
@@ -18,20 +25,20 @@ TESTS+=signals-s390x
 TESTS+=branch-relative-long
 TESTS+=noexec
 
+ifneq ($(CROSS_CC_HAS_Z14),)
 Z14_TESTS=vfminmax
 vfminmax: LDFLAGS+=-lm
 $(Z14_TESTS): CFLAGS+=-march=z14 -O2
+TESTS+=$(Z14_TESTS)
+endif
 
-TESTS+=$(if $(shell $(CC) -march=z14 -S -o /dev/null -xc /dev/null \
-			 >/dev/null 2>&1 && echo OK),$(Z14_TESTS))
-
-VECTOR_TESTS=vxeh2_vs
-VECTOR_TESTS+=vxeh2_vcvt
-VECTOR_TESTS+=vxeh2_vlstr
-$(VECTOR_TESTS): CFLAGS+=-march=z15 -O2
-
-TESTS+=$(if $(shell $(CC) -march=z15 -S -o /dev/null -xc /dev/null \
-			 >/dev/null 2>&1 && echo OK),$(VECTOR_TESTS))
+ifneq ($(CROSS_CC_HAS_Z15),)
+Z15_TESTS=vxeh2_vs
+Z15_TESTS+=vxeh2_vcvt
+Z15_TESTS+=vxeh2_vlstr
+$(Z15_TESTS): CFLAGS+=-march=z15 -O2
+TESTS+=$(Z15_TESTS)
+endif
 
 ifneq ($(HAVE_GDB_BIN),)
 GDB_SCRIPT=$(SRC_PATH)/tests/guest-debug/run-test.py
Signature · 1 line
2.31.1
#4 lore raw

[PULL 07/21] MAINTAINERS: target/s390x/: add Ilya as reviewer

In reply to Thomas Huth

From: Christian Borntraeger <[email protected]>

Ilya has volunteered to review TCG patches for s390x.

Message-Id: <[email protected]>

---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)
MAINTAINERS +1 -0
index 17ff0a0138..0a331eec7a 100644
@@ -303,6 +303,7 @@ F: target/rx/
 S390 TCG CPUs
 M: Richard Henderson <[email protected]>
 M: David Hildenbrand <[email protected]>
+R: Ilya Leoshkevich <[email protected]>
 S: Maintained
 F: target/s390x/
 F: target/s390x/tcg
Signature · 1 line
2.31.1
#5 lore raw

[PULL 08/21] tests/qtest/tpm: Clean up remainders of swtpm

In reply to Thomas Huth

After running "make check", there are remainders of the tpm tests left in the /tmp directory, slowly filling it up. Seems like "swtpm" leaves a ".lock" and a "tpm2-00.permall" file behind, so that the g_rmdir() calls on the temporary directories fail. Introduce a helper function to remove those leftovers before doing the g_rmdir().

Message-Id: <[email protected]>

---
 tests/qtest/tpm-util.h                  |  1 +
 tests/qtest/tpm-crb-swtpm-test.c        |  5 ++---
 tests/qtest/tpm-tis-device-swtpm-test.c |  5 ++---
 tests/qtest/tpm-tis-swtpm-test.c        |  5 ++---
 tests/qtest/tpm-util.c                  | 19 +++++++++++++++++++
 5 files changed, 26 insertions(+), 9 deletions(-)
tests/qtest/tpm-util.h +1 -0
index 3b97d69017..80720afac0 100644
@@ -53,5 +53,6 @@ void tpm_util_migration_start_qemu(QTestState **src_qemu,
                                    const char *machine_options);
 
 void tpm_util_wait_for_migration_complete(QTestState *who);
+void tpm_util_rmdir(const char *path);
 
 #endif /* TESTS_TPM_UTIL_H */
tests/qtest/tpm-crb-swtpm-test.c +2 -3
index 55fdb5657d..40254f762f 100644
@@ -13,7 +13,6 @@
  */
 
 #include "qemu/osdep.h"
-#include <glib/gstdio.h>
 
 #include "libqtest.h"
 #include "qemu/module.h"
@@ -62,9 +61,9 @@ int main(int argc, char **argv)
                         tpm_crb_swtpm_migration_test);
     ret = g_test_run();
 
-    g_rmdir(ts.dst_tpm_path);
+    tpm_util_rmdir(ts.dst_tpm_path);
     g_free(ts.dst_tpm_path);
-    g_rmdir(ts.src_tpm_path);
+    tpm_util_rmdir(ts.src_tpm_path);
     g_free(ts.src_tpm_path);
     g_free(ts.uri);
 
tests/qtest/tpm-tis-device-swtpm-test.c +2 -3
index 7b20035142..8c067fddd4 100644
@@ -14,7 +14,6 @@
  */
 
 #include "qemu/osdep.h"
-#include <glib/gstdio.h>
 
 #include "libqtest.h"
 #include "qemu/module.h"
@@ -66,9 +65,9 @@ int main(int argc, char **argv)
                         tpm_tis_swtpm_migration_test);
     ret = g_test_run();
 
-    g_rmdir(ts.dst_tpm_path);
+    tpm_util_rmdir(ts.dst_tpm_path);
     g_free(ts.dst_tpm_path);
-    g_rmdir(ts.src_tpm_path);
+    tpm_util_rmdir(ts.src_tpm_path);
     g_free(ts.src_tpm_path);
     g_free(ts.uri);
 
tests/qtest/tpm-tis-swtpm-test.c +2 -3
index 90131cb3c4..11539c0a52 100644
@@ -13,7 +13,6 @@
  */
 
 #include "qemu/osdep.h"
-#include <glib/gstdio.h>
 
 #include "libqtest.h"
 #include "qemu/module.h"
@@ -61,9 +60,9 @@ int main(int argc, char **argv)
                         tpm_tis_swtpm_migration_test);
     ret = g_test_run();
 
-    g_rmdir(ts.dst_tpm_path);
+    tpm_util_rmdir(ts.dst_tpm_path);
     g_free(ts.dst_tpm_path);
-    g_rmdir(ts.src_tpm_path);
+    tpm_util_rmdir(ts.src_tpm_path);
     g_free(ts.src_tpm_path);
     g_free(ts.uri);
 
tests/qtest/tpm-util.c +19 -0
index e0dc5da0af..a7efe2d0d2 100644
@@ -13,6 +13,7 @@
  */
 
 #include "qemu/osdep.h"
+#include <glib/gstdio.h>
 
 #include "hw/acpi/tpm.h"
 #include "libqtest.h"
@@ -292,3 +293,21 @@ void tpm_util_migration_start_qemu(QTestState **src_qemu,
     g_free(src_qemu_args);
     g_free(dst_qemu_args);
 }
+
+/* Remove directory with remainders of swtpm */
+void tpm_util_rmdir(const char *path)
+{
+    char *filename;
+    int ret;
+
+    filename = g_strdup_printf("%s/tpm2-00.permall", path);
+    g_unlink(filename);
+    g_free(filename);
+
+    filename = g_strdup_printf("%s/.lock", path);
+    g_unlink(filename);
+    g_free(filename);
+
+    ret = g_rmdir(path);
+    g_assert(!ret);
+}
Signature · 1 line
2.31.1
#6 lore raw

[PULL 09/21] tests/qtest/cxl-test: Remove temporary directories after testing

In reply to Thomas Huth

The cxl-test leaves some temporary directories behind. Let's clean them up now!

Message-Id: <[email protected]>

---
 tests/qtest/cxl-test.c | 3 +++
 1 file changed, 3 insertions(+)
tests/qtest/cxl-test.c +3 -0
index cbe0fb549b..61f25a72b6 100644
@@ -101,6 +101,7 @@ static void cxl_t3d(void)
 
     qtest_start(cmdline->str);
     qtest_end();
+    rmdir(tmpfs);
 }
 
 static void cxl_1pxb_2rp_2t3d(void)
@@ -115,6 +116,7 @@ static void cxl_1pxb_2rp_2t3d(void)
 
     qtest_start(cmdline->str);
     qtest_end();
+    rmdir(tmpfs);
 }
 
 static void cxl_2pxb_4rp_4t3d(void)
@@ -130,6 +132,7 @@ static void cxl_2pxb_4rp_4t3d(void)
 
     qtest_start(cmdline->str);
     qtest_end();
+    rmdir(tmpfs);
 }
 #endif /* CONFIG_POSIX */
 
Signature · 1 line
2.31.1
#7 lore raw

[PULL 12/21] tests: Add sndio to the FreeBSD CI containers / VM

In reply to Thomas Huth

From: Brad Smith <[email protected]>

Add sndio to the FreeBSD CI containers / VM

Message-Id: <[email protected]>

---
 .gitlab-ci.d/cirrus/freebsd-12.vars           |   2 +-
 .gitlab-ci.d/cirrus/freebsd-13.vars           |   2 +-
 tests/docker/dockerfiles/alpine.docker        |   3 +-
 tests/docker/dockerfiles/centos8.docker       |   2 +-
 .../dockerfiles/debian-amd64-cross.docker     | 235 ++++++++---------
 tests/docker/dockerfiles/debian-amd64.docker  | 237 +++++++++---------
 .../dockerfiles/debian-arm64-cross.docker     | 233 ++++++++---------
 .../dockerfiles/debian-armel-cross.docker     | 231 ++++++++---------
 .../dockerfiles/debian-armhf-cross.docker     | 233 ++++++++---------
 .../dockerfiles/debian-mips64el-cross.docker  | 227 ++++++++---------
 .../dockerfiles/debian-mipsel-cross.docker    | 227 ++++++++---------
 .../dockerfiles/debian-ppc64el-cross.docker   | 231 ++++++++---------
 .../dockerfiles/debian-s390x-cross.docker     | 229 ++++++++---------
 tests/docker/dockerfiles/fedora.docker        | 230 ++++++++---------
 tests/docker/dockerfiles/opensuse-leap.docker |   3 +-
 tests/docker/dockerfiles/ubuntu2004.docker    | 235 ++++++++---------
 tests/lcitool/libvirt-ci                      |   2 +-
 tests/lcitool/projects/qemu.yml               |   1 +
 tests/vm/freebsd                              |   3 +
 19 files changed, 1291 insertions(+), 1275 deletions(-)
.gitlab-ci.d/cirrus/freebsd-12.vars +1 -1
index c3db1d7d30..e3fc3235b9 100644
@@ -11,6 +11,6 @@ MAKE='/usr/local/bin/gmake'
 NINJA='/usr/local/bin/ninja'
 PACKAGING_COMMAND='pkg'
 PIP3='/usr/local/bin/pip-3.8'
-PKGS='alsa-lib bash bison bzip2 ca_root_nss capstone4 ccache cdrkit-genisoimage cmocka ctags curl cyrus-sasl dbus diffutils dtc flex fusefs-libs3 gettext git glib gmake gnutls gsed gtk3 json-c libepoxy libffi libgcrypt libjpeg-turbo libnfs libslirp libspice-server libssh libtasn1 llvm lzo2 meson ncurses nettle ninja opencv perl5 pixman pkgconf png py39-numpy py39-pillow py39-pip py39-sphinx py39-sphinx_rtd_theme py39-yaml python3 rpm2cpio sdl2 sdl2_image snappy spice-protocol tesseract texinfo usbredir virglrenderer vte3 zstd'
+PKGS='alsa-lib bash bison bzip2 ca_root_nss capstone4 ccache cdrkit-genisoimage cmocka ctags curl cyrus-sasl dbus diffutils dtc flex fusefs-libs3 gettext git glib gmake gnutls gsed gtk3 json-c libepoxy libffi libgcrypt libjpeg-turbo libnfs libslirp libspice-server libssh libtasn1 llvm lzo2 meson ncurses nettle ninja opencv perl5 pixman pkgconf png py39-numpy py39-pillow py39-pip py39-sphinx py39-sphinx_rtd_theme py39-yaml python3 rpm2cpio sdl2 sdl2_image snappy sndio spice-protocol tesseract texinfo usbredir virglrenderer vte3 zstd'
 PYPI_PKGS=''
 PYTHON='/usr/local/bin/python3'
.gitlab-ci.d/cirrus/freebsd-13.vars +1 -1
index d31faa787f..9f56babd9c 100644
@@ -11,6 +11,6 @@ MAKE='/usr/local/bin/gmake'
 NINJA='/usr/local/bin/ninja'
 PACKAGING_COMMAND='pkg'
 PIP3='/usr/local/bin/pip-3.8'
-PKGS='alsa-lib bash bison bzip2 ca_root_nss capstone4 ccache cdrkit-genisoimage cmocka ctags curl cyrus-sasl dbus diffutils dtc flex fusefs-libs3 gettext git glib gmake gnutls gsed gtk3 json-c libepoxy libffi libgcrypt libjpeg-turbo libnfs libslirp libspice-server libssh libtasn1 llvm lzo2 meson ncurses nettle ninja opencv perl5 pixman pkgconf png py39-numpy py39-pillow py39-pip py39-sphinx py39-sphinx_rtd_theme py39-yaml python3 rpm2cpio sdl2 sdl2_image snappy spice-protocol tesseract texinfo usbredir virglrenderer vte3 zstd'
+PKGS='alsa-lib bash bison bzip2 ca_root_nss capstone4 ccache cdrkit-genisoimage cmocka ctags curl cyrus-sasl dbus diffutils dtc flex fusefs-libs3 gettext git glib gmake gnutls gsed gtk3 json-c libepoxy libffi libgcrypt libjpeg-turbo libnfs libslirp libspice-server libssh libtasn1 llvm lzo2 meson ncurses nettle ninja opencv perl5 pixman pkgconf png py39-numpy py39-pillow py39-pip py39-sphinx py39-sphinx_rtd_theme py39-yaml python3 rpm2cpio sdl2 sdl2_image snappy sndio spice-protocol tesseract texinfo usbredir virglrenderer vte3 zstd'
 PYPI_PKGS=''
 PYTHON='/usr/local/bin/python3'
tests/docker/dockerfiles/alpine.docker +2 -1
index 9b7541261a..094f66f4eb 100644
@@ -94,6 +94,7 @@ RUN apk update && \
         sdl2_image-dev \
         sed \
         snappy-dev \
+        sndio-dev \
         sparse \
         spice-dev \
         spice-protocol \
@@ -119,8 +120,8 @@ RUN apk update && \
     ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/g++ && \
     ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/gcc
 
+ENV CCACHE_WRAPPERSDIR "/usr/libexec/ccache-wrappers"
 ENV LANG "en_US.UTF-8"
 ENV MAKE "/usr/bin/make"
 ENV NINJA "/usr/bin/ninja"
 ENV PYTHON "/usr/bin/python3"
-ENV CCACHE_WRAPPERSDIR "/usr/libexec/ccache-wrappers"
tests/docker/dockerfiles/centos8.docker +1 -1
index d89113c0df..1f70d41aeb 100644
@@ -130,8 +130,8 @@ RUN dnf distro-sync -y && \
     ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/g++ && \
     ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/gcc
 
+ENV CCACHE_WRAPPERSDIR "/usr/libexec/ccache-wrappers"
 ENV LANG "en_US.UTF-8"
 ENV MAKE "/usr/bin/make"
 ENV NINJA "/usr/bin/ninja"
 ENV PYTHON "/usr/bin/python3"
-ENV CCACHE_WRAPPERSDIR "/usr/libexec/ccache-wrappers"
tests/docker/dockerfiles/debian-amd64-cross.docker +118 -117

256 lines not on this page · raw message

tests/docker/dockerfiles/debian-amd64.docker +119 -118

253 lines not on this page · raw message

tests/docker/dockerfiles/debian-arm64-cross.docker +117 -116

254 lines not on this page · raw message

tests/docker/dockerfiles/debian-armel-cross.docker +116 -115

252 lines not on this page · raw message

tests/docker/dockerfiles/debian-armhf-cross.docker +117 -116

254 lines not on this page · raw message

tests/docker/dockerfiles/debian-mips64el-cross.docker +114 -113

248 lines not on this page · raw message

tests/docker/dockerfiles/debian-mipsel-cross.docker +114 -113

248 lines not on this page · raw message

tests/docker/dockerfiles/debian-ppc64el-cross.docker +116 -115

252 lines not on this page · raw message

tests/docker/dockerfiles/debian-s390x-cross.docker +115 -114

250 lines not on this page · raw message

tests/docker/dockerfiles/fedora.docker +115 -115

243 lines not on this page · raw message

tests/docker/dockerfiles/opensuse-leap.docker +2 -1
index d80064756f..4361b01464 100644
@@ -104,6 +104,7 @@ RUN zypper update -y && \
            rpm \
            sed \
            snappy-devel \
+           sndio-devel \
            sparse \
            spice-protocol-devel \
            systemd-devel \
@@ -132,8 +133,8 @@ RUN zypper update -y && \
 
 RUN /usr/bin/pip3 install meson==0.56.0
 
+ENV CCACHE_WRAPPERSDIR "/usr/libexec/ccache-wrappers"
 ENV LANG "en_US.UTF-8"
 ENV MAKE "/usr/bin/make"
 ENV NINJA "/usr/bin/ninja"
 ENV PYTHON "/usr/bin/python3"
-ENV CCACHE_WRAPPERSDIR "/usr/libexec/ccache-wrappers"
tests/docker/dockerfiles/ubuntu2004.docker +118 -117

251 lines not on this page · raw message

tests/lcitool/libvirt-ci +1 -1
index e3712b7912..79691a50a5 160000
@@ -1 +1 @@
-Subproject commit e3712b79122180fdb3b7a7ea8cbee47ece253f97
+Subproject commit 79691a50a5f99bd7adda236f66c3c09371b01afa
tests/lcitool/projects/qemu.yml +1 -0
index 0d92819249..c62dbc00f9 100644
@@ -101,6 +101,7 @@ packages:
  - sdl2-image
  - sed
  - snappy
+ - sndio
  - sparse
  - spice-protocol
  - spice-server
tests/vm/freebsd +3 -0
index 3643fe325d..d6ff4461ba 100755
@@ -66,6 +66,9 @@ class FreeBSDVM(basevm.BaseVM):
 
         # libs: networking
         "libslirp",
+
+        # libs: sndio
+        "sndio",
     ]
 
     BUILD_SCRIPT = """
Signature · 1 line
2.31.1
#8 lore raw

[PULL 14/21] tests/qtest: Use send/recv for socket communication

In reply to Thomas Huth

From: Xuzhou Cheng <[email protected]>

Socket communication in the libqtest and libqmp codes uses read() and write() which work on any file descriptor on *nix, and sockets in *nix are an example of a file descriptor.

However sockets on Windows do not use *nix-style file descriptors, so read() and write() cannot be used on sockets on Windows. Switch over to use send() and recv() instead which work on both Windows and *nix.

Message-Id: <[email protected]>

---
 include/qemu/sockets.h | 13 +++++++++++++
 tests/qtest/libqmp.c   |  5 +++--
 tests/qtest/libqtest.c |  5 +++--
 util/osdep.c           | 22 ++++++++++++++++++++++
 4 files changed, 41 insertions(+), 4 deletions(-)
include/qemu/sockets.h +13 -0
index 036745e586..61648f3f3c 100644
@@ -33,6 +33,19 @@ int qemu_socketpair(int domain, int type, int protocol, int sv[2]);
 #endif
 
 int qemu_accept(int s, struct sockaddr *addr, socklen_t *addrlen);
+/*
+ * A variant of send(2) which handles partial send.
+ *
+ * Return the number of bytes transferred over the socket.
+ * Set errno if fewer than `count' bytes are sent.
+ *
+ * This function don't work with non-blocking socket's.
+ * Any of the possibilities with non-blocking socket's is bad:
+ *   - return a short write (then name is wrong)
+ *   - busy wait adding (errno == EAGAIN) to the loop
+ */
+ssize_t qemu_send_full(int s, const void *buf, size_t count)
+    G_GNUC_WARN_UNUSED_RESULT;
 int socket_set_cork(int fd, int v);
 int socket_set_nodelay(int fd);
 void qemu_socket_set_block(int fd);
tests/qtest/libqmp.c +3 -2
index ade26c15f0..2b08382e5d 100644
@@ -23,6 +23,7 @@
 #endif
 
 #include "qemu/cutils.h"
+#include "qemu/sockets.h"
 #include "qapi/error.h"
 #include "qapi/qmp/json-parser.h"
 #include "qapi/qmp/qjson.h"
@@ -36,7 +37,7 @@ typedef struct {
 
 static void socket_send(int fd, const char *buf, size_t size)
 {
-    size_t res = qemu_write_full(fd, buf, size);
+    ssize_t res = qemu_send_full(fd, buf, size);
 
     assert(res == size);
 }
@@ -69,7 +70,7 @@ QDict *qmp_fd_receive(int fd)
         ssize_t len;
         char c;
 
-        len = read(fd, &c, 1);
+        len = recv(fd, &c, 1, 0);
         if (len == -1 && errno == EINTR) {
             continue;
         }
tests/qtest/libqtest.c +3 -2
index b23eb3edc3..b01846fd98 100644
@@ -27,6 +27,7 @@
 #include "libqmp.h"
 #include "qemu/ctype.h"
 #include "qemu/cutils.h"
+#include "qemu/sockets.h"
 #include "qapi/qmp/qdict.h"
 #include "qapi/qmp/qjson.h"
 #include "qapi/qmp/qlist.h"
@@ -428,7 +429,7 @@ void qtest_quit(QTestState *s)
 
 static void socket_send(int fd, const char *buf, size_t size)
 {
-    size_t res = qemu_write_full(fd, buf, size);
+    ssize_t res = qemu_send_full(fd, buf, size);
 
     assert(res == size);
 }
@@ -460,7 +461,7 @@ static GString *qtest_client_socket_recv_line(QTestState *s)
         ssize_t len;
         char buffer[1024];
 
-        len = read(s->fd, buffer, sizeof(buffer));
+        len = recv(s->fd, buffer, sizeof(buffer), 0);
         if (len == -1 && errno == EINTR) {
             continue;
         }
util/osdep.c +22 -0
index 746d5f7d71..77c1a6c562 100644
@@ -502,6 +502,28 @@ int qemu_accept(int s, struct sockaddr *addr, socklen_t *addrlen)
     return ret;
 }
 
+ssize_t qemu_send_full(int s, const void *buf, size_t count)
+{
+    ssize_t ret = 0;
+    ssize_t total = 0;
+
+    while (count) {
+        ret = send(s, buf, count, 0);
+        if (ret < 0) {
+            if (errno == EINTR) {
+                continue;
+            }
+            break;
+        }
+
+        count -= ret;
+        buf += ret;
+        total += ret;
+    }
+
+    return total;
+}
+
 void qemu_set_hw_version(const char *version)
 {
     hw_version = version;
Signature · 1 line
2.31.1
#9 lore raw

[PULL 16/21] tests/qtest: device-plug-test: Reverse the usage of double/single quotes

In reply to Thomas Huth

From: Bin Meng <[email protected]>

The usage of double/single quotes in test_q35_pci_unplug_json_request() should be reversed to work on both win32 and non-win32 platforms:

- The value of -device parameter needs to be surrounded by "" as Windows does not drop '' when passing it to QEMU which causes QEMU command line option parser failure.
- The JSON key/value pairs need to be surrounded by '' to make the JSON parser happy on Windows.

Fixes a12f1a7e56b7 ("tests/x86: Add subtest with 'q35' machine type to device-plug-test")

Message-Id: <[email protected]>

---
 tests/qtest/device-plug-test.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
tests/qtest/device-plug-test.c +8 -8
index 3f44f731d1..5a6afa2b57 100644
@@ -112,16 +112,16 @@ static void test_pci_unplug_json_request(void)
 
 static void test_q35_pci_unplug_json_request(void)
 {
-    const char *port = "-device '{\"driver\": \"pcie-root-port\", "
-                                      "\"id\": \"p1\"}'";
+    const char *port = "-device \"{'driver': 'pcie-root-port', "
+                                  "'id': 'p1'}\"";
 
-    const char *bridge = "-device '{\"driver\": \"pcie-pci-bridge\", "
-                                   "\"id\": \"b1\", "
-                                   "\"bus\": \"p1\"}'";
+    const char *bridge = "-device \"{'driver': 'pcie-pci-bridge', "
+                                    "'id': 'b1', "
+                                    "'bus': 'p1'}\"";
 
-    const char *device = "-device '{\"driver\": \"virtio-mouse-pci\", "
-                                   "\"bus\": \"b1\", "
-                                   "\"id\": \"dev0\"}'";
+    const char *device = "-device \"{'driver': 'virtio-mouse-pci', "
+                                    "'bus': 'b1', "
+                                    "'id': 'dev0'}\"";
 
     QTestState *qtest = qtest_initf("-machine q35 %s %s %s",
                                     port, bridge, device);
Signature · 1 line
2.31.1
#10 lore raw

[PULL 06/21] tests/tcg/s390x: Add a test for the vistr instruction

In reply to Thomas Huth

This test can be used to verify that the change in the previous commit is indeed fixing the problem with the M3 vs. M4 field mixup.

Message-Id: <[email protected]>

---
 tests/tcg/s390x/vistr.c         | 45 +++++++++++++++++++++++++++++++++
 tests/tcg/s390x/Makefile.target |  4 +++
 2 files changed, 49 insertions(+)
 create mode 100644 tests/tcg/s390x/vistr.c
tests/tcg/s390x/vistr.c new file +45 -0
new file mode 100644
index 0000000000..8e3e987d71
@@ -0,0 +1,45 @@
+/*
+ * Test the VECTOR ISOLATE STRING (vistr) instruction
+ */
+#include <stdint.h>
+#include <stdio.h>
+#include "vx.h"
+
+static inline void vistr(S390Vector *v1, S390Vector *v2,
+                         const uint8_t m3, const uint8_t m5)
+{
+    asm volatile("vistr %[v1], %[v2], %[m3], %[m5]\n"
+                 : [v1] "=v" (v1->v)
+                 : [v2]  "v" (v2->v)
+                 , [m3]  "i" (m3)
+                 , [m5]  "i" (m5)
+                 : "cc");
+}
+
+int main(int argc, char *argv[])
+{
+    S390Vector vd = {};
+    S390Vector vs16 = {
+        .h[0] = 0x1234, .h[1] = 0x0056, .h[2] = 0x7800, .h[3] = 0x0000,
+        .h[4] = 0x0078, .h[5] = 0x0000, .h[6] = 0x6543, .h[7] = 0x2100
+    };
+    S390Vector vs32 = {
+        .w[0] = 0x12340000, .w[1] = 0x78654300,
+        .w[2] = 0x0, .w[3] = 0x12,
+    };
+
+    vistr(&vd, &vs16, 1, 0);
+    if (vd.h[0] != 0x1234 || vd.h[1] != 0x0056 || vd.h[2] != 0x7800 ||
+        vd.h[3] || vd.h[4] || vd.h[5] || vd.h[6] || vd.h[7]) {
+        puts("ERROR: vitrh failed!");
+        return 1;
+    }
+
+    vistr(&vd, &vs32, 2, 0);
+    if (vd.w[0] != 0x12340000 || vd.w[1] != 0x78654300 || vd.w[2] || vd.w[3]) {
+        puts("ERROR: vitrf failed!");
+        return 1;
+    }
+
+    return 0;
+}
tests/tcg/s390x/Makefile.target +4 -0
index 29c8af8207..07fcc6d0ce 100644
@@ -25,6 +25,10 @@ TESTS+=signals-s390x
 TESTS+=branch-relative-long
 TESTS+=noexec
 
+Z13_TESTS=vistr
+$(Z13_TESTS): CFLAGS+=-march=z13 -O2
+TESTS+=$(Z13_TESTS)
+
 ifneq ($(CROSS_CC_HAS_Z14),)
 Z14_TESTS=vfminmax
 vfminmax: LDFLAGS+=-lm
Signature · 1 line
2.31.1
#11 lore raw

[PULL 15/21] tests/qtest: Support libqtest to build and run on Windows

In reply to Thomas Huth

From: Bin Meng <[email protected]>

At present the libqtest codes were written to depend on several POSIX APIs, including fork(), kill() and waitpid(). Unfortunately these APIs are not available on Windows.

This commit implements the corresponding functionalities using win32 native APIs. With this change, all qtest cases can build successfully on a Windows host, and we can start qtest testing on Windows now.

Message-Id: <[email protected]>

---
 tests/qtest/libqtest.c | 96 +++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 94 insertions(+), 2 deletions(-)
tests/qtest/libqtest.c +94 -2
index b01846fd98..d12a604d78 100644
@@ -16,9 +16,11 @@
 
 #include "qemu/osdep.h"
 
+#ifndef _WIN32
 #include <sys/socket.h>
 #include <sys/wait.h>
 #include <sys/un.h>
+#endif /* _WIN32 */
 #ifdef __linux__
 #include <sys/prctl.h>
 #endif /* __linux__ */
@@ -36,6 +38,16 @@
 #define MAX_IRQ 256
 #define SOCKET_TIMEOUT 50
 
+#ifndef _WIN32
+# define CMD_EXEC   "exec "
+# define DEV_STDERR "/dev/fd/2"
+# define DEV_NULL   "/dev/null"
+#else
+# define CMD_EXEC   ""
+# define DEV_STDERR "2"
+# define DEV_NULL   "nul"
+#endif
+
 typedef void (*QTestSendFn)(QTestState *s, const char *buf);
 typedef void (*ExternalSendFn)(void *s, const char *buf);
 typedef GString* (*QTestRecvFn)(QTestState *);
@@ -58,6 +70,9 @@ struct QTestState
     int qmp_fd;
     pid_t qemu_pid;  /* our child QEMU process */
     int wstatus;
+#ifdef _WIN32
+    DWORD exit_code;
+#endif
     int expected_status;
     bool big_endian;
     bool irq_level[MAX_IRQ];
@@ -119,10 +134,18 @@ bool qtest_probe_child(QTestState *s)
     pid_t pid = s->qemu_pid;
 
     if (pid != -1) {
+#ifndef _WIN32
         pid = waitpid(pid, &s->wstatus, WNOHANG);
         if (pid == 0) {
             return true;
         }
+#else
+        GetExitCodeProcess((HANDLE)pid, &s->exit_code);
+        if (s->exit_code == STILL_ACTIVE) {
+            return true;
+        }
+        CloseHandle((HANDLE)pid);
+#endif
         s->qemu_pid = -1;
     }
     return false;
@@ -136,13 +159,25 @@ void qtest_set_expected_status(QTestState *s, int status)
 void qtest_kill_qemu(QTestState *s)
 {
     pid_t pid = s->qemu_pid;
+#ifndef _WIN32
     int wstatus;
+#else
+    DWORD ret;
+#endif
 
     /* Skip wait if qtest_probe_child already reaped.  */
     if (pid != -1) {
+#ifndef _WIN32
         kill(pid, SIGTERM);
         TFR(pid = waitpid(s->qemu_pid, &s->wstatus, 0));
         assert(pid == s->qemu_pid);
+#else
+        TerminateProcess((HANDLE)pid, s->expected_status);
+        ret = WaitForSingleObject((HANDLE)pid, INFINITE);
+        assert(ret == WAIT_OBJECT_0);
+        GetExitCodeProcess((HANDLE)pid, &s->exit_code);
+        CloseHandle((HANDLE)pid);
+#endif
         s->qemu_pid = -1;
     }
 
@@ -150,6 +185,7 @@ void qtest_kill_qemu(QTestState *s)
      * Check whether qemu exited with expected exit status; anything else is
      * fishy and should be logged with as much detail as possible.
      */
+#ifndef _WIN32
     wstatus = s->wstatus;
     if (WIFEXITED(wstatus) && WEXITSTATUS(wstatus) != s->expected_status) {
         fprintf(stderr, "%s:%d: kill_qemu() tried to terminate QEMU "
@@ -166,6 +202,14 @@ void qtest_kill_qemu(QTestState *s)
                 __FILE__, __LINE__, sig, signame, dump);
         abort();
     }
+#else
+    if (s->exit_code != s->expected_status) {
+        fprintf(stderr, "%s:%d: kill_qemu() tried to terminate QEMU "
+                "process but encountered exit status %ld (expected %d)\n",
+                __FILE__, __LINE__, s->exit_code, s->expected_status);
+        abort();
+    }
+#endif
 }
 
 static void kill_qemu_hook_func(void *s)
@@ -244,6 +288,38 @@ static const char *qtest_qemu_binary(void)
     return qemu_bin;
 }
 
+#ifdef _WIN32
+static pid_t qtest_create_process(char *cmd)
+{
+    STARTUPINFO si;
+    PROCESS_INFORMATION pi;
+    BOOL ret;
+
+    ZeroMemory(&si, sizeof(si));
+    si.cb = sizeof(si);
+    ZeroMemory(&pi, sizeof(pi));
+
+    ret = CreateProcess(NULL,   /* module name */
+                        cmd,    /* command line */
+                        NULL,   /* process handle not inheritable */
+                        NULL,   /* thread handle not inheritable */
+                        FALSE,  /* set handle inheritance to FALSE */
+                        0,      /* No creation flags */
+                        NULL,   /* use parent's environment block */
+                        NULL,   /* use parent's starting directory */
+                        &si,    /* pointer to STARTUPINFO structure */
+                        &pi     /* pointer to PROCESS_INFORMATION structure */
+                        );
+    if (ret == 0) {
+        fprintf(stderr, "%s:%d: unable to create a new process (%s)\n",
+                __FILE__, __LINE__, strerror(GetLastError()));
+        abort();
+    }
+
+    return (pid_t)pi.hProcess;
+}
+#endif /* _WIN32 */
+
 QTestState *qtest_init_without_qmp_handshake(const char *extra_args)
 {
     QTestState *s;
@@ -271,6 +347,7 @@ QTestState *qtest_init_without_qmp_handshake(const char *extra_args)
     unlink(socket_path);
     unlink(qmp_socket_path);
 
+    socket_init();
     sock = init_socket(socket_path);
     qmpsock = init_socket(qmp_socket_path);
 
@@ -279,7 +356,7 @@ QTestState *qtest_init_without_qmp_handshake(const char *extra_args)
 
     qtest_add_abrt_handler(kill_qemu_hook_func, s);
 
-    command = g_strdup_printf("exec %s %s"
+    command = g_strdup_printf(CMD_EXEC "%s %s"
                               "-qtest unix:%s "
                               "-qtest-log %s "
                               "-chardev socket,path=%s,id=char0 "
@@ -288,7 +365,7 @@ QTestState *qtest_init_without_qmp_handshake(const char *extra_args)
                               "%s"
                               " -accel qtest",
                               qemu_binary, tracearg, socket_path,
-                              getenv("QTEST_LOG") ? "/dev/fd/2" : "/dev/null",
+                              getenv("QTEST_LOG") ? DEV_STDERR : DEV_NULL,
                               qmp_socket_path,
                               extra_args ?: "");
 
@@ -297,6 +374,7 @@ QTestState *qtest_init_without_qmp_handshake(const char *extra_args)
     s->pending_events = NULL;
     s->wstatus = 0;
     s->expected_status = 0;
+#ifndef _WIN32
     s->qemu_pid = fork();
     if (s->qemu_pid == 0) {
 #ifdef __linux__
@@ -319,6 +397,9 @@ QTestState *qtest_init_without_qmp_handshake(const char *extra_args)
         execlp("/bin/sh", "sh", "-c", command, NULL);
         exit(1);
     }
+#else
+    s->qemu_pid = qtest_create_process(command);
+#endif /* _WIN32 */
 
     g_free(command);
     s->fd = socket_accept(sock);
@@ -337,9 +418,19 @@ QTestState *qtest_init_without_qmp_handshake(const char *extra_args)
         s->irq_level[i] = false;
     }
 
+    /*
+     * Stopping QEMU for debugging is not supported on Windows.
+     *
+     * Using DebugActiveProcess() API can suspend the QEMU process,
+     * but gdb cannot attach to the process. Using the undocumented
+     * NtSuspendProcess() can suspend the QEMU process and gdb can
+     * attach to the process, but gdb cannot resume it.
+     */
+#ifndef _WIN32
     if (getenv("QTEST_STOP")) {
         kill(s->qemu_pid, SIGSTOP);
     }
+#endif
 
     /* ask endianness of the target */
 
@@ -393,6 +484,7 @@ QTestState *qtest_init_with_serial(const char *extra_args, int *sock_fd)
     g_assert_true(sock_dir != NULL);
     sock_path = g_strdup_printf("%s/sock", sock_dir);
 
+    socket_init();
     sock_fd_init = init_socket(sock_path);
 
     qts = qtest_initf("-chardev socket,id=s0,path=%s -serial chardev:s0 %s",
Signature · 1 line
2.31.1
#12 lore raw

[PULL 13/21] accel/qtest: Support qtest accelerator for Windows

In reply to Thomas Huth

From: Xuzhou Cheng <[email protected]>

Currently signal SIGIPI [=SIGUSR1] is used to kick the dummy CPU when qtest accelerator is used. However SIGUSR1 is unsupported on Windows. To support Windows, we add a QemuSemaphore CPUState::sem to kick the dummy CPU instead for Windows.

Message-Id: <[email protected]>

---
 include/hw/core/cpu.h   |  1 +
 accel/dummy-cpus.c      | 14 ++++++++++++--
 softmmu/cpus.c          |  9 +++++----
 accel/meson.build       |  2 +-
 accel/qtest/meson.build |  3 +--
 5 files changed, 20 insertions(+), 9 deletions(-)
include/hw/core/cpu.h +1 -0
index f9b58773f7..8830546121 100644
@@ -333,6 +333,7 @@ struct CPUState {
     struct QemuThread *thread;
 #ifdef _WIN32
     HANDLE hThread;
+    QemuSemaphore sem;
 #endif
     int thread_id;
     bool running, has_waiter;
accel/dummy-cpus.c +12 -2
index 10429fdfb2..d6a1b8d0a2 100644
@@ -21,8 +21,6 @@
 static void *dummy_cpu_thread_fn(void *arg)
 {
     CPUState *cpu = arg;
-    sigset_t waitset;
-    int r;
 
     rcu_register_thread();
 
@@ -32,8 +30,13 @@ static void *dummy_cpu_thread_fn(void *arg)
     cpu->can_do_io = 1;
     current_cpu = cpu;
 
+#ifndef _WIN32
+    sigset_t waitset;
+    int r;
+
     sigemptyset(&waitset);
     sigaddset(&waitset, SIG_IPI);
+#endif
 
     /* signal CPU creation */
     cpu_thread_signal_created(cpu);
@@ -41,6 +44,7 @@ static void *dummy_cpu_thread_fn(void *arg)
 
     do {
         qemu_mutex_unlock_iothread();
+#ifndef _WIN32
         do {
             int sig;
             r = sigwait(&waitset, &sig);
@@ -49,6 +53,9 @@ static void *dummy_cpu_thread_fn(void *arg)
             perror("sigwait");
             exit(1);
         }
+#else
+        qemu_sem_wait(&cpu->sem);
+#endif
         qemu_mutex_lock_iothread();
         qemu_wait_io_event(cpu);
     } while (!cpu->unplug);
@@ -69,4 +76,7 @@ void dummy_start_vcpu_thread(CPUState *cpu)
              cpu->cpu_index);
     qemu_thread_create(cpu->thread, thread_name, dummy_cpu_thread_fn, cpu,
                        QEMU_THREAD_JOINABLE);
+#ifdef _WIN32
+    qemu_sem_init(&cpu->sem, 0);
+#endif
 }
softmmu/cpus.c +5 -4
index 61b27ff59d..9dd1a4dc17 100644
@@ -437,18 +437,19 @@ void qemu_wait_io_event(CPUState *cpu)
 
 void cpus_kick_thread(CPUState *cpu)
 {
-#ifndef _WIN32
-    int err;
-
     if (cpu->thread_kicked) {
         return;
     }
     cpu->thread_kicked = true;
-    err = pthread_kill(cpu->thread->thread, SIG_IPI);
+
+#ifndef _WIN32
+    int err = pthread_kill(cpu->thread->thread, SIG_IPI);
     if (err && err != ESRCH) {
         fprintf(stderr, "qemu:%s: %s", __func__, strerror(err));
         exit(1);
     }
+#else
+    qemu_sem_post(&cpu->sem);
 #endif
 }
 
accel/meson.build +1 -1
index b9a963cf80..259c35c4c8 100644
@@ -16,5 +16,5 @@ dummy_ss.add(files(
   'dummy-cpus.c',
 ))
 
-specific_ss.add_all(when: ['CONFIG_SOFTMMU', 'CONFIG_POSIX'], if_true: dummy_ss)
+specific_ss.add_all(when: ['CONFIG_SOFTMMU'], if_true: dummy_ss)
 specific_ss.add_all(when: ['CONFIG_XEN'], if_true: dummy_ss)
accel/qtest/meson.build +1 -2
index 4c65600293..176d990ae1 100644
@@ -1,2 +1 @@
-qtest_module_ss.add(when: ['CONFIG_SOFTMMU', 'CONFIG_POSIX'],
-                    if_true: files('qtest.c'))
+qtest_module_ss.add(when: ['CONFIG_SOFTMMU'], if_true: files('qtest.c'))
Signature · 1 line
2.31.1
#13 lore raw

[PULL 18/21] tests/qtest: libqtest: Introduce qtest_wait_qemu()

In reply to Thomas Huth

From: Bin Meng <[email protected]>

Introduce an API for qtest to wait for the QEMU process to terminate.

Message-Id: <[email protected]>

---
 tests/qtest/libqtest.h |  9 ++++++
 tests/qtest/libqtest.c | 63 +++++++++++++++++++++++++-----------------
 2 files changed, 47 insertions(+), 25 deletions(-)
tests/qtest/libqtest.h +9 -0
index 65c040e504..91a5f7edd9 100644
@@ -75,6 +75,15 @@ QTestState *qtest_init_without_qmp_handshake(const char *extra_args);
  */
 QTestState *qtest_init_with_serial(const char *extra_args, int *sock_fd);
 
+/**
+ * qtest_wait_qemu:
+ * @s: #QTestState instance to operate on.
+ *
+ * Wait for the QEMU process to terminate. It is safe to call this function
+ * multiple times.
+ */
+void qtest_wait_qemu(QTestState *s);
+
 /**
  * qtest_kill_qemu:
  * @s: #QTestState instance to operate on.
tests/qtest/libqtest.c +38 -25

81 lines not on this page · raw message

Signature · 1 line
2.31.1
#14 lore raw

[PULL 17/21] tests/qtest: Use EXIT_FAILURE instead of magic number

In reply to Thomas Huth

From: Bin Meng <[email protected]>

When migration fails, QEMU exits with a status code EXIT_FAILURE. Change qtests to use the well-defined macro instead of magic number.

Message-Id: <[email protected]>

---
 tests/qtest/dbus-vmstate-test.c | 2 +-
 tests/qtest/migration-test.c    | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
tests/qtest/dbus-vmstate-test.c +1 -1
index 74ede651f6..6c990864e3 100644
@@ -233,7 +233,7 @@ test_dbus_vmstate(Test *test)
     test->src_qemu = src_qemu;
     if (test->migrate_fail) {
         wait_for_migration_fail(src_qemu, true);
-        qtest_set_expected_status(dst_qemu, 1);
+        qtest_set_expected_status(dst_qemu, EXIT_FAILURE);
     } else {
         wait_for_migration_complete(src_qemu);
     }
tests/qtest/migration-test.c +2 -2
index aa1ba179fa..28a06d8170 100644
@@ -1342,7 +1342,7 @@ static void test_precopy_common(MigrateCommon *args)
         wait_for_migration_fail(from, allow_active);
 
         if (args->result == MIG_TEST_FAIL_DEST_QUIT_ERR) {
-            qtest_set_expected_status(to, 1);
+            qtest_set_expected_status(to, EXIT_FAILURE);
         }
     } else {
         if (args->iterations) {
@@ -1738,7 +1738,7 @@ static void do_test_validate_uuid(MigrateStart *args, bool should_fail)
     migrate_qmp(from, uri, "{}");
 
     if (should_fail) {
-        qtest_set_expected_status(to, 1);
+        qtest_set_expected_status(to, EXIT_FAILURE);
         wait_for_migration_fail(from, true);
     } else {
         wait_for_migration_complete(from);
Signature · 1 line
2.31.1
#15 lore raw

[PULL 19/21] tests/qtest: migration-test: Make sure QEMU process "to" exited after migration is canceled

In reply to Thomas Huth

From: Xuzhou Cheng <[email protected]>

Make sure QEMU process "to" exited before launching another target for migration in the test_multifd_tcp_cancel case.

Message-Id: <[email protected]>

---
 tests/qtest/migration-test.c | 4 ++++
 1 file changed, 4 insertions(+)
tests/qtest/migration-test.c +4 -0
index 28a06d8170..d2eb107f0c 100644
@@ -2141,6 +2141,10 @@ static void test_multifd_tcp_cancel(void)
 
     migrate_cancel(from);
 
+    /* Make sure QEMU process "to" exited */
+    qtest_set_expected_status(to, EXIT_FAILURE);
+    qtest_wait_qemu(to);
+
     args = (MigrateStart){
         .only_target = true,
     };
Signature · 1 line
2.31.1
#16 lore raw

[PULL 05/21] target/s390x: Fix emulation of the VISTR instruction

In reply to Thomas Huth

The element size is encoded in the M3 field, not in the M4 field.

Fixes be6324c6b734 ("s390x/tcg: Implement VECTOR ISOLATE STRING")

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1248
Message-Id: <[email protected]>

---
 target/s390x/tcg/translate_vx.c.inc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
target/s390x/tcg/translate_vx.c.inc +1 -1
index 3526ba3e3b..b69c1a111c 100644
@@ -2723,7 +2723,7 @@ static DisasJumpType op_vfene(DisasContext *s, DisasOps *o)
 
 static DisasJumpType op_vistr(DisasContext *s, DisasOps *o)
 {
-    const uint8_t es = get_field(s, m4);
+    const uint8_t es = get_field(s, m3);
     const uint8_t m5 = get_field(s, m5);
     static gen_helper_gvec_2 * const g[3] = {
         gen_helper_gvec_vistr8,
Signature · 1 line
2.31.1
#17 lore raw

[PULL 21/21] tests/qtest: libqtest: Correct the timeout unit of blocking receive calls for win32

In reply to Thomas Huth

From: Bin Meng <[email protected]>

Some qtest cases don't get response from the QEMU executable under test in time on Windows. It turns out that the socket receive call got timeout before it receive the complete response.

The timeout value is supposed to be set to 50 seconds via the setsockopt() call, but there is a difference among platforms. The timeout unit of blocking receive calls is measured in seconds on non-Windows platforms but milliseconds on Windows.

Message-Id: <[email protected]>

---
 tests/qtest/libqtest.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
tests/qtest/libqtest.c +10 -1
index e1e2d39a6e..2fbc3b88f3 100644
@@ -36,13 +36,14 @@
 #include "qapi/qmp/qstring.h"
 
 #define MAX_IRQ 256
-#define SOCKET_TIMEOUT 50
 
 #ifndef _WIN32
+# define SOCKET_TIMEOUT 50
 # define CMD_EXEC   "exec "
 # define DEV_STDERR "/dev/fd/2"
 # define DEV_NULL   "/dev/null"
 #else
+# define SOCKET_TIMEOUT 50000
 # define CMD_EXEC   ""
 # define DEV_STDERR "2"
 # define DEV_NULL   "nul"
@@ -106,8 +107,16 @@ static int socket_accept(int sock)
     struct sockaddr_un addr;
     socklen_t addrlen;
     int ret;
+    /*
+     * timeout unit of blocking receive calls is different among platfoms.
+     * It's in seconds on non-Windows platforms but milliseconds on Windows.
+     */
+#ifndef _WIN32
     struct timeval timeout = { .tv_sec = SOCKET_TIMEOUT,
                                .tv_usec = 0 };
+#else
+    DWORD timeout = SOCKET_TIMEOUT;
+#endif
 
     if (setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO,
                    (void *)&timeout, sizeof(timeout))) {
Signature · 1 line
2.31.1
#18 lore raw

[PULL 11/21] tests/vm: update openbsd to release 7.2

In reply to Thomas Huth

From: Brad Smith <[email protected]>

tests/vm: update openbsd to release 7.2

Message-Id: <Y1TKVwNKvk+euT/[email protected]>

---
 tests/vm/openbsd | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
tests/vm/openbsd +5 -2
index 6f1b6f5b98..eaeb201e91 100755
@@ -22,8 +22,8 @@ class OpenBSDVM(basevm.BaseVM):
     name = "openbsd"
     arch = "x86_64"
 
-    link = "https://cdn.openbsd.org/pub/OpenBSD/7.1/amd64/install71.iso"
-    csum = "d3a7c5b9bf890bc404304a1c96f9ee72e1d9bbcf9cc849c1133bdb0d67843396"
+    link = "https://cdn.openbsd.org/pub/OpenBSD/7.2/amd64/install72.iso"
+    csum = "0369ef40a3329efcb978c578c7fdc7bda71e502aecec930a74b44160928c91d3"
     size = "20G"
     pkgs = [
         # tools
@@ -56,6 +56,9 @@ class OpenBSDVM(basevm.BaseVM):
 
         # libs: migration
         "zstd",
+
+        # libs: networking
+        "libslirp",
     ]
 
     BUILD_SCRIPT = """
Signature · 1 line
2.31.1
#19 lore raw

[PULL 20/21] tests/qtest: libqos: Do not build virtio-9p unconditionally

In reply to Thomas Huth

From: Bin Meng <[email protected]>

At present the virtio-9p related codes are built into libqos unconditionally. Change to build them conditionally by testing the 'virtfs' config option.

Message-Id: <[email protected]>

---
 tests/qtest/libqos/meson.build | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
tests/qtest/libqos/meson.build +4 -2
index 113c80b4e4..32f028872c 100644
@@ -33,8 +33,6 @@ libqos_srcs = files(
         'sdhci.c',
         'tpci200.c',
         'virtio.c',
-        'virtio-9p.c',
-        'virtio-9p-client.c',
         'virtio-balloon.c',
         'virtio-blk.c',
         'vhost-user-blk.c',
@@ -62,6 +60,10 @@ libqos_srcs = files(
         'x86_64_pc-machine.c',
 )
 
+if have_virtfs
+  libqos_srcs += files('virtio-9p.c', 'virtio-9p-client.c')
+endif
+
 libqos = static_library('qos', libqos_srcs + genh,
                         name_suffix: 'fa',
                         build_by_default: false)
Signature · 1 line
2.31.1
#20 lore raw

[PULL 10/21] tests/qtest/libqos/e1000e: Use e1000_regs.h

In reply to Thomas Huth

From: Akihiko Odaki <[email protected]>

The register definitions in tests/qtest/libqos/e1000e.c had names different from hw/net/e1000_regs.h, which made it hard to understand what test codes corresponds to the implementation. Use hw/net/e1000_regs.h from tests/qtest/libqos/e1000e.c to remove these duplications.

E1000E_CTRL_EXT_TXLSFLOW is removed from E1000E_CTRL_EXT settings because hw/net/e1000_regs.h does not have the definition and it is for TCP segmentation offload, which does not matter for the implemented tests.

Message-Id: <[email protected]>

---
 hw/net/e1000_regs.h         |   1 +
 tests/qtest/libqos/e1000e.c | 119 +++++++++++++-----------------------
 2 files changed, 45 insertions(+), 75 deletions(-)
hw/net/e1000_regs.h +1 -0
index ae99f58bab..9d423f6c09 100644
@@ -793,6 +793,7 @@
 #define E1000_CTRL_EXT_ASDCHK  0x00001000 /* auto speed detection check */
 #define E1000_CTRL_EXT_EE_RST  0x00002000 /* EEPROM reset */
 #define E1000_CTRL_EXT_LINK_EN 0x00010000 /* enable link status from external LINK_0 and LINK_1 pins */
+#define E1000_CTRL_EXT_DRV_LOAD 0x10000000 /* Driver loaded bit for FW */
 #define E1000_CTRL_EXT_EIAME   0x01000000
 #define E1000_CTRL_EXT_IAME    0x08000000 /* Int ACK Auto-mask */
 #define E1000_CTRL_EXT_PBA_CLR 0x80000000 /* PBA Clear */
tests/qtest/libqos/e1000e.c +44 -75

182 lines not on this page · raw message

Signature · 1 line
2.31.1
#21 lore raw

[PULL 03/21] s390x/tod-kvm: don't save/restore the TOD in PV guests

In reply to Thomas Huth

From: Nico Boehr <[email protected]>

Under PV, the guest's TOD clock is under control of the ultravisor and the hypervisor cannot change it.

With upcoming kernel changes[1], the Linux kernel will reject QEMU's request to adjust the guest's clock in this case, so don't attempt to set the clock.

This avoids the following warning message on save/restore of a PV guest:

warning: Unable to set KVM guest TOD clock: Operation not supported

[1] https://lore.kernel.org/all/[email protected]/

Fixes c3347ed0d2ee ("s390x: protvirt: Support unpack facility")

Message-Id: <[email protected]>

[thuth: Add curly braces]
---
 hw/s390x/tod-kvm.c | 9 +++++++++
 1 file changed, 9 insertions(+)
hw/s390x/tod-kvm.c +9 -0
index 9d0cbfbce2..e2202dae2d 100644
@@ -13,6 +13,7 @@
 #include "qemu/module.h"
 #include "sysemu/runstate.h"
 #include "hw/s390x/tod.h"
+#include "hw/s390x/pv.h"
 #include "kvm/kvm_s390x.h"
 
 static void kvm_s390_get_tod_raw(S390TOD *tod, Error **errp)
@@ -84,6 +85,14 @@ static void kvm_s390_tod_vm_state_change(void *opaque, bool running,
     S390TODState *td = opaque;
     Error *local_err = NULL;
 
+    /*
+     * Under PV, the clock is under ultravisor control, hence we cannot restore
+     * it on resume.
+     */
+    if (s390_is_pv()) {
+        return;
+    }
+
     if (running && td->stopped) {
         /* Set the old TOD when running the VM - start the TOD clock. */
         kvm_s390_set_tod_raw(&td->base, &local_err);
Signature · 1 line
2.31.1
#22 lore raw
In reply to Thomas Huth
Quoted 3 lines · Thomas Huth

Brad Smith (2):
tests/vm: update openbsd to release 7.2
tests: Add sndio to the FreeBSD CI containers / VM

The lcitool submodule was updated in this commit without an explanation. I looked through the libvirt-ci.git commits and found commit 94a63b504e8e ("mappings: add sndio package mappings").

Please document the reason for submodule updates in the future. That helps me differentiate between intentional changes to submodules and accidental ones. Thanks!

Stefan