All of lore.kernel.org
 help / color / mirror / Atom feed
* [PULL 00/54] testing, gdbstub, plugin and gitdm updates
@ 2022-10-04 13:00 Alex Bennée
  2022-10-04 13:00 ` [PULL 01/54] scripts/ci/setup: ninja missing from build-environment Alex Bennée
                   ` (54 more replies)
  0 siblings, 55 replies; 64+ messages in thread
From: Alex Bennée @ 2022-10-04 13:00 UTC (permalink / raw)
  To: qemu-devel; +Cc: stefanha, Alex Bennée

The following changes since commit efbf38d73e5dcc4d5f8b98c6e7a12be1f3b91745:

  Merge tag 'for-upstream' of git://repo.or.cz/qemu/kevin into staging (2022-10-03 15:06:07 -0400)

are available in the Git repository at:

  https://github.com/stsquad/qemu.git tags/pull-testing-gdbstub-plugins-gitdm-041022-1

for you to fetch changes up to 3450eff8bef9a97121c373c60b8abf7d79bd1fe9:

  plugins: add [pre|post]fork helpers to linux-user (2022-10-04 13:52:57 +0100)

[AJB: I've run out of gitlab minutes this month to run this tag
through CI but the previous series was clean]

----------------------------------------------------------------
testing, gdbstub, plugin and gitdm updates

  - cleanup scripts/ci/setup in advance of ppc64 runner
  - ensure detected gdb reported to TCG tests
  - update hexagon container with build deps
  - generate fedora-win[32|64]-cross with lcitool
  - move alpine container to tagged release
  - fix overflow during qos-test test tree iteration
  - allow bios blobs to be built with test cross compilers
  - introduce monitor_puts for plain strings
  - share disas code between monitor and plugins
  - fix bug in execlog plugin
  - add more tcg plugin documentation, reorg
  - fix link to semihosting spec
  - re-factor gdbstub to use AccelClass/Ops
  - many gitdm updates
  - fix race with plugin mutex lock and linux-user fork()

----------------------------------------------------------------
Alex Bennée (26):
      configure: move detected gdb to TCG's config-host.mak
      tests/docker: update fedora-win[32|64]-cross with lcitool
      tests/docker: move alpine from edge to tagged release
      tests/qtest: bump up QOS_PATH_MAX_ELEMENT_SIZE
      monitor: expose monitor_puts to rest of code
      disas: generalise plugin_printf and use for monitor_disas
      disas: use result of ->read_memory_func
      plugins: extend execlog to filter matches
      docs/devel: clean-up qemu invocations in tcg-plugins
      docs/devel: move API to end of tcg-plugins.rst
      contrib/plugins: reset skip when matching in execlog
      docs/devel: document the test plugins
      semihosting: update link to spec
      gdbstub: move into its own sub directory
      gdbstub: move sstep flags probing into AccelClass
      gdbstub: move breakpoint logic to accel ops
      gdbstub: move guest debug support check to ops
      accel/kvm: move kvm_update_guest_debug to inline stub
      contrib/gitdm: add mapping for Loongson Technology
      contrib/gitdm: add Paul to individual contributors
      contrib/gitdm: add WANG Xuerui to individual contributers
      contrib/gitdm: add ISCAS to the academics group
      contrib/gitdm: add China Telecom to the domain map
      contrib/gitdm: add Simon to individual contributors
      contrib/gitdm: add Université Grenoble Alpes
      plugins: add [pre|post]fork helpers to linux-user

Anton Johansson (3):
      target/hexagon: add flex/bison/glib2 to qemu.yml
      target/hexagon: regenerate docker/cirrus files
      target/hexagon: manually add flex/bison/glib2 to remaining containers

Lucas Mateus Castro (alqotel) (4):
      scripts/ci/setup: ninja missing from build-environment
      scripts/ci/setup: Fix libxen requirements
      scripts/ci/setup: spice-server only on x86 aarch64
      tests/docker: run script use realpath instead of readlink

Paolo Bonzini (20):
      configure: do not invoke as/ld directly for pc-bios/optionrom
      pc-bios/optionrom: detect CC options just once
      pc-bios/s390-ccw: detect CC options just once
      vof: add distclean target
      build: add recursive distclean rules
      configure: return status code from probe_target_compiler
      configure: store container engine in config-host.mak
      tests: simplify Makefile invocation for tests/tcg
      tests/tcg: remove -f from Makefile invocation
      tests/tcg: add distclean rule
      tests/tcg: unify ppc64 and ppc64le Makefiles
      tests/tcg: clean up calls to run-test
      tests/tcg: move compiler tests to Makefiles
      configure: move tests/tcg/Makefile.prereqs to root build directory
      configure: unify creation of cross-compilation Makefiles
      configure: cleanup creation of tests/tcg target config
      configure: build ROMs with container-based cross compilers
      pc-bios/optionrom: Adopt meson style Make output
      pc-bios/s390-ccw: Adopt meson style Make output
      pc-bios/vof: Adopt meson style Make output

Richard Henderson (1):
      plugins: Assert mmu_idx in range before use in qemu_plugin_get_hwaddr

 docs/devel/tcg-plugins.rst                         | 175 ++++++++++++--
 docs/devel/writing-monitor-commands.rst            |   2 +-
 configure                                          | 258 ++++++++-------------
 Makefile                                           |  12 +-
 pc-bios/s390-ccw/netboot.mak                       |  27 +--
 meson.build                                        |   6 +-
 accel/kvm/kvm-cpus.h                               |   4 +
 gdbstub/internals.h                                |  17 ++
 gdbstub/trace.h                                    |   1 +
 include/monitor/monitor.h                          |   1 +
 include/qemu/accel.h                               |  12 +
 include/qemu/plugin.h                              |  24 ++
 include/sysemu/accel-ops.h                         |   7 +
 include/sysemu/cpus.h                              |   3 +
 include/sysemu/kvm.h                               |  36 ++-
 monitor/monitor-internal.h                         |   1 -
 tests/qtest/libqos/qgraph.h                        |   2 +-
 accel/accel-common.c                               |  10 +
 accel/kvm/kvm-accel-ops.c                          |   9 +
 accel/kvm/kvm-all.c                                |  48 ++--
 accel/stubs/kvm-stub.c                             |  21 --
 accel/tcg/tcg-accel-ops.c                          |  98 ++++++++
 accel/tcg/tcg-all.c                                |  17 ++
 block/monitor/block-hmp-cmds.c                     |  10 +-
 contrib/plugins/execlog.c                          |  99 ++++++--
 disas.c                                            |  43 ++--
 disas/capstone.c                                   |  73 +++---
 gdbstub.c => gdbstub/gdbstub.c                     | 156 ++-----------
 gdbstub/softmmu.c                                  |  51 ++++
 gdbstub/user.c                                     |  68 ++++++
 hw/misc/mos6522.c                                  |   2 +-
 linux-user/main.c                                  |   2 +
 monitor/hmp-cmds.c                                 |   8 +-
 monitor/hmp.c                                      |   2 +-
 plugins/api.c                                      |   2 +
 plugins/core.c                                     |  20 ++
 semihosting/arm-compat-semi.c                      |   2 +-
 softmmu/cpus.c                                     |   7 +
 target/i386/helper.c                               |   2 +-
 tests/tcg/{ppc64le => ppc64}/bcdsub.c              |   0
 tests/tcg/{ppc64le => ppc64}/byte_reverse.c        |   0
 tests/tcg/{ppc64le => ppc64}/mffsce.c              |   0
 tests/tcg/{ppc64le => ppc64}/mtfsf.c               |   0
 tests/tcg/{ppc64le => ppc64}/non_signalling_xscv.c |   0
 .../{ppc64le => ppc64}/signal_save_restore_xer.c   |   0
 tests/tcg/{ppc64le => ppc64}/xxspltw.c             |   0
 .gitlab-ci.d/cirrus/freebsd-12.vars                |   2 +-
 .gitlab-ci.d/cirrus/freebsd-13.vars                |   2 +-
 .gitlab-ci.d/cirrus/macos-11.vars                  |   2 +-
 .gitlab-ci.d/windows.yml                           |   6 +-
 .mailmap                                           |   1 +
 MAINTAINERS                                        |   2 +-
 contrib/gitdm/domain-map                           |   2 +
 contrib/gitdm/group-map-academics                  |   6 +
 contrib/gitdm/group-map-individuals                |   3 +
 gdbstub/meson.build                                |   9 +
 gdbstub/trace-events                               |  29 +++
 pc-bios/optionrom/Makefile                         |  51 ++--
 pc-bios/s390-ccw/Makefile                          |  43 ++--
 pc-bios/vof/Makefile                               |  19 +-
 scripts/ci/setup/build-environment.yml             |  15 +-
 tests/Makefile.include                             |  24 +-
 tests/docker/Makefile.include                      |   2 +-
 tests/docker/dockerfiles/alpine.docker             |   6 +-
 tests/docker/dockerfiles/centos8.docker            |   2 +
 tests/docker/dockerfiles/debian-amd64-cross.docker |   3 +
 tests/docker/dockerfiles/debian-amd64.docker       |   2 +
 tests/docker/dockerfiles/debian-arm64-cross.docker |   3 +
 tests/docker/dockerfiles/debian-armel-cross.docker |   3 +
 tests/docker/dockerfiles/debian-armhf-cross.docker |   3 +
 .../dockerfiles/debian-mips64el-cross.docker       |   3 +
 .../docker/dockerfiles/debian-mipsel-cross.docker  |   3 +
 .../docker/dockerfiles/debian-ppc64el-cross.docker |   3 +
 .../docker/dockerfiles/debian-riscv64-cross.docker |   3 +
 tests/docker/dockerfiles/debian-s390x-cross.docker |   3 +
 tests/docker/dockerfiles/fedora-i386-cross.docker  |   2 +
 tests/docker/dockerfiles/fedora-win32-cross.docker | 136 ++++++++---
 tests/docker/dockerfiles/fedora-win64-cross.docker | 134 ++++++++---
 tests/docker/dockerfiles/fedora.docker             |   2 +
 tests/docker/dockerfiles/opensuse-leap.docker      |   2 +
 tests/docker/dockerfiles/ubuntu2004.docker         |   2 +
 tests/docker/run                                   |   2 +-
 tests/lcitool/projects/qemu.yml                    |   3 +
 tests/lcitool/refresh                              |  50 ++--
 tests/tcg/Makefile.target                          |  34 ++-
 tests/tcg/aarch64/Makefile.softmmu-target          |  11 +-
 tests/tcg/aarch64/Makefile.target                  |  15 +-
 tests/tcg/arm/Makefile.target                      |   9 +-
 tests/tcg/cris/Makefile.target                     |   2 +-
 tests/tcg/i386/Makefile.softmmu-target             |   3 +-
 tests/tcg/i386/Makefile.target                     |  11 +-
 tests/tcg/multiarch/Makefile.target                |  18 +-
 tests/tcg/multiarch/system/Makefile.softmmu-target |   2 +-
 tests/tcg/ppc64/Makefile.target                    |   8 +-
 tests/tcg/ppc64le/Makefile.target                  |  26 +--
 tests/tcg/s390x/Makefile.target                    |   2 +-
 tests/tcg/x86_64/Makefile.softmmu-target           |   3 +-
 trace-events                                       |  28 ---
 98 files changed, 1361 insertions(+), 737 deletions(-)
 create mode 100644 gdbstub/internals.h
 create mode 100644 gdbstub/trace.h
 rename gdbstub.c => gdbstub/gdbstub.c (95%)
 create mode 100644 gdbstub/softmmu.c
 create mode 100644 gdbstub/user.c
 rename tests/tcg/{ppc64le => ppc64}/bcdsub.c (100%)
 rename tests/tcg/{ppc64le => ppc64}/byte_reverse.c (100%)
 rename tests/tcg/{ppc64le => ppc64}/mffsce.c (100%)
 rename tests/tcg/{ppc64le => ppc64}/mtfsf.c (100%)
 rename tests/tcg/{ppc64le => ppc64}/non_signalling_xscv.c (100%)
 rename tests/tcg/{ppc64le => ppc64}/signal_save_restore_xer.c (100%)
 rename tests/tcg/{ppc64le => ppc64}/xxspltw.c (100%)
 create mode 100644 gdbstub/meson.build
 create mode 100644 gdbstub/trace-events

-- 
2.34.1



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

* [PULL 01/54] scripts/ci/setup: ninja missing from build-environment
  2022-10-04 13:00 [PULL 00/54] testing, gdbstub, plugin and gitdm updates Alex Bennée
@ 2022-10-04 13:00 ` Alex Bennée
  2022-10-04 13:00 ` [PULL 02/54] scripts/ci/setup: Fix libxen requirements Alex Bennée
                   ` (53 subsequent siblings)
  54 siblings, 0 replies; 64+ messages in thread
From: Alex Bennée @ 2022-10-04 13:00 UTC (permalink / raw)
  To: qemu-devel
  Cc: stefanha, Lucas Mateus Castro (alqotel),
	Alex Bennée, Philippe Mathieu-Daudé,
	Thomas Huth, Wainer dos Santos Moschetta, Beraldo Leal

From: "Lucas Mateus Castro (alqotel)" <lucas.araujo@eldorado.org.br>

ninja-build is missing from the RHEL environment, so a system prepared
with that script would still fail to compile QEMU.
Tested on a Fedora 36

Signed-off-by: Lucas Mateus Castro (alqotel) <lucas.araujo@eldorado.org.br>
Message-Id: <20220922135516.33627-2-lucas.araujo@eldorado.org.br>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20220929114231.583801-2-alex.bennee@linaro.org>

diff --git a/scripts/ci/setup/build-environment.yml b/scripts/ci/setup/build-environment.yml
index 232525b91d..b5acaf9118 100644
--- a/scripts/ci/setup/build-environment.yml
+++ b/scripts/ci/setup/build-environment.yml
@@ -153,6 +153,7 @@
           - make
           - mesa-libEGL-devel
           - nettle-devel
+          - ninja-build
           - nmap-ncat
           - perl-Test-Harness
           - pixman-devel
-- 
2.34.1



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

* [PULL 02/54] scripts/ci/setup: Fix libxen requirements
  2022-10-04 13:00 [PULL 00/54] testing, gdbstub, plugin and gitdm updates Alex Bennée
  2022-10-04 13:00 ` [PULL 01/54] scripts/ci/setup: ninja missing from build-environment Alex Bennée
@ 2022-10-04 13:00 ` Alex Bennée
  2022-10-04 13:00 ` [PULL 03/54] scripts/ci/setup: spice-server only on x86 aarch64 Alex Bennée
                   ` (52 subsequent siblings)
  54 siblings, 0 replies; 64+ messages in thread
From: Alex Bennée @ 2022-10-04 13:00 UTC (permalink / raw)
  To: qemu-devel
  Cc: stefanha, Lucas Mateus Castro (alqotel),
	Alex Bennée, Philippe Mathieu-Daudé,
	Thomas Huth, Wainer dos Santos Moschetta, Beraldo Leal

From: "Lucas Mateus Castro (alqotel)" <lucas.araujo@eldorado.org.br>

XEN hypervisor is only available in ARM and x86, but the yaml only
checked if the architecture is different from s390x, changed it to
a more accurate test.
Tested this change on a Ubuntu 20.04 ppc64le.

Signed-off-by: Lucas Mateus Castro (alqotel) <lucas.araujo@eldorado.org.br>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20220922135516.33627-3-lucas.araujo@eldorado.org.br>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20220929114231.583801-3-alex.bennee@linaro.org>

diff --git a/scripts/ci/setup/build-environment.yml b/scripts/ci/setup/build-environment.yml
index b5acaf9118..49292715d3 100644
--- a/scripts/ci/setup/build-environment.yml
+++ b/scripts/ci/setup/build-environment.yml
@@ -97,7 +97,7 @@
         state: present
       when:
         - ansible_facts['distribution'] == 'Ubuntu'
-        - ansible_facts['architecture'] != 's390x'
+        - ansible_facts['architecture'] == 'aarch64' or ansible_facts['architecture'] == 'x86_64'
 
     - name: Install basic packages to build QEMU on Ubuntu 20.04
       package:
-- 
2.34.1



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

* [PULL 03/54] scripts/ci/setup: spice-server only on x86 aarch64
  2022-10-04 13:00 [PULL 00/54] testing, gdbstub, plugin and gitdm updates Alex Bennée
  2022-10-04 13:00 ` [PULL 01/54] scripts/ci/setup: ninja missing from build-environment Alex Bennée
  2022-10-04 13:00 ` [PULL 02/54] scripts/ci/setup: Fix libxen requirements Alex Bennée
@ 2022-10-04 13:00 ` Alex Bennée
  2022-10-04 13:00 ` [PULL 04/54] tests/docker: run script use realpath instead of readlink Alex Bennée
                   ` (51 subsequent siblings)
  54 siblings, 0 replies; 64+ messages in thread
From: Alex Bennée @ 2022-10-04 13:00 UTC (permalink / raw)
  To: qemu-devel
  Cc: stefanha, Lucas Mateus Castro (alqotel),
	Philippe Mathieu-Daudé,
	Alex Bennée, Thomas Huth, Wainer dos Santos Moschetta,
	Beraldo Leal

From: "Lucas Mateus Castro (alqotel)" <lucas.araujo@eldorado.org.br>

Changed build-environment.yml to only install spice-server on x86_64 and
aarch64 as this package is only available on those architectures.

Signed-off-by: Lucas Mateus Castro (alqotel) <lucas.araujo@eldorado.org.br>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20220922135516.33627-4-lucas.araujo@eldorado.org.br>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20220929114231.583801-4-alex.bennee@linaro.org>

diff --git a/scripts/ci/setup/build-environment.yml b/scripts/ci/setup/build-environment.yml
index 49292715d3..b04c2b7cee 100644
--- a/scripts/ci/setup/build-environment.yml
+++ b/scripts/ci/setup/build-environment.yml
@@ -160,7 +160,6 @@
           - python36
           - rdma-core-devel
           - spice-glib-devel
-          - spice-server
           - systemtap-sdt-devel
           - tar
           - zlib-devel
@@ -168,3 +167,14 @@
       when:
         - ansible_facts['distribution_file_variety'] == 'RedHat'
         - ansible_facts['distribution_version'] == '8'
+
+    - name: Install packages only available on x86 and aarch64
+      dnf:
+        # Spice server not available in ppc64le
+        name:
+          - spice-server
+        state: present
+      when:
+        - ansible_facts['distribution_file_variety'] == 'RedHat'
+        - ansible_facts['distribution_version'] == '8'
+        - ansible_facts['architecture'] == 'aarch64' or ansible_facts['architecture'] == 'x86_64'
-- 
2.34.1



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

* [PULL 04/54] tests/docker: run script use realpath instead of readlink
  2022-10-04 13:00 [PULL 00/54] testing, gdbstub, plugin and gitdm updates Alex Bennée
                   ` (2 preceding siblings ...)
  2022-10-04 13:00 ` [PULL 03/54] scripts/ci/setup: spice-server only on x86 aarch64 Alex Bennée
@ 2022-10-04 13:00 ` Alex Bennée
  2022-10-04 13:00 ` [PULL 05/54] configure: move detected gdb to TCG's config-host.mak Alex Bennée
                   ` (50 subsequent siblings)
  54 siblings, 0 replies; 64+ messages in thread
From: Alex Bennée @ 2022-10-04 13:00 UTC (permalink / raw)
  To: qemu-devel
  Cc: stefanha, Lucas Mateus Castro (alqotel), Daniel P . Berrangé,
	Alex Bennée, Philippe Mathieu-Daudé,
	Thomas Huth, Wainer dos Santos Moschetta, Beraldo Leal

From: "Lucas Mateus Castro (alqotel)" <lucas.araujo@eldorado.org.br>

The alpine docker image only comes with busybox, which doesn't have the
'-e' option on its readlink, so change it to 'realpath' to avoid that
problem.

Suggested-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Lucas Mateus Castro (alqotel) <lucas.araujo@eldorado.org.br>
Message-Id: <20220922135516.33627-5-lucas.araujo@eldorado.org.br>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20220929114231.583801-5-alex.bennee@linaro.org>

diff --git a/tests/docker/run b/tests/docker/run
index 421393046b..9eb96129da 100755
--- a/tests/docker/run
+++ b/tests/docker/run
@@ -15,7 +15,7 @@ if test -n "$V"; then
     set -x
 fi
 
-BASE="$(dirname $(readlink -e $0))"
+BASE="$(dirname $(realpath $0))"
 
 # Prepare the environment
 export PATH=/usr/lib/ccache:/usr/lib64/ccache:$PATH
-- 
2.34.1



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

* [PULL 05/54] configure: move detected gdb to TCG's config-host.mak
  2022-10-04 13:00 [PULL 00/54] testing, gdbstub, plugin and gitdm updates Alex Bennée
                   ` (3 preceding siblings ...)
  2022-10-04 13:00 ` [PULL 04/54] tests/docker: run script use realpath instead of readlink Alex Bennée
@ 2022-10-04 13:00 ` Alex Bennée
  2022-10-04 13:00 ` [PULL 06/54] target/hexagon: add flex/bison/glib2 to qemu.yml Alex Bennée
                   ` (49 subsequent siblings)
  54 siblings, 0 replies; 64+ messages in thread
From: Alex Bennée @ 2022-10-04 13:00 UTC (permalink / raw)
  To: qemu-devel; +Cc: stefanha, Alex Bennée

When tests/tcg gained it's own config-host.mak we forgot to move the
GDB detection.

Fixes: 544f4a2578 (tests/tcg: isolate from QEMU's config-host.mak)
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20220929114231.583801-6-alex.bennee@linaro.org>

diff --git a/configure b/configure
index dc53e4df03..52ae4adffc 100755
--- a/configure
+++ b/configure
@@ -2453,6 +2453,8 @@ if test -n "$gdb_bin"; then
     gdb_version=$($gdb_bin --version | head -n 1)
     if version_ge ${gdb_version##* } 9.1; then
         echo "HAVE_GDB_BIN=$gdb_bin" >> $config_host_mak
+    else
+        gdb_bin=""
     fi
 fi
 
@@ -2537,6 +2539,11 @@ echo "# Automatically generated by configure - do not modify" > $config_host_mak
 echo "SRC_PATH=$source_path" >> $config_host_mak
 echo "HOST_CC=$host_cc" >> $config_host_mak
 
+# versioned checked in the main config_host.mak above
+if test -n "$gdb_bin"; then
+    echo "HAVE_GDB_BIN=$gdb_bin" >> $config_host_mak
+fi
+
 tcg_tests_targets=
 for target in $target_list; do
   arch=${target%%-*}
-- 
2.34.1



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

* [PULL 06/54] target/hexagon: add flex/bison/glib2 to qemu.yml
  2022-10-04 13:00 [PULL 00/54] testing, gdbstub, plugin and gitdm updates Alex Bennée
                   ` (4 preceding siblings ...)
  2022-10-04 13:00 ` [PULL 05/54] configure: move detected gdb to TCG's config-host.mak Alex Bennée
@ 2022-10-04 13:00 ` Alex Bennée
  2022-10-04 13:00 ` [PULL 07/54] target/hexagon: regenerate docker/cirrus files Alex Bennée
                   ` (48 subsequent siblings)
  54 siblings, 0 replies; 64+ messages in thread
From: Alex Bennée @ 2022-10-04 13:00 UTC (permalink / raw)
  To: qemu-devel
  Cc: stefanha, Anton Johansson, Alessandro Di Federico,
	Paolo Montesel, Alex Bennée, Philippe Mathieu-Daudé,
	Thomas Huth, Wainer dos Santos Moschetta, Beraldo Leal

From: Anton Johansson <anjo@rev.ng>

Note, the glib2-native mapping exists separately from the normal glib2
mapping. The latter uses a `foreign` cross-policy-default, and
libvirt-ci is not able to support package mappings for multiple
cross-compilation policies.

This will probably change in the future.

Signed-off-by: Alessandro Di Federico <ale@rev.ng>
Signed-off-by: Paolo Montesel <babush@rev.ng>
Signed-off-by: Anton Johansson <anjo@rev.ng>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20220804115548.13024-9-anjo@rev.ng>
Message-Id: <20220929114231.583801-7-alex.bennee@linaro.org>

diff --git a/tests/lcitool/projects/qemu.yml b/tests/lcitool/projects/qemu.yml
index d9f826f8eb..0d92819249 100644
--- a/tests/lcitool/projects/qemu.yml
+++ b/tests/lcitool/projects/qemu.yml
@@ -3,6 +3,7 @@ packages:
  - alsa
  - bash
  - bc
+ - bison
  - brlapi
  - bzip2
  - bzip2-libs
@@ -19,6 +20,7 @@ packages:
  - diffutils
  - dtrace
  - findutils
+ - flex
  - fuse3
  - g++
  - gcc
@@ -26,6 +28,7 @@ packages:
  - gettext
  - genisoimage
  - glib2
+ - glib2-native
  - glib2-static
  - glusterfs
  - gnutls
-- 
2.34.1



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

* [PULL 07/54] target/hexagon: regenerate docker/cirrus files
  2022-10-04 13:00 [PULL 00/54] testing, gdbstub, plugin and gitdm updates Alex Bennée
                   ` (5 preceding siblings ...)
  2022-10-04 13:00 ` [PULL 06/54] target/hexagon: add flex/bison/glib2 to qemu.yml Alex Bennée
@ 2022-10-04 13:00 ` Alex Bennée
  2022-10-04 13:00 ` [PULL 08/54] target/hexagon: manually add flex/bison/glib2 to remaining containers Alex Bennée
                   ` (47 subsequent siblings)
  54 siblings, 0 replies; 64+ messages in thread
From: Alex Bennée @ 2022-10-04 13:00 UTC (permalink / raw)
  To: qemu-devel
  Cc: stefanha, Anton Johansson, Alex Bennée, Ed Maste,
	Li-Wen Hsu, Philippe Mathieu-Daudé,
	Thomas Huth, Wainer dos Santos Moschetta, Beraldo Leal

From: Anton Johansson <anjo@rev.ng>

This patch updates the docker and cirrus files with the new packages by
running tests/lcitool/refresh

Signed-off-by: Anton Johansson <anjo@rev.ng>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20220804115548.13024-10-anjo@rev.ng>
Message-Id: <20220929114231.583801-8-alex.bennee@linaro.org>

diff --git a/.gitlab-ci.d/cirrus/freebsd-12.vars b/.gitlab-ci.d/cirrus/freebsd-12.vars
index 1a5959810f..c3db1d7d30 100644
--- a/.gitlab-ci.d/cirrus/freebsd-12.vars
+++ b/.gitlab-ci.d/cirrus/freebsd-12.vars
@@ -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 bzip2 ca_root_nss capstone4 ccache cdrkit-genisoimage cmocka ctags curl cyrus-sasl dbus diffutils dtc 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 spice-protocol tesseract texinfo usbredir virglrenderer vte3 zstd'
 PYPI_PKGS=''
 PYTHON='/usr/local/bin/python3'
diff --git a/.gitlab-ci.d/cirrus/freebsd-13.vars b/.gitlab-ci.d/cirrus/freebsd-13.vars
index 5e5aafd7e5..d31faa787f 100644
--- a/.gitlab-ci.d/cirrus/freebsd-13.vars
+++ b/.gitlab-ci.d/cirrus/freebsd-13.vars
@@ -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 bzip2 ca_root_nss capstone4 ccache cdrkit-genisoimage cmocka ctags curl cyrus-sasl dbus diffutils dtc 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 spice-protocol tesseract texinfo usbredir virglrenderer vte3 zstd'
 PYPI_PKGS=''
 PYTHON='/usr/local/bin/python3'
diff --git a/.gitlab-ci.d/cirrus/macos-11.vars b/.gitlab-ci.d/cirrus/macos-11.vars
index bec6e862d4..aee9f50de6 100644
--- a/.gitlab-ci.d/cirrus/macos-11.vars
+++ b/.gitlab-ci.d/cirrus/macos-11.vars
@@ -11,6 +11,6 @@ MAKE='/usr/local/bin/gmake'
 NINJA='/usr/local/bin/ninja'
 PACKAGING_COMMAND='brew'
 PIP3='/usr/local/bin/pip3'
-PKGS='bash bc bzip2 capstone ccache cmocka ctags curl dbus diffutils dtc gcovr gettext git glib gnu-sed gnutls gtk+3 jemalloc jpeg-turbo json-c libepoxy libffi libgcrypt libiscsi libnfs libpng libslirp libssh libtasn1 libusb llvm lzo make meson ncurses nettle ninja perl pixman pkg-config python3 rpm2cpio sdl2 sdl2_image snappy sparse spice-protocol tesseract texinfo usbredir vde vte3 zlib zstd'
+PKGS='bash bc bison bzip2 capstone ccache cmocka ctags curl dbus diffutils dtc flex gcovr gettext git glib gnu-sed gnutls gtk+3 jemalloc jpeg-turbo json-c libepoxy libffi libgcrypt libiscsi libnfs libpng libslirp libssh libtasn1 libusb llvm lzo make meson ncurses nettle ninja perl pixman pkg-config python3 rpm2cpio sdl2 sdl2_image snappy sparse spice-protocol tesseract texinfo usbredir vde vte3 zlib zstd'
 PYPI_PKGS='PyYAML numpy pillow sphinx sphinx-rtd-theme'
 PYTHON='/usr/local/bin/python3'
diff --git a/tests/docker/dockerfiles/alpine.docker b/tests/docker/dockerfiles/alpine.docker
index 806cb19f17..7d6e95275a 100644
--- a/tests/docker/dockerfiles/alpine.docker
+++ b/tests/docker/dockerfiles/alpine.docker
@@ -13,6 +13,7 @@ RUN apk update && \
         attr-dev \
         bash \
         bc \
+        bison \
         bzip2 \
         bzip2-dev \
         ca-certificates \
@@ -30,6 +31,7 @@ RUN apk update && \
         dtc-dev \
         eudev-dev \
         findutils \
+        flex \
         fuse3-dev \
         g++ \
         gcc \
diff --git a/tests/docker/dockerfiles/centos8.docker b/tests/docker/dockerfiles/centos8.docker
index 3c29883332..d89113c0df 100644
--- a/tests/docker/dockerfiles/centos8.docker
+++ b/tests/docker/dockerfiles/centos8.docker
@@ -17,6 +17,7 @@ RUN dnf distro-sync -y && \
         alsa-lib-devel \
         bash \
         bc \
+        bison \
         brlapi-devel \
         bzip2 \
         bzip2-devel \
@@ -31,6 +32,7 @@ RUN dnf distro-sync -y && \
         device-mapper-multipath-devel \
         diffutils \
         findutils \
+        flex \
         fuse3-devel \
         gcc \
         gcc-c++ \
diff --git a/tests/docker/dockerfiles/debian-amd64-cross.docker b/tests/docker/dockerfiles/debian-amd64-cross.docker
index 7d2feb7bf7..9047759e76 100644
--- a/tests/docker/dockerfiles/debian-amd64-cross.docker
+++ b/tests/docker/dockerfiles/debian-amd64-cross.docker
@@ -13,6 +13,7 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
     eatmydata apt-get install --no-install-recommends -y \
             bash \
             bc \
+            bison \
             bsdextrautils \
             bzip2 \
             ca-certificates \
@@ -22,11 +23,13 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
             diffutils \
             exuberant-ctags \
             findutils \
+            flex \
             gcovr \
             genisoimage \
             gettext \
             git \
             hostname \
+            libglib2.0-dev \
             libpcre2-dev \
             libspice-protocol-dev \
             llvm \
diff --git a/tests/docker/dockerfiles/debian-amd64.docker b/tests/docker/dockerfiles/debian-amd64.docker
index 8d78ba2484..a8b728ca64 100644
--- a/tests/docker/dockerfiles/debian-amd64.docker
+++ b/tests/docker/dockerfiles/debian-amd64.docker
@@ -13,6 +13,7 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
     eatmydata apt-get install --no-install-recommends -y \
             bash \
             bc \
+            bison \
             bsdextrautils \
             bzip2 \
             ca-certificates \
@@ -23,6 +24,7 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
             diffutils \
             exuberant-ctags \
             findutils \
+            flex \
             g++ \
             gcc \
             gcovr \
diff --git a/tests/docker/dockerfiles/debian-arm64-cross.docker b/tests/docker/dockerfiles/debian-arm64-cross.docker
index b7ba2c527f..17a5709245 100644
--- a/tests/docker/dockerfiles/debian-arm64-cross.docker
+++ b/tests/docker/dockerfiles/debian-arm64-cross.docker
@@ -13,6 +13,7 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
     eatmydata apt-get install --no-install-recommends -y \
             bash \
             bc \
+            bison \
             bsdextrautils \
             bzip2 \
             ca-certificates \
@@ -22,11 +23,13 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
             diffutils \
             exuberant-ctags \
             findutils \
+            flex \
             gcovr \
             genisoimage \
             gettext \
             git \
             hostname \
+            libglib2.0-dev \
             libpcre2-dev \
             libspice-protocol-dev \
             llvm \
diff --git a/tests/docker/dockerfiles/debian-armel-cross.docker b/tests/docker/dockerfiles/debian-armel-cross.docker
index 9b1778261e..701fc70db0 100644
--- a/tests/docker/dockerfiles/debian-armel-cross.docker
+++ b/tests/docker/dockerfiles/debian-armel-cross.docker
@@ -13,6 +13,7 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
     eatmydata apt-get install --no-install-recommends -y \
             bash \
             bc \
+            bison \
             bsdextrautils \
             bzip2 \
             ca-certificates \
@@ -22,11 +23,13 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
             diffutils \
             exuberant-ctags \
             findutils \
+            flex \
             gcovr \
             genisoimage \
             gettext \
             git \
             hostname \
+            libglib2.0-dev \
             libpcre2-dev \
             libspice-protocol-dev \
             llvm \
diff --git a/tests/docker/dockerfiles/debian-armhf-cross.docker b/tests/docker/dockerfiles/debian-armhf-cross.docker
index addbc9a793..5a11fe3900 100644
--- a/tests/docker/dockerfiles/debian-armhf-cross.docker
+++ b/tests/docker/dockerfiles/debian-armhf-cross.docker
@@ -13,6 +13,7 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
     eatmydata apt-get install --no-install-recommends -y \
             bash \
             bc \
+            bison \
             bsdextrautils \
             bzip2 \
             ca-certificates \
@@ -22,11 +23,13 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
             diffutils \
             exuberant-ctags \
             findutils \
+            flex \
             gcovr \
             genisoimage \
             gettext \
             git \
             hostname \
+            libglib2.0-dev \
             libpcre2-dev \
             libspice-protocol-dev \
             llvm \
diff --git a/tests/docker/dockerfiles/debian-mips64el-cross.docker b/tests/docker/dockerfiles/debian-mips64el-cross.docker
index 1bb7d8e184..9b90a4d6ff 100644
--- a/tests/docker/dockerfiles/debian-mips64el-cross.docker
+++ b/tests/docker/dockerfiles/debian-mips64el-cross.docker
@@ -13,6 +13,7 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
     eatmydata apt-get install --no-install-recommends -y \
             bash \
             bc \
+            bison \
             bsdextrautils \
             bzip2 \
             ca-certificates \
@@ -22,11 +23,13 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
             diffutils \
             exuberant-ctags \
             findutils \
+            flex \
             gcovr \
             genisoimage \
             gettext \
             git \
             hostname \
+            libglib2.0-dev \
             libpcre2-dev \
             libspice-protocol-dev \
             llvm \
diff --git a/tests/docker/dockerfiles/debian-mipsel-cross.docker b/tests/docker/dockerfiles/debian-mipsel-cross.docker
index a94b459b23..02feaf26cb 100644
--- a/tests/docker/dockerfiles/debian-mipsel-cross.docker
+++ b/tests/docker/dockerfiles/debian-mipsel-cross.docker
@@ -13,6 +13,7 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
     eatmydata apt-get install --no-install-recommends -y \
             bash \
             bc \
+            bison \
             bsdextrautils \
             bzip2 \
             ca-certificates \
@@ -22,11 +23,13 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
             diffutils \
             exuberant-ctags \
             findutils \
+            flex \
             gcovr \
             genisoimage \
             gettext \
             git \
             hostname \
+            libglib2.0-dev \
             libpcre2-dev \
             libspice-protocol-dev \
             llvm \
diff --git a/tests/docker/dockerfiles/debian-ppc64el-cross.docker b/tests/docker/dockerfiles/debian-ppc64el-cross.docker
index c641fd5d0e..97d3872ee2 100644
--- a/tests/docker/dockerfiles/debian-ppc64el-cross.docker
+++ b/tests/docker/dockerfiles/debian-ppc64el-cross.docker
@@ -13,6 +13,7 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
     eatmydata apt-get install --no-install-recommends -y \
             bash \
             bc \
+            bison \
             bsdextrautils \
             bzip2 \
             ca-certificates \
@@ -22,11 +23,13 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
             diffutils \
             exuberant-ctags \
             findutils \
+            flex \
             gcovr \
             genisoimage \
             gettext \
             git \
             hostname \
+            libglib2.0-dev \
             libpcre2-dev \
             libspice-protocol-dev \
             llvm \
diff --git a/tests/docker/dockerfiles/debian-s390x-cross.docker b/tests/docker/dockerfiles/debian-s390x-cross.docker
index c0cbe09e66..95585e9e56 100644
--- a/tests/docker/dockerfiles/debian-s390x-cross.docker
+++ b/tests/docker/dockerfiles/debian-s390x-cross.docker
@@ -13,6 +13,7 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
     eatmydata apt-get install --no-install-recommends -y \
             bash \
             bc \
+            bison \
             bsdextrautils \
             bzip2 \
             ca-certificates \
@@ -22,11 +23,13 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
             diffutils \
             exuberant-ctags \
             findutils \
+            flex \
             gcovr \
             genisoimage \
             gettext \
             git \
             hostname \
+            libglib2.0-dev \
             libpcre2-dev \
             libspice-protocol-dev \
             llvm \
diff --git a/tests/docker/dockerfiles/fedora.docker b/tests/docker/dockerfiles/fedora.docker
index b39d311bbc..fe84166ca1 100644
--- a/tests/docker/dockerfiles/fedora.docker
+++ b/tests/docker/dockerfiles/fedora.docker
@@ -23,6 +23,7 @@ exec "$@"' > /usr/bin/nosync && \
         alsa-lib-devel \
         bash \
         bc \
+        bison \
         brlapi-devel \
         bzip2 \
         bzip2-devel \
@@ -37,6 +38,7 @@ exec "$@"' > /usr/bin/nosync && \
         device-mapper-multipath-devel \
         diffutils \
         findutils \
+        flex \
         fuse3-devel \
         gcc \
         gcc-c++ \
diff --git a/tests/docker/dockerfiles/opensuse-leap.docker b/tests/docker/dockerfiles/opensuse-leap.docker
index 041cf9c1ff..d80064756f 100644
--- a/tests/docker/dockerfiles/opensuse-leap.docker
+++ b/tests/docker/dockerfiles/opensuse-leap.docker
@@ -12,6 +12,7 @@ RUN zypper update -y && \
            alsa-lib-devel \
            bash \
            bc \
+           bison \
            brlapi-devel \
            bzip2 \
            ca-certificates \
@@ -22,6 +23,7 @@ RUN zypper update -y && \
            dbus-1 \
            diffutils \
            findutils \
+           flex \
            fuse3-devel \
            gcc \
            gcc-c++ \
diff --git a/tests/docker/dockerfiles/ubuntu2004.docker b/tests/docker/dockerfiles/ubuntu2004.docker
index e1f4ed7c80..24594afc15 100644
--- a/tests/docker/dockerfiles/ubuntu2004.docker
+++ b/tests/docker/dockerfiles/ubuntu2004.docker
@@ -13,6 +13,7 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
     eatmydata apt-get install --no-install-recommends -y \
             bash \
             bc \
+            bison \
             bsdmainutils \
             bzip2 \
             ca-certificates \
@@ -23,6 +24,7 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
             diffutils \
             exuberant-ctags \
             findutils \
+            flex \
             g++ \
             gcc \
             gcovr \
-- 
2.34.1



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

* [PULL 08/54] target/hexagon: manually add flex/bison/glib2 to remaining containers
  2022-10-04 13:00 [PULL 00/54] testing, gdbstub, plugin and gitdm updates Alex Bennée
                   ` (6 preceding siblings ...)
  2022-10-04 13:00 ` [PULL 07/54] target/hexagon: regenerate docker/cirrus files Alex Bennée
@ 2022-10-04 13:00 ` Alex Bennée
  2022-10-04 13:00 ` [PULL 09/54] tests/docker: update fedora-win[32|64]-cross with lcitool Alex Bennée
                   ` (46 subsequent siblings)
  54 siblings, 0 replies; 64+ messages in thread
From: Alex Bennée @ 2022-10-04 13:00 UTC (permalink / raw)
  To: qemu-devel
  Cc: stefanha, Anton Johansson, Alex Bennée,
	Philippe Mathieu-Daudé,
	Thomas Huth, Wainer dos Santos Moschetta, Beraldo Leal

From: Anton Johansson <anjo@rev.ng>

Adds our build-time dependencies to containers which build qemu-hexagon,
but aren't covered by libvirt-ci.

Signed-off-by: Anton Johansson <anjo@rev.ng>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20220804115548.13024-11-anjo@rev.ng>
Message-Id: <20220929114231.583801-9-alex.bennee@linaro.org>

diff --git a/.gitlab-ci.d/windows.yml b/.gitlab-ci.d/windows.yml
index ba59844d12..a3e7a37022 100644
--- a/.gitlab-ci.d/windows.yml
+++ b/.gitlab-ci.d/windows.yml
@@ -33,7 +33,8 @@ msys2-64bit:
   extends: .shared_msys2_builder
   script:
   - .\msys64\usr\bin\bash -lc "pacman -Sy --noconfirm --needed
-      diffutils git grep make sed
+      bison diffutils flex
+      git grep make sed
       mingw-w64-x86_64-capstone
       mingw-w64-x86_64-curl
       mingw-w64-x86_64-cyrus-sasl
@@ -67,7 +68,8 @@ msys2-32bit:
   extends: .shared_msys2_builder
   script:
   - .\msys64\usr\bin\bash -lc "pacman -Sy --noconfirm --needed
-      diffutils git grep make sed
+      bison diffutils flex
+      git grep make sed
       mingw-w64-i686-capstone
       mingw-w64-i686-curl
       mingw-w64-i686-cyrus-sasl
diff --git a/tests/docker/dockerfiles/debian-riscv64-cross.docker b/tests/docker/dockerfiles/debian-riscv64-cross.docker
index 594d97982c..9715791e0b 100644
--- a/tests/docker/dockerfiles/debian-riscv64-cross.docker
+++ b/tests/docker/dockerfiles/debian-riscv64-cross.docker
@@ -16,13 +16,16 @@ RUN apt update && \
 
 # Install common build utilities
 RUN DEBIAN_FRONTEND=noninteractive eatmydata apt install -yy \
+    bison \
     bc \
     build-essential \
     ca-certificates \
     debian-ports-archive-keyring \
     dpkg-dev \
+    flex \
     gettext \
     git \
+    libglib2.0-dev \
     ninja-build \
     pkg-config \
     python3
diff --git a/tests/docker/dockerfiles/fedora-i386-cross.docker b/tests/docker/dockerfiles/fedora-i386-cross.docker
index 0a3ec346e6..7eec648d2d 100644
--- a/tests/docker/dockerfiles/fedora-i386-cross.docker
+++ b/tests/docker/dockerfiles/fedora-i386-cross.docker
@@ -1,9 +1,11 @@
 FROM registry.fedoraproject.org/fedora:34
 
 ENV PACKAGES \
+    bison \
     bzip2 \
     ccache \
     diffutils \
+    flex \
     findutils \
     gcc \
     git \
diff --git a/tests/docker/dockerfiles/fedora-win32-cross.docker b/tests/docker/dockerfiles/fedora-win32-cross.docker
index a06bd29e8e..aca37aabc4 100644
--- a/tests/docker/dockerfiles/fedora-win32-cross.docker
+++ b/tests/docker/dockerfiles/fedora-win32-cross.docker
@@ -3,13 +3,16 @@ FROM registry.fedoraproject.org/fedora:35
 # Please keep this list sorted alphabetically
 ENV PACKAGES \
     bc \
+    bison \
     bzip2 \
     ccache \
     diffutils \
     findutils \
+    flex \
     gcc \
     gettext \
     git \
+    glib2-devel \
     hostname \
     make \
     meson \
diff --git a/tests/docker/dockerfiles/fedora-win64-cross.docker b/tests/docker/dockerfiles/fedora-win64-cross.docker
index b71624330f..3642766479 100644
--- a/tests/docker/dockerfiles/fedora-win64-cross.docker
+++ b/tests/docker/dockerfiles/fedora-win64-cross.docker
@@ -3,13 +3,16 @@ FROM registry.fedoraproject.org/fedora:35
 # Please keep this list sorted alphabetically
 ENV PACKAGES \
     bc \
+    bison \
     bzip2 \
     ccache \
     diffutils \
     findutils \
+    flex \
     gcc \
     gettext \
     git \
+    glib2-devel \
     hostname \
     make \
     meson \
-- 
2.34.1



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

* [PULL 09/54] tests/docker: update fedora-win[32|64]-cross with lcitool
  2022-10-04 13:00 [PULL 00/54] testing, gdbstub, plugin and gitdm updates Alex Bennée
                   ` (7 preceding siblings ...)
  2022-10-04 13:00 ` [PULL 08/54] target/hexagon: manually add flex/bison/glib2 to remaining containers Alex Bennée
@ 2022-10-04 13:00 ` Alex Bennée
  2022-10-04 13:00 ` [PULL 10/54] tests/docker: move alpine from edge to tagged release Alex Bennée
                   ` (45 subsequent siblings)
  54 siblings, 0 replies; 64+ messages in thread
From: Alex Bennée @ 2022-10-04 13:00 UTC (permalink / raw)
  To: qemu-devel
  Cc: stefanha, Alex Bennée, Philippe Mathieu-Daudé,
	Thomas Huth, Wainer dos Santos Moschetta, Beraldo Leal

Convert another two dockerfiles to lcitool and update. I renamed the
helper because it is not Debian specific.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20220929114231.583801-10-alex.bennee@linaro.org>

diff --git a/tests/docker/dockerfiles/fedora-win32-cross.docker b/tests/docker/dockerfiles/fedora-win32-cross.docker
index aca37aabc4..11f153e397 100644
--- a/tests/docker/dockerfiles/fedora-win32-cross.docker
+++ b/tests/docker/dockerfiles/fedora-win32-cross.docker
@@ -1,46 +1,103 @@
+# THIS FILE WAS AUTO-GENERATED
+#
+#  $ lcitool dockerfile --layers all --cross mingw32 fedora-35 qemu
+#
+# https://gitlab.com/libvirt/libvirt-ci
+
 FROM registry.fedoraproject.org/fedora:35
 
-# Please keep this list sorted alphabetically
-ENV PACKAGES \
-    bc \
-    bison \
-    bzip2 \
-    ccache \
-    diffutils \
-    findutils \
-    flex \
-    gcc \
-    gettext \
-    git \
-    glib2-devel \
-    hostname \
-    make \
-    meson \
-    mingw32-bzip2 \
-    mingw32-curl \
-    mingw32-glib2 \
-    mingw32-gmp \
-    mingw32-gnutls \
-    mingw32-gtk3 \
-    mingw32-libffi \
-    mingw32-libjpeg-turbo \
-    mingw32-libpng \
-    mingw32-libtasn1 \
-    mingw32-libusbx \
-    mingw32-nettle \
-    mingw32-nsis \
-    mingw32-pixman \
-    mingw32-pkg-config \
-    mingw32-SDL2 \
-    msitools \
-    perl \
-    python3 \
-    python3-PyYAML \
-    tar \
-    which
+RUN dnf install -y nosync && \
+    echo -e '#!/bin/sh\n\
+if test -d /usr/lib64\n\
+then\n\
+    export LD_PRELOAD=/usr/lib64/nosync/nosync.so\n\
+else\n\
+    export LD_PRELOAD=/usr/lib/nosync/nosync.so\n\
+fi\n\
+exec "$@"' > /usr/bin/nosync && \
+    chmod +x /usr/bin/nosync && \
+    nosync dnf update -y && \
+    nosync dnf install -y \
+        bash \
+        bc \
+        bison \
+        bzip2 \
+        ca-certificates \
+        ccache \
+        ctags \
+        dbus-daemon \
+        diffutils \
+        findutils \
+        flex \
+        gcovr \
+        genisoimage \
+        git \
+        glib2-devel \
+        glibc-langpack-en \
+        hostname \
+        llvm \
+        make \
+        meson \
+        ninja-build \
+        nmap-ncat \
+        openssh-clients \
+        pcre-static \
+        perl-base \
+        python3 \
+        python3-PyYAML \
+        python3-numpy \
+        python3-opencv \
+        python3-pillow \
+        python3-pip \
+        python3-sphinx \
+        python3-sphinx_rtd_theme \
+        rpm \
+        sed \
+        sparse \
+        spice-protocol \
+        tar \
+        tesseract \
+        tesseract-langpack-eng \
+        texinfo \
+        util-linux \
+        which && \
+    nosync dnf autoremove -y && \
+    nosync dnf clean all -y
+
+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"
 
-RUN dnf install -y $PACKAGES
-RUN rpm -q $PACKAGES | sort > /packages.txt
+RUN nosync dnf install -y \
+        mingw32-SDL2 \
+        mingw32-SDL2_image \
+        mingw32-bzip2 \
+        mingw32-curl \
+        mingw32-gcc \
+        mingw32-gcc-c++ \
+        mingw32-gettext \
+        mingw32-glib2 \
+        mingw32-gnutls \
+        mingw32-gtk3 \
+        mingw32-libgcrypt \
+        mingw32-libjpeg-turbo \
+        mingw32-libpng \
+        mingw32-libtasn1 \
+        mingw32-nettle \
+        mingw32-nsis \
+        mingw32-pixman \
+        mingw32-pkg-config && \
+    nosync dnf clean all -y && \
+    rpm -qa | sort > /packages.txt && \
+    mkdir -p /usr/libexec/ccache-wrappers && \
+    ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/i686-w64-mingw32-c++ && \
+    ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/i686-w64-mingw32-cc && \
+    ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/i686-w64-mingw32-g++ && \
+    ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/i686-w64-mingw32-gcc
 
-# Specify the cross prefix for this image (see tests/docker/common.rc)
+ENV ABI "i686-w64-mingw32"
+ENV MESON_OPTS "--cross-file=/usr/share/mingw/toolchain-mingw32.meson"
 ENV QEMU_CONFIGURE_OPTS --cross-prefix=i686-w64-mingw32-
+ENV DEF_TARGET_LIST i386-softmmu
diff --git a/tests/docker/dockerfiles/fedora-win64-cross.docker b/tests/docker/dockerfiles/fedora-win64-cross.docker
index 3642766479..8938c28554 100644
--- a/tests/docker/dockerfiles/fedora-win64-cross.docker
+++ b/tests/docker/dockerfiles/fedora-win64-cross.docker
@@ -1,43 +1,102 @@
+# THIS FILE WAS AUTO-GENERATED
+#
+#  $ lcitool dockerfile --layers all --cross mingw64 fedora-35 qemu
+#
+# https://gitlab.com/libvirt/libvirt-ci
+
 FROM registry.fedoraproject.org/fedora:35
 
-# Please keep this list sorted alphabetically
-ENV PACKAGES \
-    bc \
-    bison \
-    bzip2 \
-    ccache \
-    diffutils \
-    findutils \
-    flex \
-    gcc \
-    gettext \
-    git \
-    glib2-devel \
-    hostname \
-    make \
-    meson \
-    mingw32-nsis \
-    mingw64-bzip2 \
-    mingw64-curl \
-    mingw64-glib2 \
-    mingw64-gmp \
-    mingw64-gtk3 \
-    mingw64-libffi \
-    mingw64-libjpeg-turbo \
-    mingw64-libpng \
-    mingw64-libtasn1 \
-    mingw64-libusbx \
-    mingw64-pixman \
-    mingw64-pkg-config \
-    msitools \
-    perl \
-    python3 \
-    python3-PyYAML \
-    tar \
-    which
+RUN dnf install -y nosync && \
+    echo -e '#!/bin/sh\n\
+if test -d /usr/lib64\n\
+then\n\
+    export LD_PRELOAD=/usr/lib64/nosync/nosync.so\n\
+else\n\
+    export LD_PRELOAD=/usr/lib/nosync/nosync.so\n\
+fi\n\
+exec "$@"' > /usr/bin/nosync && \
+    chmod +x /usr/bin/nosync && \
+    nosync dnf update -y && \
+    nosync dnf install -y \
+        bash \
+        bc \
+        bison \
+        bzip2 \
+        ca-certificates \
+        ccache \
+        ctags \
+        dbus-daemon \
+        diffutils \
+        findutils \
+        flex \
+        gcovr \
+        genisoimage \
+        git \
+        glib2-devel \
+        glibc-langpack-en \
+        hostname \
+        llvm \
+        make \
+        meson \
+        ninja-build \
+        nmap-ncat \
+        openssh-clients \
+        pcre-static \
+        perl-base \
+        python3 \
+        python3-PyYAML \
+        python3-numpy \
+        python3-opencv \
+        python3-pillow \
+        python3-pip \
+        python3-sphinx \
+        python3-sphinx_rtd_theme \
+        rpm \
+        sed \
+        sparse \
+        spice-protocol \
+        tar \
+        tesseract \
+        tesseract-langpack-eng \
+        texinfo \
+        util-linux \
+        which && \
+    nosync dnf autoremove -y && \
+    nosync dnf clean all -y
+
+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"
 
-RUN dnf install -y $PACKAGES
-RUN rpm -q $PACKAGES | sort > /packages.txt
+RUN nosync dnf install -y \
+        mingw64-SDL2 \
+        mingw64-SDL2_image \
+        mingw64-bzip2 \
+        mingw64-curl \
+        mingw64-gcc \
+        mingw64-gcc-c++ \
+        mingw64-gettext \
+        mingw64-glib2 \
+        mingw64-gnutls \
+        mingw64-gtk3 \
+        mingw64-libgcrypt \
+        mingw64-libjpeg-turbo \
+        mingw64-libpng \
+        mingw64-libtasn1 \
+        mingw64-nettle \
+        mingw64-pixman \
+        mingw64-pkg-config && \
+    nosync dnf clean all -y && \
+    rpm -qa | sort > /packages.txt && \
+    mkdir -p /usr/libexec/ccache-wrappers && \
+    ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/x86_64-w64-mingw32-c++ && \
+    ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/x86_64-w64-mingw32-cc && \
+    ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/x86_64-w64-mingw32-g++ && \
+    ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/x86_64-w64-mingw32-gcc
 
-# Specify the cross prefix for this image (see tests/docker/common.rc)
-ENV QEMU_CONFIGURE_OPTS --cross-prefix=x86_64-w64-mingw32- --disable-capstone
+ENV ABI "x86_64-w64-mingw32"
+ENV MESON_OPTS "--cross-file=/usr/share/mingw/toolchain-mingw64.meson"
+ENV QEMU_CONFIGURE_OPTS --cross-prefix=x86_64-w64-mingw32-
+ENV DEF_TARGET_LIST x86_64-softmmu
diff --git a/tests/lcitool/refresh b/tests/lcitool/refresh
index fc604d8a21..783497a989 100755
--- a/tests/lcitool/refresh
+++ b/tests/lcitool/refresh
@@ -93,7 +93,7 @@ debian11_extras = [
 ]
 
 
-def debian_cross_build(prefix, targets):
+def cross_build(prefix, targets):
     conf = "ENV QEMU_CONFIGURE_OPTS --cross-prefix=%s\n" % (prefix)
     targets = "ENV DEF_TARGET_LIST %s\n" % (targets)
     return "".join([conf, targets])
@@ -121,45 +121,55 @@ try:
     #
     generate_dockerfile("debian-amd64-cross", "debian-11",
                         cross="x86_64",
-                        trailer=debian_cross_build("x86_64-linux-gnu-",
-                                                   "x86_64-softmmu,"
-                                                   "x86_64-linux-user,"
-                                                   "i386-softmmu,i386-linux-user"))
+                        trailer=cross_build("x86_64-linux-gnu-",
+                                            "x86_64-softmmu,"
+                                            "x86_64-linux-user,"
+                                            "i386-softmmu,i386-linux-user"))
 
     generate_dockerfile("debian-arm64-cross", "debian-11",
                         cross="aarch64",
-                        trailer=debian_cross_build("aarch64-linux-gnu-",
-                                                   "aarch64-softmmu,aarch64-linux-user"))
+                        trailer=cross_build("aarch64-linux-gnu-",
+                                            "aarch64-softmmu,aarch64-linux-user"))
 
     generate_dockerfile("debian-armel-cross", "debian-11",
                         cross="armv6l",
-                        trailer=debian_cross_build("arm-linux-gnueabi-",
-                                                   "arm-softmmu,arm-linux-user,armeb-linux-user"))
+                        trailer=cross_build("arm-linux-gnueabi-",
+                                            "arm-softmmu,arm-linux-user,armeb-linux-user"))
 
     generate_dockerfile("debian-armhf-cross", "debian-11",
                         cross="armv7l",
-                        trailer=debian_cross_build("arm-linux-gnueabihf-",
-                                                   "arm-softmmu,arm-linux-user"))
+                        trailer=cross_build("arm-linux-gnueabihf-",
+                                            "arm-softmmu,arm-linux-user"))
 
     generate_dockerfile("debian-mips64el-cross", "debian-11",
                         cross="mips64el",
-                        trailer=debian_cross_build("mips64el-linux-gnuabi64-",
-                                                  "mips64el-softmmu,mips64el-linux-user"))
+                        trailer=cross_build("mips64el-linux-gnuabi64-",
+                                            "mips64el-softmmu,mips64el-linux-user"))
 
     generate_dockerfile("debian-mipsel-cross", "debian-11",
                         cross="mipsel",
-                        trailer=debian_cross_build("mipsel-linux-gnu-",
-                                                   "mipsel-softmmu,mipsel-linux-user"))
+                        trailer=cross_build("mipsel-linux-gnu-",
+                                            "mipsel-softmmu,mipsel-linux-user"))
 
     generate_dockerfile("debian-ppc64el-cross", "debian-11",
                         cross="ppc64le",
-                        trailer=debian_cross_build("powerpc64le-linux-gnu-",
-                                                   "ppc64-softmmu,ppc64-linux-user"))
+                        trailer=cross_build("powerpc64le-linux-gnu-",
+                                            "ppc64-softmmu,ppc64-linux-user"))
 
     generate_dockerfile("debian-s390x-cross", "debian-11",
                         cross="s390x",
-                        trailer=debian_cross_build("s390x-linux-gnu-",
-                                                   "s390x-softmmu,s390x-linux-user"))
+                        trailer=cross_build("s390x-linux-gnu-",
+                                            "s390x-softmmu,s390x-linux-user"))
+
+    generate_dockerfile("fedora-win32-cross", "fedora-35",
+                        cross="mingw32",
+                        trailer=cross_build("i686-w64-mingw32-",
+                                            "i386-softmmu"))
+
+    generate_dockerfile("fedora-win64-cross", "fedora-35",
+                        cross="mingw64",
+                        trailer=cross_build("x86_64-w64-mingw32-",
+                                            "x86_64-softmmu"))
 
     #
     # Cirrus packages lists for GitLab
-- 
2.34.1



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

* [PULL 10/54] tests/docker: move alpine from edge to tagged release
  2022-10-04 13:00 [PULL 00/54] testing, gdbstub, plugin and gitdm updates Alex Bennée
                   ` (8 preceding siblings ...)
  2022-10-04 13:00 ` [PULL 09/54] tests/docker: update fedora-win[32|64]-cross with lcitool Alex Bennée
@ 2022-10-04 13:00 ` Alex Bennée
  2022-10-04 13:00 ` [PULL 11/54] tests/qtest: bump up QOS_PATH_MAX_ELEMENT_SIZE Alex Bennée
                   ` (44 subsequent siblings)
  54 siblings, 0 replies; 64+ messages in thread
From: Alex Bennée @ 2022-10-04 13:00 UTC (permalink / raw)
  To: qemu-devel
  Cc: stefanha, Alex Bennée, Thomas Huth,
	Philippe Mathieu-Daudé,
	Wainer dos Santos Moschetta, Beraldo Leal

Tracking alpine-edge like debian-sid is a moving target. Usually such
rolling releases are marked as "allow_failure: true" in our CI.
However as alpine presents a musl based distro and provides useful
extra coverage lets track a release branch instead to avoid random
breakages.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20220929114231.583801-11-alex.bennee@linaro.org>

diff --git a/tests/docker/dockerfiles/alpine.docker b/tests/docker/dockerfiles/alpine.docker
index 7d6e95275a..9b7541261a 100644
--- a/tests/docker/dockerfiles/alpine.docker
+++ b/tests/docker/dockerfiles/alpine.docker
@@ -1,10 +1,10 @@
 # THIS FILE WAS AUTO-GENERATED
 #
-#  $ lcitool dockerfile --layers all alpine-edge qemu
+#  $ lcitool dockerfile --layers all alpine-316 qemu
 #
 # https://gitlab.com/libvirt/libvirt-ci
 
-FROM docker.io/library/alpine:edge
+FROM docker.io/library/alpine:3.16
 
 RUN apk update && \
     apk upgrade && \
diff --git a/tests/lcitool/refresh b/tests/lcitool/refresh
index 783497a989..ce0b24c0b1 100755
--- a/tests/lcitool/refresh
+++ b/tests/lcitool/refresh
@@ -107,7 +107,7 @@ try:
     #
     # Standard native builds
     #
-    generate_dockerfile("alpine", "alpine-edge")
+    generate_dockerfile("alpine", "alpine-316")
     generate_dockerfile("centos8", "centos-stream-8")
     generate_dockerfile("debian-amd64", "debian-11",
                         trailer="".join(debian11_extras))
-- 
2.34.1



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

* [PULL 11/54] tests/qtest: bump up QOS_PATH_MAX_ELEMENT_SIZE
  2022-10-04 13:00 [PULL 00/54] testing, gdbstub, plugin and gitdm updates Alex Bennée
                   ` (9 preceding siblings ...)
  2022-10-04 13:00 ` [PULL 10/54] tests/docker: move alpine from edge to tagged release Alex Bennée
@ 2022-10-04 13:00 ` Alex Bennée
  2022-10-04 13:00 ` [PULL 12/54] configure: do not invoke as/ld directly for pc-bios/optionrom Alex Bennée
                   ` (43 subsequent siblings)
  54 siblings, 0 replies; 64+ messages in thread
From: Alex Bennée @ 2022-10-04 13:00 UTC (permalink / raw)
  To: qemu-devel
  Cc: stefanha, Alex Bennée, Thomas Huth, Paolo Bonzini, Laurent Vivier

It seems the depth of stack we need to support can vary depending on
the order of the init constructors getting called. It seems
--enable-lto shuffles things around just enough to push you over the
limit.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Fixes: https://gitlab.com/qemu-project/qemu/-/issues/1186
Acked-by: Thomas Huth <thuth@redhat.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20220929114231.583801-12-alex.bennee@linaro.org>

diff --git a/tests/qtest/libqos/qgraph.h b/tests/qtest/libqos/qgraph.h
index 6e94824d09..5c0046e989 100644
--- a/tests/qtest/libqos/qgraph.h
+++ b/tests/qtest/libqos/qgraph.h
@@ -24,7 +24,7 @@
 #include "libqos-malloc.h"
 
 /* maximum path length */
-#define QOS_PATH_MAX_ELEMENT_SIZE 50
+#define QOS_PATH_MAX_ELEMENT_SIZE 64
 
 typedef struct QOSGraphObject QOSGraphObject;
 typedef struct QOSGraphNode QOSGraphNode;
-- 
2.34.1



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

* [PULL 12/54] configure: do not invoke as/ld directly for pc-bios/optionrom
  2022-10-04 13:00 [PULL 00/54] testing, gdbstub, plugin and gitdm updates Alex Bennée
                   ` (10 preceding siblings ...)
  2022-10-04 13:00 ` [PULL 11/54] tests/qtest: bump up QOS_PATH_MAX_ELEMENT_SIZE Alex Bennée
@ 2022-10-04 13:00 ` Alex Bennée
  2022-10-04 13:00 ` [PULL 13/54] pc-bios/optionrom: detect CC options just once Alex Bennée
                   ` (42 subsequent siblings)
  54 siblings, 0 replies; 64+ messages in thread
From: Alex Bennée @ 2022-10-04 13:00 UTC (permalink / raw)
  To: qemu-devel; +Cc: stefanha, Paolo Bonzini, Alex Bennée

From: Paolo Bonzini <pbonzini@redhat.com>

Just use using the compiler binary, with -nostdlib in the case of the
linker; the compiler driver (whether i686-*-gcc, or x86_64-*-gcc with
the -m32 option) will then pick the right magic option to as and ld.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20220929114231.583801-13-alex.bennee@linaro.org>

diff --git a/configure b/configure
index 52ae4adffc..aaa09fb957 100755
--- a/configure
+++ b/configure
@@ -2298,23 +2298,11 @@ probe_target_compiler i386-softmmu
 if test -n "$target_cc" &&
         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.
-    for emu in elf_i386 elf_i386_fbsd elf_i386_obsd i386pe; do
-        if "$target_ld" -verbose 2>&1 | grep -q "^[[:space:]]*${emu}[[:space:]]*$"; then
-            ld_i386_emulation="$emu"
-            break
-        fi
-    done
-    if test -n "$ld_i386_emulation"; then
-        roms="pc-bios/optionrom"
-        config_mak=pc-bios/optionrom/config.mak
-        echo "# Automatically generated by configure - do not modify" > $config_mak
-        echo "TOPSRC_DIR=$source_path" >> $config_mak
-        echo "LD_I386_EMULATION=$ld_i386_emulation" >> $config_mak
-        write_target_makefile >> $config_mak
-    fi
+    roms="pc-bios/optionrom"
+    config_mak=pc-bios/optionrom/config.mak
+    echo "# Automatically generated by configure - do not modify" > $config_mak
+    echo "TOPSRC_DIR=$source_path" >> $config_mak
+    write_target_makefile >> $config_mak
 fi
 
 probe_target_compiler ppc-softmmu
diff --git a/pc-bios/optionrom/Makefile b/pc-bios/optionrom/Makefile
index e90ca2e1c6..3e06c11dea 100644
--- a/pc-bios/optionrom/Makefile
+++ b/pc-bios/optionrom/Makefile
@@ -20,28 +20,24 @@ override CFLAGS += $(call cc-option, -fcf-protection=none)
 # Flags for dependency generation
 override CPPFLAGS += -MMD -MP -MT $@ -MF $(@D)/$(*F).d
 
-override CFLAGS += $(filter -W%, $(QEMU_CFLAGS))
 override CFLAGS += $(call cc-option, -fno-pie)
+override CFLAGS += $(call cc-option, -no-pie)
 override CFLAGS += -ffreestanding -I$(TOPSRC_DIR)/include
 override CFLAGS += $(call cc-option, -fno-stack-protector)
 override CFLAGS += $(call cc-option, -Wno-array-bounds)
 
-Wa = -Wa,
-override ASFLAGS += -32
-override CFLAGS += $(call cc-option, $(Wa)-32)
-
-override LDFLAGS = -m $(LD_I386_EMULATION) -T $(SRC_DIR)/flat.lds
+override LDFLAGS = -nostdlib -Wl,-T,$(SRC_DIR)/flat.lds
 
 pvh.img: pvh.o pvh_main.o
 
 %.o: %.S
-	$(call quiet-command,$(CC) $(CPPFLAGS) -E -o - $< | $(AS) $(ASFLAGS) -o $@,"AS","$@")
+	$(call quiet-command,$(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<,"AS","$@")
 
 %.o: %.c
 	$(call quiet-command,$(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@,"CC","$@")
 
 %.img: %.o
-	$(call quiet-command,$(LD) $(LDFLAGS) -s -o $@ $^,"BUILD","$@")
+	$(call quiet-command,$(CC) $(CFLAGS) $(LDFLAGS) -s -o $@ $^,"BUILD","$@")
 
 %.raw: %.img
 	$(call quiet-command,$(OBJCOPY) -O binary -j .text $< $@,"BUILD","$@")
-- 
2.34.1



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

* [PULL 13/54] pc-bios/optionrom: detect CC options just once
  2022-10-04 13:00 [PULL 00/54] testing, gdbstub, plugin and gitdm updates Alex Bennée
                   ` (11 preceding siblings ...)
  2022-10-04 13:00 ` [PULL 12/54] configure: do not invoke as/ld directly for pc-bios/optionrom Alex Bennée
@ 2022-10-04 13:00 ` Alex Bennée
  2022-10-04 13:00 ` [PULL 14/54] pc-bios/s390-ccw: " Alex Bennée
                   ` (41 subsequent siblings)
  54 siblings, 0 replies; 64+ messages in thread
From: Alex Bennée @ 2022-10-04 13:00 UTC (permalink / raw)
  To: qemu-devel; +Cc: stefanha, Paolo Bonzini, Alex Bennée

From: Paolo Bonzini <pbonzini@redhat.com>

In preparation for adding Docker container support, detect compiler options
just once rather than once per Make run; container startup overhead is
substantial and doing the detection just once makes things faster.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20220929114231.583801-14-alex.bennee@linaro.org>

diff --git a/pc-bios/optionrom/Makefile b/pc-bios/optionrom/Makefile
index 3e06c11dea..f514e4f84b 100644
--- a/pc-bios/optionrom/Makefile
+++ b/pc-bios/optionrom/Makefile
@@ -8,23 +8,33 @@ all: multiboot.bin multiboot_dma.bin linuxboot.bin linuxboot_dma.bin kvmvapic.bi
 
 CFLAGS = -O2 -g
 
-quiet-command = $(if $(V),$1,$(if $(2),@printf "  %-7s %s\n" $2 $3 && $1, @$1))
-cc-option = $(if $(shell $(CC) $1 -c -o /dev/null -xc /dev/null >/dev/null 2>&1 && echo OK), $1, $2)
-
-override CFLAGS += -march=i486 -Wall $(EXTRA_CFLAGS) -m16
+NULL :=
+SPACE := $(NULL) #
+TARGET_PREFIX := $(patsubst %/,%:$(SPACE),$(TARGET_DIR))
 
-# If -fcf-protection is enabled in flags or compiler defaults that will
-# conflict with -march=i486
-override CFLAGS += $(call cc-option, -fcf-protection=none)
+quiet-@ = $(if $(V),,@)
+quiet-command = $(if $(V),$1,$(if $(2),@printf "  %-7s %s\n" $2 $3 && $1, @$1))
 
 # Flags for dependency generation
 override CPPFLAGS += -MMD -MP -MT $@ -MF $(@D)/$(*F).d
 
-override CFLAGS += $(call cc-option, -fno-pie)
-override CFLAGS += $(call cc-option, -no-pie)
+override CFLAGS += -march=i486 -Wall $(EXTRA_CFLAGS) -m16
 override CFLAGS += -ffreestanding -I$(TOPSRC_DIR)/include
-override CFLAGS += $(call cc-option, -fno-stack-protector)
-override CFLAGS += $(call cc-option, -Wno-array-bounds)
+
+cc-test = $(CC) -Werror $1 -c -o /dev/null -xc /dev/null >/dev/null 2>/dev/null
+cc-option = if $(call cc-test, $1); then \
+    echo "$(TARGET_PREFIX)$1 detected" && echo "override CFLAGS += $1" >&3; else \
+    echo "$(TARGET_PREFIX)$1 not detected" $(if $2,&& echo "override CFLAGS += $2" >&3); fi
+
+# If -fcf-protection is enabled in flags or compiler defaults that will
+# conflict with -march=i486
+config-cc.mak: Makefile
+	$(quiet-@)($(call cc-option,-fcf-protection=none); \
+	    $(call cc-option,-fno-pie); \
+	    $(call cc-option,-no-pie); \
+	    $(call cc-option,-fno-stack-protector); \
+	    $(call cc-option,-Wno-array-bounds)) 3> config-cc.mak
+-include config-cc.mak
 
 override LDFLAGS = -nostdlib -Wl,-T,$(SRC_DIR)/flat.lds
 
@@ -50,7 +60,10 @@ include $(wildcard *.d)
 clean:
 	rm -f *.o *.d *.raw *.img *.bin *~
 
+distclean:
+	rm -f config-cc.mak
+
 # suppress auto-removal of intermediate files
 .SECONDARY:
 
-.PHONY: all clean
+.PHONY: all clean distclean
-- 
2.34.1



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

* [PULL 14/54] pc-bios/s390-ccw: detect CC options just once
  2022-10-04 13:00 [PULL 00/54] testing, gdbstub, plugin and gitdm updates Alex Bennée
                   ` (12 preceding siblings ...)
  2022-10-04 13:00 ` [PULL 13/54] pc-bios/optionrom: detect CC options just once Alex Bennée
@ 2022-10-04 13:00 ` Alex Bennée
  2022-10-04 13:00 ` [PULL 15/54] vof: add distclean target Alex Bennée
                   ` (40 subsequent siblings)
  54 siblings, 0 replies; 64+ messages in thread
From: Alex Bennée @ 2022-10-04 13:00 UTC (permalink / raw)
  To: qemu-devel
  Cc: stefanha, Paolo Bonzini, Alex Bennée, Christian Borntraeger,
	Thomas Huth, Cornelia Huck, open list:S390-ccw boot

From: Paolo Bonzini <pbonzini@redhat.com>

In preparation for adding Docker container support, detect compiler options
just once rather than once per Make run; container startup overhead is
substantial and doing the detection just once makes things faster.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20220929114231.583801-15-alex.bennee@linaro.org>

diff --git a/pc-bios/s390-ccw/netboot.mak b/pc-bios/s390-ccw/netboot.mak
index 7639da194c..ee59a5f4de 100644
--- a/pc-bios/s390-ccw/netboot.mak
+++ b/pc-bios/s390-ccw/netboot.mak
@@ -16,12 +16,9 @@ s390-netboot.elf: $(NETOBJS) libnet.a libc.a
 s390-netboot.img: s390-netboot.elf
 	$(call quiet-command,$(STRIP) --strip-unneeded $< -o $@,"STRIP","$(TARGET_DIR)$@")
 
-# SLOF is GCC-only, so ignore warnings about GNU extensions with Clang here
-NO_GNU_WARN := $(call cc-option,-Werror $(QEMU_CFLAGS),-Wno-gnu)
-
 # libc files:
 
-LIBC_CFLAGS = $(EXTRA_CFLAGS) $(CFLAGS) $(NO_GNU_WARN) $(LIBC_INC) $(LIBNET_INC) \
+LIBC_CFLAGS = $(EXTRA_CFLAGS) $(CFLAGS) $(LIBC_INC) $(LIBNET_INC) \
 	      -MMD -MP -MT $@ -MF $(@:%.o=%.d)
 
 CTYPE_OBJS = isdigit.o isxdigit.o toupper.o
@@ -55,7 +52,7 @@ libc.a: $(LIBCOBJS)
 
 LIBNETOBJS := args.o dhcp.o dns.o icmpv6.o ipv6.o tcp.o udp.o bootp.o \
 	      dhcpv6.o ethernet.o ipv4.o ndp.o tftp.o pxelinux.o
-LIBNETCFLAGS = $(EXTRA_CFLAGS) $(CFLAGS) $(NO_GNU_WARN) $(LIBC_INC) $(LIBNET_INC) \
+LIBNETCFLAGS = $(EXTRA_CFLAGS) $(CFLAGS) $(LIBC_INC) $(LIBNET_INC) \
 	       -DDHCPARCH=0x1F -MMD -MP -MT $@ -MF $(@:%.o=%.d)
 
 %.o : $(SLOF_DIR)/lib/libnet/%.c
diff --git a/pc-bios/s390-ccw/Makefile b/pc-bios/s390-ccw/Makefile
index c8784c2a08..965e633f43 100644
--- a/pc-bios/s390-ccw/Makefile
+++ b/pc-bios/s390-ccw/Makefile
@@ -6,9 +6,12 @@ include config-host.mak
 CFLAGS = -O2 -g
 MAKEFLAGS += -rR
 
+NULL :=
+SPACE := $(NULL) #
+TARGET_PREFIX := $(patsubst %/,%:$(SPACE),$(TARGET_DIR))
+
+quiet-@ = $(if $(V),,@)
 quiet-command = $(if $(V),$1,$(if $(2),@printf "  %-7s %s\n" $2 $3 && $1, @$1))
-cc-option = $(if $(shell $(CC) $1 $2 -S -o /dev/null -xc /dev/null \
-			 >/dev/null 2>&1 && echo OK),$2,$3)
 
 VPATH_SUFFIXES = %.c %.h %.S %.m %.mak %.sh %.rc Kconfig% %.json.in
 set-vpath = $(if $1,$(foreach PATTERN,$(VPATH_SUFFIXES),$(eval vpath $(PATTERN) $1)))
@@ -25,22 +28,33 @@ QEMU_DGFLAGS = -MMD -MP -MT $@ -MF $(@D)/$(*F).d
 	$(call quiet-command,$(CCAS) $(EXTRA_CFLAGS) $(QEMU_DGFLAGS) $(CFLAGS) \
 	       -c -o $@ $<,"CCAS","$(TARGET_DIR)$@")
 
-.PHONY : all clean build-all
+.PHONY : all clean build-all distclean
 
 OBJECTS = start.o main.o bootmap.o jump2ipl.o sclp.o menu.o \
 	  virtio.o virtio-scsi.o virtio-blkdev.o libc.o cio.o dasd-ipl.o
 
-EXTRA_CFLAGS := $(EXTRA_CFLAGS) -Wall
-EXTRA_CFLAGS += $(call cc-option,-Werror $(EXTRA_CFLAGS),-Wno-stringop-overflow)
+EXTRA_CFLAGS += -Wall
 EXTRA_CFLAGS += -ffreestanding -fno-delete-null-pointer-checks -fno-common -fPIE
 EXTRA_CFLAGS += -fwrapv -fno-strict-aliasing -fno-asynchronous-unwind-tables
-EXTRA_CFLAGS += $(call cc-option, $(EXTRA_CFLAGS), -fno-stack-protector)
-EXTRA_CFLAGS += $(call cc-option, $(EXTRA_CFLAGS), -Wno-array-bounds)
 EXTRA_CFLAGS += -msoft-float
-EXTRA_CFLAGS += $(call cc-option, $(EXTRA_CFLAGS),-march=z900,-march=z10)
 EXTRA_CFLAGS += -std=gnu99
 LDFLAGS += -Wl,-pie -nostdlib
 
+cc-test = $(CC) -Werror $1 -c -o /dev/null -xc /dev/null >/dev/null 2>/dev/null
+cc-option = if $(call cc-test, $1); then \
+    echo "$(TARGET_PREFIX)$1 detected" && echo "EXTRA_CFLAGS += $1" >&3; else \
+    echo "$(TARGET_PREFIX)$1 not detected" $(if $2,&& echo "EXTRA_CFLAGS += $2" >&3); fi
+
+config-cc.mak: Makefile
+	$(quiet-@)($(call cc-option,-Wno-stringop-overflow); \
+	    $(call cc-option,-fno-stack-protector); \
+	    $(call cc-option,-Wno-array-bounds); \
+	    $(call cc-option,-Wno-gnu); \
+	    $(call cc-option,-march=z900,-march=z10)) 3> config-cc.mak
+-include config-cc.mak
+
+LDFLAGS += -Wl,-pie -nostdlib
+
 build-all: s390-ccw.img s390-netboot.img
 
 s390-ccw.elf: $(OBJECTS)
@@ -63,3 +77,6 @@ ALL_OBJS = $(sort $(OBJECTS) $(NETOBJS) $(LIBCOBJS) $(LIBNETOBJS))
 
 clean:
 	rm -f *.o *.d *.img *.elf *~ *.a
+
+distclean:
+	rm -f config-cc.mak
-- 
2.34.1



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

* [PULL 15/54] vof: add distclean target
  2022-10-04 13:00 [PULL 00/54] testing, gdbstub, plugin and gitdm updates Alex Bennée
                   ` (13 preceding siblings ...)
  2022-10-04 13:00 ` [PULL 14/54] pc-bios/s390-ccw: " Alex Bennée
@ 2022-10-04 13:00 ` Alex Bennée
  2022-10-04 13:01 ` [PULL 16/54] build: add recursive distclean rules Alex Bennée
                   ` (39 subsequent siblings)
  54 siblings, 0 replies; 64+ messages in thread
From: Alex Bennée @ 2022-10-04 13:00 UTC (permalink / raw)
  To: qemu-devel
  Cc: stefanha, Paolo Bonzini, Alex Bennée, Alexey Kardashevskiy,
	Cédric Le Goater, Daniel Henrique Barboza, David Gibson,
	Greg Kurz, open list:Virtual Open Firm...

From: Paolo Bonzini <pbonzini@redhat.com>

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
[AJB: add clean dep to distclean]
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20220929114231.583801-16-alex.bennee@linaro.org>

diff --git a/pc-bios/vof/Makefile b/pc-bios/vof/Makefile
index 8809c82768..4e59009e67 100644
--- a/pc-bios/vof/Makefile
+++ b/pc-bios/vof/Makefile
@@ -19,4 +19,6 @@ vof.elf: entry.o main.o ci.o bootmem.o libc.o
 clean:
 	rm -f *.o vof.bin vof.elf *~
 
-.PHONY: all clean
+distclean: clean
+
+.PHONY: all clean distclean
-- 
2.34.1



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

* [PULL 16/54] build: add recursive distclean rules
  2022-10-04 13:00 [PULL 00/54] testing, gdbstub, plugin and gitdm updates Alex Bennée
                   ` (14 preceding siblings ...)
  2022-10-04 13:00 ` [PULL 15/54] vof: add distclean target Alex Bennée
@ 2022-10-04 13:01 ` Alex Bennée
  2022-10-04 13:01 ` [PULL 17/54] configure: return status code from probe_target_compiler Alex Bennée
                   ` (38 subsequent siblings)
  54 siblings, 0 replies; 64+ messages in thread
From: Alex Bennée @ 2022-10-04 13:01 UTC (permalink / raw)
  To: qemu-devel; +Cc: stefanha, Paolo Bonzini, Alex Bennée

From: Paolo Bonzini <pbonzini@redhat.com>

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20220929114231.583801-17-alex.bennee@linaro.org>

diff --git a/Makefile b/Makefile
index b576cba5a8..0fcde48bec 100644
--- a/Makefile
+++ b/Makefile
@@ -186,7 +186,7 @@ include $(SRC_PATH)/tests/Makefile.include
 
 all: recurse-all
 
-ROMS_RULES=$(foreach t, all clean, $(addsuffix /$(t), $(ROMS)))
+ROMS_RULES=$(foreach t, all clean distclean, $(addsuffix /$(t), $(ROMS)))
 .PHONY: $(ROMS_RULES)
 $(ROMS_RULES):
 	$(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $(dir $@) V="$(V)" TARGET_DIR="$(dir $@)" $(notdir $@),)
@@ -194,6 +194,7 @@ $(ROMS_RULES):
 .PHONY: recurse-all recurse-clean
 recurse-all: $(addsuffix /all, $(ROMS))
 recurse-clean: $(addsuffix /clean, $(ROMS))
+recurse-distclean: $(addsuffix /distclean, $(ROMS))
 
 ######################################################################
 
@@ -214,7 +215,7 @@ dist: qemu-$(VERSION).tar.bz2
 qemu-%.tar.bz2:
 	$(SRC_PATH)/scripts/make-release "$(SRC_PATH)" "$(patsubst qemu-%.tar.bz2,%,$@)"
 
-distclean: clean
+distclean: clean recurse-distclean
 	-$(quiet-@)test -f build.ninja && $(NINJA) $(NINJAFLAGS) -t clean -g || :
 	rm -f config-host.mak qemu-bundle
 	rm -f tests/tcg/config-*.mak
-- 
2.34.1



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

* [PULL 17/54] configure: return status code from probe_target_compiler
  2022-10-04 13:00 [PULL 00/54] testing, gdbstub, plugin and gitdm updates Alex Bennée
                   ` (15 preceding siblings ...)
  2022-10-04 13:01 ` [PULL 16/54] build: add recursive distclean rules Alex Bennée
@ 2022-10-04 13:01 ` Alex Bennée
  2022-10-04 13:01 ` [PULL 18/54] configure: store container engine in config-host.mak Alex Bennée
                   ` (37 subsequent siblings)
  54 siblings, 0 replies; 64+ messages in thread
From: Alex Bennée @ 2022-10-04 13:01 UTC (permalink / raw)
  To: qemu-devel; +Cc: stefanha, Paolo Bonzini, Alex Bennée

From: Paolo Bonzini <pbonzini@redhat.com>

For now, return 1 for container-based compilers.  This will change as
soon as ROMs will be buildable with them.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20220929114231.583801-18-alex.bennee@linaro.org>

diff --git a/configure b/configure
index aaa09fb957..f3984bb193 100755
--- a/configure
+++ b/configure
@@ -2147,6 +2147,7 @@ probe_target_compiler() {
     target_ranlib=
     target_strip=
   fi
+  test -n "$target_cc"
 }
 
 write_target_makefile() {
@@ -2294,10 +2295,9 @@ done
 
 # Mac OS X ships with a broken assembler
 roms=
-probe_target_compiler i386-softmmu
-if test -n "$target_cc" &&
-        test "$targetos" != "darwin" && test "$targetos" != "sunos" && \
-        test "$targetos" != "haiku" && test "$softmmu" = yes ; then
+if test "$targetos" != "darwin" && test "$targetos" != "sunos" && \
+        test "$targetos" != "haiku" && test "$softmmu" = yes && \
+        probe_target_compiler i386-softmmu; then
     roms="pc-bios/optionrom"
     config_mak=pc-bios/optionrom/config.mak
     echo "# Automatically generated by configure - do not modify" > $config_mak
@@ -2305,8 +2305,7 @@ if test -n "$target_cc" &&
     write_target_makefile >> $config_mak
 fi
 
-probe_target_compiler ppc-softmmu
-if test -n "$target_cc" && test "$softmmu" = yes; then
+if test "$softmmu" = yes && probe_target_compiler ppc-softmmu; then
     roms="$roms pc-bios/vof"
     config_mak=pc-bios/vof/config.mak
     echo "# Automatically generated by configure - do not modify" > $config_mak
@@ -2316,8 +2315,7 @@ fi
 
 # Only build s390-ccw bios if the compiler has -march=z900 or -march=z10
 # (which is the lowest architecture level that Clang supports)
-probe_target_compiler s390x-softmmu
-if test -n "$target_cc" && test "$softmmu" = yes; then
+if test "$softmmu" = yes && probe_target_compiler s390x-softmmu; then
   write_c_skeleton
   do_compiler "$target_cc" $target_cc_cflags -march=z900 -o $TMPO -c $TMPC
   has_z900=$?
-- 
2.34.1



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

* [PULL 18/54] configure: store container engine in config-host.mak
  2022-10-04 13:00 [PULL 00/54] testing, gdbstub, plugin and gitdm updates Alex Bennée
                   ` (16 preceding siblings ...)
  2022-10-04 13:01 ` [PULL 17/54] configure: return status code from probe_target_compiler Alex Bennée
@ 2022-10-04 13:01 ` Alex Bennée
  2022-10-04 13:01 ` [PULL 19/54] tests: simplify Makefile invocation for tests/tcg Alex Bennée
                   ` (36 subsequent siblings)
  54 siblings, 0 replies; 64+ messages in thread
From: Alex Bennée @ 2022-10-04 13:01 UTC (permalink / raw)
  To: qemu-devel
  Cc: stefanha, Paolo Bonzini, Alex Bennée,
	Philippe Mathieu-Daudé,
	Thomas Huth, Wainer dos Santos Moschetta, Beraldo Leal

From: Paolo Bonzini <pbonzini@redhat.com>

In preparation for removing $(DOCKER_SCRIPT) from the tests/tcg configuration
files, have Make use the same container engine that had been probed at
configure time.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20220929114231.583801-19-alex.bennee@linaro.org>

diff --git a/configure b/configure
index f3984bb193..ad70c81bfe 100755
--- a/configure
+++ b/configure
@@ -1810,9 +1810,11 @@ fi
 
 container="no"
 if test $use_containers = "yes"; then
-    if has "docker" || has "podman"; then
-        container=$($python "$source_path"/tests/docker/docker.py probe)
-    fi
+    case $($python "$source_path"/tests/docker/docker.py probe) in
+        *docker) container=docker ;;
+        podman) container=podman ;;
+        no) container=no ;;
+    esac
 fi
 
 # cross compilers defaults, can be overridden with --cross-cc-ARCH
@@ -2444,6 +2446,9 @@ if test -n "$gdb_bin"; then
     fi
 fi
 
+if test "$container" != no; then
+    echo "ENGINE=$container" >> $config_host_mak
+fi
 echo "ROMS=$roms" >> $config_host_mak
 echo "MAKE=$make" >> $config_host_mak
 echo "PYTHON=$python" >> $config_host_mak
diff --git a/tests/docker/Makefile.include b/tests/docker/Makefile.include
index 270e99786e..c87f14477a 100644
--- a/tests/docker/Makefile.include
+++ b/tests/docker/Makefile.include
@@ -14,7 +14,7 @@ DOCKER_DEFAULT_REGISTRY := registry.gitlab.com/qemu-project/qemu
 endif
 DOCKER_REGISTRY := $(if $(REGISTRY),$(REGISTRY),$(DOCKER_DEFAULT_REGISTRY))
 
-ENGINE := auto
+ENGINE ?= auto
 DOCKER_SCRIPT=$(SRC_PATH)/tests/docker/docker.py --engine $(ENGINE)
 
 CUR_TIME := $(shell date +%Y-%m-%d-%H.%M.%S.$$$$)
-- 
2.34.1



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

* [PULL 19/54] tests: simplify Makefile invocation for tests/tcg
  2022-10-04 13:00 [PULL 00/54] testing, gdbstub, plugin and gitdm updates Alex Bennée
                   ` (17 preceding siblings ...)
  2022-10-04 13:01 ` [PULL 18/54] configure: store container engine in config-host.mak Alex Bennée
@ 2022-10-04 13:01 ` Alex Bennée
  2022-10-04 13:01 ` [PULL 20/54] tests/tcg: remove -f from Makefile invocation Alex Bennée
                   ` (35 subsequent siblings)
  54 siblings, 0 replies; 64+ messages in thread
From: Alex Bennée @ 2022-10-04 13:01 UTC (permalink / raw)
  To: qemu-devel
  Cc: stefanha, Paolo Bonzini, Alex Bennée, Philippe Mathieu-Daudé

From: Paolo Bonzini <pbonzini@redhat.com>

Remove the DOCKER_SCRIPT and TARGET variable from the Makefile invocation
for tests/tcg.  For DOCKER_SCRIPT, resolve the path to docker.py in configure;
for TARGET, move it to config-$(TARGET).mak and use a symbolic link to break
the cycle.

The symbolic link is still needed because tests/tcg includes dummy config files
for targets that are not buildable.  Once that is cleaned up, the symbolic link
will go away too.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20220929114231.583801-20-alex.bennee@linaro.org>

diff --git a/configure b/configure
index ad70c81bfe..784b77ae90 100755
--- a/configure
+++ b/configure
@@ -1815,6 +1815,9 @@ if test $use_containers = "yes"; then
         podman) container=podman ;;
         no) container=no ;;
     esac
+    if test "$container" != "no"; then
+        docker_py="$python $source_path/tests/docker/docker.py --engine $container"
+    fi
 fi
 
 # cross compilers defaults, can be overridden with --cross-cc-ARCH
@@ -2184,16 +2187,16 @@ write_target_makefile() {
 write_container_target_makefile() {
   echo "EXTRA_CFLAGS=$target_cflags"
   if test -n "$container_cross_cc"; then
-    echo "CC=\$(DOCKER_SCRIPT) cc --cc $container_cross_cc -i qemu/$container_image -s $source_path --"
-    echo "CCAS=\$(DOCKER_SCRIPT) cc --cc $container_cross_cc -i qemu/$container_image -s $source_path --"
+    echo "CC=$docker_py cc --cc $container_cross_cc -i qemu/$container_image -s $source_path --"
+    echo "CCAS=$docker_py cc --cc $container_cross_cc -i qemu/$container_image -s $source_path --"
   fi
-  echo "AR=\$(DOCKER_SCRIPT) cc --cc $container_cross_ar -i qemu/$container_image -s $source_path --"
-  echo "AS=\$(DOCKER_SCRIPT) cc --cc $container_cross_as -i qemu/$container_image -s $source_path --"
-  echo "LD=\$(DOCKER_SCRIPT) cc --cc $container_cross_ld -i qemu/$container_image -s $source_path --"
-  echo "NM=\$(DOCKER_SCRIPT) cc --cc $container_cross_nm -i qemu/$container_image -s $source_path --"
-  echo "OBJCOPY=\$(DOCKER_SCRIPT) cc --cc $container_cross_objcopy -i qemu/$container_image -s $source_path --"
-  echo "RANLIB=\$(DOCKER_SCRIPT) cc --cc $container_cross_ranlib -i qemu/$container_image -s $source_path --"
-  echo "STRIP=\$(DOCKER_SCRIPT) cc --cc $container_cross_strip -i qemu/$container_image -s $source_path --"
+  echo "AR=$docker_py cc --cc $container_cross_ar -i qemu/$container_image -s $source_path --"
+  echo "AS=$docker_py cc --cc $container_cross_as -i qemu/$container_image -s $source_path --"
+  echo "LD=$docker_py cc --cc $container_cross_ld -i qemu/$container_image -s $source_path --"
+  echo "NM=$docker_py cc --cc $container_cross_nm -i qemu/$container_image -s $source_path --"
+  echo "OBJCOPY=$docker_py cc --cc $container_cross_objcopy -i qemu/$container_image -s $source_path --"
+  echo "RANLIB=$docker_py cc --cc $container_cross_ranlib -i qemu/$container_image -s $source_path --"
+  echo "STRIP=$docker_py cc --cc $container_cross_strip -i qemu/$container_image -s $source_path --"
 }
 
 
@@ -2630,6 +2633,8 @@ for target in $target_list; do
   fi
   if test $got_cross_cc = yes; then
       mkdir -p tests/tcg/$target
+      ln -sf ../config-$target.mak tests/tcg/$target/config-target.mak
+      echo "TARGET=$target" >> "$config_target_mak"
       echo "QEMU=$PWD/$qemu" >> "$config_target_mak"
       echo "run-tcg-tests-$target: $qemu\$(EXESUF)" >> $makefile
       tcg_tests_targets="$tcg_tests_targets $target"
diff --git a/tests/Makefile.include b/tests/Makefile.include
index 3accb83b13..826b1895f4 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -50,23 +50,20 @@ $(foreach TARGET,$(TCG_TESTS_TARGETS), \
 .PHONY: $(TCG_TESTS_TARGETS:%=build-tcg-tests-%)
 $(TCG_TESTS_TARGETS:%=build-tcg-tests-%): build-tcg-tests-%: $(BUILD_DIR)/tests/tcg/config-%.mak
 	$(call quiet-command, \
-            $(MAKE) -C tests/tcg/$* -f ../Makefile.target $(SUBDIR_MAKEFLAGS) \
-                        DOCKER_SCRIPT="$(DOCKER_SCRIPT)" \
-                        TARGET="$*" SRC_PATH="$(SRC_PATH)", \
+            $(MAKE) -C tests/tcg/$* -f ../Makefile.target $(SUBDIR_MAKEFLAGS), \
         "BUILD","$* guest-tests")
 
 .PHONY: $(TCG_TESTS_TARGETS:%=run-tcg-tests-%)
 $(TCG_TESTS_TARGETS:%=run-tcg-tests-%): run-tcg-tests-%: build-tcg-tests-%
 	$(call quiet-command, \
            $(MAKE) -C tests/tcg/$* -f ../Makefile.target $(SUBDIR_MAKEFLAGS) \
-                        TARGET="$*" SRC_PATH="$(SRC_PATH)" SPEED=$(SPEED) run, \
+                        SPEED=$(SPEED) run, \
         "RUN", "$* guest-tests")
 
 .PHONY: $(TCG_TESTS_TARGETS:%=clean-tcg-tests-%)
 $(TCG_TESTS_TARGETS:%=clean-tcg-tests-%): clean-tcg-tests-%:
 	$(call quiet-command, \
-           $(MAKE) -C tests/tcg/$* -f ../Makefile.target $(SUBDIR_MAKEFLAGS) \
-                        TARGET="$*" SRC_PATH="$(SRC_PATH)" clean, \
+           $(MAKE) -C tests/tcg/$* -f ../Makefile.target $(SUBDIR_MAKEFLAGS) clean, \
         "CLEAN", "$* guest-tests")
 
 .PHONY: build-tcg
diff --git a/tests/tcg/Makefile.target b/tests/tcg/Makefile.target
index c896d1033e..b9c3d247e9 100644
--- a/tests/tcg/Makefile.target
+++ b/tests/tcg/Makefile.target
@@ -31,7 +31,7 @@
 
 all:
 -include ../config-host.mak
--include ../config-$(TARGET).mak
+-include config-target.mak
 
 # Get semihosting definitions for user-mode emulation
 ifeq ($(filter %-softmmu, $(TARGET)),)
-- 
2.34.1



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

* [PULL 20/54] tests/tcg: remove -f from Makefile invocation
  2022-10-04 13:00 [PULL 00/54] testing, gdbstub, plugin and gitdm updates Alex Bennée
                   ` (18 preceding siblings ...)
  2022-10-04 13:01 ` [PULL 19/54] tests: simplify Makefile invocation for tests/tcg Alex Bennée
@ 2022-10-04 13:01 ` Alex Bennée
  2022-10-04 13:01 ` [PULL 21/54] tests/tcg: add distclean rule Alex Bennée
                   ` (34 subsequent siblings)
  54 siblings, 0 replies; 64+ messages in thread
From: Alex Bennée @ 2022-10-04 13:01 UTC (permalink / raw)
  To: qemu-devel; +Cc: stefanha, Paolo Bonzini, Alex Bennée

From: Paolo Bonzini <pbonzini@redhat.com>

Instead of linking tests/tcg/Makefile.target into the build tree, name
the symbolic link "Makefile" and create it in every target subdirectory.
This makes it possible to just invoke "make" in tests/tcg subdirectories.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20220929114231.583801-21-alex.bennee@linaro.org>

diff --git a/configure b/configure
index 784b77ae90..a48a731bf4 100755
--- a/configure
+++ b/configure
@@ -2282,7 +2282,6 @@ fi
 # tests might fail. Prefer to keep the relevant files in their own
 # directory and symlink the directory instead.
 LINKS="Makefile"
-LINKS="$LINKS tests/tcg/Makefile.target"
 LINKS="$LINKS pc-bios/optionrom/Makefile"
 LINKS="$LINKS pc-bios/s390-ccw/Makefile"
 LINKS="$LINKS pc-bios/vof/Makefile"
@@ -2529,6 +2528,7 @@ fi
 echo "# Automatically generated by configure - do not modify" > $makefile
 
 config_host_mak=tests/tcg/config-host.mak
+mkdir -p tests/tcg
 echo "# Automatically generated by configure - do not modify" > $config_host_mak
 echo "SRC_PATH=$source_path" >> $config_host_mak
 echo "HOST_CC=$host_cc" >> $config_host_mak
@@ -2632,8 +2632,9 @@ for target in $target_list; do
       got_cross_cc=yes
   fi
   if test $got_cross_cc = yes; then
-      mkdir -p tests/tcg/$target
-      ln -sf ../config-$target.mak tests/tcg/$target/config-target.mak
+      mkdir -p "tests/tcg/$target"
+      ln -sf "$source_path/tests/tcg/Makefile.target" "tests/tcg/$target/Makefile"
+      ln -sf "../config-$target.mak" "tests/tcg/$target/config-target.mak"
       echo "TARGET=$target" >> "$config_target_mak"
       echo "QEMU=$PWD/$qemu" >> "$config_target_mak"
       echo "run-tcg-tests-$target: $qemu\$(EXESUF)" >> $makefile
diff --git a/tests/Makefile.include b/tests/Makefile.include
index 826b1895f4..caef287957 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -50,20 +50,19 @@ $(foreach TARGET,$(TCG_TESTS_TARGETS), \
 .PHONY: $(TCG_TESTS_TARGETS:%=build-tcg-tests-%)
 $(TCG_TESTS_TARGETS:%=build-tcg-tests-%): build-tcg-tests-%: $(BUILD_DIR)/tests/tcg/config-%.mak
 	$(call quiet-command, \
-            $(MAKE) -C tests/tcg/$* -f ../Makefile.target $(SUBDIR_MAKEFLAGS), \
+            $(MAKE) -C tests/tcg/$* $(SUBDIR_MAKEFLAGS), \
         "BUILD","$* guest-tests")
 
 .PHONY: $(TCG_TESTS_TARGETS:%=run-tcg-tests-%)
 $(TCG_TESTS_TARGETS:%=run-tcg-tests-%): run-tcg-tests-%: build-tcg-tests-%
 	$(call quiet-command, \
-           $(MAKE) -C tests/tcg/$* -f ../Makefile.target $(SUBDIR_MAKEFLAGS) \
-                        SPEED=$(SPEED) run, \
+           $(MAKE) -C tests/tcg/$* $(SUBDIR_MAKEFLAGS) SPEED=$(SPEED) run, \
         "RUN", "$* guest-tests")
 
 .PHONY: $(TCG_TESTS_TARGETS:%=clean-tcg-tests-%)
 $(TCG_TESTS_TARGETS:%=clean-tcg-tests-%): clean-tcg-tests-%:
 	$(call quiet-command, \
-           $(MAKE) -C tests/tcg/$* -f ../Makefile.target $(SUBDIR_MAKEFLAGS) clean, \
+           $(MAKE) -C tests/tcg/$* $(SUBDIR_MAKEFLAGS) clean, \
         "CLEAN", "$* guest-tests")
 
 .PHONY: build-tcg
-- 
2.34.1



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

* [PULL 21/54] tests/tcg: add distclean rule
  2022-10-04 13:00 [PULL 00/54] testing, gdbstub, plugin and gitdm updates Alex Bennée
                   ` (19 preceding siblings ...)
  2022-10-04 13:01 ` [PULL 20/54] tests/tcg: remove -f from Makefile invocation Alex Bennée
@ 2022-10-04 13:01 ` Alex Bennée
  2022-10-04 13:01 ` [PULL 22/54] tests/tcg: unify ppc64 and ppc64le Makefiles Alex Bennée
                   ` (33 subsequent siblings)
  54 siblings, 0 replies; 64+ messages in thread
From: Alex Bennée @ 2022-10-04 13:01 UTC (permalink / raw)
  To: qemu-devel
  Cc: stefanha, Paolo Bonzini, Alex Bennée, Philippe Mathieu-Daudé

From: Paolo Bonzini <pbonzini@redhat.com>

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20220929114231.583801-22-alex.bennee@linaro.org>

diff --git a/tests/Makefile.include b/tests/Makefile.include
index caef287957..9ed67721e2 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -42,6 +42,7 @@ tests/tcg/Makefile.prereqs: config-host.mak
 # Per guest TCG tests
 BUILD_TCG_TARGET_RULES=$(patsubst %,build-tcg-tests-%, $(TCG_TESTS_TARGETS))
 CLEAN_TCG_TARGET_RULES=$(patsubst %,clean-tcg-tests-%, $(TCG_TESTS_TARGETS))
+DISTCLEAN_TCG_TARGET_RULES=$(patsubst %,distclean-tcg-tests-%, $(TCG_TESTS_TARGETS))
 RUN_TCG_TARGET_RULES=$(patsubst %,run-tcg-tests-%, $(TCG_TESTS_TARGETS))
 
 $(foreach TARGET,$(TCG_TESTS_TARGETS), \
@@ -65,6 +66,12 @@ $(TCG_TESTS_TARGETS:%=clean-tcg-tests-%): clean-tcg-tests-%:
            $(MAKE) -C tests/tcg/$* $(SUBDIR_MAKEFLAGS) clean, \
         "CLEAN", "$* guest-tests")
 
+.PHONY: $(TCG_TESTS_TARGETS:%=distclean-tcg-tests-%)
+$(TCG_TESTS_TARGETS:%=distclean-tcg-tests-%): distclean-tcg-tests-%:
+	$(call quiet-command, \
+           $(MAKE) -C tests/tcg/$* $(SUBDIR_MAKEFLAGS) distclean, \
+        "CLEAN", "$* guest-tests")
+
 .PHONY: build-tcg
 build-tcg: $(BUILD_TCG_TARGET_RULES)
 
@@ -75,6 +82,9 @@ check-tcg: $(RUN_TCG_TARGET_RULES)
 .PHONY: clean-tcg
 clean-tcg: $(CLEAN_TCG_TARGET_RULES)
 
+.PHONY: distclean-tcg
+distclean-tcg: $(DISTCLEAN_TCG_TARGET_RULES)
+
 # Python venv for running tests
 
 .PHONY: check-venv check-avocado check-acceptance check-acceptance-deprecated-warning
@@ -159,5 +169,6 @@ check-clean:
 	rm -rf $(TESTS_VENV_DIR) $(TESTS_RESULTS_DIR)
 
 clean: check-clean clean-tcg
+distclean: distclean-tcg
 
 endif
diff --git a/tests/tcg/Makefile.target b/tests/tcg/Makefile.target
index b9c3d247e9..c14eca82c2 100644
--- a/tests/tcg/Makefile.target
+++ b/tests/tcg/Makefile.target
@@ -189,3 +189,6 @@ run: $(RUN_TESTS)
 
 clean:
 	rm -f $(TESTS) *.o $(CLEANFILES)
+
+distclean:
+	rm -f config-target.mak ../config-$(TARGET).mak
-- 
2.34.1



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

* [PULL 22/54] tests/tcg: unify ppc64 and ppc64le Makefiles
  2022-10-04 13:00 [PULL 00/54] testing, gdbstub, plugin and gitdm updates Alex Bennée
                   ` (20 preceding siblings ...)
  2022-10-04 13:01 ` [PULL 21/54] tests/tcg: add distclean rule Alex Bennée
@ 2022-10-04 13:01 ` Alex Bennée
  2022-10-04 13:01 ` [PULL 23/54] tests/tcg: clean up calls to run-test Alex Bennée
                   ` (32 subsequent siblings)
  54 siblings, 0 replies; 64+ messages in thread
From: Alex Bennée @ 2022-10-04 13:01 UTC (permalink / raw)
  To: qemu-devel; +Cc: stefanha, Paolo Bonzini, Alex Bennée

From: Paolo Bonzini <pbonzini@redhat.com>

Make tests/tcg/ppc64le include tests/tcg/ppc64 instead of duplicating
the rules.  Because the ppc64le vpath includes tests/tcg/ppc64 but
not vice versa, the tests have to be moved from tests/tcg/ppc64le/
to tests/tcg/ppc64.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20220929114231.583801-23-alex.bennee@linaro.org>

diff --git a/tests/tcg/ppc64le/bcdsub.c b/tests/tcg/ppc64/bcdsub.c
similarity index 100%
rename from tests/tcg/ppc64le/bcdsub.c
rename to tests/tcg/ppc64/bcdsub.c
diff --git a/tests/tcg/ppc64le/byte_reverse.c b/tests/tcg/ppc64/byte_reverse.c
similarity index 100%
rename from tests/tcg/ppc64le/byte_reverse.c
rename to tests/tcg/ppc64/byte_reverse.c
diff --git a/tests/tcg/ppc64le/mffsce.c b/tests/tcg/ppc64/mffsce.c
similarity index 100%
rename from tests/tcg/ppc64le/mffsce.c
rename to tests/tcg/ppc64/mffsce.c
diff --git a/tests/tcg/ppc64le/mtfsf.c b/tests/tcg/ppc64/mtfsf.c
similarity index 100%
rename from tests/tcg/ppc64le/mtfsf.c
rename to tests/tcg/ppc64/mtfsf.c
diff --git a/tests/tcg/ppc64le/non_signalling_xscv.c b/tests/tcg/ppc64/non_signalling_xscv.c
similarity index 100%
rename from tests/tcg/ppc64le/non_signalling_xscv.c
rename to tests/tcg/ppc64/non_signalling_xscv.c
diff --git a/tests/tcg/ppc64le/signal_save_restore_xer.c b/tests/tcg/ppc64/signal_save_restore_xer.c
similarity index 100%
rename from tests/tcg/ppc64le/signal_save_restore_xer.c
rename to tests/tcg/ppc64/signal_save_restore_xer.c
diff --git a/tests/tcg/ppc64le/xxspltw.c b/tests/tcg/ppc64/xxspltw.c
similarity index 100%
rename from tests/tcg/ppc64le/xxspltw.c
rename to tests/tcg/ppc64/xxspltw.c
diff --git a/tests/tcg/ppc64/Makefile.target b/tests/tcg/ppc64/Makefile.target
index 331fae628e..7db7a3e2b3 100644
--- a/tests/tcg/ppc64/Makefile.target
+++ b/tests/tcg/ppc64/Makefile.target
@@ -3,7 +3,6 @@
 # ppc64 specific tweaks
 
 VPATH += $(SRC_PATH)/tests/tcg/ppc64
-VPATH += $(SRC_PATH)/tests/tcg/ppc64le
 
 ifneq ($(CROSS_CC_HAS_POWER8_VECTOR),)
 PPC64_TESTS=bcdsub non_signalling_xscv
diff --git a/tests/tcg/ppc64le/Makefile.target b/tests/tcg/ppc64le/Makefile.target
index 6ca3003f02..daad5118a5 100644
--- a/tests/tcg/ppc64le/Makefile.target
+++ b/tests/tcg/ppc64le/Makefile.target
@@ -4,28 +4,4 @@
 
 VPATH += $(SRC_PATH)/tests/tcg/ppc64le
 
-ifneq ($(CROSS_CC_HAS_POWER8_VECTOR),)
-PPC64LE_TESTS=bcdsub non_signalling_xscv
-endif
-$(PPC64LE_TESTS): CFLAGS += -mpower8-vector
-
-ifneq ($(CROSS_CC_HAS_POWER10),)
-PPC64LE_TESTS += byte_reverse sha512-vector
-endif
-byte_reverse: CFLAGS += -mcpu=power10
-run-byte_reverse: QEMU_OPTS+=-cpu POWER10
-run-plugin-byte_reverse-with-%: QEMU_OPTS+=-cpu POWER10
-
-sha512-vector: CFLAGS +=-mcpu=power10 -O3
-sha512-vector: sha512.c
-	$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $< -o $@ $(LDFLAGS)
-
-run-sha512-vector: QEMU_OPTS+=-cpu POWER10
-run-plugin-sha512-vector-with-%: QEMU_OPTS+=-cpu POWER10
-
-PPC64LE_TESTS += mtfsf
-PPC64LE_TESTS += mffsce
-PPC64LE_TESTS += signal_save_restore_xer
-PPC64LE_TESTS += xxspltw
-
-TESTS += $(PPC64LE_TESTS)
+include $(SRC_PATH)/tests/tcg/ppc64/Makefile.target
-- 
2.34.1



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

* [PULL 23/54] tests/tcg: clean up calls to run-test
  2022-10-04 13:00 [PULL 00/54] testing, gdbstub, plugin and gitdm updates Alex Bennée
                   ` (21 preceding siblings ...)
  2022-10-04 13:01 ` [PULL 22/54] tests/tcg: unify ppc64 and ppc64le Makefiles Alex Bennée
@ 2022-10-04 13:01 ` Alex Bennée
  2022-10-04 13:01 ` [PULL 24/54] tests/tcg: move compiler tests to Makefiles Alex Bennée
                   ` (31 subsequent siblings)
  54 siblings, 0 replies; 64+ messages in thread
From: Alex Bennée @ 2022-10-04 13:01 UTC (permalink / raw)
  To: qemu-devel
  Cc: stefanha, Paolo Bonzini, Alex Bennée,
	Philippe Mathieu-Daudé,
	Peter Maydell, Edgar E. Iglesias, Richard Henderson,
	Eduardo Habkost, David Hildenbrand, open list:ARM TCG CPUs,
	open list:S390 TCG CPUs

From: Paolo Bonzini <pbonzini@redhat.com>

Almost all invocations of run-test have either "$* on $(TARGET_NAME)"
or "$< on $(TARGET_NAME)" as the last argument.  So provide a default
test name, while allowing an escape hatch for custom names.

As an additional simplification, remove the need to do shell quoting.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20220929114231.583801-24-alex.bennee@linaro.org>

diff --git a/tests/tcg/Makefile.target b/tests/tcg/Makefile.target
index c14eca82c2..cd0a2ad873 100644
--- a/tests/tcg/Makefile.target
+++ b/tests/tcg/Makefile.target
@@ -41,14 +41,16 @@ endif
 # for including , in command strings
 COMMA := ,
 
-quiet-command = $(if $(V),$1,$(if $(2),@printf "  %-7s %s\n" $2 $3 && $1, @$1))
+quiet-@ = $(if $(V),,@$(if $1,printf "  %-7s %s\n" "$(strip $1)" "$(strip $2)" && ))
+quiet-command = $(call quiet-@,$2,$3)$1
 
 # $1 = test name, $2 = cmd, $3 = desc
 ifeq ($(filter %-softmmu, $(TARGET)),)
 run-test = $(call quiet-command, timeout --foreground $(TIMEOUT) $2 > $1.out, \
-	"TEST",$3)
+	TEST,$(or $3, $*, $<) on $(TARGET_NAME))
 else
-run-test = $(call quiet-command, timeout --foreground $(TIMEOUT) $2,"TEST",$3)
+run-test = $(call quiet-command, timeout --foreground $(TIMEOUT) $2, \
+        TEST,$(or $3, $*, $<) on $(TARGET_NAME))
 endif
 
 # $1 = test name, $2 = reference
@@ -56,7 +58,7 @@ endif
 # we know it failed and then force failure at the end.
 diff-out = $(call quiet-command, diff -q $1.out $2 || \
                                  (diff -u $1.out $2 | head -n 10 && false), \
-                                 "DIFF","$1.out with $2")
+                                 DIFF,$1.out with $2)
 
 # $1 = test name, $2 = reason
 skip-test = @printf "  SKIPPED %s on $(TARGET_NAME) because %s\n" $1 $2
@@ -155,21 +157,19 @@ RUN_TESTS+=$(EXTRA_RUNS)
 
 ifeq ($(filter %-softmmu, $(TARGET)),)
 run-%: %
-	$(call run-test, $<, $(QEMU) $(QEMU_OPTS) $<, "$< on $(TARGET_NAME)")
+	$(call run-test, $<, $(QEMU) $(QEMU_OPTS) $<)
 
 run-plugin-%:
 	$(call run-test, $@, $(QEMU) $(QEMU_OPTS) \
 		-plugin $(PLUGIN_LIB)/$(call extract-plugin,$@) \
 		-d plugin -D $*.pout \
-		 $(call strip-plugin,$<), \
-	"$* on $(TARGET_NAME)")
+		 $(call strip-plugin,$<))
 else
 run-%: %
 	$(call run-test, $<, \
 	  $(QEMU) -monitor none -display none \
 		  -chardev file$(COMMA)path=$<.out$(COMMA)id=output \
-	   	  $(QEMU_OPTS) $<, \
-	  "$< on $(TARGET_NAME)")
+		  $(QEMU_OPTS) $<)
 
 run-plugin-%:
 	$(call run-test, $@, \
@@ -177,8 +177,7 @@ run-plugin-%:
 		  -chardev file$(COMMA)path=$@.out$(COMMA)id=output \
 	   	  -plugin $(PLUGIN_LIB)/$(call extract-plugin,$@) \
 	    	  -d plugin -D $*.pout \
-	   	  $(QEMU_OPTS) $(call strip-plugin,$<), \
-	  "$* on $(TARGET_NAME)")
+		  $(QEMU_OPTS) $(call strip-plugin,$<))
 endif
 
 gdb-%: %
diff --git a/tests/tcg/aarch64/Makefile.softmmu-target b/tests/tcg/aarch64/Makefile.softmmu-target
index f6fcd4829e..84a9990f8d 100644
--- a/tests/tcg/aarch64/Makefile.softmmu-target
+++ b/tests/tcg/aarch64/Makefile.softmmu-target
@@ -50,8 +50,7 @@ run-memory-record: memory-record memory
 	  $(QEMU) -monitor none -display none \
 		  -chardev file$(COMMA)path=$<.out$(COMMA)id=output \
 		  -icount shift=5$(COMMA)rr=record$(COMMA)rrfile=record.bin \
-	   	  $(QEMU_OPTS) memory, \
-	  "$< on $(TARGET_NAME)")
+		  $(QEMU_OPTS) memory)
 
 .PHONY: memory-replay
 run-memory-replay: memory-replay run-memory-record
@@ -59,8 +58,7 @@ run-memory-replay: memory-replay run-memory-record
 	  $(QEMU) -monitor none -display none \
 		  -chardev file$(COMMA)path=$<.out$(COMMA)id=output \
 		  -icount shift=5$(COMMA)rr=replay$(COMMA)rrfile=record.bin \
-	   	  $(QEMU_OPTS) memory, \
-	  "$< on $(TARGET_NAME)")
+		  $(QEMU_OPTS) memory)
 
 EXTRA_RUNS+=run-memory-replay
 
diff --git a/tests/tcg/aarch64/Makefile.target b/tests/tcg/aarch64/Makefile.target
index d6a74d24dc..9837a809dc 100644
--- a/tests/tcg/aarch64/Makefile.target
+++ b/tests/tcg/aarch64/Makefile.target
@@ -55,7 +55,7 @@ sha1-vector: CFLAGS=-O3
 sha1-vector: sha1.c
 	$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $< -o $@ $(LDFLAGS)
 run-sha1-vector: sha1-vector run-sha1
-	$(call run-test, $<, $(QEMU) $(QEMU_OPTS) $<, "$< on $(TARGET_NAME)")
+	$(call run-test, $<, $(QEMU) $(QEMU_OPTS) $<)
 	$(call diff-out, sha1-vector, sha1.out)
 
 TESTS += sha1-vector
@@ -75,14 +75,14 @@ run-gdbstub-sysregs: sysregs
 		--gdb $(HAVE_GDB_BIN) \
 		--qemu $(QEMU) --qargs "$(QEMU_OPTS)" \
 		--bin $< --test $(AARCH64_SRC)/gdbstub/test-sve.py, \
-	"basic gdbstub SVE support")
+	basic gdbstub SVE support)
 
 run-gdbstub-sve-ioctls: sve-ioctls
 	$(call run-test, $@, $(GDB_SCRIPT) \
 		--gdb $(HAVE_GDB_BIN) \
 		--qemu $(QEMU) --qargs "$(QEMU_OPTS)" \
 		--bin $< --test $(AARCH64_SRC)/gdbstub/test-sve-ioctl.py, \
-	"basic gdbstub SVE ZLEN support")
+	basic gdbstub SVE ZLEN support)
 
 EXTRA_RUNS += run-gdbstub-sysregs run-gdbstub-sve-ioctls
 endif
diff --git a/tests/tcg/arm/Makefile.target b/tests/tcg/arm/Makefile.target
index 2f815120a5..b3b1504a1c 100644
--- a/tests/tcg/arm/Makefile.target
+++ b/tests/tcg/arm/Makefile.target
@@ -26,7 +26,7 @@ ARM_TESTS += fcvt
 fcvt: LDFLAGS+=-lm
 # fcvt: CFLAGS+=-march=armv8.2-a+fp16 -mfpu=neon-fp-armv8
 run-fcvt: fcvt
-	$(call run-test,fcvt,$(QEMU) $<,"$< on $(TARGET_NAME)")
+	$(call run-test,fcvt,$(QEMU) $<)
 	$(call diff-out,fcvt,$(ARM_SRC)/fcvt.ref)
 
 # PC alignment test
@@ -44,13 +44,12 @@ semihosting-arm: semihosting.c
 	$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $< -o $@ $(LDFLAGS)
 
 run-semihosting-arm: semihosting-arm
-	$(call run-test,$<,$(QEMU) $< 2> $<.err, "$< on $(TARGET_NAME)")
+	$(call run-test,$<,$(QEMU) $< 2> $<.err)
 
 run-plugin-semihosting-arm-with-%:
 	$(call run-test, $@, $(QEMU) $(QEMU_OPTS) \
 		-plugin $(PLUGIN_LIB)/$(call extract-plugin,$@) \
-		 $(call strip-plugin,$<) 2> $<.err, \
-		"$< on $(TARGET_NAME) with $*")
+		 $(call strip-plugin,$<) 2> $<.err)
 
 ARM_TESTS += semiconsole-arm
 
@@ -75,7 +74,7 @@ sha1-vector: CFLAGS=-O3
 sha1-vector: sha1.c
 	$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $< -o $@ $(LDFLAGS)
 run-sha1-vector: sha1-vector run-sha1
-	$(call run-test, $<, $(QEMU) $(QEMU_OPTS) $<, "$< on $(TARGET_NAME)")
+	$(call run-test, $<, $(QEMU) $(QEMU_OPTS) $<)
 	$(call diff-out, sha1-vector, sha1.out)
 
 ARM_TESTS += sha1-vector
diff --git a/tests/tcg/cris/Makefile.target b/tests/tcg/cris/Makefile.target
index e72d3cbdb2..372287bd03 100644
--- a/tests/tcg/cris/Makefile.target
+++ b/tests/tcg/cris/Makefile.target
@@ -56,4 +56,4 @@ SIMG:=cris-axis-linux-gnu-run
 
 # e.g.: make -f ../../tests/tcg/Makefile run-check_orm-on-sim
 run-%-on-sim:
-	$(call run-test, $<, $(SIMG) $<, "$< on $(TARGET_NAME) with SIM")
+	$(call run-test, $<, $(SIMG) $<)
diff --git a/tests/tcg/i386/Makefile.softmmu-target b/tests/tcg/i386/Makefile.softmmu-target
index 9b9038d0be..ed922d59c8 100644
--- a/tests/tcg/i386/Makefile.softmmu-target
+++ b/tests/tcg/i386/Makefile.softmmu-target
@@ -40,8 +40,7 @@ run-plugin-%-with-libinsn.so:
 		  -chardev file$(COMMA)path=$@.out$(COMMA)id=output \
                   -plugin ../../plugin/libinsn.so$(COMMA)inline=on \
 	    	  -d plugin -D $*-with-libinsn.so.pout \
-	   	  $(QEMU_OPTS) $*, \
-		  "$* on $(TARGET_NAME)")
+		  $(QEMU_OPTS) $*)
 
 # Running
 QEMU_OPTS+=-device isa-debugcon,chardev=output -device isa-debug-exit,iobase=0xf4,iosize=0x4 -kernel
diff --git a/tests/tcg/i386/Makefile.target b/tests/tcg/i386/Makefile.target
index 599f192529..8af066efc5 100644
--- a/tests/tcg/i386/Makefile.target
+++ b/tests/tcg/i386/Makefile.target
@@ -53,7 +53,7 @@ test-i386-fprem.ref: test-i386-fprem
 
 run-test-i386-fprem: TIMEOUT=60
 run-test-i386-fprem: test-i386-fprem test-i386-fprem.ref
-	$(call run-test,test-i386-fprem, $(QEMU) $<,"$< on $(TARGET_NAME)")
+	$(call run-test,test-i386-fprem, $(QEMU) $<)
 	$(call diff-out,test-i386-fprem, test-i386-fprem.ref)
 else
 SKIP_I386_TESTS+=test-i386-fprem
@@ -63,8 +63,7 @@ endif
 run-plugin-%-with-libinsn.so:
 	$(call run-test, $@, $(QEMU) $(QEMU_OPTS) \
 	       -plugin ../../plugin/libinsn.so$(COMMA)inline=on \
-	       -d plugin -D $*-with-libinsn.so.pout $*, \
-		"$* (inline) on $(TARGET_NAME)")
+	       -d plugin -D $*-with-libinsn.so.pout $*)
 
 # Update TESTS
 I386_TESTS:=$(filter-out $(SKIP_I386_TESTS), $(ALL_X86_TESTS))
diff --git a/tests/tcg/multiarch/Makefile.target b/tests/tcg/multiarch/Makefile.target
index 6bba523729..78104f9bbb 100644
--- a/tests/tcg/multiarch/Makefile.target
+++ b/tests/tcg/multiarch/Makefile.target
@@ -26,7 +26,7 @@ float_%: float_%.c libs/float_helpers.c
 	$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $< $(MULTIARCH_SRC)/libs/float_helpers.c -o $@ $(LDFLAGS)
 
 run-float_%: float_%
-	$(call run-test,$<, $(QEMU) $(QEMU_OPTS) $<,"$< on $(TARGET_NAME)")
+	$(call run-test,$<, $(QEMU) $(QEMU_OPTS) $<)
 	$(call conditional-diff-out,$<,$(SRC_PATH)/tests/tcg/$(TARGET_NAME)/$<.ref)
 
 
@@ -42,13 +42,11 @@ signals: LDFLAGS+=-lrt -lpthread
 
 # default case (host page size)
 run-test-mmap: test-mmap
-	$(call run-test, test-mmap, $(QEMU) $<, \
-		"$< (default) on $(TARGET_NAME)")
+	$(call run-test, test-mmap, $(QEMU) $<, $< (default))
 
 # additional page sizes (defined by each architecture adding to EXTRA_RUNS)
 run-test-mmap-%: test-mmap
-	$(call run-test, test-mmap-$*, $(QEMU) -p $* $<,\
-		"$< ($* byte pages) on $(TARGET_NAME)")
+	$(call run-test, test-mmap-$*, $(QEMU) -p $* $<, $< ($* byte pages))
 
 ifneq ($(HAVE_GDB_BIN),)
 GDB_SCRIPT=$(SRC_PATH)/tests/guest-debug/run-test.py
@@ -58,21 +56,21 @@ run-gdbstub-sha1: sha1
 		--gdb $(HAVE_GDB_BIN) \
 		--qemu $(QEMU) --qargs "$(QEMU_OPTS)" \
 		--bin $< --test $(MULTIARCH_SRC)/gdbstub/sha1.py, \
-	"basic gdbstub support")
+	basic gdbstub support)
 
 run-gdbstub-qxfer-auxv-read: sha1
 	$(call run-test, $@, $(GDB_SCRIPT) \
 		--gdb $(HAVE_GDB_BIN) \
 		--qemu $(QEMU) --qargs "$(QEMU_OPTS)" \
 		--bin $< --test $(MULTIARCH_SRC)/gdbstub/test-qxfer-auxv-read.py, \
-	"basic gdbstub qXfer:auxv:read support")
+	basic gdbstub qXfer:auxv:read support)
 
 run-gdbstub-thread-breakpoint: testthread
 	$(call run-test, $@, $(GDB_SCRIPT) \
 		--gdb $(HAVE_GDB_BIN) \
 		--qemu $(QEMU) --qargs "$(QEMU_OPTS)" \
 		--bin $< --test $(MULTIARCH_SRC)/gdbstub/test-thread-breakpoint.py, \
-	"hitting a breakpoint on non-main thread")
+	hitting a breakpoint on non-main thread)
 
 else
 run-gdbstub-%:
@@ -94,13 +92,13 @@ VPATH += $(MULTIARCH_SRC)/arm-compat-semi
 semihosting: CFLAGS+=-I$(SRC_PATH)/tests/tcg/$(TARGET_NAME)
 
 run-semihosting: semihosting
-	$(call run-test,$<,$(QEMU) $< 2> $<.err, "$< on $(TARGET_NAME)")
+	$(call run-test,$<,$(QEMU) $< 2> $<.err)
 
 run-plugin-semihosting-with-%:
 	$(call run-test, $@, $(QEMU) $(QEMU_OPTS) \
 		-plugin $(PLUGIN_LIB)/$(call extract-plugin,$@) \
 		 $(call strip-plugin,$<) 2> $<.err, \
-		"$< on $(TARGET_NAME) with $*")
+		$< with $*)
 
 semiconsole: CFLAGS+=-I$(SRC_PATH)/tests/tcg/$(TARGET_NAME)
 
diff --git a/tests/tcg/multiarch/system/Makefile.softmmu-target b/tests/tcg/multiarch/system/Makefile.softmmu-target
index 625ed792c6..368b64d531 100644
--- a/tests/tcg/multiarch/system/Makefile.softmmu-target
+++ b/tests/tcg/multiarch/system/Makefile.softmmu-target
@@ -25,7 +25,7 @@ run-gdbstub-memory: memory
 		--qargs \
 		"-monitor none -display none -chardev file$(COMMA)path=$<.out$(COMMA)id=output $(QEMU_OPTS)" \
 		--bin $< --test $(MULTIARCH_SRC)/gdbstub/memory.py, \
-	"softmmu gdbstub support")
+	softmmu gdbstub support)
 
 else
 run-gdbstub-%:
diff --git a/tests/tcg/s390x/Makefile.target b/tests/tcg/s390x/Makefile.target
index 5e13a41c3f..c830313e67 100644
--- a/tests/tcg/s390x/Makefile.target
+++ b/tests/tcg/s390x/Makefile.target
@@ -41,7 +41,7 @@ run-gdbstub-signals-s390x: signals-s390x
 		--gdb $(HAVE_GDB_BIN) \
 		--qemu $(QEMU) --qargs "$(QEMU_OPTS)" \
 		--bin $< --test $(S390X_SRC)/gdbstub/test-signals-s390x.py, \
-	"mixing signals and debugging on s390x")
+	mixing signals and debugging)
 
 EXTRA_RUNS += run-gdbstub-signals-s390x
 endif
diff --git a/tests/tcg/x86_64/Makefile.softmmu-target b/tests/tcg/x86_64/Makefile.softmmu-target
index 2afa3298bf..7207fee94c 100644
--- a/tests/tcg/x86_64/Makefile.softmmu-target
+++ b/tests/tcg/x86_64/Makefile.softmmu-target
@@ -40,8 +40,7 @@ run-plugin-%-with-libinsn.so:
 		  -chardev file$(COMMA)path=$@.out$(COMMA)id=output \
                   -plugin ../../plugin/libinsn.so$(COMMA)inline=on \
 	    	  -d plugin -D $*-with-libinsn.so.pout \
-	   	  $(QEMU_OPTS) $*, \
-		  "$* on $(TARGET_NAME)")
+		  $(QEMU_OPTS) $*)
 
 # Running
 QEMU_OPTS+=-device isa-debugcon,chardev=output -device isa-debug-exit,iobase=0xf4,iosize=0x4 -kernel
-- 
2.34.1



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

* [PULL 24/54] tests/tcg: move compiler tests to Makefiles
  2022-10-04 13:00 [PULL 00/54] testing, gdbstub, plugin and gitdm updates Alex Bennée
                   ` (22 preceding siblings ...)
  2022-10-04 13:01 ` [PULL 23/54] tests/tcg: clean up calls to run-test Alex Bennée
@ 2022-10-04 13:01 ` Alex Bennée
  2022-10-04 13:01 ` [PULL 25/54] configure: move tests/tcg/Makefile.prereqs to root build directory Alex Bennée
                   ` (30 subsequent siblings)
  54 siblings, 0 replies; 64+ messages in thread
From: Alex Bennée @ 2022-10-04 13:01 UTC (permalink / raw)
  To: qemu-devel
  Cc: stefanha, Paolo Bonzini, Alex Bennée,
	Philippe Mathieu-Daudé,
	Peter Maydell, Richard Henderson, Eduardo Habkost,
	open list:ARM TCG CPUs

From: Paolo Bonzini <pbonzini@redhat.com>

Further decoupling of tests/tcg from the main QEMU Makefile, and making
the build more similar between the cross compiler case and the vetted
container images.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20220929114231.583801-25-alex.bennee@linaro.org>

diff --git a/configure b/configure
index a48a731bf4..ceb1213292 100755
--- a/configure
+++ b/configure
@@ -2562,73 +2562,11 @@ for target in $target_list; do
 
   probe_target_compiler $target
   if test $got_cross_cc = yes; then
-      # Test for compiler features for optional tests. We only do this
-      # for cross compilers because ensuring the docker containers based
-      # compilers is a requirememt for adding a new test that needs a
-      # compiler feature.
-
-      echo "BUILD_STATIC=$build_static" >> "$config_target_mak"
       write_target_makefile >> "$config_target_mak"
-      case $target in
-          aarch64-*)
-              if do_compiler "$target_cc" $target_cflags \
-                             -march=armv8.1-a+sve -o $TMPE $TMPC; then
-                  echo "CROSS_CC_HAS_SVE=y" >> "$config_target_mak"
-              fi
-              if do_compiler "$target_cc" $target_cflags \
-                             -march=armv8.1-a+sve2 -o $TMPE $TMPC; then
-                  echo "CROSS_CC_HAS_SVE2=y" >> "$config_target_mak"
-              fi
-              if do_compiler "$target_cc" $target_cflags \
-                             -march=armv8.3-a -o $TMPE $TMPC; then
-                  echo "CROSS_CC_HAS_ARMV8_3=y" >> "$config_target_mak"
-              fi
-              if do_compiler "$target_cc" $target_cflags \
-                             -mbranch-protection=standard -o $TMPE $TMPC; then
-                  echo "CROSS_CC_HAS_ARMV8_BTI=y" >> "$config_target_mak"
-              fi
-              if do_compiler "$target_cc" $target_cflags \
-                             -march=armv8.5-a+memtag -o $TMPE $TMPC; then
-                  echo "CROSS_CC_HAS_ARMV8_MTE=y" >> "$config_target_mak"
-              fi
-              ;;
-          ppc*)
-              if do_compiler "$target_cc" $target_cflags \
-                             -mpower8-vector -o $TMPE $TMPC; then
-                  echo "CROSS_CC_HAS_POWER8_VECTOR=y" >> "$config_target_mak"
-              fi
-              if do_compiler "$target_cc" $target_cflags \
-                             -mpower10 -o $TMPE $TMPC; then
-                  echo "CROSS_CC_HAS_POWER10=y" >> "$config_target_mak"
-              fi
-              ;;
-          i386-linux-user)
-              if do_compiler "$target_cc" $target_cflags \
-                             -Werror -fno-pie -o $TMPE $TMPC; then
-                  echo "CROSS_CC_HAS_I386_NOPIE=y" >> "$config_target_mak"
-              fi
-              ;;
-      esac
   elif test -n "$container_image"; then
+      build_static=y
       echo "build-tcg-tests-$target: docker-image-$container_image" >> $makefile
-      echo "BUILD_STATIC=y" >> "$config_target_mak"
       write_container_target_makefile >> "$config_target_mak"
-      case $target in
-          aarch64-*)
-              echo "CROSS_CC_HAS_SVE=y" >> "$config_target_mak"
-              echo "CROSS_CC_HAS_SVE2=y" >> "$config_target_mak"
-              echo "CROSS_CC_HAS_ARMV8_3=y" >> "$config_target_mak"
-              echo "CROSS_CC_HAS_ARMV8_BTI=y" >> "$config_target_mak"
-              echo "CROSS_CC_HAS_ARMV8_MTE=y" >> "$config_target_mak"
-              ;;
-          ppc*)
-              echo "CROSS_CC_HAS_POWER8_VECTOR=y" >> "$config_target_mak"
-              echo "CROSS_CC_HAS_POWER10=y" >> "$config_target_mak"
-              ;;
-          i386-linux-user)
-              echo "CROSS_CC_HAS_I386_NOPIE=y" >> "$config_target_mak"
-              ;;
-      esac
       got_cross_cc=yes
   fi
   if test $got_cross_cc = yes; then
@@ -2637,6 +2575,7 @@ for target in $target_list; do
       ln -sf "../config-$target.mak" "tests/tcg/$target/config-target.mak"
       echo "TARGET=$target" >> "$config_target_mak"
       echo "QEMU=$PWD/$qemu" >> "$config_target_mak"
+      echo "BUILD_STATIC=$build_static" >> "$config_target_mak"
       echo "run-tcg-tests-$target: $qemu\$(EXESUF)" >> $makefile
       tcg_tests_targets="$tcg_tests_targets $target"
   fi
diff --git a/tests/tcg/Makefile.target b/tests/tcg/Makefile.target
index cd0a2ad873..75257f2b29 100644
--- a/tests/tcg/Makefile.target
+++ b/tests/tcg/Makefile.target
@@ -40,10 +40,18 @@ endif
 
 # for including , in command strings
 COMMA := ,
+NULL :=
+SPACE := $(NULL) #
+TARGET_PREFIX=tests/tcg/$(TARGET):$(SPACE)
 
 quiet-@ = $(if $(V),,@$(if $1,printf "  %-7s %s\n" "$(strip $1)" "$(strip $2)" && ))
 quiet-command = $(call quiet-@,$2,$3)$1
 
+cc-test = $(CC) -Werror $1 -c -o /dev/null -xc /dev/null >/dev/null 2>&1
+cc-option = if $(call cc-test, $1); then \
+    echo "$(TARGET_PREFIX)$1 detected" && echo "$(strip $2)=y" >&3; else \
+    echo "$(TARGET_PREFIX)$1 not detected"; fi
+
 # $1 = test name, $2 = cmd, $3 = desc
 ifeq ($(filter %-softmmu, $(TARGET)),)
 run-test = $(call quiet-command, timeout --foreground $(TIMEOUT) $2 > $1.out, \
@@ -190,4 +198,4 @@ clean:
 	rm -f $(TESTS) *.o $(CLEANFILES)
 
 distclean:
-	rm -f config-target.mak ../config-$(TARGET).mak
+	rm -f config-cc.mak config-target.mak ../config-$(TARGET).mak
diff --git a/tests/tcg/aarch64/Makefile.softmmu-target b/tests/tcg/aarch64/Makefile.softmmu-target
index 84a9990f8d..a1368905f5 100644
--- a/tests/tcg/aarch64/Makefile.softmmu-target
+++ b/tests/tcg/aarch64/Makefile.softmmu-target
@@ -19,6 +19,11 @@ EXTRA_RUNS+=$(MULTIARCH_RUNS)
 CFLAGS+=-nostdlib -ggdb -O0 $(MINILIB_INC)
 LDFLAGS+=-static -nostdlib $(CRT_OBJS) $(MINILIB_OBJS) -lgcc
 
+config-cc.mak: Makefile
+	$(quiet-@)( \
+	    $(call cc-option,-march=armv8.3-a, CROSS_CC_HAS_ARMV8_3)) 3> config-cc.mak
+-include config-cc.mak
+
 # building head blobs
 .PRECIOUS: $(CRT_OBJS)
 
diff --git a/tests/tcg/aarch64/Makefile.target b/tests/tcg/aarch64/Makefile.target
index 9837a809dc..fc8d90ed69 100644
--- a/tests/tcg/aarch64/Makefile.target
+++ b/tests/tcg/aarch64/Makefile.target
@@ -17,6 +17,15 @@ run-fcvt: fcvt
 	$(call run-test,$<,$(QEMU) $<, "$< on $(TARGET_NAME)")
 	$(call diff-out,$<,$(AARCH64_SRC)/fcvt.ref)
 
+config-cc.mak: Makefile
+	$(quiet-@)( \
+	    $(call cc-option,-march=armv8.1-a+sve,          CROSS_CC_HAS_SVE); \
+	    $(call cc-option,-march=armv8.1-a+sve2,         CROSS_CC_HAS_SVE2); \
+	    $(call cc-option,-march=armv8.3-a,              CROSS_CC_HAS_ARMV8_3); \
+	    $(call cc-option,-mbranch-protection=standard,  CROSS_CC_HAS_ARMV8_BTI); \
+	    $(call cc-option,-march=armv8.5-a+memtag,       CROSS_CC_HAS_ARMV8_MTE)) 3> config-cc.mak
+-include config-cc.mak
+
 # Pauth Tests
 ifneq ($(CROSS_CC_HAS_ARMV8_3),)
 AARCH64_TESTS += pauth-1 pauth-2 pauth-4 pauth-5
diff --git a/tests/tcg/i386/Makefile.target b/tests/tcg/i386/Makefile.target
index 8af066efc5..3273aa8061 100644
--- a/tests/tcg/i386/Makefile.target
+++ b/tests/tcg/i386/Makefile.target
@@ -5,6 +5,12 @@ I386_SRC=$(SRC_PATH)/tests/tcg/i386
 # Set search path for all sources
 VPATH 		+= $(I386_SRC)
 
+config-cc.mak: Makefile
+	$(quiet-@)( \
+          $(call cc-option,-fno-pie, CROSS_CC_HAS_I386_NOPIE)) 3> config-cc.mak
+
+-include config-cc.mak
+
 I386_SRCS=$(notdir $(wildcard $(I386_SRC)/*.c))
 ALL_X86_TESTS=$(I386_SRCS:.c=)
 SKIP_I386_TESTS=test-i386-ssse3 test-avx test-3dnow test-mmx
diff --git a/tests/tcg/ppc64/Makefile.target b/tests/tcg/ppc64/Makefile.target
index 7db7a3e2b3..f081f1c683 100644
--- a/tests/tcg/ppc64/Makefile.target
+++ b/tests/tcg/ppc64/Makefile.target
@@ -4,6 +4,13 @@
 
 VPATH += $(SRC_PATH)/tests/tcg/ppc64
 
+config-cc.mak: Makefile
+	$(quiet-@)( \
+	    $(call cc-option,-mpower8-vector,   CROSS_CC_HAS_POWER8_VECTOR); \
+	    $(call cc-option,-mpower10,         CROSS_CC_HAS_POWER10)) 3> config-cc.mak
+
+-include config-cc.mak
+
 ifneq ($(CROSS_CC_HAS_POWER8_VECTOR),)
 PPC64_TESTS=bcdsub non_signalling_xscv
 endif
-- 
2.34.1



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

* [PULL 25/54] configure: move tests/tcg/Makefile.prereqs to root build directory
  2022-10-04 13:00 [PULL 00/54] testing, gdbstub, plugin and gitdm updates Alex Bennée
                   ` (23 preceding siblings ...)
  2022-10-04 13:01 ` [PULL 24/54] tests/tcg: move compiler tests to Makefiles Alex Bennée
@ 2022-10-04 13:01 ` Alex Bennée
  2022-10-04 13:01 ` [PULL 26/54] configure: unify creation of cross-compilation Makefiles Alex Bennée
                   ` (29 subsequent siblings)
  54 siblings, 0 replies; 64+ messages in thread
From: Alex Bennée @ 2022-10-04 13:01 UTC (permalink / raw)
  To: qemu-devel; +Cc: stefanha, Paolo Bonzini, Alex Bennée

From: Paolo Bonzini <pbonzini@redhat.com>

It will not be specific to tests/tcg anymore, since it will be possible to
build firmware using container-based cross compilers too.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20220929114231.583801-26-alex.bennee@linaro.org>

diff --git a/configure b/configure
index ceb1213292..cbeac99b2b 100755
--- a/configure
+++ b/configure
@@ -2185,6 +2185,7 @@ write_target_makefile() {
 }
 
 write_container_target_makefile() {
+  echo "$1: docker-image-$container_image" >> Makefile.prereqs
   echo "EXTRA_CFLAGS=$target_cflags"
   if test -n "$container_cross_cc"; then
     echo "CC=$docker_py cc --cc $container_cross_cc -i qemu/$container_image -s $source_path --"
@@ -2297,6 +2298,8 @@ for f in $LINKS ; do
     fi
 done
 
+echo "# Automatically generated by configure - do not modify" > Makefile.prereqs
+
 # Mac OS X ships with a broken assembler
 roms=
 if test "$targetos" != "darwin" && test "$targetos" != "sunos" && \
@@ -2524,10 +2527,7 @@ if test "$safe_stack" = "yes"; then
 fi
 
 # tests/tcg configuration
-(makefile=tests/tcg/Makefile.prereqs
-echo "# Automatically generated by configure - do not modify" > $makefile
-
-config_host_mak=tests/tcg/config-host.mak
+(config_host_mak=tests/tcg/config-host.mak
 mkdir -p tests/tcg
 echo "# Automatically generated by configure - do not modify" > $config_host_mak
 echo "SRC_PATH=$source_path" >> $config_host_mak
@@ -2565,8 +2565,7 @@ for target in $target_list; do
       write_target_makefile >> "$config_target_mak"
   elif test -n "$container_image"; then
       build_static=y
-      echo "build-tcg-tests-$target: docker-image-$container_image" >> $makefile
-      write_container_target_makefile >> "$config_target_mak"
+      write_container_target_makefile build-tcg-tests-$target >> "$config_target_mak"
       got_cross_cc=yes
   fi
   if test $got_cross_cc = yes; then
@@ -2576,11 +2575,11 @@ for target in $target_list; do
       echo "TARGET=$target" >> "$config_target_mak"
       echo "QEMU=$PWD/$qemu" >> "$config_target_mak"
       echo "BUILD_STATIC=$build_static" >> "$config_target_mak"
-      echo "run-tcg-tests-$target: $qemu\$(EXESUF)" >> $makefile
+      echo "run-tcg-tests-$target: $qemu\$(EXESUF)" >> Makefile.prereqs
       tcg_tests_targets="$tcg_tests_targets $target"
   fi
 done
-echo "TCG_TESTS_TARGETS=$tcg_tests_targets" >> $makefile)
+echo "TCG_TESTS_TARGETS=$tcg_tests_targets" >> config-host.mak)
 
 if test "$skip_meson" = no; then
   cross="config-meson.cross.new"
diff --git a/Makefile b/Makefile
index 0fcde48bec..357592ad39 100644
--- a/Makefile
+++ b/Makefile
@@ -42,6 +42,9 @@ configure: ;
 ifneq ($(wildcard config-host.mak),)
 include config-host.mak
 
+include Makefile.prereqs
+Makefile.prereqs: config-host.mak
+
 git-submodule-update:
 .git-submodule-status: git-submodule-update config-host.mak
 Makefile: .git-submodule-status
@@ -217,7 +220,7 @@ qemu-%.tar.bz2:
 
 distclean: clean recurse-distclean
 	-$(quiet-@)test -f build.ninja && $(NINJA) $(NINJAFLAGS) -t clean -g || :
-	rm -f config-host.mak qemu-bundle
+	rm -f config-host.mak Makefile.prereqs qemu-bundle
 	rm -f tests/tcg/config-*.mak
 	rm -f config.status
 	rm -f roms/seabios/config.mak
diff --git a/tests/Makefile.include b/tests/Makefile.include
index 9ed67721e2..9422ddaece 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -36,9 +36,6 @@ export SRC_PATH
 
 SPEED = quick
 
--include tests/tcg/Makefile.prereqs
-tests/tcg/Makefile.prereqs: config-host.mak
-
 # Per guest TCG tests
 BUILD_TCG_TARGET_RULES=$(patsubst %,build-tcg-tests-%, $(TCG_TESTS_TARGETS))
 CLEAN_TCG_TARGET_RULES=$(patsubst %,clean-tcg-tests-%, $(TCG_TESTS_TARGETS))
-- 
2.34.1



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

* [PULL 26/54] configure: unify creation of cross-compilation Makefiles
  2022-10-04 13:00 [PULL 00/54] testing, gdbstub, plugin and gitdm updates Alex Bennée
                   ` (24 preceding siblings ...)
  2022-10-04 13:01 ` [PULL 25/54] configure: move tests/tcg/Makefile.prereqs to root build directory Alex Bennée
@ 2022-10-04 13:01 ` Alex Bennée
  2022-10-06 20:33   ` Stefan Hajnoczi
  2022-10-04 13:01 ` [PULL 27/54] configure: cleanup creation of tests/tcg target config Alex Bennée
                   ` (28 subsequent siblings)
  54 siblings, 1 reply; 64+ messages in thread
From: Alex Bennée @ 2022-10-04 13:01 UTC (permalink / raw)
  To: qemu-devel; +Cc: stefanha, Paolo Bonzini, Alex Bennée

From: Paolo Bonzini <pbonzini@redhat.com>

Let write_target_makefile handle both host and container cross compilers.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20220929114231.583801-27-alex.bennee@linaro.org>

diff --git a/configure b/configure
index cbeac99b2b..8b495d4453 100755
--- a/configure
+++ b/configure
@@ -2157,51 +2157,49 @@ probe_target_compiler() {
 
 write_target_makefile() {
   echo "EXTRA_CFLAGS=$target_cflags"
-  if test -n "$target_cc"; then
-    echo "CC=$target_cc"
-    echo "CCAS=$target_ccas"
-  fi
-  if test -n "$target_ar"; then
-    echo "AR=$target_ar"
-  fi
-  if test -n "$target_as"; then
-    echo "AS=$target_as"
-  fi
-  if test -n "$target_ld"; then
-    echo "LD=$target_ld"
-  fi
-  if test -n "$target_nm"; then
-    echo "NM=$target_nm"
-  fi
-  if test -n "$target_objcopy"; then
-    echo "OBJCOPY=$target_objcopy"
-  fi
-  if test -n "$target_ranlib"; then
-    echo "RANLIB=$target_ranlib"
-  fi
-  if test -n "$target_strip"; then
-    echo "STRIP=$target_strip"
-  fi
-}
-
-write_container_target_makefile() {
-  echo "$1: docker-image-$container_image" >> Makefile.prereqs
-  echo "EXTRA_CFLAGS=$target_cflags"
-  if test -n "$container_cross_cc"; then
-    echo "CC=$docker_py cc --cc $container_cross_cc -i qemu/$container_image -s $source_path --"
-    echo "CCAS=$docker_py cc --cc $container_cross_cc -i qemu/$container_image -s $source_path --"
+  if test -z "$target_cc" && test -z "$target_as"; then
+    test -z "$container_image" && error_exit "Internal error: could not find cross compiler for $1?"
+    echo "$1: docker-image-$container_image" >> Makefile.prereqs
+    if test -n "$container_cross_cc"; then
+      echo "CC=$docker_py cc --cc $container_cross_cc -i qemu/$container_image -s $source_path --"
+      echo "CCAS=$docker_py cc --cc $container_cross_cc -i qemu/$container_image -s $source_path --"
+    fi
+    echo "AR=$docker_py cc --cc $container_cross_ar -i qemu/$container_image -s $source_path --"
+    echo "AS=$docker_py cc --cc $container_cross_as -i qemu/$container_image -s $source_path --"
+    echo "LD=$docker_py cc --cc $container_cross_ld -i qemu/$container_image -s $source_path --"
+    echo "NM=$docker_py cc --cc $container_cross_nm -i qemu/$container_image -s $source_path --"
+    echo "OBJCOPY=$docker_py cc --cc $container_cross_objcopy -i qemu/$container_image -s $source_path --"
+    echo "RANLIB=$docker_py cc --cc $container_cross_ranlib -i qemu/$container_image -s $source_path --"
+    echo "STRIP=$docker_py cc --cc $container_cross_strip -i qemu/$container_image -s $source_path --"
+  else
+    if test -n "$target_cc"; then
+      echo "CC=$target_cc"
+      echo "CCAS=$target_ccas"
+    fi
+    if test -n "$target_ar"; then
+      echo "AR=$target_ar"
+    fi
+    if test -n "$target_as"; then
+      echo "AS=$target_as"
+    fi
+    if test -n "$target_ld"; then
+      echo "LD=$target_ld"
+    fi
+    if test -n "$target_nm"; then
+      echo "NM=$target_nm"
+    fi
+    if test -n "$target_objcopy"; then
+      echo "OBJCOPY=$target_objcopy"
+    fi
+    if test -n "$target_ranlib"; then
+      echo "RANLIB=$target_ranlib"
+    fi
+    if test -n "$target_strip"; then
+      echo "STRIP=$target_strip"
+    fi
   fi
-  echo "AR=$docker_py cc --cc $container_cross_ar -i qemu/$container_image -s $source_path --"
-  echo "AS=$docker_py cc --cc $container_cross_as -i qemu/$container_image -s $source_path --"
-  echo "LD=$docker_py cc --cc $container_cross_ld -i qemu/$container_image -s $source_path --"
-  echo "NM=$docker_py cc --cc $container_cross_nm -i qemu/$container_image -s $source_path --"
-  echo "OBJCOPY=$docker_py cc --cc $container_cross_objcopy -i qemu/$container_image -s $source_path --"
-  echo "RANLIB=$docker_py cc --cc $container_cross_ranlib -i qemu/$container_image -s $source_path --"
-  echo "STRIP=$docker_py cc --cc $container_cross_strip -i qemu/$container_image -s $source_path --"
 }
 
-
-
 ##########################################
 # check for vfio_user_server
 
@@ -2560,15 +2558,9 @@ for target in $target_list; do
       ;;
   esac
 
-  probe_target_compiler $target
-  if test $got_cross_cc = yes; then
-      write_target_makefile >> "$config_target_mak"
-  elif test -n "$container_image"; then
-      build_static=y
-      write_container_target_makefile build-tcg-tests-$target >> "$config_target_mak"
-      got_cross_cc=yes
-  fi
-  if test $got_cross_cc = yes; then
+  if probe_target_compiler $target || test -n "$container_image"; then
+      test -n "$container_image" && build_static=y
+      write_target_makefile "build-tcg-tests-$target >> "$config_target_mak"
       mkdir -p "tests/tcg/$target"
       ln -sf "$source_path/tests/tcg/Makefile.target" "tests/tcg/$target/Makefile"
       ln -sf "../config-$target.mak" "tests/tcg/$target/config-target.mak"
-- 
2.34.1



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

* [PULL 27/54] configure: cleanup creation of tests/tcg target config
  2022-10-04 13:00 [PULL 00/54] testing, gdbstub, plugin and gitdm updates Alex Bennée
                   ` (25 preceding siblings ...)
  2022-10-04 13:01 ` [PULL 26/54] configure: unify creation of cross-compilation Makefiles Alex Bennée
@ 2022-10-04 13:01 ` Alex Bennée
  2022-10-04 13:01 ` [PULL 28/54] configure: build ROMs with container-based cross compilers Alex Bennée
                   ` (27 subsequent siblings)
  54 siblings, 0 replies; 64+ messages in thread
From: Alex Bennée @ 2022-10-04 13:01 UTC (permalink / raw)
  To: qemu-devel; +Cc: stefanha, Paolo Bonzini, Alex Bennée

From: Paolo Bonzini <pbonzini@redhat.com>

Remove the symlink to tests/tcg/config-*.mak, which is possible now
that unused target config files are not created either.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20220929114231.583801-28-alex.bennee@linaro.org>

diff --git a/configure b/configure
index 8b495d4453..c175650eb9 100755
--- a/configure
+++ b/configure
@@ -2540,10 +2540,6 @@ tcg_tests_targets=
 for target in $target_list; do
   arch=${target%%-*}
 
-  config_target_mak=tests/tcg/config-$target.mak
-
-  echo "# Automatically generated by configure - do not modify" > $config_target_mak
-  echo "TARGET_NAME=$arch" >> "$config_target_mak"
   case $target in
     xtensa*-linux-user)
       # the toolchain is not complete with headers, only build softmmu tests
@@ -2560,13 +2556,15 @@ for target in $target_list; do
 
   if probe_target_compiler $target || test -n "$container_image"; then
       test -n "$container_image" && build_static=y
-      write_target_makefile "build-tcg-tests-$target >> "$config_target_mak"
       mkdir -p "tests/tcg/$target"
+      config_target_mak=tests/tcg/$target/config-target.mak
       ln -sf "$source_path/tests/tcg/Makefile.target" "tests/tcg/$target/Makefile"
-      ln -sf "../config-$target.mak" "tests/tcg/$target/config-target.mak"
+      echo "# Automatically generated by configure - do not modify" > "$config_target_mak"
+      echo "TARGET_NAME=$arch" >> "$config_target_mak"
       echo "TARGET=$target" >> "$config_target_mak"
-      echo "QEMU=$PWD/$qemu" >> "$config_target_mak"
+      write_target_makefile "build-tcg-tests-$target" >> "$config_target_mak"
       echo "BUILD_STATIC=$build_static" >> "$config_target_mak"
+      echo "QEMU=$PWD/$qemu" >> "$config_target_mak"
       echo "run-tcg-tests-$target: $qemu\$(EXESUF)" >> Makefile.prereqs
       tcg_tests_targets="$tcg_tests_targets $target"
   fi
diff --git a/Makefile b/Makefile
index 357592ad39..a48103cc8a 100644
--- a/Makefile
+++ b/Makefile
@@ -221,7 +221,7 @@ qemu-%.tar.bz2:
 distclean: clean recurse-distclean
 	-$(quiet-@)test -f build.ninja && $(NINJA) $(NINJAFLAGS) -t clean -g || :
 	rm -f config-host.mak Makefile.prereqs qemu-bundle
-	rm -f tests/tcg/config-*.mak
+	rm -f tests/tcg/*/config-target.mak tests/tcg/config-host.mak
 	rm -f config.status
 	rm -f roms/seabios/config.mak
 	rm -f qemu-plugins-ld.symbols qemu-plugins-ld64.symbols
diff --git a/meson.build b/meson.build
index 8dc661363f..ac5ef05c21 100644
--- a/meson.build
+++ b/meson.build
@@ -3738,7 +3738,7 @@ summary(summary_info, bool_yn: true, section: 'Compilation')
 summary_info = {}
 have_cross = false
 foreach target: target_dirs
-  tcg_mak = meson.current_build_dir() / 'tests/tcg' / 'config-' + target + '.mak'
+  tcg_mak = meson.current_build_dir() / 'tests/tcg' / target / 'config-target.mak'
   if fs.exists(tcg_mak)
     config_cross_tcg = keyval.load(tcg_mak)
     if 'CC' in config_cross_tcg
-- 
2.34.1



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

* [PULL 28/54] configure: build ROMs with container-based cross compilers
  2022-10-04 13:00 [PULL 00/54] testing, gdbstub, plugin and gitdm updates Alex Bennée
                   ` (26 preceding siblings ...)
  2022-10-04 13:01 ` [PULL 27/54] configure: cleanup creation of tests/tcg target config Alex Bennée
@ 2022-10-04 13:01 ` Alex Bennée
  2022-10-06 20:37   ` Stefan Hajnoczi
  2022-10-10 12:54   ` Daniel P. Berrangé
  2022-10-04 13:01 ` [PULL 29/54] pc-bios/optionrom: Adopt meson style Make output Alex Bennée
                   ` (26 subsequent siblings)
  54 siblings, 2 replies; 64+ messages in thread
From: Alex Bennée @ 2022-10-04 13:01 UTC (permalink / raw)
  To: qemu-devel; +Cc: stefanha, Paolo Bonzini, Alex Bennée

From: Paolo Bonzini <pbonzini@redhat.com>

s390-ccw remains a bit more complex, because the -march=z900 test is done
only for the native cross compiler.  Otherwise, all that is needed is
to pass the (now mandatory) target argument to write_target_makefile.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20220929114231.583801-29-alex.bennee@linaro.org>

diff --git a/configure b/configure
index c175650eb9..a54e17aca9 100755
--- a/configure
+++ b/configure
@@ -2152,7 +2152,7 @@ probe_target_compiler() {
     target_ranlib=
     target_strip=
   fi
-  test -n "$target_cc"
+  test -n "$target_cc" || test -n "$container_image"
 }
 
 write_target_makefile() {
@@ -2307,7 +2307,7 @@ if test "$targetos" != "darwin" && test "$targetos" != "sunos" && \
     config_mak=pc-bios/optionrom/config.mak
     echo "# Automatically generated by configure - do not modify" > $config_mak
     echo "TOPSRC_DIR=$source_path" >> $config_mak
-    write_target_makefile >> $config_mak
+    write_target_makefile pc-bios/optionrom/all >> $config_mak
 fi
 
 if test "$softmmu" = yes && probe_target_compiler ppc-softmmu; then
@@ -2315,25 +2315,31 @@ if test "$softmmu" = yes && probe_target_compiler ppc-softmmu; then
     config_mak=pc-bios/vof/config.mak
     echo "# Automatically generated by configure - do not modify" > $config_mak
     echo "SRC_DIR=$source_path/pc-bios/vof" >> $config_mak
-    write_target_makefile >> $config_mak
+    write_target_makefile pc-bios/vof/all >> $config_mak
 fi
 
 # Only build s390-ccw bios if the compiler has -march=z900 or -march=z10
 # (which is the lowest architecture level that Clang supports)
 if test "$softmmu" = yes && probe_target_compiler s390x-softmmu; then
-  write_c_skeleton
-  do_compiler "$target_cc" $target_cc_cflags -march=z900 -o $TMPO -c $TMPC
-  has_z900=$?
-  if [ $has_z900 = 0 ] || do_compiler "$target_cc" $target_cc_cflags -march=z10 -msoft-float -Werror -o $TMPO -c $TMPC; then
-    if [ $has_z900 != 0 ]; then
-      echo "WARNING: Your compiler does not support the z900!"
-      echo "         The s390-ccw bios will only work with guest CPUs >= z10."
+  got_cross_cc=no
+  if test -n "$target_cc"; then
+    write_c_skeleton
+    do_compiler "$target_cc" $target_cc_cflags -march=z900 -o $TMPO -c $TMPC
+    has_z900=$?
+    if [ $has_z900 = 0 ] || do_compiler "$target_cc" $target_cc_cflags -march=z10 -msoft-float -Werror -o $TMPO -c $TMPC; then
+      if [ $has_z900 != 0 ]; then
+        echo "WARNING: Your compiler does not support the z900!"
+        echo "         The s390-ccw bios will only work with guest CPUs >= z10."
+      fi
+      got_cross_cc=yes
     fi
+  fi
+  if test "$got_cross_cc" = yes || test -n "$container_image"; then
     roms="$roms pc-bios/s390-ccw"
     config_mak=pc-bios/s390-ccw/config-host.mak
     echo "# Automatically generated by configure - do not modify" > $config_mak
     echo "SRC_PATH=$source_path/pc-bios/s390-ccw" >> $config_mak
-    write_target_makefile >> $config_mak
+    write_target_makefile pc-bios/s390-ccw/all >> $config_mak
     # SLOF is required for building the s390-ccw firmware on s390x,
     # since it is using the libnet code from SLOF for network booting.
     git_submodules="${git_submodules} roms/SLOF"
@@ -2554,7 +2560,7 @@ for target in $target_list; do
       ;;
   esac
 
-  if probe_target_compiler $target || test -n "$container_image"; then
+  if probe_target_compiler $target; then
       test -n "$container_image" && build_static=y
       mkdir -p "tests/tcg/$target"
       config_target_mak=tests/tcg/$target/config-target.mak
-- 
2.34.1



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

* [PULL 29/54] pc-bios/optionrom: Adopt meson style Make output
  2022-10-04 13:00 [PULL 00/54] testing, gdbstub, plugin and gitdm updates Alex Bennée
                   ` (27 preceding siblings ...)
  2022-10-04 13:01 ` [PULL 28/54] configure: build ROMs with container-based cross compilers Alex Bennée
@ 2022-10-04 13:01 ` Alex Bennée
  2022-10-04 13:01 ` [PULL 30/54] pc-bios/s390-ccw: " Alex Bennée
                   ` (25 subsequent siblings)
  54 siblings, 0 replies; 64+ messages in thread
From: Alex Bennée @ 2022-10-04 13:01 UTC (permalink / raw)
  To: qemu-devel; +Cc: stefanha, Paolo Bonzini, Alex Bennée

From: Paolo Bonzini <pbonzini@redhat.com>

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20220929114231.583801-30-alex.bennee@linaro.org>

diff --git a/pc-bios/optionrom/Makefile b/pc-bios/optionrom/Makefile
index f514e4f84b..b1fff0ba6c 100644
--- a/pc-bios/optionrom/Makefile
+++ b/pc-bios/optionrom/Makefile
@@ -12,8 +12,8 @@ NULL :=
 SPACE := $(NULL) #
 TARGET_PREFIX := $(patsubst %/,%:$(SPACE),$(TARGET_DIR))
 
-quiet-@ = $(if $(V),,@)
-quiet-command = $(if $(V),$1,$(if $(2),@printf "  %-7s %s\n" $2 $3 && $1, @$1))
+quiet-@ = $(if $(V),,@$(if $1,printf "%s\n" "$(TARGET_PREFIX)$1" && ))
+quiet-command = $(call quiet-@,$2 $@)$1
 
 # Flags for dependency generation
 override CPPFLAGS += -MMD -MP -MT $@ -MF $(@D)/$(*F).d
@@ -41,19 +41,19 @@ override LDFLAGS = -nostdlib -Wl,-T,$(SRC_DIR)/flat.lds
 pvh.img: pvh.o pvh_main.o
 
 %.o: %.S
-	$(call quiet-command,$(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<,"AS","$@")
+	$(call quiet-command,$(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<,Assembling)
 
 %.o: %.c
-	$(call quiet-command,$(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@,"CC","$@")
+	$(call quiet-command,$(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@,Compiling)
 
 %.img: %.o
-	$(call quiet-command,$(CC) $(CFLAGS) $(LDFLAGS) -s -o $@ $^,"BUILD","$@")
+	$(call quiet-command,$(CC) $(CFLAGS) $(LDFLAGS) -s -o $@ $^,Linking)
 
 %.raw: %.img
-	$(call quiet-command,$(OBJCOPY) -O binary -j .text $< $@,"BUILD","$@")
+	$(call quiet-command,$(OBJCOPY) -O binary -j .text $< $@,Extracting raw object)
 
 %.bin: %.raw
-	$(call quiet-command,$(PYTHON) $(TOPSRC_DIR)/scripts/signrom.py $< $@,"SIGN","$@")
+	$(call quiet-command,$(PYTHON) $(TOPSRC_DIR)/scripts/signrom.py $< $@,Computing checksum into)
 
 include $(wildcard *.d)
 
-- 
2.34.1



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

* [PULL 30/54] pc-bios/s390-ccw: Adopt meson style Make output
  2022-10-04 13:00 [PULL 00/54] testing, gdbstub, plugin and gitdm updates Alex Bennée
                   ` (28 preceding siblings ...)
  2022-10-04 13:01 ` [PULL 29/54] pc-bios/optionrom: Adopt meson style Make output Alex Bennée
@ 2022-10-04 13:01 ` Alex Bennée
  2022-10-04 13:01 ` [PULL 31/54] pc-bios/vof: " Alex Bennée
                   ` (24 subsequent siblings)
  54 siblings, 0 replies; 64+ messages in thread
From: Alex Bennée @ 2022-10-04 13:01 UTC (permalink / raw)
  To: qemu-devel
  Cc: stefanha, Paolo Bonzini, Alex Bennée, Christian Borntraeger,
	Thomas Huth, Cornelia Huck, open list:S390-ccw boot

From: Paolo Bonzini <pbonzini@redhat.com>

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20220929114231.583801-31-alex.bennee@linaro.org>

diff --git a/pc-bios/s390-ccw/netboot.mak b/pc-bios/s390-ccw/netboot.mak
index ee59a5f4de..046aa35587 100644
--- a/pc-bios/s390-ccw/netboot.mak
+++ b/pc-bios/s390-ccw/netboot.mak
@@ -11,10 +11,10 @@ NETLDFLAGS := $(LDFLAGS) -Wl,-Ttext=0x7800000
 $(NETOBJS): EXTRA_CFLAGS += $(LIBC_INC) $(LIBNET_INC)
 
 s390-netboot.elf: $(NETOBJS) libnet.a libc.a
-	$(call quiet-command,$(CC) $(NETLDFLAGS) -o $@ $^,"BUILD","$(TARGET_DIR)$@")
+	$(call quiet-command,$(CC) $(NETLDFLAGS) -o $@ $^,Linking)
 
 s390-netboot.img: s390-netboot.elf
-	$(call quiet-command,$(STRIP) --strip-unneeded $< -o $@,"STRIP","$(TARGET_DIR)$@")
+	$(call quiet-command,$(STRIP) --strip-unneeded $< -o $@,Stripping $< into)
 
 # libc files:
 
@@ -23,30 +23,30 @@ LIBC_CFLAGS = $(EXTRA_CFLAGS) $(CFLAGS) $(LIBC_INC) $(LIBNET_INC) \
 
 CTYPE_OBJS = isdigit.o isxdigit.o toupper.o
 %.o : $(SLOF_DIR)/lib/libc/ctype/%.c
-	$(call quiet-command,$(CC) $(LIBC_CFLAGS) -c -o $@ $<,"CC","$(TARGET_DIR)$@")
+	$(call quiet-command,$(CC) $(LIBC_CFLAGS) -c -o $@ $<,Compiling)
 
 STRING_OBJS = strcat.o strchr.o strrchr.o strcpy.o strlen.o strncpy.o \
 	      strcmp.o strncmp.o strcasecmp.o strncasecmp.o strstr.o \
 	      memset.o memcpy.o memmove.o memcmp.o
 %.o : $(SLOF_DIR)/lib/libc/string/%.c
-	$(call quiet-command,$(CC) $(LIBC_CFLAGS) -c -o $@ $<,"CC","$(TARGET_DIR)$@")
+	$(call quiet-command,$(CC) $(LIBC_CFLAGS) -c -o $@ $<,Compiling)
 
 STDLIB_OBJS = atoi.o atol.o strtoul.o strtol.o rand.o malloc.o free.o
 %.o : $(SLOF_DIR)/lib/libc/stdlib/%.c
-	$(call quiet-command,$(CC) $(LIBC_CFLAGS) -c -o $@ $<,"CC","$(TARGET_DIR)$@")
+	$(call quiet-command,$(CC) $(LIBC_CFLAGS) -c -o $@ $<,Compiling)
 
 STDIO_OBJS = sprintf.o snprintf.o vfprintf.o vsnprintf.o vsprintf.o fprintf.o \
 	     printf.o putc.o puts.o putchar.o stdchnls.o fileno.o
 %.o : $(SLOF_DIR)/lib/libc/stdio/%.c
-	$(call quiet-command,$(CC) $(LIBC_CFLAGS) -c -o $@ $<,"CC","$(TARGET_DIR)$@")
+	$(call quiet-command,$(CC) $(LIBC_CFLAGS) -c -o $@ $<,Compiling)
 
 sbrk.o: $(SLOF_DIR)/slof/sbrk.c
-	$(call quiet-command,$(CC) $(LIBC_CFLAGS) -c -o $@ $<,"CC","$(TARGET_DIR)$@")
+	$(call quiet-command,$(CC) $(LIBC_CFLAGS) -c -o $@ $<,Compiling)
 
 LIBCOBJS := $(STRING_OBJS) $(CTYPE_OBJS) $(STDLIB_OBJS) $(STDIO_OBJS) sbrk.o
 
 libc.a: $(LIBCOBJS)
-	$(call quiet-command,$(AR) -rc $@ $^,"AR","$(TARGET_DIR)$@")
+	$(call quiet-command,$(AR) -rc $@ $^,Creating static library)
 
 # libnet files:
 
@@ -56,7 +56,7 @@ LIBNETCFLAGS = $(EXTRA_CFLAGS) $(CFLAGS) $(LIBC_INC) $(LIBNET_INC) \
 	       -DDHCPARCH=0x1F -MMD -MP -MT $@ -MF $(@:%.o=%.d)
 
 %.o : $(SLOF_DIR)/lib/libnet/%.c
-	$(call quiet-command,$(CC) $(LIBNETCFLAGS) -c -o $@ $<,"CC","$(TARGET_DIR)$@")
+	$(call quiet-command,$(CC) $(LIBNETCFLAGS) -c -o $@ $<,Compiling)
 
 libnet.a: $(LIBNETOBJS)
-	$(call quiet-command,$(AR) -rc $@ $^,"AR","$(TARGET_DIR)$@")
+	$(call quiet-command,$(AR) -rc $@ $^,Creating static library)
diff --git a/pc-bios/s390-ccw/Makefile b/pc-bios/s390-ccw/Makefile
index 965e633f43..10e8f5cb63 100644
--- a/pc-bios/s390-ccw/Makefile
+++ b/pc-bios/s390-ccw/Makefile
@@ -10,8 +10,8 @@ NULL :=
 SPACE := $(NULL) #
 TARGET_PREFIX := $(patsubst %/,%:$(SPACE),$(TARGET_DIR))
 
-quiet-@ = $(if $(V),,@)
-quiet-command = $(if $(V),$1,$(if $(2),@printf "  %-7s %s\n" $2 $3 && $1, @$1))
+quiet-@ = $(if $(V),,@$(if $1,printf "%s\n" "$(TARGET_PREFIX)$1" && ))
+quiet-command = $(call quiet-@,$2 $@)$1
 
 VPATH_SUFFIXES = %.c %.h %.S %.m %.mak %.sh %.rc Kconfig% %.json.in
 set-vpath = $(if $1,$(foreach PATTERN,$(VPATH_SUFFIXES),$(eval vpath $(PATTERN) $1)))
@@ -22,11 +22,11 @@ QEMU_DGFLAGS = -MMD -MP -MT $@ -MF $(@D)/$(*F).d
 
 %.o: %.c
 	$(call quiet-command,$(CC) $(EXTRA_CFLAGS) $(QEMU_DGFLAGS) $(CFLAGS) \
-	       -c -o $@ $<,"CC","$(TARGET_DIR)$@")
+	       -c -o $@ $<,Compiling)
 
 %.o: %.S
 	$(call quiet-command,$(CCAS) $(EXTRA_CFLAGS) $(QEMU_DGFLAGS) $(CFLAGS) \
-	       -c -o $@ $<,"CCAS","$(TARGET_DIR)$@")
+	       -c -o $@ $<,Assembling)
 
 .PHONY : all clean build-all distclean
 
@@ -58,10 +58,10 @@ LDFLAGS += -Wl,-pie -nostdlib
 build-all: s390-ccw.img s390-netboot.img
 
 s390-ccw.elf: $(OBJECTS)
-	$(call quiet-command,$(CC) $(LDFLAGS) -o $@ $(OBJECTS),"BUILD","$(TARGET_DIR)$@")
+	$(call quiet-command,$(CC) $(LDFLAGS) -o $@ $(OBJECTS),Linking)
 
 s390-ccw.img: s390-ccw.elf
-	$(call quiet-command,$(STRIP) --strip-unneeded $< -o $@,"STRIP","$(TARGET_DIR)$@")
+	$(call quiet-command,$(STRIP) --strip-unneeded $< -o $@,Stripping $< into)
 
 $(OBJECTS): Makefile
 
-- 
2.34.1



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

* [PULL 31/54] pc-bios/vof: Adopt meson style Make output
  2022-10-04 13:00 [PULL 00/54] testing, gdbstub, plugin and gitdm updates Alex Bennée
                   ` (29 preceding siblings ...)
  2022-10-04 13:01 ` [PULL 30/54] pc-bios/s390-ccw: " Alex Bennée
@ 2022-10-04 13:01 ` Alex Bennée
  2022-10-04 13:01 ` [PULL 32/54] monitor: expose monitor_puts to rest of code Alex Bennée
                   ` (23 subsequent siblings)
  54 siblings, 0 replies; 64+ messages in thread
From: Alex Bennée @ 2022-10-04 13:01 UTC (permalink / raw)
  To: qemu-devel
  Cc: stefanha, Paolo Bonzini, Alex Bennée, Alexey Kardashevskiy,
	Cédric Le Goater, Daniel Henrique Barboza, David Gibson,
	Greg Kurz, open list:Virtual Open Firm...

From: Paolo Bonzini <pbonzini@redhat.com>

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20220929114231.583801-32-alex.bennee@linaro.org>

diff --git a/pc-bios/vof/Makefile b/pc-bios/vof/Makefile
index 4e59009e67..d1eb6ced7e 100644
--- a/pc-bios/vof/Makefile
+++ b/pc-bios/vof/Makefile
@@ -2,19 +2,26 @@ include config.mak
 VPATH=$(SRC_DIR)
 all: vof.bin
 
+NULL :=
+SPACE := $(NULL) #
+TARGET_PREFIX := $(patsubst %/,%:$(SPACE),$(TARGET_DIR))
+
+quiet-@ = $(if $(V),,@$(if $1,,printf "%s\n" "$(TARGET_PREFIX)$1" && ))
+quiet-command = $(call quiet-@,$2 $@)$1
+
 EXTRA_CFLAGS += -mcpu=power4
 
 %.o: %.S
-	$(CC) $(EXTRA_CFLAGS) -c -o $@ $<
+	$(call quiet-command, $(CC) $(EXTRA_CFLAGS) -c -o $@ $<,Assembling)
 
 %.o: %.c
-	$(CC) $(EXTRA_CFLAGS) -c -fno-stack-protector -o $@ $<
+	$(call quiet-command, $(CC) $(EXTRA_CFLAGS) -c -fno-stack-protector -o $@ $<,Compiling)
 
 vof.elf: entry.o main.o ci.o bootmem.o libc.o
-	$(LD) -nostdlib -e_start -T$(SRC_DIR)/vof.lds -EB -o $@ $^
+	$(call quiet-command, $(LD) -nostdlib -e_start -T$(SRC_DIR)/vof.lds -EB -o $@ $^,Linking)
 
 %.bin: %.elf
-	$(OBJCOPY) -O binary -j .text -j .data -j .toc -j .got2 $^ $@
+	$(call quiet-command, $(OBJCOPY) -O binary -j .text -j .data -j .toc -j .got2 $^ $@,Extracting raw object)
 
 clean:
 	rm -f *.o vof.bin vof.elf *~
-- 
2.34.1



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

* [PULL 32/54] monitor: expose monitor_puts to rest of code
  2022-10-04 13:00 [PULL 00/54] testing, gdbstub, plugin and gitdm updates Alex Bennée
                   ` (30 preceding siblings ...)
  2022-10-04 13:01 ` [PULL 31/54] pc-bios/vof: " Alex Bennée
@ 2022-10-04 13:01 ` Alex Bennée
  2022-10-04 13:01 ` [PULL 33/54] disas: generalise plugin_printf and use for monitor_disas Alex Bennée
                   ` (22 subsequent siblings)
  54 siblings, 0 replies; 64+ messages in thread
From: Alex Bennée @ 2022-10-04 13:01 UTC (permalink / raw)
  To: qemu-devel
  Cc: stefanha, Alex Bennée, Richard Henderson, Kevin Wolf,
	Markus Armbruster, Philippe Mathieu-Daudé,
	Hanna Reitz, Mark Cave-Ayland, Dr. David Alan Gilbert,
	open list:Block layer core, open list:New World (mac99)

This helps us construct strings elsewhere before echoing to the
monitor. It avoids having to jump through hoops like:

  monitor_printf(mon, "%s", s->str);

It will be useful in following patches but for now convert all
existing plain "%s" printfs to use the _puts api.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20220929114231.583801-33-alex.bennee@linaro.org>

diff --git a/docs/devel/writing-monitor-commands.rst b/docs/devel/writing-monitor-commands.rst
index 4aa2bb904d..2fefedcd98 100644
--- a/docs/devel/writing-monitor-commands.rst
+++ b/docs/devel/writing-monitor-commands.rst
@@ -716,7 +716,7 @@ message. Here's the implementation of the "info roms" HMP command::
      if (hmp_handle_error(mon, err)) {
          return;
      }
-     monitor_printf(mon, "%s", info->human_readable_text);
+     monitor_puts(mon, info->human_readable_text);
  }
 
 Also, you have to add the function's prototype to the hmp.h file.
diff --git a/include/monitor/monitor.h b/include/monitor/monitor.h
index a4b40e8391..737e750670 100644
--- a/include/monitor/monitor.h
+++ b/include/monitor/monitor.h
@@ -31,6 +31,7 @@ void monitor_resume(Monitor *mon);
 int monitor_get_fd(Monitor *mon, const char *fdname, Error **errp);
 int monitor_fd_param(Monitor *mon, const char *fdname, Error **errp);
 
+int monitor_puts(Monitor *mon, const char *str);
 int monitor_vprintf(Monitor *mon, const char *fmt, va_list ap)
     G_GNUC_PRINTF(2, 0);
 int monitor_printf(Monitor *mon, const char *fmt, ...) G_GNUC_PRINTF(2, 3);
diff --git a/monitor/monitor-internal.h b/monitor/monitor-internal.h
index caa2e90ef2..a2cdbbf646 100644
--- a/monitor/monitor-internal.h
+++ b/monitor/monitor-internal.h
@@ -174,7 +174,6 @@ extern int mon_refcount;
 
 extern HMPCommand hmp_cmds[];
 
-int monitor_puts(Monitor *mon, const char *str);
 void monitor_data_init(Monitor *mon, bool is_qmp, bool skip_flush,
                        bool use_io_thread);
 void monitor_data_destroy(Monitor *mon);
diff --git a/block/monitor/block-hmp-cmds.c b/block/monitor/block-hmp-cmds.c
index bfb3c043a0..939a520d17 100644
--- a/block/monitor/block-hmp-cmds.c
+++ b/block/monitor/block-hmp-cmds.c
@@ -638,16 +638,16 @@ static void print_block_info(Monitor *mon, BlockInfo *info,
     assert(!info || !info->has_inserted || info->inserted == inserted);
 
     if (info && *info->device) {
-        monitor_printf(mon, "%s", info->device);
+        monitor_puts(mon, info->device);
         if (inserted && inserted->has_node_name) {
             monitor_printf(mon, " (%s)", inserted->node_name);
         }
     } else {
         assert(info || inserted);
-        monitor_printf(mon, "%s",
-                       inserted && inserted->has_node_name ? inserted->node_name
-                       : info && info->has_qdev ? info->qdev
-                       : "<anonymous>");
+        monitor_puts(mon,
+                     inserted && inserted->has_node_name ? inserted->node_name
+                     : info && info->has_qdev ? info->qdev
+                     : "<anonymous>");
     }
 
     if (inserted) {
diff --git a/hw/misc/mos6522.c b/hw/misc/mos6522.c
index f9e646350e..fe38c44426 100644
--- a/hw/misc/mos6522.c
+++ b/hw/misc/mos6522.c
@@ -595,7 +595,7 @@ void hmp_info_via(Monitor *mon, const QDict *qdict)
     if (hmp_handle_error(mon, err)) {
         return;
     }
-    monitor_printf(mon, "%s", info->human_readable_text);
+    monitor_puts(mon, info->human_readable_text);
 }
 
 static const MemoryRegionOps mos6522_ops = {
diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
index c6cd6f91dd..f90eea8d01 100644
--- a/monitor/hmp-cmds.c
+++ b/monitor/hmp-cmds.c
@@ -730,7 +730,7 @@ static void hmp_info_pci_device(Monitor *mon, const PciDeviceInfo *dev)
     monitor_printf(mon, "    ");
 
     if (dev->class_info->has_desc) {
-        monitor_printf(mon, "%s", dev->class_info->desc);
+        monitor_puts(mon, dev->class_info->desc);
     } else {
         monitor_printf(mon, "Class %04" PRId64, dev->class_info->q_class);
     }
@@ -2258,12 +2258,12 @@ static void print_stats_schema_value(Monitor *mon, StatsSchemaValue *value)
     if (unit && value->base == 10 &&
         value->exponent >= -18 && value->exponent <= 18 &&
         value->exponent % 3 == 0) {
-        monitor_printf(mon, "%s", si_prefix(value->exponent));
+        monitor_puts(mon, si_prefix(value->exponent));
     } else if (unit && value->base == 2 &&
                value->exponent >= 0 && value->exponent <= 60 &&
                value->exponent % 10 == 0) {
 
-        monitor_printf(mon, "%s", iec_binary_prefix(value->exponent));
+        monitor_puts(mon, iec_binary_prefix(value->exponent));
     } else if (value->exponent) {
         /* Use exponential notation and write the unit's English name */
         monitor_printf(mon, "* %d^%d%s",
@@ -2273,7 +2273,7 @@ static void print_stats_schema_value(Monitor *mon, StatsSchemaValue *value)
     }
 
     if (value->has_unit) {
-        monitor_printf(mon, "%s", unit ? unit : StatsUnit_str(value->unit));
+        monitor_puts(mon, unit ? unit : StatsUnit_str(value->unit));
     }
 
     /* Print bucket size for linear histograms */
diff --git a/monitor/hmp.c b/monitor/hmp.c
index a3375d0341..43fd69f984 100644
--- a/monitor/hmp.c
+++ b/monitor/hmp.c
@@ -1094,7 +1094,7 @@ static void hmp_info_human_readable_text(Monitor *mon,
         return;
     }
 
-    monitor_printf(mon, "%s", info->human_readable_text);
+    monitor_puts(mon, info->human_readable_text);
 }
 
 static void handle_hmp_command_exec(Monitor *mon,
diff --git a/target/i386/helper.c b/target/i386/helper.c
index fa409e9c44..b954ccda50 100644
--- a/target/i386/helper.c
+++ b/target/i386/helper.c
@@ -415,7 +415,7 @@ static void do_inject_x86_mce(CPUState *cs, run_on_cpu_data data)
         if (need_reset) {
             emit_guest_memory_failure(MEMORY_FAILURE_ACTION_RESET, ar,
                                       recursive);
-            monitor_printf(params->mon, "%s", msg);
+            monitor_puts(params->mon, msg);
             qemu_log_mask(CPU_LOG_RESET, "%s\n", msg);
             qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET);
             return;
-- 
2.34.1



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

* [PULL 33/54] disas: generalise plugin_printf and use for monitor_disas
  2022-10-04 13:00 [PULL 00/54] testing, gdbstub, plugin and gitdm updates Alex Bennée
                   ` (31 preceding siblings ...)
  2022-10-04 13:01 ` [PULL 32/54] monitor: expose monitor_puts to rest of code Alex Bennée
@ 2022-10-04 13:01 ` Alex Bennée
  2022-10-04 13:01 ` [PULL 34/54] disas: use result of ->read_memory_func Alex Bennée
                   ` (21 subsequent siblings)
  54 siblings, 0 replies; 64+ messages in thread
From: Alex Bennée @ 2022-10-04 13:01 UTC (permalink / raw)
  To: qemu-devel; +Cc: stefanha, Alex Bennée, Richard Henderson

Rather than assembling our output piecemeal lets use the same approach
as the plugin disas interface to build the disassembly string before
printing it.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20220929114231.583801-34-alex.bennee@linaro.org>

diff --git a/disas.c b/disas.c
index e31438f349..f07b6e760b 100644
--- a/disas.c
+++ b/disas.c
@@ -239,7 +239,7 @@ void target_disas(FILE *out, CPUState *cpu, target_ulong code,
     }
 }
 
-static int plugin_printf(FILE *stream, const char *fmt, ...)
+static int gstring_printf(FILE *stream, const char *fmt, ...)
 {
     /* We abuse the FILE parameter to pass a GString. */
     GString *s = (GString *)stream;
@@ -270,7 +270,7 @@ char *plugin_disas(CPUState *cpu, uint64_t addr, size_t size)
     GString *ds = g_string_new(NULL);
 
     initialize_debug_target(&s, cpu);
-    s.info.fprintf_func = plugin_printf;
+    s.info.fprintf_func = gstring_printf;
     s.info.stream = (FILE *)ds;  /* abuse this slot */
     s.info.buffer_vma = addr;
     s.info.buffer_length = size;
@@ -358,15 +358,19 @@ void monitor_disas(Monitor *mon, CPUState *cpu,
 {
     int count, i;
     CPUDebug s;
+    g_autoptr(GString) ds = g_string_new("");
 
     initialize_debug_target(&s, cpu);
-    s.info.fprintf_func = qemu_fprintf;
+    s.info.fprintf_func = gstring_printf;
+    s.info.stream = (FILE *)ds;  /* abuse this slot */
+
     if (is_physical) {
         s.info.read_memory_func = physical_read_memory;
     }
     s.info.buffer_vma = pc;
 
     if (s.info.cap_arch >= 0 && cap_disas_monitor(&s.info, pc, nb_insn)) {
+        monitor_puts(mon, ds->str);
         return;
     }
 
@@ -376,13 +380,16 @@ void monitor_disas(Monitor *mon, CPUState *cpu,
         return;
     }
 
-    for(i = 0; i < nb_insn; i++) {
-	monitor_printf(mon, "0x" TARGET_FMT_lx ":  ", pc);
+    for (i = 0; i < nb_insn; i++) {
+        g_string_append_printf(ds, "0x" TARGET_FMT_lx ":  ", pc);
         count = s.info.print_insn(pc, &s.info);
-	monitor_printf(mon, "\n");
-	if (count < 0)
-	    break;
+        g_string_append_c(ds, '\n');
+        if (count < 0) {
+            break;
+        }
         pc += count;
     }
+
+    monitor_puts(mon, ds->str);
 }
 #endif
-- 
2.34.1



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

* [PULL 34/54] disas: use result of ->read_memory_func
  2022-10-04 13:00 [PULL 00/54] testing, gdbstub, plugin and gitdm updates Alex Bennée
                   ` (32 preceding siblings ...)
  2022-10-04 13:01 ` [PULL 33/54] disas: generalise plugin_printf and use for monitor_disas Alex Bennée
@ 2022-10-04 13:01 ` Alex Bennée
  2022-10-04 13:01 ` [PULL 35/54] plugins: extend execlog to filter matches Alex Bennée
                   ` (20 subsequent siblings)
  54 siblings, 0 replies; 64+ messages in thread
From: Alex Bennée @ 2022-10-04 13:01 UTC (permalink / raw)
  To: qemu-devel
  Cc: stefanha, Alex Bennée, Richard Henderson,
	Philippe Mathieu-Daudé

This gets especially confusing if you start plugging in host addresses
from a trace and you wonder why the output keeps changing. Report when
read_memory_func fails instead of blindly disassembling the buffer
contents.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20220929114231.583801-35-alex.bennee@linaro.org>

diff --git a/disas.c b/disas.c
index f07b6e760b..94d3b45042 100644
--- a/disas.c
+++ b/disas.c
@@ -83,18 +83,18 @@ static int print_insn_objdump(bfd_vma pc, disassemble_info *info,
                               const char *prefix)
 {
     int i, n = info->buffer_length;
-    uint8_t *buf = g_malloc(n);
-
-    info->read_memory_func(pc, buf, n, info);
-
-    for (i = 0; i < n; ++i) {
-        if (i % 32 == 0) {
-            info->fprintf_func(info->stream, "\n%s: ", prefix);
+    g_autofree uint8_t *buf = g_malloc(n);
+
+    if (info->read_memory_func(pc, buf, n, info) == 0) {
+        for (i = 0; i < n; ++i) {
+            if (i % 32 == 0) {
+                info->fprintf_func(info->stream, "\n%s: ", prefix);
+            }
+            info->fprintf_func(info->stream, "%02x", buf[i]);
         }
-        info->fprintf_func(info->stream, "%02x", buf[i]);
+    } else {
+        info->fprintf_func(info->stream, "unable to read memory");
     }
-
-    g_free(buf);
     return n;
 }
 
diff --git a/disas/capstone.c b/disas/capstone.c
index 20bc8f9669..fe3efb0d3c 100644
--- a/disas/capstone.c
+++ b/disas/capstone.c
@@ -191,37 +191,43 @@ bool cap_disas_target(disassemble_info *info, uint64_t pc, size_t size)
         size_t tsize = MIN(sizeof(cap_buf) - csize, size);
         const uint8_t *cbuf = cap_buf;
 
-        info->read_memory_func(pc + csize, cap_buf + csize, tsize, info);
-        csize += tsize;
-        size -= tsize;
+        if (info->read_memory_func(pc + csize, cap_buf + csize, tsize, info) == 0) {
+            csize += tsize;
+            size -= tsize;
 
-        while (cs_disasm_iter(handle, &cbuf, &csize, &pc, insn)) {
-            cap_dump_insn(info, insn);
-        }
+            while (cs_disasm_iter(handle, &cbuf, &csize, &pc, insn)) {
+                cap_dump_insn(info, insn);
+            }
+
+            /* If the target memory is not consumed, go back for more... */
+            if (size != 0) {
+                /*
+                 * ... taking care to move any remaining fractional insn
+                 * to the beginning of the buffer.
+                 */
+                if (csize != 0) {
+                    memmove(cap_buf, cbuf, csize);
+                }
+                continue;
+            }
 
-        /* If the target memory is not consumed, go back for more... */
-        if (size != 0) {
             /*
-             * ... taking care to move any remaining fractional insn
-             * to the beginning of the buffer.
+             * Since the target memory is consumed, we should not have
+             * a remaining fractional insn.
              */
             if (csize != 0) {
-                memmove(cap_buf, cbuf, csize);
+                info->fprintf_func(info->stream,
+                                   "Disassembler disagrees with translator "
+                                   "over instruction decoding\n"
+                                   "Please report this to qemu-devel@nongnu.org\n");
             }
-            continue;
-        }
+            break;
 
-        /*
-         * Since the target memory is consumed, we should not have
-         * a remaining fractional insn.
-         */
-        if (csize != 0) {
+        } else {
             info->fprintf_func(info->stream,
-                "Disassembler disagrees with translator "
-                "over instruction decoding\n"
-                "Please report this to qemu-devel@nongnu.org\n");
+                               "0x%08" PRIx64 ": unable to read memory\n", pc);
+            break;
         }
-        break;
     }
 
     cs_close(&handle);
@@ -286,16 +292,23 @@ bool cap_disas_monitor(disassemble_info *info, uint64_t pc, int count)
 
         /* Make certain that we can make progress.  */
         assert(tsize != 0);
-        info->read_memory_func(pc + csize, cap_buf + csize, tsize, info);
-        csize += tsize;
-
-        if (cs_disasm_iter(handle, &cbuf, &csize, &pc, insn)) {
-            cap_dump_insn(info, insn);
-            if (--count <= 0) {
-                break;
+        if (info->read_memory_func(pc + csize, cap_buf + csize,
+                                   tsize, info) == 0)
+        {
+            csize += tsize;
+
+            if (cs_disasm_iter(handle, &cbuf, &csize, &pc, insn)) {
+                cap_dump_insn(info, insn);
+                if (--count <= 0) {
+                    break;
+                }
             }
+            memmove(cap_buf, cbuf, csize);
+        } else {
+            info->fprintf_func(info->stream,
+                               "0x%08" PRIx64 ": unable to read memory\n", pc);
+            break;
         }
-        memmove(cap_buf, cbuf, csize);
     }
 
     cs_close(&handle);
-- 
2.34.1



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

* [PULL 35/54] plugins: extend execlog to filter matches
  2022-10-04 13:00 [PULL 00/54] testing, gdbstub, plugin and gitdm updates Alex Bennée
                   ` (33 preceding siblings ...)
  2022-10-04 13:01 ` [PULL 34/54] disas: use result of ->read_memory_func Alex Bennée
@ 2022-10-04 13:01 ` Alex Bennée
  2022-10-04 13:01 ` [PULL 36/54] plugins: Assert mmu_idx in range before use in qemu_plugin_get_hwaddr Alex Bennée
                   ` (19 subsequent siblings)
  54 siblings, 0 replies; 64+ messages in thread
From: Alex Bennée @ 2022-10-04 13:01 UTC (permalink / raw)
  To: qemu-devel
  Cc: stefanha, Alex Bennée, Alexandre Iooss, Robert Henry,
	Aaron Lindsay, Mahmoud Mandour

Sometimes the whole execlog is just two much so add the ability to
filter by instruction opcode or address.

[AJB: this shows for example

 qemu-system-aarch64 -display none -serial mon:stdio \
   -M virt -cpu max \
   -semihosting-config enable=on \
   -kernel ./tests/tcg/aarch64-softmmu/memory-sve \
   -plugin ./contrib/plugins/libexeclog.so,ifilter=st1w,afilter=0x40001808 -d plugin -D plugin.out

the st1w SVE instruction is not instrumenting its stores.]

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Alexandre Iooss <erdnaxe@crans.org>
Cc: Robert Henry <robhenry@microsoft.com>
Cc: Aaron Lindsay <aaron@os.amperecomputing.com>
Message-Id: <20220929114231.583801-36-alex.bennee@linaro.org>

diff --git a/docs/devel/tcg-plugins.rst b/docs/devel/tcg-plugins.rst
index a7cc44aa20..a503d44cee 100644
--- a/docs/devel/tcg-plugins.rst
+++ b/docs/devel/tcg-plugins.rst
@@ -346,7 +346,7 @@ The execlog tool traces executed instructions with memory access. It can be used
 for debugging and security analysis purposes.
 Please be aware that this will generate a lot of output.
 
-The plugin takes no argument::
+The plugin needs default argument::
 
   qemu-system-arm $(QEMU_ARGS) \
     -plugin ./contrib/plugins/libexeclog.so -d plugin
@@ -364,6 +364,13 @@ which will output an execution trace following this structure::
   0, 0xd34, 0xf9c8f000, "bl #0x10c8"
   0, 0x10c8, 0xfff96c43, "ldr r3, [r0, #0x44]", load, 0x200000e4, RAM
 
+the output can be filtered to only track certain instructions or
+addresses using the `ifilter` or `afilter` options. You can stack the
+arguments if required::
+
+  qemu-system-arm $(QEMU_ARGS) \
+    -plugin ./contrib/plugins/libexeclog.so,ifilter=st1w,afilter=0x40001808 -d plugin
+
 - contrib/plugins/cache.c
 
 Cache modelling plugin that measures the performance of a given L1 cache
diff --git a/contrib/plugins/execlog.c b/contrib/plugins/execlog.c
index a5275dcc15..e659ac9cbb 100644
--- a/contrib/plugins/execlog.c
+++ b/contrib/plugins/execlog.c
@@ -20,6 +20,9 @@ QEMU_PLUGIN_EXPORT int qemu_plugin_version = QEMU_PLUGIN_VERSION;
 /* Store last executed instruction on each vCPU as a GString */
 GArray *last_exec;
 
+static GPtrArray *imatches;
+static GArray *amatches;
+
 /**
  * Add memory read or write information to current instruction log
  */
@@ -85,12 +88,13 @@ static void vcpu_insn_exec(unsigned int cpu_index, void *udata)
 static void vcpu_tb_trans(qemu_plugin_id_t id, struct qemu_plugin_tb *tb)
 {
     struct qemu_plugin_insn *insn;
-    uint64_t insn_vaddr;
-    uint32_t insn_opcode;
-    char *insn_disas;
+    bool skip = (imatches || amatches) ? true : false;
 
     size_t n = qemu_plugin_tb_n_insns(tb);
     for (size_t i = 0; i < n; i++) {
+        char *insn_disas;
+        uint64_t insn_vaddr;
+
         /*
          * `insn` is shared between translations in QEMU, copy needed data here.
          * `output` is never freed as it might be used multiple times during
@@ -99,20 +103,52 @@ static void vcpu_tb_trans(qemu_plugin_id_t id, struct qemu_plugin_tb *tb)
          * a limitation for CISC architectures.
          */
         insn = qemu_plugin_tb_get_insn(tb, i);
-        insn_vaddr = qemu_plugin_insn_vaddr(insn);
-        insn_opcode = *((uint32_t *)qemu_plugin_insn_data(insn));
         insn_disas = qemu_plugin_insn_disas(insn);
-        char *output = g_strdup_printf("0x%"PRIx64", 0x%"PRIx32", \"%s\"",
-                                       insn_vaddr, insn_opcode, insn_disas);
+        insn_vaddr = qemu_plugin_insn_vaddr(insn);
+
+        /*
+         * If we are filtering we better check out if we have any
+         * hits. The skip "latches" so we can track memory accesses
+         * after the instruction we care about.
+         */
+        if (skip && imatches) {
+            int j;
+            for (j = 0; j < imatches->len && skip; j++) {
+                char *m = g_ptr_array_index(imatches, j);
+                if (g_str_has_prefix(insn_disas, m)) {
+                    skip = false;
+                }
+            }
+        }
+
+        if (skip && amatches) {
+            int j;
+            for (j = 0; j < amatches->len && skip; j++) {
+                uint64_t v = g_array_index(amatches, uint64_t, j);
+                if (v == insn_vaddr) {
+                    skip = false;
+                }
+            }
+        }
 
-        /* Register callback on memory read or write */
-        qemu_plugin_register_vcpu_mem_cb(insn, vcpu_mem,
-                                         QEMU_PLUGIN_CB_NO_REGS,
-                                         QEMU_PLUGIN_MEM_RW, NULL);
+        if (skip) {
+            g_free(insn_disas);
+        } else {
+            uint32_t insn_opcode;
+            insn_opcode = *((uint32_t *)qemu_plugin_insn_data(insn));
+            char *output = g_strdup_printf("0x%"PRIx64", 0x%"PRIx32", \"%s\"",
+                                           insn_vaddr, insn_opcode, insn_disas);
+
+            /* Register callback on memory read or write */
+            qemu_plugin_register_vcpu_mem_cb(insn, vcpu_mem,
+                                             QEMU_PLUGIN_CB_NO_REGS,
+                                             QEMU_PLUGIN_MEM_RW, NULL);
+
+            /* Register callback on instruction */
+            qemu_plugin_register_vcpu_insn_exec_cb(insn, vcpu_insn_exec,
+                                                   QEMU_PLUGIN_CB_NO_REGS, output);
+        }
 
-        /* Register callback on instruction */
-        qemu_plugin_register_vcpu_insn_exec_cb(insn, vcpu_insn_exec,
-                                               QEMU_PLUGIN_CB_NO_REGS, output);
     }
 }
 
@@ -132,6 +168,25 @@ static void plugin_exit(qemu_plugin_id_t id, void *p)
     }
 }
 
+/* Add a match to the array of matches */
+static void parse_insn_match(char *match)
+{
+    if (!imatches) {
+        imatches = g_ptr_array_new();
+    }
+    g_ptr_array_add(imatches, match);
+}
+
+static void parse_vaddr_match(char *match)
+{
+    uint64_t v = g_ascii_strtoull(match, NULL, 16);
+
+    if (!amatches) {
+        amatches = g_array_new(false, true, sizeof(uint64_t));
+    }
+    g_array_append_val(amatches, v);
+}
+
 /**
  * Install the plugin
  */
@@ -145,6 +200,19 @@ QEMU_PLUGIN_EXPORT int qemu_plugin_install(qemu_plugin_id_t id,
      */
     last_exec = g_array_new(FALSE, FALSE, sizeof(GString *));
 
+    for (int i = 0; i < argc; i++) {
+        char *opt = argv[i];
+        g_autofree char **tokens = g_strsplit(opt, "=", 2);
+        if (g_strcmp0(tokens[0], "ifilter") == 0) {
+            parse_insn_match(tokens[1]);
+        } else if (g_strcmp0(tokens[0], "afilter") == 0) {
+            parse_vaddr_match(tokens[1]);
+        } else {
+            fprintf(stderr, "option parsing failed: %s\n", opt);
+            return -1;
+        }
+    }
+
     /* Register translation block and exit callbacks */
     qemu_plugin_register_vcpu_tb_trans_cb(id, vcpu_tb_trans);
     qemu_plugin_register_atexit_cb(id, plugin_exit, NULL);
-- 
2.34.1



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

* [PULL 36/54] plugins: Assert mmu_idx in range before use in qemu_plugin_get_hwaddr
  2022-10-04 13:00 [PULL 00/54] testing, gdbstub, plugin and gitdm updates Alex Bennée
                   ` (34 preceding siblings ...)
  2022-10-04 13:01 ` [PULL 35/54] plugins: extend execlog to filter matches Alex Bennée
@ 2022-10-04 13:01 ` Alex Bennée
  2022-10-04 13:01 ` [PULL 37/54] docs/devel: clean-up qemu invocations in tcg-plugins Alex Bennée
                   ` (18 subsequent siblings)
  54 siblings, 0 replies; 64+ messages in thread
From: Alex Bennée @ 2022-10-04 13:01 UTC (permalink / raw)
  To: qemu-devel
  Cc: stefanha, Richard Henderson, Damien Hedde, Alex Bennée,
	Philippe Mathieu-Daudé,
	Alexandre Iooss, Mahmoud Mandour

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

Coverity reports out-of-bound accesses here.  This should be a
false positive due to how the index is decoded from MemOpIdx.

Fixes: Coverity CID 1487201
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Damien Hedde <damien.hedde@greensocs.com>
Message-Id: <20220401190233.329360-1-richard.henderson@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20220929114231.583801-37-alex.bennee@linaro.org>

diff --git a/plugins/api.c b/plugins/api.c
index 7bf71b189d..2078b16edb 100644
--- a/plugins/api.c
+++ b/plugins/api.c
@@ -289,6 +289,8 @@ struct qemu_plugin_hwaddr *qemu_plugin_get_hwaddr(qemu_plugin_meminfo_t info,
     enum qemu_plugin_mem_rw rw = get_plugin_meminfo_rw(info);
     hwaddr_info.is_store = (rw & QEMU_PLUGIN_MEM_W) != 0;
 
+    assert(mmu_idx < NB_MMU_MODES);
+
     if (!tlb_plugin_lookup(cpu, vaddr, mmu_idx,
                            hwaddr_info.is_store, &hwaddr_info)) {
         error_report("invalid use of qemu_plugin_get_hwaddr");
-- 
2.34.1



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

* [PULL 37/54] docs/devel: clean-up qemu invocations in tcg-plugins
  2022-10-04 13:00 [PULL 00/54] testing, gdbstub, plugin and gitdm updates Alex Bennée
                   ` (35 preceding siblings ...)
  2022-10-04 13:01 ` [PULL 36/54] plugins: Assert mmu_idx in range before use in qemu_plugin_get_hwaddr Alex Bennée
@ 2022-10-04 13:01 ` Alex Bennée
  2022-10-04 13:01 ` [PULL 38/54] docs/devel: move API to end of tcg-plugins.rst Alex Bennée
                   ` (17 subsequent siblings)
  54 siblings, 0 replies; 64+ messages in thread
From: Alex Bennée @ 2022-10-04 13:01 UTC (permalink / raw)
  To: qemu-devel
  Cc: stefanha, Alex Bennée, Philippe Mathieu-Daudé,
	Alexandre Iooss, Mahmoud Mandour

We currently have the final binaries in the root of the build dir so
the build prefix is superfluous. Additionally add a shell prompt to be
more in line with the rest of the code.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20220929114231.583801-38-alex.bennee@linaro.org>

diff --git a/docs/devel/tcg-plugins.rst b/docs/devel/tcg-plugins.rst
index a503d44cee..a6fdde01f8 100644
--- a/docs/devel/tcg-plugins.rst
+++ b/docs/devel/tcg-plugins.rst
@@ -172,7 +172,7 @@ slightly faster (but not thread safe) counters.
 
 Example::
 
-  ./aarch64-linux-user/qemu-aarch64 \
+  $ qemu-aarch64 \
     -plugin contrib/plugins/libhotblocks.so -d plugin \
     ./tests/tcg/aarch64-linux-user/sha1
   SHA1=15dd99a1991e0b3826fede3deffc1feba42278e6
@@ -186,7 +186,7 @@ Example::
 
 Similar to hotblocks but this time tracks memory accesses::
 
-  ./aarch64-linux-user/qemu-aarch64 \
+  $ qemu-aarch64 \
     -plugin contrib/plugins/libhotpages.so -d plugin \
     ./tests/tcg/aarch64-linux-user/sha1
   SHA1=15dd99a1991e0b3826fede3deffc1feba42278e6
@@ -220,7 +220,7 @@ counted. You can give a value to the ``count`` argument for a class of
 instructions to break it down fully, so for example to see all the system
 registers accesses::
 
-  ./aarch64-softmmu/qemu-system-aarch64 $(QEMU_ARGS) \
+  $ qemu-system-aarch64 $(QEMU_ARGS) \
     -append "root=/dev/sda2 systemd.unit=benchmark.service" \
     -smp 4 -plugin ./contrib/plugins/libhowvec.so,count=sreg -d plugin
 
@@ -288,10 +288,10 @@ for the plugin is a path for the socket the two instances will
 communicate over::
 
 
-  ./sparc-softmmu/qemu-system-sparc -monitor none -parallel none \
+  $ qemu-system-sparc -monitor none -parallel none \
     -net none -M SS-20 -m 256 -kernel day11/zImage.elf \
     -plugin ./contrib/plugins/liblockstep.so,sockpath=lockstep-sparc.sock \
-  -d plugin,nochain
+    -d plugin,nochain
 
 which will eventually report::
 
@@ -348,7 +348,7 @@ Please be aware that this will generate a lot of output.
 
 The plugin needs default argument::
 
-  qemu-system-arm $(QEMU_ARGS) \
+  $ qemu-system-arm $(QEMU_ARGS) \
     -plugin ./contrib/plugins/libexeclog.so -d plugin
 
 which will output an execution trace following this structure::
@@ -365,10 +365,10 @@ which will output an execution trace following this structure::
   0, 0x10c8, 0xfff96c43, "ldr r3, [r0, #0x44]", load, 0x200000e4, RAM
 
 the output can be filtered to only track certain instructions or
-addresses using the `ifilter` or `afilter` options. You can stack the
+addresses using the ``ifilter`` or ``afilter`` options. You can stack the
 arguments if required::
 
-  qemu-system-arm $(QEMU_ARGS) \
+  $ qemu-system-arm $(QEMU_ARGS) \
     -plugin ./contrib/plugins/libexeclog.so,ifilter=st1w,afilter=0x40001808 -d plugin
 
 - contrib/plugins/cache.c
@@ -377,7 +377,7 @@ Cache modelling plugin that measures the performance of a given L1 cache
 configuration, and optionally a unified L2 per-core cache when a given working
 set is run::
 
-    qemu-x86_64 -plugin ./contrib/plugins/libcache.so \
+  $ qemu-x86_64 -plugin ./contrib/plugins/libcache.so \
       -d plugin -D cache.log ./tests/tcg/x86_64-linux-user/float_convs
 
 will report the following::
-- 
2.34.1



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

* [PULL 38/54] docs/devel: move API to end of tcg-plugins.rst
  2022-10-04 13:00 [PULL 00/54] testing, gdbstub, plugin and gitdm updates Alex Bennée
                   ` (36 preceding siblings ...)
  2022-10-04 13:01 ` [PULL 37/54] docs/devel: clean-up qemu invocations in tcg-plugins Alex Bennée
@ 2022-10-04 13:01 ` Alex Bennée
  2022-10-04 13:01 ` [PULL 39/54] contrib/plugins: reset skip when matching in execlog Alex Bennée
                   ` (16 subsequent siblings)
  54 siblings, 0 replies; 64+ messages in thread
From: Alex Bennée @ 2022-10-04 13:01 UTC (permalink / raw)
  To: qemu-devel
  Cc: stefanha, Alex Bennée, Philippe Mathieu-Daudé,
	Alexandre Iooss, Mahmoud Mandour

The API documentation is quite dry and doesn't flow nicely with the
rest of the document. Move it to its own section at the bottom along
with a little leader text to remind people to update it.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20220929114231.583801-39-alex.bennee@linaro.org>

diff --git a/docs/devel/tcg-plugins.rst b/docs/devel/tcg-plugins.rst
index a6fdde01f8..8b40b2a606 100644
--- a/docs/devel/tcg-plugins.rst
+++ b/docs/devel/tcg-plugins.rst
@@ -110,11 +110,6 @@ details are opaque to plugins. The plugin is able to query select
 details of instructions and system configuration only through the
 exported *qemu_plugin* functions.
 
-API
-~~~
-
-.. kernel-doc:: include/qemu/qemu-plugin.h
-
 Internals
 ---------
 
@@ -448,3 +443,13 @@ The plugin has a number of arguments, all of them are optional:
   associativity of the L2 cache, respectively. Setting any of the L2
   configuration arguments implies ``l2=on``.
   (default: N = 2097152 (2MB), B = 64, A = 16)
+
+API
+---
+
+The following API is generated from the inline documentation in
+``include/qemu/qemu-plugin.h``. Please ensure any updates to the API
+include the full kernel-doc annotations.
+
+.. kernel-doc:: include/qemu/qemu-plugin.h
+
-- 
2.34.1



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

* [PULL 39/54] contrib/plugins: reset skip when matching in execlog
  2022-10-04 13:00 [PULL 00/54] testing, gdbstub, plugin and gitdm updates Alex Bennée
                   ` (37 preceding siblings ...)
  2022-10-04 13:01 ` [PULL 38/54] docs/devel: move API to end of tcg-plugins.rst Alex Bennée
@ 2022-10-04 13:01 ` Alex Bennée
  2022-10-04 13:01 ` [PULL 40/54] docs/devel: document the test plugins Alex Bennée
                   ` (15 subsequent siblings)
  54 siblings, 0 replies; 64+ messages in thread
From: Alex Bennée @ 2022-10-04 13:01 UTC (permalink / raw)
  To: qemu-devel
  Cc: stefanha, Alex Bennée, Alexandre Iooss, Richard Henderson,
	Philippe Mathieu-Daudé,
	Mahmoud Mandour

The purpose of the matches was to only track the execution of
instructions we care about. Without resetting skip to the value at the
start of the block we end up dumping all instructions after the match
with the consequent load on the instrumentation.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Cc: Alexandre Iooss <erdnaxe@crans.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20220929114231.583801-40-alex.bennee@linaro.org>

diff --git a/contrib/plugins/execlog.c b/contrib/plugins/execlog.c
index e659ac9cbb..1b3bb7ebba 100644
--- a/contrib/plugins/execlog.c
+++ b/contrib/plugins/execlog.c
@@ -88,7 +88,7 @@ static void vcpu_insn_exec(unsigned int cpu_index, void *udata)
 static void vcpu_tb_trans(qemu_plugin_id_t id, struct qemu_plugin_tb *tb)
 {
     struct qemu_plugin_insn *insn;
-    bool skip = (imatches || amatches) ? true : false;
+    bool skip = (imatches || amatches);
 
     size_t n = qemu_plugin_tb_n_insns(tb);
     for (size_t i = 0; i < n; i++) {
@@ -147,6 +147,9 @@ static void vcpu_tb_trans(qemu_plugin_id_t id, struct qemu_plugin_tb *tb)
             /* Register callback on instruction */
             qemu_plugin_register_vcpu_insn_exec_cb(insn, vcpu_insn_exec,
                                                    QEMU_PLUGIN_CB_NO_REGS, output);
+
+            /* reset skip */
+            skip = (imatches || amatches);
         }
 
     }
-- 
2.34.1



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

* [PULL 40/54] docs/devel: document the test plugins
  2022-10-04 13:00 [PULL 00/54] testing, gdbstub, plugin and gitdm updates Alex Bennée
                   ` (38 preceding siblings ...)
  2022-10-04 13:01 ` [PULL 39/54] contrib/plugins: reset skip when matching in execlog Alex Bennée
@ 2022-10-04 13:01 ` Alex Bennée
  2022-10-04 13:01 ` [PULL 41/54] semihosting: update link to spec Alex Bennée
                   ` (14 subsequent siblings)
  54 siblings, 0 replies; 64+ messages in thread
From: Alex Bennée @ 2022-10-04 13:01 UTC (permalink / raw)
  To: qemu-devel; +Cc: stefanha, Alex Bennée, Alexandre Iooss, Mahmoud Mandour

Although the test plugins are fairly basic they are still useful for
some things so we should document their existence.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20220929114231.583801-41-alex.bennee@linaro.org>

diff --git a/docs/devel/tcg-plugins.rst b/docs/devel/tcg-plugins.rst
index 8b40b2a606..9740a70406 100644
--- a/docs/devel/tcg-plugins.rst
+++ b/docs/devel/tcg-plugins.rst
@@ -145,12 +145,141 @@ Example Plugins
 
 There are a number of plugins included with QEMU and you are
 encouraged to contribute your own plugins plugins upstream. There is a
-``contrib/plugins`` directory where they can go.
+``contrib/plugins`` directory where they can go. There are also some
+basic plugins that are used to test and exercise the API during the
+``make check-tcg`` target in ``tests\plugins``.
 
-- tests/plugins
+- tests/plugins/empty.c
 
-These are some basic plugins that are used to test and exercise the
-API during the ``make check-tcg`` target.
+Purely a test plugin for measuring the overhead of the plugins system
+itself. Does no instrumentation.
+
+- tests/plugins/bb.c
+
+A very basic plugin which will measure execution in course terms as
+each basic block is executed. By default the results are shown once
+execution finishes::
+
+  $ qemu-aarch64 -plugin tests/plugin/libbb.so \
+      -d plugin ./tests/tcg/aarch64-linux-user/sha1
+  SHA1=15dd99a1991e0b3826fede3deffc1feba42278e6
+  bb's: 2277338, insns: 158483046
+
+Behaviour can be tweaked with the following arguments:
+
+ * inline=true|false
+
+ Use faster inline addition of a single counter. Not per-cpu and not
+ thread safe.
+
+ * idle=true|false
+
+ Dump the current execution stats whenever the guest vCPU idles
+
+- tests/plugins/insn.c
+
+This is a basic instruction level instrumentation which can count the
+number of instructions executed on each core/thread::
+
+  $ qemu-aarch64 -plugin tests/plugin/libinsn.so \
+      -d plugin ./tests/tcg/aarch64-linux-user/threadcount
+  Created 10 threads
+  Done
+  cpu 0 insns: 46765
+  cpu 1 insns: 3694
+  cpu 2 insns: 3694
+  cpu 3 insns: 2994
+  cpu 4 insns: 1497
+  cpu 5 insns: 1497
+  cpu 6 insns: 1497
+  cpu 7 insns: 1497
+  total insns: 63135
+
+Behaviour can be tweaked with the following arguments:
+
+ * inline=true|false
+
+ Use faster inline addition of a single counter. Not per-cpu and not
+ thread safe.
+
+ * sizes=true|false
+
+ Give a summary of the instruction sizes for the execution
+
+ * match=<string>
+
+ Only instrument instructions matching the string prefix. Will show
+ some basic stats including how many instructions have executed since
+ the last execution. For example::
+
+   $ qemu-aarch64 -plugin tests/plugin/libinsn.so,match=bl \
+       -d plugin ./tests/tcg/aarch64-linux-user/sha512-vector
+   ...
+   0x40069c, 'bl #0x4002b0', 10 hits, 1093 match hits, Δ+1257 since last match, 98 avg insns/match
+   0x4006ac, 'bl #0x403690', 10 hits, 1094 match hits, Δ+47 since last match, 98 avg insns/match 
+   0x4037fc, 'bl #0x4002b0', 18 hits, 1095 match hits, Δ+22 since last match, 98 avg insns/match 
+   0x400720, 'bl #0x403690', 10 hits, 1096 match hits, Δ+58 since last match, 98 avg insns/match 
+   0x4037fc, 'bl #0x4002b0', 19 hits, 1097 match hits, Δ+22 since last match, 98 avg insns/match 
+   0x400730, 'bl #0x403690', 10 hits, 1098 match hits, Δ+33 since last match, 98 avg insns/match 
+   0x4037ac, 'bl #0x4002b0', 12 hits, 1099 match hits, Δ+20 since last match, 98 avg insns/match 
+   ...
+
+For more detailed execution tracing see the ``execlog`` plugin for
+other options.
+
+- tests/plugins/mem.c
+
+Basic instruction level memory instrumentation::
+
+  $ qemu-aarch64 -plugin tests/plugin/libmem.so,inline=true \
+      -d plugin ./tests/tcg/aarch64-linux-user/sha1
+  SHA1=15dd99a1991e0b3826fede3deffc1feba42278e6
+  inline mem accesses: 79525013
+
+Behaviour can be tweaked with the following arguments:
+
+ * inline=true|false
+
+ Use faster inline addition of a single counter. Not per-cpu and not
+ thread safe.
+
+ * callback=true|false
+
+ Use callbacks on each memory instrumentation.
+
+ * hwaddr=true|false
+
+ Count IO accesses (only for system emulation)
+
+- tests/plugins/syscall.c
+
+A basic syscall tracing plugin. This only works for user-mode. By
+default it will give a summary of syscall stats at the end of the
+run::
+
+  $ qemu-aarch64 -plugin tests/plugin/libsyscall \
+      -d plugin ./tests/tcg/aarch64-linux-user/threadcount
+  Created 10 threads
+  Done
+  syscall no.  calls  errors
+  226          12     0
+  99           11     11
+  115          11     0
+  222          11     0
+  93           10     0
+  220          10     0
+  233          10     0
+  215          8      0
+  214          4      0
+  134          2      0
+  64           2      0
+  96           1      0
+  94           1      0
+  80           1      0
+  261          1      0
+  78           1      0
+  160          1      0
+  135          1      0
 
 - contrib/plugins/hotblocks.c
 
-- 
2.34.1



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

* [PULL 41/54] semihosting: update link to spec
  2022-10-04 13:00 [PULL 00/54] testing, gdbstub, plugin and gitdm updates Alex Bennée
                   ` (39 preceding siblings ...)
  2022-10-04 13:01 ` [PULL 40/54] docs/devel: document the test plugins Alex Bennée
@ 2022-10-04 13:01 ` Alex Bennée
  2022-10-04 13:01 ` [PULL 42/54] gdbstub: move into its own sub directory Alex Bennée
                   ` (13 subsequent siblings)
  54 siblings, 0 replies; 64+ messages in thread
From: Alex Bennée @ 2022-10-04 13:01 UTC (permalink / raw)
  To: qemu-devel; +Cc: stefanha, Alex Bennée, Richard Henderson

The old link has moved but it seems the document is now hosted on
Arm's github along with a license update to CC-BY-SA-4.0.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20220929114231.583801-42-alex.bennee@linaro.org>

diff --git a/semihosting/arm-compat-semi.c b/semihosting/arm-compat-semi.c
index e741674238..bfea9e9337 100644
--- a/semihosting/arm-compat-semi.c
+++ b/semihosting/arm-compat-semi.c
@@ -24,7 +24,7 @@
  *
  *  ARM Semihosting is documented in:
  *     Semihosting for AArch32 and AArch64 Release 2.0
- *     https://static.docs.arm.com/100863/0200/semihosting.pdf
+ *     https://github.com/ARM-software/abi-aa/blob/main/semihosting/semihosting.rst
  *
  *  RISC-V Semihosting is documented in:
  *     RISC-V Semihosting
-- 
2.34.1



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

* [PULL 42/54] gdbstub: move into its own sub directory
  2022-10-04 13:00 [PULL 00/54] testing, gdbstub, plugin and gitdm updates Alex Bennée
                   ` (40 preceding siblings ...)
  2022-10-04 13:01 ` [PULL 41/54] semihosting: update link to spec Alex Bennée
@ 2022-10-04 13:01 ` Alex Bennée
  2022-10-04 13:01 ` [PULL 43/54] gdbstub: move sstep flags probing into AccelClass Alex Bennée
                   ` (12 subsequent siblings)
  54 siblings, 0 replies; 64+ messages in thread
From: Alex Bennée @ 2022-10-04 13:01 UTC (permalink / raw)
  To: qemu-devel
  Cc: stefanha, Alex Bennée, Richard Henderson,
	Philippe Mathieu-Daudé

This is in preparation of future refactoring as well as cleaning up
the source tree. Aside from the minor tweaks to meson and trace.h this
is pure code motion.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20220929114231.583801-43-alex.bennee@linaro.org>

diff --git a/meson.build b/meson.build
index ac5ef05c21..73646558db 100644
--- a/meson.build
+++ b/meson.build
@@ -2837,6 +2837,7 @@ trace_events_subdirs = [
   'qom',
   'monitor',
   'util',
+  'gdbstub',
 ]
 if have_linux_user
   trace_events_subdirs += [ 'linux-user' ]
@@ -2960,6 +2961,7 @@ subdir('authz')
 subdir('crypto')
 subdir('ui')
 subdir('hw')
+subdir('gdbstub')
 
 
 if enable_modules
@@ -3037,7 +3039,7 @@ common_ss.add(files('cpus-common.c'))
 subdir('softmmu')
 
 common_ss.add(capstone)
-specific_ss.add(files('cpu.c', 'disas.c', 'gdbstub.c'), capstone)
+specific_ss.add(files('cpu.c', 'disas.c'), capstone)
 
 # Work around a gcc bug/misfeature wherein constant propagation looks
 # through an alias:
diff --git a/gdbstub/trace.h b/gdbstub/trace.h
new file mode 100644
index 0000000000..dee87b1238
--- /dev/null
+++ b/gdbstub/trace.h
@@ -0,0 +1 @@
+#include "trace/trace-gdbstub.h"
diff --git a/gdbstub.c b/gdbstub/gdbstub.c
similarity index 99%
rename from gdbstub.c
rename to gdbstub/gdbstub.c
index cf869b10e3..7d8fe475b3 100644
--- a/gdbstub.c
+++ b/gdbstub/gdbstub.c
@@ -29,7 +29,7 @@
 #include "qemu/ctype.h"
 #include "qemu/cutils.h"
 #include "qemu/module.h"
-#include "trace/trace-root.h"
+#include "trace.h"
 #include "exec/gdbstub.h"
 #ifdef CONFIG_USER_ONLY
 #include "qemu.h"
diff --git a/MAINTAINERS b/MAINTAINERS
index 789172b2a8..e1530b51a2 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2677,7 +2677,7 @@ GDB stub
 M: Alex Bennée <alex.bennee@linaro.org>
 R: Philippe Mathieu-Daudé <f4bug@amsat.org>
 S: Maintained
-F: gdbstub*
+F: gdbstub/*
 F: include/exec/gdbstub.h
 F: gdb-xml/
 F: tests/tcg/multiarch/gdbstub/
diff --git a/gdbstub/meson.build b/gdbstub/meson.build
new file mode 100644
index 0000000000..6d4ae2d03c
--- /dev/null
+++ b/gdbstub/meson.build
@@ -0,0 +1 @@
+specific_ss.add(files('gdbstub.c'))
diff --git a/gdbstub/trace-events b/gdbstub/trace-events
new file mode 100644
index 0000000000..03f0c303bf
--- /dev/null
+++ b/gdbstub/trace-events
@@ -0,0 +1,29 @@
+# See docs/devel/tracing.rst for syntax documentation.
+
+# gdbstub.c
+gdbstub_op_start(const char *device) "Starting gdbstub using device %s"
+gdbstub_op_exiting(uint8_t code) "notifying exit with code=0x%02x"
+gdbstub_op_continue(void) "Continuing all CPUs"
+gdbstub_op_continue_cpu(int cpu_index) "Continuing CPU %d"
+gdbstub_op_stepping(int cpu_index) "Stepping CPU %d"
+gdbstub_op_extra_info(const char *info) "Thread extra info: %s"
+gdbstub_hit_watchpoint(const char *type, int cpu_gdb_index, uint64_t vaddr) "Watchpoint hit, type=\"%s\" cpu=%d, vaddr=0x%" PRIx64 ""
+gdbstub_hit_internal_error(void) "RUN_STATE_INTERNAL_ERROR"
+gdbstub_hit_break(void) "RUN_STATE_DEBUG"
+gdbstub_hit_paused(void) "RUN_STATE_PAUSED"
+gdbstub_hit_shutdown(void) "RUN_STATE_SHUTDOWN"
+gdbstub_hit_io_error(void) "RUN_STATE_IO_ERROR"
+gdbstub_hit_watchdog(void) "RUN_STATE_WATCHDOG"
+gdbstub_hit_unknown(int state) "Unknown run state=0x%x"
+gdbstub_io_reply(const char *message) "Sent: %s"
+gdbstub_io_binaryreply(size_t ofs, const char *line) "0x%04zx: %s"
+gdbstub_io_command(const char *command) "Received: %s"
+gdbstub_io_got_ack(void) "Got ACK"
+gdbstub_io_got_unexpected(uint8_t ch) "Got 0x%02x when expecting ACK/NACK"
+gdbstub_err_got_nack(void) "Got NACK, retransmitting"
+gdbstub_err_garbage(uint8_t ch) "received garbage between packets: 0x%02x"
+gdbstub_err_overrun(void) "command buffer overrun, dropping command"
+gdbstub_err_invalid_repeat(uint8_t ch) "got invalid RLE count: 0x%02x"
+gdbstub_err_invalid_rle(void) "got invalid RLE sequence"
+gdbstub_err_checksum_invalid(uint8_t ch) "got invalid command checksum digit: 0x%02x"
+gdbstub_err_checksum_incorrect(uint8_t expected, uint8_t got) "got command packet with incorrect checksum, expected=0x%02x, received=0x%02x"
diff --git a/trace-events b/trace-events
index bc71006675..035f3d570d 100644
--- a/trace-events
+++ b/trace-events
@@ -46,34 +46,6 @@ ram_block_discard_range(const char *rbname, void *hva, size_t length, bool need_
 memory_notdirty_write_access(uint64_t vaddr, uint64_t ram_addr, unsigned size) "0x%" PRIx64 " ram_addr 0x%" PRIx64 " size %u"
 memory_notdirty_set_dirty(uint64_t vaddr) "0x%" PRIx64
 
-# gdbstub.c
-gdbstub_op_start(const char *device) "Starting gdbstub using device %s"
-gdbstub_op_exiting(uint8_t code) "notifying exit with code=0x%02x"
-gdbstub_op_continue(void) "Continuing all CPUs"
-gdbstub_op_continue_cpu(int cpu_index) "Continuing CPU %d"
-gdbstub_op_stepping(int cpu_index) "Stepping CPU %d"
-gdbstub_op_extra_info(const char *info) "Thread extra info: %s"
-gdbstub_hit_watchpoint(const char *type, int cpu_gdb_index, uint64_t vaddr) "Watchpoint hit, type=\"%s\" cpu=%d, vaddr=0x%" PRIx64 ""
-gdbstub_hit_internal_error(void) "RUN_STATE_INTERNAL_ERROR"
-gdbstub_hit_break(void) "RUN_STATE_DEBUG"
-gdbstub_hit_paused(void) "RUN_STATE_PAUSED"
-gdbstub_hit_shutdown(void) "RUN_STATE_SHUTDOWN"
-gdbstub_hit_io_error(void) "RUN_STATE_IO_ERROR"
-gdbstub_hit_watchdog(void) "RUN_STATE_WATCHDOG"
-gdbstub_hit_unknown(int state) "Unknown run state=0x%x"
-gdbstub_io_reply(const char *message) "Sent: %s"
-gdbstub_io_binaryreply(size_t ofs, const char *line) "0x%04zx: %s"
-gdbstub_io_command(const char *command) "Received: %s"
-gdbstub_io_got_ack(void) "Got ACK"
-gdbstub_io_got_unexpected(uint8_t ch) "Got 0x%02x when expecting ACK/NACK"
-gdbstub_err_got_nack(void) "Got NACK, retransmitting"
-gdbstub_err_garbage(uint8_t ch) "received garbage between packets: 0x%02x"
-gdbstub_err_overrun(void) "command buffer overrun, dropping command"
-gdbstub_err_invalid_repeat(uint8_t ch) "got invalid RLE count: 0x%02x"
-gdbstub_err_invalid_rle(void) "got invalid RLE sequence"
-gdbstub_err_checksum_invalid(uint8_t ch) "got invalid command checksum digit: 0x%02x"
-gdbstub_err_checksum_incorrect(uint8_t expected, uint8_t got) "got command packet with incorrect checksum, expected=0x%02x, received=0x%02x"
-
 # job.c
 job_state_transition(void *job,  int ret, const char *legal, const char *s0, const char *s1) "job %p (ret: %d) attempting %s transition (%s-->%s)"
 job_apply_verb(void *job, const char *state, const char *verb, const char *legal) "job %p in state %s; applying verb %s (%s)"
-- 
2.34.1



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

* [PULL 43/54] gdbstub: move sstep flags probing into AccelClass
  2022-10-04 13:00 [PULL 00/54] testing, gdbstub, plugin and gitdm updates Alex Bennée
                   ` (41 preceding siblings ...)
  2022-10-04 13:01 ` [PULL 42/54] gdbstub: move into its own sub directory Alex Bennée
@ 2022-10-04 13:01 ` Alex Bennée
  2022-10-04 13:01 ` [PULL 44/54] gdbstub: move breakpoint logic to accel ops Alex Bennée
                   ` (11 subsequent siblings)
  54 siblings, 0 replies; 64+ messages in thread
From: Alex Bennée @ 2022-10-04 13:01 UTC (permalink / raw)
  To: qemu-devel
  Cc: stefanha, Alex Bennée, Richard Henderson,
	Philippe Mathieu-Daudé,
	Mads Ynddal, Paolo Bonzini, open list:Overall KVM CPUs

The support of single-stepping is very much dependent on support from
the accelerator we are using. To avoid special casing in gdbstub move
the probing out to an AccelClass function so future accelerators can
put their code there.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Mads Ynddal <mads@ynddal.dk>
Message-Id: <20220929114231.583801-44-alex.bennee@linaro.org>

diff --git a/include/qemu/accel.h b/include/qemu/accel.h
index be56da1b99..ce4747634a 100644
--- a/include/qemu/accel.h
+++ b/include/qemu/accel.h
@@ -43,6 +43,10 @@ typedef struct AccelClass {
     bool (*has_memory)(MachineState *ms, AddressSpace *as,
                        hwaddr start_addr, hwaddr size);
 #endif
+
+    /* gdbstub related hooks */
+    int (*gdbstub_supported_sstep_flags)(void);
+
     bool *allowed;
     /*
      * Array of global properties that would be applied when specific
@@ -92,4 +96,12 @@ void accel_cpu_instance_init(CPUState *cpu);
  */
 bool accel_cpu_realizefn(CPUState *cpu, Error **errp);
 
+/**
+ * accel_supported_gdbstub_sstep_flags:
+ *
+ * Returns the supported single step modes for the configured
+ * accelerator.
+ */
+int accel_supported_gdbstub_sstep_flags(void);
+
 #endif /* QEMU_ACCEL_H */
diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h
index efd6dee818..a20ad51aad 100644
--- a/include/sysemu/kvm.h
+++ b/include/sysemu/kvm.h
@@ -47,7 +47,6 @@ extern bool kvm_direct_msi_allowed;
 extern bool kvm_ioeventfd_any_length_allowed;
 extern bool kvm_msi_use_devid;
 extern bool kvm_has_guest_debug;
-extern int kvm_sstep_flags;
 
 #define kvm_enabled()           (kvm_allowed)
 /**
@@ -174,12 +173,6 @@ extern int kvm_sstep_flags;
  */
 #define kvm_supports_guest_debug() (kvm_has_guest_debug)
 
-/*
- * kvm_supported_sstep_flags
- * Returns: SSTEP_* flags that KVM supports for guest debug
- */
-#define kvm_get_supported_sstep_flags() (kvm_sstep_flags)
-
 #else
 
 #define kvm_enabled()           (0)
@@ -198,7 +191,6 @@ extern int kvm_sstep_flags;
 #define kvm_ioeventfd_any_length_enabled() (false)
 #define kvm_msi_devid_required() (false)
 #define kvm_supports_guest_debug() (false)
-#define kvm_get_supported_sstep_flags() (0)
 
 #endif  /* CONFIG_KVM_IS_POSSIBLE */
 
diff --git a/accel/accel-common.c b/accel/accel-common.c
index 50035bda55..df72cc989a 100644
--- a/accel/accel-common.c
+++ b/accel/accel-common.c
@@ -129,6 +129,16 @@ bool accel_cpu_realizefn(CPUState *cpu, Error **errp)
     return true;
 }
 
+int accel_supported_gdbstub_sstep_flags(void)
+{
+    AccelState *accel = current_accel();
+    AccelClass *acc = ACCEL_GET_CLASS(accel);
+    if (acc->gdbstub_supported_sstep_flags) {
+        return acc->gdbstub_supported_sstep_flags();
+    }
+    return 0;
+}
+
 static const TypeInfo accel_cpu_type = {
     .name = TYPE_ACCEL_CPU,
     .parent = TYPE_OBJECT,
diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
index 5acab1767f..c55938453a 100644
--- a/accel/kvm/kvm-all.c
+++ b/accel/kvm/kvm-all.c
@@ -175,7 +175,7 @@ bool kvm_direct_msi_allowed;
 bool kvm_ioeventfd_any_length_allowed;
 bool kvm_msi_use_devid;
 bool kvm_has_guest_debug;
-int kvm_sstep_flags;
+static int kvm_sstep_flags;
 static bool kvm_immediate_exit;
 static hwaddr kvm_max_slot_size = ~0;
 
@@ -3712,6 +3712,17 @@ static void kvm_accel_instance_init(Object *obj)
     s->kvm_dirty_ring_size = 0;
 }
 
+/**
+ * kvm_gdbstub_sstep_flags():
+ *
+ * Returns: SSTEP_* flags that KVM supports for guest debug. The
+ * support is probed during kvm_init()
+ */
+static int kvm_gdbstub_sstep_flags(void)
+{
+    return kvm_sstep_flags;
+}
+
 static void kvm_accel_class_init(ObjectClass *oc, void *data)
 {
     AccelClass *ac = ACCEL_CLASS(oc);
@@ -3719,6 +3730,7 @@ static void kvm_accel_class_init(ObjectClass *oc, void *data)
     ac->init_machine = kvm_init;
     ac->has_memory = kvm_accel_has_memory;
     ac->allowed = &kvm_allowed;
+    ac->gdbstub_supported_sstep_flags = kvm_gdbstub_sstep_flags;
 
     object_class_property_add(oc, "kernel-irqchip", "on|off|split",
         NULL, kvm_set_kernel_irqchip,
diff --git a/accel/tcg/tcg-all.c b/accel/tcg/tcg-all.c
index 47952eecd7..30b503fb22 100644
--- a/accel/tcg/tcg-all.c
+++ b/accel/tcg/tcg-all.c
@@ -25,6 +25,7 @@
 
 #include "qemu/osdep.h"
 #include "sysemu/tcg.h"
+#include "sysemu/replay.h"
 #include "sysemu/cpu-timers.h"
 #include "tcg/tcg.h"
 #include "qapi/error.h"
@@ -207,12 +208,28 @@ static void tcg_set_splitwx(Object *obj, bool value, Error **errp)
     s->splitwx_enabled = value;
 }
 
+static int tcg_gdbstub_supported_sstep_flags(void)
+{
+    /*
+     * In replay mode all events will come from the log and can't be
+     * suppressed otherwise we would break determinism. However as those
+     * events are tied to the number of executed instructions we won't see
+     * them occurring every time we single step.
+     */
+    if (replay_mode != REPLAY_MODE_NONE) {
+        return SSTEP_ENABLE;
+    } else {
+        return SSTEP_ENABLE | SSTEP_NOIRQ | SSTEP_NOTIMER;
+    }
+}
+
 static void tcg_accel_class_init(ObjectClass *oc, void *data)
 {
     AccelClass *ac = ACCEL_CLASS(oc);
     ac->name = "tcg";
     ac->init_machine = tcg_init_machine;
     ac->allowed = &tcg_allowed;
+    ac->gdbstub_supported_sstep_flags = tcg_gdbstub_supported_sstep_flags;
 
     object_class_property_add_str(oc, "thread",
                                   tcg_get_thread,
diff --git a/gdbstub/gdbstub.c b/gdbstub/gdbstub.c
index 7d8fe475b3..a0755e6505 100644
--- a/gdbstub/gdbstub.c
+++ b/gdbstub/gdbstub.c
@@ -383,27 +383,13 @@ static void init_gdbserver_state(void)
     gdbserver_state.last_packet = g_byte_array_sized_new(MAX_PACKET_LENGTH + 4);
 
     /*
-     * In replay mode all events will come from the log and can't be
-     * suppressed otherwise we would break determinism. However as those
-     * events are tied to the number of executed instructions we won't see
-     * them occurring every time we single step.
-     */
-    if (replay_mode != REPLAY_MODE_NONE) {
-        gdbserver_state.supported_sstep_flags = SSTEP_ENABLE;
-    } else if (kvm_enabled()) {
-        gdbserver_state.supported_sstep_flags = kvm_get_supported_sstep_flags();
-    } else {
-        gdbserver_state.supported_sstep_flags =
-            SSTEP_ENABLE | SSTEP_NOIRQ | SSTEP_NOTIMER;
-    }
-
-    /*
-     * By default use no IRQs and no timers while single stepping so as to
-     * make single stepping like an ICE HW step.
+     * What single-step modes are supported is accelerator dependent.
+     * By default try to use no IRQs and no timers while single
+     * stepping so as to make single stepping like a typical ICE HW step.
      */
+    gdbserver_state.supported_sstep_flags = accel_supported_gdbstub_sstep_flags();
     gdbserver_state.sstep_flags = SSTEP_ENABLE | SSTEP_NOIRQ | SSTEP_NOTIMER;
     gdbserver_state.sstep_flags &= gdbserver_state.supported_sstep_flags;
-
 }
 
 #ifndef CONFIG_USER_ONLY
-- 
2.34.1


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

* [PULL 44/54] gdbstub: move breakpoint logic to accel ops
  2022-10-04 13:00 [PULL 00/54] testing, gdbstub, plugin and gitdm updates Alex Bennée
                   ` (42 preceding siblings ...)
  2022-10-04 13:01 ` [PULL 43/54] gdbstub: move sstep flags probing into AccelClass Alex Bennée
@ 2022-10-04 13:01 ` Alex Bennée
  2022-10-04 13:01 ` [PULL 45/54] gdbstub: move guest debug support check to ops Alex Bennée
                   ` (10 subsequent siblings)
  54 siblings, 0 replies; 64+ messages in thread
From: Alex Bennée @ 2022-10-04 13:01 UTC (permalink / raw)
  To: qemu-devel
  Cc: stefanha, Alex Bennée, Richard Henderson, Mads Ynddal,
	Paolo Bonzini, Philippe Mathieu-Daudé,
	open list:Overall KVM CPUs

As HW virtualization requires specific support to handle breakpoints
lets push out special casing out of the core gdbstub code and into
AccelOpsClass. This will make it easier to add other accelerator
support and reduces some of the stub shenanigans.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Mads Ynddal <mads@ynddal.dk>
Message-Id: <20220929114231.583801-45-alex.bennee@linaro.org>

diff --git a/accel/kvm/kvm-cpus.h b/accel/kvm/kvm-cpus.h
index bf0bd1bee4..33e435d62b 100644
--- a/accel/kvm/kvm-cpus.h
+++ b/accel/kvm/kvm-cpus.h
@@ -18,5 +18,8 @@ void kvm_destroy_vcpu(CPUState *cpu);
 void kvm_cpu_synchronize_post_reset(CPUState *cpu);
 void kvm_cpu_synchronize_post_init(CPUState *cpu);
 void kvm_cpu_synchronize_pre_loadvm(CPUState *cpu);
+int kvm_insert_breakpoint(CPUState *cpu, int type, hwaddr addr, hwaddr len);
+int kvm_remove_breakpoint(CPUState *cpu, int type, hwaddr addr, hwaddr len);
+void kvm_remove_all_breakpoints(CPUState *cpu);
 
 #endif /* KVM_CPUS_H */
diff --git a/gdbstub/internals.h b/gdbstub/internals.h
new file mode 100644
index 0000000000..41e2e72dbf
--- /dev/null
+++ b/gdbstub/internals.h
@@ -0,0 +1,16 @@
+/*
+ * gdbstub internals
+ *
+ * Copyright (c) 2022 Linaro Ltd
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#ifndef _INTERNALS_H_
+#define _INTERNALS_H_
+
+int gdb_breakpoint_insert(CPUState *cs, int type, hwaddr addr, hwaddr len);
+int gdb_breakpoint_remove(CPUState *cs, int type, hwaddr addr, hwaddr len);
+void gdb_breakpoint_remove_all(CPUState *cs);
+
+#endif /* _INTERNALS_H_ */
diff --git a/include/sysemu/accel-ops.h b/include/sysemu/accel-ops.h
index a0572ea87a..86794ac273 100644
--- a/include/sysemu/accel-ops.h
+++ b/include/sysemu/accel-ops.h
@@ -10,6 +10,7 @@
 #ifndef ACCEL_OPS_H
 #define ACCEL_OPS_H
 
+#include "exec/hwaddr.h"
 #include "qom/object.h"
 
 #define ACCEL_OPS_SUFFIX "-ops"
@@ -44,6 +45,11 @@ struct AccelOpsClass {
 
     int64_t (*get_virtual_clock)(void);
     int64_t (*get_elapsed_ticks)(void);
+
+    /* gdbstub hooks */
+    int (*insert_breakpoint)(CPUState *cpu, int type, hwaddr addr, hwaddr len);
+    int (*remove_breakpoint)(CPUState *cpu, int type, hwaddr addr, hwaddr len);
+    void (*remove_all_breakpoints)(CPUState *cpu);
 };
 
 #endif /* ACCEL_OPS_H */
diff --git a/include/sysemu/cpus.h b/include/sysemu/cpus.h
index b5c87d48b3..1bace3379b 100644
--- a/include/sysemu/cpus.h
+++ b/include/sysemu/cpus.h
@@ -7,6 +7,9 @@
 /* register accel-specific operations */
 void cpus_register_accel(const AccelOpsClass *i);
 
+/* return registers ops */
+const AccelOpsClass *cpus_get_accel(void);
+
 /* accel/dummy-cpus.c */
 
 /* Create a dummy vcpu for AccelOpsClass->create_vcpu_thread */
diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h
index a20ad51aad..21d3f1d01e 100644
--- a/include/sysemu/kvm.h
+++ b/include/sysemu/kvm.h
@@ -254,11 +254,6 @@ int kvm_on_sigbus(int code, void *addr);
 
 void kvm_flush_coalesced_mmio_buffer(void);
 
-int kvm_insert_breakpoint(CPUState *cpu, target_ulong addr,
-                          target_ulong len, int type);
-int kvm_remove_breakpoint(CPUState *cpu, target_ulong addr,
-                          target_ulong len, int type);
-void kvm_remove_all_breakpoints(CPUState *cpu);
 int kvm_update_guest_debug(CPUState *cpu, unsigned long reinject_trap);
 
 /* internal API */
diff --git a/accel/kvm/kvm-accel-ops.c b/accel/kvm/kvm-accel-ops.c
index c4244a23c6..5c0e37514c 100644
--- a/accel/kvm/kvm-accel-ops.c
+++ b/accel/kvm/kvm-accel-ops.c
@@ -16,12 +16,14 @@
 #include "qemu/osdep.h"
 #include "qemu/error-report.h"
 #include "qemu/main-loop.h"
+#include "sysemu/kvm.h"
 #include "sysemu/kvm_int.h"
 #include "sysemu/runstate.h"
 #include "sysemu/cpus.h"
 #include "qemu/guest-random.h"
 #include "qapi/error.h"
 
+#include <linux/kvm.h>
 #include "kvm-cpus.h"
 
 static void *kvm_vcpu_thread_fn(void *arg)
@@ -95,6 +97,12 @@ static void kvm_accel_ops_class_init(ObjectClass *oc, void *data)
     ops->synchronize_post_init = kvm_cpu_synchronize_post_init;
     ops->synchronize_state = kvm_cpu_synchronize_state;
     ops->synchronize_pre_loadvm = kvm_cpu_synchronize_pre_loadvm;
+
+#ifdef KVM_CAP_SET_GUEST_DEBUG
+    ops->insert_breakpoint = kvm_insert_breakpoint;
+    ops->remove_breakpoint = kvm_remove_breakpoint;
+    ops->remove_all_breakpoints = kvm_remove_all_breakpoints;
+#endif
 }
 
 static const TypeInfo kvm_accel_ops_type = {
diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
index c55938453a..b8c734fe3a 100644
--- a/accel/kvm/kvm-all.c
+++ b/accel/kvm/kvm-all.c
@@ -3287,8 +3287,7 @@ int kvm_update_guest_debug(CPUState *cpu, unsigned long reinject_trap)
     return data.err;
 }
 
-int kvm_insert_breakpoint(CPUState *cpu, target_ulong addr,
-                          target_ulong len, int type)
+int kvm_insert_breakpoint(CPUState *cpu, int type, hwaddr addr, hwaddr len)
 {
     struct kvm_sw_breakpoint *bp;
     int err;
@@ -3326,8 +3325,7 @@ int kvm_insert_breakpoint(CPUState *cpu, target_ulong addr,
     return 0;
 }
 
-int kvm_remove_breakpoint(CPUState *cpu, target_ulong addr,
-                          target_ulong len, int type)
+int kvm_remove_breakpoint(CPUState *cpu, int type, hwaddr addr, hwaddr len)
 {
     struct kvm_sw_breakpoint *bp;
     int err;
@@ -3393,26 +3391,10 @@ void kvm_remove_all_breakpoints(CPUState *cpu)
 
 #else /* !KVM_CAP_SET_GUEST_DEBUG */
 
-int kvm_update_guest_debug(CPUState *cpu, unsigned long reinject_trap)
+static int kvm_update_guest_debug(CPUState *cpu, unsigned long reinject_trap)
 {
     return -EINVAL;
 }
-
-int kvm_insert_breakpoint(CPUState *cpu, target_ulong addr,
-                          target_ulong len, int type)
-{
-    return -EINVAL;
-}
-
-int kvm_remove_breakpoint(CPUState *cpu, target_ulong addr,
-                          target_ulong len, int type)
-{
-    return -EINVAL;
-}
-
-void kvm_remove_all_breakpoints(CPUState *cpu)
-{
-}
 #endif /* !KVM_CAP_SET_GUEST_DEBUG */
 
 static int kvm_set_signal_mask(CPUState *cpu, const sigset_t *sigset)
diff --git a/accel/stubs/kvm-stub.c b/accel/stubs/kvm-stub.c
index 2ac5f9c036..2d79333143 100644
--- a/accel/stubs/kvm-stub.c
+++ b/accel/stubs/kvm-stub.c
@@ -51,22 +51,6 @@ int kvm_update_guest_debug(CPUState *cpu, unsigned long reinject_trap)
     return -ENOSYS;
 }
 
-int kvm_insert_breakpoint(CPUState *cpu, target_ulong addr,
-                          target_ulong len, int type)
-{
-    return -EINVAL;
-}
-
-int kvm_remove_breakpoint(CPUState *cpu, target_ulong addr,
-                          target_ulong len, int type)
-{
-    return -EINVAL;
-}
-
-void kvm_remove_all_breakpoints(CPUState *cpu)
-{
-}
-
 int kvm_on_sigbus_vcpu(CPUState *cpu, int code, void *addr)
 {
     return 1;
diff --git a/accel/tcg/tcg-accel-ops.c b/accel/tcg/tcg-accel-ops.c
index 786d90c08f..965c2ad581 100644
--- a/accel/tcg/tcg-accel-ops.c
+++ b/accel/tcg/tcg-accel-ops.c
@@ -32,6 +32,8 @@
 #include "qemu/main-loop.h"
 #include "qemu/guest-random.h"
 #include "exec/exec-all.h"
+#include "exec/hwaddr.h"
+#include "exec/gdbstub.h"
 
 #include "tcg-accel-ops.h"
 #include "tcg-accel-ops-mttcg.h"
@@ -91,6 +93,92 @@ void tcg_handle_interrupt(CPUState *cpu, int mask)
     }
 }
 
+/* Translate GDB watchpoint type to a flags value for cpu_watchpoint_* */
+static inline int xlat_gdb_type(CPUState *cpu, int gdbtype)
+{
+    static const int xlat[] = {
+        [GDB_WATCHPOINT_WRITE]  = BP_GDB | BP_MEM_WRITE,
+        [GDB_WATCHPOINT_READ]   = BP_GDB | BP_MEM_READ,
+        [GDB_WATCHPOINT_ACCESS] = BP_GDB | BP_MEM_ACCESS,
+    };
+
+    CPUClass *cc = CPU_GET_CLASS(cpu);
+    int cputype = xlat[gdbtype];
+
+    if (cc->gdb_stop_before_watchpoint) {
+        cputype |= BP_STOP_BEFORE_ACCESS;
+    }
+    return cputype;
+}
+
+static int tcg_insert_breakpoint(CPUState *cs, int type, hwaddr addr, hwaddr len)
+{
+    CPUState *cpu;
+    int err = 0;
+
+    switch (type) {
+    case GDB_BREAKPOINT_SW:
+    case GDB_BREAKPOINT_HW:
+        CPU_FOREACH(cpu) {
+            err = cpu_breakpoint_insert(cpu, addr, BP_GDB, NULL);
+            if (err) {
+                break;
+            }
+        }
+        return err;
+    case GDB_WATCHPOINT_WRITE:
+    case GDB_WATCHPOINT_READ:
+    case GDB_WATCHPOINT_ACCESS:
+        CPU_FOREACH(cpu) {
+            err = cpu_watchpoint_insert(cpu, addr, len,
+                                        xlat_gdb_type(cpu, type), NULL);
+            if (err) {
+                break;
+            }
+        }
+        return err;
+    default:
+        return -ENOSYS;
+    }
+}
+
+static int tcg_remove_breakpoint(CPUState *cs, int type, hwaddr addr, hwaddr len)
+{
+    CPUState *cpu;
+    int err = 0;
+
+    switch (type) {
+    case GDB_BREAKPOINT_SW:
+    case GDB_BREAKPOINT_HW:
+        CPU_FOREACH(cpu) {
+            err = cpu_breakpoint_remove(cpu, addr, BP_GDB);
+            if (err) {
+                break;
+            }
+        }
+        return err;
+    case GDB_WATCHPOINT_WRITE:
+    case GDB_WATCHPOINT_READ:
+    case GDB_WATCHPOINT_ACCESS:
+        CPU_FOREACH(cpu) {
+            err = cpu_watchpoint_remove(cpu, addr, len,
+                                        xlat_gdb_type(cpu, type));
+            if (err) {
+                break;
+            }
+        }
+        return err;
+    default:
+        return -ENOSYS;
+    }
+}
+
+static inline void tcg_remove_all_breakpoints(CPUState *cpu)
+{
+    cpu_breakpoint_remove_all(cpu, BP_GDB);
+    cpu_watchpoint_remove_all(cpu, BP_GDB);
+}
+
 static void tcg_accel_ops_init(AccelOpsClass *ops)
 {
     if (qemu_tcg_mttcg_enabled()) {
@@ -109,6 +197,10 @@ static void tcg_accel_ops_init(AccelOpsClass *ops)
             ops->handle_interrupt = tcg_handle_interrupt;
         }
     }
+
+    ops->insert_breakpoint = tcg_insert_breakpoint;
+    ops->remove_breakpoint = tcg_remove_breakpoint;
+    ops->remove_all_breakpoints = tcg_remove_all_breakpoints;
 }
 
 static void tcg_accel_ops_class_init(ObjectClass *oc, void *data)
diff --git a/gdbstub/gdbstub.c b/gdbstub/gdbstub.c
index a0755e6505..ff9f3f9586 100644
--- a/gdbstub/gdbstub.c
+++ b/gdbstub/gdbstub.c
@@ -49,8 +49,11 @@
 #include "sysemu/runstate.h"
 #include "semihosting/semihost.h"
 #include "exec/exec-all.h"
+#include "exec/hwaddr.h"
 #include "sysemu/replay.h"
 
+#include "internals.h"
+
 #ifdef CONFIG_USER_ONLY
 #define GDB_ATTACHED "0"
 #else
@@ -1012,130 +1015,16 @@ void gdb_register_coprocessor(CPUState *cpu,
     }
 }
 
-#ifndef CONFIG_USER_ONLY
-/* Translate GDB watchpoint type to a flags value for cpu_watchpoint_* */
-static inline int xlat_gdb_type(CPUState *cpu, int gdbtype)
-{
-    static const int xlat[] = {
-        [GDB_WATCHPOINT_WRITE]  = BP_GDB | BP_MEM_WRITE,
-        [GDB_WATCHPOINT_READ]   = BP_GDB | BP_MEM_READ,
-        [GDB_WATCHPOINT_ACCESS] = BP_GDB | BP_MEM_ACCESS,
-    };
-
-    CPUClass *cc = CPU_GET_CLASS(cpu);
-    int cputype = xlat[gdbtype];
-
-    if (cc->gdb_stop_before_watchpoint) {
-        cputype |= BP_STOP_BEFORE_ACCESS;
-    }
-    return cputype;
-}
-#endif
-
-static int gdb_breakpoint_insert(int type, target_ulong addr, target_ulong len)
-{
-    CPUState *cpu;
-    int err = 0;
-
-    if (kvm_enabled()) {
-        return kvm_insert_breakpoint(gdbserver_state.c_cpu, addr, len, type);
-    }
-
-    switch (type) {
-    case GDB_BREAKPOINT_SW:
-    case GDB_BREAKPOINT_HW:
-        CPU_FOREACH(cpu) {
-            err = cpu_breakpoint_insert(cpu, addr, BP_GDB, NULL);
-            if (err) {
-                break;
-            }
-        }
-        return err;
-#ifndef CONFIG_USER_ONLY
-    case GDB_WATCHPOINT_WRITE:
-    case GDB_WATCHPOINT_READ:
-    case GDB_WATCHPOINT_ACCESS:
-        CPU_FOREACH(cpu) {
-            err = cpu_watchpoint_insert(cpu, addr, len,
-                                        xlat_gdb_type(cpu, type), NULL);
-            if (err) {
-                break;
-            }
-        }
-        return err;
-#endif
-    default:
-        return -ENOSYS;
-    }
-}
-
-static int gdb_breakpoint_remove(int type, target_ulong addr, target_ulong len)
-{
-    CPUState *cpu;
-    int err = 0;
-
-    if (kvm_enabled()) {
-        return kvm_remove_breakpoint(gdbserver_state.c_cpu, addr, len, type);
-    }
-
-    switch (type) {
-    case GDB_BREAKPOINT_SW:
-    case GDB_BREAKPOINT_HW:
-        CPU_FOREACH(cpu) {
-            err = cpu_breakpoint_remove(cpu, addr, BP_GDB);
-            if (err) {
-                break;
-            }
-        }
-        return err;
-#ifndef CONFIG_USER_ONLY
-    case GDB_WATCHPOINT_WRITE:
-    case GDB_WATCHPOINT_READ:
-    case GDB_WATCHPOINT_ACCESS:
-        CPU_FOREACH(cpu) {
-            err = cpu_watchpoint_remove(cpu, addr, len,
-                                        xlat_gdb_type(cpu, type));
-            if (err)
-                break;
-        }
-        return err;
-#endif
-    default:
-        return -ENOSYS;
-    }
-}
-
-static inline void gdb_cpu_breakpoint_remove_all(CPUState *cpu)
-{
-    cpu_breakpoint_remove_all(cpu, BP_GDB);
-#ifndef CONFIG_USER_ONLY
-    cpu_watchpoint_remove_all(cpu, BP_GDB);
-#endif
-}
-
 static void gdb_process_breakpoint_remove_all(GDBProcess *p)
 {
     CPUState *cpu = get_first_cpu_in_process(p);
 
     while (cpu) {
-        gdb_cpu_breakpoint_remove_all(cpu);
+        gdb_breakpoint_remove_all(cpu);
         cpu = gdb_next_cpu_in_process(cpu);
     }
 }
 
-static void gdb_breakpoint_remove_all(void)
-{
-    CPUState *cpu;
-
-    if (kvm_enabled()) {
-        kvm_remove_all_breakpoints(gdbserver_state.c_cpu);
-        return;
-    }
-
-    CPU_FOREACH(cpu) {
-        gdb_cpu_breakpoint_remove_all(cpu);
-    }
-}
 
 static void gdb_set_cpu_pc(target_ulong pc)
 {
@@ -1667,7 +1556,8 @@ static void handle_insert_bp(GArray *params, void *user_ctx)
         return;
     }
 
-    res = gdb_breakpoint_insert(get_param(params, 0)->val_ul,
+    res = gdb_breakpoint_insert(gdbserver_state.c_cpu,
+                                get_param(params, 0)->val_ul,
                                 get_param(params, 1)->val_ull,
                                 get_param(params, 2)->val_ull);
     if (res >= 0) {
@@ -1690,7 +1580,8 @@ static void handle_remove_bp(GArray *params, void *user_ctx)
         return;
     }
 
-    res = gdb_breakpoint_remove(get_param(params, 0)->val_ul,
+    res = gdb_breakpoint_remove(gdbserver_state.c_cpu,
+                                get_param(params, 0)->val_ul,
                                 get_param(params, 1)->val_ull,
                                 get_param(params, 2)->val_ull);
     if (res >= 0) {
@@ -2541,7 +2432,7 @@ static void handle_target_halt(GArray *params, void *user_ctx)
      * because gdb is doing an initial connect and the state
      * should be cleaned up.
      */
-    gdb_breakpoint_remove_all();
+    gdb_breakpoint_remove_all(gdbserver_state.c_cpu);
 }
 
 static int gdb_handle_packet(const char *line_buf)
diff --git a/gdbstub/softmmu.c b/gdbstub/softmmu.c
new file mode 100644
index 0000000000..4e73890379
--- /dev/null
+++ b/gdbstub/softmmu.c
@@ -0,0 +1,42 @@
+/*
+ * gdb server stub - softmmu specific bits
+ *
+ * Debug integration depends on support from the individual
+ * accelerators so most of this involves calling the ops helpers.
+ *
+ * Copyright (c) 2022 Linaro Ltd
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#include "qemu/osdep.h"
+#include "exec/gdbstub.h"
+#include "exec/hwaddr.h"
+#include "sysemu/cpus.h"
+#include "internals.h"
+
+int gdb_breakpoint_insert(CPUState *cs, int type, hwaddr addr, hwaddr len)
+{
+    const AccelOpsClass *ops = cpus_get_accel();
+    if (ops->insert_breakpoint) {
+        return ops->insert_breakpoint(cs, type, addr, len);
+    }
+    return -ENOSYS;
+}
+
+int gdb_breakpoint_remove(CPUState *cs, int type, hwaddr addr, hwaddr len)
+{
+    const AccelOpsClass *ops = cpus_get_accel();
+    if (ops->remove_breakpoint) {
+        return ops->remove_breakpoint(cs, type, addr, len);
+    }
+    return -ENOSYS;
+}
+
+void gdb_breakpoint_remove_all(CPUState *cs)
+{
+    const AccelOpsClass *ops = cpus_get_accel();
+    if (ops->remove_all_breakpoints) {
+        ops->remove_all_breakpoints(cs);
+    }
+}
diff --git a/gdbstub/user.c b/gdbstub/user.c
new file mode 100644
index 0000000000..42652b28a7
--- /dev/null
+++ b/gdbstub/user.c
@@ -0,0 +1,62 @@
+/*
+ * gdbstub user-mode helper routines.
+ *
+ * We know for user-mode we are using TCG so we can call stuff directly.
+ *
+ * Copyright (c) 2022 Linaro Ltd
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#include "qemu/osdep.h"
+#include "exec/hwaddr.h"
+#include "exec/gdbstub.h"
+#include "hw/core/cpu.h"
+#include "internals.h"
+
+int gdb_breakpoint_insert(CPUState *cs, int type, hwaddr addr, hwaddr len)
+{
+    CPUState *cpu;
+    int err = 0;
+
+    switch (type) {
+    case GDB_BREAKPOINT_SW:
+    case GDB_BREAKPOINT_HW:
+        CPU_FOREACH(cpu) {
+            err = cpu_breakpoint_insert(cpu, addr, BP_GDB, NULL);
+            if (err) {
+                break;
+            }
+        }
+        return err;
+    default:
+        /* user-mode doesn't support watchpoints */
+        return -ENOSYS;
+    }
+}
+
+int gdb_breakpoint_remove(CPUState *cs, int type, hwaddr addr, hwaddr len)
+{
+    CPUState *cpu;
+    int err = 0;
+
+    switch (type) {
+    case GDB_BREAKPOINT_SW:
+    case GDB_BREAKPOINT_HW:
+        CPU_FOREACH(cpu) {
+            err = cpu_breakpoint_remove(cpu, addr, BP_GDB);
+            if (err) {
+                break;
+            }
+        }
+        return err;
+    default:
+        /* user-mode doesn't support watchpoints */
+        return -ENOSYS;
+    }
+}
+
+void gdb_breakpoint_remove_all(CPUState *cs)
+{
+    cpu_breakpoint_remove_all(cs, BP_GDB);
+}
diff --git a/softmmu/cpus.c b/softmmu/cpus.c
index 23b30484b2..61b27ff59d 100644
--- a/softmmu/cpus.c
+++ b/softmmu/cpus.c
@@ -617,6 +617,13 @@ void cpus_register_accel(const AccelOpsClass *ops)
     cpus_accel = ops;
 }
 
+const AccelOpsClass *cpus_get_accel(void)
+{
+    /* broken if we call this early */
+    assert(cpus_accel);
+    return cpus_accel;
+}
+
 void qemu_init_vcpu(CPUState *cpu)
 {
     MachineState *ms = MACHINE(qdev_get_machine());
diff --git a/gdbstub/meson.build b/gdbstub/meson.build
index 6d4ae2d03c..fc895a2c39 100644
--- a/gdbstub/meson.build
+++ b/gdbstub/meson.build
@@ -1 +1,9 @@
+#
+# The main gdbstub still relies on per-build definitions of various
+# types. The bits pushed to softmmu/user.c try to use guest agnostic
+# types such as hwaddr.
+#
+
 specific_ss.add(files('gdbstub.c'))
+softmmu_ss.add(files('softmmu.c'))
+user_ss.add(files('user.c'))
-- 
2.34.1


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

* [PULL 45/54] gdbstub: move guest debug support check to ops
  2022-10-04 13:00 [PULL 00/54] testing, gdbstub, plugin and gitdm updates Alex Bennée
                   ` (43 preceding siblings ...)
  2022-10-04 13:01 ` [PULL 44/54] gdbstub: move breakpoint logic to accel ops Alex Bennée
@ 2022-10-04 13:01 ` Alex Bennée
  2022-10-04 13:01 ` [PULL 46/54] accel/kvm: move kvm_update_guest_debug to inline stub Alex Bennée
                   ` (9 subsequent siblings)
  54 siblings, 0 replies; 64+ messages in thread
From: Alex Bennée @ 2022-10-04 13:01 UTC (permalink / raw)
  To: qemu-devel
  Cc: stefanha, Alex Bennée, Philippe Mathieu-Daudé,
	Mads Ynddal, Paolo Bonzini, Richard Henderson,
	open list:Overall KVM CPUs

This removes the final hard coding of kvm_enabled() in gdbstub and
moves the check to an AccelOps.

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Mads Ynddal <mads@ynddal.dk>
Message-Id: <20220929114231.583801-46-alex.bennee@linaro.org>

diff --git a/accel/kvm/kvm-cpus.h b/accel/kvm/kvm-cpus.h
index 33e435d62b..fd63fe6a59 100644
--- a/accel/kvm/kvm-cpus.h
+++ b/accel/kvm/kvm-cpus.h
@@ -18,6 +18,7 @@ void kvm_destroy_vcpu(CPUState *cpu);
 void kvm_cpu_synchronize_post_reset(CPUState *cpu);
 void kvm_cpu_synchronize_post_init(CPUState *cpu);
 void kvm_cpu_synchronize_pre_loadvm(CPUState *cpu);
+bool kvm_supports_guest_debug(void);
 int kvm_insert_breakpoint(CPUState *cpu, int type, hwaddr addr, hwaddr len);
 int kvm_remove_breakpoint(CPUState *cpu, int type, hwaddr addr, hwaddr len);
 void kvm_remove_all_breakpoints(CPUState *cpu);
diff --git a/gdbstub/internals.h b/gdbstub/internals.h
index 41e2e72dbf..eabb0341d1 100644
--- a/gdbstub/internals.h
+++ b/gdbstub/internals.h
@@ -9,6 +9,7 @@
 #ifndef _INTERNALS_H_
 #define _INTERNALS_H_
 
+bool gdb_supports_guest_debug(void);
 int gdb_breakpoint_insert(CPUState *cs, int type, hwaddr addr, hwaddr len);
 int gdb_breakpoint_remove(CPUState *cs, int type, hwaddr addr, hwaddr len);
 void gdb_breakpoint_remove_all(CPUState *cs);
diff --git a/include/sysemu/accel-ops.h b/include/sysemu/accel-ops.h
index 86794ac273..8cc7996def 100644
--- a/include/sysemu/accel-ops.h
+++ b/include/sysemu/accel-ops.h
@@ -47,6 +47,7 @@ struct AccelOpsClass {
     int64_t (*get_elapsed_ticks)(void);
 
     /* gdbstub hooks */
+    bool (*supports_guest_debug)(void);
     int (*insert_breakpoint)(CPUState *cpu, int type, hwaddr addr, hwaddr len);
     int (*remove_breakpoint)(CPUState *cpu, int type, hwaddr addr, hwaddr len);
     void (*remove_all_breakpoints)(CPUState *cpu);
diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h
index 21d3f1d01e..6e1bd01725 100644
--- a/include/sysemu/kvm.h
+++ b/include/sysemu/kvm.h
@@ -46,7 +46,6 @@ extern bool kvm_readonly_mem_allowed;
 extern bool kvm_direct_msi_allowed;
 extern bool kvm_ioeventfd_any_length_allowed;
 extern bool kvm_msi_use_devid;
-extern bool kvm_has_guest_debug;
 
 #define kvm_enabled()           (kvm_allowed)
 /**
@@ -168,11 +167,6 @@ extern bool kvm_has_guest_debug;
  */
 #define kvm_msi_devid_required() (kvm_msi_use_devid)
 
-/*
- * Does KVM support guest debugging
- */
-#define kvm_supports_guest_debug() (kvm_has_guest_debug)
-
 #else
 
 #define kvm_enabled()           (0)
@@ -190,7 +184,6 @@ extern bool kvm_has_guest_debug;
 #define kvm_direct_msi_enabled() (false)
 #define kvm_ioeventfd_any_length_enabled() (false)
 #define kvm_msi_devid_required() (false)
-#define kvm_supports_guest_debug() (false)
 
 #endif  /* CONFIG_KVM_IS_POSSIBLE */
 
diff --git a/accel/kvm/kvm-accel-ops.c b/accel/kvm/kvm-accel-ops.c
index 5c0e37514c..fbf4fe3497 100644
--- a/accel/kvm/kvm-accel-ops.c
+++ b/accel/kvm/kvm-accel-ops.c
@@ -99,6 +99,7 @@ static void kvm_accel_ops_class_init(ObjectClass *oc, void *data)
     ops->synchronize_pre_loadvm = kvm_cpu_synchronize_pre_loadvm;
 
 #ifdef KVM_CAP_SET_GUEST_DEBUG
+    ops->supports_guest_debug = kvm_supports_guest_debug;
     ops->insert_breakpoint = kvm_insert_breakpoint;
     ops->remove_breakpoint = kvm_remove_breakpoint;
     ops->remove_all_breakpoints = kvm_remove_all_breakpoints;
diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
index b8c734fe3a..6ebff6e5a6 100644
--- a/accel/kvm/kvm-all.c
+++ b/accel/kvm/kvm-all.c
@@ -3287,6 +3287,12 @@ int kvm_update_guest_debug(CPUState *cpu, unsigned long reinject_trap)
     return data.err;
 }
 
+bool kvm_supports_guest_debug(void)
+{
+    /* probed during kvm_init() */
+    return kvm_has_guest_debug;
+}
+
 int kvm_insert_breakpoint(CPUState *cpu, int type, hwaddr addr, hwaddr len)
 {
     struct kvm_sw_breakpoint *bp;
diff --git a/accel/tcg/tcg-accel-ops.c b/accel/tcg/tcg-accel-ops.c
index 965c2ad581..19cbf1db3a 100644
--- a/accel/tcg/tcg-accel-ops.c
+++ b/accel/tcg/tcg-accel-ops.c
@@ -93,6 +93,11 @@ void tcg_handle_interrupt(CPUState *cpu, int mask)
     }
 }
 
+static bool tcg_supports_guest_debug(void)
+{
+    return true;
+}
+
 /* Translate GDB watchpoint type to a flags value for cpu_watchpoint_* */
 static inline int xlat_gdb_type(CPUState *cpu, int gdbtype)
 {
@@ -198,6 +203,7 @@ static void tcg_accel_ops_init(AccelOpsClass *ops)
         }
     }
 
+    ops->supports_guest_debug = tcg_supports_guest_debug;
     ops->insert_breakpoint = tcg_insert_breakpoint;
     ops->remove_breakpoint = tcg_remove_breakpoint;
     ops->remove_all_breakpoints = tcg_remove_all_breakpoints;
diff --git a/gdbstub/gdbstub.c b/gdbstub/gdbstub.c
index ff9f3f9586..be88ca0d71 100644
--- a/gdbstub/gdbstub.c
+++ b/gdbstub/gdbstub.c
@@ -45,7 +45,6 @@
 
 #include "qemu/sockets.h"
 #include "sysemu/hw_accel.h"
-#include "sysemu/kvm.h"
 #include "sysemu/runstate.h"
 #include "semihosting/semihost.h"
 #include "exec/exec-all.h"
@@ -3447,8 +3446,8 @@ int gdbserver_start(const char *device)
         return -1;
     }
 
-    if (kvm_enabled() && !kvm_supports_guest_debug()) {
-        error_report("gdbstub: KVM doesn't support guest debugging");
+    if (!gdb_supports_guest_debug()) {
+        error_report("gdbstub: current accelerator doesn't support guest debugging");
         return -1;
     }
 
diff --git a/gdbstub/softmmu.c b/gdbstub/softmmu.c
index 4e73890379..f208c6cf15 100644
--- a/gdbstub/softmmu.c
+++ b/gdbstub/softmmu.c
@@ -15,6 +15,15 @@
 #include "sysemu/cpus.h"
 #include "internals.h"
 
+bool gdb_supports_guest_debug(void)
+{
+    const AccelOpsClass *ops = cpus_get_accel();
+    if (ops->supports_guest_debug) {
+        return ops->supports_guest_debug();
+    }
+    return false;
+}
+
 int gdb_breakpoint_insert(CPUState *cs, int type, hwaddr addr, hwaddr len)
 {
     const AccelOpsClass *ops = cpus_get_accel();
diff --git a/gdbstub/user.c b/gdbstub/user.c
index 42652b28a7..033e5fdd71 100644
--- a/gdbstub/user.c
+++ b/gdbstub/user.c
@@ -14,6 +14,12 @@
 #include "hw/core/cpu.h"
 #include "internals.h"
 
+bool gdb_supports_guest_debug(void)
+{
+    /* user-mode == TCG == supported */
+    return true;
+}
+
 int gdb_breakpoint_insert(CPUState *cs, int type, hwaddr addr, hwaddr len)
 {
     CPUState *cpu;
-- 
2.34.1


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

* [PULL 46/54] accel/kvm: move kvm_update_guest_debug to inline stub
  2022-10-04 13:00 [PULL 00/54] testing, gdbstub, plugin and gitdm updates Alex Bennée
                   ` (44 preceding siblings ...)
  2022-10-04 13:01 ` [PULL 45/54] gdbstub: move guest debug support check to ops Alex Bennée
@ 2022-10-04 13:01 ` Alex Bennée
  2022-10-04 13:01 ` [PULL 47/54] contrib/gitdm: add mapping for Loongson Technology Alex Bennée
                   ` (8 subsequent siblings)
  54 siblings, 0 replies; 64+ messages in thread
From: Alex Bennée @ 2022-10-04 13:01 UTC (permalink / raw)
  To: qemu-devel
  Cc: stefanha, Alex Bennée, Paolo Bonzini, open list:Overall KVM CPUs

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20220929114231.583801-47-alex.bennee@linaro.org>

diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h
index 6e1bd01725..790d35ef78 100644
--- a/include/sysemu/kvm.h
+++ b/include/sysemu/kvm.h
@@ -247,7 +247,23 @@ int kvm_on_sigbus(int code, void *addr);
 
 void kvm_flush_coalesced_mmio_buffer(void);
 
+/**
+ * kvm_update_guest_debug(): ensure KVM debug structures updated
+ * @cs: the CPUState for this cpu
+ * @reinject_trap: KVM trap injection control
+ *
+ * There are usually per-arch specifics which will be handled by
+ * calling down to kvm_arch_update_guest_debug after the generic
+ * fields have been set.
+ */
+#ifdef KVM_CAP_SET_GUEST_DEBUG
 int kvm_update_guest_debug(CPUState *cpu, unsigned long reinject_trap);
+#else
+static inline int kvm_update_guest_debug(CPUState *cpu, unsigned long reinject_trap)
+{
+    return -EINVAL;
+}
+#endif
 
 /* internal API */
 
diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
index 6ebff6e5a6..423fb1936f 100644
--- a/accel/kvm/kvm-all.c
+++ b/accel/kvm/kvm-all.c
@@ -3395,12 +3395,6 @@ void kvm_remove_all_breakpoints(CPUState *cpu)
     }
 }
 
-#else /* !KVM_CAP_SET_GUEST_DEBUG */
-
-static int kvm_update_guest_debug(CPUState *cpu, unsigned long reinject_trap)
-{
-    return -EINVAL;
-}
 #endif /* !KVM_CAP_SET_GUEST_DEBUG */
 
 static int kvm_set_signal_mask(CPUState *cpu, const sigset_t *sigset)
diff --git a/accel/stubs/kvm-stub.c b/accel/stubs/kvm-stub.c
index 2d79333143..5d2dd8f351 100644
--- a/accel/stubs/kvm-stub.c
+++ b/accel/stubs/kvm-stub.c
@@ -46,11 +46,6 @@ int kvm_has_many_ioeventfds(void)
     return 0;
 }
 
-int kvm_update_guest_debug(CPUState *cpu, unsigned long reinject_trap)
-{
-    return -ENOSYS;
-}
-
 int kvm_on_sigbus_vcpu(CPUState *cpu, int code, void *addr)
 {
     return 1;
-- 
2.34.1


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

* [PULL 47/54] contrib/gitdm: add mapping for Loongson Technology
  2022-10-04 13:00 [PULL 00/54] testing, gdbstub, plugin and gitdm updates Alex Bennée
                   ` (45 preceding siblings ...)
  2022-10-04 13:01 ` [PULL 46/54] accel/kvm: move kvm_update_guest_debug to inline stub Alex Bennée
@ 2022-10-04 13:01 ` Alex Bennée
  2022-10-04 13:01 ` [PULL 48/54] contrib/gitdm: add Paul to individual contributors Alex Bennée
                   ` (7 subsequent siblings)
  54 siblings, 0 replies; 64+ messages in thread
From: Alex Bennée @ 2022-10-04 13:01 UTC (permalink / raw)
  To: qemu-devel; +Cc: stefanha, Alex Bennée, Song Gao

Please confirm you are happy with this mapping.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Acked-by: Song Gao <gaosong@loongson.cn>
Message-Id: <20220929114231.583801-48-alex.bennee@linaro.org>

diff --git a/contrib/gitdm/domain-map b/contrib/gitdm/domain-map
index 2800d9f986..434ef53afc 100644
--- a/contrib/gitdm/domain-map
+++ b/contrib/gitdm/domain-map
@@ -19,6 +19,7 @@ ibm.com         IBM
 igalia.com      Igalia
 intel.com       Intel
 linaro.org      Linaro
+loongson.cn     Loongson Technology
 lwn.net         LWN
 microsoft.com   Microsoft
 mvista.com      MontaVista
-- 
2.34.1



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

* [PULL 48/54] contrib/gitdm: add Paul to individual contributors
  2022-10-04 13:00 [PULL 00/54] testing, gdbstub, plugin and gitdm updates Alex Bennée
                   ` (46 preceding siblings ...)
  2022-10-04 13:01 ` [PULL 47/54] contrib/gitdm: add mapping for Loongson Technology Alex Bennée
@ 2022-10-04 13:01 ` Alex Bennée
  2022-10-04 13:01 ` [PULL 49/54] contrib/gitdm: add WANG Xuerui to individual contributers Alex Bennée
                   ` (6 subsequent siblings)
  54 siblings, 0 replies; 64+ messages in thread
From: Alex Bennée @ 2022-10-04 13:01 UTC (permalink / raw)
  To: qemu-devel; +Cc: stefanha, Alex Bennée, Paul Brook

Also map his old codesourcery address to his canonical address.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Cc: Paul Brook <paul@nowt.org>
Message-Id: <20220929114231.583801-49-alex.bennee@linaro.org>

diff --git a/.mailmap b/.mailmap
index 8c326709cf..1f7319b70b 100644
--- a/.mailmap
+++ b/.mailmap
@@ -65,6 +65,7 @@ James Hogan <jhogan@kernel.org> <james.hogan@imgtec.com>
 Leif Lindholm <quic_llindhol@quicinc.com> <leif.lindholm@linaro.org>
 Leif Lindholm <quic_llindhol@quicinc.com> <leif@nuviainc.com>
 Radoslaw Biernacki <rad@semihalf.com> <radoslaw.biernacki@linaro.org>
+Paul Brook <paul@nowt.org> <paul@codesourcery.com>
 Paul Burton <paulburton@kernel.org> <paul.burton@mips.com>
 Paul Burton <paulburton@kernel.org> <paul.burton@imgtec.com>
 Paul Burton <paulburton@kernel.org> <paul@archlinuxmips.org>
diff --git a/contrib/gitdm/group-map-individuals b/contrib/gitdm/group-map-individuals
index f816aa8770..6322b3476d 100644
--- a/contrib/gitdm/group-map-individuals
+++ b/contrib/gitdm/group-map-individuals
@@ -34,3 +34,4 @@ bmeng.cn@gmail.com
 liq3ea@gmail.com
 chetan4windows@gmail.com
 akihiko.odaki@gmail.com
+paul@nowt.org
-- 
2.34.1



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

* [PULL 49/54] contrib/gitdm: add WANG Xuerui to individual contributers
  2022-10-04 13:00 [PULL 00/54] testing, gdbstub, plugin and gitdm updates Alex Bennée
                   ` (47 preceding siblings ...)
  2022-10-04 13:01 ` [PULL 48/54] contrib/gitdm: add Paul to individual contributors Alex Bennée
@ 2022-10-04 13:01 ` Alex Bennée
  2022-10-04 13:01 ` [PULL 50/54] contrib/gitdm: add ISCAS to the academics group Alex Bennée
                   ` (5 subsequent siblings)
  54 siblings, 0 replies; 64+ messages in thread
From: Alex Bennée @ 2022-10-04 13:01 UTC (permalink / raw)
  To: qemu-devel; +Cc: stefanha, Alex Bennée, WANG Xuerui

His blog confirms he is not affiliated with Loongson.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: WANG Xuerui <git@xen0n.name>
Message-Id: <20220929114231.583801-50-alex.bennee@linaro.org>

diff --git a/contrib/gitdm/group-map-individuals b/contrib/gitdm/group-map-individuals
index 6322b3476d..e19d79626c 100644
--- a/contrib/gitdm/group-map-individuals
+++ b/contrib/gitdm/group-map-individuals
@@ -35,3 +35,4 @@ liq3ea@gmail.com
 chetan4windows@gmail.com
 akihiko.odaki@gmail.com
 paul@nowt.org
+git@xen0n.name
-- 
2.34.1



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

* [PULL 50/54] contrib/gitdm: add ISCAS to the academics group
  2022-10-04 13:00 [PULL 00/54] testing, gdbstub, plugin and gitdm updates Alex Bennée
                   ` (48 preceding siblings ...)
  2022-10-04 13:01 ` [PULL 49/54] contrib/gitdm: add WANG Xuerui to individual contributers Alex Bennée
@ 2022-10-04 13:01 ` Alex Bennée
  2022-10-04 13:01 ` [PULL 51/54] contrib/gitdm: add China Telecom to the domain map Alex Bennée
                   ` (4 subsequent siblings)
  54 siblings, 0 replies; 64+ messages in thread
From: Alex Bennée @ 2022-10-04 13:01 UTC (permalink / raw)
  To: qemu-devel; +Cc: stefanha, Alex Bennée, Weiwei Li

The English website (http://english.is.cas.cn/) in on a slightly
different domain but has the same logo as http://www.iscas.ac.cn/.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Weiwei Li <liweiwei@iscas.ac.cn>
Message-Id: <20220929114231.583801-51-alex.bennee@linaro.org>

diff --git a/contrib/gitdm/group-map-academics b/contrib/gitdm/group-map-academics
index 44745ca85b..877a11e69b 100644
--- a/contrib/gitdm/group-map-academics
+++ b/contrib/gitdm/group-map-academics
@@ -19,3 +19,6 @@ edu.cn
 
 # Boston University
 bu.edu
+
+# Institute of Software Chinese Academy of Sciences
+iscas.ac.cn
-- 
2.34.1



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

* [PULL 51/54] contrib/gitdm: add China Telecom to the domain map
  2022-10-04 13:00 [PULL 00/54] testing, gdbstub, plugin and gitdm updates Alex Bennée
                   ` (49 preceding siblings ...)
  2022-10-04 13:01 ` [PULL 50/54] contrib/gitdm: add ISCAS to the academics group Alex Bennée
@ 2022-10-04 13:01 ` Alex Bennée
  2022-10-04 13:01 ` [PULL 52/54] contrib/gitdm: add Simon to individual contributors Alex Bennée
                   ` (3 subsequent siblings)
  54 siblings, 0 replies; 64+ messages in thread
From: Alex Bennée @ 2022-10-04 13:01 UTC (permalink / raw)
  To: qemu-devel; +Cc: stefanha, Alex Bennée, Hyman Huang

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Acked-by: Hyman Huang(黄勇) <huangy81@chinatelecom.cn>
Message-Id: <20220929114231.583801-52-alex.bennee@linaro.org>

diff --git a/contrib/gitdm/domain-map b/contrib/gitdm/domain-map
index 434ef53afc..3727918641 100644
--- a/contrib/gitdm/domain-map
+++ b/contrib/gitdm/domain-map
@@ -10,6 +10,7 @@ bytedance.com   ByteDance
 cmss.chinamobile.com China Mobile
 citrix.com      Citrix
 crudebyte.com   Crudebyte
+chinatelecom.cn China Telecom
 eldorado.org.br Instituto de Pesquisas Eldorado
 fujitsu.com     Fujitsu
 google.com      Google
-- 
2.34.1



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

* [PULL 52/54] contrib/gitdm: add Simon to individual contributors
  2022-10-04 13:00 [PULL 00/54] testing, gdbstub, plugin and gitdm updates Alex Bennée
                   ` (50 preceding siblings ...)
  2022-10-04 13:01 ` [PULL 51/54] contrib/gitdm: add China Telecom to the domain map Alex Bennée
@ 2022-10-04 13:01 ` Alex Bennée
  2022-10-04 16:06   ` Simon Safar via
  2022-10-04 13:01 ` [PULL 53/54] contrib/gitdm: add Université Grenoble Alpes Alex Bennée
                   ` (2 subsequent siblings)
  54 siblings, 1 reply; 64+ messages in thread
From: Alex Bennée @ 2022-10-04 13:01 UTC (permalink / raw)
  To: qemu-devel; +Cc: stefanha, Alex Bennée, Simon Safar

Please confirm this is the correct mapping for you.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Simon Safar <simon@simonsafar.com>
Message-Id: <20220926134609.3301945-2-alex.bennee@linaro.org>

diff --git a/contrib/gitdm/group-map-individuals b/contrib/gitdm/group-map-individuals
index e19d79626c..53883cc526 100644
--- a/contrib/gitdm/group-map-individuals
+++ b/contrib/gitdm/group-map-individuals
@@ -36,3 +36,4 @@ chetan4windows@gmail.com
 akihiko.odaki@gmail.com
 paul@nowt.org
 git@xen0n.name
+simon@simonsafar.com
-- 
2.34.1



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

* [PULL 53/54] contrib/gitdm: add Université Grenoble Alpes
  2022-10-04 13:00 [PULL 00/54] testing, gdbstub, plugin and gitdm updates Alex Bennée
                   ` (51 preceding siblings ...)
  2022-10-04 13:01 ` [PULL 52/54] contrib/gitdm: add Simon to individual contributors Alex Bennée
@ 2022-10-04 13:01 ` Alex Bennée
  2022-10-04 13:01 ` [PULL 54/54] plugins: add [pre|post]fork helpers to linux-user Alex Bennée
  2022-10-05 14:16 ` [PULL 00/54] testing, gdbstub, plugin and gitdm updates Stefan Hajnoczi
  54 siblings, 0 replies; 64+ messages in thread
From: Alex Bennée @ 2022-10-04 13:01 UTC (permalink / raw)
  To: qemu-devel
  Cc: stefanha, Alex Bennée, Frédéric Pétrot,
	Philippe Mathieu-Daudé

again to the academic group map.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Cc: Frédéric Pétrot <frederic.petrot@univ-grenoble-alpes.fr>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20220926134609.3301945-7-alex.bennee@linaro.org>

diff --git a/contrib/gitdm/group-map-academics b/contrib/gitdm/group-map-academics
index 877a11e69b..082458e1bd 100644
--- a/contrib/gitdm/group-map-academics
+++ b/contrib/gitdm/group-map-academics
@@ -22,3 +22,6 @@ bu.edu
 
 # Institute of Software Chinese Academy of Sciences
 iscas.ac.cn
+
+# Université Grenoble Alpes
+univ-grenoble-alpes.fr
-- 
2.34.1



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

* [PULL 54/54] plugins: add [pre|post]fork helpers to linux-user
  2022-10-04 13:00 [PULL 00/54] testing, gdbstub, plugin and gitdm updates Alex Bennée
                   ` (52 preceding siblings ...)
  2022-10-04 13:01 ` [PULL 53/54] contrib/gitdm: add Université Grenoble Alpes Alex Bennée
@ 2022-10-04 13:01 ` Alex Bennée
  2022-10-05 14:16 ` [PULL 00/54] testing, gdbstub, plugin and gitdm updates Stefan Hajnoczi
  54 siblings, 0 replies; 64+ messages in thread
From: Alex Bennée @ 2022-10-04 13:01 UTC (permalink / raw)
  To: qemu-devel
  Cc: stefanha, Alex Bennée, Daniel P . Berrangé,
	Laurent Vivier, Alexandre Iooss, Mahmoud Mandour

Special care needs to be taken in ensuring locks are in a consistent
state across fork events. Add helpers so the plugin system can ensure
that.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Fixes: https://gitlab.com/qemu-project/qemu/-/issues/358
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Tested-by: Daniel P. Berrangé <berrange@redhat.com>
Message-Id: <20221004115221.2174499-1-alex.bennee@linaro.org>

diff --git a/include/qemu/plugin.h b/include/qemu/plugin.h
index 145f8a221a..a772e14193 100644
--- a/include/qemu/plugin.h
+++ b/include/qemu/plugin.h
@@ -224,6 +224,23 @@ void qemu_plugin_disable_mem_helpers(CPUState *cpu);
  */
 void qemu_plugin_user_exit(void);
 
+/**
+ * qemu_plugin_user_prefork_lock(): take plugin lock before forking
+ *
+ * This is a user-mode only helper to take the internal plugin lock
+ * before a fork event. This is ensure a consistent lock state
+ */
+void qemu_plugin_user_prefork_lock(void);
+
+/**
+ * qemu_plugin_user_postfork(): reset the plugin lock
+ * @is_child: is this thread the child
+ *
+ * This user-mode only helper resets the lock state after a fork so we
+ * can continue using the plugin interface.
+ */
+void qemu_plugin_user_postfork(bool is_child);
+
 #else /* !CONFIG_PLUGIN */
 
 static inline void qemu_plugin_add_opts(void)
@@ -287,6 +304,13 @@ static inline void qemu_plugin_disable_mem_helpers(CPUState *cpu)
 
 static inline void qemu_plugin_user_exit(void)
 { }
+
+static inline void qemu_plugin_user_prefork_lock(void)
+{ }
+
+static inline void qemu_plugin_user_postfork(bool is_child)
+{ }
+
 #endif /* !CONFIG_PLUGIN */
 
 #endif /* QEMU_PLUGIN_H */
diff --git a/linux-user/main.c b/linux-user/main.c
index 88fccfe261..a17fed045b 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -142,10 +142,12 @@ void fork_start(void)
     start_exclusive();
     mmap_fork_start();
     cpu_list_lock();
+    qemu_plugin_user_prefork_lock();
 }
 
 void fork_end(int child)
 {
+    qemu_plugin_user_postfork(child);
     mmap_fork_end(child);
     if (child) {
         CPUState *cpu, *next_cpu;
diff --git a/plugins/core.c b/plugins/core.c
index 792262da08..532cbaa94d 100644
--- a/plugins/core.c
+++ b/plugins/core.c
@@ -526,6 +526,26 @@ void qemu_plugin_user_exit(void)
     qemu_plugin_atexit_cb();
 }
 
+/*
+ * Helpers for *-user to ensure locks are sane across fork() events.
+ */
+
+void qemu_plugin_user_prefork_lock(void)
+{
+    qemu_rec_mutex_lock(&plugin.lock);
+}
+
+void qemu_plugin_user_postfork(bool is_child)
+{
+    if (is_child) {
+        /* should we just reset via plugin_init? */
+        qemu_rec_mutex_init(&plugin.lock);
+    } else {
+        qemu_rec_mutex_unlock(&plugin.lock);
+    }
+}
+
+
 /*
  * Call this function after longjmp'ing to the main loop. It's possible that the
  * last instruction of a TB might have used helpers, and therefore the
-- 
2.34.1



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

* Re: [PULL 52/54] contrib/gitdm: add Simon to individual contributors
  2022-10-04 13:01 ` [PULL 52/54] contrib/gitdm: add Simon to individual contributors Alex Bennée
@ 2022-10-04 16:06   ` Simon Safar via
  0 siblings, 0 replies; 64+ messages in thread
From: Simon Safar via @ 2022-10-04 16:06 UTC (permalink / raw)
  To: Alex Bennée, qemu-devel; +Cc: stefanha

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

On Tue, Oct 4, 2022, at 6:01 AM, Alex Bennée wrote:
> Please confirm this is the correct mapping for you.

Looks good to me, thank you!!!

> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> Reviewed-by: Simon Safar <simon@simonsafar.com>
> Message-Id: <20220926134609.3301945-2-alex.bennee@linaro.org>
> 
> diff --git a/contrib/gitdm/group-map-individuals b/contrib/gitdm/group-map-individuals
> index e19d79626c..53883cc526 100644
> --- a/contrib/gitdm/group-map-individuals
> +++ b/contrib/gitdm/group-map-individuals
> @@ -36,3 +36,4 @@ chetan4windows@gmail.com
>  akihiko.odaki@gmail.com
>  paul@nowt.org
>  git@xen0n.name
> +simon@simonsafar.com
> -- 
> 2.34.1
> 
> 

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

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

* Re: [PULL 00/54] testing, gdbstub, plugin and gitdm updates
  2022-10-04 13:00 [PULL 00/54] testing, gdbstub, plugin and gitdm updates Alex Bennée
                   ` (53 preceding siblings ...)
  2022-10-04 13:01 ` [PULL 54/54] plugins: add [pre|post]fork helpers to linux-user Alex Bennée
@ 2022-10-05 14:16 ` Stefan Hajnoczi
  2022-10-05 15:23   ` Alex Bennée
  54 siblings, 1 reply; 64+ messages in thread
From: Stefan Hajnoczi @ 2022-10-05 14:16 UTC (permalink / raw)
  To: Alex Bennée; +Cc: qemu-devel, stefanha

On Tue, 4 Oct 2022 at 09:38, Alex Bennée <alex.bennee@linaro.org> wrote:
>
> The following changes since commit efbf38d73e5dcc4d5f8b98c6e7a12be1f3b91745:
>
>   Merge tag 'for-upstream' of git://repo.or.cz/qemu/kevin into staging (2022-10-03 15:06:07 -0400)
>
> are available in the Git repository at:
>
>   https://github.com/stsquad/qemu.git tags/pull-testing-gdbstub-plugins-gitdm-041022-1

Hi Alex,
Please rebase and resend. There is a merge conflict.

Thanks,
Stefan


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

* Re: [PULL 00/54] testing, gdbstub, plugin and gitdm updates
  2022-10-05 14:16 ` [PULL 00/54] testing, gdbstub, plugin and gitdm updates Stefan Hajnoczi
@ 2022-10-05 15:23   ` Alex Bennée
  2022-10-05 23:17     ` Paolo Bonzini
  0 siblings, 1 reply; 64+ messages in thread
From: Alex Bennée @ 2022-10-05 15:23 UTC (permalink / raw)
  To: Stefan Hajnoczi; +Cc: qemu-devel, stefanha


Stefan Hajnoczi <stefanha@gmail.com> writes:

> On Tue, 4 Oct 2022 at 09:38, Alex Bennée <alex.bennee@linaro.org> wrote:
>>
>> The following changes since commit efbf38d73e5dcc4d5f8b98c6e7a12be1f3b91745:
>>
>>   Merge tag 'for-upstream' of git://repo.or.cz/qemu/kevin into staging (2022-10-03 15:06:07 -0400)
>>
>> are available in the Git repository at:
>>
>>   https://github.com/stsquad/qemu.git tags/pull-testing-gdbstub-plugins-gitdm-041022-1
>
> Hi Alex,
> Please rebase and resend. There is a merge conflict.

Any clue as to where - because it rebased cleanly for me.

>
> Thanks,
> Stefan


-- 
Alex Bennée


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

* Re: [PULL 00/54] testing, gdbstub, plugin and gitdm updates
  2022-10-05 15:23   ` Alex Bennée
@ 2022-10-05 23:17     ` Paolo Bonzini
  0 siblings, 0 replies; 64+ messages in thread
From: Paolo Bonzini @ 2022-10-05 23:17 UTC (permalink / raw)
  To: Alex Bennée, Stefan Hajnoczi; +Cc: qemu-devel, stefanha

On 10/5/22 17:23, Alex Bennée wrote:
> 
> Stefan Hajnoczi <stefanha@gmail.com> writes:
> 
>> On Tue, 4 Oct 2022 at 09:38, Alex Bennée <alex.bennee@linaro.org> wrote:
>>>
>>> The following changes since commit efbf38d73e5dcc4d5f8b98c6e7a12be1f3b91745:
>>>
>>>    Merge tag 'for-upstream' of git://repo.or.cz/qemu/kevin into staging (2022-10-03 15:06:07 -0400)
>>>
>>> are available in the Git repository at:
>>>
>>>    https://github.com/stsquad/qemu.git tags/pull-testing-gdbstub-plugins-gitdm-041022-1
>>
>> Hi Alex,
>> Please rebase and resend. There is a merge conflict.
> 
> Any clue as to where - because it rebased cleanly for me.

That's because "[PULL 12/54] configure: do not invoke as/ld directly for 
pc-bios/optionrom" was also part of my pull request.  Rebasing and 
resending will do the right thing, as it will remove your copy of that 
patch from your branch.

Paolo



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

* Re: [PULL 26/54] configure: unify creation of cross-compilation Makefiles
  2022-10-04 13:01 ` [PULL 26/54] configure: unify creation of cross-compilation Makefiles Alex Bennée
@ 2022-10-06 20:33   ` Stefan Hajnoczi
  0 siblings, 0 replies; 64+ messages in thread
From: Stefan Hajnoczi @ 2022-10-06 20:33 UTC (permalink / raw)
  To: Alex Bennée; +Cc: qemu-devel, Paolo Bonzini

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

On Tue, Oct 04, 2022 at 02:01:10PM +0100, Alex Bennée wrote:
> From: Paolo Bonzini <pbonzini@redhat.com>
> 
> Let write_target_makefile handle both host and container cross compilers.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> Message-Id: <20220929114231.583801-27-alex.bennee@linaro.org>

I think this commit breaks bisection:

  configure: line 2498: syntax error near unexpected token `('
  configure: line 2498: `      echo "run-tcg-tests-$target: $qemu\$(EXESUF)" >> Makefile.prereqs'

It has already been merged into qemu.git/master, so there's no fixing it
now. I wanted to leave a comment in case someone hits this problem in
the future and wonders what's going on.

I had to use git bisect skip.

Stefan

> 
> diff --git a/configure b/configure
> index cbeac99b2b..8b495d4453 100755
> --- a/configure
> +++ b/configure
> @@ -2157,51 +2157,49 @@ probe_target_compiler() {
>  
>  write_target_makefile() {
>    echo "EXTRA_CFLAGS=$target_cflags"
> -  if test -n "$target_cc"; then
> -    echo "CC=$target_cc"
> -    echo "CCAS=$target_ccas"
> -  fi
> -  if test -n "$target_ar"; then
> -    echo "AR=$target_ar"
> -  fi
> -  if test -n "$target_as"; then
> -    echo "AS=$target_as"
> -  fi
> -  if test -n "$target_ld"; then
> -    echo "LD=$target_ld"
> -  fi
> -  if test -n "$target_nm"; then
> -    echo "NM=$target_nm"
> -  fi
> -  if test -n "$target_objcopy"; then
> -    echo "OBJCOPY=$target_objcopy"
> -  fi
> -  if test -n "$target_ranlib"; then
> -    echo "RANLIB=$target_ranlib"
> -  fi
> -  if test -n "$target_strip"; then
> -    echo "STRIP=$target_strip"
> -  fi
> -}
> -
> -write_container_target_makefile() {
> -  echo "$1: docker-image-$container_image" >> Makefile.prereqs
> -  echo "EXTRA_CFLAGS=$target_cflags"
> -  if test -n "$container_cross_cc"; then
> -    echo "CC=$docker_py cc --cc $container_cross_cc -i qemu/$container_image -s $source_path --"
> -    echo "CCAS=$docker_py cc --cc $container_cross_cc -i qemu/$container_image -s $source_path --"
> +  if test -z "$target_cc" && test -z "$target_as"; then
> +    test -z "$container_image" && error_exit "Internal error: could not find cross compiler for $1?"
> +    echo "$1: docker-image-$container_image" >> Makefile.prereqs
> +    if test -n "$container_cross_cc"; then
> +      echo "CC=$docker_py cc --cc $container_cross_cc -i qemu/$container_image -s $source_path --"
> +      echo "CCAS=$docker_py cc --cc $container_cross_cc -i qemu/$container_image -s $source_path --"
> +    fi
> +    echo "AR=$docker_py cc --cc $container_cross_ar -i qemu/$container_image -s $source_path --"
> +    echo "AS=$docker_py cc --cc $container_cross_as -i qemu/$container_image -s $source_path --"
> +    echo "LD=$docker_py cc --cc $container_cross_ld -i qemu/$container_image -s $source_path --"
> +    echo "NM=$docker_py cc --cc $container_cross_nm -i qemu/$container_image -s $source_path --"
> +    echo "OBJCOPY=$docker_py cc --cc $container_cross_objcopy -i qemu/$container_image -s $source_path --"
> +    echo "RANLIB=$docker_py cc --cc $container_cross_ranlib -i qemu/$container_image -s $source_path --"
> +    echo "STRIP=$docker_py cc --cc $container_cross_strip -i qemu/$container_image -s $source_path --"
> +  else
> +    if test -n "$target_cc"; then
> +      echo "CC=$target_cc"
> +      echo "CCAS=$target_ccas"
> +    fi
> +    if test -n "$target_ar"; then
> +      echo "AR=$target_ar"
> +    fi
> +    if test -n "$target_as"; then
> +      echo "AS=$target_as"
> +    fi
> +    if test -n "$target_ld"; then
> +      echo "LD=$target_ld"
> +    fi
> +    if test -n "$target_nm"; then
> +      echo "NM=$target_nm"
> +    fi
> +    if test -n "$target_objcopy"; then
> +      echo "OBJCOPY=$target_objcopy"
> +    fi
> +    if test -n "$target_ranlib"; then
> +      echo "RANLIB=$target_ranlib"
> +    fi
> +    if test -n "$target_strip"; then
> +      echo "STRIP=$target_strip"
> +    fi
>    fi
> -  echo "AR=$docker_py cc --cc $container_cross_ar -i qemu/$container_image -s $source_path --"
> -  echo "AS=$docker_py cc --cc $container_cross_as -i qemu/$container_image -s $source_path --"
> -  echo "LD=$docker_py cc --cc $container_cross_ld -i qemu/$container_image -s $source_path --"
> -  echo "NM=$docker_py cc --cc $container_cross_nm -i qemu/$container_image -s $source_path --"
> -  echo "OBJCOPY=$docker_py cc --cc $container_cross_objcopy -i qemu/$container_image -s $source_path --"
> -  echo "RANLIB=$docker_py cc --cc $container_cross_ranlib -i qemu/$container_image -s $source_path --"
> -  echo "STRIP=$docker_py cc --cc $container_cross_strip -i qemu/$container_image -s $source_path --"
>  }
>  
> -
> -
>  ##########################################
>  # check for vfio_user_server
>  
> @@ -2560,15 +2558,9 @@ for target in $target_list; do
>        ;;
>    esac
>  
> -  probe_target_compiler $target
> -  if test $got_cross_cc = yes; then
> -      write_target_makefile >> "$config_target_mak"
> -  elif test -n "$container_image"; then
> -      build_static=y
> -      write_container_target_makefile build-tcg-tests-$target >> "$config_target_mak"
> -      got_cross_cc=yes
> -  fi
> -  if test $got_cross_cc = yes; then
> +  if probe_target_compiler $target || test -n "$container_image"; then
> +      test -n "$container_image" && build_static=y
> +      write_target_makefile "build-tcg-tests-$target >> "$config_target_mak"
>        mkdir -p "tests/tcg/$target"
>        ln -sf "$source_path/tests/tcg/Makefile.target" "tests/tcg/$target/Makefile"
>        ln -sf "../config-$target.mak" "tests/tcg/$target/config-target.mak"
> -- 
> 2.34.1
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PULL 28/54] configure: build ROMs with container-based cross compilers
  2022-10-04 13:01 ` [PULL 28/54] configure: build ROMs with container-based cross compilers Alex Bennée
@ 2022-10-06 20:37   ` Stefan Hajnoczi
  2022-10-10 12:54   ` Daniel P. Berrangé
  1 sibling, 0 replies; 64+ messages in thread
From: Stefan Hajnoczi @ 2022-10-06 20:37 UTC (permalink / raw)
  To: Alex Bennée; +Cc: qemu-devel, Paolo Bonzini

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

On Tue, Oct 04, 2022 at 02:01:12PM +0100, Alex Bennée wrote:
> From: Paolo Bonzini <pbonzini@redhat.com>
> 
> s390-ccw remains a bit more complex, because the -march=z900 test is done
> only for the native cross compiler.  Otherwise, all that is needed is
> to pass the (now mandatory) target argument to write_target_makefile.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> Message-Id: <20220929114231.583801-29-alex.bennee@linaro.org>

This commit broke local builds on my machine because there were
root-owned files in my QEMU source tree from some testing I had done
previously. I think podman gives up when it encounters such files:

  Error: lsetxattr qemu/virtiofsd-1.sock: operation not permitted
  Traceback (most recent call last):
    File "qemu/tests/docker/docker.py", line 683, in <module>
      sys.exit(main())
    File "qemu/tests/docker/docker.py", line 679, in main
      return args.cmdobj.run(args, argv)
    File "qemu/tests/docker/docker.py", line 657, in run
      return Docker().run(cmd, False, quiet=args.quiet,
    File "qemu/tests/docker/docker.py", line 370, in run
      ret = self._do_check(["run", "--rm", "--label",
    File "qemu/tests/docker/docker.py", line 247, in _do_check
      return subprocess.check_call(self._command + cmd, **kwargs)
    File "/usr/lib64/python3.10/subprocess.py", line 369, in check_call
      raise CalledProcessError(retcode, cmd)
  subprocess.CalledProcessError: Command '['podman', 'run', '--rm', '--label', 'com.qemu.instance.uuid=e5f732db938a455cb4dca486dc9534d6', '--userns=keep-id', '-u', '1000', '-w', 'qemu/build/pc-bios/s390-ccw', '-v', 'qemu/build/pc-bios/s390-ccw:qemu/build/pc-bios/s390-ccw:rw', '-v', 'qemu:qemu:ro,z', 'qemu/debian-s390x-cross', 's390x-linux-gnu-gcc', '-Wall', '-ffreestanding', '-fno-delete-null-pointer-checks', '-fno-common', '-fPIE', '-fwrapv', '-fno-strict-aliasing', '-fno-asynchronous-unwind-tables', '-msoft-float', '-std=gnu99', '-march=z10', '-O2', '-g', '-nostdinc', '-Iqemu/pc-bios/s390-ccw/../../roms/SLOF/lib/libc/include', '-Iqemu/pc-bios/s390-ccw/../../roms/SLOF/lib/libnet', '-DDHCPARCH=0x1F', '-MMD', '-MP', '-MT', 'ipv4.o', '-MF', 'ipv4.d', '-c', '-o', 'ipv4.o', 'qemu/pc-bios/s390-ccw/../../roms/SLOF/lib/libnet/ipv4.c']' returned non-zero exit status 126.

After removing those kinds of files from my source tree the build
completed successfully.

It would be nice if the build didn't trip up over this. My podman
version is 4.2.0.

Do you think we should do anything about this?

Stefan

> diff --git a/configure b/configure
> index c175650eb9..a54e17aca9 100755
> --- a/configure
> +++ b/configure
> @@ -2152,7 +2152,7 @@ probe_target_compiler() {
>      target_ranlib=
>      target_strip=
>    fi
> -  test -n "$target_cc"
> +  test -n "$target_cc" || test -n "$container_image"
>  }
>  
>  write_target_makefile() {
> @@ -2307,7 +2307,7 @@ if test "$targetos" != "darwin" && test "$targetos" != "sunos" && \
>      config_mak=pc-bios/optionrom/config.mak
>      echo "# Automatically generated by configure - do not modify" > $config_mak
>      echo "TOPSRC_DIR=$source_path" >> $config_mak
> -    write_target_makefile >> $config_mak
> +    write_target_makefile pc-bios/optionrom/all >> $config_mak
>  fi
>  
>  if test "$softmmu" = yes && probe_target_compiler ppc-softmmu; then
> @@ -2315,25 +2315,31 @@ if test "$softmmu" = yes && probe_target_compiler ppc-softmmu; then
>      config_mak=pc-bios/vof/config.mak
>      echo "# Automatically generated by configure - do not modify" > $config_mak
>      echo "SRC_DIR=$source_path/pc-bios/vof" >> $config_mak
> -    write_target_makefile >> $config_mak
> +    write_target_makefile pc-bios/vof/all >> $config_mak
>  fi
>  
>  # Only build s390-ccw bios if the compiler has -march=z900 or -march=z10
>  # (which is the lowest architecture level that Clang supports)
>  if test "$softmmu" = yes && probe_target_compiler s390x-softmmu; then
> -  write_c_skeleton
> -  do_compiler "$target_cc" $target_cc_cflags -march=z900 -o $TMPO -c $TMPC
> -  has_z900=$?
> -  if [ $has_z900 = 0 ] || do_compiler "$target_cc" $target_cc_cflags -march=z10 -msoft-float -Werror -o $TMPO -c $TMPC; then
> -    if [ $has_z900 != 0 ]; then
> -      echo "WARNING: Your compiler does not support the z900!"
> -      echo "         The s390-ccw bios will only work with guest CPUs >= z10."
> +  got_cross_cc=no
> +  if test -n "$target_cc"; then
> +    write_c_skeleton
> +    do_compiler "$target_cc" $target_cc_cflags -march=z900 -o $TMPO -c $TMPC
> +    has_z900=$?
> +    if [ $has_z900 = 0 ] || do_compiler "$target_cc" $target_cc_cflags -march=z10 -msoft-float -Werror -o $TMPO -c $TMPC; then
> +      if [ $has_z900 != 0 ]; then
> +        echo "WARNING: Your compiler does not support the z900!"
> +        echo "         The s390-ccw bios will only work with guest CPUs >= z10."
> +      fi
> +      got_cross_cc=yes
>      fi
> +  fi
> +  if test "$got_cross_cc" = yes || test -n "$container_image"; then
>      roms="$roms pc-bios/s390-ccw"
>      config_mak=pc-bios/s390-ccw/config-host.mak
>      echo "# Automatically generated by configure - do not modify" > $config_mak
>      echo "SRC_PATH=$source_path/pc-bios/s390-ccw" >> $config_mak
> -    write_target_makefile >> $config_mak
> +    write_target_makefile pc-bios/s390-ccw/all >> $config_mak
>      # SLOF is required for building the s390-ccw firmware on s390x,
>      # since it is using the libnet code from SLOF for network booting.
>      git_submodules="${git_submodules} roms/SLOF"
> @@ -2554,7 +2560,7 @@ for target in $target_list; do
>        ;;
>    esac
>  
> -  if probe_target_compiler $target || test -n "$container_image"; then
> +  if probe_target_compiler $target; then
>        test -n "$container_image" && build_static=y
>        mkdir -p "tests/tcg/$target"
>        config_target_mak=tests/tcg/$target/config-target.mak
> -- 
> 2.34.1
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PULL 28/54] configure: build ROMs with container-based cross compilers
  2022-10-04 13:01 ` [PULL 28/54] configure: build ROMs with container-based cross compilers Alex Bennée
  2022-10-06 20:37   ` Stefan Hajnoczi
@ 2022-10-10 12:54   ` Daniel P. Berrangé
  2022-10-10 13:07     ` Daniel P. Berrangé
  2022-10-10 13:47     ` Alex Bennée
  1 sibling, 2 replies; 64+ messages in thread
From: Daniel P. Berrangé @ 2022-10-10 12:54 UTC (permalink / raw)
  To: Alex Bennée; +Cc: qemu-devel, stefanha, Paolo Bonzini

On Tue, Oct 04, 2022 at 02:01:12PM +0100, Alex Bennée wrote:
> From: Paolo Bonzini <pbonzini@redhat.com>
> 
> s390-ccw remains a bit more complex, because the -march=z900 test is done
> only for the native cross compiler.  Otherwise, all that is needed is
> to pass the (now mandatory) target argument to write_target_makefile.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> Message-Id: <20220929114231.583801-29-alex.bennee@linaro.org>

I'm not at all convinced this change was/is a good idea.

First of all, it causes 'make' to now download about 1 GB of
container images

  $ ./configure --target-list=x86_64-softmmu
  $ make
  ...snip...
  BUILD   debian-powerpc-test-cross
  Trying to pull registry.gitlab.com/qemu-project/qemu/qemu/debian-powerpc-test-cross:latest...
  Getting image source signatures
  Copying blob 2a205c8a1d36 [=>------------------------------------] 12.4MiB / 257.2MiB

  ...
  ...snip...
  
Despite downloading this image, it then proceeded to rebuild the
image from scratch, requiring another few 100MBs of downloads
of dpkgs. This time the download was without progress information
until it entirely failed due to a dead Debia mirror server, needing
a retry.

It then went on to download an s390x image which seems to have
two layers, each with 360 MB.

  BUILD   debian-s390x-cross
Trying to pull registry.gitlab.com/qemu-project/qemu/qemu/debian-s390x-cross:latest...
Getting image source signatures
Copying blob fc8d65e34cd5 [>-------------------------------------] 12.0MiB / 360.2MiB
Copying blob bd159e379b3b skipped: already exists  
Copying blob 13224e2971af [>-------------------------------------] 12.2MiB / 366.5MiB

So overall it was more than 1 GB of downloads when typing 'make'

I wasn't too amuzed by seeing this downloaded data , given that
I'm usually running off a 4G mobile connection, and it took a
very long time.


The progress information printed by docker when downloading
the images splatters all over the output meson displays, when
doing a parallel make making everything unintelligible.


Finally, I had requested only building x86_64, so we shouldn't
be doing anything related to ppc or s390 at all, but even if

AFAICT, it enables this downloading unconditionally merely by
having 'docker'/'podman' binaries installed, if you don't
otherwise have cross compuilers present.

I'd really not want to see any of this stuff downloaded without
an explicit opt-in choice at configure time.

I'm also a little concerned at what happens if we have to stop
publishing the containers at registry.gitlab.com in future. Are
we going to break the default 'make' for existing released QEMU
tarballs ?

Generally we've only relied on the gitlab infra for our CI
testing, so we have been free to change infra or alter the
way we publish images at any time, without risk of impact on
the released tarballs.

This isn't a theoretical problem, because GitLab has announced
their intention to limit storage usage in gitlab.com, and even
having joined the Open Source Program, our quota is only increased
from 5 GB to 25 GB.  I'd be concerned we're at risk of exceeding
that 25 GB limit, when they start to enforce it, requiring us to
move container image host to somewhere else such as quay.io


> diff --git a/configure b/configure
> index c175650eb9..a54e17aca9 100755
> --- a/configure
> +++ b/configure
> @@ -2152,7 +2152,7 @@ probe_target_compiler() {
>      target_ranlib=
>      target_strip=
>    fi
> -  test -n "$target_cc"
> +  test -n "$target_cc" || test -n "$container_image"
>  }
>  
>  write_target_makefile() {
> @@ -2307,7 +2307,7 @@ if test "$targetos" != "darwin" && test "$targetos" != "sunos" && \
>      config_mak=pc-bios/optionrom/config.mak
>      echo "# Automatically generated by configure - do not modify" > $config_mak
>      echo "TOPSRC_DIR=$source_path" >> $config_mak
> -    write_target_makefile >> $config_mak
> +    write_target_makefile pc-bios/optionrom/all >> $config_mak
>  fi
>  
>  if test "$softmmu" = yes && probe_target_compiler ppc-softmmu; then
> @@ -2315,25 +2315,31 @@ if test "$softmmu" = yes && probe_target_compiler ppc-softmmu; then
>      config_mak=pc-bios/vof/config.mak
>      echo "# Automatically generated by configure - do not modify" > $config_mak
>      echo "SRC_DIR=$source_path/pc-bios/vof" >> $config_mak
> -    write_target_makefile >> $config_mak
> +    write_target_makefile pc-bios/vof/all >> $config_mak
>  fi
>  
>  # Only build s390-ccw bios if the compiler has -march=z900 or -march=z10
>  # (which is the lowest architecture level that Clang supports)
>  if test "$softmmu" = yes && probe_target_compiler s390x-softmmu; then
> -  write_c_skeleton
> -  do_compiler "$target_cc" $target_cc_cflags -march=z900 -o $TMPO -c $TMPC
> -  has_z900=$?
> -  if [ $has_z900 = 0 ] || do_compiler "$target_cc" $target_cc_cflags -march=z10 -msoft-float -Werror -o $TMPO -c $TMPC; then
> -    if [ $has_z900 != 0 ]; then
> -      echo "WARNING: Your compiler does not support the z900!"
> -      echo "         The s390-ccw bios will only work with guest CPUs >= z10."
> +  got_cross_cc=no
> +  if test -n "$target_cc"; then
> +    write_c_skeleton
> +    do_compiler "$target_cc" $target_cc_cflags -march=z900 -o $TMPO -c $TMPC
> +    has_z900=$?
> +    if [ $has_z900 = 0 ] || do_compiler "$target_cc" $target_cc_cflags -march=z10 -msoft-float -Werror -o $TMPO -c $TMPC; then
> +      if [ $has_z900 != 0 ]; then
> +        echo "WARNING: Your compiler does not support the z900!"
> +        echo "         The s390-ccw bios will only work with guest CPUs >= z10."
> +      fi
> +      got_cross_cc=yes
>      fi
> +  fi
> +  if test "$got_cross_cc" = yes || test -n "$container_image"; then
>      roms="$roms pc-bios/s390-ccw"
>      config_mak=pc-bios/s390-ccw/config-host.mak
>      echo "# Automatically generated by configure - do not modify" > $config_mak
>      echo "SRC_PATH=$source_path/pc-bios/s390-ccw" >> $config_mak
> -    write_target_makefile >> $config_mak
> +    write_target_makefile pc-bios/s390-ccw/all >> $config_mak
>      # SLOF is required for building the s390-ccw firmware on s390x,
>      # since it is using the libnet code from SLOF for network booting.
>      git_submodules="${git_submodules} roms/SLOF"
> @@ -2554,7 +2560,7 @@ for target in $target_list; do
>        ;;
>    esac
>  
> -  if probe_target_compiler $target || test -n "$container_image"; then
> +  if probe_target_compiler $target; then
>        test -n "$container_image" && build_static=y
>        mkdir -p "tests/tcg/$target"
>        config_target_mak=tests/tcg/$target/config-target.mak
> -- 
> 2.34.1
> 
> 

With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|



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

* Re: [PULL 28/54] configure: build ROMs with container-based cross compilers
  2022-10-10 12:54   ` Daniel P. Berrangé
@ 2022-10-10 13:07     ` Daniel P. Berrangé
  2022-10-10 13:47     ` Alex Bennée
  1 sibling, 0 replies; 64+ messages in thread
From: Daniel P. Berrangé @ 2022-10-10 13:07 UTC (permalink / raw)
  To: Alex Bennée, qemu-devel, stefanha, Paolo Bonzini

On Mon, Oct 10, 2022 at 01:54:16PM +0100, Daniel P. Berrangé wrote:
> On Tue, Oct 04, 2022 at 02:01:12PM +0100, Alex Bennée wrote:
> > From: Paolo Bonzini <pbonzini@redhat.com>
> > 
> > s390-ccw remains a bit more complex, because the -march=z900 test is done
> > only for the native cross compiler.  Otherwise, all that is needed is
> > to pass the (now mandatory) target argument to write_target_makefile.
> > 
> > Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> > Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> > Message-Id: <20220929114231.583801-29-alex.bennee@linaro.org>
> 
> I'm not at all convinced this change was/is a good idea.
> 
> First of all, it causes 'make' to now download about 1 GB of
> container images
> 
>   $ ./configure --target-list=x86_64-softmmu
>   $ make
>   ...snip...
>   BUILD   debian-powerpc-test-cross
>   Trying to pull registry.gitlab.com/qemu-project/qemu/qemu/debian-powerpc-test-cross:latest...
>   Getting image source signatures
>   Copying blob 2a205c8a1d36 [=>------------------------------------] 12.4MiB / 257.2MiB
> 
>   ...
>   ...snip...
>   
> Despite downloading this image, it then proceeded to rebuild the
> image from scratch, requiring another few 100MBs of downloads
> of dpkgs. This time the download was without progress information
> until it entirely failed due to a dead Debia mirror server, needing
> a retry.

This failure seems worse than I realized.  It also failed on a
non-responsive mirror when re-building the s390 image. WHen I
re-ran 'make' it definitely did not retry the re-build process,
as 'BUILD debian-s390x-cross' was instantaneous. So it looks
like it is using the downloaded cached image, despite the previous
'make' apparently considering that to have been outdated content
needing a rebuild.

FWIW the  failure output was:

  BUILD   debian-s390x-cross
Trying to pull registry.gitlab.com/qemu-project/qemu/qemu/debian-s390x-cross:latest...
Getting image source signatures
Copying blob fc8d65e34cd5 [===================================>--] 341.6MiB / 360.2MiB
Copying blob fc8d65e34cd5 done  
Copying blob bd159e379b3b skipped: already exists  
Copying blob 13224e2971af done  
Copying config 67a127f7cd done  
Writing manifest to image destination
Storing signatures
debconf: delaying package configuration, since apt-utils is not installed
E: Failed to fetch http://deb.debian.org/debian/pool/main/s/systemd/systemd_247.3-7%2bdeb11u1_amd64.deb  400  Bad Request [IP: 199.232.122.132 80]
E: Failed to fetch http://deb.debian.org/debian/pool/main/p/perl/perl_5.32.1-4%2bdeb11u2_amd64.deb  Error reading from server - read (104: Connection reset by peer) [IP: 199.232.122.132 80]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
Error: error building at STEP "RUN export DEBIAN_FRONTEND=noninteractive &&     apt-get update &&     apt-get install -y eatmydata &&     eatmydata apt-get dist-upgrade -y &&     eatmydata apt-get install --no-install-recommends -y             bash             bc             bison             bsdextrautils             bzip2             ca-certificates             ccache             dbus             debianutils             diffutils             exuberant-ctags             findutils             flex             gcovr             genisoimage             gettext             git             hostname             libglib2.0-dev             libpcre2-dev             libspice-protocol-dev             llvm             locales             make             meson             ncat             ninja-build             openssh-client             perl-base             pkgconf             python3             python3-numpy             python3-opencv             python3-pillow             python3-pip             python3-sphinx             python3-sphinx-rtd-theme             python3-venv             python3-yaml             rpm2cpio             sed             sparse             tar             tesseract-ocr             tesseract-ocr-eng             texinfo &&     eatmydata apt-get autoremove -y &&     eatmydata apt-get autoclean -y &&     sed -Ei 's,^# (en_US\.UTF-8 .*)$,\1,' /etc/locale.gen &&     dpkg-reconfigure locales": error while running runtime: exit status 100
Traceback (most recent call last):
  File "/home/berrange/src/virt/qemu/tests/docker/docker.py", line 683, in <module>
    sys.exit(main())
  File "/home/berrange/src/virt/qemu/tests/docker/docker.py", line 679, in main
    return args.cmdobj.run(args, argv)
  File "/home/berrange/src/virt/qemu/tests/docker/docker.py", line 493, in run
    dkr.build_image(tag, docker_dir, dockerfile,
  File "/home/berrange/src/virt/qemu/tests/docker/docker.py", line 343, in build_image
    self._do_check(build_args,
  File "/home/berrange/src/virt/qemu/tests/docker/docker.py", line 247, in _do_check
    return subprocess.check_call(self._command + cmd, **kwargs)
  File "/usr/lib64/python3.10/subprocess.py", line 369, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['podman', 'build', '-t', 'qemu/debian-s390x-cross', '-f', '/tmp/docker_buildt03fabg5/tmp3xpdzx90.docker', '--cache-from', 'registry.gitlab.com/qemu-project/qemu/qemu/debian-s390x-cross', '/tmp/docker_buildt03fabg5']' returned non-zero exit status 100.
make[1]: *** [/home/berrange/src/virt/qemu/tests/docker/Makefile.include:38: docker-image-debian-s390x-cross] Error 1
make[1]: Leaving directory '/home/berrange/src/virt/qemu/build'
make: *** [GNUmakefile:11: all] Error 2


With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|



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

* Re: [PULL 28/54] configure: build ROMs with container-based cross compilers
  2022-10-10 12:54   ` Daniel P. Berrangé
  2022-10-10 13:07     ` Daniel P. Berrangé
@ 2022-10-10 13:47     ` Alex Bennée
  1 sibling, 0 replies; 64+ messages in thread
From: Alex Bennée @ 2022-10-10 13:47 UTC (permalink / raw)
  To: Daniel P. Berrangé; +Cc: qemu-devel, stefanha, Paolo Bonzini


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

> On Tue, Oct 04, 2022 at 02:01:12PM +0100, Alex Bennée wrote:
>> From: Paolo Bonzini <pbonzini@redhat.com>
>> 
>> s390-ccw remains a bit more complex, because the -march=z900 test is done
>> only for the native cross compiler.  Otherwise, all that is needed is
>> to pass the (now mandatory) target argument to write_target_makefile.
>> 
>> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
>> Message-Id: <20220929114231.583801-29-alex.bennee@linaro.org>
>
> I'm not at all convinced this change was/is a good idea.
>
> First of all, it causes 'make' to now download about 1 GB of
> container images
>
>   $ ./configure --target-list=x86_64-softmmu
>   $ make
>   ...snip...
>   BUILD   debian-powerpc-test-cross
>   Trying to pull registry.gitlab.com/qemu-project/qemu/qemu/debian-powerpc-test-cross:latest...
>   Getting image source signatures
>   Copying blob 2a205c8a1d36 [=>------------------------------------] 12.4MiB / 257.2MiB
>
>   ...
>   ...snip...
>   
> Despite downloading this image, it then proceeded to rebuild the
> image from scratch, requiring another few 100MBs of downloads
> of dpkgs. This time the download was without progress information
> until it entirely failed due to a dead Debia mirror server, needing
> a retry.
>
> It then went on to download an s390x image which seems to have
> two layers, each with 360 MB.
>
>   BUILD   debian-s390x-cross
> Trying to pull registry.gitlab.com/qemu-project/qemu/qemu/debian-s390x-cross:latest...
> Getting image source signatures
> Copying blob fc8d65e34cd5 [>-------------------------------------] 12.0MiB / 360.2MiB
> Copying blob bd159e379b3b skipped: already exists  
> Copying blob 13224e2971af [>-------------------------------------] 12.2MiB / 366.5MiB
>
> So overall it was more than 1 GB of downloads when typing 'make'
>
> I wasn't too amuzed by seeing this downloaded data , given that
> I'm usually running off a 4G mobile connection, and it took a
> very long time.

Yikes, sorry I didn't notice that (probably because I always have most
of the containers built).

I was hoping the next set of patches would reduce the total re-build
time to just the mirror operation by dumping docker.py and any caching
that breaks.

> The progress information printed by docker when downloading
> the images splatters all over the output meson displays, when
> doing a parallel make making everything unintelligible.
>
>
> Finally, I had requested only building x86_64, so we shouldn't
> be doing anything related to ppc or s390 at all, but even if
>
> AFAICT, it enables this downloading unconditionally merely by
> having 'docker'/'podman' binaries installed, if you don't
> otherwise have cross compuilers present.
>
> I'd really not want to see any of this stuff downloaded without
> an explicit opt-in choice at configure time.
>
> I'm also a little concerned at what happens if we have to stop
> publishing the containers at registry.gitlab.com in future. Are
> we going to break the default 'make' for existing released QEMU
> tarballs ?

We can easily move the registry around. The aim of this work is to
eventually stop local re-builds for most people.

>
> Generally we've only relied on the gitlab infra for our CI
> testing, so we have been free to change infra or alter the
> way we publish images at any time, without risk of impact on
> the released tarballs.
>
> This isn't a theoretical problem, because GitLab has announced
> their intention to limit storage usage in gitlab.com, and even
> having joined the Open Source Program, our quota is only increased
> from 5 GB to 25 GB.  I'd be concerned we're at risk of exceeding
> that 25 GB limit, when they start to enforce it, requiring us to
> move container image host to somewhere else such as quay.io
>
>
>> diff --git a/configure b/configure
>> index c175650eb9..a54e17aca9 100755
>> --- a/configure
>> +++ b/configure
>> @@ -2152,7 +2152,7 @@ probe_target_compiler() {
>>      target_ranlib=
>>      target_strip=
>>    fi
>> -  test -n "$target_cc"
>> +  test -n "$target_cc" || test -n "$container_image"
>>  }
>>  
>>  write_target_makefile() {
>> @@ -2307,7 +2307,7 @@ if test "$targetos" != "darwin" && test "$targetos" != "sunos" && \
>>      config_mak=pc-bios/optionrom/config.mak
>>      echo "# Automatically generated by configure - do not modify" > $config_mak
>>      echo "TOPSRC_DIR=$source_path" >> $config_mak
>> -    write_target_makefile >> $config_mak
>> +    write_target_makefile pc-bios/optionrom/all >> $config_mak
>>  fi
>>  
>>  if test "$softmmu" = yes && probe_target_compiler ppc-softmmu; then
>> @@ -2315,25 +2315,31 @@ if test "$softmmu" = yes && probe_target_compiler ppc-softmmu; then
>>      config_mak=pc-bios/vof/config.mak
>>      echo "# Automatically generated by configure - do not modify" > $config_mak
>>      echo "SRC_DIR=$source_path/pc-bios/vof" >> $config_mak
>> -    write_target_makefile >> $config_mak
>> +    write_target_makefile pc-bios/vof/all >> $config_mak
>>  fi
>>  
>>  # Only build s390-ccw bios if the compiler has -march=z900 or -march=z10
>>  # (which is the lowest architecture level that Clang supports)
>>  if test "$softmmu" = yes && probe_target_compiler s390x-softmmu; then
>> -  write_c_skeleton
>> -  do_compiler "$target_cc" $target_cc_cflags -march=z900 -o $TMPO -c $TMPC
>> -  has_z900=$?
>> -  if [ $has_z900 = 0 ] || do_compiler "$target_cc" $target_cc_cflags -march=z10 -msoft-float -Werror -o $TMPO -c $TMPC; then
>> -    if [ $has_z900 != 0 ]; then
>> -      echo "WARNING: Your compiler does not support the z900!"
>> -      echo "         The s390-ccw bios will only work with guest CPUs >= z10."
>> +  got_cross_cc=no
>> +  if test -n "$target_cc"; then
>> +    write_c_skeleton
>> +    do_compiler "$target_cc" $target_cc_cflags -march=z900 -o $TMPO -c $TMPC
>> +    has_z900=$?
>> +    if [ $has_z900 = 0 ] || do_compiler "$target_cc" $target_cc_cflags -march=z10 -msoft-float -Werror -o $TMPO -c $TMPC; then
>> +      if [ $has_z900 != 0 ]; then
>> +        echo "WARNING: Your compiler does not support the z900!"
>> +        echo "         The s390-ccw bios will only work with guest CPUs >= z10."
>> +      fi
>> +      got_cross_cc=yes
>>      fi
>> +  fi
>> +  if test "$got_cross_cc" = yes || test -n "$container_image"; then
>>      roms="$roms pc-bios/s390-ccw"
>>      config_mak=pc-bios/s390-ccw/config-host.mak
>>      echo "# Automatically generated by configure - do not modify" > $config_mak
>>      echo "SRC_PATH=$source_path/pc-bios/s390-ccw" >> $config_mak
>> -    write_target_makefile >> $config_mak
>> +    write_target_makefile pc-bios/s390-ccw/all >> $config_mak
>>      # SLOF is required for building the s390-ccw firmware on s390x,
>>      # since it is using the libnet code from SLOF for network booting.
>>      git_submodules="${git_submodules} roms/SLOF"
>> @@ -2554,7 +2560,7 @@ for target in $target_list; do
>>        ;;
>>    esac
>>  
>> -  if probe_target_compiler $target || test -n "$container_image"; then
>> +  if probe_target_compiler $target; then
>>        test -n "$container_image" && build_static=y
>>        mkdir -p "tests/tcg/$target"
>>        config_target_mak=tests/tcg/$target/config-target.mak
>> -- 
>> 2.34.1
>> 
>> 
>
> With regards,
> Daniel


-- 
Alex Bennée


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

end of thread, other threads:[~2022-10-10 13:53 UTC | newest]

Thread overview: 64+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-04 13:00 [PULL 00/54] testing, gdbstub, plugin and gitdm updates Alex Bennée
2022-10-04 13:00 ` [PULL 01/54] scripts/ci/setup: ninja missing from build-environment Alex Bennée
2022-10-04 13:00 ` [PULL 02/54] scripts/ci/setup: Fix libxen requirements Alex Bennée
2022-10-04 13:00 ` [PULL 03/54] scripts/ci/setup: spice-server only on x86 aarch64 Alex Bennée
2022-10-04 13:00 ` [PULL 04/54] tests/docker: run script use realpath instead of readlink Alex Bennée
2022-10-04 13:00 ` [PULL 05/54] configure: move detected gdb to TCG's config-host.mak Alex Bennée
2022-10-04 13:00 ` [PULL 06/54] target/hexagon: add flex/bison/glib2 to qemu.yml Alex Bennée
2022-10-04 13:00 ` [PULL 07/54] target/hexagon: regenerate docker/cirrus files Alex Bennée
2022-10-04 13:00 ` [PULL 08/54] target/hexagon: manually add flex/bison/glib2 to remaining containers Alex Bennée
2022-10-04 13:00 ` [PULL 09/54] tests/docker: update fedora-win[32|64]-cross with lcitool Alex Bennée
2022-10-04 13:00 ` [PULL 10/54] tests/docker: move alpine from edge to tagged release Alex Bennée
2022-10-04 13:00 ` [PULL 11/54] tests/qtest: bump up QOS_PATH_MAX_ELEMENT_SIZE Alex Bennée
2022-10-04 13:00 ` [PULL 12/54] configure: do not invoke as/ld directly for pc-bios/optionrom Alex Bennée
2022-10-04 13:00 ` [PULL 13/54] pc-bios/optionrom: detect CC options just once Alex Bennée
2022-10-04 13:00 ` [PULL 14/54] pc-bios/s390-ccw: " Alex Bennée
2022-10-04 13:00 ` [PULL 15/54] vof: add distclean target Alex Bennée
2022-10-04 13:01 ` [PULL 16/54] build: add recursive distclean rules Alex Bennée
2022-10-04 13:01 ` [PULL 17/54] configure: return status code from probe_target_compiler Alex Bennée
2022-10-04 13:01 ` [PULL 18/54] configure: store container engine in config-host.mak Alex Bennée
2022-10-04 13:01 ` [PULL 19/54] tests: simplify Makefile invocation for tests/tcg Alex Bennée
2022-10-04 13:01 ` [PULL 20/54] tests/tcg: remove -f from Makefile invocation Alex Bennée
2022-10-04 13:01 ` [PULL 21/54] tests/tcg: add distclean rule Alex Bennée
2022-10-04 13:01 ` [PULL 22/54] tests/tcg: unify ppc64 and ppc64le Makefiles Alex Bennée
2022-10-04 13:01 ` [PULL 23/54] tests/tcg: clean up calls to run-test Alex Bennée
2022-10-04 13:01 ` [PULL 24/54] tests/tcg: move compiler tests to Makefiles Alex Bennée
2022-10-04 13:01 ` [PULL 25/54] configure: move tests/tcg/Makefile.prereqs to root build directory Alex Bennée
2022-10-04 13:01 ` [PULL 26/54] configure: unify creation of cross-compilation Makefiles Alex Bennée
2022-10-06 20:33   ` Stefan Hajnoczi
2022-10-04 13:01 ` [PULL 27/54] configure: cleanup creation of tests/tcg target config Alex Bennée
2022-10-04 13:01 ` [PULL 28/54] configure: build ROMs with container-based cross compilers Alex Bennée
2022-10-06 20:37   ` Stefan Hajnoczi
2022-10-10 12:54   ` Daniel P. Berrangé
2022-10-10 13:07     ` Daniel P. Berrangé
2022-10-10 13:47     ` Alex Bennée
2022-10-04 13:01 ` [PULL 29/54] pc-bios/optionrom: Adopt meson style Make output Alex Bennée
2022-10-04 13:01 ` [PULL 30/54] pc-bios/s390-ccw: " Alex Bennée
2022-10-04 13:01 ` [PULL 31/54] pc-bios/vof: " Alex Bennée
2022-10-04 13:01 ` [PULL 32/54] monitor: expose monitor_puts to rest of code Alex Bennée
2022-10-04 13:01 ` [PULL 33/54] disas: generalise plugin_printf and use for monitor_disas Alex Bennée
2022-10-04 13:01 ` [PULL 34/54] disas: use result of ->read_memory_func Alex Bennée
2022-10-04 13:01 ` [PULL 35/54] plugins: extend execlog to filter matches Alex Bennée
2022-10-04 13:01 ` [PULL 36/54] plugins: Assert mmu_idx in range before use in qemu_plugin_get_hwaddr Alex Bennée
2022-10-04 13:01 ` [PULL 37/54] docs/devel: clean-up qemu invocations in tcg-plugins Alex Bennée
2022-10-04 13:01 ` [PULL 38/54] docs/devel: move API to end of tcg-plugins.rst Alex Bennée
2022-10-04 13:01 ` [PULL 39/54] contrib/plugins: reset skip when matching in execlog Alex Bennée
2022-10-04 13:01 ` [PULL 40/54] docs/devel: document the test plugins Alex Bennée
2022-10-04 13:01 ` [PULL 41/54] semihosting: update link to spec Alex Bennée
2022-10-04 13:01 ` [PULL 42/54] gdbstub: move into its own sub directory Alex Bennée
2022-10-04 13:01 ` [PULL 43/54] gdbstub: move sstep flags probing into AccelClass Alex Bennée
2022-10-04 13:01 ` [PULL 44/54] gdbstub: move breakpoint logic to accel ops Alex Bennée
2022-10-04 13:01 ` [PULL 45/54] gdbstub: move guest debug support check to ops Alex Bennée
2022-10-04 13:01 ` [PULL 46/54] accel/kvm: move kvm_update_guest_debug to inline stub Alex Bennée
2022-10-04 13:01 ` [PULL 47/54] contrib/gitdm: add mapping for Loongson Technology Alex Bennée
2022-10-04 13:01 ` [PULL 48/54] contrib/gitdm: add Paul to individual contributors Alex Bennée
2022-10-04 13:01 ` [PULL 49/54] contrib/gitdm: add WANG Xuerui to individual contributers Alex Bennée
2022-10-04 13:01 ` [PULL 50/54] contrib/gitdm: add ISCAS to the academics group Alex Bennée
2022-10-04 13:01 ` [PULL 51/54] contrib/gitdm: add China Telecom to the domain map Alex Bennée
2022-10-04 13:01 ` [PULL 52/54] contrib/gitdm: add Simon to individual contributors Alex Bennée
2022-10-04 16:06   ` Simon Safar via
2022-10-04 13:01 ` [PULL 53/54] contrib/gitdm: add Université Grenoble Alpes Alex Bennée
2022-10-04 13:01 ` [PULL 54/54] plugins: add [pre|post]fork helpers to linux-user Alex Bennée
2022-10-05 14:16 ` [PULL 00/54] testing, gdbstub, plugin and gitdm updates Stefan Hajnoczi
2022-10-05 15:23   ` Alex Bennée
2022-10-05 23:17     ` Paolo Bonzini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.