qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 00/14] random fixes for 8.2 pre-PR (tests, plugins, docs, semihosting)
@ 2023-11-20 15:08 Alex Bennée
  2023-11-20 15:08 ` [PATCH v2 01/14] tests/docker: replace fedora-i386 with debian-i686 Alex Bennée
                   ` (13 more replies)
  0 siblings, 14 replies; 21+ messages in thread
From: Alex Bennée @ 2023-11-20 15:08 UTC (permalink / raw)
  To: qemu-devel
  Cc: Wainer dos Santos Moschetta, Cédric Le Goater,
	Mahmoud Mandour, Peter Maydell, David Hildenbrand,
	Alex Bennée, qemu-s390x, Beraldo Leal, qemu-arm, devel,
	qemu-ppc, Daniel Henrique Barboza, Paolo Bonzini,
	Philippe Mathieu-Daudé, Alexandre Iooss, Marek Vasut,
	Thomas Huth, Chris Wulff, Ilya Leoshkevich, Richard Henderson,
	Nicholas Piggin

I've just been trying to clear some of the bugs against various
subsystems. These are mostly testing changes and a minor tweak I found
while checking up on semihosting behaviour. Enabling arm-softmmu
check-tcg tests expands our testing abilities slightly for the 32 bit
side of the family.

For v2
------

 - fixed up register test for ppc64/s390x
 - added gdbstub doc patch
 - review comments for arm-softmmu testing
 - changed handling of "native" cross for linux-user

I intend to roll the PR on Wednesday.

The following need still review:

  tests/tcg: finesse the registers check for "hidden" regs
  configure: don't try a "native" cross for linux-user
  tests/tcg: enable semiconsole test for Arm
  tests/tcg: enable arm softmmu tests
  docs/system: clarify limits of using gdbstub in system emulation
  docs/emulation: expand warning about semihosting
  tests/tcg: fixup Aarch64 semiconsole test

Alex Bennée (10):
  tests/docker: merge debian-native with debian-amd64
  tests/tcg: fixup Aarch64 semiconsole test
  docs/emulation: expand warning about semihosting
  docs/system: clarify limits of using gdbstub in system emulation
  hw/core: skip loading debug on all failures
  testing: move arm system tests into their own folder
  tests/tcg: enable arm softmmu tests
  tests/tcg: enable semiconsole test for Arm
  configure: don't try a "native" cross for linux-user
  tests/tcg: finesse the registers check for "hidden" regs

Daniel P. Berrangé (1):
  tests/docker: replace fedora-i386 with debian-i686

Greg Manning (1):
  plugins: fix win plugin tests on cross compile

Philippe Mathieu-Daudé (2):
  .gitlab-ci.d/cirrus: Upgrade macOS to 13 (Ventura)
  target/nios2: Deprecate the Nios II architecture

 docs/about/deprecated.rst                     |  15 +
 docs/about/emulation.rst                      |   5 +-
 docs/system/gdb.rst                           |  13 +-
 configure                                     |  27 +-
 hw/core/loader.c                              |   2 +-
 hw/nios2/10m50_devboard.c                     |   1 +
 hw/nios2/generic_nommu.c                      |   1 +
 tests/tcg/arm/system/semiconsole.c            |  42 +++
 .gitlab-ci.d/buildtest.yml                    |  12 +-
 .gitlab-ci.d/cirrus.yml                       |   6 +-
 .../cirrus/{macos-12.vars => macos-13.vars}   |   2 +-
 .gitlab-ci.d/container-cross.yml              |  11 +-
 .gitlab-ci.d/containers.yml                   |   2 +-
 .gitlab-ci.d/crossbuilds.yml                  |  14 +-
 contrib/plugins/Makefile                      |   2 +-
 plugins/meson.build                           |   2 +-
 tests/docker/Makefile.include                 |   3 -
 .../dockerfiles/debian-i686-cross.docker      | 182 +++++++++++
 tests/docker/dockerfiles/debian-native.docker |  54 ----
 .../{debian-amd64.docker => debian.docker}    |   7 +-
 .../dockerfiles/fedora-i386-cross.docker      |  40 ---
 tests/lcitool/refresh                         |  18 +-
 tests/plugin/meson.build                      |   3 +-
 tests/tcg/aarch64/Makefile.softmmu-target     |   5 +-
 tests/tcg/arm/Makefile.softmmu-target         |  76 ++++-
 tests/tcg/arm/system/boot.S                   | 301 ++++++++++++++++++
 tests/tcg/arm/system/kernel.ld                |  24 ++
 .../tcg/arm/{ => system}/test-armv6m-undef.S  |   0
 .../tcg/arm/{ => system}/test-armv6m-undef.ld |   0
 tests/tcg/multiarch/gdbstub/registers.py      |  87 +++--
 tests/tcg/ppc64/Makefile.target               |   7 -
 tests/tcg/s390x/Makefile.target               |   4 -
 32 files changed, 775 insertions(+), 193 deletions(-)
 create mode 100644 tests/tcg/arm/system/semiconsole.c
 rename .gitlab-ci.d/cirrus/{macos-12.vars => macos-13.vars} (95%)
 create mode 100644 tests/docker/dockerfiles/debian-i686-cross.docker
 delete mode 100644 tests/docker/dockerfiles/debian-native.docker
 rename tests/docker/dockerfiles/{debian-amd64.docker => debian.docker} (96%)
 delete mode 100644 tests/docker/dockerfiles/fedora-i386-cross.docker
 create mode 100644 tests/tcg/arm/system/boot.S
 create mode 100644 tests/tcg/arm/system/kernel.ld
 rename tests/tcg/arm/{ => system}/test-armv6m-undef.S (100%)
 rename tests/tcg/arm/{ => system}/test-armv6m-undef.ld (100%)

-- 
2.39.2



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

* [PATCH v2 01/14] tests/docker: replace fedora-i386 with debian-i686
  2023-11-20 15:08 [PATCH v2 00/14] random fixes for 8.2 pre-PR (tests, plugins, docs, semihosting) Alex Bennée
@ 2023-11-20 15:08 ` Alex Bennée
  2023-11-20 15:08 ` [PATCH v2 02/14] .gitlab-ci.d/cirrus: Upgrade macOS to 13 (Ventura) Alex Bennée
                   ` (12 subsequent siblings)
  13 siblings, 0 replies; 21+ messages in thread
From: Alex Bennée @ 2023-11-20 15:08 UTC (permalink / raw)
  To: qemu-devel
  Cc: Wainer dos Santos Moschetta, Cédric Le Goater,
	Mahmoud Mandour, Peter Maydell, David Hildenbrand,
	Alex Bennée, qemu-s390x, Beraldo Leal, qemu-arm, devel,
	qemu-ppc, Daniel Henrique Barboza, Paolo Bonzini,
	Philippe Mathieu-Daudé, Alexandre Iooss, Marek Vasut,
	Thomas Huth, Chris Wulff, Ilya Leoshkevich, Richard Henderson,
	Nicholas Piggin, Daniel P. Berrangé

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

Fedora is gradually killing off i386 packages in its repos, via a
death-by-1000-cuts process. Thus Debian looks like a better long
term bet for i686 build testing. It has the added advantage that
we can generate it via lcitool too.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20231107164109.1449014-1-berrange@redhat.com>
[AJB: tweak commit msg, set correct prefix]
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

---
v2
  - also set correct prefix
---
 configure                                     |   4 +-
 .gitlab-ci.d/container-cross.yml              |  11 +-
 .gitlab-ci.d/crossbuilds.yml                  |  12 +-
 .../dockerfiles/debian-i686-cross.docker      | 182 ++++++++++++++++++
 .../dockerfiles/fedora-i386-cross.docker      |  40 ----
 tests/lcitool/refresh                         |   7 +
 6 files changed, 203 insertions(+), 53 deletions(-)
 create mode 100644 tests/docker/dockerfiles/debian-i686-cross.docker
 delete mode 100644 tests/docker/dockerfiles/fedora-i386-cross.docker

diff --git a/configure b/configure
index abcb199aa8..9ea0bf5698 100755
--- a/configure
+++ b/configure
@@ -1307,8 +1307,8 @@ probe_target_compiler() {
         container_cross_cc=${container_cross_prefix}gcc
         ;;
       i386)
-        container_image=fedora-i386-cross
-        container_cross_prefix=
+        container_image=debian-i686-cross
+        container_cross_prefix=i686-linux-gnu-
         ;;
       loongarch64)
         container_image=debian-loongarch-cross
diff --git a/.gitlab-ci.d/container-cross.yml b/.gitlab-ci.d/container-cross.yml
index 463ac493ad..8d235cbea0 100644
--- a/.gitlab-ci.d/container-cross.yml
+++ b/.gitlab-ci.d/container-cross.yml
@@ -46,6 +46,12 @@ loongarch-debian-cross-container:
   variables:
     NAME: debian-loongarch-cross
 
+i686-debian-cross-container:
+  extends: .container_job_template
+  stage: containers
+  variables:
+    NAME: debian-i686-cross
+
 mips64el-debian-cross-container:
   extends: .container_job_template
   stage: containers
@@ -95,11 +101,6 @@ cris-fedora-cross-container:
   variables:
     NAME: fedora-cris-cross
 
-i386-fedora-cross-container:
-  extends: .container_job_template
-  variables:
-    NAME: fedora-i386-cross
-
 win32-fedora-cross-container:
   extends: .container_job_template
   variables:
diff --git a/.gitlab-ci.d/crossbuilds.yml b/.gitlab-ci.d/crossbuilds.yml
index ac71a2abd3..c2af6c7f44 100644
--- a/.gitlab-ci.d/crossbuilds.yml
+++ b/.gitlab-ci.d/crossbuilds.yml
@@ -37,25 +37,25 @@ cross-arm64-kvm-only:
     IMAGE: debian-arm64-cross
     EXTRA_CONFIGURE_OPTS: --disable-tcg --without-default-features
 
-cross-i386-user:
+cross-i686-user:
   extends:
     - .cross_user_build_job
     - .cross_test_artifacts
   needs:
-    job: i386-fedora-cross-container
+    job: i686-debian-cross-container
   variables:
-    IMAGE: fedora-i386-cross
+    IMAGE: debian-i686-cross
     MAKE_CHECK_ARGS: check
 
-cross-i386-tci:
+cross-i686-tci:
   extends:
     - .cross_accel_build_job
     - .cross_test_artifacts
   timeout: 60m
   needs:
-    job: i386-fedora-cross-container
+    job: i686-debian-cross-container
   variables:
-    IMAGE: fedora-i386-cross
+    IMAGE: debian-i686-cross
     ACCEL: tcg-interpreter
     EXTRA_CONFIGURE_OPTS: --target-list=i386-softmmu,i386-linux-user,aarch64-softmmu,aarch64-linux-user,ppc-softmmu,ppc-linux-user --disable-plugins
     MAKE_CHECK_ARGS: check check-tcg
diff --git a/tests/docker/dockerfiles/debian-i686-cross.docker b/tests/docker/dockerfiles/debian-i686-cross.docker
new file mode 100644
index 0000000000..3fc4e15acd
--- /dev/null
+++ b/tests/docker/dockerfiles/debian-i686-cross.docker
@@ -0,0 +1,182 @@
+# THIS FILE WAS AUTO-GENERATED
+#
+#  $ lcitool dockerfile --layers all --cross-arch i686 debian-11 qemu
+#
+# https://gitlab.com/libvirt/libvirt-ci
+
+FROM docker.io/library/debian:11-slim
+
+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 \
+                      gcc \
+                      gcovr \
+                      gettext \
+                      git \
+                      hostname \
+                      libglib2.0-dev \
+                      libpcre2-dev \
+                      libsndio-dev \
+                      libspice-protocol-dev \
+                      llvm \
+                      locales \
+                      make \
+                      meson \
+                      mtools \
+                      ncat \
+                      ninja-build \
+                      openssh-client \
+                      pkgconf \
+                      python3 \
+                      python3-numpy \
+                      python3-opencv \
+                      python3-pillow \
+                      python3-pip \
+                      python3-setuptools \
+                      python3-sphinx \
+                      python3-sphinx-rtd-theme \
+                      python3-venv \
+                      python3-wheel \
+                      python3-yaml \
+                      rpm2cpio \
+                      sed \
+                      socat \
+                      sparse \
+                      tar \
+                      tesseract-ocr \
+                      tesseract-ocr-eng \
+                      xorriso \
+                      zstd && \
+    eatmydata apt-get autoremove -y && \
+    eatmydata apt-get autoclean -y && \
+    sed -Ei 's,^# (en_US\.UTF-8 .*)$,\1,' /etc/locale.gen && \
+    dpkg-reconfigure locales
+
+RUN /usr/bin/pip3 install tomli
+
+ENV CCACHE_WRAPPERSDIR "/usr/libexec/ccache-wrappers"
+ENV LANG "en_US.UTF-8"
+ENV MAKE "/usr/bin/make"
+ENV NINJA "/usr/bin/ninja"
+ENV PYTHON "/usr/bin/python3"
+
+RUN export DEBIAN_FRONTEND=noninteractive && \
+    dpkg --add-architecture i386 && \
+    eatmydata apt-get update && \
+    eatmydata apt-get dist-upgrade -y && \
+    eatmydata apt-get install --no-install-recommends -y dpkg-dev && \
+    eatmydata apt-get install --no-install-recommends -y \
+                      g++-i686-linux-gnu \
+                      gcc-i686-linux-gnu \
+                      libaio-dev:i386 \
+                      libasan6:i386 \
+                      libasound2-dev:i386 \
+                      libattr1-dev:i386 \
+                      libbpf-dev:i386 \
+                      libbrlapi-dev:i386 \
+                      libbz2-dev:i386 \
+                      libc6-dev:i386 \
+                      libcacard-dev:i386 \
+                      libcap-ng-dev:i386 \
+                      libcapstone-dev:i386 \
+                      libcmocka-dev:i386 \
+                      libcurl4-gnutls-dev:i386 \
+                      libdaxctl-dev:i386 \
+                      libdrm-dev:i386 \
+                      libepoxy-dev:i386 \
+                      libfdt-dev:i386 \
+                      libffi-dev:i386 \
+                      libfuse3-dev:i386 \
+                      libgbm-dev:i386 \
+                      libgcrypt20-dev:i386 \
+                      libglib2.0-dev:i386 \
+                      libglusterfs-dev:i386 \
+                      libgnutls28-dev:i386 \
+                      libgtk-3-dev:i386 \
+                      libibumad-dev:i386 \
+                      libibverbs-dev:i386 \
+                      libiscsi-dev:i386 \
+                      libjemalloc-dev:i386 \
+                      libjpeg62-turbo-dev:i386 \
+                      libjson-c-dev:i386 \
+                      liblttng-ust-dev:i386 \
+                      liblzo2-dev:i386 \
+                      libncursesw5-dev:i386 \
+                      libnfs-dev:i386 \
+                      libnuma-dev:i386 \
+                      libpam0g-dev:i386 \
+                      libpipewire-0.3-dev:i386 \
+                      libpixman-1-dev:i386 \
+                      libpng-dev:i386 \
+                      libpulse-dev:i386 \
+                      librbd-dev:i386 \
+                      librdmacm-dev:i386 \
+                      libsasl2-dev:i386 \
+                      libsdl2-dev:i386 \
+                      libsdl2-image-dev:i386 \
+                      libseccomp-dev:i386 \
+                      libselinux1-dev:i386 \
+                      libslirp-dev:i386 \
+                      libsnappy-dev:i386 \
+                      libspice-server-dev:i386 \
+                      libssh-gcrypt-dev:i386 \
+                      libsystemd-dev:i386 \
+                      libtasn1-6-dev:i386 \
+                      libubsan1:i386 \
+                      libudev-dev:i386 \
+                      liburing-dev:i386 \
+                      libusb-1.0-0-dev:i386 \
+                      libusbredirhost-dev:i386 \
+                      libvdeplug-dev:i386 \
+                      libvirglrenderer-dev:i386 \
+                      libvte-2.91-dev:i386 \
+                      libzstd-dev:i386 \
+                      nettle-dev:i386 \
+                      systemtap-sdt-dev:i386 \
+                      xfslibs-dev:i386 \
+                      zlib1g-dev:i386 && \
+    eatmydata apt-get autoremove -y && \
+    eatmydata apt-get autoclean -y && \
+    mkdir -p /usr/local/share/meson/cross && \
+    printf "[binaries]\n\
+c = '/usr/bin/i686-linux-gnu-gcc'\n\
+ar = '/usr/bin/i686-linux-gnu-gcc-ar'\n\
+strip = '/usr/bin/i686-linux-gnu-strip'\n\
+pkgconfig = '/usr/bin/i686-linux-gnu-pkg-config'\n\
+\n\
+[host_machine]\n\
+system = 'linux'\n\
+cpu_family = 'x86'\n\
+cpu = 'i686'\n\
+endian = 'little'\n" > /usr/local/share/meson/cross/i686-linux-gnu && \
+    dpkg-query --showformat '${Package}_${Version}_${Architecture}\n' --show > /packages.txt && \
+    mkdir -p /usr/libexec/ccache-wrappers && \
+    ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/i686-linux-gnu-c++ && \
+    ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/i686-linux-gnu-cc && \
+    ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/i686-linux-gnu-g++ && \
+    ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/i686-linux-gnu-gcc
+
+ENV ABI "i686-linux-gnu"
+ENV MESON_OPTS "--cross-file=i686-linux-gnu"
+ENV QEMU_CONFIGURE_OPTS --cross-prefix=x86_64-linux-gnu-
+ENV DEF_TARGET_LIST x86_64-softmmu,x86_64-linux-user,i386-softmmu,i386-linux-user
+# As a final step configure the user (if env is defined)
+ARG USER
+ARG UID
+RUN if [ "${USER}" ]; then \
+  id ${USER} 2>/dev/null || useradd -u ${UID} -U ${USER}; fi
diff --git a/tests/docker/dockerfiles/fedora-i386-cross.docker b/tests/docker/dockerfiles/fedora-i386-cross.docker
deleted file mode 100644
index b59a9115c4..0000000000
--- a/tests/docker/dockerfiles/fedora-i386-cross.docker
+++ /dev/null
@@ -1,40 +0,0 @@
-FROM registry.fedoraproject.org/fedora:34
-
-ENV PACKAGES \
-    bison \
-    bzip2 \
-    ccache \
-    diffutils \
-    flex \
-    findutils \
-    gcc \
-    git \
-    libfdt-devel.i686 \
-    libffi-devel.i686 \
-    libselinux-devel.i686 \
-    libtasn1-devel.i686 \
-    libzstd-devel.i686 \
-    make \
-    meson \
-    ninja-build \
-    glib2-devel.i686 \
-    glibc-devel.i686 \
-    glibc-static.i686 \
-    gnutls-devel.i686 \
-    nettle-devel.i686 \
-    pcre-devel.i686 \
-    pixman-devel.i686 \
-    python3-tomli \
-    sysprof-capture-devel.i686 \
-    zlib-devel.i686
-
-ENV QEMU_CONFIGURE_OPTS --cpu=i386 --disable-vhost-user
-ENV PKG_CONFIG_LIBDIR /usr/lib/pkgconfig
-
-RUN dnf update -y && dnf install -y $PACKAGES
-RUN rpm -q $PACKAGES | sort > /packages.txt
-# As a final step configure the user (if env is defined)
-ARG USER
-ARG UID
-RUN if [ "${USER}" ]; then \
-  id ${USER} 2>/dev/null || useradd -u ${UID} -U ${USER}; fi
diff --git a/tests/lcitool/refresh b/tests/lcitool/refresh
index 92e7d30982..10c54a377c 100755
--- a/tests/lcitool/refresh
+++ b/tests/lcitool/refresh
@@ -156,6 +156,13 @@ try:
                         trailer=cross_build("arm-linux-gnueabihf-",
                                             "arm-softmmu,arm-linux-user"))
 
+    generate_dockerfile("debian-i686-cross", "debian-11",
+                        cross="i686",
+                        trailer=cross_build("x86_64-linux-gnu-",
+                                            "x86_64-softmmu,"
+                                            "x86_64-linux-user,"
+                                            "i386-softmmu,i386-linux-user"))
+
     generate_dockerfile("debian-mips64el-cross", "debian-11",
                         cross="mips64el",
                         trailer=cross_build("mips64el-linux-gnuabi64-",
-- 
2.39.2



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

* [PATCH v2 02/14] .gitlab-ci.d/cirrus: Upgrade macOS to 13 (Ventura)
  2023-11-20 15:08 [PATCH v2 00/14] random fixes for 8.2 pre-PR (tests, plugins, docs, semihosting) Alex Bennée
  2023-11-20 15:08 ` [PATCH v2 01/14] tests/docker: replace fedora-i386 with debian-i686 Alex Bennée
@ 2023-11-20 15:08 ` Alex Bennée
  2023-11-20 15:08 ` [PATCH v2 03/14] tests/docker: merge debian-native with debian-amd64 Alex Bennée
                   ` (11 subsequent siblings)
  13 siblings, 0 replies; 21+ messages in thread
From: Alex Bennée @ 2023-11-20 15:08 UTC (permalink / raw)
  To: qemu-devel
  Cc: Wainer dos Santos Moschetta, Cédric Le Goater,
	Mahmoud Mandour, Peter Maydell, David Hildenbrand,
	Alex Bennée, qemu-s390x, Beraldo Leal, qemu-arm, devel,
	qemu-ppc, Daniel Henrique Barboza, Paolo Bonzini,
	Philippe Mathieu-Daudé, Alexandre Iooss, Marek Vasut,
	Thomas Huth, Chris Wulff, Ilya Leoshkevich, Richard Henderson,
	Nicholas Piggin, Daniel P . Berrangé

From: Philippe Mathieu-Daudé <philmd@linaro.org>

macOS 14 "Sonoma" was released on September 2023 [1].

According to QEMU's support policy, we stop supporting the
previous major release two years after the the new major
release has been published. Replace the macOS 12 (Monterey)
testing by macOS 13 (Ventura, released on October 2022, [2]).

Refresh the generated files by running:

  $ make lcitool-refresh

[1] https://www.apple.com/newsroom/2023/09/macos-sonoma-is-available-today/
[2] https://www.apple.com/newsroom/2022/10/macos-ventura-is-now-available/

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Message-Id: <20231108162022.76189-1-philmd@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
 .gitlab-ci.d/cirrus.yml                              | 6 +++---
 .gitlab-ci.d/cirrus/{macos-12.vars => macos-13.vars} | 2 +-
 tests/lcitool/refresh                                | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)
 rename .gitlab-ci.d/cirrus/{macos-12.vars => macos-13.vars} (95%)

diff --git a/.gitlab-ci.d/cirrus.yml b/.gitlab-ci.d/cirrus.yml
index e7f1f83c2c..07dc6edae1 100644
--- a/.gitlab-ci.d/cirrus.yml
+++ b/.gitlab-ci.d/cirrus.yml
@@ -59,13 +59,13 @@ x64-freebsd-13-build:
     INSTALL_COMMAND: pkg install -y
     TEST_TARGETS: check
 
-aarch64-macos-12-base-build:
+aarch64-macos-13-base-build:
   extends: .cirrus_build_job
   variables:
-    NAME: macos-12
+    NAME: macos-13
     CIRRUS_VM_INSTANCE_TYPE: macos_instance
     CIRRUS_VM_IMAGE_SELECTOR: image
-    CIRRUS_VM_IMAGE_NAME: ghcr.io/cirruslabs/macos-monterey-base:latest
+    CIRRUS_VM_IMAGE_NAME: ghcr.io/cirruslabs/macos-ventura-base:latest
     CIRRUS_VM_CPUS: 12
     CIRRUS_VM_RAM: 24G
     UPDATE_COMMAND: brew update
diff --git a/.gitlab-ci.d/cirrus/macos-12.vars b/.gitlab-ci.d/cirrus/macos-13.vars
similarity index 95%
rename from .gitlab-ci.d/cirrus/macos-12.vars
rename to .gitlab-ci.d/cirrus/macos-13.vars
index 5f3fb346d1..534f029956 100644
--- a/.gitlab-ci.d/cirrus/macos-12.vars
+++ b/.gitlab-ci.d/cirrus/macos-13.vars
@@ -1,6 +1,6 @@
 # THIS FILE WAS AUTO-GENERATED
 #
-#  $ lcitool variables macos-12 qemu
+#  $ lcitool variables macos-13 qemu
 #
 # https://gitlab.com/libvirt/libvirt-ci
 
diff --git a/tests/lcitool/refresh b/tests/lcitool/refresh
index 10c54a377c..7c211eba2e 100755
--- a/tests/lcitool/refresh
+++ b/tests/lcitool/refresh
@@ -203,7 +203,7 @@ try:
     # Cirrus packages lists for GitLab
     #
     generate_cirrus("freebsd-13")
-    generate_cirrus("macos-12")
+    generate_cirrus("macos-13")
 
     #
     # VM packages lists
-- 
2.39.2



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

* [PATCH v2 03/14] tests/docker: merge debian-native with debian-amd64
  2023-11-20 15:08 [PATCH v2 00/14] random fixes for 8.2 pre-PR (tests, plugins, docs, semihosting) Alex Bennée
  2023-11-20 15:08 ` [PATCH v2 01/14] tests/docker: replace fedora-i386 with debian-i686 Alex Bennée
  2023-11-20 15:08 ` [PATCH v2 02/14] .gitlab-ci.d/cirrus: Upgrade macOS to 13 (Ventura) Alex Bennée
@ 2023-11-20 15:08 ` Alex Bennée
  2023-11-20 15:08 ` [PATCH v2 04/14] plugins: fix win plugin tests on cross compile Alex Bennée
                   ` (10 subsequent siblings)
  13 siblings, 0 replies; 21+ messages in thread
From: Alex Bennée @ 2023-11-20 15:08 UTC (permalink / raw)
  To: qemu-devel
  Cc: Wainer dos Santos Moschetta, Cédric Le Goater,
	Mahmoud Mandour, Peter Maydell, David Hildenbrand,
	Alex Bennée, qemu-s390x, Beraldo Leal, qemu-arm, devel,
	qemu-ppc, Daniel Henrique Barboza, Paolo Bonzini,
	Philippe Mathieu-Daudé, Alexandre Iooss, Marek Vasut,
	Thomas Huth, Chris Wulff, Ilya Leoshkevich, Richard Henderson,
	Nicholas Piggin, Anders Roxell

debian-native isn't really needed and suffers from the problem of
tracking a distros dependencies rather than the projects. With a
little surgery we can make the debian-amd64 container architecture
neutral and allow people to use it to build a native QEMU.

Rename it so it follows the same non-arch pattern of the other distro
containers.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Anders Roxell <anders.roxell@linaro.org>
---
 .gitlab-ci.d/buildtest.yml                    | 12 ++---
 .gitlab-ci.d/containers.yml                   |  2 +-
 tests/docker/Makefile.include                 |  3 --
 tests/docker/dockerfiles/debian-native.docker | 54 -------------------
 .../{debian-amd64.docker => debian.docker}    |  7 ++-
 tests/lcitool/refresh                         |  9 ++--
 6 files changed, 18 insertions(+), 69 deletions(-)
 delete mode 100644 tests/docker/dockerfiles/debian-native.docker
 rename tests/docker/dockerfiles/{debian-amd64.docker => debian.docker} (96%)

diff --git a/.gitlab-ci.d/buildtest.yml b/.gitlab-ci.d/buildtest.yml
index da72f7c690..7f9af83b10 100644
--- a/.gitlab-ci.d/buildtest.yml
+++ b/.gitlab-ci.d/buildtest.yml
@@ -70,7 +70,7 @@ build-system-debian:
   needs:
     job: amd64-debian-container
   variables:
-    IMAGE: debian-amd64
+    IMAGE: debian
     CONFIGURE_ARGS: --with-coroutine=sigaltstack
     TARGETS: arm-softmmu i386-softmmu riscv64-softmmu sh4eb-softmmu
       sparc-softmmu xtensa-softmmu
@@ -82,7 +82,7 @@ check-system-debian:
     - job: build-system-debian
       artifacts: true
   variables:
-    IMAGE: debian-amd64
+    IMAGE: debian
     MAKE_CHECK_ARGS: check
 
 avocado-system-debian:
@@ -91,7 +91,7 @@ avocado-system-debian:
     - job: build-system-debian
       artifacts: true
   variables:
-    IMAGE: debian-amd64
+    IMAGE: debian
     MAKE_CHECK_ARGS: check-avocado
     AVOCADO_TAGS: arch:arm arch:i386 arch:riscv64 arch:sh4 arch:sparc arch:xtensa
 
@@ -101,7 +101,7 @@ crash-test-debian:
     - job: build-system-debian
       artifacts: true
   variables:
-    IMAGE: debian-amd64
+    IMAGE: debian
   script:
     - cd build
     - make NINJA=":" check-venv
@@ -589,7 +589,7 @@ build-tools-and-docs-debian:
     # when running on 'master' we use pre-existing container
     optional: true
   variables:
-    IMAGE: debian-amd64
+    IMAGE: debian
     MAKE_CHECK_ARGS: check-unit ctags TAGS cscope
     CONFIGURE_ARGS: --disable-system --disable-user --enable-docs --enable-tools
     QEMU_JOB_PUBLISH: 1
@@ -609,7 +609,7 @@ build-tools-and-docs-debian:
 # of what topic branch they're currently using
 pages:
   extends: .base_job_template
-  image: $CI_REGISTRY_IMAGE/qemu/debian-amd64:$QEMU_CI_CONTAINER_TAG
+  image: $CI_REGISTRY_IMAGE/qemu/debian:$QEMU_CI_CONTAINER_TAG
   stage: test
   needs:
     - job: build-tools-and-docs-debian
diff --git a/.gitlab-ci.d/containers.yml b/.gitlab-ci.d/containers.yml
index 8637a13d86..ae79d4c58b 100644
--- a/.gitlab-ci.d/containers.yml
+++ b/.gitlab-ci.d/containers.yml
@@ -11,7 +11,7 @@ amd64-debian-container:
   extends: .container_job_template
   stage: containers
   variables:
-    NAME: debian-amd64
+    NAME: debian
 
 amd64-ubuntu2204-container:
   extends: .container_job_template
diff --git a/tests/docker/Makefile.include b/tests/docker/Makefile.include
index cd4688bf07..5ba5b50ab9 100644
--- a/tests/docker/Makefile.include
+++ b/tests/docker/Makefile.include
@@ -88,9 +88,6 @@ DOCKER_PARTIAL_IMAGES += debian-s390x-cross
 DOCKER_PARTIAL_IMAGES += fedora
 endif
 
-# The native build should never use the registry
-docker-image-debian-native: DOCKER_REGISTRY=
-
 # alpine has no adduser
 docker-image-alpine: NOUSER=1
 
diff --git a/tests/docker/dockerfiles/debian-native.docker b/tests/docker/dockerfiles/debian-native.docker
deleted file mode 100644
index abac7d7cd7..0000000000
--- a/tests/docker/dockerfiles/debian-native.docker
+++ /dev/null
@@ -1,54 +0,0 @@
-#
-# Docker Debian Native
-#
-# This is intended to build QEMU on native host systems. Debian is
-# chosen due to the broadest range on supported host systems for QEMU.
-#
-# This docker target is based on the docker.io Debian Bullseye base
-# image rather than QEMU's base because we would otherwise confuse the
-# build grabbing stuff from the registry built for other
-# architectures.
-#
-FROM docker.io/library/debian:bullseye-slim
-MAINTAINER Alex Bennée <alex.bennee@linaro.org>
-
-# Duplicate deb line as deb-src
-RUN cat /etc/apt/sources.list | sed "s/^deb\ /deb-src /" >> /etc/apt/sources.list
-
-# Install common build utilities
-RUN apt update && \
-    DEBIAN_FRONTEND=noninteractive apt install -yy eatmydata
-
-RUN apt update && \
-    DEBIAN_FRONTEND=noninteractive eatmydata \
-    apt build-dep -yy --arch-only qemu
-
-RUN apt update && \
-    DEBIAN_FRONTEND=noninteractive eatmydata \
-    apt install -y --no-install-recommends \
-        cscope \
-        genisoimage \
-        exuberant-ctags \
-        global \
-        libbz2-dev \
-        liblzo2-dev \
-        libgcrypt20-dev \
-        libfdt-dev \
-        librdmacm-dev \
-        libsasl2-dev \
-        libsnappy-dev \
-        libvte-dev \
-        netcat-openbsd \
-        ninja-build \
-        openssh-client \
-        python3-numpy \
-        python3-opencv \
-        python3-venv
-
-ENV QEMU_CONFIGURE_OPTS $QEMU_CONFIGURE_OPTS
-ENV DEF_TARGET_LIST "none"
-# As a final step configure the user (if env is defined)
-ARG USER
-ARG UID
-RUN if [ "${USER}" ]; then \
-  id ${USER} 2>/dev/null || useradd -u ${UID} -U ${USER}; fi
diff --git a/tests/docker/dockerfiles/debian-amd64.docker b/tests/docker/dockerfiles/debian.docker
similarity index 96%
rename from tests/docker/dockerfiles/debian-amd64.docker
rename to tests/docker/dockerfiles/debian.docker
index 9b50fb2f63..b5e642d5b6 100644
--- a/tests/docker/dockerfiles/debian-amd64.docker
+++ b/tests/docker/dockerfiles/debian.docker
@@ -155,10 +155,13 @@ RUN DEBIAN_FRONTEND=noninteractive eatmydata \
   apt install -y --no-install-recommends \
   cscope\
   global\
-  linux-headers-amd64
+  linux-headers-generic
 RUN git clone https://github.com/luigirizzo/netmap.git /usr/src/netmap
 RUN cd /usr/src/netmap && git checkout v11.3
-RUN cd /usr/src/netmap/LINUX && ./configure --no-drivers --no-apps --kernel-dir=$(ls -d /usr/src/linux-headers-*-amd64) && make install
+RUN cd /usr/src/netmap/LINUX && \
+  ./configure --no-drivers --no-apps \
+  --kernel-dir=$(ls -d /usr/src/linux-headers-*-$(dpkg --print-architecture)) \
+  && make install
 ENV QEMU_CONFIGURE_OPTS --enable-netmap
 # As a final step configure the user (if env is defined)
 ARG USER
diff --git a/tests/lcitool/refresh b/tests/lcitool/refresh
index 7c211eba2e..993683cf48 100755
--- a/tests/lcitool/refresh
+++ b/tests/lcitool/refresh
@@ -99,10 +99,13 @@ debian12_extras = [
     "  apt install -y --no-install-recommends \\\n",
     "  cscope\\\n",
     "  global\\\n",
-    "  linux-headers-amd64\n",
+    "  linux-headers-generic\n",
     "RUN git clone https://github.com/luigirizzo/netmap.git /usr/src/netmap\n",
     "RUN cd /usr/src/netmap && git checkout v11.3\n",
-    "RUN cd /usr/src/netmap/LINUX && ./configure --no-drivers --no-apps --kernel-dir=$(ls -d /usr/src/linux-headers-*-amd64) && make install\n",
+    "RUN cd /usr/src/netmap/LINUX && \\\n",
+    "  ./configure --no-drivers --no-apps \\\n",
+    "  --kernel-dir=$(ls -d /usr/src/linux-headers-*-$(dpkg --print-architecture)) \\\n",
+    "  && make install\n",
     "ENV QEMU_CONFIGURE_OPTS --enable-netmap\n"
 ]
 
@@ -123,7 +126,7 @@ try:
     #
     generate_dockerfile("alpine", "alpine-318")
     generate_dockerfile("centos8", "centos-stream-8")
-    generate_dockerfile("debian-amd64", "debian-12",
+    generate_dockerfile("debian", "debian-12",
                         trailer="".join(debian12_extras))
     generate_dockerfile("fedora", "fedora-38")
     generate_dockerfile("opensuse-leap", "opensuse-leap-15")
-- 
2.39.2



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

* [PATCH v2 04/14] plugins: fix win plugin tests on cross compile
  2023-11-20 15:08 [PATCH v2 00/14] random fixes for 8.2 pre-PR (tests, plugins, docs, semihosting) Alex Bennée
                   ` (2 preceding siblings ...)
  2023-11-20 15:08 ` [PATCH v2 03/14] tests/docker: merge debian-native with debian-amd64 Alex Bennée
@ 2023-11-20 15:08 ` Alex Bennée
  2023-11-20 15:08 ` [PATCH v2 05/14] target/nios2: Deprecate the Nios II architecture Alex Bennée
                   ` (9 subsequent siblings)
  13 siblings, 0 replies; 21+ messages in thread
From: Alex Bennée @ 2023-11-20 15:08 UTC (permalink / raw)
  To: qemu-devel
  Cc: Wainer dos Santos Moschetta, Cédric Le Goater,
	Mahmoud Mandour, Peter Maydell, David Hildenbrand,
	Alex Bennée, qemu-s390x, Beraldo Leal, qemu-arm, devel,
	qemu-ppc, Daniel Henrique Barboza, Paolo Bonzini,
	Philippe Mathieu-Daudé, Alexandre Iooss, Marek Vasut,
	Thomas Huth, Chris Wulff, Ilya Leoshkevich, Richard Henderson,
	Nicholas Piggin, Greg Manning

From: Greg Manning <gmanning@rapitasystems.com>

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

Cross compile gcc is more picky about argument order than msys. Changed
the meson command to take the (now renamed) libqemu_plugin_api.a as a
lib, rather than an object. This puts it in the right place on both
native and cross compile gcc commands

Reenable plugins on crossbuilds

Signed-off-by: Greg Manning <gmanning@rapitasystems.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20231109124326.21106-2-gmanning@rapitasystems.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
 .gitlab-ci.d/crossbuilds.yml | 2 +-
 contrib/plugins/Makefile     | 2 +-
 plugins/meson.build          | 2 +-
 tests/plugin/meson.build     | 3 ++-
 4 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/.gitlab-ci.d/crossbuilds.yml b/.gitlab-ci.d/crossbuilds.yml
index c2af6c7f44..d19d98cde0 100644
--- a/.gitlab-ci.d/crossbuilds.yml
+++ b/.gitlab-ci.d/crossbuilds.yml
@@ -165,7 +165,7 @@ cross-win32-system:
     job: win32-fedora-cross-container
   variables:
     IMAGE: fedora-win32-cross
-    EXTRA_CONFIGURE_OPTS: --enable-fdt=internal --disable-plugins
+    EXTRA_CONFIGURE_OPTS: --enable-fdt=internal
     CROSS_SKIP_TARGETS: alpha-softmmu avr-softmmu hppa-softmmu m68k-softmmu
                         microblazeel-softmmu mips64el-softmmu nios2-softmmu
   artifacts:
diff --git a/contrib/plugins/Makefile b/contrib/plugins/Makefile
index 1783750cf6..0b64d2c1e3 100644
--- a/contrib/plugins/Makefile
+++ b/contrib/plugins/Makefile
@@ -49,7 +49,7 @@ all: $(SONAMES)
 	$(CC) $(CFLAGS) $(PLUGIN_CFLAGS) -c -o $@ $<
 
 ifeq ($(CONFIG_WIN32),y)
-lib%$(SO_SUFFIX): %.o win32_linker.o ../../plugins/qemu_plugin_api.lib
+lib%$(SO_SUFFIX): %.o win32_linker.o ../../plugins/libqemu_plugin_api.a
 	$(CC) -shared -o $@ $^ $(LDLIBS)
 else ifeq ($(CONFIG_DARWIN),y)
 lib%$(SO_SUFFIX): %.o
diff --git a/plugins/meson.build b/plugins/meson.build
index 40d24529c0..6b2d7a9292 100644
--- a/plugins/meson.build
+++ b/plugins/meson.build
@@ -28,7 +28,7 @@ if get_option('plugins')
     # then use dlltool to assemble a delaylib.
     win32_qemu_plugin_api_lib = configure_file(
       input: win32_plugin_def,
-      output: 'qemu_plugin_api.lib',
+      output: 'libqemu_plugin_api.a',
       command: [dlltool, '--input-def', '@INPUT@',
                 '--output-delaylib', '@OUTPUT@', '--dllname', 'qemu.exe']
     )
diff --git a/tests/plugin/meson.build b/tests/plugin/meson.build
index 528bb9d86c..28a929dbcc 100644
--- a/tests/plugin/meson.build
+++ b/tests/plugin/meson.build
@@ -4,7 +4,8 @@ if get_option('plugins')
     if targetos == 'windows'
       t += shared_module(i, files(i + '.c') + '../../contrib/plugins/win32_linker.c',
                         include_directories: '../../include/qemu',
-                        objects: [win32_qemu_plugin_api_lib],
+                        link_depends: [win32_qemu_plugin_api_lib],
+                        link_args: ['-Lplugins', '-lqemu_plugin_api'],
                         dependencies: glib)
 
     else
-- 
2.39.2



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

* [PATCH v2 05/14] target/nios2: Deprecate the Nios II architecture
  2023-11-20 15:08 [PATCH v2 00/14] random fixes for 8.2 pre-PR (tests, plugins, docs, semihosting) Alex Bennée
                   ` (3 preceding siblings ...)
  2023-11-20 15:08 ` [PATCH v2 04/14] plugins: fix win plugin tests on cross compile Alex Bennée
@ 2023-11-20 15:08 ` Alex Bennée
  2023-11-20 15:08 ` [PATCH v2 06/14] tests/tcg: fixup Aarch64 semiconsole test Alex Bennée
                   ` (8 subsequent siblings)
  13 siblings, 0 replies; 21+ messages in thread
From: Alex Bennée @ 2023-11-20 15:08 UTC (permalink / raw)
  To: qemu-devel
  Cc: Wainer dos Santos Moschetta, Cédric Le Goater,
	Mahmoud Mandour, Peter Maydell, David Hildenbrand,
	Alex Bennée, qemu-s390x, Beraldo Leal, qemu-arm, devel,
	qemu-ppc, Daniel Henrique Barboza, Paolo Bonzini,
	Philippe Mathieu-Daudé, Alexandre Iooss, Marek Vasut,
	Thomas Huth, Chris Wulff, Ilya Leoshkevich, Richard Henderson,
	Nicholas Piggin

From: Philippe Mathieu-Daudé <philmd@linaro.org>

See commit 9ba1caf510 ("MAINTAINERS: Mark the Nios II CPU as orphan"),
last contribution from Chris was in 2012 [1] and Marek in 2018 [2].

[1] https://lore.kernel.org/qemu-devel/1352607539-10455-2-git-send-email-crwulff@gmail.com/
[2] https://lore.kernel.org/qemu-devel/805fc7b5-03f0-56d4-abfd-ed010d4fa769@denx.de/

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Acked-by: Marek Vasut <marex@denx.de>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20231117070250.32932-1-philmd@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
 docs/about/deprecated.rst | 15 +++++++++++++++
 hw/nios2/10m50_devboard.c |  1 +
 hw/nios2/generic_nommu.c  |  1 +
 3 files changed, 17 insertions(+)

diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst
index 6c84db90b5..2e15040246 100644
--- a/docs/about/deprecated.rst
+++ b/docs/about/deprecated.rst
@@ -236,6 +236,16 @@ it. Since all recent x86 hardware from the past >10 years is capable of the
 64-bit x86 extensions, a corresponding 64-bit OS should be used instead.
 
 
+System emulator CPUs
+--------------------
+
+Nios II CPU (since 8.2)
+'''''''''''''''''''''''
+
+The Nios II architecture is orphan. The ``nios2`` guest CPU support is
+deprecated and will be removed in a future version of QEMU.
+
+
 System emulator machines
 ------------------------
 
@@ -254,6 +264,11 @@ These old machine types are quite neglected nowadays and thus might have
 various pitfalls with regards to live migration. Use a newer machine type
 instead.
 
+Nios II ``10m50-ghrd`` and ``nios2-generic-nommu`` machines (since 8.2)
+'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
+
+The Nios II architecture is orphan.
+
 
 Backend options
 ---------------
diff --git a/hw/nios2/10m50_devboard.c b/hw/nios2/10m50_devboard.c
index 952a0dc33e..6cb32f777b 100644
--- a/hw/nios2/10m50_devboard.c
+++ b/hw/nios2/10m50_devboard.c
@@ -160,6 +160,7 @@ static void nios2_10m50_ghrd_class_init(ObjectClass *oc, void *data)
     mc->desc = "Altera 10M50 GHRD Nios II design";
     mc->init = nios2_10m50_ghrd_init;
     mc->is_default = true;
+    mc->deprecation_reason = "Nios II architecture is deprecated";
 
     object_class_property_add_bool(oc, "vic", get_vic, set_vic);
     object_class_property_set_description(oc, "vic",
diff --git a/hw/nios2/generic_nommu.c b/hw/nios2/generic_nommu.c
index 48edb3ae37..defa16953f 100644
--- a/hw/nios2/generic_nommu.c
+++ b/hw/nios2/generic_nommu.c
@@ -95,6 +95,7 @@ static void nios2_generic_nommu_machine_init(struct MachineClass *mc)
 {
     mc->desc = "Generic NOMMU Nios II design";
     mc->init = nios2_generic_nommu_init;
+    mc->deprecation_reason = "Nios II architecture is deprecated";
 }
 
 DEFINE_MACHINE("nios2-generic-nommu", nios2_generic_nommu_machine_init);
-- 
2.39.2



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

* [PATCH v2 06/14] tests/tcg: fixup Aarch64 semiconsole test
  2023-11-20 15:08 [PATCH v2 00/14] random fixes for 8.2 pre-PR (tests, plugins, docs, semihosting) Alex Bennée
                   ` (4 preceding siblings ...)
  2023-11-20 15:08 ` [PATCH v2 05/14] target/nios2: Deprecate the Nios II architecture Alex Bennée
@ 2023-11-20 15:08 ` Alex Bennée
  2023-11-20 15:08 ` [PATCH v2 07/14] docs/emulation: expand warning about semihosting Alex Bennée
                   ` (7 subsequent siblings)
  13 siblings, 0 replies; 21+ messages in thread
From: Alex Bennée @ 2023-11-20 15:08 UTC (permalink / raw)
  To: qemu-devel
  Cc: Wainer dos Santos Moschetta, Cédric Le Goater,
	Mahmoud Mandour, Peter Maydell, David Hildenbrand,
	Alex Bennée, qemu-s390x, Beraldo Leal, qemu-arm, devel,
	qemu-ppc, Daniel Henrique Barboza, Paolo Bonzini,
	Philippe Mathieu-Daudé, Alexandre Iooss, Marek Vasut,
	Thomas Huth, Chris Wulff, Ilya Leoshkevich, Richard Henderson,
	Nicholas Piggin

We need to ensure we squash the serial port if we want to hand craft
our muxed input. As a bonus emit the example with a V=1 build to make
it easier for people to figure out.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
 tests/tcg/aarch64/Makefile.softmmu-target | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tests/tcg/aarch64/Makefile.softmmu-target b/tests/tcg/aarch64/Makefile.softmmu-target
index b74a2534e3..77c5018e02 100644
--- a/tests/tcg/aarch64/Makefile.softmmu-target
+++ b/tests/tcg/aarch64/Makefile.softmmu-target
@@ -48,10 +48,11 @@ QEMU_BASE_MACHINE=-M virt -cpu max -display none
 QEMU_OPTS+=$(QEMU_BASE_MACHINE) -semihosting-config enable=on,target=native,chardev=output -kernel
 
 # console test is manual only
-QEMU_SEMIHOST=-chardev stdio,mux=on,id=stdio0 -semihosting-config enable=on,chardev=stdio0 -mon chardev=stdio0,mode=readline
-run-semiconsole: QEMU_OPTS=$(QEMU_BASE_MACHINE) $(QEMU_SEMIHOST)  -kernel
+QEMU_SEMIHOST=-serial none -chardev stdio,mux=on,id=stdio0 -semihosting-config enable=on,chardev=stdio0 -mon chardev=stdio0,mode=readline
+run-semiconsole: QEMU_OPTS=$(QEMU_BASE_MACHINE) $(QEMU_SEMIHOST) -kernel
 run-semiconsole: semiconsole
 	$(call skip-test, $<, "MANUAL ONLY")
+	$(if $(V),@printf "  %-7s %s %s\n" "TO RUN" $(notdir $(QEMU)) "$(QEMU_OPTS) $<")
 run-plugin-semiconsole-with-%: semiconsole
 	$(call skip-test, $<, "MANUAL ONLY")
 
-- 
2.39.2



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

* [PATCH v2 07/14] docs/emulation: expand warning about semihosting
  2023-11-20 15:08 [PATCH v2 00/14] random fixes for 8.2 pre-PR (tests, plugins, docs, semihosting) Alex Bennée
                   ` (5 preceding siblings ...)
  2023-11-20 15:08 ` [PATCH v2 06/14] tests/tcg: fixup Aarch64 semiconsole test Alex Bennée
@ 2023-11-20 15:08 ` Alex Bennée
  2023-11-20 16:15   ` Richard Henderson
  2023-11-20 15:08 ` [PATCH v2 08/14] docs/system: clarify limits of using gdbstub in system emulation Alex Bennée
                   ` (6 subsequent siblings)
  13 siblings, 1 reply; 21+ messages in thread
From: Alex Bennée @ 2023-11-20 15:08 UTC (permalink / raw)
  To: qemu-devel
  Cc: Wainer dos Santos Moschetta, Cédric Le Goater,
	Mahmoud Mandour, Peter Maydell, David Hildenbrand,
	Alex Bennée, qemu-s390x, Beraldo Leal, qemu-arm, devel,
	qemu-ppc, Daniel Henrique Barboza, Paolo Bonzini,
	Philippe Mathieu-Daudé, Alexandre Iooss, Marek Vasut,
	Thomas Huth, Chris Wulff, Ilya Leoshkevich, Richard Henderson,
	Nicholas Piggin

A surprising feature of calls like SYS_READC is this can cause QEMU to
indefinitely block as there is no handling for EOF.

Clarifies: https://gitlab.com/qemu-project/qemu/-/issues/1963
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
 docs/about/emulation.rst | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/docs/about/emulation.rst b/docs/about/emulation.rst
index 0ad0b86f0d..a2eefe3f3f 100644
--- a/docs/about/emulation.rst
+++ b/docs/about/emulation.rst
@@ -129,8 +129,9 @@ causing most hypervisors to trap and fault on them.
 .. warning::
    Semihosting inherently bypasses any isolation there may be between
    the guest and the host. As a result a program using semihosting can
-   happily trash your host system. You should only ever run trusted
-   code with semihosting enabled.
+   happily trash your host system. Some semihosting calls (e.g.
+   ``SYS_READC``) can block execution indefinitely. You should only
+   ever run trusted code with semihosting enabled.
 
 Redirection
 ~~~~~~~~~~~
-- 
2.39.2



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

* [PATCH v2 08/14] docs/system: clarify limits of using gdbstub in system emulation
  2023-11-20 15:08 [PATCH v2 00/14] random fixes for 8.2 pre-PR (tests, plugins, docs, semihosting) Alex Bennée
                   ` (6 preceding siblings ...)
  2023-11-20 15:08 ` [PATCH v2 07/14] docs/emulation: expand warning about semihosting Alex Bennée
@ 2023-11-20 15:08 ` Alex Bennée
  2023-11-20 16:15   ` Richard Henderson
                     ` (2 more replies)
  2023-11-20 15:08 ` [PATCH v2 09/14] hw/core: skip loading debug on all failures Alex Bennée
                   ` (5 subsequent siblings)
  13 siblings, 3 replies; 21+ messages in thread
From: Alex Bennée @ 2023-11-20 15:08 UTC (permalink / raw)
  To: qemu-devel
  Cc: Wainer dos Santos Moschetta, Cédric Le Goater,
	Mahmoud Mandour, Peter Maydell, David Hildenbrand,
	Alex Bennée, qemu-s390x, Beraldo Leal, qemu-arm, devel,
	qemu-ppc, Daniel Henrique Barboza, Paolo Bonzini,
	Philippe Mathieu-Daudé, Alexandre Iooss, Marek Vasut,
	Thomas Huth, Chris Wulff, Ilya Leoshkevich, Richard Henderson,
	Nicholas Piggin

It seems some users will try and use the gdbstub to debug userspace
inside a system emulation. While possible clarify the limitations of
this approach and direct the users to a less head scratching way of
debugging user-space.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Clarifies: https://gitlab.com/qemu-project/qemu/-/issues/1274
---
 docs/system/gdb.rst | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/docs/system/gdb.rst b/docs/system/gdb.rst
index 9906991b84..c0cc0c9c7e 100644
--- a/docs/system/gdb.rst
+++ b/docs/system/gdb.rst
@@ -60,7 +60,7 @@ As TCG cannot track all memory accesses in user-mode there is no
 support for watchpoints.
 
 Relocating code
----------------
+===============
 
 On modern kernels confusion can be caused by code being relocated by
 features such as address space layout randomisation. To avoid
@@ -68,6 +68,17 @@ confusion when debugging such things you either need to update gdb's
 view of where things are in memory or perhaps more trivially disable
 ASLR when booting the system.
 
+Debugging user-space in system emulation
+========================================
+
+While technically possible to debug a user-space program running
+inside a system image it does present challenges. Kernel preemption
+and execution mode changes between kernel and user mode can make it
+hard to follow whats going on. Unless you are specifically trying to
+debug some interaction between kernel and user-space you are better
+off running your guest program with gdb either in the guest or using
+a gdbserver exposed via a port to the outside world.
+
 Debugging multicore machines
 ============================
 
-- 
2.39.2



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

* [PATCH v2 09/14] hw/core: skip loading debug on all failures
  2023-11-20 15:08 [PATCH v2 00/14] random fixes for 8.2 pre-PR (tests, plugins, docs, semihosting) Alex Bennée
                   ` (7 preceding siblings ...)
  2023-11-20 15:08 ` [PATCH v2 08/14] docs/system: clarify limits of using gdbstub in system emulation Alex Bennée
@ 2023-11-20 15:08 ` Alex Bennée
  2023-11-20 15:08 ` [PATCH v2 10/14] testing: move arm system tests into their own folder Alex Bennée
                   ` (4 subsequent siblings)
  13 siblings, 0 replies; 21+ messages in thread
From: Alex Bennée @ 2023-11-20 15:08 UTC (permalink / raw)
  To: qemu-devel
  Cc: Wainer dos Santos Moschetta, Cédric Le Goater,
	Mahmoud Mandour, Peter Maydell, David Hildenbrand,
	Alex Bennée, qemu-s390x, Beraldo Leal, qemu-arm, devel,
	qemu-ppc, Daniel Henrique Barboza, Paolo Bonzini,
	Philippe Mathieu-Daudé, Alexandre Iooss, Marek Vasut,
	Thomas Huth, Chris Wulff, Ilya Leoshkevich, Richard Henderson,
	Nicholas Piggin

ELF_LOAD_FAILED is one of many negative return codes we can have. Lets
treat any positive size_t as a success for loading.

Message-Id: <20231115205542.3092038-8-alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
 hw/core/loader.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/core/loader.c b/hw/core/loader.c
index 3c79283777..e7a9b3775b 100644
--- a/hw/core/loader.c
+++ b/hw/core/loader.c
@@ -505,7 +505,7 @@ ssize_t load_elf_ram_sym(const char *filename,
                          clear_lsb, data_swab, as, load_rom, sym_cb);
     }
 
-    if (ret != ELF_LOAD_FAILED) {
+    if (ret > 0) {
         debuginfo_report_elf(filename, fd, 0);
     }
 
-- 
2.39.2



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

* [PATCH v2 10/14] testing: move arm system tests into their own folder
  2023-11-20 15:08 [PATCH v2 00/14] random fixes for 8.2 pre-PR (tests, plugins, docs, semihosting) Alex Bennée
                   ` (8 preceding siblings ...)
  2023-11-20 15:08 ` [PATCH v2 09/14] hw/core: skip loading debug on all failures Alex Bennée
@ 2023-11-20 15:08 ` Alex Bennée
  2023-11-20 15:08 ` [PATCH v2 11/14] tests/tcg: enable arm softmmu tests Alex Bennée
                   ` (3 subsequent siblings)
  13 siblings, 0 replies; 21+ messages in thread
From: Alex Bennée @ 2023-11-20 15:08 UTC (permalink / raw)
  To: qemu-devel
  Cc: Wainer dos Santos Moschetta, Cédric Le Goater,
	Mahmoud Mandour, Peter Maydell, David Hildenbrand,
	Alex Bennée, qemu-s390x, Beraldo Leal, qemu-arm, devel,
	qemu-ppc, Daniel Henrique Barboza, Paolo Bonzini,
	Philippe Mathieu-Daudé, Alexandre Iooss, Marek Vasut,
	Thomas Huth, Chris Wulff, Ilya Leoshkevich, Richard Henderson,
	Nicholas Piggin

Prepare for expanding the arm system tests by cleaning up the test
directory.

Message-Id: <20231115205542.3092038-9-alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
 tests/tcg/arm/Makefile.softmmu-target           | 5 ++---
 tests/tcg/arm/{ => system}/test-armv6m-undef.S  | 0
 tests/tcg/arm/{ => system}/test-armv6m-undef.ld | 0
 3 files changed, 2 insertions(+), 3 deletions(-)
 rename tests/tcg/arm/{ => system}/test-armv6m-undef.S (100%)
 rename tests/tcg/arm/{ => system}/test-armv6m-undef.ld (100%)

diff --git a/tests/tcg/arm/Makefile.softmmu-target b/tests/tcg/arm/Makefile.softmmu-target
index 8b546e2aa3..7857ab9324 100644
--- a/tests/tcg/arm/Makefile.softmmu-target
+++ b/tests/tcg/arm/Makefile.softmmu-target
@@ -3,7 +3,7 @@
 # ARM SoftMMU tests - included from tests/tcg/Makefile
 #
 
-ARM_SRC=$(SRC_PATH)/tests/tcg/arm
+ARM_SRC=$(SRC_PATH)/tests/tcg/arm/system
 
 # Set search path for all sources
 VPATH 		+= $(ARM_SRC)
@@ -12,7 +12,6 @@ ARM_TESTS=test-armv6m-undef
 
 TESTS += $(ARM_TESTS)
 
-CFLAGS+=-Wl,--build-id=none -x assembler-with-cpp
 LDFLAGS+=-nostdlib -N -static
 
 %: %.S %.ld
@@ -20,7 +19,7 @@ LDFLAGS+=-nostdlib -N -static
 
 # Specific Test Rules
 
-test-armv6m-undef: EXTRA_CFLAGS+=-mcpu=cortex-m0 -mfloat-abi=soft
+test-armv6m-undef: EXTRA_CFLAGS+=-mcpu=cortex-m0 -mfloat-abi=soft -Wl,--build-id=none -x assembler-with-cpp
 
 run-test-armv6m-undef: QEMU_OPTS+=-semihosting -M microbit -kernel
 
diff --git a/tests/tcg/arm/test-armv6m-undef.S b/tests/tcg/arm/system/test-armv6m-undef.S
similarity index 100%
rename from tests/tcg/arm/test-armv6m-undef.S
rename to tests/tcg/arm/system/test-armv6m-undef.S
diff --git a/tests/tcg/arm/test-armv6m-undef.ld b/tests/tcg/arm/system/test-armv6m-undef.ld
similarity index 100%
rename from tests/tcg/arm/test-armv6m-undef.ld
rename to tests/tcg/arm/system/test-armv6m-undef.ld
-- 
2.39.2



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

* [PATCH v2 11/14] tests/tcg: enable arm softmmu tests
  2023-11-20 15:08 [PATCH v2 00/14] random fixes for 8.2 pre-PR (tests, plugins, docs, semihosting) Alex Bennée
                   ` (9 preceding siblings ...)
  2023-11-20 15:08 ` [PATCH v2 10/14] testing: move arm system tests into their own folder Alex Bennée
@ 2023-11-20 15:08 ` Alex Bennée
  2023-11-20 16:32   ` Richard Henderson
  2023-11-20 17:25   ` Peter Maydell
  2023-11-20 15:08 ` [PATCH v2 12/14] tests/tcg: enable semiconsole test for Arm Alex Bennée
                   ` (2 subsequent siblings)
  13 siblings, 2 replies; 21+ messages in thread
From: Alex Bennée @ 2023-11-20 15:08 UTC (permalink / raw)
  To: qemu-devel
  Cc: Wainer dos Santos Moschetta, Cédric Le Goater,
	Mahmoud Mandour, Peter Maydell, David Hildenbrand,
	Alex Bennée, qemu-s390x, Beraldo Leal, qemu-arm, devel,
	qemu-ppc, Daniel Henrique Barboza, Paolo Bonzini,
	Philippe Mathieu-Daudé, Alexandre Iooss, Marek Vasut,
	Thomas Huth, Chris Wulff, Ilya Leoshkevich, Richard Henderson,
	Nicholas Piggin

To make it easier to test 32 bit Arm softmmu issues implement a basic
boot.S so we can build the multiarch tests. Currently CHECK_UNALIGNED
is disabled as I haven't got the right magic set for it to work.

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

---
v2
  - use endf macro for global function symbols in boot.S
---
 tests/tcg/arm/Makefile.softmmu-target |  64 +++++-
 tests/tcg/arm/system/boot.S           | 301 ++++++++++++++++++++++++++
 tests/tcg/arm/system/kernel.ld        |  24 ++
 3 files changed, 379 insertions(+), 10 deletions(-)
 create mode 100644 tests/tcg/arm/system/boot.S
 create mode 100644 tests/tcg/arm/system/kernel.ld

diff --git a/tests/tcg/arm/Makefile.softmmu-target b/tests/tcg/arm/Makefile.softmmu-target
index 7857ab9324..aadc12767e 100644
--- a/tests/tcg/arm/Makefile.softmmu-target
+++ b/tests/tcg/arm/Makefile.softmmu-target
@@ -8,20 +8,64 @@ ARM_SRC=$(SRC_PATH)/tests/tcg/arm/system
 # Set search path for all sources
 VPATH 		+= $(ARM_SRC)
 
-ARM_TESTS=test-armv6m-undef
+# Specific Test Rules
 
-TESTS += $(ARM_TESTS)
+test-armv6m-undef: test-armv6m-undef.S
+	$(CC) -mcpu=cortex-m0 -mfloat-abi=soft \
+		-Wl,--build-id=none -x assembler-with-cpp \
+		$< -o $@ -nostdlib -N -static \
+		-T $(ARM_SRC)/$@.ld
 
-LDFLAGS+=-nostdlib -N -static
+run-test-armv6m-undef: QEMU_OPTS+=-semihosting -M microbit -kernel
 
-%: %.S %.ld
-	$(CC) $(CFLAGS) $(ASFLAGS) $(EXTRA_CFLAGS) $< -o $@ $(LDFLAGS) -T $(ARM_SRC)/$@.ld
+ARM_TESTS+=test-armv6m-undef
 
-# Specific Test Rules
+# These objects provide the basic boot code and helper functions for all tests
+CRT_OBJS=boot.o
 
-test-armv6m-undef: EXTRA_CFLAGS+=-mcpu=cortex-m0 -mfloat-abi=soft -Wl,--build-id=none -x assembler-with-cpp
+ARM_TEST_SRCS=$(wildcard $(ARM_SRC)/*.c)
+ARM_TESTS+=$(patsubst $(ARM_SRC)/%.c, %, $(ARM_TEST_SRCS))
 
-run-test-armv6m-undef: QEMU_OPTS+=-semihosting -M microbit -kernel
+CRT_PATH=$(ARM_SRC)
+LINK_SCRIPT=$(ARM_SRC)/kernel.ld
+LDFLAGS=-Wl,-T$(LINK_SCRIPT)
+CFLAGS+=-nostdlib -ggdb -O0 $(MINILIB_INC)
+LDFLAGS+=-static -nostdlib -N $(CRT_OBJS) $(MINILIB_OBJS) -lgcc
+
+# building head blobs
+.PRECIOUS: $(CRT_OBJS)
+
+%.o: $(ARM_SRC)/%.S
+	$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -x assembler-with-cpp -c $< -o $@
+
+# Build and link the tests
+%: %.c $(LINK_SCRIPT) $(CRT_OBJS) $(MINILIB_OBJS)
+	$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $< -o $@ $(LDFLAGS)
+
+memory: CFLAGS+=-DCHECK_UNALIGNED=0
+
+# Running
+QEMU_BASE_MACHINE=-M virt -cpu max -display none
+QEMU_OPTS+=$(QEMU_BASE_MACHINE) -semihosting-config enable=on,target=native,chardev=output -kernel
+
+# Simple Record/Replay Test
+.PHONY: memory-record
+run-memory-record: memory-record memory
+	$(call run-test, $<, \
+	  $(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)
+
+.PHONY: memory-replay
+run-memory-replay: memory-replay run-memory-record
+	$(call run-test, $<, \
+	  $(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)
+
+EXTRA_RUNS+=run-memory-replay
 
-# We don't currently support the multiarch system tests
-undefine MULTIARCH_TESTS
+TESTS += $(ARM_TESTS) $(MULTIARCH_TESTS)
+EXTRA_RUNS+=$(MULTIARCH_RUNS)
diff --git a/tests/tcg/arm/system/boot.S b/tests/tcg/arm/system/boot.S
new file mode 100644
index 0000000000..7915502ae4
--- /dev/null
+++ b/tests/tcg/arm/system/boot.S
@@ -0,0 +1,301 @@
+/*
+ * Minimal ArmV7 system boot code.
+ *
+ * Using semihosting for serial output and exit functions.
+ */
+
+/*
+ * Semihosting interface on ARM AArch32
+ * R0 - semihosting call number
+ * R1 - semihosting parameter
+ */
+#define semihosting_call svc 0x123456
+#define SYS_WRITEC	0x03	/* character to debug channel */
+#define SYS_WRITE0	0x04	/* string to debug channel */
+#define SYS_EXIT	0x18
+
+#define ADP_Stopped_ApplicationExit	0x20026
+#define ADP_Stopped_InternalError	0x20024
+
+/*
+ * Helper macro for the linker calling subroutines from the C code.
+ */
+.macro 	endf 	name
+	.global	\name
+	.type	\name, %function
+	.size	\name, . - \name
+.endm
+
+	.section	.interrupt_vector, "ax"
+	.align	5
+
+vector_table:
+	b   reset		/* reset vector */
+	b   undef_instr        /* undefined instruction vector */
+	b   software_intr    	/* software interrupt vector */
+	b   prefetch_abort		/* prefetch abort vector */
+	b   data_abort	        /* data abort vector */
+	nop			            /* reserved */
+	b   IRQ_handler        	/* IRQ vector */
+	b   FIQ_handler        	/* FIQ vector */
+
+	.text
+__start:
+	ldr  	r0, =vector_table
+	mcr  	p15, 0, r0, c12, c0, 0  /* Set up VBAR */
+
+	ldr	sp, =stack_end		/* Set up the stack */
+	bl	mmu_setup		/* Set up the MMU */
+	bl	main			/* Jump to main */
+
+endf	__start
+
+_exit:
+	cmp r0, #0
+	ite EQ  // if-then-else. "EQ" is for if equal, else otherwise
+	ldreq r1, =ADP_Stopped_ApplicationExit // if r0 == 0
+	ldrne r1, =ADP_Stopped_InternalError   // else
+	mov r0, #SYS_EXIT
+	semihosting_call
+
+endf	_exit
+
+	/*
+ * Helper Functions
+ */
+
+mmu_setup:
+	/*
+  	 * The MMU setup for this is very simple using two stage one
+	 * translations. The first 1Mb section points to the text
+	 * section and the second points to the data and rss.
+         * Currently the fattest test only needs ~50k for that so we
+ 	 * have plenty of space.
+	 *
+	 * The short descriptor Section format is as follows:
+	 *
+	 *  PA[31:20] - Section Base Address
+	 *  NS[19] - Non-secure bit
+	 *  0[18] - Section (1 for Super Section)
+	 *  nG[17] - Not global bit
+	 *  S[16] - Shareable
+	 *  TEX[14:12] - Memory Region Attributes
+	 *  AP[15, 11:10] - Access Permission Bits
+	 *  IMPDEF[9]
+	 *  Domain[8:5]
+	 *  XN[4] - Execute never bit
+	 *  C[3] - Memory Region Attributes
+	 *  B[2] - Memory Region Attributes
+	 *  1[1]
+	 *  PXN[0] - Privileged Execute Never
+	 *
+	 * r0 - point at the table
+	 * r1 - address
+	 * r2 - entry
+	 * r3 - common section bits
+	 * r4 - scratch
+	 */
+
+	/*
+	 * Memory Region Bits
+	 *
+	 *   TEX[14:12] = 000
+	 *     C[3]     = 1
+	 *     B[2]     = 1
+	 *
+	 * Outer and Inner WB, no write allocate
+	 */
+	mov r3, #0
+	ldr r4, =(3 << 2)
+	orr r3, r4, r4
+
+	/* Section bit */
+	orr r3, r3, #2
+
+	/* Page table setup (identity mapping). */
+	ldr r0, =ttb
+
+	/* First block: .text/RO/execute enabled */
+	ldr r1, =.text
+	ldr r2, =0xFFF00000  			/* 1MB block alignment */
+	and r2, r1, r2
+	orr r2, r2, r3				/* common bits */
+	orr r2, r2, #(1 << 15)			/* AP[2] = 1 */
+	orr r2, r2, #(1 << 10)			/* AP[0] = 1 => RO @ PL1 */
+
+	lsr r4, r2, #(20 - 2)
+	str r2, [r0, r4, lsl #0]		/* write entry */
+
+	/* Second block: .data/RW/no execute */
+	ldr r1, =.data
+	ldr r2, =0xFFF00000  			/* 1MB block alignment */
+	and r2, r1, r2
+	orr r2, r2, r3				/* common bits */
+	orr r2, r2, #(1 << 10)			/* AP[0] = 1 => RW @ PL1 */
+	orr r2, r2, #(1 << 4)			/* XN[4] => no execute */
+
+	lsr r4, r2, #(20 - 2)
+	str r2, [r0, r4, lsl #0]		/* write entry */
+
+	/*
+	 * DACR - Domain Control
+	 *
+	 * Enable client mode for domain 0 (we don't use any others)
+	 */
+	ldr r0, =0x1
+	mcr p15, 0, r0, c3, c0, 0
+
+	/*
+	 * TTCBR - Translation Table Base Control Register
+	 *
+	 * EAE[31] = 0, 32-bit translation, short descriptor format
+	 * N[2:0] = 5 ( TTBRO uses 31:14-5 => 9 bit lookup stage )
+	 */
+	ldr r0, =0x5
+	mcr p15, 0, r0, c1, c0, 2
+
+	/*
+	 * TTBR0 -Translation Table Base Register 0
+	 *
+	 * [31:9] = Base address of table
+	 *
+	 * QEMU doesn't really care about the cache sharing
+	 * attributes so we don't need to either.
+	 */
+	ldr r0, =ttb
+	mcr p15, 0, r0, c2, c0, 0
+
+	/*
+	 * SCTLR- System Control Register
+	 *
+   	 * TE[30] = 0, exceptions to A32 state
+	 * AFE[29] = 0, AP[0] is the access permissions bit
+	 * EE[25] = 0, Little-endian
+	 * WXN[19] = 0 = no effect, Write does not imply XN (execute never)
+	 * I[12] = Instruction cachability control
+	 * C[2] = Data cachability control
+	 * M[0] = 1, enable stage 1 address translation for EL0/1
+         *
+	 * At this point virtual memory is enabled.
+	 */
+	ldr r0, =0x1005
+	mcr p15, 0, r0, c1, c0, 0
+
+	isb
+
+	mov  pc, lr  /* done, return to caller */
+
+/* Output a single character to serial port */
+__sys_outc:
+	STMFD sp!, {r0-r1}  // push r0, r1 onto stack
+	mov r1, sp
+	mov r0, #SYS_WRITEC
+	semihosting_call
+	LDMFD sp!, {r0-r1}  // pop r0, r1 from stack
+	bx lr
+
+endf __sys_outc
+
+reset:
+	ldr	r1, =reset_error
+	b exception_handler
+
+undef_instr:
+	ldr	r1, =undef_intr_error
+	b exception_handler
+
+software_intr:
+	ldr	r1, =software_intr_error
+	b exception_handler
+
+prefetch_abort:
+	ldr	r1, =prefetch_abort_error
+	b exception_handler
+
+data_abort:
+	ldr	r1, =data_abort_error
+	b exception_handler
+
+IRQ_handler:
+	ldr	r1, =irq_error
+	b exception_handler
+
+FIQ_handler:
+	ldr	r1, =fiq_error
+	b exception_handler
+
+/*
+ * Initiate a exit semihosting call whenever there is any exception
+ * r1 already holds the string.
+ */
+exception_handler:
+	mov	r0, #SYS_WRITE0
+	semihosting_call
+	mov	r0, #SYS_EXIT
+	mov	r1, #1
+	semihosting_call
+
+endf	exception_handler
+
+/*
+ * We implement a stub raise() function which errors out as tests
+ * shouldn't trigger maths errors.
+ */
+	.global raise
+raise:
+	mov	r0, #SYS_WRITE0
+	ldr	r1, =maths_error
+	semihosting_call
+	mov	r0, #SYS_EXIT
+	ldr	r1, =ADP_Stopped_InternalError
+	semihosting_call
+
+endf raise
+
+	.data
+
+.data
+
+reset_error:
+	.ascii "Reset exception occurred.\n\0"
+
+undef_intr_error:
+	.ascii "Undefined Instruction Exception Occurred.\n\0"
+
+software_intr_error:
+	.ascii "Software Interrupt Occurred.\n\0"
+
+prefetch_abort_error:
+	.ascii "Prefetch Abort Occurred.\n\0"
+
+data_abort_error:
+	.ascii "Data Abort Occurred.\n\0"
+
+irq_error:
+	.ascii "IRQ exception occurred.\n\0"
+
+fiq_error:
+	.ascii "FIQ exception occurred.\n\0"
+
+maths_error:
+	.ascii "Software maths exception.\n\0"
+
+
+	/*
+	 * 1st Stage Translation table
+	 * 4096 entries, indexed by [31:20]
+	 * each entry covers 1Mb of address space
+	 * aligned on 16kb
+	 */
+	.align	15
+ttb:
+	.space	(4096 * 4), 0
+
+	.align	12
+
+	/* Space for stack */
+	.align	5
+	.section .bss
+stack:
+	.space 65536, 0
+stack_end:
diff --git a/tests/tcg/arm/system/kernel.ld b/tests/tcg/arm/system/kernel.ld
new file mode 100644
index 0000000000..7b3a76dcbf
--- /dev/null
+++ b/tests/tcg/arm/system/kernel.ld
@@ -0,0 +1,24 @@
+ENTRY(__start)
+
+SECTIONS
+{
+    /* virt machine, RAM starts at 1gb */
+    . = (1 << 30);
+    .text : {
+        *(.text)
+    }
+    .rodata : {
+        *(.rodata)
+    }
+    /* align r/w section to next 2mb */
+    . = ALIGN(1 << 21);
+    .data : {
+        *(.data)
+    }
+    .bss : {
+        *(.bss)
+    }
+    /DISCARD/ : {
+        *(.ARM.attributes)
+    }
+}
-- 
2.39.2



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

* [PATCH v2 12/14] tests/tcg: enable semiconsole test for Arm
  2023-11-20 15:08 [PATCH v2 00/14] random fixes for 8.2 pre-PR (tests, plugins, docs, semihosting) Alex Bennée
                   ` (10 preceding siblings ...)
  2023-11-20 15:08 ` [PATCH v2 11/14] tests/tcg: enable arm softmmu tests Alex Bennée
@ 2023-11-20 15:08 ` Alex Bennée
  2023-11-20 15:08 ` [PATCH v2 13/14] configure: don't try a "native" cross for linux-user Alex Bennée
  2023-11-20 15:08 ` [PATCH v2 14/14] tests/tcg: finesse the registers check for "hidden" regs Alex Bennée
  13 siblings, 0 replies; 21+ messages in thread
From: Alex Bennée @ 2023-11-20 15:08 UTC (permalink / raw)
  To: qemu-devel
  Cc: Wainer dos Santos Moschetta, Cédric Le Goater,
	Mahmoud Mandour, Peter Maydell, David Hildenbrand,
	Alex Bennée, qemu-s390x, Beraldo Leal, qemu-arm, devel,
	qemu-ppc, Daniel Henrique Barboza, Paolo Bonzini,
	Philippe Mathieu-Daudé, Alexandre Iooss, Marek Vasut,
	Thomas Huth, Chris Wulff, Ilya Leoshkevich, Richard Henderson,
	Nicholas Piggin

This still remains a MANUAL test due to blocking issues.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
 tests/tcg/arm/system/semiconsole.c    | 42 +++++++++++++++++++++++++++
 tests/tcg/arm/Makefile.softmmu-target |  9 ++++++
 2 files changed, 51 insertions(+)
 create mode 100644 tests/tcg/arm/system/semiconsole.c

diff --git a/tests/tcg/arm/system/semiconsole.c b/tests/tcg/arm/system/semiconsole.c
new file mode 100644
index 0000000000..206dd60eed
--- /dev/null
+++ b/tests/tcg/arm/system/semiconsole.c
@@ -0,0 +1,42 @@
+/*
+ * Semihosting Console Test
+ *
+ * Copyright (c) 2019 Linaro Ltd
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#include <stdint.h>
+#include <minilib.h>
+
+#define SYS_READC 0x7
+
+uintptr_t __semi_call(uintptr_t type, uintptr_t arg0)
+{
+    register uintptr_t t asm("r0") = type;
+    register uintptr_t a0 asm("r1") = arg0;
+#ifdef __thumb__
+#  define SVC  "svc 0xab"
+#else
+#  define SVC  "svc 0x123456"
+#endif
+    asm(SVC : "=r" (t)
+        : "r" (t), "r" (a0));
+
+    return t;
+}
+
+int main(void)
+{
+    char c;
+
+    ml_printf("Semihosting Console Test\n");
+    ml_printf("hit X to exit:");
+
+    do {
+        c = __semi_call(SYS_READC, 0);
+        __sys_outc(c);
+    } while (c != 'X');
+
+    return 0;
+}
diff --git a/tests/tcg/arm/Makefile.softmmu-target b/tests/tcg/arm/Makefile.softmmu-target
index aadc12767e..4c9264057f 100644
--- a/tests/tcg/arm/Makefile.softmmu-target
+++ b/tests/tcg/arm/Makefile.softmmu-target
@@ -48,6 +48,15 @@ memory: CFLAGS+=-DCHECK_UNALIGNED=0
 QEMU_BASE_MACHINE=-M virt -cpu max -display none
 QEMU_OPTS+=$(QEMU_BASE_MACHINE) -semihosting-config enable=on,target=native,chardev=output -kernel
 
+# console test is manual only
+QEMU_SEMIHOST=-serial none -chardev stdio,mux=on,id=stdio0 -semihosting-config enable=on,chardev=stdio0 -mon chardev=stdio0,mode=readline
+run-semiconsole: QEMU_OPTS=$(QEMU_BASE_MACHINE) $(QEMU_SEMIHOST)  -kernel
+run-semiconsole: semiconsole
+	$(call skip-test, $<, "MANUAL ONLY")
+	$(if $(V),@printf "  %-7s %s %s\n" "TO RUN" $(notdir $(QEMU)) "$(QEMU_OPTS) $<")
+run-plugin-semiconsole-with-%: semiconsole
+	$(call skip-test, $<, "MANUAL ONLY")
+
 # Simple Record/Replay Test
 .PHONY: memory-record
 run-memory-record: memory-record memory
-- 
2.39.2



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

* [PATCH v2 13/14] configure: don't try a "native" cross for linux-user
  2023-11-20 15:08 [PATCH v2 00/14] random fixes for 8.2 pre-PR (tests, plugins, docs, semihosting) Alex Bennée
                   ` (11 preceding siblings ...)
  2023-11-20 15:08 ` [PATCH v2 12/14] tests/tcg: enable semiconsole test for Arm Alex Bennée
@ 2023-11-20 15:08 ` Alex Bennée
  2023-11-20 15:08 ` [PATCH v2 14/14] tests/tcg: finesse the registers check for "hidden" regs Alex Bennée
  13 siblings, 0 replies; 21+ messages in thread
From: Alex Bennée @ 2023-11-20 15:08 UTC (permalink / raw)
  To: qemu-devel
  Cc: Wainer dos Santos Moschetta, Cédric Le Goater,
	Mahmoud Mandour, Peter Maydell, David Hildenbrand,
	Alex Bennée, qemu-s390x, Beraldo Leal, qemu-arm, devel,
	qemu-ppc, Daniel Henrique Barboza, Paolo Bonzini,
	Philippe Mathieu-Daudé, Alexandre Iooss, Marek Vasut,
	Thomas Huth, Chris Wulff, Ilya Leoshkevich, Richard Henderson,
	Nicholas Piggin

As 32 bit x86 become rarer we are starting to run into problems with
search paths. Although we switched to a Debian container we still
favour the native CC on a Bookworm host. As a result we have a broken
cross compile setup which then fails to build with:

    BUILD   i386-linux-user guest-tests
  In file included from /usr/include/linux/stat.h:5,
                   from /usr/include/bits/statx.h:31,
                   from /usr/include/sys/stat.h:465,
                   from /home/alex/lsrc/qemu.git/tests/tcg/multiarch/linux/linux-test.c:28:
  /usr/include/linux/types.h:5:10: fatal error: asm/types.h: No such file or directory
      5 | #include <asm/types.h>
        |          ^~~~~~~~~~~~~
  compilation terminated.
  make[1]: *** [Makefile:119: linux-test] Error 1
  make: *** [/home/alex/lsrc/qemu.git/tests/Makefile.include:50: build-tcg-tests-i386-linux-user] Error 2

This is likely to affect more and more linux-user builds so wrap the
whole check in a test for softmmu targets (aka bare metal) which don't
worry about such header niceties. This allows us to keep using the
host compiler for softmmu tests and the roms.

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

---
v2
  - split fix for tests/docker: replace fedora-i386 with debian-i686
    as still in my tree ;-)
  - didn't apply dpb rb due to change requested by bonzini
---
 configure | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/configure b/configure
index 9ea0bf5698..42fe4d0510 100755
--- a/configure
+++ b/configure
@@ -1391,16 +1391,19 @@ probe_target_compiler() {
   done
 
   try=cross
-  case "$target_arch:$cpu" in
-    aarch64_be:aarch64 | \
-    armeb:arm | \
-    i386:x86_64 | \
-    mips*:mips64 | \
-    ppc*:ppc64 | \
-    sparc:sparc64 | \
-    "$cpu:$cpu")
-      try='native cross' ;;
-  esac
+  # For softmmu/roms we might be able to use the host compiler
+  if [ "${1%softmmu}" != "$1" ]; then
+      case "$target_arch:$cpu" in
+        aarch64_be:aarch64 | \
+        armeb:arm | \
+        i386:x86_64 | \
+        mips*:mips64 | \
+        ppc*:ppc64 | \
+        sparc:sparc64 | \
+        "$cpu:$cpu")
+        try='native cross' ;;
+      esac
+  fi
   eval "target_cflags=\${cross_cc_cflags_$target_arch}"
   for thistry in $try; do
     case $thistry in
-- 
2.39.2



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

* [PATCH v2 14/14] tests/tcg: finesse the registers check for "hidden" regs
  2023-11-20 15:08 [PATCH v2 00/14] random fixes for 8.2 pre-PR (tests, plugins, docs, semihosting) Alex Bennée
                   ` (12 preceding siblings ...)
  2023-11-20 15:08 ` [PATCH v2 13/14] configure: don't try a "native" cross for linux-user Alex Bennée
@ 2023-11-20 15:08 ` Alex Bennée
  13 siblings, 0 replies; 21+ messages in thread
From: Alex Bennée @ 2023-11-20 15:08 UTC (permalink / raw)
  To: qemu-devel
  Cc: Wainer dos Santos Moschetta, Cédric Le Goater,
	Mahmoud Mandour, Peter Maydell, David Hildenbrand,
	Alex Bennée, qemu-s390x, Beraldo Leal, qemu-arm, devel,
	qemu-ppc, Daniel Henrique Barboza, Paolo Bonzini,
	Philippe Mathieu-Daudé, Alexandre Iooss, Marek Vasut,
	Thomas Huth, Chris Wulff, Ilya Leoshkevich, Richard Henderson,
	Nicholas Piggin, Luis Machado

The reason the ppc64 and s390x test where failing was because gdb
hides them although they are still accessible via regnum. We can
re-arrange the test a little bit and include these two arches in our
test.

We still don't explicitly fail for registers that just disappear like
in the ARM case:

  xml-tdesc has 228 registers
  remote-registers has 219 registers
  of which 0 are hidden
  {'name': 'CNTP_CVAL', 'regnum': 96} wasn't seen in remote-registers
  {'name': 'CNTV_CVAL', 'regnum': 101} wasn't seen in remote-registers
  {'name': 'PAR', 'regnum': 113} wasn't seen in remote-registers
  {'name': 'CPUACTLR', 'regnum': 114} wasn't seen in remote-registers
  {'name': 'CPUECTLR', 'regnum': 127} wasn't seen in remote-registers
  {'name': 'CPUMERRSR', 'regnum': 140} wasn't seen in remote-registers
  {'name': 'TTBR1', 'regnum': 148} wasn't seen in remote-registers
  {'name': 'L2MERRSR', 'regnum': 161} wasn't seen in remote-registers
  {'name': 'TTBR0', 'regnum': 168} wasn't seen in remote-registers

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Cc: Ilya Leoshkevich <iii@linux.ibm.com>
Cc: qemu-s390x@nongnu.org
Cc: Nicholas Piggin <npiggin@gmail.com>
Cc: Daniel Henrique Barboza <danielhb413@gmail.com>
Cc: qemu-ppc@nongnu.org
Cc: Luis Machado <luis.machado@arm.com>

---
v2
  - skip if check for total_regs != total_r_regs and always dump what
    is elided/missed
---
 tests/tcg/multiarch/gdbstub/registers.py | 87 +++++++++++++++++-------
 tests/tcg/ppc64/Makefile.target          |  7 --
 tests/tcg/s390x/Makefile.target          |  4 --
 3 files changed, 64 insertions(+), 34 deletions(-)

diff --git a/tests/tcg/multiarch/gdbstub/registers.py b/tests/tcg/multiarch/gdbstub/registers.py
index ff6076b09e..8ba14099b5 100644
--- a/tests/tcg/multiarch/gdbstub/registers.py
+++ b/tests/tcg/multiarch/gdbstub/registers.py
@@ -44,7 +44,6 @@ def fetch_xml_regmap():
 
     total_regs = 0
     reg_map = {}
-    frame = gdb.selected_frame()
 
     tree = ET.fromstring(xml)
     for f in tree.findall("feature"):
@@ -61,12 +60,8 @@ def fetch_xml_regmap():
         for r in regs:
             name = r.attrib["name"]
             regnum = int(r.attrib["regnum"])
-            try:
-                value = frame.read_register(name)
-            except ValueError:
-                report(False, f"failed to read reg: {name}")
 
-            entry = { "name": name, "initial": value, "regnum": regnum }
+            entry = { "name": name, "regnum": regnum }
 
             if name in reg_map:
                 report(False, f"duplicate register {entry} vs {reg_map[name]}")
@@ -80,6 +75,15 @@ def fetch_xml_regmap():
 
     return reg_map
 
+def get_register_by_regnum(reg_map, regnum):
+    """
+    Helper to find a register from the map via its XML regnum
+    """
+    for regname, entry in reg_map.items():
+        if entry['regnum'] == regnum:
+            return entry
+    return None
+
 def crosscheck_remote_xml(reg_map):
     """
     Cross-check the list of remote-registers with the XML info.
@@ -90,6 +94,7 @@ def crosscheck_remote_xml(reg_map):
 
     total_regs = len(reg_map.keys())
     total_r_regs = 0
+    total_r_elided_regs = 0
 
     for r in r_regs:
         fields = r.split()
@@ -100,6 +105,15 @@ def crosscheck_remote_xml(reg_map):
             r_name = fields[0]
             r_regnum = int(fields[6])
 
+            # Some registers are "hidden" so don't have a name
+            # although they still should have a register number
+            if r_name == "''":
+                total_r_elided_regs += 1
+                x_reg = get_register_by_regnum(reg_map, r_regnum)
+                if x_reg is not None:
+                    x_reg["hidden"] = True
+                continue
+
             # check in the XML
             try:
                 x_reg = reg_map[r_name]
@@ -117,14 +131,39 @@ def crosscheck_remote_xml(reg_map):
     # Just print a mismatch in totals as gdb will filter out 64 bit
     # registers on a 32 bit machine. Also print what is missing to
     # help with debug.
-    if total_regs != total_r_regs:
-        print(f"xml-tdesc has ({total_regs}) registers")
-        print(f"remote-registers has ({total_r_regs}) registers")
+    print(f"xml-tdesc has {total_regs} registers")
+    print(f"remote-registers has {total_r_regs} registers")
+    print(f"of which {total_r_elided_regs} are hidden")
+
+    for x_key in reg_map.keys():
+        x_reg = reg_map[x_key]
+        if "hidden" in x_reg:
+            print(f"{x_reg} elided by gdb")
+        elif "seen" not in x_reg:
+            print(f"{x_reg} wasn't seen in remote-registers")
+
+def initial_register_read(reg_map):
+    """
+    Do an initial read of all registers that we know gdb cares about
+    (so ignore the elided ones).
+    """
+    frame = gdb.selected_frame()
+
+    for e in reg_map.values():
+        name = e["name"]
+        regnum = e["regnum"]
+
+        try:
+            if "hidden" in e:
+                value = frame.read_register(regnum)
+                e["initial"] = value
+            elif "seen" in e:
+                value = frame.read_register(name)
+                e["initial"] = value
+
+        except ValueError:
+                report(False, f"failed to read reg: {name}")
 
-        for x_key in reg_map.keys():
-            x_reg = reg_map[x_key]
-            if "seen" not in x_reg:
-                print(f"{x_reg} wasn't seen in remote-registers")
 
 def complete_and_diff(reg_map):
     """
@@ -144,18 +183,19 @@ def complete_and_diff(reg_map):
     changed = 0
 
     for e in reg_map.values():
-        name = e["name"]
-        old_val = e["initial"]
+        if "initial" in e and "hidden" not in e:
+            name = e["name"]
+            old_val = e["initial"]
 
-        try:
-            new_val = frame.read_register(name)
-        except:
-            report(False, f"failed to read {name} at end of run")
-            continue
+            try:
+                new_val = frame.read_register(name)
+            except ValueError:
+                report(False, f"failed to read {name} at end of run")
+                continue
 
-        if new_val != old_val:
-            print(f"{name} changes from {old_val} to {new_val}")
-            changed += 1
+            if new_val != old_val:
+                print(f"{name} changes from {old_val} to {new_val}")
+                changed += 1
 
     # as long as something changed we can be confident its working
     report(changed > 0, f"{changed} registers were changed")
@@ -168,6 +208,7 @@ def run_test():
 
     if reg_map is not None:
         crosscheck_remote_xml(reg_map)
+        initial_register_read(reg_map)
         complete_and_diff(reg_map)
 
 
diff --git a/tests/tcg/ppc64/Makefile.target b/tests/tcg/ppc64/Makefile.target
index 1d08076756..5721c159f2 100644
--- a/tests/tcg/ppc64/Makefile.target
+++ b/tests/tcg/ppc64/Makefile.target
@@ -38,11 +38,4 @@ PPC64_TESTS += signal_save_restore_xer
 PPC64_TESTS += xxspltw
 PPC64_TESTS += test-aes
 
-ifneq ($(GDB),)
-# Skip for now until vsx registers sorted out
-run-gdbstub-registers:
-	$(call skip-test, $<, "BROKEN reading VSX registers")
-endif
-
-
 TESTS += $(PPC64_TESTS)
diff --git a/tests/tcg/s390x/Makefile.target b/tests/tcg/s390x/Makefile.target
index 46544fecd4..0e670f3f8b 100644
--- a/tests/tcg/s390x/Makefile.target
+++ b/tests/tcg/s390x/Makefile.target
@@ -103,10 +103,6 @@ run-gdbstub-svc: hello-s390x-asm
 		--bin $< --test $(S390X_SRC)/gdbstub/test-svc.py, \
 	single-stepping svc)
 
-# Skip for now until vx registers sorted out
-run-gdbstub-registers:
-	$(call skip-test, $<, "BROKEN reading VX registers")
-
 EXTRA_RUNS += run-gdbstub-signals-s390x run-gdbstub-svc
 endif
 
-- 
2.39.2



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

* Re: [PATCH v2 08/14] docs/system: clarify limits of using gdbstub in system emulation
  2023-11-20 15:08 ` [PATCH v2 08/14] docs/system: clarify limits of using gdbstub in system emulation Alex Bennée
@ 2023-11-20 16:15   ` Richard Henderson
  2023-11-20 17:20   ` Philippe Mathieu-Daudé
  2023-11-20 17:26   ` Peter Maydell
  2 siblings, 0 replies; 21+ messages in thread
From: Richard Henderson @ 2023-11-20 16:15 UTC (permalink / raw)
  To: Alex Bennée, qemu-devel

On 11/20/23 07:08, Alex Bennée wrote:
> It seems some users will try and use the gdbstub to debug userspace
> inside a system emulation. While possible clarify the limitations of
> this approach and direct the users to a less head scratching way of
> debugging user-space.
> 
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> Clarifies: https://gitlab.com/qemu-project/qemu/-/issues/1274
> ---
>   docs/system/gdb.rst | 13 ++++++++++++-
>   1 file changed, 12 insertions(+), 1 deletion(-)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>


r~


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

* Re: [PATCH v2 07/14] docs/emulation: expand warning about semihosting
  2023-11-20 15:08 ` [PATCH v2 07/14] docs/emulation: expand warning about semihosting Alex Bennée
@ 2023-11-20 16:15   ` Richard Henderson
  0 siblings, 0 replies; 21+ messages in thread
From: Richard Henderson @ 2023-11-20 16:15 UTC (permalink / raw)
  To: Alex Bennée, qemu-devel

On 11/20/23 07:08, Alex Bennée wrote:
> A surprising feature of calls like SYS_READC is this can cause QEMU to
> indefinitely block as there is no handling for EOF.
> 
> Clarifies: https://gitlab.com/qemu-project/qemu/-/issues/1963
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> ---
>   docs/about/emulation.rst | 5 +++--
>   1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/docs/about/emulation.rst b/docs/about/emulation.rst
> index 0ad0b86f0d..a2eefe3f3f 100644
> --- a/docs/about/emulation.rst
> +++ b/docs/about/emulation.rst
> @@ -129,8 +129,9 @@ causing most hypervisors to trap and fault on them.
>   .. warning::
>      Semihosting inherently bypasses any isolation there may be between
>      the guest and the host. As a result a program using semihosting can
> -   happily trash your host system. You should only ever run trusted
> -   code with semihosting enabled.
> +   happily trash your host system. Some semihosting calls (e.g.
> +   ``SYS_READC``) can block execution indefinitely. You should only
> +   ever run trusted code with semihosting enabled.
>   
>   Redirection
>   ~~~~~~~~~~~



Reviewed-by: Richard Henderson <richard.henderson@linaro.org>


r~


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

* Re: [PATCH v2 11/14] tests/tcg: enable arm softmmu tests
  2023-11-20 15:08 ` [PATCH v2 11/14] tests/tcg: enable arm softmmu tests Alex Bennée
@ 2023-11-20 16:32   ` Richard Henderson
  2023-11-20 17:25   ` Peter Maydell
  1 sibling, 0 replies; 21+ messages in thread
From: Richard Henderson @ 2023-11-20 16:32 UTC (permalink / raw)
  To: Alex Bennée, qemu-devel

On 11/20/23 07:08, Alex Bennée wrote:
> +/*
> + * Helper macro for the linker calling subroutines from the C code.
> + */

That's not all it's for.  Better "annotating functions with elf type and size".

> +vector_table:
> +	b   reset		/* reset vector */
> +	b   undef_instr        /* undefined instruction vector */
> +	b   software_intr    	/* software interrupt vector */
> +	b   prefetch_abort		/* prefetch abort vector */
> +	b   data_abort	        /* data abort vector */
> +	nop			            /* reserved */
> +	b   IRQ_handler        	/* IRQ vector */
> +	b   FIQ_handler        	/* FIQ vector */

Missing endf, for the purpose of qemu load_symbols().

> +mmu_setup:
> +reset:
> +undef_instr:
> +software_intr:
> +prefetch_abort:
> +data_abort:
> +IRQ_handler:
> +FIQ_handler:

Also missing.

With those fixed,

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>


r~


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

* Re: [PATCH v2 08/14] docs/system: clarify limits of using gdbstub in system emulation
  2023-11-20 15:08 ` [PATCH v2 08/14] docs/system: clarify limits of using gdbstub in system emulation Alex Bennée
  2023-11-20 16:15   ` Richard Henderson
@ 2023-11-20 17:20   ` Philippe Mathieu-Daudé
  2023-11-20 17:26   ` Peter Maydell
  2 siblings, 0 replies; 21+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-11-20 17:20 UTC (permalink / raw)
  To: Alex Bennée, qemu-devel
  Cc: Wainer dos Santos Moschetta, Cédric Le Goater,
	Mahmoud Mandour, Peter Maydell, David Hildenbrand, qemu-s390x,
	Beraldo Leal, qemu-arm, devel, qemu-ppc, Daniel Henrique Barboza,
	Paolo Bonzini, Alexandre Iooss, Marek Vasut, Thomas Huth,
	Chris Wulff, Ilya Leoshkevich, Richard Henderson, Nicholas Piggin

On 20/11/23 16:08, Alex Bennée wrote:
> It seems some users will try and use the gdbstub to debug userspace
> inside a system emulation. While possible clarify the limitations of
> this approach and direct the users to a less head scratching way of
> debugging user-space.
> 
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> Clarifies: https://gitlab.com/qemu-project/qemu/-/issues/1274
> ---
>   docs/system/gdb.rst | 13 ++++++++++++-
>   1 file changed, 12 insertions(+), 1 deletion(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>



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

* Re: [PATCH v2 11/14] tests/tcg: enable arm softmmu tests
  2023-11-20 15:08 ` [PATCH v2 11/14] tests/tcg: enable arm softmmu tests Alex Bennée
  2023-11-20 16:32   ` Richard Henderson
@ 2023-11-20 17:25   ` Peter Maydell
  1 sibling, 0 replies; 21+ messages in thread
From: Peter Maydell @ 2023-11-20 17:25 UTC (permalink / raw)
  To: Alex Bennée
  Cc: qemu-devel, Wainer dos Santos Moschetta, Cédric Le Goater,
	Mahmoud Mandour, David Hildenbrand, qemu-s390x, Beraldo Leal,
	qemu-arm, devel, qemu-ppc, Daniel Henrique Barboza, Paolo Bonzini,
	Philippe Mathieu-Daudé, Alexandre Iooss, Marek Vasut,
	Thomas Huth, Chris Wulff, Ilya Leoshkevich, Richard Henderson,
	Nicholas Piggin

On Mon, 20 Nov 2023 at 15:08, Alex Bennée <alex.bennee@linaro.org> wrote:
>
> To make it easier to test 32 bit Arm softmmu issues implement a basic
> boot.S so we can build the multiarch tests. Currently CHECK_UNALIGNED
> is disabled as I haven't got the right magic set for it to work.
>
> Message-Id: <20231115205542.3092038-10-alex.bennee@linaro.org>
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>


> +# Running
> +QEMU_BASE_MACHINE=-M virt -cpu max -display none
> +QEMU_OPTS+=$(QEMU_BASE_MACHINE) -semihosting-config enable=on,target=native,chardev=output -kernel
> +

A minor thing, but I just ran into an awkwardness in the
equivalent set of variables in the aarch64 subdirectory:
if you ever want to define a different machine type then
there's no convenient way to say "give me the standard
options but a different machine", because the QEMU_OPTS
has the base machine in it and there's no variable with
just the semihosting etc options in it. For aarch64 I opted for:

+QEMU_BASE_ARGS=-semihosting-config enable=on,target=native,chardev=output
+QEMU_OPTS+=$(QEMU_BASE_MACHINE) $(QEMU_BASE_ARGS) -kernel

because then you can have a particular test do something like
+QEMU_EL2_MACHINE=-machine virt,virtualization=on,gic-version=2 -cpu
cortex-a57 -smp 4
+run-vtimer: QEMU_OPTS=$(QEMU_EL2_MACHINE) $(QEMU_BASE_ARGS) -kernel

You could argue about whether '-display none' should be in
QEMU_BASE_ARGS. I figure -kernel should not be because it
has the weird "must go last" property.

(These tweaks to the aarch64 makefile coming soon in a different
patch...)

thanks
-- PMM


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

* Re: [PATCH v2 08/14] docs/system: clarify limits of using gdbstub in system emulation
  2023-11-20 15:08 ` [PATCH v2 08/14] docs/system: clarify limits of using gdbstub in system emulation Alex Bennée
  2023-11-20 16:15   ` Richard Henderson
  2023-11-20 17:20   ` Philippe Mathieu-Daudé
@ 2023-11-20 17:26   ` Peter Maydell
  2 siblings, 0 replies; 21+ messages in thread
From: Peter Maydell @ 2023-11-20 17:26 UTC (permalink / raw)
  To: Alex Bennée
  Cc: qemu-devel, Wainer dos Santos Moschetta, Cédric Le Goater,
	Mahmoud Mandour, David Hildenbrand, qemu-s390x, Beraldo Leal,
	qemu-arm, devel, qemu-ppc, Daniel Henrique Barboza, Paolo Bonzini,
	Philippe Mathieu-Daudé, Alexandre Iooss, Marek Vasut,
	Thomas Huth, Chris Wulff, Ilya Leoshkevich, Richard Henderson,
	Nicholas Piggin

On Mon, 20 Nov 2023 at 15:08, Alex Bennée <alex.bennee@linaro.org> wrote:
>
> It seems some users will try and use the gdbstub to debug userspace
> inside a system emulation. While possible clarify the limitations of
> this approach and direct the users to a less head scratching way of
> debugging user-space.
>
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> Clarifies: https://gitlab.com/qemu-project/qemu/-/issues/1274
> ---
>  docs/system/gdb.rst | 13 ++++++++++++-
>  1 file changed, 12 insertions(+), 1 deletion(-)
>
> diff --git a/docs/system/gdb.rst b/docs/system/gdb.rst
> index 9906991b84..c0cc0c9c7e 100644
> --- a/docs/system/gdb.rst
> +++ b/docs/system/gdb.rst
> @@ -60,7 +60,7 @@ As TCG cannot track all memory accesses in user-mode there is no
>  support for watchpoints.
>
>  Relocating code
> ----------------
> +===============
>
>  On modern kernels confusion can be caused by code being relocated by
>  features such as address space layout randomisation. To avoid
> @@ -68,6 +68,17 @@ confusion when debugging such things you either need to update gdb's
>  view of where things are in memory or perhaps more trivially disable
>  ASLR when booting the system.
>
> +Debugging user-space in system emulation
> +========================================
> +
> +While technically possible to debug a user-space program running

"While it is"

> +inside a system image it does present challenges. Kernel preemption

"image, "

> +and execution mode changes between kernel and user mode can make it
> +hard to follow whats going on. Unless you are specifically trying to

"what's"

> +debug some interaction between kernel and user-space you are better
> +off running your guest program with gdb either in the guest or using
> +a gdbserver exposed via a port to the outside world.
> +
>  Debugging multicore machines
>  ============================

thanks
-- PMM


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

end of thread, other threads:[~2023-11-20 17:26 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-20 15:08 [PATCH v2 00/14] random fixes for 8.2 pre-PR (tests, plugins, docs, semihosting) Alex Bennée
2023-11-20 15:08 ` [PATCH v2 01/14] tests/docker: replace fedora-i386 with debian-i686 Alex Bennée
2023-11-20 15:08 ` [PATCH v2 02/14] .gitlab-ci.d/cirrus: Upgrade macOS to 13 (Ventura) Alex Bennée
2023-11-20 15:08 ` [PATCH v2 03/14] tests/docker: merge debian-native with debian-amd64 Alex Bennée
2023-11-20 15:08 ` [PATCH v2 04/14] plugins: fix win plugin tests on cross compile Alex Bennée
2023-11-20 15:08 ` [PATCH v2 05/14] target/nios2: Deprecate the Nios II architecture Alex Bennée
2023-11-20 15:08 ` [PATCH v2 06/14] tests/tcg: fixup Aarch64 semiconsole test Alex Bennée
2023-11-20 15:08 ` [PATCH v2 07/14] docs/emulation: expand warning about semihosting Alex Bennée
2023-11-20 16:15   ` Richard Henderson
2023-11-20 15:08 ` [PATCH v2 08/14] docs/system: clarify limits of using gdbstub in system emulation Alex Bennée
2023-11-20 16:15   ` Richard Henderson
2023-11-20 17:20   ` Philippe Mathieu-Daudé
2023-11-20 17:26   ` Peter Maydell
2023-11-20 15:08 ` [PATCH v2 09/14] hw/core: skip loading debug on all failures Alex Bennée
2023-11-20 15:08 ` [PATCH v2 10/14] testing: move arm system tests into their own folder Alex Bennée
2023-11-20 15:08 ` [PATCH v2 11/14] tests/tcg: enable arm softmmu tests Alex Bennée
2023-11-20 16:32   ` Richard Henderson
2023-11-20 17:25   ` Peter Maydell
2023-11-20 15:08 ` [PATCH v2 12/14] tests/tcg: enable semiconsole test for Arm Alex Bennée
2023-11-20 15:08 ` [PATCH v2 13/14] configure: don't try a "native" cross for linux-user Alex Bennée
2023-11-20 15:08 ` [PATCH v2 14/14] tests/tcg: finesse the registers check for "hidden" regs Alex Bennée

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