All of lore.kernel.org
 help / color / mirror / Atom feed
* [PULL 00/18] testing, docs, semihosting move and guest-loader
@ 2021-03-08 13:50 Alex Bennée
  2021-03-08 13:50 ` [PULL 01/18] docs/system: add a gentle prompt for the complexity to come Alex Bennée
                   ` (19 more replies)
  0 siblings, 20 replies; 38+ messages in thread
From: Alex Bennée @ 2021-03-08 13:50 UTC (permalink / raw)
  To: peter.maydell; +Cc: Alex Bennée, qemu-devel

The following changes since commit 91e92cad67caca3bc4b8e920ddb5c8ca64aac9e1:

  Merge remote-tracking branch 'remotes/cohuck-gitlab/tags/s390x-20210305' into staging (2021-03-05 19:04:47 +0000)

are available in the Git repository at:

  https://github.com/stsquad/qemu.git tags/pull-testing-docs-xen-updates-080321-1

for you to fetch changes up to 8109b8cadf5979a29b4b6e1ca7288bc0ee676426:

  semihosting: Move hw/semihosting/ -> semihosting/ (2021-03-08 12:15:05 +0000)

----------------------------------------------------------------
Testing, guest-loader and other misc tweaks

  - add warning text to quickstart example
  - add support for hexagon check-tcg tests
  - add CFI tests to CI
  - use --arch-only for docker pre-requisites
  - fix .editorconfig for emacs
  - add guest-loader for Xen-like hypervisor testing
  - move generic-loader docs into manual proper
  - move semihosting out of hw/

----------------------------------------------------------------
Alessandro Di Federico (2):
      docker: Add Hexagon image
      tests/tcg: Use Hexagon Docker image

Alex Bennée (11):
      docs/system: add a gentle prompt for the complexity to come
      tests/docker: add a test-tcg for building then running check-tcg
      gitlab: add build-user-hexagon test
      .editorconfig: update the automatic mode setting for Emacs
      hw/board: promote fdt from ARM VirtMachineState to MachineState
      hw/riscv: migrate fdt field to generic MachineState
      device_tree: add qemu_fdt_setprop_string_array helper
      hw/core: implement a guest-loader to support static hypervisor guests
      docs: move generic-loader documentation into the main manual
      docs: add some documentation for the guest-loader
      tests/avocado: add boot_xen tests

Daniele Buono (2):
      gitlab-ci.yml: Allow custom # of parallel linkers
      gitlab-ci.yml: Add jobs to test CFI flags

Philippe Mathieu-Daudé (3):
      tests/docker: Use --arch-only when building Debian cross image
      semihosting: Move include/hw/semihosting/ -> include/semihosting/
      semihosting: Move hw/semihosting/ -> semihosting/

 docs/generic-loader.txt                            |  92 ------
 docs/system/generic-loader.rst                     | 117 +++++++
 docs/system/guest-loader.rst                       |  54 ++++
 docs/system/index.rst                              |   2 +
 docs/system/quickstart.rst                         |   8 +
 docs/system/targets.rst                            |   2 +
 meson.build                                        |   1 +
 hw/core/guest-loader.h                             |  34 ++
 include/hw/arm/virt.h                              |   1 -
 include/hw/boards.h                                |   1 +
 include/hw/riscv/virt.h                            |   1 -
 include/{hw => }/semihosting/console.h             |   0
 include/{hw => }/semihosting/semihost.h            |   0
 include/sysemu/device_tree.h                       |  17 +
 {hw/semihosting => semihosting}/common-semi.h      |   0
 gdbstub.c                                          |   2 +-
 hw/arm/virt.c                                      | 356 +++++++++++----------
 hw/core/guest-loader.c                             | 145 +++++++++
 hw/mips/malta.c                                    |   2 +-
 hw/riscv/virt.c                                    |  20 +-
 linux-user/aarch64/cpu_loop.c                      |   2 +-
 linux-user/arm/cpu_loop.c                          |   2 +-
 linux-user/riscv/cpu_loop.c                        |   2 +-
 linux-user/semihost.c                              |   2 +-
 {hw/semihosting => semihosting}/arm-compat-semi.c  |   6 +-
 {hw/semihosting => semihosting}/config.c           |   2 +-
 {hw/semihosting => semihosting}/console.c          |   4 +-
 softmmu/device_tree.c                              |  26 ++
 softmmu/vl.c                                       |   2 +-
 stubs/semihost.c                                   |   2 +-
 target/arm/helper.c                                |   4 +-
 target/arm/m_helper.c                              |   4 +-
 target/arm/translate-a64.c                         |   2 +-
 target/arm/translate.c                             |   2 +-
 target/lm32/helper.c                               |   2 +-
 target/m68k/op_helper.c                            |   2 +-
 target/mips/cpu.c                                  |   2 +-
 target/mips/mips-semi.c                            |   4 +-
 target/mips/translate.c                            |   2 +-
 target/nios2/helper.c                              |   2 +-
 target/riscv/cpu_helper.c                          |   2 +-
 target/unicore32/helper.c                          |   2 +-
 target/xtensa/translate.c                          |   2 +-
 target/xtensa/xtensa-semi.c                        |   2 +-
 .editorconfig                                      |  17 +-
 .gitlab-ci.yml                                     | 134 ++++++++
 Kconfig                                            |   1 +
 MAINTAINERS                                        |  15 +-
 hw/Kconfig                                         |   1 -
 hw/core/meson.build                                |   2 +
 hw/meson.build                                     |   1 -
 {hw/semihosting => semihosting}/Kconfig            |   0
 {hw/semihosting => semihosting}/meson.build        |   0
 tests/acceptance/boot_xen.py                       | 118 +++++++
 tests/docker/Makefile.include                      |   2 +
 .../docker/dockerfiles/debian-hexagon-cross.docker |  27 ++
 .../build-toolchain.sh                             | 141 ++++++++
 tests/docker/dockerfiles/debian10.docker           |   2 +-
 tests/docker/test-tcg                              |  22 ++
 tests/tcg/configure.sh                             |   4 +
 60 files changed, 1108 insertions(+), 318 deletions(-)
 delete mode 100644 docs/generic-loader.txt
 create mode 100644 docs/system/generic-loader.rst
 create mode 100644 docs/system/guest-loader.rst
 create mode 100644 hw/core/guest-loader.h
 rename include/{hw => }/semihosting/console.h (100%)
 rename include/{hw => }/semihosting/semihost.h (100%)
 rename {hw/semihosting => semihosting}/common-semi.h (100%)
 create mode 100644 hw/core/guest-loader.c
 rename {hw/semihosting => semihosting}/arm-compat-semi.c (99%)
 rename {hw/semihosting => semihosting}/config.c (99%)
 rename {hw/semihosting => semihosting}/console.c (98%)
 rename {hw/semihosting => semihosting}/Kconfig (100%)
 rename {hw/semihosting => semihosting}/meson.build (100%)
 create mode 100644 tests/acceptance/boot_xen.py
 create mode 100644 tests/docker/dockerfiles/debian-hexagon-cross.docker
 create mode 100755 tests/docker/dockerfiles/debian-hexagon-cross.docker.d/build-toolchain.sh
 create mode 100755 tests/docker/test-tcg


-- 
2.20.1



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

* [PULL 01/18] docs/system: add a gentle prompt for the complexity to come
  2021-03-08 13:50 [PULL 00/18] testing, docs, semihosting move and guest-loader Alex Bennée
@ 2021-03-08 13:50 ` Alex Bennée
  2021-03-08 13:50 ` [PULL 02/18] tests/docker: add a test-tcg for building then running check-tcg Alex Bennée
                   ` (18 subsequent siblings)
  19 siblings, 0 replies; 38+ messages in thread
From: Alex Bennée @ 2021-03-08 13:50 UTC (permalink / raw)
  To: peter.maydell
  Cc: John Snow, Thomas Huth, Alex Bennée, qemu-devel, Stefan Hajnoczi

We all know the QEMU command line can become a fiendishly complex
beast. Lets gently prepare our user for the horrors to come by
referencing where other example command lines can be found in the
manual.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-Id: <20210305092328.31792-3-alex.bennee@linaro.org>

diff --git a/docs/system/quickstart.rst b/docs/system/quickstart.rst
index 3a3acab5e7..681678c86e 100644
--- a/docs/system/quickstart.rst
+++ b/docs/system/quickstart.rst
@@ -11,3 +11,11 @@ Download and uncompress a PC hard disk image with Linux installed (e.g.
    |qemu_system| linux.img
 
 Linux should boot and give you a prompt.
+
+Users should be aware the above example elides a lot of the complexity
+of setting up a VM with x86_64 specific defaults and assumes the
+first non switch argument is a PC compatible disk image with a boot
+sector. For a non-x86 system where we emulate a broad range of machine
+types, the command lines are generally more explicit in defining the
+machine and boot behaviour. You will find more example command lines
+in the :ref:`system-targets-ref` section of the manual.
diff --git a/docs/system/targets.rst b/docs/system/targets.rst
index 75ed1087fd..9dcd95dd84 100644
--- a/docs/system/targets.rst
+++ b/docs/system/targets.rst
@@ -1,3 +1,5 @@
+.. _system-targets-ref:
+
 QEMU System Emulator Targets
 ============================
 
-- 
2.20.1



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

* [PULL 02/18] tests/docker: add a test-tcg for building then running check-tcg
  2021-03-08 13:50 [PULL 00/18] testing, docs, semihosting move and guest-loader Alex Bennée
  2021-03-08 13:50 ` [PULL 01/18] docs/system: add a gentle prompt for the complexity to come Alex Bennée
@ 2021-03-08 13:50 ` Alex Bennée
  2021-03-08 13:50 ` [PULL 03/18] docker: Add Hexagon image Alex Bennée
                   ` (17 subsequent siblings)
  19 siblings, 0 replies; 38+ messages in thread
From: Alex Bennée @ 2021-03-08 13:50 UTC (permalink / raw)
  To: peter.maydell
  Cc: Fam Zheng, Philippe Mathieu-Daudé,
	Alex Bennée, qemu-devel, Philippe Mathieu-Daudé

This is mostly useful for verifying containers will work on the CI
setup.

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

diff --git a/tests/docker/test-tcg b/tests/docker/test-tcg
new file mode 100755
index 0000000000..00993b73ba
--- /dev/null
+++ b/tests/docker/test-tcg
@@ -0,0 +1,22 @@
+#!/bin/bash -e
+#
+# Build and run the TCG tests
+#
+# Copyright (c) 2021 Linaro Ltd.
+#
+# Authors:
+#  Alex Bennée <alex.bennee@linaro.org>
+#
+# This work is licensed under the terms of the GNU GPL, version 2
+# or (at your option) any later version. See the COPYING file in
+# the top-level directory.
+
+. common.rc
+
+cd "$BUILD_DIR"
+
+# although we are not building QEMU itself we still need a configured
+# build for the unit tests to be built and run
+TARGET_LIST=${TARGET_LIST:-$DEF_TARGET_LIST} \
+build_qemu
+check_qemu check-tcg
-- 
2.20.1



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

* [PULL 03/18] docker: Add Hexagon image
  2021-03-08 13:50 [PULL 00/18] testing, docs, semihosting move and guest-loader Alex Bennée
  2021-03-08 13:50 ` [PULL 01/18] docs/system: add a gentle prompt for the complexity to come Alex Bennée
  2021-03-08 13:50 ` [PULL 02/18] tests/docker: add a test-tcg for building then running check-tcg Alex Bennée
@ 2021-03-08 13:50 ` Alex Bennée
  2021-03-08 13:50 ` [PULL 04/18] tests/tcg: Use Hexagon Docker image Alex Bennée
                   ` (16 subsequent siblings)
  19 siblings, 0 replies; 38+ messages in thread
From: Alex Bennée @ 2021-03-08 13:50 UTC (permalink / raw)
  To: peter.maydell
  Cc: Alessandro Di Federico, Brian Cain, Philippe Mathieu-Daudé,
	qemu-devel, Philippe Mathieu-Daudé,
	Fam Zheng, Alex Bennée

From: Alessandro Di Federico <ale@rev.ng>

[PMD: Base on qemu/debian10, add missing EXTRA_FILES, remove X86]

Signed-off-by: Alessandro Di Federico <ale@rev.ng>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Brian Cain <bcain@quicinc.com>
Message-Id: <20210228222314.304787-2-f4bug@amsat.org>
[AJB: add build-dep for QEMU, include in MAINTAINERS]
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

squash! docker: Add Hexagon image
Message-Id: <20210305092328.31792-5-alex.bennee@linaro.org>

diff --git a/MAINTAINERS b/MAINTAINERS
index 26c9454823..ab3118429b 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -196,6 +196,8 @@ F: linux-user/hexagon/
 F: tests/tcg/hexagon/
 F: disas/hexagon.c
 F: default-configs/targets/hexagon-linux-user.mak
+F: docker/dockerfiles/debian-hexagon-cross.docker
+F: docker/dockerfiles/debian-hexagon-cross.docker.d/build-toolchain.sh
 
 HPPA (PA-RISC) TCG CPUs
 M: Richard Henderson <richard.henderson@linaro.org>
diff --git a/tests/docker/Makefile.include b/tests/docker/Makefile.include
index 7cab761bf5..3aee031c4e 100644
--- a/tests/docker/Makefile.include
+++ b/tests/docker/Makefile.include
@@ -144,6 +144,8 @@ docker-image-debian-riscv64-cross: docker-image-debian10
 docker-image-debian-s390x-cross: docker-image-debian10
 docker-image-debian-sh4-cross: docker-image-debian10
 docker-image-debian-sparc64-cross: docker-image-debian10
+docker-image-debian-hexagon-cross: \
+	EXTRA_FILES:=$(SRC_PATH)/tests/docker/dockerfiles/debian-hexagon-cross.docker.d/build-toolchain.sh
 
 # Specialist build images, sometimes very limited tools
 docker-image-debian-tricore-cross: docker-image-debian10
diff --git a/tests/docker/dockerfiles/debian-hexagon-cross.docker b/tests/docker/dockerfiles/debian-hexagon-cross.docker
new file mode 100644
index 0000000000..bf32536896
--- /dev/null
+++ b/tests/docker/dockerfiles/debian-hexagon-cross.docker
@@ -0,0 +1,27 @@
+FROM qemu/debian10
+
+# What we need to build QEMU itself (as this is used in CI as well)
+RUN apt update && \
+    DEBIAN_FRONTEND=noninteractive eatmydata \
+    apt build-dep -yy qemu
+
+RUN DEBIAN_FRONTEND=noninteractive eatmydata \
+    apt install -y --no-install-recommends \
+        bison \
+        cmake \
+        flex \
+        lld \
+        rsync \
+        wget
+
+ENV TOOLCHAIN_INSTALL /usr
+ENV ROOTFS /usr
+
+ENV LLVM_URL https://github.com/llvm/llvm-project/archive/3d8149c2a1228609fd7d7c91a04681304a2f0ca9.tar.gz
+ENV MUSL_URL https://github.com/quic/musl/archive/aff74b395fbf59cd7e93b3691905aa1af6c0778c.tar.gz
+ENV LINUX_URL https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.6.18.tar.xz
+
+ADD build-toolchain.sh /root/hexagon-toolchain/build-toolchain.sh
+
+RUN ( cd /root/hexagon-toolchain && ./build-toolchain.sh ) && \
+    rm -rf /root/hexagon-toolchain
diff --git a/tests/docker/dockerfiles/debian-hexagon-cross.docker.d/build-toolchain.sh b/tests/docker/dockerfiles/debian-hexagon-cross.docker.d/build-toolchain.sh
new file mode 100755
index 0000000000..19b1c9f83e
--- /dev/null
+++ b/tests/docker/dockerfiles/debian-hexagon-cross.docker.d/build-toolchain.sh
@@ -0,0 +1,141 @@
+#!/bin/bash
+
+set -e
+
+BASE=$(readlink -f ${PWD})
+
+TOOLCHAIN_INSTALL=$(readlink -f "$TOOLCHAIN_INSTALL")
+ROOTFS=$(readlink -f "$ROOTFS")
+
+TOOLCHAIN_BIN=${TOOLCHAIN_INSTALL}/bin
+HEX_SYSROOT=${TOOLCHAIN_INSTALL}/hexagon-unknown-linux-musl
+HEX_TOOLS_TARGET_BASE=${HEX_SYSROOT}/usr
+
+function cdp() {
+  DIR="$1"
+  mkdir -p "$DIR"
+  cd "$DIR"
+}
+
+function fetch() {
+  DIR="$1"
+  URL="$2"
+  TEMP="$(readlink -f "$PWD/tmp.tar.gz")"
+  wget --quiet "$URL" -O "$TEMP"
+  cdp "$DIR"
+  tar xaf "$TEMP" --strip-components=1
+  rm "$TEMP"
+  cd -
+}
+
+build_llvm_clang() {
+  fetch "$BASE/llvm-project" "$LLVM_URL"
+  cdp "$BASE/build-llvm"
+
+  cmake -G Ninja \
+    -DCMAKE_BUILD_TYPE=Release \
+    -DCMAKE_INSTALL_PREFIX=${TOOLCHAIN_INSTALL} \
+    -DLLVM_ENABLE_LLD=ON \
+    -DLLVM_TARGETS_TO_BUILD="Hexagon" \
+    -DLLVM_ENABLE_PROJECTS="clang;lld" \
+    "$BASE/llvm-project/llvm"
+  ninja all install
+  cd ${TOOLCHAIN_BIN}
+  ln -sf clang hexagon-unknown-linux-musl-clang
+  ln -sf clang++ hexagon-unknown-linux-musl-clang++
+  ln -sf llvm-ar hexagon-unknown-linux-musl-ar
+  ln -sf llvm-objdump hexagon-unknown-linux-musl-objdump
+  ln -sf llvm-objcopy hexagon-unknown-linux-musl-objcopy
+  ln -sf llvm-readelf hexagon-unknown-linux-musl-readelf
+  ln -sf llvm-ranlib hexagon-unknown-linux-musl-ranlib
+
+  # workaround for now:
+  cat <<EOF > hexagon-unknown-linux-musl.cfg
+-G0 --sysroot=${HEX_SYSROOT}
+EOF
+}
+
+build_clang_rt() {
+  cdp "$BASE/build-clang_rt"
+  cmake -G Ninja \
+    -DCMAKE_BUILD_TYPE=Release \
+    -DLLVM_CONFIG_PATH="$BASE/build-llvm/bin/llvm-config" \
+    -DCMAKE_ASM_FLAGS="-G0 -mlong-calls -fno-pic --target=hexagon-unknown-linux-musl " \
+    -DCMAKE_SYSTEM_NAME=Linux \
+    -DCMAKE_C_COMPILER="${TOOLCHAIN_BIN}/hexagon-unknown-linux-musl-clang" \
+    -DCMAKE_ASM_COMPILER="${TOOLCHAIN_BIN}/hexagon-unknown-linux-musl-clang" \
+    -DCMAKE_INSTALL_PREFIX=${HEX_TOOLS_TARGET_BASE} \
+    -DCMAKE_CROSSCOMPILING=ON \
+    -DCMAKE_C_COMPILER_FORCED=ON \
+    -DCMAKE_CXX_COMPILER_FORCED=ON \
+    -DCOMPILER_RT_BUILD_BUILTINS=ON \
+    -DCOMPILER_RT_BUILTINS_ENABLE_PIC=OFF \
+    -DCMAKE_SIZEOF_VOID_P=4 \
+    -DCOMPILER_RT_OS_DIR= \
+    -DCAN_TARGET_hexagon=1 \
+    -DCAN_TARGET_x86_64=0 \
+    -DCOMPILER_RT_SUPPORTED_ARCH=hexagon \
+    -DLLVM_ENABLE_PROJECTS="compiler-rt" \
+    "$BASE/llvm-project/compiler-rt"
+  ninja install-compiler-rt
+}
+
+build_musl_headers() {
+  fetch "$BASE/musl" "$MUSL_URL"
+  cd "$BASE/musl"
+  make clean
+  CC=${TOOLCHAIN_BIN}/hexagon-unknown-linux-musl-clang \
+    CROSS_COMPILE=hexagon-unknown-linux-musl \
+    LIBCC=${HEX_TOOLS_TARGET_BASE}/lib/libclang_rt.builtins-hexagon.a \
+    CROSS_CFLAGS="-G0 -O0 -mv65 -fno-builtin -fno-rounding-math --target=hexagon-unknown-linux-musl" \
+    ./configure --target=hexagon --prefix=${HEX_TOOLS_TARGET_BASE}
+  PATH=${TOOLCHAIN_BIN}:$PATH make CROSS_COMPILE= install-headers
+
+  cd ${HEX_SYSROOT}/..
+  ln -sf hexagon-unknown-linux-musl hexagon
+}
+
+build_kernel_headers() {
+  fetch "$BASE/linux" "$LINUX_URL"
+  mkdir -p "$BASE/build-linux"
+  cd "$BASE/linux"
+  make O=../build-linux ARCH=hexagon \
+   KBUILD_CFLAGS_KERNEL="-mlong-calls" \
+   CC=${TOOLCHAIN_BIN}/hexagon-unknown-linux-musl-clang \
+   LD=${TOOLCHAIN_BIN}/ld.lld \
+   KBUILD_VERBOSE=1 comet_defconfig
+  make mrproper
+
+  cd "$BASE/build-linux"
+  make \
+    ARCH=hexagon \
+    CC=${TOOLCHAIN_BIN}/clang \
+    INSTALL_HDR_PATH=${HEX_TOOLS_TARGET_BASE} \
+    V=1 \
+    headers_install
+}
+
+build_musl() {
+  cd "$BASE/musl"
+  make clean
+  CROSS_COMPILE=hexagon-unknown-linux-musl- \
+    AR=llvm-ar \
+    RANLIB=llvm-ranlib \
+    STRIP=llvm-strip \
+    CC=clang \
+    LIBCC=${HEX_TOOLS_TARGET_BASE}/lib/libclang_rt.builtins-hexagon.a \
+    CFLAGS="-G0 -O0 -mv65 -fno-builtin -fno-rounding-math --target=hexagon-unknown-linux-musl" \
+    ./configure --target=hexagon --prefix=${HEX_TOOLS_TARGET_BASE}
+  PATH=${TOOLCHAIN_BIN}/:$PATH make CROSS_COMPILE= install
+  cd ${HEX_TOOLS_TARGET_BASE}/lib
+  ln -sf libc.so ld-musl-hexagon.so
+  ln -sf ld-musl-hexagon.so ld-musl-hexagon.so.1
+  cdp ${HEX_TOOLS_TARGET_BASE}/../lib
+  ln -sf ../usr/lib/ld-musl-hexagon.so.1
+}
+
+build_llvm_clang
+build_kernel_headers
+build_musl_headers
+build_clang_rt
+build_musl
-- 
2.20.1



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

* [PULL 04/18] tests/tcg: Use Hexagon Docker image
  2021-03-08 13:50 [PULL 00/18] testing, docs, semihosting move and guest-loader Alex Bennée
                   ` (2 preceding siblings ...)
  2021-03-08 13:50 ` [PULL 03/18] docker: Add Hexagon image Alex Bennée
@ 2021-03-08 13:50 ` Alex Bennée
  2021-03-08 13:50 ` [PULL 05/18] gitlab: add build-user-hexagon test Alex Bennée
                   ` (15 subsequent siblings)
  19 siblings, 0 replies; 38+ messages in thread
From: Alex Bennée @ 2021-03-08 13:50 UTC (permalink / raw)
  To: peter.maydell
  Cc: Alessandro Di Federico, Alex Bennée, qemu-devel,
	Philippe Mathieu-Daudé

From: Alessandro Di Federico <ale@rev.ng>

[PMD: Split from 'Add Hexagon Docker image' patch]

Signed-off-by: Alessandro Di Federico <ale@rev.ng>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20210228222314.304787-5-f4bug@amsat.org>
Message-Id: <20210305092328.31792-6-alex.bennee@linaro.org>

diff --git a/tests/tcg/configure.sh b/tests/tcg/configure.sh
index 36b8a73a54..f70fd7435d 100755
--- a/tests/tcg/configure.sh
+++ b/tests/tcg/configure.sh
@@ -124,6 +124,10 @@ for target in $target_list; do
       container_image=fedora-cris-cross
       container_cross_cc=cris-linux-gnu-gcc
       ;;
+    hexagon-*)
+      container_image=debian-hexagon-cross
+      container_cross_cc=hexagon-unknown-linux-musl-clang
+      ;;
     hppa-*)
       container_image=debian-hppa-cross
       container_cross_cc=hppa-linux-gnu-gcc
-- 
2.20.1



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

* [PULL 05/18] gitlab: add build-user-hexagon test
  2021-03-08 13:50 [PULL 00/18] testing, docs, semihosting move and guest-loader Alex Bennée
                   ` (3 preceding siblings ...)
  2021-03-08 13:50 ` [PULL 04/18] tests/tcg: Use Hexagon Docker image Alex Bennée
@ 2021-03-08 13:50 ` Alex Bennée
  2021-03-08 13:50 ` [PULL 06/18] gitlab-ci.yml: Allow custom # of parallel linkers Alex Bennée
                   ` (14 subsequent siblings)
  19 siblings, 0 replies; 38+ messages in thread
From: Alex Bennée @ 2021-03-08 13:50 UTC (permalink / raw)
  To: peter.maydell
  Cc: Thomas Huth, Alex Bennée, qemu-devel,
	Wainer dos Santos Moschetta, Philippe Mathieu-Daudé,
	Philippe Mathieu-Daudé

We special case this as the container with the cross compiler for the
tests takes so long to build it is manually uploaded into the
registry.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
Message-Id: <20210305092328.31792-7-alex.bennee@linaro.org>

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 8b6d495288..c2c5196b8b 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -417,6 +417,17 @@ build-user-static:
     CONFIGURE_ARGS: --disable-tools --disable-system --static
     MAKE_CHECK_ARGS: check-tcg
 
+# Because the hexagon cross-compiler takes so long to build we don't rely
+# on the CI system to build it and hence this job has no dependency
+# declared. The image is manually uploaded.
+build-user-hexagon:
+  <<: *native_build_job_definition
+  variables:
+    IMAGE: debian-hexagon-cross
+    TARGETS: hexagon-linux-user
+    CONFIGURE_ARGS: --disable-tools --disable-docs --enable-debug-tcg
+    MAKE_CHECK_ARGS: check-tcg
+
 # Only build the softmmu targets we have check-tcg tests for
 build-some-softmmu:
   <<: *native_build_job_definition
-- 
2.20.1



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

* [PULL 06/18] gitlab-ci.yml: Allow custom # of parallel linkers
  2021-03-08 13:50 [PULL 00/18] testing, docs, semihosting move and guest-loader Alex Bennée
                   ` (4 preceding siblings ...)
  2021-03-08 13:50 ` [PULL 05/18] gitlab: add build-user-hexagon test Alex Bennée
@ 2021-03-08 13:50 ` Alex Bennée
  2021-03-08 13:50 ` [PULL 07/18] gitlab-ci.yml: Add jobs to test CFI flags Alex Bennée
                   ` (13 subsequent siblings)
  19 siblings, 0 replies; 38+ messages in thread
From: Alex Bennée @ 2021-03-08 13:50 UTC (permalink / raw)
  To: peter.maydell
  Cc: Thomas Huth, Daniel P . Berrangé,
	Philippe Mathieu-Daudé,
	qemu-devel, Wainer dos Santos Moschetta, Alex Bennée,
	Daniele Buono

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

Define a new variable LD_JOBS, that can be used to select
the maximum number of linking jobs to be executed in parallel.
If the variable is not defined, maintain the default given by
make -j

Currently, make parallelism at build time is based on the number
of cpus available.

This doesn't work well with LTO at linking, because with LTO the
linker has to load in memory all the intermediate object files
for optimization.
The end result is that, if the gitlab runner happens to run two
linking processes at the same time, the job will fail with an
out-of-memory error,

This patch leverages the ability to maintain high parallelism at
compile time, but limit the number of linkers executed in parallel.

Signed-off-by: Daniele Buono <dbuono@linux.vnet.ibm.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Message-Id: <20210304030948.9367-2-dbuono@linux.vnet.ibm.com>
Message-Id: <20210305092328.31792-8-alex.bennee@linaro.org>

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index c2c5196b8b..1ea944eb91 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -27,6 +27,10 @@ include:
       else
         ../configure --enable-werror $CONFIGURE_ARGS ;
       fi || { cat config.log meson-logs/meson-log.txt && exit 1; }
+    - if test -n "$LD_JOBS";
+      then
+        meson configure . -Dbackend_max_links="$LD_JOBS" ;
+      fi || exit 1;
     - make -j"$JOBS"
     - if test -n "$MAKE_CHECK_ARGS";
       then
-- 
2.20.1



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

* [PULL 07/18] gitlab-ci.yml: Add jobs to test CFI flags
  2021-03-08 13:50 [PULL 00/18] testing, docs, semihosting move and guest-loader Alex Bennée
                   ` (5 preceding siblings ...)
  2021-03-08 13:50 ` [PULL 06/18] gitlab-ci.yml: Allow custom # of parallel linkers Alex Bennée
@ 2021-03-08 13:50 ` Alex Bennée
  2021-03-08 13:50 ` [PULL 08/18] tests/docker: Use --arch-only when building Debian cross image Alex Bennée
                   ` (12 subsequent siblings)
  19 siblings, 0 replies; 38+ messages in thread
From: Alex Bennée @ 2021-03-08 13:50 UTC (permalink / raw)
  To: peter.maydell
  Cc: Thomas Huth, Alex Bennée, qemu-devel,
	Wainer dos Santos Moschetta, Philippe Mathieu-Daudé,
	Philippe Mathieu-Daudé,
	Daniele Buono

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

QEMU has had options to enable control-flow integrity features
for a few months now. Add two sets of build/check/acceptance
jobs to ensure the binary produced is working fine.

The three sets allow testing of x86_64 binaries for x86_64, s390x,
ppc64 and aarch64 targets

[AJB: tweak job names to avoid brands]

Signed-off-by: Daniele Buono <dbuono@linux.vnet.ibm.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20210304030948.9367-3-dbuono@linux.vnet.ibm.com>
Message-Id: <20210305092328.31792-9-alex.bennee@linaro.org>

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 1ea944eb91..5625265ef8 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -494,6 +494,125 @@ clang-user:
       --extra-cflags=-fsanitize=undefined --extra-cflags=-fno-sanitize-recover=undefined
     MAKE_CHECK_ARGS: check-unit check-tcg
 
+# Set LD_JOBS=1 because this requires LTO and ld consumes a large amount of memory.
+# On gitlab runners, default value sometimes end up calling 2 lds concurrently and
+# triggers an Out-Of-Memory error
+#
+# Since slirp callbacks are used in QEMU Timers, slirp needs to be compiled together
+# with QEMU and linked as a static library to avoid false positives in CFI checks.
+# This can be accomplished by using -enable-slirp=git, which avoids the use of
+# a system-wide version of the library
+#
+# Split in three sets of build/check/acceptance to limit the execution time of each
+# job
+build-cfi-aarch64:
+  <<: *native_build_job_definition
+  needs:
+  - job: amd64-fedora-container
+  variables:
+    LD_JOBS: 1
+    AR: llvm-ar
+    IMAGE: fedora
+    CONFIGURE_ARGS: --cc=clang --cxx=clang++ --enable-cfi --enable-cfi-debug
+      --enable-safe-stack --enable-slirp=git
+    TARGETS: aarch64-softmmu
+    MAKE_CHECK_ARGS: check-build
+  artifacts:
+    expire_in: 2 days
+    paths:
+      - build
+
+check-cfi-aarch64:
+  <<: *native_test_job_definition
+  needs:
+    - job: build-cfi-aarch64
+      artifacts: true
+  variables:
+    IMAGE: fedora
+    MAKE_CHECK_ARGS: check
+
+acceptance-cfi-aarch64:
+  <<: *native_test_job_definition
+  needs:
+    - job: build-cfi-aarch64
+      artifacts: true
+  variables:
+    IMAGE: fedora
+    MAKE_CHECK_ARGS: check-acceptance
+  <<: *acceptance_definition
+
+build-cfi-ppc64-s390x:
+  <<: *native_build_job_definition
+  needs:
+  - job: amd64-fedora-container
+  variables:
+    LD_JOBS: 1
+    AR: llvm-ar
+    IMAGE: fedora
+    CONFIGURE_ARGS: --cc=clang --cxx=clang++ --enable-cfi --enable-cfi-debug
+      --enable-safe-stack --enable-slirp=git
+    TARGETS: ppc64-softmmu s390x-softmmu
+    MAKE_CHECK_ARGS: check-build
+  artifacts:
+    expire_in: 2 days
+    paths:
+      - build
+
+check-cfi-ppc64-s390x:
+  <<: *native_test_job_definition
+  needs:
+    - job: build-cfi-ppc64-s390x
+      artifacts: true
+  variables:
+    IMAGE: fedora
+    MAKE_CHECK_ARGS: check
+
+acceptance-cfi-ppc64-s390x:
+  <<: *native_test_job_definition
+  needs:
+    - job: build-cfi-ppc64-s390x
+      artifacts: true
+  variables:
+    IMAGE: fedora
+    MAKE_CHECK_ARGS: check-acceptance
+  <<: *acceptance_definition
+
+build-cfi-x86_64:
+  <<: *native_build_job_definition
+  needs:
+  - job: amd64-fedora-container
+  variables:
+    LD_JOBS: 1
+    AR: llvm-ar
+    IMAGE: fedora
+    CONFIGURE_ARGS: --cc=clang --cxx=clang++ --enable-cfi --enable-cfi-debug
+      --enable-safe-stack --enable-slirp=git
+    TARGETS: x86_64-softmmu
+    MAKE_CHECK_ARGS: check-build
+  artifacts:
+    expire_in: 2 days
+    paths:
+      - build
+
+check-cfi-x86_64:
+  <<: *native_test_job_definition
+  needs:
+    - job: build-cfi-x86_64
+      artifacts: true
+  variables:
+    IMAGE: fedora
+    MAKE_CHECK_ARGS: check
+
+acceptance-cfi-x86_64:
+  <<: *native_test_job_definition
+  needs:
+    - job: build-cfi-x86_64
+      artifacts: true
+  variables:
+    IMAGE: fedora
+    MAKE_CHECK_ARGS: check-acceptance
+  <<: *acceptance_definition
+
 tsan-build:
   <<: *native_build_job_definition
   variables:
-- 
2.20.1



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

* [PULL 08/18] tests/docker: Use --arch-only when building Debian cross image
  2021-03-08 13:50 [PULL 00/18] testing, docs, semihosting move and guest-loader Alex Bennée
                   ` (6 preceding siblings ...)
  2021-03-08 13:50 ` [PULL 07/18] gitlab-ci.yml: Add jobs to test CFI flags Alex Bennée
@ 2021-03-08 13:50 ` Alex Bennée
  2021-03-08 13:50 ` [PULL 09/18] .editorconfig: update the automatic mode setting for Emacs Alex Bennée
                   ` (11 subsequent siblings)
  19 siblings, 0 replies; 38+ messages in thread
From: Alex Bennée @ 2021-03-08 13:50 UTC (permalink / raw)
  To: peter.maydell
  Cc: Fam Zheng, Alex Bennée, qemu-devel, Christian Ehrhardt,
	Philippe Mathieu-Daudé, Philippe Mathieu-Daudé

From: Philippe Mathieu-Daudé <f4bug@amsat.org>

When building a Docker image based on debian10.docker on
a non-x86 host, we get:

 [2/4] RUN apt update &&     DEBIAN_FRONTEND=noninteractive eatmydata     apt build-dep -yy qemu
 Reading package lists... Done
 Building dependency tree
 Reading state information... Done
 Some packages could not be installed. This may mean that you have
 requested an impossible situation or if you are using the unstable
 distribution that some required packages have not yet been created
 or been moved out of Incoming.
 The following information may help to resolve the situation:

 The following packages have unmet dependencies:
  builddeps:qemu : Depends: gcc-s390x-linux-gnu but it is not installable
                   Depends: gcc-alpha-linux-gnu but it is not installable
 E: Unable to correct problems, you have held broken packages.

Fix by using the --arch-only option suggested here:
https://bugs.launchpad.net/ubuntu/+source/qemu/+bug/1866032/comments/1

Suggested-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20210223211115.2971565-1-f4bug@amsat.org>
Message-Id: <20210305092328.31792-10-alex.bennee@linaro.org>

diff --git a/tests/docker/dockerfiles/debian10.docker b/tests/docker/dockerfiles/debian10.docker
index 9d42b5a4b8..d034acbd25 100644
--- a/tests/docker/dockerfiles/debian10.docker
+++ b/tests/docker/dockerfiles/debian10.docker
@@ -32,6 +32,6 @@ RUN apt update && \
         psmisc \
         python3 \
         python3-sphinx \
-        $(apt-get -s build-dep qemu | egrep ^Inst | fgrep '[all]' | cut -d\  -f2)
+        $(apt-get -s build-dep --arch-only qemu | egrep ^Inst | fgrep '[all]' | cut -d\  -f2)
 
 ENV FEATURES docs
-- 
2.20.1



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

* [PULL 09/18] .editorconfig: update the automatic mode setting for Emacs
  2021-03-08 13:50 [PULL 00/18] testing, docs, semihosting move and guest-loader Alex Bennée
                   ` (7 preceding siblings ...)
  2021-03-08 13:50 ` [PULL 08/18] tests/docker: Use --arch-only when building Debian cross image Alex Bennée
@ 2021-03-08 13:50 ` Alex Bennée
  2021-03-08 13:50 ` [PULL 10/18] hw/board: promote fdt from ARM VirtMachineState to MachineState Alex Bennée
                   ` (10 subsequent siblings)
  19 siblings, 0 replies; 38+ messages in thread
From: Alex Bennée @ 2021-03-08 13:50 UTC (permalink / raw)
  To: peter.maydell; +Cc: Marc-André Lureau, Alex Bennée, qemu-devel

It seems the editor specific keywords have been deprecated in the main
editorconfig plugin:

  https://github.com/editorconfig/editorconfig-emacs#file-type-file_type_ext-file_type_emacs

Update the keywords to the suggested one and point users at the
extension.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20210305144839.6558-1-alex.bennee@linaro.org>

diff --git a/.editorconfig b/.editorconfig
index 22681d91c6..7303759ed7 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -4,6 +4,11 @@
 # plugin.
 #
 # Check https://editorconfig.org for details.
+#
+# Emacs: you need https://github.com/10sr/editorconfig-custom-majormode-el
+# to automatically enable the appropriate major-mode for your files
+# that aren't already caught by your existing config.
+#
 
 root = true
 
@@ -15,17 +20,17 @@ charset = utf-8
 [*.mak]
 indent_style = tab
 indent_size = 8
-file_type_emacs = makefile
+emacs_mode = makefile
 
 [Makefile*]
 indent_style = tab
 indent_size = 8
-file_type_emacs = makefile
+emacs_mode = makefile
 
 [*.{c,h,c.inc,h.inc}]
 indent_style = space
 indent_size = 4
-file_type_emacs = c
+emacs_mode = c
 
 [*.sh]
 indent_style = space
@@ -34,11 +39,11 @@ indent_size = 4
 [*.{s,S}]
 indent_style = tab
 indent_size = 8
-file_type_emacs = asm
+emacs_mode = asm
 
 [*.{vert,frag}]
-file_type_emacs = glsl
+emacs_mode = glsl
 
 [*.json]
 indent_style = space
-file_type_emacs = python
+emacs_mode = python
-- 
2.20.1



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

* [PULL 10/18] hw/board: promote fdt from ARM VirtMachineState to MachineState
  2021-03-08 13:50 [PULL 00/18] testing, docs, semihosting move and guest-loader Alex Bennée
                   ` (8 preceding siblings ...)
  2021-03-08 13:50 ` [PULL 09/18] .editorconfig: update the automatic mode setting for Emacs Alex Bennée
@ 2021-03-08 13:50 ` Alex Bennée
  2021-03-08 13:50   ` Alex Bennée
                   ` (9 subsequent siblings)
  19 siblings, 0 replies; 38+ messages in thread
From: Alex Bennée @ 2021-03-08 13:50 UTC (permalink / raw)
  To: peter.maydell
  Cc: Eduardo Habkost, Alex Bennée, qemu-devel, open list:Virt,
	Philippe Mathieu-Daudé

The use of FDT's is quite common across our various platforms. To
allow the guest loader to tweak it we need to make it available in
the generic state. This creates the field and migrates the initial
user to use the generic field. Other boards will be updated in later
patches.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20210303173642.3805-2-alex.bennee@linaro.org>

diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h
index ee9a93101e..921416f918 100644
--- a/include/hw/arm/virt.h
+++ b/include/hw/arm/virt.h
@@ -153,7 +153,6 @@ struct VirtMachineState {
     MemMapEntry *memmap;
     char *pciehb_nodename;
     const int *irqmap;
-    void *fdt;
     int fdt_size;
     uint32_t clock_phandle;
     uint32_t gic_phandle;
diff --git a/include/hw/boards.h b/include/hw/boards.h
index a46dfe5d1a..5fda5fd128 100644
--- a/include/hw/boards.h
+++ b/include/hw/boards.h
@@ -258,6 +258,7 @@ struct MachineState {
 
     /*< public >*/
 
+    void *fdt;
     char *dtb;
     char *dumpdtb;
     int phandle_start;
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index 371147f3ae..c08bf11297 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -218,14 +218,14 @@ static bool cpu_type_valid(const char *cpu)
     return false;
 }
 
-static void create_kaslr_seed(VirtMachineState *vms, const char *node)
+static void create_kaslr_seed(MachineState *ms, const char *node)
 {
     uint64_t seed;
 
     if (qemu_guest_getrandom(&seed, sizeof(seed), NULL)) {
         return;
     }
-    qemu_fdt_setprop_u64(vms->fdt, node, "kaslr-seed", seed);
+    qemu_fdt_setprop_u64(ms->fdt, node, "kaslr-seed", seed);
 }
 
 static void create_fdt(VirtMachineState *vms)
@@ -239,7 +239,7 @@ static void create_fdt(VirtMachineState *vms)
         exit(1);
     }
 
-    vms->fdt = fdt;
+    ms->fdt = fdt;
 
     /* Header */
     qemu_fdt_setprop_string(fdt, "/", "compatible", "linux,dummy-virt");
@@ -248,11 +248,11 @@ static void create_fdt(VirtMachineState *vms)
 
     /* /chosen must exist for load_dtb to fill in necessary properties later */
     qemu_fdt_add_subnode(fdt, "/chosen");
-    create_kaslr_seed(vms, "/chosen");
+    create_kaslr_seed(ms, "/chosen");
 
     if (vms->secure) {
         qemu_fdt_add_subnode(fdt, "/secure-chosen");
-        create_kaslr_seed(vms, "/secure-chosen");
+        create_kaslr_seed(ms, "/secure-chosen");
     }
 
     /* Clock node, for the benefit of the UART. The kernel device tree
@@ -316,6 +316,7 @@ static void fdt_add_timer_nodes(const VirtMachineState *vms)
     ARMCPU *armcpu;
     VirtMachineClass *vmc = VIRT_MACHINE_GET_CLASS(vms);
     uint32_t irqflags = GIC_FDT_IRQ_FLAGS_LEVEL_HI;
+    MachineState *ms = MACHINE(vms);
 
     if (vmc->claim_edge_triggered_timers) {
         irqflags = GIC_FDT_IRQ_FLAGS_EDGE_LO_HI;
@@ -327,19 +328,19 @@ static void fdt_add_timer_nodes(const VirtMachineState *vms)
                              (1 << MACHINE(vms)->smp.cpus) - 1);
     }
 
-    qemu_fdt_add_subnode(vms->fdt, "/timer");
+    qemu_fdt_add_subnode(ms->fdt, "/timer");
 
     armcpu = ARM_CPU(qemu_get_cpu(0));
     if (arm_feature(&armcpu->env, ARM_FEATURE_V8)) {
         const char compat[] = "arm,armv8-timer\0arm,armv7-timer";
-        qemu_fdt_setprop(vms->fdt, "/timer", "compatible",
+        qemu_fdt_setprop(ms->fdt, "/timer", "compatible",
                          compat, sizeof(compat));
     } else {
-        qemu_fdt_setprop_string(vms->fdt, "/timer", "compatible",
+        qemu_fdt_setprop_string(ms->fdt, "/timer", "compatible",
                                 "arm,armv7-timer");
     }
-    qemu_fdt_setprop(vms->fdt, "/timer", "always-on", NULL, 0);
-    qemu_fdt_setprop_cells(vms->fdt, "/timer", "interrupts",
+    qemu_fdt_setprop(ms->fdt, "/timer", "always-on", NULL, 0);
+    qemu_fdt_setprop_cells(ms->fdt, "/timer", "interrupts",
                        GIC_FDT_IRQ_TYPE_PPI, ARCH_TIMER_S_EL1_IRQ, irqflags,
                        GIC_FDT_IRQ_TYPE_PPI, ARCH_TIMER_NS_EL1_IRQ, irqflags,
                        GIC_FDT_IRQ_TYPE_PPI, ARCH_TIMER_VIRT_IRQ, irqflags,
@@ -375,35 +376,35 @@ static void fdt_add_cpu_nodes(const VirtMachineState *vms)
         }
     }
 
-    qemu_fdt_add_subnode(vms->fdt, "/cpus");
-    qemu_fdt_setprop_cell(vms->fdt, "/cpus", "#address-cells", addr_cells);
-    qemu_fdt_setprop_cell(vms->fdt, "/cpus", "#size-cells", 0x0);
+    qemu_fdt_add_subnode(ms->fdt, "/cpus");
+    qemu_fdt_setprop_cell(ms->fdt, "/cpus", "#address-cells", addr_cells);
+    qemu_fdt_setprop_cell(ms->fdt, "/cpus", "#size-cells", 0x0);
 
     for (cpu = smp_cpus - 1; cpu >= 0; cpu--) {
         char *nodename = g_strdup_printf("/cpus/cpu@%d", cpu);
         ARMCPU *armcpu = ARM_CPU(qemu_get_cpu(cpu));
         CPUState *cs = CPU(armcpu);
 
-        qemu_fdt_add_subnode(vms->fdt, nodename);
-        qemu_fdt_setprop_string(vms->fdt, nodename, "device_type", "cpu");
-        qemu_fdt_setprop_string(vms->fdt, nodename, "compatible",
+        qemu_fdt_add_subnode(ms->fdt, nodename);
+        qemu_fdt_setprop_string(ms->fdt, nodename, "device_type", "cpu");
+        qemu_fdt_setprop_string(ms->fdt, nodename, "compatible",
                                     armcpu->dtb_compatible);
 
         if (vms->psci_conduit != QEMU_PSCI_CONDUIT_DISABLED && smp_cpus > 1) {
-            qemu_fdt_setprop_string(vms->fdt, nodename,
+            qemu_fdt_setprop_string(ms->fdt, nodename,
                                         "enable-method", "psci");
         }
 
         if (addr_cells == 2) {
-            qemu_fdt_setprop_u64(vms->fdt, nodename, "reg",
+            qemu_fdt_setprop_u64(ms->fdt, nodename, "reg",
                                  armcpu->mp_affinity);
         } else {
-            qemu_fdt_setprop_cell(vms->fdt, nodename, "reg",
+            qemu_fdt_setprop_cell(ms->fdt, nodename, "reg",
                                   armcpu->mp_affinity);
         }
 
         if (ms->possible_cpus->cpus[cs->cpu_index].props.has_node_id) {
-            qemu_fdt_setprop_cell(vms->fdt, nodename, "numa-node-id",
+            qemu_fdt_setprop_cell(ms->fdt, nodename, "numa-node-id",
                 ms->possible_cpus->cpus[cs->cpu_index].props.node_id);
         }
 
@@ -414,71 +415,74 @@ static void fdt_add_cpu_nodes(const VirtMachineState *vms)
 static void fdt_add_its_gic_node(VirtMachineState *vms)
 {
     char *nodename;
+    MachineState *ms = MACHINE(vms);
 
-    vms->msi_phandle = qemu_fdt_alloc_phandle(vms->fdt);
+    vms->msi_phandle = qemu_fdt_alloc_phandle(ms->fdt);
     nodename = g_strdup_printf("/intc/its@%" PRIx64,
                                vms->memmap[VIRT_GIC_ITS].base);
-    qemu_fdt_add_subnode(vms->fdt, nodename);
-    qemu_fdt_setprop_string(vms->fdt, nodename, "compatible",
+    qemu_fdt_add_subnode(ms->fdt, nodename);
+    qemu_fdt_setprop_string(ms->fdt, nodename, "compatible",
                             "arm,gic-v3-its");
-    qemu_fdt_setprop(vms->fdt, nodename, "msi-controller", NULL, 0);
-    qemu_fdt_setprop_sized_cells(vms->fdt, nodename, "reg",
+    qemu_fdt_setprop(ms->fdt, nodename, "msi-controller", NULL, 0);
+    qemu_fdt_setprop_sized_cells(ms->fdt, nodename, "reg",
                                  2, vms->memmap[VIRT_GIC_ITS].base,
                                  2, vms->memmap[VIRT_GIC_ITS].size);
-    qemu_fdt_setprop_cell(vms->fdt, nodename, "phandle", vms->msi_phandle);
+    qemu_fdt_setprop_cell(ms->fdt, nodename, "phandle", vms->msi_phandle);
     g_free(nodename);
 }
 
 static void fdt_add_v2m_gic_node(VirtMachineState *vms)
 {
+    MachineState *ms = MACHINE(vms);
     char *nodename;
 
     nodename = g_strdup_printf("/intc/v2m@%" PRIx64,
                                vms->memmap[VIRT_GIC_V2M].base);
-    vms->msi_phandle = qemu_fdt_alloc_phandle(vms->fdt);
-    qemu_fdt_add_subnode(vms->fdt, nodename);
-    qemu_fdt_setprop_string(vms->fdt, nodename, "compatible",
+    vms->msi_phandle = qemu_fdt_alloc_phandle(ms->fdt);
+    qemu_fdt_add_subnode(ms->fdt, nodename);
+    qemu_fdt_setprop_string(ms->fdt, nodename, "compatible",
                             "arm,gic-v2m-frame");
-    qemu_fdt_setprop(vms->fdt, nodename, "msi-controller", NULL, 0);
-    qemu_fdt_setprop_sized_cells(vms->fdt, nodename, "reg",
+    qemu_fdt_setprop(ms->fdt, nodename, "msi-controller", NULL, 0);
+    qemu_fdt_setprop_sized_cells(ms->fdt, nodename, "reg",
                                  2, vms->memmap[VIRT_GIC_V2M].base,
                                  2, vms->memmap[VIRT_GIC_V2M].size);
-    qemu_fdt_setprop_cell(vms->fdt, nodename, "phandle", vms->msi_phandle);
+    qemu_fdt_setprop_cell(ms->fdt, nodename, "phandle", vms->msi_phandle);
     g_free(nodename);
 }
 
 static void fdt_add_gic_node(VirtMachineState *vms)
 {
+    MachineState *ms = MACHINE(vms);
     char *nodename;
 
-    vms->gic_phandle = qemu_fdt_alloc_phandle(vms->fdt);
-    qemu_fdt_setprop_cell(vms->fdt, "/", "interrupt-parent", vms->gic_phandle);
+    vms->gic_phandle = qemu_fdt_alloc_phandle(ms->fdt);
+    qemu_fdt_setprop_cell(ms->fdt, "/", "interrupt-parent", vms->gic_phandle);
 
     nodename = g_strdup_printf("/intc@%" PRIx64,
                                vms->memmap[VIRT_GIC_DIST].base);
-    qemu_fdt_add_subnode(vms->fdt, nodename);
-    qemu_fdt_setprop_cell(vms->fdt, nodename, "#interrupt-cells", 3);
-    qemu_fdt_setprop(vms->fdt, nodename, "interrupt-controller", NULL, 0);
-    qemu_fdt_setprop_cell(vms->fdt, nodename, "#address-cells", 0x2);
-    qemu_fdt_setprop_cell(vms->fdt, nodename, "#size-cells", 0x2);
-    qemu_fdt_setprop(vms->fdt, nodename, "ranges", NULL, 0);
+    qemu_fdt_add_subnode(ms->fdt, nodename);
+    qemu_fdt_setprop_cell(ms->fdt, nodename, "#interrupt-cells", 3);
+    qemu_fdt_setprop(ms->fdt, nodename, "interrupt-controller", NULL, 0);
+    qemu_fdt_setprop_cell(ms->fdt, nodename, "#address-cells", 0x2);
+    qemu_fdt_setprop_cell(ms->fdt, nodename, "#size-cells", 0x2);
+    qemu_fdt_setprop(ms->fdt, nodename, "ranges", NULL, 0);
     if (vms->gic_version == VIRT_GIC_VERSION_3) {
         int nb_redist_regions = virt_gicv3_redist_region_count(vms);
 
-        qemu_fdt_setprop_string(vms->fdt, nodename, "compatible",
+        qemu_fdt_setprop_string(ms->fdt, nodename, "compatible",
                                 "arm,gic-v3");
 
-        qemu_fdt_setprop_cell(vms->fdt, nodename,
+        qemu_fdt_setprop_cell(ms->fdt, nodename,
                               "#redistributor-regions", nb_redist_regions);
 
         if (nb_redist_regions == 1) {
-            qemu_fdt_setprop_sized_cells(vms->fdt, nodename, "reg",
+            qemu_fdt_setprop_sized_cells(ms->fdt, nodename, "reg",
                                          2, vms->memmap[VIRT_GIC_DIST].base,
                                          2, vms->memmap[VIRT_GIC_DIST].size,
                                          2, vms->memmap[VIRT_GIC_REDIST].base,
                                          2, vms->memmap[VIRT_GIC_REDIST].size);
         } else {
-            qemu_fdt_setprop_sized_cells(vms->fdt, nodename, "reg",
+            qemu_fdt_setprop_sized_cells(ms->fdt, nodename, "reg",
                                  2, vms->memmap[VIRT_GIC_DIST].base,
                                  2, vms->memmap[VIRT_GIC_DIST].size,
                                  2, vms->memmap[VIRT_GIC_REDIST].base,
@@ -488,22 +492,22 @@ static void fdt_add_gic_node(VirtMachineState *vms)
         }
 
         if (vms->virt) {
-            qemu_fdt_setprop_cells(vms->fdt, nodename, "interrupts",
+            qemu_fdt_setprop_cells(ms->fdt, nodename, "interrupts",
                                    GIC_FDT_IRQ_TYPE_PPI, ARCH_GIC_MAINT_IRQ,
                                    GIC_FDT_IRQ_FLAGS_LEVEL_HI);
         }
     } else {
         /* 'cortex-a15-gic' means 'GIC v2' */
-        qemu_fdt_setprop_string(vms->fdt, nodename, "compatible",
+        qemu_fdt_setprop_string(ms->fdt, nodename, "compatible",
                                 "arm,cortex-a15-gic");
         if (!vms->virt) {
-            qemu_fdt_setprop_sized_cells(vms->fdt, nodename, "reg",
+            qemu_fdt_setprop_sized_cells(ms->fdt, nodename, "reg",
                                          2, vms->memmap[VIRT_GIC_DIST].base,
                                          2, vms->memmap[VIRT_GIC_DIST].size,
                                          2, vms->memmap[VIRT_GIC_CPU].base,
                                          2, vms->memmap[VIRT_GIC_CPU].size);
         } else {
-            qemu_fdt_setprop_sized_cells(vms->fdt, nodename, "reg",
+            qemu_fdt_setprop_sized_cells(ms->fdt, nodename, "reg",
                                          2, vms->memmap[VIRT_GIC_DIST].base,
                                          2, vms->memmap[VIRT_GIC_DIST].size,
                                          2, vms->memmap[VIRT_GIC_CPU].base,
@@ -512,13 +516,13 @@ static void fdt_add_gic_node(VirtMachineState *vms)
                                          2, vms->memmap[VIRT_GIC_HYP].size,
                                          2, vms->memmap[VIRT_GIC_VCPU].base,
                                          2, vms->memmap[VIRT_GIC_VCPU].size);
-            qemu_fdt_setprop_cells(vms->fdt, nodename, "interrupts",
+            qemu_fdt_setprop_cells(ms->fdt, nodename, "interrupts",
                                    GIC_FDT_IRQ_TYPE_PPI, ARCH_GIC_MAINT_IRQ,
                                    GIC_FDT_IRQ_FLAGS_LEVEL_HI);
         }
     }
 
-    qemu_fdt_setprop_cell(vms->fdt, nodename, "phandle", vms->gic_phandle);
+    qemu_fdt_setprop_cell(ms->fdt, nodename, "phandle", vms->gic_phandle);
     g_free(nodename);
 }
 
@@ -526,6 +530,7 @@ static void fdt_add_pmu_nodes(const VirtMachineState *vms)
 {
     ARMCPU *armcpu = ARM_CPU(first_cpu);
     uint32_t irqflags = GIC_FDT_IRQ_FLAGS_LEVEL_HI;
+    MachineState *ms = MACHINE(vms);
 
     if (!arm_feature(&armcpu->env, ARM_FEATURE_PMU)) {
         assert(!object_property_get_bool(OBJECT(armcpu), "pmu", NULL));
@@ -538,12 +543,12 @@ static void fdt_add_pmu_nodes(const VirtMachineState *vms)
                              (1 << MACHINE(vms)->smp.cpus) - 1);
     }
 
-    qemu_fdt_add_subnode(vms->fdt, "/pmu");
+    qemu_fdt_add_subnode(ms->fdt, "/pmu");
     if (arm_feature(&armcpu->env, ARM_FEATURE_V8)) {
         const char compat[] = "arm,armv8-pmuv3";
-        qemu_fdt_setprop(vms->fdt, "/pmu", "compatible",
+        qemu_fdt_setprop(ms->fdt, "/pmu", "compatible",
                          compat, sizeof(compat));
-        qemu_fdt_setprop_cells(vms->fdt, "/pmu", "interrupts",
+        qemu_fdt_setprop_cells(ms->fdt, "/pmu", "interrupts",
                                GIC_FDT_IRQ_TYPE_PPI, VIRTUAL_PMU_IRQ, irqflags);
     }
 }
@@ -749,6 +754,7 @@ static void create_uart(const VirtMachineState *vms, int uart,
     const char clocknames[] = "uartclk\0apb_pclk";
     DeviceState *dev = qdev_new(TYPE_PL011);
     SysBusDevice *s = SYS_BUS_DEVICE(dev);
+    MachineState *ms = MACHINE(vms);
 
     qdev_prop_set_chr(dev, "chardev", chr);
     sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
@@ -757,28 +763,28 @@ static void create_uart(const VirtMachineState *vms, int uart,
     sysbus_connect_irq(s, 0, qdev_get_gpio_in(vms->gic, irq));
 
     nodename = g_strdup_printf("/pl011@%" PRIx64, base);
-    qemu_fdt_add_subnode(vms->fdt, nodename);
+    qemu_fdt_add_subnode(ms->fdt, nodename);
     /* Note that we can't use setprop_string because of the embedded NUL */
-    qemu_fdt_setprop(vms->fdt, nodename, "compatible",
+    qemu_fdt_setprop(ms->fdt, nodename, "compatible",
                          compat, sizeof(compat));
-    qemu_fdt_setprop_sized_cells(vms->fdt, nodename, "reg",
+    qemu_fdt_setprop_sized_cells(ms->fdt, nodename, "reg",
                                      2, base, 2, size);
-    qemu_fdt_setprop_cells(vms->fdt, nodename, "interrupts",
+    qemu_fdt_setprop_cells(ms->fdt, nodename, "interrupts",
                                GIC_FDT_IRQ_TYPE_SPI, irq,
                                GIC_FDT_IRQ_FLAGS_LEVEL_HI);
-    qemu_fdt_setprop_cells(vms->fdt, nodename, "clocks",
+    qemu_fdt_setprop_cells(ms->fdt, nodename, "clocks",
                                vms->clock_phandle, vms->clock_phandle);
-    qemu_fdt_setprop(vms->fdt, nodename, "clock-names",
+    qemu_fdt_setprop(ms->fdt, nodename, "clock-names",
                          clocknames, sizeof(clocknames));
 
     if (uart == VIRT_UART) {
-        qemu_fdt_setprop_string(vms->fdt, "/chosen", "stdout-path", nodename);
+        qemu_fdt_setprop_string(ms->fdt, "/chosen", "stdout-path", nodename);
     } else {
         /* Mark as not usable by the normal world */
-        qemu_fdt_setprop_string(vms->fdt, nodename, "status", "disabled");
-        qemu_fdt_setprop_string(vms->fdt, nodename, "secure-status", "okay");
+        qemu_fdt_setprop_string(ms->fdt, nodename, "status", "disabled");
+        qemu_fdt_setprop_string(ms->fdt, nodename, "secure-status", "okay");
 
-        qemu_fdt_setprop_string(vms->fdt, "/secure-chosen", "stdout-path",
+        qemu_fdt_setprop_string(ms->fdt, "/secure-chosen", "stdout-path",
                                 nodename);
     }
 
@@ -792,19 +798,20 @@ static void create_rtc(const VirtMachineState *vms)
     hwaddr size = vms->memmap[VIRT_RTC].size;
     int irq = vms->irqmap[VIRT_RTC];
     const char compat[] = "arm,pl031\0arm,primecell";
+    MachineState *ms = MACHINE(vms);
 
     sysbus_create_simple("pl031", base, qdev_get_gpio_in(vms->gic, irq));
 
     nodename = g_strdup_printf("/pl031@%" PRIx64, base);
-    qemu_fdt_add_subnode(vms->fdt, nodename);
-    qemu_fdt_setprop(vms->fdt, nodename, "compatible", compat, sizeof(compat));
-    qemu_fdt_setprop_sized_cells(vms->fdt, nodename, "reg",
+    qemu_fdt_add_subnode(ms->fdt, nodename);
+    qemu_fdt_setprop(ms->fdt, nodename, "compatible", compat, sizeof(compat));
+    qemu_fdt_setprop_sized_cells(ms->fdt, nodename, "reg",
                                  2, base, 2, size);
-    qemu_fdt_setprop_cells(vms->fdt, nodename, "interrupts",
+    qemu_fdt_setprop_cells(ms->fdt, nodename, "interrupts",
                            GIC_FDT_IRQ_TYPE_SPI, irq,
                            GIC_FDT_IRQ_FLAGS_LEVEL_HI);
-    qemu_fdt_setprop_cell(vms->fdt, nodename, "clocks", vms->clock_phandle);
-    qemu_fdt_setprop_string(vms->fdt, nodename, "clock-names", "apb_pclk");
+    qemu_fdt_setprop_cell(ms->fdt, nodename, "clocks", vms->clock_phandle);
+    qemu_fdt_setprop_string(ms->fdt, nodename, "clock-names", "apb_pclk");
     g_free(nodename);
 }
 
@@ -821,32 +828,30 @@ static void virt_powerdown_req(Notifier *n, void *opaque)
     }
 }
 
-static void create_gpio_keys(const VirtMachineState *vms,
-                             DeviceState *pl061_dev,
+static void create_gpio_keys(char *fdt, DeviceState *pl061_dev,
                              uint32_t phandle)
 {
     gpio_key_dev = sysbus_create_simple("gpio-key", -1,
                                         qdev_get_gpio_in(pl061_dev, 3));
 
-    qemu_fdt_add_subnode(vms->fdt, "/gpio-keys");
-    qemu_fdt_setprop_string(vms->fdt, "/gpio-keys", "compatible", "gpio-keys");
-    qemu_fdt_setprop_cell(vms->fdt, "/gpio-keys", "#size-cells", 0);
-    qemu_fdt_setprop_cell(vms->fdt, "/gpio-keys", "#address-cells", 1);
+    qemu_fdt_add_subnode(fdt, "/gpio-keys");
+    qemu_fdt_setprop_string(fdt, "/gpio-keys", "compatible", "gpio-keys");
+    qemu_fdt_setprop_cell(fdt, "/gpio-keys", "#size-cells", 0);
+    qemu_fdt_setprop_cell(fdt, "/gpio-keys", "#address-cells", 1);
 
-    qemu_fdt_add_subnode(vms->fdt, "/gpio-keys/poweroff");
-    qemu_fdt_setprop_string(vms->fdt, "/gpio-keys/poweroff",
+    qemu_fdt_add_subnode(fdt, "/gpio-keys/poweroff");
+    qemu_fdt_setprop_string(fdt, "/gpio-keys/poweroff",
                             "label", "GPIO Key Poweroff");
-    qemu_fdt_setprop_cell(vms->fdt, "/gpio-keys/poweroff", "linux,code",
+    qemu_fdt_setprop_cell(fdt, "/gpio-keys/poweroff", "linux,code",
                           KEY_POWER);
-    qemu_fdt_setprop_cells(vms->fdt, "/gpio-keys/poweroff",
+    qemu_fdt_setprop_cells(fdt, "/gpio-keys/poweroff",
                            "gpios", phandle, 3, 0);
 }
 
 #define SECURE_GPIO_POWEROFF 0
 #define SECURE_GPIO_RESET    1
 
-static void create_secure_gpio_pwr(const VirtMachineState *vms,
-                                   DeviceState *pl061_dev,
+static void create_secure_gpio_pwr(char *fdt, DeviceState *pl061_dev,
                                    uint32_t phandle)
 {
     DeviceState *gpio_pwr_dev;
@@ -860,22 +865,22 @@ static void create_secure_gpio_pwr(const VirtMachineState *vms,
     qdev_connect_gpio_out(pl061_dev, SECURE_GPIO_POWEROFF,
                           qdev_get_gpio_in_named(gpio_pwr_dev, "shutdown", 0));
 
-    qemu_fdt_add_subnode(vms->fdt, "/gpio-poweroff");
-    qemu_fdt_setprop_string(vms->fdt, "/gpio-poweroff", "compatible",
+    qemu_fdt_add_subnode(fdt, "/gpio-poweroff");
+    qemu_fdt_setprop_string(fdt, "/gpio-poweroff", "compatible",
                             "gpio-poweroff");
-    qemu_fdt_setprop_cells(vms->fdt, "/gpio-poweroff",
+    qemu_fdt_setprop_cells(fdt, "/gpio-poweroff",
                            "gpios", phandle, SECURE_GPIO_POWEROFF, 0);
-    qemu_fdt_setprop_string(vms->fdt, "/gpio-poweroff", "status", "disabled");
-    qemu_fdt_setprop_string(vms->fdt, "/gpio-poweroff", "secure-status",
+    qemu_fdt_setprop_string(fdt, "/gpio-poweroff", "status", "disabled");
+    qemu_fdt_setprop_string(fdt, "/gpio-poweroff", "secure-status",
                             "okay");
 
-    qemu_fdt_add_subnode(vms->fdt, "/gpio-restart");
-    qemu_fdt_setprop_string(vms->fdt, "/gpio-restart", "compatible",
+    qemu_fdt_add_subnode(fdt, "/gpio-restart");
+    qemu_fdt_setprop_string(fdt, "/gpio-restart", "compatible",
                             "gpio-restart");
-    qemu_fdt_setprop_cells(vms->fdt, "/gpio-restart",
+    qemu_fdt_setprop_cells(fdt, "/gpio-restart",
                            "gpios", phandle, SECURE_GPIO_RESET, 0);
-    qemu_fdt_setprop_string(vms->fdt, "/gpio-restart", "status", "disabled");
-    qemu_fdt_setprop_string(vms->fdt, "/gpio-restart", "secure-status",
+    qemu_fdt_setprop_string(fdt, "/gpio-restart", "status", "disabled");
+    qemu_fdt_setprop_string(fdt, "/gpio-restart", "secure-status",
                             "okay");
 }
 
@@ -889,6 +894,7 @@ static void create_gpio_devices(const VirtMachineState *vms, int gpio,
     int irq = vms->irqmap[gpio];
     const char compat[] = "arm,pl061\0arm,primecell";
     SysBusDevice *s;
+    MachineState *ms = MACHINE(vms);
 
     pl061_dev = qdev_new("pl061");
     s = SYS_BUS_DEVICE(pl061_dev);
@@ -896,33 +902,33 @@ static void create_gpio_devices(const VirtMachineState *vms, int gpio,
     memory_region_add_subregion(mem, base, sysbus_mmio_get_region(s, 0));
     sysbus_connect_irq(s, 0, qdev_get_gpio_in(vms->gic, irq));
 
-    uint32_t phandle = qemu_fdt_alloc_phandle(vms->fdt);
+    uint32_t phandle = qemu_fdt_alloc_phandle(ms->fdt);
     nodename = g_strdup_printf("/pl061@%" PRIx64, base);
-    qemu_fdt_add_subnode(vms->fdt, nodename);
-    qemu_fdt_setprop_sized_cells(vms->fdt, nodename, "reg",
+    qemu_fdt_add_subnode(ms->fdt, nodename);
+    qemu_fdt_setprop_sized_cells(ms->fdt, nodename, "reg",
                                  2, base, 2, size);
-    qemu_fdt_setprop(vms->fdt, nodename, "compatible", compat, sizeof(compat));
-    qemu_fdt_setprop_cell(vms->fdt, nodename, "#gpio-cells", 2);
-    qemu_fdt_setprop(vms->fdt, nodename, "gpio-controller", NULL, 0);
-    qemu_fdt_setprop_cells(vms->fdt, nodename, "interrupts",
+    qemu_fdt_setprop(ms->fdt, nodename, "compatible", compat, sizeof(compat));
+    qemu_fdt_setprop_cell(ms->fdt, nodename, "#gpio-cells", 2);
+    qemu_fdt_setprop(ms->fdt, nodename, "gpio-controller", NULL, 0);
+    qemu_fdt_setprop_cells(ms->fdt, nodename, "interrupts",
                            GIC_FDT_IRQ_TYPE_SPI, irq,
                            GIC_FDT_IRQ_FLAGS_LEVEL_HI);
-    qemu_fdt_setprop_cell(vms->fdt, nodename, "clocks", vms->clock_phandle);
-    qemu_fdt_setprop_string(vms->fdt, nodename, "clock-names", "apb_pclk");
-    qemu_fdt_setprop_cell(vms->fdt, nodename, "phandle", phandle);
+    qemu_fdt_setprop_cell(ms->fdt, nodename, "clocks", vms->clock_phandle);
+    qemu_fdt_setprop_string(ms->fdt, nodename, "clock-names", "apb_pclk");
+    qemu_fdt_setprop_cell(ms->fdt, nodename, "phandle", phandle);
 
     if (gpio != VIRT_GPIO) {
         /* Mark as not usable by the normal world */
-        qemu_fdt_setprop_string(vms->fdt, nodename, "status", "disabled");
-        qemu_fdt_setprop_string(vms->fdt, nodename, "secure-status", "okay");
+        qemu_fdt_setprop_string(ms->fdt, nodename, "status", "disabled");
+        qemu_fdt_setprop_string(ms->fdt, nodename, "secure-status", "okay");
     }
     g_free(nodename);
 
     /* Child gpio devices */
     if (gpio == VIRT_GPIO) {
-        create_gpio_keys(vms, pl061_dev, phandle);
+        create_gpio_keys(ms->fdt, pl061_dev, phandle);
     } else {
-        create_secure_gpio_pwr(vms, pl061_dev, phandle);
+        create_secure_gpio_pwr(ms->fdt, pl061_dev, phandle);
     }
 }
 
@@ -930,6 +936,7 @@ static void create_virtio_devices(const VirtMachineState *vms)
 {
     int i;
     hwaddr size = vms->memmap[VIRT_MMIO].size;
+    MachineState *ms = MACHINE(vms);
 
     /* We create the transports in forwards order. Since qbus_realize()
      * prepends (not appends) new child buses, the incrementing loop below will
@@ -979,15 +986,15 @@ static void create_virtio_devices(const VirtMachineState *vms)
         hwaddr base = vms->memmap[VIRT_MMIO].base + i * size;
 
         nodename = g_strdup_printf("/virtio_mmio@%" PRIx64, base);
-        qemu_fdt_add_subnode(vms->fdt, nodename);
-        qemu_fdt_setprop_string(vms->fdt, nodename,
+        qemu_fdt_add_subnode(ms->fdt, nodename);
+        qemu_fdt_setprop_string(ms->fdt, nodename,
                                 "compatible", "virtio,mmio");
-        qemu_fdt_setprop_sized_cells(vms->fdt, nodename, "reg",
+        qemu_fdt_setprop_sized_cells(ms->fdt, nodename, "reg",
                                      2, base, 2, size);
-        qemu_fdt_setprop_cells(vms->fdt, nodename, "interrupts",
+        qemu_fdt_setprop_cells(ms->fdt, nodename, "interrupts",
                                GIC_FDT_IRQ_TYPE_SPI, irq,
                                GIC_FDT_IRQ_FLAGS_EDGE_LO_HI);
-        qemu_fdt_setprop(vms->fdt, nodename, "dma-coherent", NULL, 0);
+        qemu_fdt_setprop(ms->fdt, nodename, "dma-coherent", NULL, 0);
         g_free(nodename);
     }
 }
@@ -1068,17 +1075,18 @@ static void virt_flash_fdt(VirtMachineState *vms,
 {
     hwaddr flashsize = vms->memmap[VIRT_FLASH].size / 2;
     hwaddr flashbase = vms->memmap[VIRT_FLASH].base;
+    MachineState *ms = MACHINE(vms);
     char *nodename;
 
     if (sysmem == secure_sysmem) {
         /* Report both flash devices as a single node in the DT */
         nodename = g_strdup_printf("/flash@%" PRIx64, flashbase);
-        qemu_fdt_add_subnode(vms->fdt, nodename);
-        qemu_fdt_setprop_string(vms->fdt, nodename, "compatible", "cfi-flash");
-        qemu_fdt_setprop_sized_cells(vms->fdt, nodename, "reg",
+        qemu_fdt_add_subnode(ms->fdt, nodename);
+        qemu_fdt_setprop_string(ms->fdt, nodename, "compatible", "cfi-flash");
+        qemu_fdt_setprop_sized_cells(ms->fdt, nodename, "reg",
                                      2, flashbase, 2, flashsize,
                                      2, flashbase + flashsize, 2, flashsize);
-        qemu_fdt_setprop_cell(vms->fdt, nodename, "bank-width", 4);
+        qemu_fdt_setprop_cell(ms->fdt, nodename, "bank-width", 4);
         g_free(nodename);
     } else {
         /*
@@ -1086,21 +1094,21 @@ static void virt_flash_fdt(VirtMachineState *vms,
          * only visible to the secure world.
          */
         nodename = g_strdup_printf("/secflash@%" PRIx64, flashbase);
-        qemu_fdt_add_subnode(vms->fdt, nodename);
-        qemu_fdt_setprop_string(vms->fdt, nodename, "compatible", "cfi-flash");
-        qemu_fdt_setprop_sized_cells(vms->fdt, nodename, "reg",
+        qemu_fdt_add_subnode(ms->fdt, nodename);
+        qemu_fdt_setprop_string(ms->fdt, nodename, "compatible", "cfi-flash");
+        qemu_fdt_setprop_sized_cells(ms->fdt, nodename, "reg",
                                      2, flashbase, 2, flashsize);
-        qemu_fdt_setprop_cell(vms->fdt, nodename, "bank-width", 4);
-        qemu_fdt_setprop_string(vms->fdt, nodename, "status", "disabled");
-        qemu_fdt_setprop_string(vms->fdt, nodename, "secure-status", "okay");
+        qemu_fdt_setprop_cell(ms->fdt, nodename, "bank-width", 4);
+        qemu_fdt_setprop_string(ms->fdt, nodename, "status", "disabled");
+        qemu_fdt_setprop_string(ms->fdt, nodename, "secure-status", "okay");
         g_free(nodename);
 
         nodename = g_strdup_printf("/flash@%" PRIx64, flashbase);
-        qemu_fdt_add_subnode(vms->fdt, nodename);
-        qemu_fdt_setprop_string(vms->fdt, nodename, "compatible", "cfi-flash");
-        qemu_fdt_setprop_sized_cells(vms->fdt, nodename, "reg",
+        qemu_fdt_add_subnode(ms->fdt, nodename);
+        qemu_fdt_setprop_string(ms->fdt, nodename, "compatible", "cfi-flash");
+        qemu_fdt_setprop_sized_cells(ms->fdt, nodename, "reg",
                                      2, flashbase + flashsize, 2, flashsize);
-        qemu_fdt_setprop_cell(vms->fdt, nodename, "bank-width", 4);
+        qemu_fdt_setprop_cell(ms->fdt, nodename, "bank-width", 4);
         g_free(nodename);
     }
 }
@@ -1167,17 +1175,17 @@ static FWCfgState *create_fw_cfg(const VirtMachineState *vms, AddressSpace *as)
     fw_cfg_add_i16(fw_cfg, FW_CFG_NB_CPUS, (uint16_t)ms->smp.cpus);
 
     nodename = g_strdup_printf("/fw-cfg@%" PRIx64, base);
-    qemu_fdt_add_subnode(vms->fdt, nodename);
-    qemu_fdt_setprop_string(vms->fdt, nodename,
+    qemu_fdt_add_subnode(ms->fdt, nodename);
+    qemu_fdt_setprop_string(ms->fdt, nodename,
                             "compatible", "qemu,fw-cfg-mmio");
-    qemu_fdt_setprop_sized_cells(vms->fdt, nodename, "reg",
+    qemu_fdt_setprop_sized_cells(ms->fdt, nodename, "reg",
                                  2, base, 2, size);
-    qemu_fdt_setprop(vms->fdt, nodename, "dma-coherent", NULL, 0);
+    qemu_fdt_setprop(ms->fdt, nodename, "dma-coherent", NULL, 0);
     g_free(nodename);
     return fw_cfg;
 }
 
-static void create_pcie_irq_map(const VirtMachineState *vms,
+static void create_pcie_irq_map(const MachineState *ms,
                                 uint32_t gic_phandle,
                                 int first_irq, const char *nodename)
 {
@@ -1205,10 +1213,10 @@ static void create_pcie_irq_map(const VirtMachineState *vms,
         }
     }
 
-    qemu_fdt_setprop(vms->fdt, nodename, "interrupt-map",
+    qemu_fdt_setprop(ms->fdt, nodename, "interrupt-map",
                      full_irq_map, sizeof(full_irq_map));
 
-    qemu_fdt_setprop_cells(vms->fdt, nodename, "interrupt-map-mask",
+    qemu_fdt_setprop_cells(ms->fdt, nodename, "interrupt-map-mask",
                            cpu_to_be16(PCI_DEVFN(3, 0)), /* Slot 3 */
                            0, 0,
                            0x7           /* PCI irq */);
@@ -1225,6 +1233,7 @@ static void create_smmu(const VirtMachineState *vms,
     hwaddr size = vms->memmap[VIRT_SMMU].size;
     const char irq_names[] = "eventq\0priq\0cmdq-sync\0gerror";
     DeviceState *dev;
+    MachineState *ms = MACHINE(vms);
 
     if (vms->iommu != VIRT_IOMMU_SMMUV3 || !vms->iommu_phandle) {
         return;
@@ -1242,26 +1251,26 @@ static void create_smmu(const VirtMachineState *vms,
     }
 
     node = g_strdup_printf("/smmuv3@%" PRIx64, base);
-    qemu_fdt_add_subnode(vms->fdt, node);
-    qemu_fdt_setprop(vms->fdt, node, "compatible", compat, sizeof(compat));
-    qemu_fdt_setprop_sized_cells(vms->fdt, node, "reg", 2, base, 2, size);
+    qemu_fdt_add_subnode(ms->fdt, node);
+    qemu_fdt_setprop(ms->fdt, node, "compatible", compat, sizeof(compat));
+    qemu_fdt_setprop_sized_cells(ms->fdt, node, "reg", 2, base, 2, size);
 
-    qemu_fdt_setprop_cells(vms->fdt, node, "interrupts",
+    qemu_fdt_setprop_cells(ms->fdt, node, "interrupts",
             GIC_FDT_IRQ_TYPE_SPI, irq    , GIC_FDT_IRQ_FLAGS_EDGE_LO_HI,
             GIC_FDT_IRQ_TYPE_SPI, irq + 1, GIC_FDT_IRQ_FLAGS_EDGE_LO_HI,
             GIC_FDT_IRQ_TYPE_SPI, irq + 2, GIC_FDT_IRQ_FLAGS_EDGE_LO_HI,
             GIC_FDT_IRQ_TYPE_SPI, irq + 3, GIC_FDT_IRQ_FLAGS_EDGE_LO_HI);
 
-    qemu_fdt_setprop(vms->fdt, node, "interrupt-names", irq_names,
+    qemu_fdt_setprop(ms->fdt, node, "interrupt-names", irq_names,
                      sizeof(irq_names));
 
-    qemu_fdt_setprop_cell(vms->fdt, node, "clocks", vms->clock_phandle);
-    qemu_fdt_setprop_string(vms->fdt, node, "clock-names", "apb_pclk");
-    qemu_fdt_setprop(vms->fdt, node, "dma-coherent", NULL, 0);
+    qemu_fdt_setprop_cell(ms->fdt, node, "clocks", vms->clock_phandle);
+    qemu_fdt_setprop_string(ms->fdt, node, "clock-names", "apb_pclk");
+    qemu_fdt_setprop(ms->fdt, node, "dma-coherent", NULL, 0);
 
-    qemu_fdt_setprop_cell(vms->fdt, node, "#iommu-cells", 1);
+    qemu_fdt_setprop_cell(ms->fdt, node, "#iommu-cells", 1);
 
-    qemu_fdt_setprop_cell(vms->fdt, node, "phandle", vms->iommu_phandle);
+    qemu_fdt_setprop_cell(ms->fdt, node, "phandle", vms->iommu_phandle);
     g_free(node);
 }
 
@@ -1269,22 +1278,23 @@ static void create_virtio_iommu_dt_bindings(VirtMachineState *vms)
 {
     const char compat[] = "virtio,pci-iommu";
     uint16_t bdf = vms->virtio_iommu_bdf;
+    MachineState *ms = MACHINE(vms);
     char *node;
 
-    vms->iommu_phandle = qemu_fdt_alloc_phandle(vms->fdt);
+    vms->iommu_phandle = qemu_fdt_alloc_phandle(ms->fdt);
 
     node = g_strdup_printf("%s/virtio_iommu@%d", vms->pciehb_nodename, bdf);
-    qemu_fdt_add_subnode(vms->fdt, node);
-    qemu_fdt_setprop(vms->fdt, node, "compatible", compat, sizeof(compat));
-    qemu_fdt_setprop_sized_cells(vms->fdt, node, "reg",
+    qemu_fdt_add_subnode(ms->fdt, node);
+    qemu_fdt_setprop(ms->fdt, node, "compatible", compat, sizeof(compat));
+    qemu_fdt_setprop_sized_cells(ms->fdt, node, "reg",
                                  1, bdf << 8, 1, 0, 1, 0,
                                  1, 0, 1, 0);
 
-    qemu_fdt_setprop_cell(vms->fdt, node, "#iommu-cells", 1);
-    qemu_fdt_setprop_cell(vms->fdt, node, "phandle", vms->iommu_phandle);
+    qemu_fdt_setprop_cell(ms->fdt, node, "#iommu-cells", 1);
+    qemu_fdt_setprop_cell(ms->fdt, node, "phandle", vms->iommu_phandle);
     g_free(node);
 
-    qemu_fdt_setprop_cells(vms->fdt, vms->pciehb_nodename, "iommu-map",
+    qemu_fdt_setprop_cells(ms->fdt, vms->pciehb_nodename, "iommu-map",
                            0x0, vms->iommu_phandle, 0x0, bdf,
                            bdf + 1, vms->iommu_phandle, bdf + 1, 0xffff - bdf);
 }
@@ -1309,6 +1319,7 @@ static void create_pcie(VirtMachineState *vms)
     char *nodename;
     int i, ecam_id;
     PCIHostState *pci;
+    MachineState *ms = MACHINE(vms);
 
     dev = qdev_new(TYPE_GPEX_HOST);
     sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
@@ -1369,27 +1380,27 @@ static void create_pcie(VirtMachineState *vms)
     }
 
     nodename = vms->pciehb_nodename = g_strdup_printf("/pcie@%" PRIx64, base);
-    qemu_fdt_add_subnode(vms->fdt, nodename);
-    qemu_fdt_setprop_string(vms->fdt, nodename,
+    qemu_fdt_add_subnode(ms->fdt, nodename);
+    qemu_fdt_setprop_string(ms->fdt, nodename,
                             "compatible", "pci-host-ecam-generic");
-    qemu_fdt_setprop_string(vms->fdt, nodename, "device_type", "pci");
-    qemu_fdt_setprop_cell(vms->fdt, nodename, "#address-cells", 3);
-    qemu_fdt_setprop_cell(vms->fdt, nodename, "#size-cells", 2);
-    qemu_fdt_setprop_cell(vms->fdt, nodename, "linux,pci-domain", 0);
-    qemu_fdt_setprop_cells(vms->fdt, nodename, "bus-range", 0,
+    qemu_fdt_setprop_string(ms->fdt, nodename, "device_type", "pci");
+    qemu_fdt_setprop_cell(ms->fdt, nodename, "#address-cells", 3);
+    qemu_fdt_setprop_cell(ms->fdt, nodename, "#size-cells", 2);
+    qemu_fdt_setprop_cell(ms->fdt, nodename, "linux,pci-domain", 0);
+    qemu_fdt_setprop_cells(ms->fdt, nodename, "bus-range", 0,
                            nr_pcie_buses - 1);
-    qemu_fdt_setprop(vms->fdt, nodename, "dma-coherent", NULL, 0);
+    qemu_fdt_setprop(ms->fdt, nodename, "dma-coherent", NULL, 0);
 
     if (vms->msi_phandle) {
-        qemu_fdt_setprop_cells(vms->fdt, nodename, "msi-parent",
+        qemu_fdt_setprop_cells(ms->fdt, nodename, "msi-parent",
                                vms->msi_phandle);
     }
 
-    qemu_fdt_setprop_sized_cells(vms->fdt, nodename, "reg",
+    qemu_fdt_setprop_sized_cells(ms->fdt, nodename, "reg",
                                  2, base_ecam, 2, size_ecam);
 
     if (vms->highmem) {
-        qemu_fdt_setprop_sized_cells(vms->fdt, nodename, "ranges",
+        qemu_fdt_setprop_sized_cells(ms->fdt, nodename, "ranges",
                                      1, FDT_PCI_RANGE_IOPORT, 2, 0,
                                      2, base_pio, 2, size_pio,
                                      1, FDT_PCI_RANGE_MMIO, 2, base_mmio,
@@ -1398,23 +1409,23 @@ static void create_pcie(VirtMachineState *vms)
                                      2, base_mmio_high,
                                      2, base_mmio_high, 2, size_mmio_high);
     } else {
-        qemu_fdt_setprop_sized_cells(vms->fdt, nodename, "ranges",
+        qemu_fdt_setprop_sized_cells(ms->fdt, nodename, "ranges",
                                      1, FDT_PCI_RANGE_IOPORT, 2, 0,
                                      2, base_pio, 2, size_pio,
                                      1, FDT_PCI_RANGE_MMIO, 2, base_mmio,
                                      2, base_mmio, 2, size_mmio);
     }
 
-    qemu_fdt_setprop_cell(vms->fdt, nodename, "#interrupt-cells", 1);
-    create_pcie_irq_map(vms, vms->gic_phandle, irq, nodename);
+    qemu_fdt_setprop_cell(ms->fdt, nodename, "#interrupt-cells", 1);
+    create_pcie_irq_map(ms, vms->gic_phandle, irq, nodename);
 
     if (vms->iommu) {
-        vms->iommu_phandle = qemu_fdt_alloc_phandle(vms->fdt);
+        vms->iommu_phandle = qemu_fdt_alloc_phandle(ms->fdt);
 
         switch (vms->iommu) {
         case VIRT_IOMMU_SMMUV3:
             create_smmu(vms, vms->bus);
-            qemu_fdt_setprop_cells(vms->fdt, nodename, "iommu-map",
+            qemu_fdt_setprop_cells(ms->fdt, nodename, "iommu-map",
                                    0x0, vms->iommu_phandle, 0x0, 0x10000);
             break;
         default:
@@ -1466,17 +1477,18 @@ static void create_secure_ram(VirtMachineState *vms,
     char *nodename;
     hwaddr base = vms->memmap[VIRT_SECURE_MEM].base;
     hwaddr size = vms->memmap[VIRT_SECURE_MEM].size;
+    MachineState *ms = MACHINE(vms);
 
     memory_region_init_ram(secram, NULL, "virt.secure-ram", size,
                            &error_fatal);
     memory_region_add_subregion(secure_sysmem, base, secram);
 
     nodename = g_strdup_printf("/secram@%" PRIx64, base);
-    qemu_fdt_add_subnode(vms->fdt, nodename);
-    qemu_fdt_setprop_string(vms->fdt, nodename, "device_type", "memory");
-    qemu_fdt_setprop_sized_cells(vms->fdt, nodename, "reg", 2, base, 2, size);
-    qemu_fdt_setprop_string(vms->fdt, nodename, "status", "disabled");
-    qemu_fdt_setprop_string(vms->fdt, nodename, "secure-status", "okay");
+    qemu_fdt_add_subnode(ms->fdt, nodename);
+    qemu_fdt_setprop_string(ms->fdt, nodename, "device_type", "memory");
+    qemu_fdt_setprop_sized_cells(ms->fdt, nodename, "reg", 2, base, 2, size);
+    qemu_fdt_setprop_string(ms->fdt, nodename, "status", "disabled");
+    qemu_fdt_setprop_string(ms->fdt, nodename, "secure-status", "okay");
 
     if (secure_tag_sysmem) {
         create_tag_ram(secure_tag_sysmem, base, size, "mach-virt.secure-tag");
@@ -1489,9 +1501,11 @@ static void *machvirt_dtb(const struct arm_boot_info *binfo, int *fdt_size)
 {
     const VirtMachineState *board = container_of(binfo, VirtMachineState,
                                                  bootinfo);
+    MachineState *ms = MACHINE(board);
+
 
     *fdt_size = board->fdt_size;
-    return board->fdt;
+    return ms->fdt;
 }
 
 static void virt_build_smbios(VirtMachineState *vms)
@@ -1539,7 +1553,7 @@ void virt_machine_done(Notifier *notifier, void *data)
      * while qemu takes charge of the qom stuff.
      */
     if (info->dtb_filename == NULL) {
-        platform_bus_add_all_fdt_nodes(vms->fdt, "/intc",
+        platform_bus_add_all_fdt_nodes(ms->fdt, "/intc",
                                        vms->memmap[VIRT_PLATFORM_BUS].base,
                                        vms->memmap[VIRT_PLATFORM_BUS].size,
                                        vms->irqmap[VIRT_PLATFORM_BUS]);
-- 
2.20.1



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

* [PULL 11/18] hw/riscv: migrate fdt field to generic MachineState
  2021-03-08 13:50 [PULL 00/18] testing, docs, semihosting move and guest-loader Alex Bennée
@ 2021-03-08 13:50   ` Alex Bennée
  2021-03-08 13:50 ` [PULL 02/18] tests/docker: add a test-tcg for building then running check-tcg Alex Bennée
                     ` (18 subsequent siblings)
  19 siblings, 0 replies; 38+ messages in thread
From: Alex Bennée @ 2021-03-08 13:50 UTC (permalink / raw)
  To: peter.maydell
  Cc: open list:RISC-V TCG CPUs, Sagar Karandikar,
	Philippe Mathieu-Daudé,
	qemu-devel, Alistair Francis, Bastian Koppelmann, Palmer Dabbelt,
	Alex Bennée

This is a mechanical change to make the fdt available through
MachineState.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20210303173642.3805-3-alex.bennee@linaro.org>

diff --git a/include/hw/riscv/virt.h b/include/hw/riscv/virt.h
index 84b7a3848f..632da52018 100644
--- a/include/hw/riscv/virt.h
+++ b/include/hw/riscv/virt.h
@@ -41,7 +41,6 @@ struct RISCVVirtState {
     DeviceState *plic[VIRT_SOCKETS_MAX];
     PFlashCFI01 *flash[2];
 
-    void *fdt;
     int fdt_size;
 };
 
diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c
index 4f0c2fbca0..0b39101a5e 100644
--- a/hw/riscv/virt.c
+++ b/hw/riscv/virt.c
@@ -195,14 +195,14 @@ static void create_fdt(RISCVVirtState *s, const MemMapEntry *memmap,
     hwaddr flashbase = virt_memmap[VIRT_FLASH].base;
 
     if (mc->dtb) {
-        fdt = s->fdt = load_device_tree(mc->dtb, &s->fdt_size);
+        fdt = mc->fdt = load_device_tree(mc->dtb, &s->fdt_size);
         if (!fdt) {
             error_report("load_device_tree() failed");
             exit(1);
         }
         goto update_bootargs;
     } else {
-        fdt = s->fdt = create_device_tree(&s->fdt_size);
+        fdt = mc->fdt = create_device_tree(&s->fdt_size);
         if (!fdt) {
             error_report("create_device_tree() failed");
             exit(1);
@@ -444,12 +444,12 @@ static void create_fdt(RISCVVirtState *s, const MemMapEntry *memmap,
     g_free(name);
 
     name = g_strdup_printf("/soc/flash@%" PRIx64, flashbase);
-    qemu_fdt_add_subnode(s->fdt, name);
-    qemu_fdt_setprop_string(s->fdt, name, "compatible", "cfi-flash");
-    qemu_fdt_setprop_sized_cells(s->fdt, name, "reg",
+    qemu_fdt_add_subnode(mc->fdt, name);
+    qemu_fdt_setprop_string(mc->fdt, name, "compatible", "cfi-flash");
+    qemu_fdt_setprop_sized_cells(mc->fdt, name, "reg",
                                  2, flashbase, 2, flashsize,
                                  2, flashbase + flashsize, 2, flashsize);
-    qemu_fdt_setprop_cell(s->fdt, name, "bank-width", 4);
+    qemu_fdt_setprop_cell(mc->fdt, name, "bank-width", 4);
     g_free(name);
 
 update_bootargs:
@@ -667,9 +667,9 @@ static void virt_machine_init(MachineState *machine)
             hwaddr end = riscv_load_initrd(machine->initrd_filename,
                                            machine->ram_size, kernel_entry,
                                            &start);
-            qemu_fdt_setprop_cell(s->fdt, "/chosen",
+            qemu_fdt_setprop_cell(machine->fdt, "/chosen",
                                   "linux,initrd-start", start);
-            qemu_fdt_setprop_cell(s->fdt, "/chosen", "linux,initrd-end",
+            qemu_fdt_setprop_cell(machine->fdt, "/chosen", "linux,initrd-end",
                                   end);
         }
     } else {
@@ -690,12 +690,12 @@ static void virt_machine_init(MachineState *machine)
 
     /* Compute the fdt load address in dram */
     fdt_load_addr = riscv_load_fdt(memmap[VIRT_DRAM].base,
-                                   machine->ram_size, s->fdt);
+                                   machine->ram_size, machine->fdt);
     /* load the reset vector */
     riscv_setup_rom_reset_vec(machine, &s->soc[0], start_addr,
                               virt_memmap[VIRT_MROM].base,
                               virt_memmap[VIRT_MROM].size, kernel_entry,
-                              fdt_load_addr, s->fdt);
+                              fdt_load_addr, machine->fdt);
 
     /* SiFive Test MMIO device */
     sifive_test_create(memmap[VIRT_TEST].base);
-- 
2.20.1



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

* [PULL 11/18] hw/riscv: migrate fdt field to generic MachineState
@ 2021-03-08 13:50   ` Alex Bennée
  0 siblings, 0 replies; 38+ messages in thread
From: Alex Bennée @ 2021-03-08 13:50 UTC (permalink / raw)
  To: peter.maydell
  Cc: qemu-devel, Alex Bennée, Alistair Francis,
	Philippe Mathieu-Daudé,
	Palmer Dabbelt, Alistair Francis, Sagar Karandikar,
	Bastian Koppelmann, open list:RISC-V TCG CPUs

This is a mechanical change to make the fdt available through
MachineState.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20210303173642.3805-3-alex.bennee@linaro.org>

diff --git a/include/hw/riscv/virt.h b/include/hw/riscv/virt.h
index 84b7a3848f..632da52018 100644
--- a/include/hw/riscv/virt.h
+++ b/include/hw/riscv/virt.h
@@ -41,7 +41,6 @@ struct RISCVVirtState {
     DeviceState *plic[VIRT_SOCKETS_MAX];
     PFlashCFI01 *flash[2];
 
-    void *fdt;
     int fdt_size;
 };
 
diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c
index 4f0c2fbca0..0b39101a5e 100644
--- a/hw/riscv/virt.c
+++ b/hw/riscv/virt.c
@@ -195,14 +195,14 @@ static void create_fdt(RISCVVirtState *s, const MemMapEntry *memmap,
     hwaddr flashbase = virt_memmap[VIRT_FLASH].base;
 
     if (mc->dtb) {
-        fdt = s->fdt = load_device_tree(mc->dtb, &s->fdt_size);
+        fdt = mc->fdt = load_device_tree(mc->dtb, &s->fdt_size);
         if (!fdt) {
             error_report("load_device_tree() failed");
             exit(1);
         }
         goto update_bootargs;
     } else {
-        fdt = s->fdt = create_device_tree(&s->fdt_size);
+        fdt = mc->fdt = create_device_tree(&s->fdt_size);
         if (!fdt) {
             error_report("create_device_tree() failed");
             exit(1);
@@ -444,12 +444,12 @@ static void create_fdt(RISCVVirtState *s, const MemMapEntry *memmap,
     g_free(name);
 
     name = g_strdup_printf("/soc/flash@%" PRIx64, flashbase);
-    qemu_fdt_add_subnode(s->fdt, name);
-    qemu_fdt_setprop_string(s->fdt, name, "compatible", "cfi-flash");
-    qemu_fdt_setprop_sized_cells(s->fdt, name, "reg",
+    qemu_fdt_add_subnode(mc->fdt, name);
+    qemu_fdt_setprop_string(mc->fdt, name, "compatible", "cfi-flash");
+    qemu_fdt_setprop_sized_cells(mc->fdt, name, "reg",
                                  2, flashbase, 2, flashsize,
                                  2, flashbase + flashsize, 2, flashsize);
-    qemu_fdt_setprop_cell(s->fdt, name, "bank-width", 4);
+    qemu_fdt_setprop_cell(mc->fdt, name, "bank-width", 4);
     g_free(name);
 
 update_bootargs:
@@ -667,9 +667,9 @@ static void virt_machine_init(MachineState *machine)
             hwaddr end = riscv_load_initrd(machine->initrd_filename,
                                            machine->ram_size, kernel_entry,
                                            &start);
-            qemu_fdt_setprop_cell(s->fdt, "/chosen",
+            qemu_fdt_setprop_cell(machine->fdt, "/chosen",
                                   "linux,initrd-start", start);
-            qemu_fdt_setprop_cell(s->fdt, "/chosen", "linux,initrd-end",
+            qemu_fdt_setprop_cell(machine->fdt, "/chosen", "linux,initrd-end",
                                   end);
         }
     } else {
@@ -690,12 +690,12 @@ static void virt_machine_init(MachineState *machine)
 
     /* Compute the fdt load address in dram */
     fdt_load_addr = riscv_load_fdt(memmap[VIRT_DRAM].base,
-                                   machine->ram_size, s->fdt);
+                                   machine->ram_size, machine->fdt);
     /* load the reset vector */
     riscv_setup_rom_reset_vec(machine, &s->soc[0], start_addr,
                               virt_memmap[VIRT_MROM].base,
                               virt_memmap[VIRT_MROM].size, kernel_entry,
-                              fdt_load_addr, s->fdt);
+                              fdt_load_addr, machine->fdt);
 
     /* SiFive Test MMIO device */
     sifive_test_create(memmap[VIRT_TEST].base);
-- 
2.20.1



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

* [PULL 12/18] device_tree: add qemu_fdt_setprop_string_array helper
  2021-03-08 13:50 [PULL 00/18] testing, docs, semihosting move and guest-loader Alex Bennée
                   ` (10 preceding siblings ...)
  2021-03-08 13:50   ` Alex Bennée
@ 2021-03-08 13:50 ` Alex Bennée
  2021-03-08 13:50 ` [PULL 13/18] hw/core: implement a guest-loader to support static hypervisor guests Alex Bennée
                   ` (7 subsequent siblings)
  19 siblings, 0 replies; 38+ messages in thread
From: Alex Bennée @ 2021-03-08 13:50 UTC (permalink / raw)
  To: peter.maydell
  Cc: Alistair Francis, Alex Bennée, qemu-devel, David Gibson

A string array in device tree is simply a series of \0 terminated
strings next to each other. As libfdt doesn't support that directly
we need to build it ourselves.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-Id: <20210303173642.3805-4-alex.bennee@linaro.org>

diff --git a/include/sysemu/device_tree.h b/include/sysemu/device_tree.h
index 982c89345f..8a2fe55622 100644
--- a/include/sysemu/device_tree.h
+++ b/include/sysemu/device_tree.h
@@ -70,6 +70,23 @@ int qemu_fdt_setprop_u64(void *fdt, const char *node_path,
                          const char *property, uint64_t val);
 int qemu_fdt_setprop_string(void *fdt, const char *node_path,
                             const char *property, const char *string);
+
+/**
+ * qemu_fdt_setprop_string_array: set a string array property
+ *
+ * @fdt: pointer to the dt blob
+ * @name: node name
+ * @prop: property array
+ * @array: pointer to an array of string pointers
+ * @len: length of array
+ *
+ * assigns a string array to a property. This function converts and
+ * array of strings to a sequential string with \0 separators before
+ * setting the property.
+ */
+int qemu_fdt_setprop_string_array(void *fdt, const char *node_path,
+                                  const char *prop, char **array, int len);
+
 int qemu_fdt_setprop_phandle(void *fdt, const char *node_path,
                              const char *property,
                              const char *target_node_path);
diff --git a/softmmu/device_tree.c b/softmmu/device_tree.c
index b9a3ddc518..2691c58cf6 100644
--- a/softmmu/device_tree.c
+++ b/softmmu/device_tree.c
@@ -21,6 +21,7 @@
 #include "qemu/error-report.h"
 #include "qemu/option.h"
 #include "qemu/bswap.h"
+#include "qemu/cutils.h"
 #include "sysemu/device_tree.h"
 #include "sysemu/sysemu.h"
 #include "hw/loader.h"
@@ -397,6 +398,31 @@ int qemu_fdt_setprop_string(void *fdt, const char *node_path,
     return r;
 }
 
+/*
+ * libfdt doesn't allow us to add string arrays directly but they are
+ * test a series of null terminated strings with a length. We build
+ * the string up here so we can calculate the final length.
+ */
+int qemu_fdt_setprop_string_array(void *fdt, const char *node_path,
+                                  const char *prop, char **array, int len)
+{
+    int ret, i, total_len = 0;
+    char *str, *p;
+    for (i = 0; i < len; i++) {
+        total_len += strlen(array[i]) + 1;
+    }
+    p = str = g_malloc0(total_len);
+    for (i = 0; i < len; i++) {
+        int len = strlen(array[i]) + 1;
+        pstrcpy(p, len, array[i]);
+        p += len;
+    }
+
+    ret = qemu_fdt_setprop(fdt, node_path, prop, str, total_len);
+    g_free(str);
+    return ret;
+}
+
 const void *qemu_fdt_getprop(void *fdt, const char *node_path,
                              const char *property, int *lenp, Error **errp)
 {
-- 
2.20.1



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

* [PULL 13/18] hw/core: implement a guest-loader to support static hypervisor guests
  2021-03-08 13:50 [PULL 00/18] testing, docs, semihosting move and guest-loader Alex Bennée
                   ` (11 preceding siblings ...)
  2021-03-08 13:50 ` [PULL 12/18] device_tree: add qemu_fdt_setprop_string_array helper Alex Bennée
@ 2021-03-08 13:50 ` Alex Bennée
  2021-03-15 16:16   ` Christian Borntraeger
  2021-03-08 13:51 ` [PULL 14/18] docs: move generic-loader documentation into the main manual Alex Bennée
                   ` (6 subsequent siblings)
  19 siblings, 1 reply; 38+ messages in thread
From: Alex Bennée @ 2021-03-08 13:50 UTC (permalink / raw)
  To: peter.maydell
  Cc: Alistair Francis, Alex Bennée, qemu-devel,
	Philippe Mathieu-Daudé

Hypervisors, especially type-1 ones, need the firmware/bootcode to put
their initial guest somewhere in memory and pass the information to it
via platform data. The guest-loader is modelled after the generic
loader for exactly this sort of purpose:

  $QEMU $ARGS  -kernel ~/xen.git/xen/xen \
    -append "dom0_mem=1G,max:1G loglvl=all guest_loglvl=all" \
    -device guest-loader,addr=0x42000000,kernel=Image,bootargs="root=/dev/sda2 ro console=hvc0 earlyprintk=xen" \
    -device guest-loader,addr=0x47000000,initrd=rootfs.cpio

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20210303173642.3805-5-alex.bennee@linaro.org>

diff --git a/hw/core/guest-loader.h b/hw/core/guest-loader.h
new file mode 100644
index 0000000000..07f4b4884b
--- /dev/null
+++ b/hw/core/guest-loader.h
@@ -0,0 +1,34 @@
+/*
+ * Guest Loader
+ *
+ * Copyright (C) 2020 Linaro
+ * Written by Alex Bennée <alex.bennee@linaro.org>
+ * (based on the generic-loader by Li Guang <lig.fnst@cn.fujitsu.com>)
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#ifndef GUEST_LOADER_H
+#define GUEST_LOADER_H
+
+#include "hw/qdev-core.h"
+#include "qom/object.h"
+
+struct GuestLoaderState {
+    /* <private> */
+    DeviceState parent_obj;
+
+    /* <public> */
+    uint64_t addr;
+    char *kernel;
+    char *args;
+    char *initrd;
+};
+
+#define TYPE_GUEST_LOADER "guest-loader"
+OBJECT_DECLARE_SIMPLE_TYPE(GuestLoaderState, GUEST_LOADER)
+
+#endif
diff --git a/hw/core/guest-loader.c b/hw/core/guest-loader.c
new file mode 100644
index 0000000000..bde44e27b4
--- /dev/null
+++ b/hw/core/guest-loader.c
@@ -0,0 +1,145 @@
+/*
+ * Guest Loader
+ *
+ * Copyright (C) 2020 Linaro
+ * Written by Alex Bennée <alex.bennee@linaro.org>
+ * (based on the generic-loader by Li Guang <lig.fnst@cn.fujitsu.com>)
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+/*
+ * Much like the generic-loader this is treated as a special device
+ * inside QEMU. However unlike the generic-loader this device is used
+ * to load guest images for hypervisors. As part of that process the
+ * hypervisor needs to have platform information passed to it by the
+ * lower levels of the stack (e.g. firmware/bootloader). If you boot
+ * the hypervisor directly you use the guest-loader to load the Dom0
+ * or equivalent guest images in the right place in the same way a
+ * boot loader would.
+ *
+ * This is only relevant for full system emulation.
+ */
+
+#include "qemu/osdep.h"
+#include "hw/core/cpu.h"
+#include "hw/sysbus.h"
+#include "sysemu/dma.h"
+#include "hw/loader.h"
+#include "hw/qdev-properties.h"
+#include "qapi/error.h"
+#include "qemu/module.h"
+#include "guest-loader.h"
+#include "sysemu/device_tree.h"
+#include "hw/boards.h"
+
+/*
+ * Insert some FDT nodes for the loaded blob.
+ */
+static void loader_insert_platform_data(GuestLoaderState *s, int size,
+                                        Error **errp)
+{
+    MachineState *machine = MACHINE(qdev_get_machine());
+    void *fdt = machine->fdt;
+    g_autofree char *node = g_strdup_printf("/chosen/module@0x%08" PRIx64,
+                                            s->addr);
+    uint64_t reg_attr[2] = {cpu_to_be64(s->addr), cpu_to_be64(size)};
+
+    if (!fdt) {
+        error_setg(errp, "Cannot modify FDT fields if the machine has none");
+        return;
+    }
+
+    qemu_fdt_add_subnode(fdt, node);
+    qemu_fdt_setprop(fdt, node, "reg", &reg_attr, sizeof(reg_attr));
+
+    if (s->kernel) {
+        const char *compat[2] = { "multiboot,module", "multiboot,kernel" };
+        if (qemu_fdt_setprop_string_array(fdt, node, "compatible",
+                                          (char **) &compat,
+                                          ARRAY_SIZE(compat)) < 0) {
+            error_setg(errp, "couldn't set %s/compatible", node);
+            return;
+        }
+        if (s->args) {
+            if (qemu_fdt_setprop_string(fdt, node, "bootargs", s->args) < 0) {
+                error_setg(errp, "couldn't set %s/bootargs", node);
+            }
+        }
+    } else if (s->initrd) {
+        const char *compat[2] = { "multiboot,module", "multiboot,ramdisk" };
+        if (qemu_fdt_setprop_string_array(fdt, node, "compatible",
+                                          (char **) &compat,
+                                          ARRAY_SIZE(compat)) < 0) {
+            error_setg(errp, "couldn't set %s/compatible", node);
+            return;
+        }
+    }
+}
+
+static void guest_loader_realize(DeviceState *dev, Error **errp)
+{
+    GuestLoaderState *s = GUEST_LOADER(dev);
+    char *file = s->kernel ? s->kernel : s->initrd;
+    int size = 0;
+
+    /* Perform some error checking on the user's options */
+    if (s->kernel && s->initrd) {
+        error_setg(errp, "Cannot specify a kernel and initrd in same stanza");
+        return;
+    } else if (!s->kernel && !s->initrd)  {
+        error_setg(errp, "Need to specify a kernel or initrd image");
+        return;
+    } else if (!s->addr) {
+        error_setg(errp, "Need to specify the address of guest blob");
+        return;
+    } else if (s->args && !s->kernel) {
+        error_setg(errp, "Boot args only relevant to kernel blobs");
+    }
+
+    /* Default to the maximum size being the machine's ram size */
+    size = load_image_targphys_as(file, s->addr, current_machine->ram_size,
+                                  NULL);
+    if (size < 0) {
+        error_setg(errp, "Cannot load specified image %s", file);
+        return;
+    }
+
+    /* Now the image is loaded we need to update the platform data */
+    loader_insert_platform_data(s, size, errp);
+}
+
+static Property guest_loader_props[] = {
+    DEFINE_PROP_UINT64("addr", GuestLoaderState, addr, 0),
+    DEFINE_PROP_STRING("kernel", GuestLoaderState, kernel),
+    DEFINE_PROP_STRING("bootargs", GuestLoaderState, args),
+    DEFINE_PROP_STRING("initrd", GuestLoaderState, initrd),
+    DEFINE_PROP_END_OF_LIST(),
+};
+
+static void guest_loader_class_init(ObjectClass *klass, void *data)
+{
+    DeviceClass *dc = DEVICE_CLASS(klass);
+
+    dc->realize = guest_loader_realize;
+    device_class_set_props(dc, guest_loader_props);
+    dc->desc = "Guest Loader";
+    set_bit(DEVICE_CATEGORY_MISC, dc->categories);
+}
+
+static TypeInfo guest_loader_info = {
+    .name = TYPE_GUEST_LOADER,
+    .parent = TYPE_DEVICE,
+    .instance_size = sizeof(GuestLoaderState),
+    .class_init = guest_loader_class_init,
+};
+
+static void guest_loader_register_type(void)
+{
+    type_register_static(&guest_loader_info);
+}
+
+type_init(guest_loader_register_type)
diff --git a/MAINTAINERS b/MAINTAINERS
index ab3118429b..0134cad491 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2018,6 +2018,11 @@ F: hw/core/generic-loader.c
 F: include/hw/core/generic-loader.h
 F: docs/generic-loader.txt
 
+Guest Loader
+M: Alex Bennée <alex.bennee@linaro.org>
+S: Maintained
+F: hw/core/guest-loader.c
+
 Intel Hexadecimal Object File Loader
 M: Su Hang <suhang16@mails.ucas.ac.cn>
 S: Maintained
diff --git a/hw/core/meson.build b/hw/core/meson.build
index 032576f571..9cd72edf51 100644
--- a/hw/core/meson.build
+++ b/hw/core/meson.build
@@ -37,6 +37,8 @@ softmmu_ss.add(files(
   'clock-vmstate.c',
 ))
 
+softmmu_ss.add(when: 'CONFIG_TCG', if_true: files('guest-loader.c'))
+
 specific_ss.add(when: 'CONFIG_SOFTMMU', if_true: files(
   'machine-qmp-cmds.c',
   'numa.c',
-- 
2.20.1



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

* [PULL 14/18] docs: move generic-loader documentation into the main manual
  2021-03-08 13:50 [PULL 00/18] testing, docs, semihosting move and guest-loader Alex Bennée
                   ` (12 preceding siblings ...)
  2021-03-08 13:50 ` [PULL 13/18] hw/core: implement a guest-loader to support static hypervisor guests Alex Bennée
@ 2021-03-08 13:51 ` Alex Bennée
  2021-03-08 13:51 ` [PULL 15/18] docs: add some documentation for the guest-loader Alex Bennée
                   ` (5 subsequent siblings)
  19 siblings, 0 replies; 38+ messages in thread
From: Alex Bennée @ 2021-03-08 13:51 UTC (permalink / raw)
  To: peter.maydell
  Cc: Alistair Francis, Alistair Francis, Alex Bennée, qemu-devel

We might as well surface this useful information in the manual so
users can find it easily. It is a fairly simple conversion to rst with
the only textual fixes being QemuOps to QemuOpts.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-Id: <20210303173642.3805-6-alex.bennee@linaro.org>

diff --git a/docs/generic-loader.txt b/docs/generic-loader.txt
deleted file mode 100644
index a9603a2af7..0000000000
--- a/docs/generic-loader.txt
+++ /dev/null
@@ -1,92 +0,0 @@
-Copyright (c) 2016 Xilinx Inc.
-
-This work is licensed under the terms of the GNU GPL, version 2 or later.  See
-the COPYING file in the top-level directory.
-
-
-The 'loader' device allows the user to load multiple images or values into
-QEMU at startup.
-
-Loading Data into Memory Values
--------------------------------
-The loader device allows memory values to be set from the command line. This
-can be done by following the syntax below:
-
-     -device loader,addr=<addr>,data=<data>,data-len=<data-len>
-                   [,data-be=<data-be>][,cpu-num=<cpu-num>]
-
-    <addr>      - The address to store the data in.
-    <data>      - The value to be written to the address. The maximum size of
-                  the data is 8 bytes.
-    <data-len>  - The length of the data in bytes. This argument must be
-                  included if the data argument is.
-    <data-be>   - Set to true if the data to be stored on the guest should be
-                  written as big endian data. The default is to write little
-                  endian data.
-    <cpu-num>   - The number of the CPU's address space where the data should
-                  be loaded. If not specified the address space of the first
-                  CPU is used.
-
-All values are parsed using the standard QemuOps parsing. This allows the user
-to specify any values in any format supported. By default the values
-will be parsed as decimal. To use hex values the user should prefix the number
-with a '0x'.
-
-An example of loading value 0x8000000e to address 0xfd1a0104 is:
-    -device loader,addr=0xfd1a0104,data=0x8000000e,data-len=4
-
-Setting a CPU's Program Counter
--------------------------------
-The loader device allows the CPU's PC to be set from the command line. This
-can be done by following the syntax below:
-
-     -device loader,addr=<addr>,cpu-num=<cpu-num>
-
-    <addr>      - The value to use as the CPU's PC.
-    <cpu-num>   - The number of the CPU whose PC should be set to the
-                  specified value.
-
-All values are parsed using the standard QemuOps parsing. This allows the user
-to specify any values in any format supported. By default the values
-will be parsed as decimal. To use hex values the user should prefix the number
-with a '0x'.
-
-An example of setting CPU 0's PC to 0x8000 is:
-    -device loader,addr=0x8000,cpu-num=0
-
-Loading Files
--------------
-The loader device also allows files to be loaded into memory. It can load ELF,
-U-Boot, and Intel HEX executable formats as well as raw images.  The syntax is
-shown below:
-
-    -device loader,file=<file>[,addr=<addr>][,cpu-num=<cpu-num>][,force-raw=<raw>]
-
-    <file>      - A file to be loaded into memory
-    <addr>      - The memory address where the file should be loaded. This is
-                  required for raw images and ignored for non-raw files.
-    <cpu-num>   - This specifies the CPU that should be used. This is an
-                  optional argument and will cause the CPU's PC to be set to
-                  the memory address where the raw file is loaded or the entry
-                  point specified in the executable format header. This option
-                  should only be used for the boot image.
-                  This will also cause the image to be written to the specified
-                  CPU's address space. If not specified, the default is CPU 0.
-    <force-raw> - Setting force-raw=on forces the file to be treated as a raw
-                  image.  This can be used to load supported executable formats
-                  as if they were raw.
-
-All values are parsed using the standard QemuOps parsing. This allows the user
-to specify any values in any format supported. By default the values
-will be parsed as decimal. To use hex values the user should prefix the number
-with a '0x'.
-
-An example of loading an ELF file which CPU0 will boot is shown below:
-    -device loader,file=./images/boot.elf,cpu-num=0
-
-Restrictions and ToDos
-----------------------
- - At the moment it is just assumed that if you specify a cpu-num then you
-   want to set the PC as well. This might not always be the case. In future
-   the internal state 'set_pc' (which exists in the generic loader now) should
-   be exposed to the user so that they can choose if the PC is set or not.
diff --git a/docs/system/generic-loader.rst b/docs/system/generic-loader.rst
new file mode 100644
index 0000000000..6bf8a4eb48
--- /dev/null
+++ b/docs/system/generic-loader.rst
@@ -0,0 +1,117 @@
+..
+   Copyright (c) 2016, Xilinx Inc.
+
+This work is licensed under the terms of the GNU GPL, version 2 or later.  See
+the COPYING file in the top-level directory.
+
+Generic Loader
+--------------
+
+The 'loader' device allows the user to load multiple images or values into
+QEMU at startup.
+
+Loading Data into Memory Values
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+The loader device allows memory values to be set from the command line. This
+can be done by following the syntax below::
+
+   -device loader,addr=<addr>,data=<data>,data-len=<data-len> \
+                   [,data-be=<data-be>][,cpu-num=<cpu-num>]
+
+``<addr>``
+  The address to store the data in.
+
+``<data>``
+  The value to be written to the address. The maximum size of the data
+  is 8 bytes.
+
+``<data-len>``
+  The length of the data in bytes. This argument must be included if
+  the data argument is.
+
+``<data-be>``
+  Set to true if the data to be stored on the guest should be written
+  as big endian data. The default is to write little endian data.
+
+``<cpu-num>``
+  The number of the CPU's address space where the data should be
+  loaded. If not specified the address space of the first CPU is used.
+
+All values are parsed using the standard QemuOps parsing. This allows the user
+to specify any values in any format supported. By default the values
+will be parsed as decimal. To use hex values the user should prefix the number
+with a '0x'.
+
+An example of loading value 0x8000000e to address 0xfd1a0104 is::
+
+    -device loader,addr=0xfd1a0104,data=0x8000000e,data-len=4
+
+Setting a CPU's Program Counter
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+The loader device allows the CPU's PC to be set from the command line. This
+can be done by following the syntax below::
+
+     -device loader,addr=<addr>,cpu-num=<cpu-num>
+
+``<addr>``
+  The value to use as the CPU's PC.
+
+``<cpu-num>``
+  The number of the CPU whose PC should be set to the specified value.
+
+All values are parsed using the standard QemuOpts parsing. This allows the user
+to specify any values in any format supported. By default the values
+will be parsed as decimal. To use hex values the user should prefix the number
+with a '0x'.
+
+An example of setting CPU 0's PC to 0x8000 is::
+
+    -device loader,addr=0x8000,cpu-num=0
+
+Loading Files
+^^^^^^^^^^^^^
+
+The loader device also allows files to be loaded into memory. It can load ELF,
+U-Boot, and Intel HEX executable formats as well as raw images.  The syntax is
+shown below:
+
+    -device loader,file=<file>[,addr=<addr>][,cpu-num=<cpu-num>][,force-raw=<raw>]
+
+``<file>``
+  A file to be loaded into memory
+
+``<addr>``
+  The memory address where the file should be loaded. This is required
+  for raw images and ignored for non-raw files.
+
+``<cpu-num>``
+  This specifies the CPU that should be used. This is an
+  optional argument and will cause the CPU's PC to be set to the
+  memory address where the raw file is loaded or the entry point
+  specified in the executable format header. This option should only
+  be used for the boot image. This will also cause the image to be
+  written to the specified CPU's address space. If not specified, the
+  default is CPU 0. <force-raw> - Setting force-raw=on forces the file
+  to be treated as a raw image. This can be used to load supported
+  executable formats as if they were raw.
+
+All values are parsed using the standard QemuOpts parsing. This allows the user
+to specify any values in any format supported. By default the values
+will be parsed as decimal. To use hex values the user should prefix the number
+with a '0x'.
+
+An example of loading an ELF file which CPU0 will boot is shown below::
+
+    -device loader,file=./images/boot.elf,cpu-num=0
+
+Restrictions and ToDos
+^^^^^^^^^^^^^^^^^^^^^^
+
+At the moment it is just assumed that if you specify a cpu-num then
+you want to set the PC as well. This might not always be the case. In
+future the internal state 'set_pc' (which exists in the generic loader
+now) should be exposed to the user so that they can choose if the PC
+is set or not.
+
+
diff --git a/docs/system/index.rst b/docs/system/index.rst
index 625b494372..cee1c83540 100644
--- a/docs/system/index.rst
+++ b/docs/system/index.rst
@@ -25,6 +25,7 @@ Contents:
    usb
    ivshmem
    linuxboot
+   generic-loader
    vnc-security
    tls
    gdb
diff --git a/MAINTAINERS b/MAINTAINERS
index 0134cad491..7a37599427 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2016,7 +2016,7 @@ M: Alistair Francis <alistair@alistair23.me>
 S: Maintained
 F: hw/core/generic-loader.c
 F: include/hw/core/generic-loader.h
-F: docs/generic-loader.txt
+F: docs/system/generic-loader.rst
 
 Guest Loader
 M: Alex Bennée <alex.bennee@linaro.org>
-- 
2.20.1



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

* [PULL 15/18] docs: add some documentation for the guest-loader
  2021-03-08 13:50 [PULL 00/18] testing, docs, semihosting move and guest-loader Alex Bennée
                   ` (13 preceding siblings ...)
  2021-03-08 13:51 ` [PULL 14/18] docs: move generic-loader documentation into the main manual Alex Bennée
@ 2021-03-08 13:51 ` Alex Bennée
  2021-03-08 13:51 ` [PULL 16/18] tests/avocado: add boot_xen tests Alex Bennée
                   ` (4 subsequent siblings)
  19 siblings, 0 replies; 38+ messages in thread
From: Alex Bennée @ 2021-03-08 13:51 UTC (permalink / raw)
  To: peter.maydell; +Cc: Alistair Francis, Alex Bennée, qemu-devel

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-Id: <20210303173642.3805-7-alex.bennee@linaro.org>

diff --git a/docs/system/guest-loader.rst b/docs/system/guest-loader.rst
new file mode 100644
index 0000000000..37d03cbd89
--- /dev/null
+++ b/docs/system/guest-loader.rst
@@ -0,0 +1,54 @@
+..
+   Copyright (c) 2020, Linaro
+
+Guest Loader
+------------
+
+The guest loader is similar to the `generic-loader` although it is
+aimed at a particular use case of loading hypervisor guests. This is
+useful for debugging hypervisors without having to jump through the
+hoops of firmware and boot-loaders.
+
+The guest loader does two things:
+
+  - load blobs (kernels and initial ram disks) into memory
+  - sets platform FDT data so hypervisors can find and boot them
+
+This is what is typically done by a boot-loader like grub using it's
+multi-boot capability. A typical example would look like:
+
+.. parsed-literal::
+
+  |qemu_system| -kernel ~/xen.git/xen/xen \
+    -append "dom0_mem=1G,max:1G loglvl=all guest_loglvl=all" \
+    -device guest-loader,addr=0x42000000,kernel=Image,bootargs="root=/dev/sda2 ro console=hvc0 earlyprintk=xen" \
+    -device guest-loader,addr=0x47000000,initrd=rootfs.cpio
+
+In the above example the Xen hypervisor is loaded by the -kernel
+parameter and passed it's boot arguments via -append. The Dom0 guest
+is loaded into the areas of memory. Each blob will get
+`/chosen/module@<addr>` entry in the FDT to indicate it's location and
+size. Additional information can be passed with by using additional
+arguments.
+
+Currently the only supported machines which use FDT data to boot are
+the ARM and RiscV `virt` machines.
+
+Arguments
+^^^^^^^^^
+
+The full syntax of the guest-loader is::
+
+  -device guest-loader,addr=<addr>[,kernel=<file>,[bootargs=<args>]][,initrd=<file>]
+
+``addr=<addr>``
+  This is mandatory and indicates the start address of the blob.
+
+``kernel|initrd=<file>``
+  Indicates the filename of the kernel or initrd blob. Both blobs will
+  have the "multiboot,module" compatibility string as well as
+  "multiboot,kernel" or "multiboot,ramdisk" as appropriate.
+
+``bootargs=<args>``
+  This is an optional field for kernel blobs which will pass command
+  like via the `/chosen/module@<addr>/bootargs` node.
diff --git a/docs/system/index.rst b/docs/system/index.rst
index cee1c83540..6ad9c93806 100644
--- a/docs/system/index.rst
+++ b/docs/system/index.rst
@@ -26,6 +26,7 @@ Contents:
    ivshmem
    linuxboot
    generic-loader
+   guest-loader
    vnc-security
    tls
    gdb
diff --git a/MAINTAINERS b/MAINTAINERS
index 7a37599427..6bebd5279b 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2022,6 +2022,7 @@ Guest Loader
 M: Alex Bennée <alex.bennee@linaro.org>
 S: Maintained
 F: hw/core/guest-loader.c
+F: docs/system/guest-loader.rst
 
 Intel Hexadecimal Object File Loader
 M: Su Hang <suhang16@mails.ucas.ac.cn>
-- 
2.20.1



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

* [PULL 16/18] tests/avocado: add boot_xen tests
  2021-03-08 13:50 [PULL 00/18] testing, docs, semihosting move and guest-loader Alex Bennée
                   ` (14 preceding siblings ...)
  2021-03-08 13:51 ` [PULL 15/18] docs: add some documentation for the guest-loader Alex Bennée
@ 2021-03-08 13:51 ` Alex Bennée
  2021-03-08 13:51   ` Alex Bennée
                   ` (3 subsequent siblings)
  19 siblings, 0 replies; 38+ messages in thread
From: Alex Bennée @ 2021-03-08 13:51 UTC (permalink / raw)
  To: peter.maydell
  Cc: Alex Bennée, Philippe Mathieu-Daudé,
	Wainer dos Santos Moschetta, qemu-devel, Cleber Rosa,
	Philippe Mathieu-Daudé

These tests make sure we can boot the Xen hypervisor with a Dom0
kernel using the guest-loader. We currently have to use a kernel I
built myself because there are issues using the Debian kernel images.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Tested-by: Cleber Rosa <crosa@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Cleber Rosa <crosa@redhat.com>
Message-Id: <20210303173642.3805-8-alex.bennee@linaro.org>

diff --git a/MAINTAINERS b/MAINTAINERS
index 6bebd5279b..b54a22475b 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2023,6 +2023,7 @@ M: Alex Bennée <alex.bennee@linaro.org>
 S: Maintained
 F: hw/core/guest-loader.c
 F: docs/system/guest-loader.rst
+F: tests/acceptance/boot_xen.py
 
 Intel Hexadecimal Object File Loader
 M: Su Hang <suhang16@mails.ucas.ac.cn>
diff --git a/tests/acceptance/boot_xen.py b/tests/acceptance/boot_xen.py
new file mode 100644
index 0000000000..75c2d44492
--- /dev/null
+++ b/tests/acceptance/boot_xen.py
@@ -0,0 +1,118 @@
+# Functional test that boots a Xen hypervisor with a domU kernel and
+# checks the console output is vaguely sane .
+#
+# Copyright (c) 2020 Linaro
+#
+# Author:
+#  Alex Bennée <alex.bennee@linaro.org>
+#
+# SPDX-License-Identifier: GPL-2.0-or-later
+#
+# This work is licensed under the terms of the GNU GPL, version 2 or
+# later.  See the COPYING file in the top-level directory.
+
+import os
+
+from avocado import skipIf
+from avocado_qemu import wait_for_console_pattern
+from boot_linux_console import LinuxKernelTest
+
+
+class BootXenBase(LinuxKernelTest):
+    """
+    Boots a Xen hypervisor with a Linux DomU kernel.
+    """
+
+    timeout = 90
+    XEN_COMMON_COMMAND_LINE = 'dom0_mem=128M loglvl=all guest_loglvl=all'
+
+    def fetch_guest_kernel(self):
+        # Using my own built kernel - which works
+        kernel_url = ('https://fileserver.linaro.org/'
+                      's/JSsewXGZ6mqxPr5/download?path=%2F&files='
+                      'linux-5.9.9-arm64-ajb')
+        kernel_sha1 = '4f92bc4b9f88d5ab792fa7a43a68555d344e1b83'
+        kernel_path = self.fetch_asset(kernel_url,
+                                       asset_hash=kernel_sha1)
+
+        return kernel_path
+
+    def launch_xen(self, xen_path):
+        """
+        Launch Xen with a dom0 guest kernel
+        """
+        self.log.info("launch with xen_path: %s", xen_path)
+        kernel_path = self.fetch_guest_kernel()
+
+        self.vm.set_console()
+
+        xen_command_line = self.XEN_COMMON_COMMAND_LINE
+        self.vm.add_args('-machine', 'virtualization=on',
+                         '-cpu', 'cortex-a57',
+                         '-m', '768',
+                         '-kernel', xen_path,
+                         '-append', xen_command_line,
+                         '-device',
+                         'guest-loader,addr=0x47000000,kernel=%s,bootargs=console=hvc0'
+                         % (kernel_path))
+
+        self.vm.launch()
+
+        console_pattern = 'VFS: Cannot open root device'
+        wait_for_console_pattern(self, console_pattern, "Panic on CPU 0:")
+
+
+class BootXen(BootXenBase):
+
+    def test_arm64_xen_411_and_dom0(self):
+        """
+        :avocado: tags=arch:aarch64
+        :avocado: tags=accel:tcg
+        :avocado: tags=cpu:cortex-a57
+        :avocado: tags=machine:virt
+        """
+
+        # archive of file from https://deb.debian.org/debian/pool/main/x/xen/
+        xen_url = ('https://fileserver.linaro.org/s/JSsewXGZ6mqxPr5/'
+                   'download?path=%2F&files='
+                   'xen-hypervisor-4.11-arm64_4.11.4%2B37-g3263f257ca-1_arm64.deb')
+        xen_sha1 = '034e634d4416adbad1212d59b62bccdcda63e62a'
+        xen_deb = self.fetch_asset(xen_url, asset_hash=xen_sha1)
+        xen_path = self.extract_from_deb(xen_deb, "/boot/xen-4.11-arm64")
+
+        self.launch_xen(xen_path)
+
+    def test_arm64_xen_414_and_dom0(self):
+        """
+        :avocado: tags=arch:aarch64
+        :avocado: tags=accel:tcg
+        :avocado: tags=cpu:cortex-a57
+        :avocado: tags=machine:virt
+        """
+
+        # archive of file from https://deb.debian.org/debian/pool/main/x/xen/
+        xen_url = ('https://fileserver.linaro.org/s/JSsewXGZ6mqxPr5/'
+                   'download?path=%2F&files='
+                   'xen-hypervisor-4.14-arm64_4.14.0%2B80-gd101b417b7-1_arm64.deb')
+        xen_sha1 = 'b9d209dd689ed2b393e625303a225badefec1160'
+        xen_deb = self.fetch_asset(xen_url, asset_hash=xen_sha1)
+        xen_path = self.extract_from_deb(xen_deb, "/boot/xen-4.14-arm64")
+
+        self.launch_xen(xen_path)
+
+    def test_arm64_xen_415_and_dom0(self):
+        """
+        :avocado: tags=arch:aarch64
+        :avocado: tags=accel:tcg
+        :avocado: tags=cpu:cortex-a57
+        :avocado: tags=machine:virt
+        """
+
+        xen_url = ('https://fileserver.linaro.org/'
+                   's/JSsewXGZ6mqxPr5/download'
+                   '?path=%2F&files=xen-upstream-4.15-unstable.deb')
+        xen_sha1 = 'fc191172b85cf355abb95d275a24cc0f6d6579d8'
+        xen_deb = self.fetch_asset(xen_url, asset_hash=xen_sha1)
+        xen_path = self.extract_from_deb(xen_deb, "/boot/xen-4.15-unstable")
+
+        self.launch_xen(xen_path)
-- 
2.20.1



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

* [PULL 17/18] semihosting: Move include/hw/semihosting/ -> include/semihosting/
  2021-03-08 13:50 [PULL 00/18] testing, docs, semihosting move and guest-loader Alex Bennée
@ 2021-03-08 13:51   ` Alex Bennée
  2021-03-08 13:50 ` [PULL 02/18] tests/docker: add a test-tcg for building then running check-tcg Alex Bennée
                     ` (18 subsequent siblings)
  19 siblings, 0 replies; 38+ messages in thread
From: Alex Bennée @ 2021-03-08 13:51 UTC (permalink / raw)
  To: peter.maydell
  Cc: Marek Vasut, Aleksandar Rikalo, open list:RISC-V TCG CPUs,
	Sagar Karandikar, Alex Bennée, Chris Wulff, qemu-devel,
	Philippe Mathieu-Daudé,
	Max Filippov, Michael Walle, open list:ARM TCG CPUs,
	Palmer Dabbelt, Bastian Koppelmann, Paolo Bonzini,
	Alistair Francis, Guan Xuetao, Philippe Mathieu-Daudé,
	Aurelien Jarno, Laurent Vivier

From: Philippe Mathieu-Daudé <f4bug@amsat.org>

We want to move the semihosting code out of hw/ in the next patch.

This patch contains the mechanical steps, created using:

  $ git mv include/hw/semihosting/ include/
  $ sed -i s,hw/semihosting,semihosting, $(git grep -l hw/semihosting)

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

diff --git a/include/hw/semihosting/console.h b/include/semihosting/console.h
similarity index 100%
rename from include/hw/semihosting/console.h
rename to include/semihosting/console.h
diff --git a/include/hw/semihosting/semihost.h b/include/semihosting/semihost.h
similarity index 100%
rename from include/hw/semihosting/semihost.h
rename to include/semihosting/semihost.h
diff --git a/gdbstub.c b/gdbstub.c
index 3ee40479b6..e51e33cc70 100644
--- a/gdbstub.c
+++ b/gdbstub.c
@@ -49,7 +49,7 @@
 #include "sysemu/hw_accel.h"
 #include "sysemu/kvm.h"
 #include "sysemu/runstate.h"
-#include "hw/semihosting/semihost.h"
+#include "semihosting/semihost.h"
 #include "exec/exec-all.h"
 #include "sysemu/replay.h"
 
diff --git a/hw/mips/malta.c b/hw/mips/malta.c
index 9afc0b427b..26e7b1bd9f 100644
--- a/hw/mips/malta.c
+++ b/hw/mips/malta.c
@@ -58,7 +58,7 @@
 #include "qemu/error-report.h"
 #include "hw/misc/empty_slot.h"
 #include "sysemu/kvm.h"
-#include "hw/semihosting/semihost.h"
+#include "semihosting/semihost.h"
 #include "hw/mips/cps.h"
 #include "hw/qdev-clock.h"
 
diff --git a/hw/semihosting/arm-compat-semi.c b/hw/semihosting/arm-compat-semi.c
index 23c6e3edcb..94950b6c56 100644
--- a/hw/semihosting/arm-compat-semi.c
+++ b/hw/semihosting/arm-compat-semi.c
@@ -34,9 +34,9 @@
 #include "qemu/osdep.h"
 
 #include "cpu.h"
-#include "hw/semihosting/semihost.h"
-#include "hw/semihosting/console.h"
-#include "hw/semihosting/common-semi.h"
+#include "semihosting/semihost.h"
+#include "semihosting/console.h"
+#include "semihosting/common-semi.h"
 #include "qemu/log.h"
 #include "qemu/timer.h"
 #ifdef CONFIG_USER_ONLY
diff --git a/hw/semihosting/config.c b/hw/semihosting/config.c
index 9807f10cb0..3548e0f627 100644
--- a/hw/semihosting/config.c
+++ b/hw/semihosting/config.c
@@ -22,7 +22,7 @@
 #include "qemu/option.h"
 #include "qemu/config-file.h"
 #include "qemu/error-report.h"
-#include "hw/semihosting/semihost.h"
+#include "semihosting/semihost.h"
 #include "chardev/char.h"
 #include "sysemu/sysemu.h"
 
diff --git a/hw/semihosting/console.c b/hw/semihosting/console.c
index 9b4fee9260..c9ebd6fdd0 100644
--- a/hw/semihosting/console.c
+++ b/hw/semihosting/console.c
@@ -17,8 +17,8 @@
 
 #include "qemu/osdep.h"
 #include "cpu.h"
-#include "hw/semihosting/semihost.h"
-#include "hw/semihosting/console.h"
+#include "semihosting/semihost.h"
+#include "semihosting/console.h"
 #include "exec/gdbstub.h"
 #include "exec/exec-all.h"
 #include "qemu/log.h"
diff --git a/linux-user/aarch64/cpu_loop.c b/linux-user/aarch64/cpu_loop.c
index 7c42f65706..ee72a1c20f 100644
--- a/linux-user/aarch64/cpu_loop.c
+++ b/linux-user/aarch64/cpu_loop.c
@@ -22,7 +22,7 @@
 #include "qemu.h"
 #include "cpu_loop-common.h"
 #include "qemu/guest-random.h"
-#include "hw/semihosting/common-semi.h"
+#include "semihosting/common-semi.h"
 #include "target/arm/syndrome.h"
 
 #define get_user_code_u32(x, gaddr, env)                \
diff --git a/linux-user/arm/cpu_loop.c b/linux-user/arm/cpu_loop.c
index cadfb7fa43..989d03cd89 100644
--- a/linux-user/arm/cpu_loop.c
+++ b/linux-user/arm/cpu_loop.c
@@ -22,7 +22,7 @@
 #include "qemu.h"
 #include "elf.h"
 #include "cpu_loop-common.h"
-#include "hw/semihosting/common-semi.h"
+#include "semihosting/common-semi.h"
 
 #define get_user_code_u32(x, gaddr, env)                \
     ({ abi_long __r = get_user_u32((x), (gaddr));       \
diff --git a/linux-user/riscv/cpu_loop.c b/linux-user/riscv/cpu_loop.c
index 9665dabb09..6767f941e8 100644
--- a/linux-user/riscv/cpu_loop.c
+++ b/linux-user/riscv/cpu_loop.c
@@ -23,7 +23,7 @@
 #include "qemu.h"
 #include "cpu_loop-common.h"
 #include "elf.h"
-#include "hw/semihosting/common-semi.h"
+#include "semihosting/common-semi.h"
 
 void cpu_loop(CPURISCVState *env)
 {
diff --git a/linux-user/semihost.c b/linux-user/semihost.c
index c0015ee7f6..82013b8b48 100644
--- a/linux-user/semihost.c
+++ b/linux-user/semihost.c
@@ -12,7 +12,7 @@
 
 #include "qemu/osdep.h"
 #include "cpu.h"
-#include "hw/semihosting/console.h"
+#include "semihosting/console.h"
 #include "qemu.h"
 #include <termios.h>
 
diff --git a/softmmu/vl.c b/softmmu/vl.c
index 10bd8a10a3..ac06dfbae0 100644
--- a/softmmu/vl.c
+++ b/softmmu/vl.c
@@ -108,7 +108,7 @@
 #include "qapi/opts-visitor.h"
 #include "qapi/clone-visitor.h"
 #include "qom/object_interfaces.h"
-#include "hw/semihosting/semihost.h"
+#include "semihosting/semihost.h"
 #include "crypto/init.h"
 #include "sysemu/replay.h"
 #include "qapi/qapi-events-run-state.h"
diff --git a/stubs/semihost.c b/stubs/semihost.c
index 1d8b37f7b2..1b30f38b03 100644
--- a/stubs/semihost.c
+++ b/stubs/semihost.c
@@ -11,7 +11,7 @@
 #include "qemu/osdep.h"
 #include "qemu/option.h"
 #include "qemu/error-report.h"
-#include "hw/semihosting/semihost.h"
+#include "semihosting/semihost.h"
 #include "sysemu/sysemu.h"
 
 /* Empty config */
diff --git a/target/arm/helper.c b/target/arm/helper.c
index 0e1a3b9421..d763f376c6 100644
--- a/target/arm/helper.c
+++ b/target/arm/helper.c
@@ -22,7 +22,7 @@
 #include "exec/exec-all.h"
 #include <zlib.h> /* For crc32 */
 #include "hw/irq.h"
-#include "hw/semihosting/semihost.h"
+#include "semihosting/semihost.h"
 #include "sysemu/cpus.h"
 #include "sysemu/cpu-timers.h"
 #include "sysemu/kvm.h"
@@ -34,7 +34,7 @@
 #ifdef CONFIG_TCG
 #include "arm_ldst.h"
 #include "exec/cpu_ldst.h"
-#include "hw/semihosting/common-semi.h"
+#include "semihosting/common-semi.h"
 #endif
 
 #define ARM_CPU_FREQ 1000000000 /* FIXME: 1 GHz, should be configurable */
diff --git a/target/arm/m_helper.c b/target/arm/m_helper.c
index 731c435c00..d63ae465e1 100644
--- a/target/arm/m_helper.c
+++ b/target/arm/m_helper.c
@@ -21,7 +21,7 @@
 #include "qemu/qemu-print.h"
 #include "exec/exec-all.h"
 #include <zlib.h> /* For crc32 */
-#include "hw/semihosting/semihost.h"
+#include "semihosting/semihost.h"
 #include "sysemu/cpus.h"
 #include "sysemu/kvm.h"
 #include "qemu/range.h"
@@ -31,7 +31,7 @@
 #ifdef CONFIG_TCG
 #include "arm_ldst.h"
 #include "exec/cpu_ldst.h"
-#include "hw/semihosting/common-semi.h"
+#include "semihosting/common-semi.h"
 #endif
 
 static void v7m_msr_xpsr(CPUARMState *env, uint32_t mask,
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
index b23a8975d5..6d002e2c63 100644
--- a/target/arm/translate-a64.c
+++ b/target/arm/translate-a64.c
@@ -28,7 +28,7 @@
 #include "internals.h"
 #include "qemu/host-utils.h"
 
-#include "hw/semihosting/semihost.h"
+#include "semihosting/semihost.h"
 #include "exec/gen-icount.h"
 
 #include "exec/helper-proto.h"
diff --git a/target/arm/translate.c b/target/arm/translate.c
index 1653cca1aa..62b1c2081b 100644
--- a/target/arm/translate.c
+++ b/target/arm/translate.c
@@ -29,7 +29,7 @@
 #include "qemu/log.h"
 #include "qemu/bitops.h"
 #include "arm_ldst.h"
-#include "hw/semihosting/semihost.h"
+#include "semihosting/semihost.h"
 
 #include "exec/helper-proto.h"
 #include "exec/helper-gen.h"
diff --git a/target/lm32/helper.c b/target/lm32/helper.c
index 7c52ae76d6..01cc3c53a5 100644
--- a/target/lm32/helper.c
+++ b/target/lm32/helper.c
@@ -21,7 +21,7 @@
 #include "cpu.h"
 #include "exec/exec-all.h"
 #include "qemu/host-utils.h"
-#include "hw/semihosting/semihost.h"
+#include "semihosting/semihost.h"
 #include "exec/log.h"
 
 bool lm32_cpu_tlb_fill(CPUState *cs, vaddr address, int size,
diff --git a/target/m68k/op_helper.c b/target/m68k/op_helper.c
index 202498deb5..730cdf7744 100644
--- a/target/m68k/op_helper.c
+++ b/target/m68k/op_helper.c
@@ -21,7 +21,7 @@
 #include "exec/helper-proto.h"
 #include "exec/exec-all.h"
 #include "exec/cpu_ldst.h"
-#include "hw/semihosting/semihost.h"
+#include "semihosting/semihost.h"
 
 #if defined(CONFIG_USER_ONLY)
 
diff --git a/target/mips/cpu.c b/target/mips/cpu.c
index bf70c77295..bd4dca571f 100644
--- a/target/mips/cpu.c
+++ b/target/mips/cpu.c
@@ -31,7 +31,7 @@
 #include "exec/exec-all.h"
 #include "hw/qdev-properties.h"
 #include "hw/qdev-clock.h"
-#include "hw/semihosting/semihost.h"
+#include "semihosting/semihost.h"
 #include "qapi/qapi-commands-machine-target.h"
 #include "fpu_helper.h"
 
diff --git a/target/mips/mips-semi.c b/target/mips/mips-semi.c
index 898251aa02..6de60fa6dd 100644
--- a/target/mips/mips-semi.c
+++ b/target/mips/mips-semi.c
@@ -22,8 +22,8 @@
 #include "qemu/log.h"
 #include "exec/helper-proto.h"
 #include "exec/softmmu-semi.h"
-#include "hw/semihosting/semihost.h"
-#include "hw/semihosting/console.h"
+#include "semihosting/semihost.h"
+#include "semihosting/console.h"
 
 typedef enum UHIOp {
     UHI_exit = 1,
diff --git a/target/mips/translate.c b/target/mips/translate.c
index 70891c37cd..0b6d82d228 100644
--- a/target/mips/translate.c
+++ b/target/mips/translate.c
@@ -29,7 +29,7 @@
 #include "exec/translator.h"
 #include "exec/helper-proto.h"
 #include "exec/helper-gen.h"
-#include "hw/semihosting/semihost.h"
+#include "semihosting/semihost.h"
 
 #include "target/mips/trace.h"
 #include "trace-tcg.h"
diff --git a/target/nios2/helper.c b/target/nios2/helper.c
index 57c97bde3c..53be8398e9 100644
--- a/target/nios2/helper.c
+++ b/target/nios2/helper.c
@@ -26,7 +26,7 @@
 #include "exec/cpu_ldst.h"
 #include "exec/log.h"
 #include "exec/helper-proto.h"
-#include "hw/semihosting/semihost.h"
+#include "semihosting/semihost.h"
 
 #if defined(CONFIG_USER_ONLY)
 
diff --git a/target/riscv/cpu_helper.c b/target/riscv/cpu_helper.c
index 2f43939fb6..83a6bcfad0 100644
--- a/target/riscv/cpu_helper.c
+++ b/target/riscv/cpu_helper.c
@@ -24,7 +24,7 @@
 #include "exec/exec-all.h"
 #include "tcg/tcg-op.h"
 #include "trace.h"
-#include "hw/semihosting/common-semi.h"
+#include "semihosting/common-semi.h"
 
 int riscv_cpu_mmu_index(CPURISCVState *env, bool ifetch)
 {
diff --git a/target/unicore32/helper.c b/target/unicore32/helper.c
index 54c26871fe..704393c27f 100644
--- a/target/unicore32/helper.c
+++ b/target/unicore32/helper.c
@@ -14,7 +14,7 @@
 #include "cpu.h"
 #include "exec/exec-all.h"
 #include "exec/helper-proto.h"
-#include "hw/semihosting/console.h"
+#include "semihosting/console.h"
 
 #undef DEBUG_UC32
 
diff --git a/target/xtensa/translate.c b/target/xtensa/translate.c
index 944a157747..0ae4efc48a 100644
--- a/target/xtensa/translate.c
+++ b/target/xtensa/translate.c
@@ -37,7 +37,7 @@
 #include "qemu/log.h"
 #include "qemu/qemu-print.h"
 #include "exec/cpu_ldst.h"
-#include "hw/semihosting/semihost.h"
+#include "semihosting/semihost.h"
 #include "exec/translator.h"
 
 #include "exec/helper-proto.h"
diff --git a/target/xtensa/xtensa-semi.c b/target/xtensa/xtensa-semi.c
index 25f57a6500..79f2b043f2 100644
--- a/target/xtensa/xtensa-semi.c
+++ b/target/xtensa/xtensa-semi.c
@@ -29,7 +29,7 @@
 #include "cpu.h"
 #include "chardev/char-fe.h"
 #include "exec/helper-proto.h"
-#include "hw/semihosting/semihost.h"
+#include "semihosting/semihost.h"
 #include "qapi/error.h"
 #include "qemu/log.h"
 
diff --git a/MAINTAINERS b/MAINTAINERS
index b54a22475b..99e9874fd2 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -3243,7 +3243,7 @@ Semihosting
 M: Alex Bennée <alex.bennee@linaro.org>
 S: Maintained
 F: hw/semihosting/
-F: include/hw/semihosting/
+F: include/semihosting/
 
 Multi-process QEMU
 M: Elena Ufimtseva <elena.ufimtseva@oracle.com>
-- 
2.20.1



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

* [PULL 17/18] semihosting: Move include/hw/semihosting/ -> include/semihosting/
@ 2021-03-08 13:51   ` Alex Bennée
  0 siblings, 0 replies; 38+ messages in thread
From: Alex Bennée @ 2021-03-08 13:51 UTC (permalink / raw)
  To: peter.maydell
  Cc: qemu-devel, Philippe Mathieu-Daudé,
	Alex Bennée, Philippe Mathieu-Daudé,
	Aurelien Jarno, Jiaxun Yang, Aleksandar Rikalo, Laurent Vivier,
	Paolo Bonzini, Michael Walle, Chris Wulff, Marek Vasut,
	Palmer Dabbelt, Alistair Francis, Sagar Karandikar,
	Bastian Koppelmann, Guan Xuetao, Max Filippov,
	open list:ARM TCG CPUs, open list:RISC-V TCG CPUs

From: Philippe Mathieu-Daudé <f4bug@amsat.org>

We want to move the semihosting code out of hw/ in the next patch.

This patch contains the mechanical steps, created using:

  $ git mv include/hw/semihosting/ include/
  $ sed -i s,hw/semihosting,semihosting, $(git grep -l hw/semihosting)

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

diff --git a/include/hw/semihosting/console.h b/include/semihosting/console.h
similarity index 100%
rename from include/hw/semihosting/console.h
rename to include/semihosting/console.h
diff --git a/include/hw/semihosting/semihost.h b/include/semihosting/semihost.h
similarity index 100%
rename from include/hw/semihosting/semihost.h
rename to include/semihosting/semihost.h
diff --git a/gdbstub.c b/gdbstub.c
index 3ee40479b6..e51e33cc70 100644
--- a/gdbstub.c
+++ b/gdbstub.c
@@ -49,7 +49,7 @@
 #include "sysemu/hw_accel.h"
 #include "sysemu/kvm.h"
 #include "sysemu/runstate.h"
-#include "hw/semihosting/semihost.h"
+#include "semihosting/semihost.h"
 #include "exec/exec-all.h"
 #include "sysemu/replay.h"
 
diff --git a/hw/mips/malta.c b/hw/mips/malta.c
index 9afc0b427b..26e7b1bd9f 100644
--- a/hw/mips/malta.c
+++ b/hw/mips/malta.c
@@ -58,7 +58,7 @@
 #include "qemu/error-report.h"
 #include "hw/misc/empty_slot.h"
 #include "sysemu/kvm.h"
-#include "hw/semihosting/semihost.h"
+#include "semihosting/semihost.h"
 #include "hw/mips/cps.h"
 #include "hw/qdev-clock.h"
 
diff --git a/hw/semihosting/arm-compat-semi.c b/hw/semihosting/arm-compat-semi.c
index 23c6e3edcb..94950b6c56 100644
--- a/hw/semihosting/arm-compat-semi.c
+++ b/hw/semihosting/arm-compat-semi.c
@@ -34,9 +34,9 @@
 #include "qemu/osdep.h"
 
 #include "cpu.h"
-#include "hw/semihosting/semihost.h"
-#include "hw/semihosting/console.h"
-#include "hw/semihosting/common-semi.h"
+#include "semihosting/semihost.h"
+#include "semihosting/console.h"
+#include "semihosting/common-semi.h"
 #include "qemu/log.h"
 #include "qemu/timer.h"
 #ifdef CONFIG_USER_ONLY
diff --git a/hw/semihosting/config.c b/hw/semihosting/config.c
index 9807f10cb0..3548e0f627 100644
--- a/hw/semihosting/config.c
+++ b/hw/semihosting/config.c
@@ -22,7 +22,7 @@
 #include "qemu/option.h"
 #include "qemu/config-file.h"
 #include "qemu/error-report.h"
-#include "hw/semihosting/semihost.h"
+#include "semihosting/semihost.h"
 #include "chardev/char.h"
 #include "sysemu/sysemu.h"
 
diff --git a/hw/semihosting/console.c b/hw/semihosting/console.c
index 9b4fee9260..c9ebd6fdd0 100644
--- a/hw/semihosting/console.c
+++ b/hw/semihosting/console.c
@@ -17,8 +17,8 @@
 
 #include "qemu/osdep.h"
 #include "cpu.h"
-#include "hw/semihosting/semihost.h"
-#include "hw/semihosting/console.h"
+#include "semihosting/semihost.h"
+#include "semihosting/console.h"
 #include "exec/gdbstub.h"
 #include "exec/exec-all.h"
 #include "qemu/log.h"
diff --git a/linux-user/aarch64/cpu_loop.c b/linux-user/aarch64/cpu_loop.c
index 7c42f65706..ee72a1c20f 100644
--- a/linux-user/aarch64/cpu_loop.c
+++ b/linux-user/aarch64/cpu_loop.c
@@ -22,7 +22,7 @@
 #include "qemu.h"
 #include "cpu_loop-common.h"
 #include "qemu/guest-random.h"
-#include "hw/semihosting/common-semi.h"
+#include "semihosting/common-semi.h"
 #include "target/arm/syndrome.h"
 
 #define get_user_code_u32(x, gaddr, env)                \
diff --git a/linux-user/arm/cpu_loop.c b/linux-user/arm/cpu_loop.c
index cadfb7fa43..989d03cd89 100644
--- a/linux-user/arm/cpu_loop.c
+++ b/linux-user/arm/cpu_loop.c
@@ -22,7 +22,7 @@
 #include "qemu.h"
 #include "elf.h"
 #include "cpu_loop-common.h"
-#include "hw/semihosting/common-semi.h"
+#include "semihosting/common-semi.h"
 
 #define get_user_code_u32(x, gaddr, env)                \
     ({ abi_long __r = get_user_u32((x), (gaddr));       \
diff --git a/linux-user/riscv/cpu_loop.c b/linux-user/riscv/cpu_loop.c
index 9665dabb09..6767f941e8 100644
--- a/linux-user/riscv/cpu_loop.c
+++ b/linux-user/riscv/cpu_loop.c
@@ -23,7 +23,7 @@
 #include "qemu.h"
 #include "cpu_loop-common.h"
 #include "elf.h"
-#include "hw/semihosting/common-semi.h"
+#include "semihosting/common-semi.h"
 
 void cpu_loop(CPURISCVState *env)
 {
diff --git a/linux-user/semihost.c b/linux-user/semihost.c
index c0015ee7f6..82013b8b48 100644
--- a/linux-user/semihost.c
+++ b/linux-user/semihost.c
@@ -12,7 +12,7 @@
 
 #include "qemu/osdep.h"
 #include "cpu.h"
-#include "hw/semihosting/console.h"
+#include "semihosting/console.h"
 #include "qemu.h"
 #include <termios.h>
 
diff --git a/softmmu/vl.c b/softmmu/vl.c
index 10bd8a10a3..ac06dfbae0 100644
--- a/softmmu/vl.c
+++ b/softmmu/vl.c
@@ -108,7 +108,7 @@
 #include "qapi/opts-visitor.h"
 #include "qapi/clone-visitor.h"
 #include "qom/object_interfaces.h"
-#include "hw/semihosting/semihost.h"
+#include "semihosting/semihost.h"
 #include "crypto/init.h"
 #include "sysemu/replay.h"
 #include "qapi/qapi-events-run-state.h"
diff --git a/stubs/semihost.c b/stubs/semihost.c
index 1d8b37f7b2..1b30f38b03 100644
--- a/stubs/semihost.c
+++ b/stubs/semihost.c
@@ -11,7 +11,7 @@
 #include "qemu/osdep.h"
 #include "qemu/option.h"
 #include "qemu/error-report.h"
-#include "hw/semihosting/semihost.h"
+#include "semihosting/semihost.h"
 #include "sysemu/sysemu.h"
 
 /* Empty config */
diff --git a/target/arm/helper.c b/target/arm/helper.c
index 0e1a3b9421..d763f376c6 100644
--- a/target/arm/helper.c
+++ b/target/arm/helper.c
@@ -22,7 +22,7 @@
 #include "exec/exec-all.h"
 #include <zlib.h> /* For crc32 */
 #include "hw/irq.h"
-#include "hw/semihosting/semihost.h"
+#include "semihosting/semihost.h"
 #include "sysemu/cpus.h"
 #include "sysemu/cpu-timers.h"
 #include "sysemu/kvm.h"
@@ -34,7 +34,7 @@
 #ifdef CONFIG_TCG
 #include "arm_ldst.h"
 #include "exec/cpu_ldst.h"
-#include "hw/semihosting/common-semi.h"
+#include "semihosting/common-semi.h"
 #endif
 
 #define ARM_CPU_FREQ 1000000000 /* FIXME: 1 GHz, should be configurable */
diff --git a/target/arm/m_helper.c b/target/arm/m_helper.c
index 731c435c00..d63ae465e1 100644
--- a/target/arm/m_helper.c
+++ b/target/arm/m_helper.c
@@ -21,7 +21,7 @@
 #include "qemu/qemu-print.h"
 #include "exec/exec-all.h"
 #include <zlib.h> /* For crc32 */
-#include "hw/semihosting/semihost.h"
+#include "semihosting/semihost.h"
 #include "sysemu/cpus.h"
 #include "sysemu/kvm.h"
 #include "qemu/range.h"
@@ -31,7 +31,7 @@
 #ifdef CONFIG_TCG
 #include "arm_ldst.h"
 #include "exec/cpu_ldst.h"
-#include "hw/semihosting/common-semi.h"
+#include "semihosting/common-semi.h"
 #endif
 
 static void v7m_msr_xpsr(CPUARMState *env, uint32_t mask,
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
index b23a8975d5..6d002e2c63 100644
--- a/target/arm/translate-a64.c
+++ b/target/arm/translate-a64.c
@@ -28,7 +28,7 @@
 #include "internals.h"
 #include "qemu/host-utils.h"
 
-#include "hw/semihosting/semihost.h"
+#include "semihosting/semihost.h"
 #include "exec/gen-icount.h"
 
 #include "exec/helper-proto.h"
diff --git a/target/arm/translate.c b/target/arm/translate.c
index 1653cca1aa..62b1c2081b 100644
--- a/target/arm/translate.c
+++ b/target/arm/translate.c
@@ -29,7 +29,7 @@
 #include "qemu/log.h"
 #include "qemu/bitops.h"
 #include "arm_ldst.h"
-#include "hw/semihosting/semihost.h"
+#include "semihosting/semihost.h"
 
 #include "exec/helper-proto.h"
 #include "exec/helper-gen.h"
diff --git a/target/lm32/helper.c b/target/lm32/helper.c
index 7c52ae76d6..01cc3c53a5 100644
--- a/target/lm32/helper.c
+++ b/target/lm32/helper.c
@@ -21,7 +21,7 @@
 #include "cpu.h"
 #include "exec/exec-all.h"
 #include "qemu/host-utils.h"
-#include "hw/semihosting/semihost.h"
+#include "semihosting/semihost.h"
 #include "exec/log.h"
 
 bool lm32_cpu_tlb_fill(CPUState *cs, vaddr address, int size,
diff --git a/target/m68k/op_helper.c b/target/m68k/op_helper.c
index 202498deb5..730cdf7744 100644
--- a/target/m68k/op_helper.c
+++ b/target/m68k/op_helper.c
@@ -21,7 +21,7 @@
 #include "exec/helper-proto.h"
 #include "exec/exec-all.h"
 #include "exec/cpu_ldst.h"
-#include "hw/semihosting/semihost.h"
+#include "semihosting/semihost.h"
 
 #if defined(CONFIG_USER_ONLY)
 
diff --git a/target/mips/cpu.c b/target/mips/cpu.c
index bf70c77295..bd4dca571f 100644
--- a/target/mips/cpu.c
+++ b/target/mips/cpu.c
@@ -31,7 +31,7 @@
 #include "exec/exec-all.h"
 #include "hw/qdev-properties.h"
 #include "hw/qdev-clock.h"
-#include "hw/semihosting/semihost.h"
+#include "semihosting/semihost.h"
 #include "qapi/qapi-commands-machine-target.h"
 #include "fpu_helper.h"
 
diff --git a/target/mips/mips-semi.c b/target/mips/mips-semi.c
index 898251aa02..6de60fa6dd 100644
--- a/target/mips/mips-semi.c
+++ b/target/mips/mips-semi.c
@@ -22,8 +22,8 @@
 #include "qemu/log.h"
 #include "exec/helper-proto.h"
 #include "exec/softmmu-semi.h"
-#include "hw/semihosting/semihost.h"
-#include "hw/semihosting/console.h"
+#include "semihosting/semihost.h"
+#include "semihosting/console.h"
 
 typedef enum UHIOp {
     UHI_exit = 1,
diff --git a/target/mips/translate.c b/target/mips/translate.c
index 70891c37cd..0b6d82d228 100644
--- a/target/mips/translate.c
+++ b/target/mips/translate.c
@@ -29,7 +29,7 @@
 #include "exec/translator.h"
 #include "exec/helper-proto.h"
 #include "exec/helper-gen.h"
-#include "hw/semihosting/semihost.h"
+#include "semihosting/semihost.h"
 
 #include "target/mips/trace.h"
 #include "trace-tcg.h"
diff --git a/target/nios2/helper.c b/target/nios2/helper.c
index 57c97bde3c..53be8398e9 100644
--- a/target/nios2/helper.c
+++ b/target/nios2/helper.c
@@ -26,7 +26,7 @@
 #include "exec/cpu_ldst.h"
 #include "exec/log.h"
 #include "exec/helper-proto.h"
-#include "hw/semihosting/semihost.h"
+#include "semihosting/semihost.h"
 
 #if defined(CONFIG_USER_ONLY)
 
diff --git a/target/riscv/cpu_helper.c b/target/riscv/cpu_helper.c
index 2f43939fb6..83a6bcfad0 100644
--- a/target/riscv/cpu_helper.c
+++ b/target/riscv/cpu_helper.c
@@ -24,7 +24,7 @@
 #include "exec/exec-all.h"
 #include "tcg/tcg-op.h"
 #include "trace.h"
-#include "hw/semihosting/common-semi.h"
+#include "semihosting/common-semi.h"
 
 int riscv_cpu_mmu_index(CPURISCVState *env, bool ifetch)
 {
diff --git a/target/unicore32/helper.c b/target/unicore32/helper.c
index 54c26871fe..704393c27f 100644
--- a/target/unicore32/helper.c
+++ b/target/unicore32/helper.c
@@ -14,7 +14,7 @@
 #include "cpu.h"
 #include "exec/exec-all.h"
 #include "exec/helper-proto.h"
-#include "hw/semihosting/console.h"
+#include "semihosting/console.h"
 
 #undef DEBUG_UC32
 
diff --git a/target/xtensa/translate.c b/target/xtensa/translate.c
index 944a157747..0ae4efc48a 100644
--- a/target/xtensa/translate.c
+++ b/target/xtensa/translate.c
@@ -37,7 +37,7 @@
 #include "qemu/log.h"
 #include "qemu/qemu-print.h"
 #include "exec/cpu_ldst.h"
-#include "hw/semihosting/semihost.h"
+#include "semihosting/semihost.h"
 #include "exec/translator.h"
 
 #include "exec/helper-proto.h"
diff --git a/target/xtensa/xtensa-semi.c b/target/xtensa/xtensa-semi.c
index 25f57a6500..79f2b043f2 100644
--- a/target/xtensa/xtensa-semi.c
+++ b/target/xtensa/xtensa-semi.c
@@ -29,7 +29,7 @@
 #include "cpu.h"
 #include "chardev/char-fe.h"
 #include "exec/helper-proto.h"
-#include "hw/semihosting/semihost.h"
+#include "semihosting/semihost.h"
 #include "qapi/error.h"
 #include "qemu/log.h"
 
diff --git a/MAINTAINERS b/MAINTAINERS
index b54a22475b..99e9874fd2 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -3243,7 +3243,7 @@ Semihosting
 M: Alex Bennée <alex.bennee@linaro.org>
 S: Maintained
 F: hw/semihosting/
-F: include/hw/semihosting/
+F: include/semihosting/
 
 Multi-process QEMU
 M: Elena Ufimtseva <elena.ufimtseva@oracle.com>
-- 
2.20.1



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

* [PULL 18/18] semihosting: Move hw/semihosting/ -> semihosting/
  2021-03-08 13:50 [PULL 00/18] testing, docs, semihosting move and guest-loader Alex Bennée
                   ` (16 preceding siblings ...)
  2021-03-08 13:51   ` Alex Bennée
@ 2021-03-08 13:51 ` Alex Bennée
  2021-03-08 14:39 ` [PULL 00/18] testing, docs, semihosting move and guest-loader no-reply
  2021-03-09 18:11 ` Peter Maydell
  19 siblings, 0 replies; 38+ messages in thread
From: Alex Bennée @ 2021-03-08 13:51 UTC (permalink / raw)
  To: peter.maydell; +Cc: Alex Bennée, qemu-devel, Philippe Mathieu-Daudé

From: Philippe Mathieu-Daudé <f4bug@amsat.org>

With the exception of hw/core/, the hw/ directory only contains
device models used in system emulation. Semihosting is also used
by user emulation. As a generic feature, move it out of hw/ directory.

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

diff --git a/meson.build b/meson.build
index 81d760d6e8..16dbb6fc12 100644
--- a/meson.build
+++ b/meson.build
@@ -1939,6 +1939,7 @@ subdir('migration')
 subdir('monitor')
 subdir('net')
 subdir('replay')
+subdir('semihosting')
 subdir('hw')
 subdir('accel')
 subdir('plugins')
diff --git a/hw/semihosting/common-semi.h b/semihosting/common-semi.h
similarity index 100%
rename from hw/semihosting/common-semi.h
rename to semihosting/common-semi.h
diff --git a/hw/semihosting/arm-compat-semi.c b/semihosting/arm-compat-semi.c
similarity index 100%
rename from hw/semihosting/arm-compat-semi.c
rename to semihosting/arm-compat-semi.c
diff --git a/hw/semihosting/config.c b/semihosting/config.c
similarity index 100%
rename from hw/semihosting/config.c
rename to semihosting/config.c
diff --git a/hw/semihosting/console.c b/semihosting/console.c
similarity index 100%
rename from hw/semihosting/console.c
rename to semihosting/console.c
diff --git a/Kconfig b/Kconfig
index bf694c42af..d52ebd839b 100644
--- a/Kconfig
+++ b/Kconfig
@@ -2,3 +2,4 @@ source Kconfig.host
 source backends/Kconfig
 source accel/Kconfig
 source hw/Kconfig
+source semihosting/Kconfig
diff --git a/MAINTAINERS b/MAINTAINERS
index 99e9874fd2..8956bd2f32 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -3242,7 +3242,7 @@ F: qapi/rdma.json
 Semihosting
 M: Alex Bennée <alex.bennee@linaro.org>
 S: Maintained
-F: hw/semihosting/
+F: semihosting/
 F: include/semihosting/
 
 Multi-process QEMU
diff --git a/hw/Kconfig b/hw/Kconfig
index 8ea26479c4..ff40bd3f7b 100644
--- a/hw/Kconfig
+++ b/hw/Kconfig
@@ -31,7 +31,6 @@ source remote/Kconfig
 source rtc/Kconfig
 source scsi/Kconfig
 source sd/Kconfig
-source semihosting/Kconfig
 source smbios/Kconfig
 source ssi/Kconfig
 source timer/Kconfig
diff --git a/hw/meson.build b/hw/meson.build
index e615d72d4d..8ba79b1a52 100644
--- a/hw/meson.build
+++ b/hw/meson.build
@@ -30,7 +30,6 @@ subdir('rdma')
 subdir('rtc')
 subdir('scsi')
 subdir('sd')
-subdir('semihosting')
 subdir('smbios')
 subdir('ssi')
 subdir('timer')
diff --git a/hw/semihosting/Kconfig b/semihosting/Kconfig
similarity index 100%
rename from hw/semihosting/Kconfig
rename to semihosting/Kconfig
diff --git a/hw/semihosting/meson.build b/semihosting/meson.build
similarity index 100%
rename from hw/semihosting/meson.build
rename to semihosting/meson.build
-- 
2.20.1



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

* Re: [PULL 00/18] testing, docs, semihosting move and guest-loader
  2021-03-08 13:50 [PULL 00/18] testing, docs, semihosting move and guest-loader Alex Bennée
                   ` (17 preceding siblings ...)
  2021-03-08 13:51 ` [PULL 18/18] semihosting: Move hw/semihosting/ -> semihosting/ Alex Bennée
@ 2021-03-08 14:39 ` no-reply
  2021-03-09 18:11 ` Peter Maydell
  19 siblings, 0 replies; 38+ messages in thread
From: no-reply @ 2021-03-08 14:39 UTC (permalink / raw)
  To: alex.bennee; +Cc: peter.maydell, alex.bennee, qemu-devel

Patchew URL: https://patchew.org/QEMU/20210308135104.24903-1-alex.bennee@linaro.org/



Hi,

This series seems to have some coding style problems. See output below for
more information:

Type: series
Message-id: 20210308135104.24903-1-alex.bennee@linaro.org
Subject: [PULL 00/18] testing, docs, semihosting move and guest-loader

=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram
./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
 * [new tag]         patchew/20210308135104.24903-1-alex.bennee@linaro.org -> patchew/20210308135104.24903-1-alex.bennee@linaro.org
Switched to a new branch 'test'
d4615d7 semihosting: Move hw/semihosting/ -> semihosting/
11ff336 semihosting: Move include/hw/semihosting/ -> include/semihosting/
6ff470d tests/avocado: add boot_xen tests
366972f docs: add some documentation for the guest-loader
2de6334 docs: move generic-loader documentation into the main manual
3540331 hw/core: implement a guest-loader to support static hypervisor guests
59152d4 device_tree: add qemu_fdt_setprop_string_array helper
5e73c0a hw/riscv: migrate fdt field to generic MachineState
97b2110 hw/board: promote fdt from ARM VirtMachineState to MachineState
8e087e0 .editorconfig: update the automatic mode setting for Emacs
b19b8a9 tests/docker: Use --arch-only when building Debian cross image
7904ddd gitlab-ci.yml: Add jobs to test CFI flags
c0b1a18 gitlab-ci.yml: Allow custom # of parallel linkers
06aaa2a gitlab: add build-user-hexagon test
6e13d36 tests/tcg: Use Hexagon Docker image
d1e83eb docker: Add Hexagon image
0cedc72 tests/docker: add a test-tcg for building then running check-tcg
1463a1a docs/system: add a gentle prompt for the complexity to come

=== OUTPUT BEGIN ===
1/18 Checking commit 1463a1add7ee (docs/system: add a gentle prompt for the complexity to come)
2/18 Checking commit 0cedc725cfc7 (tests/docker: add a test-tcg for building then running check-tcg)
Use of uninitialized value $acpi_testexpected in string eq at ./scripts/checkpatch.pl line 1529.
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
#20: 
new file mode 100755

total: 0 errors, 1 warnings, 22 lines checked

Patch 2/18 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
3/18 Checking commit d1e83ebe6917 (docker: Add Hexagon image)
WARNING: line over 80 characters
#154: FILE: tests/docker/dockerfiles/debian-hexagon-cross.docker.d/build-toolchain.sh:63:
+    -DCMAKE_ASM_FLAGS="-G0 -mlong-calls -fno-pic --target=hexagon-unknown-linux-musl " \

ERROR: line over 90 characters
#181: FILE: tests/docker/dockerfiles/debian-hexagon-cross.docker.d/build-toolchain.sh:90:
+    CROSS_CFLAGS="-G0 -O0 -mv65 -fno-builtin -fno-rounding-math --target=hexagon-unknown-linux-musl" \

ERROR: line over 90 characters
#218: FILE: tests/docker/dockerfiles/debian-hexagon-cross.docker.d/build-toolchain.sh:127:
+    CFLAGS="-G0 -O0 -mv65 -fno-builtin -fno-rounding-math --target=hexagon-unknown-linux-musl" \

total: 2 errors, 1 warnings, 184 lines checked

Patch 3/18 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

4/18 Checking commit 6e13d36db441 (tests/tcg: Use Hexagon Docker image)
5/18 Checking commit 06aaa2a233b0 (gitlab: add build-user-hexagon test)
6/18 Checking commit c0b1a1890207 (gitlab-ci.yml: Allow custom # of parallel linkers)
7/18 Checking commit 7904dddf9a7d (gitlab-ci.yml: Add jobs to test CFI flags)
8/18 Checking commit b19b8a9ffcc3 (tests/docker: Use --arch-only when building Debian cross image)
9/18 Checking commit 8e087e006cee (.editorconfig: update the automatic mode setting for Emacs)
10/18 Checking commit 97b211043a1b (hw/board: promote fdt from ARM VirtMachineState to MachineState)
11/18 Checking commit 5e73c0a7598b (hw/riscv: migrate fdt field to generic MachineState)
12/18 Checking commit 59152d4b2f5e (device_tree: add qemu_fdt_setprop_string_array helper)
13/18 Checking commit 354033138a38 (hw/core: implement a guest-loader to support static hypervisor guests)
14/18 Checking commit 2de63345e199 (docs: move generic-loader documentation into the main manual)
15/18 Checking commit 366972f9a48b (docs: add some documentation for the guest-loader)
16/18 Checking commit 6ff470d25fc6 (tests/avocado: add boot_xen tests)
WARNING: line over 80 characters
#96: FILE: tests/acceptance/boot_xen.py:56:
+                         'guest-loader,addr=0x47000000,kernel=%s,bootargs=console=hvc0'

WARNING: line over 80 characters
#118: FILE: tests/acceptance/boot_xen.py:78:
+                   'xen-hypervisor-4.11-arm64_4.11.4%2B37-g3263f257ca-1_arm64.deb')

WARNING: line over 80 characters
#136: FILE: tests/acceptance/boot_xen.py:96:
+                   'xen-hypervisor-4.14-arm64_4.14.0%2B80-gd101b417b7-1_arm64.deb')

total: 0 errors, 3 warnings, 125 lines checked

Patch 16/18 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
17/18 Checking commit 11ff336713dd (semihosting: Move include/hw/semihosting/ -> include/semihosting/)
18/18 Checking commit d4615d7502e5 (semihosting: Move hw/semihosting/ -> semihosting/)
=== OUTPUT END ===

Test command exited with code: 1


The full log is available at
http://patchew.org/logs/20210308135104.24903-1-alex.bennee@linaro.org/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-devel@redhat.com

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

* Re: [PULL 00/18] testing, docs, semihosting move and guest-loader
  2021-03-08 13:50 [PULL 00/18] testing, docs, semihosting move and guest-loader Alex Bennée
                   ` (18 preceding siblings ...)
  2021-03-08 14:39 ` [PULL 00/18] testing, docs, semihosting move and guest-loader no-reply
@ 2021-03-09 18:11 ` Peter Maydell
  2021-03-09 18:37   ` Alex Bennée
  2021-03-10 10:41   ` Alex Bennée
  19 siblings, 2 replies; 38+ messages in thread
From: Peter Maydell @ 2021-03-09 18:11 UTC (permalink / raw)
  To: Alex Bennée; +Cc: QEMU Developers

On Mon, 8 Mar 2021 at 13:51, Alex Bennée <alex.bennee@linaro.org> wrote:
>
> The following changes since commit 91e92cad67caca3bc4b8e920ddb5c8ca64aac9e1:
>
>   Merge remote-tracking branch 'remotes/cohuck-gitlab/tags/s390x-20210305' into staging (2021-03-05 19:04:47 +0000)
>
> are available in the Git repository at:
>
>   https://github.com/stsquad/qemu.git tags/pull-testing-docs-xen-updates-080321-1
>
> for you to fetch changes up to 8109b8cadf5979a29b4b6e1ca7288bc0ee676426:
>
>   semihosting: Move hw/semihosting/ -> semihosting/ (2021-03-08 12:15:05 +0000)
>
> ----------------------------------------------------------------
> Testing, guest-loader and other misc tweaks
>
>   - add warning text to quickstart example
>   - add support for hexagon check-tcg tests
>   - add CFI tests to CI
>   - use --arch-only for docker pre-requisites
>   - fix .editorconfig for emacs
>   - add guest-loader for Xen-like hypervisor testing
>   - move generic-loader docs into manual proper
>   - move semihosting out of hw/

Fails on x86-64 trying to do something with docker:

make: Entering directory
'/home/petmay01/linaro/qemu-for-merges/build/all-linux-static'
/home/petmay01/linaro/qemu-for-merges/tests/docker/docker.py --engine
auto build -t qemu/debian-hexagon-cross -f
/home/petmay01/linaro/qemu-for-merges/tests/docker/dockerfiles/debian-hexagon-cross.docker
  --registry registry.gitlab.com/qemu-project/qemu --add-current-user
--extra-files /home/petmay01/linaro/qemu-for-merges/tests/docker/dockerfiles/debian-hexagon-cross.docker.d/build-toolchain.sh
Using default tag: latest
latest: Pulling from qemu-project/qemu/qemu/debian10
Digest: sha256:4f96b88d2c3cf59d46d6173d86f240ef7b4f2b68509e6e5eec7b179aa1bfbf74
Status: Image is up to date for
registry.gitlab.com/qemu-project/qemu/qemu/debian10:latest
Using default tag: latest
latest: Pulling from qemu-project/qemu/qemu/debian-hexagon-cross
45b42c59be33: Already exists
7a55fd5ded7c: Already exists
[...]

40ae5f465547: Pull complete
Digest: sha256:c5f3e6f6a761c17570945059e60297352380379f9222fe444f998c6ea7e9d4ce
Status: Downloaded newer image for
registry.gitlab.com/qemu-project/qemu/qemu/debian-hexagon-cross:latest

#1 [internal] load build definition from tmplp8d2u1p.docker
#1       digest:
sha256:639f37ba0ced2cf59254e62ec107d1d7ccd627d6876fb2b465f50c88c4baa44d
#1         name: "[internal] load build definition from tmplp8d2u1p.docker"
#1      started: 2021-03-09 16:53:55.092177401 +0000 UTC
#1    completed: 2021-03-09 16:53:55.092271396 +0000 UTC
#1     duration: 93.995µs
#1      started: 2021-03-09 16:53:55.092598107 +0000 UTC
#1    completed: 2021-03-09 16:53:55.188002068 +0000 UTC
#1     duration: 95.403961ms
#1 transferring dockerfile: 1.26kB done

[...]
#9 [internal] load build context
#9      started: 2021-03-09 16:53:56.338003711 +0000 UTC
#9    completed: 2021-03-09 16:53:56.42858509 +0000 UTC
#9     duration: 90.581379ms
#9 transferring context: 4.19kB done


#7 [2/6] RUN apt update &&     DEBIAN_FRONTEND=noninteractive eatmydata    ...
#7       digest:
sha256:d73bbaa9b5d86f286257ada3d545250e61e000c22c1f971f003578dc00661346
#7         name: "[2/6] RUN apt update &&
DEBIAN_FRONTEND=noninteractive eatmydata     apt build-dep -yy qemu"
#7      started: 2021-03-09 16:53:56.338854291 +0000 UTC
#7 0.553
#7 0.553 WARNING: apt does not have a stable CLI interface. Use with
caution in scripts.
#7 0.553
#7    completed: 2021-03-09 16:54:00.554068941 +0000 UTC
#7     duration: 4.21521465s
#7        error: "executor failed running [/bin/sh -c apt update &&
 DEBIAN_FRONTEND=noninteractive eatmydata     apt build-dep -yy qemu]:
exit code: 137: context canceled: context canceled"

error on cache query: invalid build cache from
{MediaType:application/vnd.docker.distribution.manifest.v2+json
Digest:sha256:c5f3e6f6a761c17570945059e60297352380379f9222fe444f998c6ea7e9d4ce
Size:2009 URLs:[] Annotations:map[] Platform:<nil>}
Traceback (most recent call last):
  File "/home/petmay01/linaro/qemu-for-merges/tests/docker/docker.py",
line 720, in <module>
    sys.exit(main())
  File "/home/petmay01/linaro/qemu-for-merges/tests/docker/docker.py",
line 716, in main
    return args.cmdobj.run(args, argv)
  File "/home/petmay01/linaro/qemu-for-merges/tests/docker/docker.py",
line 512, in run
    extra_files_cksum=cksum)
  File "/home/petmay01/linaro/qemu-for-merges/tests/docker/docker.py",
line 360, in build_image
    quiet=quiet)
  File "/home/petmay01/linaro/qemu-for-merges/tests/docker/docker.py",
line 250, in _do_check
    return subprocess.check_call(self._command + cmd, **kwargs)
  File "/usr/lib/python3.6/subprocess.py", line 311, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['docker', 'build', '-t',
'qemu/debian-hexagon-cross', '-f',
'/tmp/docker_buildpuzztpb1/tmplp8d2u1p.docker', '--build-arg',
'BUILDKIT_INLINE_CACHE=1', '--cache-from',
'registry.gitlab.com/qemu-project/qemu/qemu/debian-hexagon-cross',
'/tmp/docker_buildpuzztpb1']' returned non-zero exit status 1.
/home/petmay01/linaro/qemu-for-merges/tests/docker/Makefile.include:59:
recipe for target 'docker-image-debian-hexagon-cross' failed
make: *** [docker-image-debian-hexagon-cross] Error 1

thanks
-- PMM


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

* Re: [PULL 00/18] testing, docs, semihosting move and guest-loader
  2021-03-09 18:11 ` Peter Maydell
@ 2021-03-09 18:37   ` Alex Bennée
  2021-03-09 21:33     ` Peter Maydell
  2021-03-09 22:26     ` Philippe Mathieu-Daudé
  2021-03-10 10:41   ` Alex Bennée
  1 sibling, 2 replies; 38+ messages in thread
From: Alex Bennée @ 2021-03-09 18:37 UTC (permalink / raw)
  To: Peter Maydell; +Cc: QEMU Developers


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

> On Mon, 8 Mar 2021 at 13:51, Alex Bennée <alex.bennee@linaro.org> wrote:
>>
>> The following changes since commit 91e92cad67caca3bc4b8e920ddb5c8ca64aac9e1:
>>
>>   Merge remote-tracking branch 'remotes/cohuck-gitlab/tags/s390x-20210305' into staging (2021-03-05 19:04:47 +0000)
>>
>> are available in the Git repository at:
>>
>>   https://github.com/stsquad/qemu.git tags/pull-testing-docs-xen-updates-080321-1
>>
>> for you to fetch changes up to 8109b8cadf5979a29b4b6e1ca7288bc0ee676426:
>>
>>   semihosting: Move hw/semihosting/ -> semihosting/ (2021-03-08 12:15:05 +0000)
>>
>> ----------------------------------------------------------------
>> Testing, guest-loader and other misc tweaks
>>
>>   - add warning text to quickstart example
>>   - add support for hexagon check-tcg tests
>>   - add CFI tests to CI
>>   - use --arch-only for docker pre-requisites
>>   - fix .editorconfig for emacs
>>   - add guest-loader for Xen-like hypervisor testing
>>   - move generic-loader docs into manual proper
>>   - move semihosting out of hw/
>
> Fails on x86-64 trying to do something with docker:
>
> make: Entering directory
> '/home/petmay01/linaro/qemu-for-merges/build/all-linux-static'
> /home/petmay01/linaro/qemu-for-merges/tests/docker/docker.py --engine
> auto build -t qemu/debian-hexagon-cross -f
> /home/petmay01/linaro/qemu-for-merges/tests/docker/dockerfiles/debian-hexagon-cross.docker
>   --registry registry.gitlab.com/qemu-project/qemu --add-current-user
> --extra-files /home/petmay01/linaro/qemu-for-merges/tests/docker/dockerfiles/debian-hexagon-cross.docker.d/build-toolchain.sh
> Using default tag: latest
> latest: Pulling from qemu-project/qemu/qemu/debian10
> Digest: sha256:4f96b88d2c3cf59d46d6173d86f240ef7b4f2b68509e6e5eec7b179aa1bfbf74
> Status: Image is up to date for
> registry.gitlab.com/qemu-project/qemu/qemu/debian10:latest
> Using default tag: latest
> latest: Pulling from qemu-project/qemu/qemu/debian-hexagon-cross
> 45b42c59be33: Already exists
> 7a55fd5ded7c: Already exists
> [...]
>
> 40ae5f465547: Pull complete
> Digest: sha256:c5f3e6f6a761c17570945059e60297352380379f9222fe444f998c6ea7e9d4ce
> Status: Downloaded newer image for
> registry.gitlab.com/qemu-project/qemu/qemu/debian-hexagon-cross:latest
>
> #1 [internal] load build definition from tmplp8d2u1p.docker
> #1       digest:
> sha256:639f37ba0ced2cf59254e62ec107d1d7ccd627d6876fb2b465f50c88c4baa44d
> #1         name: "[internal] load build definition from tmplp8d2u1p.docker"
> #1      started: 2021-03-09 16:53:55.092177401 +0000 UTC
> #1    completed: 2021-03-09 16:53:55.092271396 +0000 UTC
> #1     duration: 93.995µs
> #1      started: 2021-03-09 16:53:55.092598107 +0000 UTC
> #1    completed: 2021-03-09 16:53:55.188002068 +0000 UTC
> #1     duration: 95.403961ms
> #1 transferring dockerfile: 1.26kB done
>
> [...]
> #9 [internal] load build context
> #9      started: 2021-03-09 16:53:56.338003711 +0000 UTC
> #9    completed: 2021-03-09 16:53:56.42858509 +0000 UTC
> #9     duration: 90.581379ms
> #9 transferring context: 4.19kB done
>
>
> #7 [2/6] RUN apt update &&     DEBIAN_FRONTEND=noninteractive eatmydata    ...
> #7       digest:
> sha256:d73bbaa9b5d86f286257ada3d545250e61e000c22c1f971f003578dc00661346
> #7         name: "[2/6] RUN apt update &&
> DEBIAN_FRONTEND=noninteractive eatmydata     apt build-dep -yy qemu"
> #7      started: 2021-03-09 16:53:56.338854291 +0000 UTC
> #7 0.553
> #7 0.553 WARNING: apt does not have a stable CLI interface. Use with
> caution in scripts.
> #7 0.553
> #7    completed: 2021-03-09 16:54:00.554068941 +0000 UTC
> #7     duration: 4.21521465s
> #7        error: "executor failed running [/bin/sh -c apt update &&
>  DEBIAN_FRONTEND=noninteractive eatmydata     apt build-dep -yy qemu]:
> exit code: 137: context canceled: context canceled"
>
> error on cache query: invalid build cache from
> {MediaType:application/vnd.docker.distribution.manifest.v2+json
> Digest:sha256:c5f3e6f6a761c17570945059e60297352380379f9222fe444f998c6ea7e9d4ce
> Size:2009 URLs:[] Annotations:map[] Platform:<nil>}
> Traceback (most recent call last):
>   File "/home/petmay01/linaro/qemu-for-merges/tests/docker/docker.py",
> line 720, in <module>
>     sys.exit(main())
>   File "/home/petmay01/linaro/qemu-for-merges/tests/docker/docker.py",
> line 716, in main
>     return args.cmdobj.run(args, argv)
>   File "/home/petmay01/linaro/qemu-for-merges/tests/docker/docker.py",
> line 512, in run
>     extra_files_cksum=cksum)
>   File "/home/petmay01/linaro/qemu-for-merges/tests/docker/docker.py",
> line 360, in build_image
>     quiet=quiet)
>   File "/home/petmay01/linaro/qemu-for-merges/tests/docker/docker.py",
> line 250, in _do_check
>     return subprocess.check_call(self._command + cmd, **kwargs)
>   File "/usr/lib/python3.6/subprocess.py", line 311, in check_call
>     raise CalledProcessError(retcode, cmd)
> subprocess.CalledProcessError: Command '['docker', 'build', '-t',
> 'qemu/debian-hexagon-cross', '-f',
> '/tmp/docker_buildpuzztpb1/tmplp8d2u1p.docker', '--build-arg',
> 'BUILDKIT_INLINE_CACHE=1', '--cache-from',
> 'registry.gitlab.com/qemu-project/qemu/qemu/debian-hexagon-cross',
> '/tmp/docker_buildpuzztpb1']' returned non-zero exit status 1.
> /home/petmay01/linaro/qemu-for-merges/tests/docker/Makefile.include:59:
> recipe for target 'docker-image-debian-hexagon-cross' failed
> make: *** [docker-image-debian-hexagon-cross] Error 1

Hmm that's weird. What machine are you running on?

>
> thanks
> -- PMM


-- 
Alex Bennée


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

* Re: [PULL 00/18] testing, docs, semihosting move and guest-loader
  2021-03-09 18:37   ` Alex Bennée
@ 2021-03-09 21:33     ` Peter Maydell
  2021-03-09 22:26     ` Philippe Mathieu-Daudé
  1 sibling, 0 replies; 38+ messages in thread
From: Peter Maydell @ 2021-03-09 21:33 UTC (permalink / raw)
  To: Alex Bennée; +Cc: QEMU Developers

On Tue, 9 Mar 2021 at 18:38, Alex Bennée <alex.bennee@linaro.org> wrote:
>
>
> Peter Maydell <peter.maydell@linaro.org> writes:
> >
> > Fails on x86-64 trying to do something with docker:

> Hmm that's weird. What machine are you running on?

Ubuntu 18.04.5 LTS.

-- PMM


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

* Re: [PULL 00/18] testing, docs, semihosting move and guest-loader
  2021-03-09 18:37   ` Alex Bennée
  2021-03-09 21:33     ` Peter Maydell
@ 2021-03-09 22:26     ` Philippe Mathieu-Daudé
  1 sibling, 0 replies; 38+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-03-09 22:26 UTC (permalink / raw)
  To: Alex Bennée, Peter Maydell; +Cc: QEMU Developers

On 3/9/21 7:37 PM, Alex Bennée wrote:
> 
> Peter Maydell <peter.maydell@linaro.org> writes:
> 
>> On Mon, 8 Mar 2021 at 13:51, Alex Bennée <alex.bennee@linaro.org> wrote:
>>>
>>> The following changes since commit 91e92cad67caca3bc4b8e920ddb5c8ca64aac9e1:
>>>
>>>   Merge remote-tracking branch 'remotes/cohuck-gitlab/tags/s390x-20210305' into staging (2021-03-05 19:04:47 +0000)
>>>
>>> are available in the Git repository at:
>>>
>>>   https://github.com/stsquad/qemu.git tags/pull-testing-docs-xen-updates-080321-1
>>>
>>> for you to fetch changes up to 8109b8cadf5979a29b4b6e1ca7288bc0ee676426:
>>>
>>>   semihosting: Move hw/semihosting/ -> semihosting/ (2021-03-08 12:15:05 +0000)
>>>
>>> ----------------------------------------------------------------
>>> Testing, guest-loader and other misc tweaks
>>>
>>>   - add warning text to quickstart example
>>>   - add support for hexagon check-tcg tests
>>>   - add CFI tests to CI
>>>   - use --arch-only for docker pre-requisites
>>>   - fix .editorconfig for emacs
>>>   - add guest-loader for Xen-like hypervisor testing
>>>   - move generic-loader docs into manual proper
>>>   - move semihosting out of hw/
>>
>> Fails on x86-64 trying to do something with docker:
>>
>> make: Entering directory
>> '/home/petmay01/linaro/qemu-for-merges/build/all-linux-static'
>> /home/petmay01/linaro/qemu-for-merges/tests/docker/docker.py --engine
>> auto build -t qemu/debian-hexagon-cross -f
>> /home/petmay01/linaro/qemu-for-merges/tests/docker/dockerfiles/debian-hexagon-cross.docker
>>   --registry registry.gitlab.com/qemu-project/qemu --add-current-user
>> --extra-files /home/petmay01/linaro/qemu-for-merges/tests/docker/dockerfiles/debian-hexagon-cross.docker.d/build-toolchain.sh
>> Using default tag: latest
>> latest: Pulling from qemu-project/qemu/qemu/debian10
>> Digest: sha256:4f96b88d2c3cf59d46d6173d86f240ef7b4f2b68509e6e5eec7b179aa1bfbf74
>> Status: Image is up to date for
>> registry.gitlab.com/qemu-project/qemu/qemu/debian10:latest
>> Using default tag: latest
>> latest: Pulling from qemu-project/qemu/qemu/debian-hexagon-cross
>> 45b42c59be33: Already exists
>> 7a55fd5ded7c: Already exists
>> [...]
>>
>> 40ae5f465547: Pull complete
>> Digest: sha256:c5f3e6f6a761c17570945059e60297352380379f9222fe444f998c6ea7e9d4ce
>> Status: Downloaded newer image for
>> registry.gitlab.com/qemu-project/qemu/qemu/debian-hexagon-cross:latest

^ until here, all good.

>>
>> #1 [internal] load build definition from tmplp8d2u1p.docker
>> #1       digest:
>> sha256:639f37ba0ced2cf59254e62ec107d1d7ccd627d6876fb2b465f50c88c4baa44d
>> #1         name: "[internal] load build definition from tmplp8d2u1p.docker"
>> #1      started: 2021-03-09 16:53:55.092177401 +0000 UTC
>> #1    completed: 2021-03-09 16:53:55.092271396 +0000 UTC
>> #1     duration: 93.995µs
>> #1      started: 2021-03-09 16:53:55.092598107 +0000 UTC
>> #1    completed: 2021-03-09 16:53:55.188002068 +0000 UTC
>> #1     duration: 95.403961ms
>> #1 transferring dockerfile: 1.26kB done
>>
>> [...]
>> #9 [internal] load build context
>> #9      started: 2021-03-09 16:53:56.338003711 +0000 UTC
>> #9    completed: 2021-03-09 16:53:56.42858509 +0000 UTC
>> #9     duration: 90.581379ms
>> #9 transferring context: 4.19kB done
>>
>>
>> #7 [2/6] RUN apt update &&     DEBIAN_FRONTEND=noninteractive eatmydata    ...
>> #7       digest:
>> sha256:d73bbaa9b5d86f286257ada3d545250e61e000c22c1f971f003578dc00661346
>> #7         name: "[2/6] RUN apt update &&
>> DEBIAN_FRONTEND=noninteractive eatmydata     apt build-dep -yy qemu"

^ why is that run?...

>> #7      started: 2021-03-09 16:53:56.338854291 +0000 UTC
>> #7 0.553
>> #7 0.553 WARNING: apt does not have a stable CLI interface. Use with
>> caution in scripts.
>> #7 0.553
>> #7    completed: 2021-03-09 16:54:00.554068941 +0000 UTC
>> #7     duration: 4.21521465s
>> #7        error: "executor failed running [/bin/sh -c apt update &&
>>  DEBIAN_FRONTEND=noninteractive eatmydata     apt build-dep -yy qemu]:
>> exit code: 137: context canceled: context canceled"

:/


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

* Re: [PULL 00/18] testing, docs, semihosting move and guest-loader
  2021-03-09 18:11 ` Peter Maydell
  2021-03-09 18:37   ` Alex Bennée
@ 2021-03-10 10:41   ` Alex Bennée
  2021-03-10 11:10     ` Peter Maydell
  1 sibling, 1 reply; 38+ messages in thread
From: Alex Bennée @ 2021-03-10 10:41 UTC (permalink / raw)
  To: Peter Maydell; +Cc: QEMU Developers


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

> On Mon, 8 Mar 2021 at 13:51, Alex Bennée <alex.bennee@linaro.org> wrote:
>>
>> The following changes since commit 91e92cad67caca3bc4b8e920ddb5c8ca64aac9e1:
>>
>>   Merge remote-tracking branch 'remotes/cohuck-gitlab/tags/s390x-20210305' into staging (2021-03-05 19:04:47 +0000)
>>
>> are available in the Git repository at:
>>
>>   https://github.com/stsquad/qemu.git tags/pull-testing-docs-xen-updates-080321-1
>>
>> for you to fetch changes up to 8109b8cadf5979a29b4b6e1ca7288bc0ee676426:
>>
>>   semihosting: Move hw/semihosting/ -> semihosting/ (2021-03-08 12:15:05 +0000)
>>
>> ----------------------------------------------------------------
>> Testing, guest-loader and other misc tweaks
>>
>>   - add warning text to quickstart example
>>   - add support for hexagon check-tcg tests
>>   - add CFI tests to CI
>>   - use --arch-only for docker pre-requisites
>>   - fix .editorconfig for emacs
>>   - add guest-loader for Xen-like hypervisor testing
>>   - move generic-loader docs into manual proper
>>   - move semihosting out of hw/
>
> Fails on x86-64 trying to do something with docker:
>
> make: Entering directory
> '/home/petmay01/linaro/qemu-for-merges/build/all-linux-static'
> /home/petmay01/linaro/qemu-for-merges/tests/docker/docker.py --engine
> auto build -t qemu/debian-hexagon-cross -f
> /home/petmay01/linaro/qemu-for-merges/tests/docker/dockerfiles/debian-hexagon-cross.docker
>   --registry registry.gitlab.com/qemu-project/qemu --add-current-user
> --extra-files /home/petmay01/linaro/qemu-for-merges/tests/docker/dockerfiles/debian-hexagon-cross.docker.d/build-toolchain.sh
> Using default tag: latest
> latest: Pulling from qemu-project/qemu/qemu/debian10
> Digest: sha256:4f96b88d2c3cf59d46d6173d86f240ef7b4f2b68509e6e5eec7b179aa1bfbf74
> Status: Image is up to date for
> registry.gitlab.com/qemu-project/qemu/qemu/debian10:latest
> Using default tag: latest
> latest: Pulling from qemu-project/qemu/qemu/debian-hexagon-cross
> 45b42c59be33: Already exists
> 7a55fd5ded7c: Already exists
> [...]
>
> 40ae5f465547: Pull complete
> Digest: sha256:c5f3e6f6a761c17570945059e60297352380379f9222fe444f998c6ea7e9d4ce
> Status: Downloaded newer image for
> registry.gitlab.com/qemu-project/qemu/qemu/debian-hexagon-cross:latest
>
> #1 [internal] load build definition from tmplp8d2u1p.docker
> #1       digest:
> sha256:639f37ba0ced2cf59254e62ec107d1d7ccd627d6876fb2b465f50c88c4baa44d
> #1         name: "[internal] load build definition from tmplp8d2u1p.docker"
> #1      started: 2021-03-09 16:53:55.092177401 +0000 UTC
> #1    completed: 2021-03-09 16:53:55.092271396 +0000 UTC
> #1     duration: 93.995µs
> #1      started: 2021-03-09 16:53:55.092598107 +0000 UTC
> #1    completed: 2021-03-09 16:53:55.188002068 +0000 UTC
> #1     duration: 95.403961ms
> #1 transferring dockerfile: 1.26kB done
>
> [...]
> #9 [internal] load build context
> #9      started: 2021-03-09 16:53:56.338003711 +0000 UTC
> #9    completed: 2021-03-09 16:53:56.42858509 +0000 UTC
> #9     duration: 90.581379ms
> #9 transferring context: 4.19kB done
>
>
> #7 [2/6] RUN apt update &&     DEBIAN_FRONTEND=noninteractive eatmydata    ...
> #7       digest:
> sha256:d73bbaa9b5d86f286257ada3d545250e61e000c22c1f971f003578dc00661346
> #7         name: "[2/6] RUN apt update &&
> DEBIAN_FRONTEND=noninteractive eatmydata     apt build-dep -yy qemu"
> #7      started: 2021-03-09 16:53:56.338854291 +0000 UTC
> #7 0.553
> #7 0.553 WARNING: apt does not have a stable CLI interface. Use with
> caution in scripts.
> #7 0.553
> #7    completed: 2021-03-09 16:54:00.554068941 +0000 UTC
> #7     duration: 4.21521465s
> #7        error: "executor failed running [/bin/sh -c apt update &&
>  DEBIAN_FRONTEND=noninteractive eatmydata     apt build-dep -yy qemu]:
> exit code: 137: context canceled: context canceled"
>
> error on cache query: invalid build cache from
> {MediaType:application/vnd.docker.distribution.manifest.v2+json
> Digest:sha256:c5f3e6f6a761c17570945059e60297352380379f9222fe444f998c6ea7e9d4ce
> Size:2009 URLs:[] Annotations:map[] Platform:<nil>}
> Traceback (most recent call last):
>   File "/home/petmay01/linaro/qemu-for-merges/tests/docker/docker.py",
> line 720, in <module>
>     sys.exit(main())
>   File "/home/petmay01/linaro/qemu-for-merges/tests/docker/docker.py",
> line 716, in main
>     return args.cmdobj.run(args, argv)
>   File "/home/petmay01/linaro/qemu-for-merges/tests/docker/docker.py",
> line 512, in run
>     extra_files_cksum=cksum)
>   File "/home/petmay01/linaro/qemu-for-merges/tests/docker/docker.py",
> line 360, in build_image
>     quiet=quiet)
>   File "/home/petmay01/linaro/qemu-for-merges/tests/docker/docker.py",
> line 250, in _do_check
>     return subprocess.check_call(self._command + cmd, **kwargs)
>   File "/usr/lib/python3.6/subprocess.py", line 311, in check_call
>     raise CalledProcessError(retcode, cmd)
> subprocess.CalledProcessError: Command '['docker', 'build', '-t',
> 'qemu/debian-hexagon-cross', '-f',
> '/tmp/docker_buildpuzztpb1/tmplp8d2u1p.docker', '--build-arg',
> 'BUILDKIT_INLINE_CACHE=1', '--cache-from',
> 'registry.gitlab.com/qemu-project/qemu/qemu/debian-hexagon-cross',
> '/tmp/docker_buildpuzztpb1']' returned non-zero exit status 1.
> /home/petmay01/linaro/qemu-for-merges/tests/docker/Makefile.include:59:
> recipe for target 'docker-image-debian-hexagon-cross' failed
> make: *** [docker-image-debian-hexagon-cross] Error 1

I think something has changed on Ubuntu, my system didn't have docker
but after auto-updating it appeared and was a snap:

  10:40 alex@bionic/x86_64  [user.static/testing/next] >which docker
  /snap/bin/docker

I had to pull the usual group shenanigans to enable:

   sudo addgroup --system docker
   sudo adduser $USER docker
   newgrp docker

And then restart it:

   snap disable docker
   snap enable docker

And then I get the same failure as you. Can you confirm the docker
version you have now?

  10:39 alex@bionic/x86_64  [user.static/testing/next] >docker version
  Client:
   Version:           19.03.13
   API version:       1.40
   Go version:        go1.13.15
   Git commit:        cd8016b6bc
   Built:             Fri Feb  5 15:56:39 2021
   OS/Arch:           linux/amd64
   Experimental:      false

  Server:
   Engine:
    Version:          19.03.13
    API version:      1.40 (minimum version 1.12)
    Go version:       go1.13.15
    Git commit:       bd33bbf
    Built:            Fri Feb  5 15:58:24 2021
    OS/Arch:          linux/amd64
    Experimental:     false
   containerd:
    Version:          v1.3.7
    GitCommit:        8fba4e9a7d01810a393d5d25a3621dc101981175
   runc:
    Version:          1.0.0-rc10
    GitCommit:
   docker-init:
    Version:          0.18.0
    GitCommit:        fec3683

-- 
Alex Bennée


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

* Re: [PULL 00/18] testing, docs, semihosting move and guest-loader
  2021-03-10 10:41   ` Alex Bennée
@ 2021-03-10 11:10     ` Peter Maydell
  2021-03-10 13:27       ` Alex Bennée
  0 siblings, 1 reply; 38+ messages in thread
From: Peter Maydell @ 2021-03-10 11:10 UTC (permalink / raw)
  To: Alex Bennée; +Cc: QEMU Developers

On Wed, 10 Mar 2021 at 10:44, Alex Bennée <alex.bennee@linaro.org> wrote:
> And then I get the same failure as you. Can you confirm the docker
> version you have now?

e104462:bionic:qemu$ docker version
Client:
 Version:           18.09.1
 API version:       1.39
 Go version:        go1.10.6
 Git commit:        4c52b90
 Built:             Wed Jan  9 19:35:23 2019
 OS/Arch:           linux/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          18.09.1
  API version:      1.39 (minimum version 1.12)
  Go version:       go1.10.6
  Git commit:       4c52b90
  Built:            Wed Jan  9 19:02:44 2019
  OS/Arch:          linux/amd64
  Experimental:     false

-- PMM


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

* Re: [PULL 00/18] testing, docs, semihosting move and guest-loader
  2021-03-10 11:10     ` Peter Maydell
@ 2021-03-10 13:27       ` Alex Bennée
  2021-03-10 13:53         ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 38+ messages in thread
From: Alex Bennée @ 2021-03-10 13:27 UTC (permalink / raw)
  To: Peter Maydell; +Cc: QEMU Developers


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

> On Wed, 10 Mar 2021 at 10:44, Alex Bennée <alex.bennee@linaro.org> wrote:
>> And then I get the same failure as you. Can you confirm the docker
>> version you have now?
>
> e104462:bionic:qemu$ docker version
> Client:
>  Version:           18.09.1
>  API version:       1.39
>  Go version:        go1.10.6
>  Git commit:        4c52b90
>  Built:             Wed Jan  9 19:35:23 2019
>  OS/Arch:           linux/amd64
>  Experimental:      false
>
> Server: Docker Engine - Community
>  Engine:
>   Version:          18.09.1
>   API version:      1.39 (minimum version 1.12)
>   Go version:       go1.10.6
>   Git commit:       4c52b90
>   Built:            Wed Jan  9 19:02:44 2019
>   OS/Arch:          linux/amd64
>   Experimental:     false

I swapped out the snap docker for the docker.io package from the
repository but it's still a newer version than yours:

  13:25 alex@bionic/x86_64  [user.static/testing/next] >docker version
  Client:
   Version:           19.03.6
   API version:       1.40
   Go version:        go1.12.17
   Git commit:        369ce74a3c
   Built:             Fri Dec 18 12:21:44 2020
   OS/Arch:           linux/amd64
   Experimental:      false

  Server:
   Engine:
    Version:          19.03.6
    API version:      1.40 (minimum version 1.12)
    Go version:       go1.12.17
    Git commit:       369ce74a3c
    Built:            Thu Dec 10 13:23:49 2020
    OS/Arch:          linux/amd64
    Experimental:     false
   containerd:
    Version:          1.3.3-0ubuntu1~18.04.4
    GitCommit:
   runc:
    Version:          spec: 1.0.1-dev
    GitCommit:
   docker-init:
    Version:          0.18.0
    GitCommit:

So I guess somehow we've regressed something that doesn't work on the
older version on your system. I can't recreate anything like your
failure unless I switch to the snap version (which I think is related to
visibility of file-systems from the snap) so perhaps we just need to
detect that somehow and disable docker support?

-- 
Alex Bennée


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

* Re: [PULL 00/18] testing, docs, semihosting move and guest-loader
  2021-03-10 13:27       ` Alex Bennée
@ 2021-03-10 13:53         ` Philippe Mathieu-Daudé
  2021-03-10 15:47           ` Alex Bennée
  0 siblings, 1 reply; 38+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-03-10 13:53 UTC (permalink / raw)
  To: Alex Bennée, Peter Maydell; +Cc: QEMU Developers

On 3/10/21 2:27 PM, Alex Bennée wrote:
> 
> Peter Maydell <peter.maydell@linaro.org> writes:
> 
>> On Wed, 10 Mar 2021 at 10:44, Alex Bennée <alex.bennee@linaro.org> wrote:
>>> And then I get the same failure as you. Can you confirm the docker
>>> version you have now?
>>
>> e104462:bionic:qemu$ docker version
>> Client:
>>  Version:           18.09.1
>>  API version:       1.39
>>  Go version:        go1.10.6
>>  Git commit:        4c52b90
>>  Built:             Wed Jan  9 19:35:23 2019
>>  OS/Arch:           linux/amd64
>>  Experimental:      false
>>
>> Server: Docker Engine - Community
>>  Engine:
>>   Version:          18.09.1
>>   API version:      1.39 (minimum version 1.12)
>>   Go version:       go1.10.6
>>   Git commit:       4c52b90
>>   Built:            Wed Jan  9 19:02:44 2019
>>   OS/Arch:          linux/amd64
>>   Experimental:     false
> 
> I swapped out the snap docker for the docker.io package from the
> repository but it's still a newer version than yours:
> 
>   13:25 alex@bionic/x86_64  [user.static/testing/next] >docker version
>   Client:
>    Version:           19.03.6
>    API version:       1.40
>    Go version:        go1.12.17
>    Git commit:        369ce74a3c
>    Built:             Fri Dec 18 12:21:44 2020
>    OS/Arch:           linux/amd64
>    Experimental:      false
> 
>   Server:
>    Engine:
>     Version:          19.03.6
>     API version:      1.40 (minimum version 1.12)
>     Go version:       go1.12.17
>     Git commit:       369ce74a3c
>     Built:            Thu Dec 10 13:23:49 2020
>     OS/Arch:          linux/amd64
>     Experimental:     false
>    containerd:
>     Version:          1.3.3-0ubuntu1~18.04.4
>     GitCommit:
>    runc:
>     Version:          spec: 1.0.1-dev
>     GitCommit:
>    docker-init:
>     Version:          0.18.0
>     GitCommit:
> 
> So I guess somehow we've regressed something that doesn't work on the
> older version on your system. I can't recreate anything like your
> failure unless I switch to the snap version (which I think is related to
> visibility of file-systems from the snap) so perhaps we just need to
> detect that somehow and disable docker support?

Why is Peter's Docker trying to rebuild the downloaded image?
Is it something the docker.py script is doing (like final step)
that invalidate the cache?

Peter, just to remove one variable from the equation, your system
RTC is correct?

Alex, why not simply remove the 2 Hexagon patches from your pullreq
until we figure this out?

Phil.


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

* Re: [PULL 00/18] testing, docs, semihosting move and guest-loader
  2021-03-10 13:53         ` Philippe Mathieu-Daudé
@ 2021-03-10 15:47           ` Alex Bennée
  0 siblings, 0 replies; 38+ messages in thread
From: Alex Bennée @ 2021-03-10 15:47 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Alessandro Di Federico, Peter Maydell, QEMU Developers, Brian Cain


Philippe Mathieu-Daudé <f4bug@amsat.org> writes:

> On 3/10/21 2:27 PM, Alex Bennée wrote:
>> 
>> Peter Maydell <peter.maydell@linaro.org> writes:
>> 
>>> On Wed, 10 Mar 2021 at 10:44, Alex Bennée <alex.bennee@linaro.org> wrote:
>>>> And then I get the same failure as you. Can you confirm the docker
>>>> version you have now?
>>>
>>> e104462:bionic:qemu$ docker version
>>> Client:
>>>  Version:           18.09.1
>>>  API version:       1.39
>>>  Go version:        go1.10.6
>>>  Git commit:        4c52b90
>>>  Built:             Wed Jan  9 19:35:23 2019
>>>  OS/Arch:           linux/amd64
>>>  Experimental:      false
>>>
>>> Server: Docker Engine - Community
>>>  Engine:
>>>   Version:          18.09.1
>>>   API version:      1.39 (minimum version 1.12)
>>>   Go version:       go1.10.6
>>>   Git commit:       4c52b90
>>>   Built:            Wed Jan  9 19:02:44 2019
>>>   OS/Arch:          linux/amd64
>>>   Experimental:     false
>> 
>> I swapped out the snap docker for the docker.io package from the
>> repository but it's still a newer version than yours:
>> 
>>   13:25 alex@bionic/x86_64  [user.static/testing/next] >docker version
>>   Client:
>>    Version:           19.03.6
>>    API version:       1.40
>>    Go version:        go1.12.17
>>    Git commit:        369ce74a3c
>>    Built:             Fri Dec 18 12:21:44 2020
>>    OS/Arch:           linux/amd64
>>    Experimental:      false
>> 
>>   Server:
>>    Engine:
>>     Version:          19.03.6
>>     API version:      1.40 (minimum version 1.12)
>>     Go version:       go1.12.17
>>     Git commit:       369ce74a3c
>>     Built:            Thu Dec 10 13:23:49 2020
>>     OS/Arch:          linux/amd64
>>     Experimental:     false
>>    containerd:
>>     Version:          1.3.3-0ubuntu1~18.04.4
>>     GitCommit:
>>    runc:
>>     Version:          spec: 1.0.1-dev
>>     GitCommit:
>>    docker-init:
>>     Version:          0.18.0
>>     GitCommit:
>> 
>> So I guess somehow we've regressed something that doesn't work on the
>> older version on your system. I can't recreate anything like your
>> failure unless I switch to the snap version (which I think is related to
>> visibility of file-systems from the snap) so perhaps we just need to
>> detect that somehow and disable docker support?
>
> Why is Peter's Docker trying to rebuild the downloaded image?
> Is it something the docker.py script is doing (like final step)
> that invalidate the cache?
>
> Peter, just to remove one variable from the equation, your system
> RTC is correct?
>
> Alex, why not simply remove the 2 Hexagon patches from your pullreq
> until we figure this out?

Yeah I'm going to drop them for now. I think we need to:

 - ensure re-builds aren't triggered normally when they should be cached
   - I think this means the hexagon build should be standalone
   - possible also properly split using multi-stage builds
 - upload a NOUSER variant of the build (--add-user should be a local change)
 - detect snap versions of docker?   

>
> Phil.


-- 
Alex Bennée


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

* Re: [PULL 13/18] hw/core: implement a guest-loader to support static hypervisor guests
  2021-03-08 13:50 ` [PULL 13/18] hw/core: implement a guest-loader to support static hypervisor guests Alex Bennée
@ 2021-03-15 16:16   ` Christian Borntraeger
  2021-03-15 16:44     ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 38+ messages in thread
From: Christian Borntraeger @ 2021-03-15 16:16 UTC (permalink / raw)
  To: Alex Bennée, peter.maydell
  Cc: Philippe Mathieu-Daudé, Alistair Francis, qemu-devel



On 08.03.21 14:50, Alex Bennée wrote:
> Hypervisors, especially type-1 ones, need the firmware/bootcode to put
> their initial guest somewhere in memory and pass the information to it
> via platform data. The guest-loader is modelled after the generic
> loader for exactly this sort of purpose:
> 
>    $QEMU $ARGS  -kernel ~/xen.git/xen/xen \
>      -append "dom0_mem=1G,max:1G loglvl=all guest_loglvl=all" \
>      -device guest-loader,addr=0x42000000,kernel=Image,bootargs="root=/dev/sda2 ro console=hvc0 earlyprintk=xen" \
>      -device guest-loader,addr=0x47000000,initrd=rootfs.cpio
> 
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> Message-Id: <20210303173642.3805-5-alex.bennee@linaro.org>
> 

This now results in

     /usr/bin/ld: libcommon.fa.p/hw_core_guest-loader.c.o: in function `loader_insert_platform_data':
     build/../hw/core/guest-loader.c:56: undefined reference to `qemu_fdt_add_subnode'
     /usr/bin/ld: build/../hw/core/guest-loader.c:57: undefined reference to `qemu_fdt_setprop'
     /usr/bin/ld: build/../hw/core/guest-loader.c:61: undefined reference to `qemu_fdt_setprop_string_array'
     /usr/bin/ld: build/../hw/core/guest-loader.c:68: undefined reference to `qemu_fdt_setprop_string'
     /usr/bin/ld: build/../hw/core/guest-loader.c:74: undefined reference to `qemu_fdt_setprop_string_array'
     collect2: error: ld returned 1 exit status
     ninja: build stopped: subcommand failed.

when building s390-softmmu on s390 with  --disable-fdt, which was in my build script.


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

* Re: [PULL 13/18] hw/core: implement a guest-loader to support static hypervisor guests
  2021-03-15 16:16   ` Christian Borntraeger
@ 2021-03-15 16:44     ` Philippe Mathieu-Daudé
  2021-03-15 16:51       ` Philippe Mathieu-Daudé
  2021-03-15 16:52       ` Christian Borntraeger
  0 siblings, 2 replies; 38+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-03-15 16:44 UTC (permalink / raw)
  To: Christian Borntraeger, Alex Bennée, peter.maydell
  Cc: Alistair Francis, qemu-devel

On 3/15/21 5:16 PM, Christian Borntraeger wrote:
> 
> 
> On 08.03.21 14:50, Alex Bennée wrote:
>> Hypervisors, especially type-1 ones, need the firmware/bootcode to put
>> their initial guest somewhere in memory and pass the information to it
>> via platform data. The guest-loader is modelled after the generic
>> loader for exactly this sort of purpose:
>>
>>    $QEMU $ARGS  -kernel ~/xen.git/xen/xen \
>>      -append "dom0_mem=1G,max:1G loglvl=all guest_loglvl=all" \
>>      -device
>> guest-loader,addr=0x42000000,kernel=Image,bootargs="root=/dev/sda2 ro
>> console=hvc0 earlyprintk=xen" \
>>      -device guest-loader,addr=0x47000000,initrd=rootfs.cpio
>>
>> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
>> Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
>> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
>> Message-Id: <20210303173642.3805-5-alex.bennee@linaro.org>
>>
> 
> This now results in
> 
>     /usr/bin/ld: libcommon.fa.p/hw_core_guest-loader.c.o: in function
> `loader_insert_platform_data':
>     build/../hw/core/guest-loader.c:56: undefined reference to
> `qemu_fdt_add_subnode'
>     /usr/bin/ld: build/../hw/core/guest-loader.c:57: undefined reference
> to `qemu_fdt_setprop'
>     /usr/bin/ld: build/../hw/core/guest-loader.c:61: undefined reference
> to `qemu_fdt_setprop_string_array'
>     /usr/bin/ld: build/../hw/core/guest-loader.c:68: undefined reference
> to `qemu_fdt_setprop_string'
>     /usr/bin/ld: build/../hw/core/guest-loader.c:74: undefined reference
> to `qemu_fdt_setprop_string_array'
>     collect2: error: ld returned 1 exit status
>     ninja: build stopped: subcommand failed.
> 
> when building s390-softmmu on s390 with  --disable-fdt, which was in my
> build script.
>

Oops. Quick fix:

-- >8 --
diff --git a/hw/core/meson.build b/hw/core/meson.build
index 9cd72edf513..5827996206e 100644
--- a/hw/core/meson.build
+++ b/hw/core/meson.build
@@ -37,7 +37,7 @@
   'clock-vmstate.c',
 ))

-softmmu_ss.add(when: 'CONFIG_TCG', if_true: files('guest-loader.c'))
+softmmu_ss.add(when: ['CONFIG_TCG', fdt], if_true: files('guest-loader.c'))

 specific_ss.add(when: 'CONFIG_SOFTMMU', if_true: files(
   'machine-qmp-cmds.c',

---

But better is a Kconfig entry to be able to deselect this
device.



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

* Re: [PULL 13/18] hw/core: implement a guest-loader to support static hypervisor guests
  2021-03-15 16:44     ` Philippe Mathieu-Daudé
@ 2021-03-15 16:51       ` Philippe Mathieu-Daudé
  2021-03-15 16:59         ` Christian Borntraeger
  2021-03-15 16:52       ` Christian Borntraeger
  1 sibling, 1 reply; 38+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-03-15 16:51 UTC (permalink / raw)
  To: Christian Borntraeger, Alex Bennée, peter.maydell
  Cc: Alistair Francis, qemu-devel

On 3/15/21 5:44 PM, Philippe Mathieu-Daudé wrote:
> On 3/15/21 5:16 PM, Christian Borntraeger wrote:
>>
>>
>> On 08.03.21 14:50, Alex Bennée wrote:
>>> Hypervisors, especially type-1 ones, need the firmware/bootcode to put
>>> their initial guest somewhere in memory and pass the information to it
>>> via platform data. The guest-loader is modelled after the generic
>>> loader for exactly this sort of purpose:
>>>
>>>    $QEMU $ARGS  -kernel ~/xen.git/xen/xen \
>>>      -append "dom0_mem=1G,max:1G loglvl=all guest_loglvl=all" \
>>>      -device
>>> guest-loader,addr=0x42000000,kernel=Image,bootargs="root=/dev/sda2 ro
>>> console=hvc0 earlyprintk=xen" \
>>>      -device guest-loader,addr=0x47000000,initrd=rootfs.cpio
>>>
>>> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
>>> Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
>>> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
>>> Message-Id: <20210303173642.3805-5-alex.bennee@linaro.org>
>>>
>>
>> This now results in
>>
>>     /usr/bin/ld: libcommon.fa.p/hw_core_guest-loader.c.o: in function
>> `loader_insert_platform_data':
>>     build/../hw/core/guest-loader.c:56: undefined reference to
>> `qemu_fdt_add_subnode'
>>     /usr/bin/ld: build/../hw/core/guest-loader.c:57: undefined reference
>> to `qemu_fdt_setprop'
>>     /usr/bin/ld: build/../hw/core/guest-loader.c:61: undefined reference
>> to `qemu_fdt_setprop_string_array'
>>     /usr/bin/ld: build/../hw/core/guest-loader.c:68: undefined reference
>> to `qemu_fdt_setprop_string'
>>     /usr/bin/ld: build/../hw/core/guest-loader.c:74: undefined reference
>> to `qemu_fdt_setprop_string_array'
>>     collect2: error: ld returned 1 exit status
>>     ninja: build stopped: subcommand failed.
>>
>> when building s390-softmmu on s390 with  --disable-fdt, which was in my
>> build script.
>>
> 
> Oops. Quick fix:
> 
> -- >8 --
> diff --git a/hw/core/meson.build b/hw/core/meson.build
> index 9cd72edf513..5827996206e 100644
> --- a/hw/core/meson.build
> +++ b/hw/core/meson.build
> @@ -37,7 +37,7 @@
>    'clock-vmstate.c',
>  ))
> 
> -softmmu_ss.add(when: 'CONFIG_TCG', if_true: files('guest-loader.c'))
> +softmmu_ss.add(when: ['CONFIG_TCG', fdt], if_true: files('guest-loader.c'))
> 
>  specific_ss.add(when: 'CONFIG_SOFTMMU', if_true: files(
>    'machine-qmp-cmds.c',
> 
> ---
> 
> But better is a Kconfig entry to be able to deselect this
> device.

-- >8 --
diff --git a/hw/core/Kconfig b/hw/core/Kconfig
index fdf03514d7d..9397503656d 100644
--- a/hw/core/Kconfig
+++ b/hw/core/Kconfig
@@ -11,6 +11,11 @@ config GENERIC_LOADER
     bool
     default y

+config GUEST_LOADER
+    bool
+    default y
+    depends on TCG
+
 config OR_IRQ
     bool

diff --git a/hw/core/meson.build b/hw/core/meson.build
index 9cd72edf513..59f1605bb07 100644
--- a/hw/core/meson.build
+++ b/hw/core/meson.build
@@ -16,6 +16,7 @@
 common_ss.add(files('cpu.c'))
 common_ss.add(when: 'CONFIG_FITLOADER', if_true: files('loader-fit.c'))
 common_ss.add(when: 'CONFIG_GENERIC_LOADER', if_true:
files('generic-loader.c'))
+common_ss.add(when: ['CONFIG_GUEST_LOADER', fdt], if_true:
files('guest-loader.c'))
 common_ss.add(when: 'CONFIG_OR_IRQ', if_true: files('or-irq.c'))
 common_ss.add(when: 'CONFIG_PLATFORM_BUS', if_true:
files('platform-bus.c'))
 common_ss.add(when: 'CONFIG_PTIMER', if_true: files('ptimer.c'))
@@ -37,8 +38,6 @@
   'clock-vmstate.c',
 ))

-softmmu_ss.add(when: 'CONFIG_TCG', if_true: files('guest-loader.c'))
-
 specific_ss.add(when: 'CONFIG_SOFTMMU', if_true: files(
   'machine-qmp-cmds.c',
   'numa.c',
---



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

* Re: [PULL 13/18] hw/core: implement a guest-loader to support static hypervisor guests
  2021-03-15 16:44     ` Philippe Mathieu-Daudé
  2021-03-15 16:51       ` Philippe Mathieu-Daudé
@ 2021-03-15 16:52       ` Christian Borntraeger
  1 sibling, 0 replies; 38+ messages in thread
From: Christian Borntraeger @ 2021-03-15 16:52 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, Alex Bennée, peter.maydell
  Cc: Alistair Francis, qemu-devel



On 15.03.21 17:44, Philippe Mathieu-Daudé wrote:
> On 3/15/21 5:16 PM, Christian Borntraeger wrote:
>>
>>
>> On 08.03.21 14:50, Alex Bennée wrote:
>>> Hypervisors, especially type-1 ones, need the firmware/bootcode to put
>>> their initial guest somewhere in memory and pass the information to it
>>> via platform data. The guest-loader is modelled after the generic
>>> loader for exactly this sort of purpose:
>>>
>>>     $QEMU $ARGS  -kernel ~/xen.git/xen/xen \
>>>       -append "dom0_mem=1G,max:1G loglvl=all guest_loglvl=all" \
>>>       -device
>>> guest-loader,addr=0x42000000,kernel=Image,bootargs="root=/dev/sda2 ro
>>> console=hvc0 earlyprintk=xen" \
>>>       -device guest-loader,addr=0x47000000,initrd=rootfs.cpio
>>>
>>> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
>>> Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
>>> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
>>> Message-Id: <20210303173642.3805-5-alex.bennee@linaro.org>
>>>
>>
>> This now results in
>>
>>      /usr/bin/ld: libcommon.fa.p/hw_core_guest-loader.c.o: in function
>> `loader_insert_platform_data':
>>      build/../hw/core/guest-loader.c:56: undefined reference to
>> `qemu_fdt_add_subnode'
>>      /usr/bin/ld: build/../hw/core/guest-loader.c:57: undefined reference
>> to `qemu_fdt_setprop'
>>      /usr/bin/ld: build/../hw/core/guest-loader.c:61: undefined reference
>> to `qemu_fdt_setprop_string_array'
>>      /usr/bin/ld: build/../hw/core/guest-loader.c:68: undefined reference
>> to `qemu_fdt_setprop_string'
>>      /usr/bin/ld: build/../hw/core/guest-loader.c:74: undefined reference
>> to `qemu_fdt_setprop_string_array'
>>      collect2: error: ld returned 1 exit status
>>      ninja: build stopped: subcommand failed.
>>
>> when building s390-softmmu on s390 with  --disable-fdt, which was in my
>> build script.
>>
> 
> Oops. Quick fix:
> 
> -- >8 --
> diff --git a/hw/core/meson.build b/hw/core/meson.build
> index 9cd72edf513..5827996206e 100644
> --- a/hw/core/meson.build
> +++ b/hw/core/meson.build
> @@ -37,7 +37,7 @@
>     'clock-vmstate.c',
>   ))
> 
> -softmmu_ss.add(when: 'CONFIG_TCG', if_true: files('guest-loader.c'))
> +softmmu_ss.add(when: ['CONFIG_TCG', fdt], if_true: files('guest-loader.c'))
> 
>   specific_ss.add(when: 'CONFIG_SOFTMMU', if_true: files(
>     'machine-qmp-cmds.c',
> 

At least this one is
Tested-by: Christian Borntraeger <borntraeger@de.ibm.com>



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

* Re: [PULL 13/18] hw/core: implement a guest-loader to support static hypervisor guests
  2021-03-15 16:51       ` Philippe Mathieu-Daudé
@ 2021-03-15 16:59         ` Christian Borntraeger
  2021-03-15 17:05           ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 38+ messages in thread
From: Christian Borntraeger @ 2021-03-15 16:59 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, Alex Bennée, peter.maydell
  Cc: Alistair Francis, qemu-devel



On 15.03.21 17:51, Philippe Mathieu-Daudé wrote:

> diff --git a/hw/core/Kconfig b/hw/core/Kconfig
> index fdf03514d7d..9397503656d 100644
> --- a/hw/core/Kconfig
> +++ b/hw/core/Kconfig
> @@ -11,6 +11,11 @@ config GENERIC_LOADER
>       bool
>       default y
> 
> +config GUEST_LOADER
> +    bool
> +    default y
> +    depends on TCG
> +
>   config OR_IRQ
>       bool
> 
> diff --git a/hw/core/meson.build b/hw/core/meson.build
> index 9cd72edf513..59f1605bb07 100644
> --- a/hw/core/meson.build
> +++ b/hw/core/meson.build
> @@ -16,6 +16,7 @@
>   common_ss.add(files('cpu.c'))
>   common_ss.add(when: 'CONFIG_FITLOADER', if_true: files('loader-fit.c'))
>   common_ss.add(when: 'CONFIG_GENERIC_LOADER', if_true:
> files('generic-loader.c'))
> +common_ss.add(when: ['CONFIG_GUEST_LOADER', fdt], if_true:
> files('guest-loader.c'))
>   common_ss.add(when: 'CONFIG_OR_IRQ', if_true: files('or-irq.c'))
>   common_ss.add(when: 'CONFIG_PLATFORM_BUS', if_true:
> files('platform-bus.c'))
>   common_ss.add(when: 'CONFIG_PTIMER', if_true: files('ptimer.c'))
> @@ -37,8 +38,6 @@
>     'clock-vmstate.c',
>   ))
> 
> -softmmu_ss.add(when: 'CONFIG_TCG', if_true: files('guest-loader.c'))
> -
>   specific_ss.add(when: 'CONFIG_SOFTMMU', if_true: files(
>     'machine-qmp-cmds.c',
>     'numa.c',


Also
Tested-by: Christian Borntraeger <borntraeger@de.ibm.com>


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

* Re: [PULL 13/18] hw/core: implement a guest-loader to support static hypervisor guests
  2021-03-15 16:59         ` Christian Borntraeger
@ 2021-03-15 17:05           ` Philippe Mathieu-Daudé
  2021-03-15 18:01             ` Alex Bennée
  0 siblings, 1 reply; 38+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-03-15 17:05 UTC (permalink / raw)
  To: Christian Borntraeger, Alex Bennée, peter.maydell
  Cc: Alistair Francis, qemu-devel

On 3/15/21 5:59 PM, Christian Borntraeger wrote:
> On 15.03.21 17:51, Philippe Mathieu-Daudé wrote:
> 
>> diff --git a/hw/core/Kconfig b/hw/core/Kconfig
>> index fdf03514d7d..9397503656d 100644
>> --- a/hw/core/Kconfig
>> +++ b/hw/core/Kconfig
>> @@ -11,6 +11,11 @@ config GENERIC_LOADER
>>       bool
>>       default y
>>
>> +config GUEST_LOADER
>> +    bool
>> +    default y
>> +    depends on TCG
>> +
>>   config OR_IRQ
>>       bool
>>
>> diff --git a/hw/core/meson.build b/hw/core/meson.build
>> index 9cd72edf513..59f1605bb07 100644
>> --- a/hw/core/meson.build
>> +++ b/hw/core/meson.build
>> @@ -16,6 +16,7 @@
>>   common_ss.add(files('cpu.c'))
>>   common_ss.add(when: 'CONFIG_FITLOADER', if_true: files('loader-fit.c'))
>>   common_ss.add(when: 'CONFIG_GENERIC_LOADER', if_true:
>> files('generic-loader.c'))
>> +common_ss.add(when: ['CONFIG_GUEST_LOADER', fdt], if_true:
>> files('guest-loader.c'))
>>   common_ss.add(when: 'CONFIG_OR_IRQ', if_true: files('or-irq.c'))
>>   common_ss.add(when: 'CONFIG_PLATFORM_BUS', if_true:
>> files('platform-bus.c'))
>>   common_ss.add(when: 'CONFIG_PTIMER', if_true: files('ptimer.c'))
>> @@ -37,8 +38,6 @@
>>     'clock-vmstate.c',
>>   ))
>>
>> -softmmu_ss.add(when: 'CONFIG_TCG', if_true: files('guest-loader.c'))
>> -
>>   specific_ss.add(when: 'CONFIG_SOFTMMU', if_true: files(
>>     'machine-qmp-cmds.c',
>>     'numa.c',
> 
> 
> Also
> Tested-by: Christian Borntraeger <borntraeger@de.ibm.com>

Thanks Christian!



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

* Re: [PULL 13/18] hw/core: implement a guest-loader to support static hypervisor guests
  2021-03-15 17:05           ` Philippe Mathieu-Daudé
@ 2021-03-15 18:01             ` Alex Bennée
  0 siblings, 0 replies; 38+ messages in thread
From: Alex Bennée @ 2021-03-15 18:01 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Christian Borntraeger, Alistair Francis, qemu-devel, peter.maydell


Philippe Mathieu-Daudé <philmd@redhat.com> writes:

> On 3/15/21 5:59 PM, Christian Borntraeger wrote:
>> On 15.03.21 17:51, Philippe Mathieu-Daudé wrote:
>> 
>>> diff --git a/hw/core/Kconfig b/hw/core/Kconfig
>>> index fdf03514d7d..9397503656d 100644
>>> --- a/hw/core/Kconfig
>>> +++ b/hw/core/Kconfig
>>> @@ -11,6 +11,11 @@ config GENERIC_LOADER
>>>       bool
>>>       default y
>>>
>>> +config GUEST_LOADER
>>> +    bool
>>> +    default y
>>> +    depends on TCG
>>> +
>>>   config OR_IRQ
>>>       bool
>>>
>>> diff --git a/hw/core/meson.build b/hw/core/meson.build
>>> index 9cd72edf513..59f1605bb07 100644
>>> --- a/hw/core/meson.build
>>> +++ b/hw/core/meson.build
>>> @@ -16,6 +16,7 @@
>>>   common_ss.add(files('cpu.c'))
>>>   common_ss.add(when: 'CONFIG_FITLOADER', if_true: files('loader-fit.c'))
>>>   common_ss.add(when: 'CONFIG_GENERIC_LOADER', if_true:
>>> files('generic-loader.c'))
>>> +common_ss.add(when: ['CONFIG_GUEST_LOADER', fdt], if_true:
>>> files('guest-loader.c'))
>>>   common_ss.add(when: 'CONFIG_OR_IRQ', if_true: files('or-irq.c'))
>>>   common_ss.add(when: 'CONFIG_PLATFORM_BUS', if_true:
>>> files('platform-bus.c'))
>>>   common_ss.add(when: 'CONFIG_PTIMER', if_true: files('ptimer.c'))
>>> @@ -37,8 +38,6 @@
>>>     'clock-vmstate.c',
>>>   ))
>>>
>>> -softmmu_ss.add(when: 'CONFIG_TCG', if_true: files('guest-loader.c'))
>>> -
>>>   specific_ss.add(when: 'CONFIG_SOFTMMU', if_true: files(
>>>     'machine-qmp-cmds.c',
>>>     'numa.c',
>> 
>> 
>> Also
>> Tested-by: Christian Borntraeger <borntraeger@de.ibm.com>
>
> Thanks Christian!

Can you send that to me as a proper patch (unless Christian wants to
take it through the s390 trees)?

-- 
Alex Bennée


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

end of thread, other threads:[~2021-03-15 18:21 UTC | newest]

Thread overview: 38+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-08 13:50 [PULL 00/18] testing, docs, semihosting move and guest-loader Alex Bennée
2021-03-08 13:50 ` [PULL 01/18] docs/system: add a gentle prompt for the complexity to come Alex Bennée
2021-03-08 13:50 ` [PULL 02/18] tests/docker: add a test-tcg for building then running check-tcg Alex Bennée
2021-03-08 13:50 ` [PULL 03/18] docker: Add Hexagon image Alex Bennée
2021-03-08 13:50 ` [PULL 04/18] tests/tcg: Use Hexagon Docker image Alex Bennée
2021-03-08 13:50 ` [PULL 05/18] gitlab: add build-user-hexagon test Alex Bennée
2021-03-08 13:50 ` [PULL 06/18] gitlab-ci.yml: Allow custom # of parallel linkers Alex Bennée
2021-03-08 13:50 ` [PULL 07/18] gitlab-ci.yml: Add jobs to test CFI flags Alex Bennée
2021-03-08 13:50 ` [PULL 08/18] tests/docker: Use --arch-only when building Debian cross image Alex Bennée
2021-03-08 13:50 ` [PULL 09/18] .editorconfig: update the automatic mode setting for Emacs Alex Bennée
2021-03-08 13:50 ` [PULL 10/18] hw/board: promote fdt from ARM VirtMachineState to MachineState Alex Bennée
2021-03-08 13:50 ` [PULL 11/18] hw/riscv: migrate fdt field to generic MachineState Alex Bennée
2021-03-08 13:50   ` Alex Bennée
2021-03-08 13:50 ` [PULL 12/18] device_tree: add qemu_fdt_setprop_string_array helper Alex Bennée
2021-03-08 13:50 ` [PULL 13/18] hw/core: implement a guest-loader to support static hypervisor guests Alex Bennée
2021-03-15 16:16   ` Christian Borntraeger
2021-03-15 16:44     ` Philippe Mathieu-Daudé
2021-03-15 16:51       ` Philippe Mathieu-Daudé
2021-03-15 16:59         ` Christian Borntraeger
2021-03-15 17:05           ` Philippe Mathieu-Daudé
2021-03-15 18:01             ` Alex Bennée
2021-03-15 16:52       ` Christian Borntraeger
2021-03-08 13:51 ` [PULL 14/18] docs: move generic-loader documentation into the main manual Alex Bennée
2021-03-08 13:51 ` [PULL 15/18] docs: add some documentation for the guest-loader Alex Bennée
2021-03-08 13:51 ` [PULL 16/18] tests/avocado: add boot_xen tests Alex Bennée
2021-03-08 13:51 ` [PULL 17/18] semihosting: Move include/hw/semihosting/ -> include/semihosting/ Alex Bennée
2021-03-08 13:51   ` Alex Bennée
2021-03-08 13:51 ` [PULL 18/18] semihosting: Move hw/semihosting/ -> semihosting/ Alex Bennée
2021-03-08 14:39 ` [PULL 00/18] testing, docs, semihosting move and guest-loader no-reply
2021-03-09 18:11 ` Peter Maydell
2021-03-09 18:37   ` Alex Bennée
2021-03-09 21:33     ` Peter Maydell
2021-03-09 22:26     ` Philippe Mathieu-Daudé
2021-03-10 10:41   ` Alex Bennée
2021-03-10 11:10     ` Peter Maydell
2021-03-10 13:27       ` Alex Bennée
2021-03-10 13:53         ` Philippe Mathieu-Daudé
2021-03-10 15:47           ` Alex Bennée

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