various random fixes for 8.2

- replace fedora-i386 cross compiler with debian
   - update cirrus MacOS image to Ventura
   - merge debian-native and debian-amd64 docker images
   - fix compile of plugins on Windows mingw cross
   - add some doc notes on semihosting READC
   - add some doc notes on gdbstub
   - skip loading debug symbols if we have failed
   - enable arm-softmmu TCG tests
   - don't attempt to use native cross builds for linux-user
   - clean up registers gdb test case (ppc64/s390x)
 -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCgAdFiEEZoWumedRZ7yvyN81+9DbCVqeKkQFAmVfXowACgkQ+9DbCVqe
 KkQY6Af5AVjPG2aHmixvhTjxEx5dXAH3cGYsWbny3EByT2RijaTBBK/A4OB7RTVV
 fr11kGpCkJDk4JPoUz4yTuw6Q+7WBmB0tJJ5wcGyC9cyCjI/PttSTJUC7hiikifw
 dg1IVrJZX0ahOpUiDXAtDbeHK1/i95mDRtot40mnyv5HHYHlJKohKsUVtiQEWMeq
 0/X/M5Zq8oJ6wCkbw1nsCqkWpZa7eh4YcB9cGNf87dd0ZJ9M93CbjdSQlsugF2gB
 pH+5ZGOj+L/zkbEKoaWJNwYzF4G6hJeLpqP2rLMqRfA5MM43wdd0dJ6gK0ylKeuR
 Bo7jC1oEOcuLibZY40OhlOwLTMWiDg==
 =ME/l
 -----END PGP SIGNATURE-----

Merge tag 'pull-for-8.2-fixes-231123-1' of https://gitlab.com/stsquad/qemu into staging

various random fixes for 8.2

  - replace fedora-i386 cross compiler with debian
  - update cirrus MacOS image to Ventura
  - merge debian-native and debian-amd64 docker images
  - fix compile of plugins on Windows mingw cross
  - add some doc notes on semihosting READC
  - add some doc notes on gdbstub
  - skip loading debug symbols if we have failed
  - enable arm-softmmu TCG tests
  - don't attempt to use native cross builds for linux-user
  - clean up registers gdb test case (ppc64/s390x)

# -----BEGIN PGP SIGNATURE-----
#
# iQEzBAABCgAdFiEEZoWumedRZ7yvyN81+9DbCVqeKkQFAmVfXowACgkQ+9DbCVqe
# KkQY6Af5AVjPG2aHmixvhTjxEx5dXAH3cGYsWbny3EByT2RijaTBBK/A4OB7RTVV
# fr11kGpCkJDk4JPoUz4yTuw6Q+7WBmB0tJJ5wcGyC9cyCjI/PttSTJUC7hiikifw
# dg1IVrJZX0ahOpUiDXAtDbeHK1/i95mDRtot40mnyv5HHYHlJKohKsUVtiQEWMeq
# 0/X/M5Zq8oJ6wCkbw1nsCqkWpZa7eh4YcB9cGNf87dd0ZJ9M93CbjdSQlsugF2gB
# pH+5ZGOj+L/zkbEKoaWJNwYzF4G6hJeLpqP2rLMqRfA5MM43wdd0dJ6gK0ylKeuR
# Bo7jC1oEOcuLibZY40OhlOwLTMWiDg==
# =ME/l
# -----END PGP SIGNATURE-----
# gpg: Signature made Thu 23 Nov 2023 09:15:40 EST
# gpg:                using RSA key 6685AE99E75167BCAFC8DF35FBD0DB095A9E2A44
# gpg: Good signature from "Alex Bennée (Master Work Key) <alex.bennee@linaro.org>" [unknown]
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: 6685 AE99 E751 67BC AFC8  DF35 FBD0 DB09 5A9E 2A44

* tag 'pull-for-8.2-fixes-231123-1' of https://gitlab.com/stsquad/qemu:
  tests/tcg: finesse the registers check for "hidden" regs
  configure: don't try a "native" cross for linux-user
  tests/tcg: enable semiconsole test for Arm
  tests/tcg: enable arm softmmu tests
  testing: move arm system tests into their own folder
  hw/core: skip loading debug on all failures
  docs/system: clarify limits of using gdbstub in system emulation
  docs/emulation: expand warning about semihosting
  tests/tcg: fixup Aarch64 semiconsole test
  target/nios2: Deprecate the Nios II architecture
  plugins: fix win plugin tests on cross compile
  tests/docker: merge debian-native with debian-amd64
  .gitlab-ci.d/cirrus: Upgrade macOS to 13 (Ventura)
  tests/docker: replace fedora-i386 with debian-i686

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
Stefan Hajnoczi 2023-11-24 08:00:18 -05:00
commit 4705fc0c85
32 changed files with 800 additions and 198 deletions

View File

@ -70,7 +70,7 @@ build-system-debian:
needs:
job: amd64-debian-container
variables:
IMAGE: debian-amd64
IMAGE: debian
CONFIGURE_ARGS: --with-coroutine=sigaltstack
TARGETS: arm-softmmu i386-softmmu riscv64-softmmu sh4eb-softmmu
sparc-softmmu xtensa-softmmu
@ -82,7 +82,7 @@ check-system-debian:
- job: build-system-debian
artifacts: true
variables:
IMAGE: debian-amd64
IMAGE: debian
MAKE_CHECK_ARGS: check
avocado-system-debian:
@ -91,7 +91,7 @@ avocado-system-debian:
- job: build-system-debian
artifacts: true
variables:
IMAGE: debian-amd64
IMAGE: debian
MAKE_CHECK_ARGS: check-avocado
AVOCADO_TAGS: arch:arm arch:i386 arch:riscv64 arch:sh4 arch:sparc arch:xtensa
@ -101,7 +101,7 @@ crash-test-debian:
- job: build-system-debian
artifacts: true
variables:
IMAGE: debian-amd64
IMAGE: debian
script:
- cd build
- make NINJA=":" check-venv
@ -589,7 +589,7 @@ build-tools-and-docs-debian:
# when running on 'master' we use pre-existing container
optional: true
variables:
IMAGE: debian-amd64
IMAGE: debian
MAKE_CHECK_ARGS: check-unit ctags TAGS cscope
CONFIGURE_ARGS: --disable-system --disable-user --enable-docs --enable-tools
QEMU_JOB_PUBLISH: 1
@ -609,7 +609,7 @@ build-tools-and-docs-debian:
# of what topic branch they're currently using
pages:
extends: .base_job_template
image: $CI_REGISTRY_IMAGE/qemu/debian-amd64:$QEMU_CI_CONTAINER_TAG
image: $CI_REGISTRY_IMAGE/qemu/debian:$QEMU_CI_CONTAINER_TAG
stage: test
needs:
- job: build-tools-and-docs-debian

View File

@ -59,13 +59,13 @@ x64-freebsd-13-build:
INSTALL_COMMAND: pkg install -y
TEST_TARGETS: check
aarch64-macos-12-base-build:
aarch64-macos-13-base-build:
extends: .cirrus_build_job
variables:
NAME: macos-12
NAME: macos-13
CIRRUS_VM_INSTANCE_TYPE: macos_instance
CIRRUS_VM_IMAGE_SELECTOR: image
CIRRUS_VM_IMAGE_NAME: ghcr.io/cirruslabs/macos-monterey-base:latest
CIRRUS_VM_IMAGE_NAME: ghcr.io/cirruslabs/macos-ventura-base:latest
CIRRUS_VM_CPUS: 12
CIRRUS_VM_RAM: 24G
UPDATE_COMMAND: brew update

View File

@ -1,6 +1,6 @@
# THIS FILE WAS AUTO-GENERATED
#
# $ lcitool variables macos-12 qemu
# $ lcitool variables macos-13 qemu
#
# https://gitlab.com/libvirt/libvirt-ci

View File

@ -46,6 +46,12 @@ loongarch-debian-cross-container:
variables:
NAME: debian-loongarch-cross
i686-debian-cross-container:
extends: .container_job_template
stage: containers
variables:
NAME: debian-i686-cross
mips64el-debian-cross-container:
extends: .container_job_template
stage: containers
@ -95,11 +101,6 @@ cris-fedora-cross-container:
variables:
NAME: fedora-cris-cross
i386-fedora-cross-container:
extends: .container_job_template
variables:
NAME: fedora-i386-cross
win32-fedora-cross-container:
extends: .container_job_template
variables:

View File

@ -11,7 +11,7 @@ amd64-debian-container:
extends: .container_job_template
stage: containers
variables:
NAME: debian-amd64
NAME: debian
amd64-ubuntu2204-container:
extends: .container_job_template

View File

@ -37,25 +37,25 @@ cross-arm64-kvm-only:
IMAGE: debian-arm64-cross
EXTRA_CONFIGURE_OPTS: --disable-tcg --without-default-features
cross-i386-user:
cross-i686-user:
extends:
- .cross_user_build_job
- .cross_test_artifacts
needs:
job: i386-fedora-cross-container
job: i686-debian-cross-container
variables:
IMAGE: fedora-i386-cross
IMAGE: debian-i686-cross
MAKE_CHECK_ARGS: check
cross-i386-tci:
cross-i686-tci:
extends:
- .cross_accel_build_job
- .cross_test_artifacts
timeout: 60m
needs:
job: i386-fedora-cross-container
job: i686-debian-cross-container
variables:
IMAGE: fedora-i386-cross
IMAGE: debian-i686-cross
ACCEL: tcg-interpreter
EXTRA_CONFIGURE_OPTS: --target-list=i386-softmmu,i386-linux-user,aarch64-softmmu,aarch64-linux-user,ppc-softmmu,ppc-linux-user --disable-plugins
MAKE_CHECK_ARGS: check check-tcg
@ -165,7 +165,7 @@ cross-win32-system:
job: win32-fedora-cross-container
variables:
IMAGE: fedora-win32-cross
EXTRA_CONFIGURE_OPTS: --enable-fdt=internal --disable-plugins
EXTRA_CONFIGURE_OPTS: --enable-fdt=internal
CROSS_SKIP_TARGETS: alpha-softmmu avr-softmmu hppa-softmmu m68k-softmmu
microblazeel-softmmu mips64el-softmmu nios2-softmmu
artifacts:

27
configure vendored
View File

@ -1307,8 +1307,8 @@ probe_target_compiler() {
container_cross_cc=${container_cross_prefix}gcc
;;
i386)
container_image=fedora-i386-cross
container_cross_prefix=
container_image=debian-i686-cross
container_cross_prefix=i686-linux-gnu-
;;
loongarch64)
container_image=debian-loongarch-cross
@ -1391,16 +1391,19 @@ probe_target_compiler() {
done
try=cross
case "$target_arch:$cpu" in
aarch64_be:aarch64 | \
armeb:arm | \
i386:x86_64 | \
mips*:mips64 | \
ppc*:ppc64 | \
sparc:sparc64 | \
"$cpu:$cpu")
try='native cross' ;;
esac
# For softmmu/roms we might be able to use the host compiler
if [ "${1%softmmu}" != "$1" ]; then
case "$target_arch:$cpu" in
aarch64_be:aarch64 | \
armeb:arm | \
i386:x86_64 | \
mips*:mips64 | \
ppc*:ppc64 | \
sparc:sparc64 | \
"$cpu:$cpu")
try='native cross' ;;
esac
fi
eval "target_cflags=\${cross_cc_cflags_$target_arch}"
for thistry in $try; do
case $thistry in

View File

@ -49,7 +49,7 @@ all: $(SONAMES)
$(CC) $(CFLAGS) $(PLUGIN_CFLAGS) -c -o $@ $<
ifeq ($(CONFIG_WIN32),y)
lib%$(SO_SUFFIX): %.o win32_linker.o ../../plugins/qemu_plugin_api.lib
lib%$(SO_SUFFIX): %.o win32_linker.o ../../plugins/libqemu_plugin_api.a
$(CC) -shared -o $@ $^ $(LDLIBS)
else ifeq ($(CONFIG_DARWIN),y)
lib%$(SO_SUFFIX): %.o

View File

@ -236,6 +236,16 @@ it. Since all recent x86 hardware from the past >10 years is capable of the
64-bit x86 extensions, a corresponding 64-bit OS should be used instead.
System emulator CPUs
--------------------
Nios II CPU (since 8.2)
'''''''''''''''''''''''
The Nios II architecture is orphan. The ``nios2`` guest CPU support is
deprecated and will be removed in a future version of QEMU.
System emulator machines
------------------------
@ -254,6 +264,11 @@ These old machine types are quite neglected nowadays and thus might have
various pitfalls with regards to live migration. Use a newer machine type
instead.
Nios II ``10m50-ghrd`` and ``nios2-generic-nommu`` machines (since 8.2)
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
The Nios II architecture is orphan.
Backend options
---------------

View File

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

View File

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

View File

@ -505,7 +505,7 @@ ssize_t load_elf_ram_sym(const char *filename,
clear_lsb, data_swab, as, load_rom, sym_cb);
}
if (ret != ELF_LOAD_FAILED) {
if (ret > 0) {
debuginfo_report_elf(filename, fd, 0);
}

View File

@ -160,6 +160,7 @@ static void nios2_10m50_ghrd_class_init(ObjectClass *oc, void *data)
mc->desc = "Altera 10M50 GHRD Nios II design";
mc->init = nios2_10m50_ghrd_init;
mc->is_default = true;
mc->deprecation_reason = "Nios II architecture is deprecated";
object_class_property_add_bool(oc, "vic", get_vic, set_vic);
object_class_property_set_description(oc, "vic",

View File

@ -95,6 +95,7 @@ static void nios2_generic_nommu_machine_init(struct MachineClass *mc)
{
mc->desc = "Generic NOMMU Nios II design";
mc->init = nios2_generic_nommu_init;
mc->deprecation_reason = "Nios II architecture is deprecated";
}
DEFINE_MACHINE("nios2-generic-nommu", nios2_generic_nommu_machine_init);

View File

@ -28,7 +28,7 @@ if get_option('plugins')
# then use dlltool to assemble a delaylib.
win32_qemu_plugin_api_lib = configure_file(
input: win32_plugin_def,
output: 'qemu_plugin_api.lib',
output: 'libqemu_plugin_api.a',
command: [dlltool, '--input-def', '@INPUT@',
'--output-delaylib', '@OUTPUT@', '--dllname', 'qemu.exe']
)

View File

@ -88,9 +88,6 @@ DOCKER_PARTIAL_IMAGES += debian-s390x-cross
DOCKER_PARTIAL_IMAGES += fedora
endif
# The native build should never use the registry
docker-image-debian-native: DOCKER_REGISTRY=
# alpine has no adduser
docker-image-alpine: NOUSER=1

View File

@ -0,0 +1,182 @@
# THIS FILE WAS AUTO-GENERATED
#
# $ lcitool dockerfile --layers all --cross-arch i686 debian-11 qemu
#
# https://gitlab.com/libvirt/libvirt-ci
FROM docker.io/library/debian:11-slim
RUN export DEBIAN_FRONTEND=noninteractive && \
apt-get update && \
apt-get install -y eatmydata && \
eatmydata apt-get dist-upgrade -y && \
eatmydata apt-get install --no-install-recommends -y \
bash \
bc \
bison \
bsdextrautils \
bzip2 \
ca-certificates \
ccache \
dbus \
debianutils \
diffutils \
exuberant-ctags \
findutils \
flex \
gcc \
gcovr \
gettext \
git \
hostname \
libglib2.0-dev \
libpcre2-dev \
libsndio-dev \
libspice-protocol-dev \
llvm \
locales \
make \
meson \
mtools \
ncat \
ninja-build \
openssh-client \
pkgconf \
python3 \
python3-numpy \
python3-opencv \
python3-pillow \
python3-pip \
python3-setuptools \
python3-sphinx \
python3-sphinx-rtd-theme \
python3-venv \
python3-wheel \
python3-yaml \
rpm2cpio \
sed \
socat \
sparse \
tar \
tesseract-ocr \
tesseract-ocr-eng \
xorriso \
zstd && \
eatmydata apt-get autoremove -y && \
eatmydata apt-get autoclean -y && \
sed -Ei 's,^# (en_US\.UTF-8 .*)$,\1,' /etc/locale.gen && \
dpkg-reconfigure locales
RUN /usr/bin/pip3 install tomli
ENV CCACHE_WRAPPERSDIR "/usr/libexec/ccache-wrappers"
ENV LANG "en_US.UTF-8"
ENV MAKE "/usr/bin/make"
ENV NINJA "/usr/bin/ninja"
ENV PYTHON "/usr/bin/python3"
RUN export DEBIAN_FRONTEND=noninteractive && \
dpkg --add-architecture i386 && \
eatmydata apt-get update && \
eatmydata apt-get dist-upgrade -y && \
eatmydata apt-get install --no-install-recommends -y dpkg-dev && \
eatmydata apt-get install --no-install-recommends -y \
g++-i686-linux-gnu \
gcc-i686-linux-gnu \
libaio-dev:i386 \
libasan6:i386 \
libasound2-dev:i386 \
libattr1-dev:i386 \
libbpf-dev:i386 \
libbrlapi-dev:i386 \
libbz2-dev:i386 \
libc6-dev:i386 \
libcacard-dev:i386 \
libcap-ng-dev:i386 \
libcapstone-dev:i386 \
libcmocka-dev:i386 \
libcurl4-gnutls-dev:i386 \
libdaxctl-dev:i386 \
libdrm-dev:i386 \
libepoxy-dev:i386 \
libfdt-dev:i386 \
libffi-dev:i386 \
libfuse3-dev:i386 \
libgbm-dev:i386 \
libgcrypt20-dev:i386 \
libglib2.0-dev:i386 \
libglusterfs-dev:i386 \
libgnutls28-dev:i386 \
libgtk-3-dev:i386 \
libibumad-dev:i386 \
libibverbs-dev:i386 \
libiscsi-dev:i386 \
libjemalloc-dev:i386 \
libjpeg62-turbo-dev:i386 \
libjson-c-dev:i386 \
liblttng-ust-dev:i386 \
liblzo2-dev:i386 \
libncursesw5-dev:i386 \
libnfs-dev:i386 \
libnuma-dev:i386 \
libpam0g-dev:i386 \
libpipewire-0.3-dev:i386 \
libpixman-1-dev:i386 \
libpng-dev:i386 \
libpulse-dev:i386 \
librbd-dev:i386 \
librdmacm-dev:i386 \
libsasl2-dev:i386 \
libsdl2-dev:i386 \
libsdl2-image-dev:i386 \
libseccomp-dev:i386 \
libselinux1-dev:i386 \
libslirp-dev:i386 \
libsnappy-dev:i386 \
libspice-server-dev:i386 \
libssh-gcrypt-dev:i386 \
libsystemd-dev:i386 \
libtasn1-6-dev:i386 \
libubsan1:i386 \
libudev-dev:i386 \
liburing-dev:i386 \
libusb-1.0-0-dev:i386 \
libusbredirhost-dev:i386 \
libvdeplug-dev:i386 \
libvirglrenderer-dev:i386 \
libvte-2.91-dev:i386 \
libzstd-dev:i386 \
nettle-dev:i386 \
systemtap-sdt-dev:i386 \
xfslibs-dev:i386 \
zlib1g-dev:i386 && \
eatmydata apt-get autoremove -y && \
eatmydata apt-get autoclean -y && \
mkdir -p /usr/local/share/meson/cross && \
printf "[binaries]\n\
c = '/usr/bin/i686-linux-gnu-gcc'\n\
ar = '/usr/bin/i686-linux-gnu-gcc-ar'\n\
strip = '/usr/bin/i686-linux-gnu-strip'\n\
pkgconfig = '/usr/bin/i686-linux-gnu-pkg-config'\n\
\n\
[host_machine]\n\
system = 'linux'\n\
cpu_family = 'x86'\n\
cpu = 'i686'\n\
endian = 'little'\n" > /usr/local/share/meson/cross/i686-linux-gnu && \
dpkg-query --showformat '${Package}_${Version}_${Architecture}\n' --show > /packages.txt && \
mkdir -p /usr/libexec/ccache-wrappers && \
ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/i686-linux-gnu-c++ && \
ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/i686-linux-gnu-cc && \
ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/i686-linux-gnu-g++ && \
ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/i686-linux-gnu-gcc
ENV ABI "i686-linux-gnu"
ENV MESON_OPTS "--cross-file=i686-linux-gnu"
ENV QEMU_CONFIGURE_OPTS --cross-prefix=x86_64-linux-gnu-
ENV DEF_TARGET_LIST x86_64-softmmu,x86_64-linux-user,i386-softmmu,i386-linux-user
# As a final step configure the user (if env is defined)
ARG USER
ARG UID
RUN if [ "${USER}" ]; then \
id ${USER} 2>/dev/null || useradd -u ${UID} -U ${USER}; fi

View File

@ -1,54 +0,0 @@
#
# Docker Debian Native
#
# This is intended to build QEMU on native host systems. Debian is
# chosen due to the broadest range on supported host systems for QEMU.
#
# This docker target is based on the docker.io Debian Bullseye base
# image rather than QEMU's base because we would otherwise confuse the
# build grabbing stuff from the registry built for other
# architectures.
#
FROM docker.io/library/debian:bullseye-slim
MAINTAINER Alex Bennée <alex.bennee@linaro.org>
# Duplicate deb line as deb-src
RUN cat /etc/apt/sources.list | sed "s/^deb\ /deb-src /" >> /etc/apt/sources.list
# Install common build utilities
RUN apt update && \
DEBIAN_FRONTEND=noninteractive apt install -yy eatmydata
RUN apt update && \
DEBIAN_FRONTEND=noninteractive eatmydata \
apt build-dep -yy --arch-only qemu
RUN apt update && \
DEBIAN_FRONTEND=noninteractive eatmydata \
apt install -y --no-install-recommends \
cscope \
genisoimage \
exuberant-ctags \
global \
libbz2-dev \
liblzo2-dev \
libgcrypt20-dev \
libfdt-dev \
librdmacm-dev \
libsasl2-dev \
libsnappy-dev \
libvte-dev \
netcat-openbsd \
ninja-build \
openssh-client \
python3-numpy \
python3-opencv \
python3-venv
ENV QEMU_CONFIGURE_OPTS $QEMU_CONFIGURE_OPTS
ENV DEF_TARGET_LIST "none"
# As a final step configure the user (if env is defined)
ARG USER
ARG UID
RUN if [ "${USER}" ]; then \
id ${USER} 2>/dev/null || useradd -u ${UID} -U ${USER}; fi

View File

@ -155,10 +155,13 @@ RUN DEBIAN_FRONTEND=noninteractive eatmydata \
apt install -y --no-install-recommends \
cscope\
global\
linux-headers-amd64
linux-headers-generic
RUN git clone https://github.com/luigirizzo/netmap.git /usr/src/netmap
RUN cd /usr/src/netmap && git checkout v11.3
RUN cd /usr/src/netmap/LINUX && ./configure --no-drivers --no-apps --kernel-dir=$(ls -d /usr/src/linux-headers-*-amd64) && make install
RUN cd /usr/src/netmap/LINUX && \
./configure --no-drivers --no-apps \
--kernel-dir=$(ls -d /usr/src/linux-headers-*-$(dpkg --print-architecture)) \
&& make install
ENV QEMU_CONFIGURE_OPTS --enable-netmap
# As a final step configure the user (if env is defined)
ARG USER

View File

@ -1,40 +0,0 @@
FROM registry.fedoraproject.org/fedora:34
ENV PACKAGES \
bison \
bzip2 \
ccache \
diffutils \
flex \
findutils \
gcc \
git \
libfdt-devel.i686 \
libffi-devel.i686 \
libselinux-devel.i686 \
libtasn1-devel.i686 \
libzstd-devel.i686 \
make \
meson \
ninja-build \
glib2-devel.i686 \
glibc-devel.i686 \
glibc-static.i686 \
gnutls-devel.i686 \
nettle-devel.i686 \
pcre-devel.i686 \
pixman-devel.i686 \
python3-tomli \
sysprof-capture-devel.i686 \
zlib-devel.i686
ENV QEMU_CONFIGURE_OPTS --cpu=i386 --disable-vhost-user
ENV PKG_CONFIG_LIBDIR /usr/lib/pkgconfig
RUN dnf update -y && dnf install -y $PACKAGES
RUN rpm -q $PACKAGES | sort > /packages.txt
# As a final step configure the user (if env is defined)
ARG USER
ARG UID
RUN if [ "${USER}" ]; then \
id ${USER} 2>/dev/null || useradd -u ${UID} -U ${USER}; fi

View File

@ -99,10 +99,13 @@ debian12_extras = [
" apt install -y --no-install-recommends \\\n",
" cscope\\\n",
" global\\\n",
" linux-headers-amd64\n",
" linux-headers-generic\n",
"RUN git clone https://github.com/luigirizzo/netmap.git /usr/src/netmap\n",
"RUN cd /usr/src/netmap && git checkout v11.3\n",
"RUN cd /usr/src/netmap/LINUX && ./configure --no-drivers --no-apps --kernel-dir=$(ls -d /usr/src/linux-headers-*-amd64) && make install\n",
"RUN cd /usr/src/netmap/LINUX && \\\n",
" ./configure --no-drivers --no-apps \\\n",
" --kernel-dir=$(ls -d /usr/src/linux-headers-*-$(dpkg --print-architecture)) \\\n",
" && make install\n",
"ENV QEMU_CONFIGURE_OPTS --enable-netmap\n"
]
@ -123,7 +126,7 @@ try:
#
generate_dockerfile("alpine", "alpine-318")
generate_dockerfile("centos8", "centos-stream-8")
generate_dockerfile("debian-amd64", "debian-12",
generate_dockerfile("debian", "debian-12",
trailer="".join(debian12_extras))
generate_dockerfile("fedora", "fedora-38")
generate_dockerfile("opensuse-leap", "opensuse-leap-15")
@ -156,6 +159,13 @@ try:
trailer=cross_build("arm-linux-gnueabihf-",
"arm-softmmu,arm-linux-user"))
generate_dockerfile("debian-i686-cross", "debian-11",
cross="i686",
trailer=cross_build("x86_64-linux-gnu-",
"x86_64-softmmu,"
"x86_64-linux-user,"
"i386-softmmu,i386-linux-user"))
generate_dockerfile("debian-mips64el-cross", "debian-11",
cross="mips64el",
trailer=cross_build("mips64el-linux-gnuabi64-",
@ -196,7 +206,7 @@ try:
# Cirrus packages lists for GitLab
#
generate_cirrus("freebsd-13")
generate_cirrus("macos-12")
generate_cirrus("macos-13")
#
# VM packages lists

View File

@ -4,7 +4,8 @@ if get_option('plugins')
if targetos == 'windows'
t += shared_module(i, files(i + '.c') + '../../contrib/plugins/win32_linker.c',
include_directories: '../../include/qemu',
objects: [win32_qemu_plugin_api_lib],
link_depends: [win32_qemu_plugin_api_lib],
link_args: ['-Lplugins', '-lqemu_plugin_api'],
dependencies: glib)
else

View File

@ -48,10 +48,11 @@ QEMU_BASE_MACHINE=-M virt -cpu max -display none
QEMU_OPTS+=$(QEMU_BASE_MACHINE) -semihosting-config enable=on,target=native,chardev=output -kernel
# console test is manual only
QEMU_SEMIHOST=-chardev stdio,mux=on,id=stdio0 -semihosting-config enable=on,chardev=stdio0 -mon chardev=stdio0,mode=readline
run-semiconsole: QEMU_OPTS=$(QEMU_BASE_MACHINE) $(QEMU_SEMIHOST) -kernel
QEMU_SEMIHOST=-serial none -chardev stdio,mux=on,id=stdio0 -semihosting-config enable=on,chardev=stdio0 -mon chardev=stdio0,mode=readline
run-semiconsole: QEMU_OPTS=$(QEMU_BASE_MACHINE) $(QEMU_SEMIHOST) -kernel
run-semiconsole: semiconsole
$(call skip-test, $<, "MANUAL ONLY")
$(if $(V),@printf " %-7s %s %s\n" "TO RUN" $(notdir $(QEMU)) "$(QEMU_OPTS) $<")
run-plugin-semiconsole-with-%: semiconsole
$(call skip-test, $<, "MANUAL ONLY")

View File

@ -3,26 +3,78 @@
# ARM SoftMMU tests - included from tests/tcg/Makefile
#
ARM_SRC=$(SRC_PATH)/tests/tcg/arm
ARM_SRC=$(SRC_PATH)/tests/tcg/arm/system
# Set search path for all sources
VPATH += $(ARM_SRC)
ARM_TESTS=test-armv6m-undef
TESTS += $(ARM_TESTS)
CFLAGS+=-Wl,--build-id=none -x assembler-with-cpp
LDFLAGS+=-nostdlib -N -static
%: %.S %.ld
$(CC) $(CFLAGS) $(ASFLAGS) $(EXTRA_CFLAGS) $< -o $@ $(LDFLAGS) -T $(ARM_SRC)/$@.ld
# Specific Test Rules
test-armv6m-undef: EXTRA_CFLAGS+=-mcpu=cortex-m0 -mfloat-abi=soft
test-armv6m-undef: test-armv6m-undef.S
$(CC) -mcpu=cortex-m0 -mfloat-abi=soft \
-Wl,--build-id=none -x assembler-with-cpp \
$< -o $@ -nostdlib -N -static \
-T $(ARM_SRC)/$@.ld
run-test-armv6m-undef: QEMU_OPTS+=-semihosting -M microbit -kernel
# We don't currently support the multiarch system tests
undefine MULTIARCH_TESTS
ARM_TESTS+=test-armv6m-undef
# These objects provide the basic boot code and helper functions for all tests
CRT_OBJS=boot.o
ARM_TEST_SRCS=$(wildcard $(ARM_SRC)/*.c)
ARM_TESTS+=$(patsubst $(ARM_SRC)/%.c, %, $(ARM_TEST_SRCS))
CRT_PATH=$(ARM_SRC)
LINK_SCRIPT=$(ARM_SRC)/kernel.ld
LDFLAGS=-Wl,-T$(LINK_SCRIPT)
CFLAGS+=-nostdlib -ggdb -O0 $(MINILIB_INC)
LDFLAGS+=-static -nostdlib -N $(CRT_OBJS) $(MINILIB_OBJS) -lgcc
# building head blobs
.PRECIOUS: $(CRT_OBJS)
%.o: $(ARM_SRC)/%.S
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -x assembler-with-cpp -c $< -o $@
# Build and link the tests
%: %.c $(LINK_SCRIPT) $(CRT_OBJS) $(MINILIB_OBJS)
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $< -o $@ $(LDFLAGS)
memory: CFLAGS+=-DCHECK_UNALIGNED=0
# Running
QEMU_BASE_MACHINE=-M virt -cpu max -display none
QEMU_OPTS+=$(QEMU_BASE_MACHINE) -semihosting-config enable=on,target=native,chardev=output -kernel
# console test is manual only
QEMU_SEMIHOST=-serial none -chardev stdio,mux=on,id=stdio0 -semihosting-config enable=on,chardev=stdio0 -mon chardev=stdio0,mode=readline
run-semiconsole: QEMU_OPTS=$(QEMU_BASE_MACHINE) $(QEMU_SEMIHOST) -kernel
run-semiconsole: semiconsole
$(call skip-test, $<, "MANUAL ONLY")
$(if $(V),@printf " %-7s %s %s\n" "TO RUN" $(notdir $(QEMU)) "$(QEMU_OPTS) $<")
run-plugin-semiconsole-with-%: semiconsole
$(call skip-test, $<, "MANUAL ONLY")
# Simple Record/Replay Test
.PHONY: memory-record
run-memory-record: memory-record memory
$(call run-test, $<, \
$(QEMU) -monitor none -display none \
-chardev file$(COMMA)path=$<.out$(COMMA)id=output \
-icount shift=5$(COMMA)rr=record$(COMMA)rrfile=record.bin \
$(QEMU_OPTS) memory)
.PHONY: memory-replay
run-memory-replay: memory-replay run-memory-record
$(call run-test, $<, \
$(QEMU) -monitor none -display none \
-chardev file$(COMMA)path=$<.out$(COMMA)id=output \
-icount shift=5$(COMMA)rr=replay$(COMMA)rrfile=record.bin \
$(QEMU_OPTS) memory)
EXTRA_RUNS+=run-memory-replay
TESTS += $(ARM_TESTS) $(MULTIARCH_TESTS)
EXTRA_RUNS+=$(MULTIARCH_RUNS)

319
tests/tcg/arm/system/boot.S Normal file
View File

@ -0,0 +1,319 @@
/*
* Minimal ArmV7 system boot code.
*
* Using semihosting for serial output and exit functions.
*/
/*
* Semihosting interface on ARM AArch32
* R0 - semihosting call number
* R1 - semihosting parameter
*/
#define semihosting_call svc 0x123456
#define SYS_WRITEC 0x03 /* character to debug channel */
#define SYS_WRITE0 0x04 /* string to debug channel */
#define SYS_EXIT 0x18
#define ADP_Stopped_ApplicationExit 0x20026
#define ADP_Stopped_InternalError 0x20024
/*
* Helper macro for annotating functions with elf type and size.
*/
.macro endf name
.global \name
.type \name, %function
.size \name, . - \name
.endm
.section .interrupt_vector, "ax"
.align 5
vector_table:
b reset /* reset vector */
b undef_instr /* undefined instruction vector */
b software_intr /* software interrupt vector */
b prefetch_abort /* prefetch abort vector */
b data_abort /* data abort vector */
nop /* reserved */
b IRQ_handler /* IRQ vector */
b FIQ_handler /* FIQ vector */
endf vector_table
.text
__start:
ldr r0, =vector_table
mcr p15, 0, r0, c12, c0, 0 /* Set up VBAR */
ldr sp, =stack_end /* Set up the stack */
bl mmu_setup /* Set up the MMU */
bl main /* Jump to main */
endf __start
_exit:
cmp r0, #0
ite EQ // if-then-else. "EQ" is for if equal, else otherwise
ldreq r1, =ADP_Stopped_ApplicationExit // if r0 == 0
ldrne r1, =ADP_Stopped_InternalError // else
mov r0, #SYS_EXIT
semihosting_call
endf _exit
/*
* Helper Functions
*/
mmu_setup:
/*
* The MMU setup for this is very simple using two stage one
* translations. The first 1Mb section points to the text
* section and the second points to the data and rss.
* Currently the fattest test only needs ~50k for that so we
* have plenty of space.
*
* The short descriptor Section format is as follows:
*
* PA[31:20] - Section Base Address
* NS[19] - Non-secure bit
* 0[18] - Section (1 for Super Section)
* nG[17] - Not global bit
* S[16] - Shareable
* TEX[14:12] - Memory Region Attributes
* AP[15, 11:10] - Access Permission Bits
* IMPDEF[9]
* Domain[8:5]
* XN[4] - Execute never bit
* C[3] - Memory Region Attributes
* B[2] - Memory Region Attributes
* 1[1]
* PXN[0] - Privileged Execute Never
*
* r0 - point at the table
* r1 - address
* r2 - entry
* r3 - common section bits
* r4 - scratch
*/
/*
* Memory Region Bits
*
* TEX[14:12] = 000
* C[3] = 1
* B[2] = 1
*
* Outer and Inner WB, no write allocate
*/
mov r3, #0
ldr r4, =(3 << 2)
orr r3, r4, r4
/* Section bit */
orr r3, r3, #2
/* Page table setup (identity mapping). */
ldr r0, =ttb
/* First block: .text/RO/execute enabled */
ldr r1, =.text
ldr r2, =0xFFF00000 /* 1MB block alignment */
and r2, r1, r2
orr r2, r2, r3 /* common bits */
orr r2, r2, #(1 << 15) /* AP[2] = 1 */
orr r2, r2, #(1 << 10) /* AP[0] = 1 => RO @ PL1 */
lsr r4, r2, #(20 - 2)
str r2, [r0, r4, lsl #0] /* write entry */
/* Second block: .data/RW/no execute */
ldr r1, =.data
ldr r2, =0xFFF00000 /* 1MB block alignment */
and r2, r1, r2
orr r2, r2, r3 /* common bits */
orr r2, r2, #(1 << 10) /* AP[0] = 1 => RW @ PL1 */
orr r2, r2, #(1 << 4) /* XN[4] => no execute */
lsr r4, r2, #(20 - 2)
str r2, [r0, r4, lsl #0] /* write entry */
/*
* DACR - Domain Control
*
* Enable client mode for domain 0 (we don't use any others)
*/
ldr r0, =0x1
mcr p15, 0, r0, c3, c0, 0
/*
* TTCBR - Translation Table Base Control Register
*
* EAE[31] = 0, 32-bit translation, short descriptor format
* N[2:0] = 5 ( TTBRO uses 31:14-5 => 9 bit lookup stage )
*/
ldr r0, =0x5
mcr p15, 0, r0, c1, c0, 2
/*
* TTBR0 -Translation Table Base Register 0
*
* [31:9] = Base address of table
*
* QEMU doesn't really care about the cache sharing
* attributes so we don't need to either.
*/
ldr r0, =ttb
mcr p15, 0, r0, c2, c0, 0
/*
* SCTLR- System Control Register
*
* TE[30] = 0, exceptions to A32 state
* AFE[29] = 0, AP[0] is the access permissions bit
* EE[25] = 0, Little-endian
* WXN[19] = 0 = no effect, Write does not imply XN (execute never)
* I[12] = Instruction cachability control
* C[2] = Data cachability control
* M[0] = 1, enable stage 1 address translation for EL0/1
*
* At this point virtual memory is enabled.
*/
ldr r0, =0x1005
mcr p15, 0, r0, c1, c0, 0
isb
mov pc, lr /* done, return to caller */
endf mmu_setup
/* Output a single character to serial port */
__sys_outc:
STMFD sp!, {r0-r1} // push r0, r1 onto stack
mov r1, sp
mov r0, #SYS_WRITEC
semihosting_call
LDMFD sp!, {r0-r1} // pop r0, r1 from stack
bx lr
endf __sys_outc
reset:
ldr r1, =reset_error
b exception_handler
endf reset
undef_instr:
ldr r1, =undef_intr_error
b exception_handler
endf undef_instr
software_intr:
ldr r1, =software_intr_error
b exception_handler
endf software_intr
prefetch_abort:
ldr r1, =prefetch_abort_error
b exception_handler
endf prefetch_abort
data_abort:
ldr r1, =data_abort_error
b exception_handler
endf data_abort
IRQ_handler:
ldr r1, =irq_error
b exception_handler
endf IRQ_handler
FIQ_handler:
ldr r1, =fiq_error
b exception_handler
endf FIQ_handler
/*
* Initiate a exit semihosting call whenever there is any exception
* r1 already holds the string.
*/
exception_handler:
mov r0, #SYS_WRITE0
semihosting_call
mov r0, #SYS_EXIT
mov r1, #1
semihosting_call
endf exception_handler
/*
* We implement a stub raise() function which errors out as tests
* shouldn't trigger maths errors.
*/
.global raise
raise:
mov r0, #SYS_WRITE0
ldr r1, =maths_error
semihosting_call
mov r0, #SYS_EXIT
ldr r1, =ADP_Stopped_InternalError
semihosting_call
endf raise
.data
.data
reset_error:
.ascii "Reset exception occurred.\n\0"
undef_intr_error:
.ascii "Undefined Instruction Exception Occurred.\n\0"
software_intr_error:
.ascii "Software Interrupt Occurred.\n\0"
prefetch_abort_error:
.ascii "Prefetch Abort Occurred.\n\0"
data_abort_error:
.ascii "Data Abort Occurred.\n\0"
irq_error:
.ascii "IRQ exception occurred.\n\0"
fiq_error:
.ascii "FIQ exception occurred.\n\0"
maths_error:
.ascii "Software maths exception.\n\0"
/*
* 1st Stage Translation table
* 4096 entries, indexed by [31:20]
* each entry covers 1Mb of address space
* aligned on 16kb
*/
.align 15
ttb:
.space (4096 * 4), 0
.align 12
/* Space for stack */
.align 5
.section .bss
stack:
.space 65536, 0
stack_end:

View File

@ -0,0 +1,24 @@
ENTRY(__start)
SECTIONS
{
/* virt machine, RAM starts at 1gb */
. = (1 << 30);
.text : {
*(.text)
}
.rodata : {
*(.rodata)
}
/* align r/w section to next 2mb */
. = ALIGN(1 << 21);
.data : {
*(.data)
}
.bss : {
*(.bss)
}
/DISCARD/ : {
*(.ARM.attributes)
}
}

View File

@ -0,0 +1,42 @@
/*
* Semihosting Console Test
*
* Copyright (c) 2019 Linaro Ltd
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#include <stdint.h>
#include <minilib.h>
#define SYS_READC 0x7
uintptr_t __semi_call(uintptr_t type, uintptr_t arg0)
{
register uintptr_t t asm("r0") = type;
register uintptr_t a0 asm("r1") = arg0;
#ifdef __thumb__
# define SVC "svc 0xab"
#else
# define SVC "svc 0x123456"
#endif
asm(SVC : "=r" (t)
: "r" (t), "r" (a0));
return t;
}
int main(void)
{
char c;
ml_printf("Semihosting Console Test\n");
ml_printf("hit X to exit:");
do {
c = __semi_call(SYS_READC, 0);
__sys_outc(c);
} while (c != 'X');
return 0;
}

View File

@ -44,7 +44,6 @@ def fetch_xml_regmap():
total_regs = 0
reg_map = {}
frame = gdb.selected_frame()
tree = ET.fromstring(xml)
for f in tree.findall("feature"):
@ -61,12 +60,8 @@ def fetch_xml_regmap():
for r in regs:
name = r.attrib["name"]
regnum = int(r.attrib["regnum"])
try:
value = frame.read_register(name)
except ValueError:
report(False, f"failed to read reg: {name}")
entry = { "name": name, "initial": value, "regnum": regnum }
entry = { "name": name, "regnum": regnum }
if name in reg_map:
report(False, f"duplicate register {entry} vs {reg_map[name]}")
@ -80,6 +75,15 @@ def fetch_xml_regmap():
return reg_map
def get_register_by_regnum(reg_map, regnum):
"""
Helper to find a register from the map via its XML regnum
"""
for regname, entry in reg_map.items():
if entry['regnum'] == regnum:
return entry
return None
def crosscheck_remote_xml(reg_map):
"""
Cross-check the list of remote-registers with the XML info.
@ -90,8 +94,11 @@ def crosscheck_remote_xml(reg_map):
total_regs = len(reg_map.keys())
total_r_regs = 0
total_r_elided_regs = 0
for r in r_regs:
r = r.replace("long long", "long_long")
r = r.replace("long double", "long_double")
fields = r.split()
# Some of the registers reported here are "pseudo" registers that
# gdb invents based on actual registers so we need to filter them
@ -100,6 +107,15 @@ def crosscheck_remote_xml(reg_map):
r_name = fields[0]
r_regnum = int(fields[6])
# Some registers are "hidden" so don't have a name
# although they still should have a register number
if r_name == "''":
total_r_elided_regs += 1
x_reg = get_register_by_regnum(reg_map, r_regnum)
if x_reg is not None:
x_reg["hidden"] = True
continue
# check in the XML
try:
x_reg = reg_map[r_name]
@ -114,17 +130,42 @@ def crosscheck_remote_xml(reg_map):
else:
total_r_regs += 1
# Just print a mismatch in totals as gdb will filter out 64 bit
# registers on a 32 bit machine. Also print what is missing to
# help with debug.
if total_regs != total_r_regs:
print(f"xml-tdesc has ({total_regs}) registers")
print(f"remote-registers has ({total_r_regs}) registers")
report(total_regs == total_r_regs + total_r_elided_regs,
"All XML Registers accounted for")
print(f"xml-tdesc has {total_regs} registers")
print(f"remote-registers has {total_r_regs} registers")
print(f"of which {total_r_elided_regs} are hidden")
for x_key in reg_map.keys():
x_reg = reg_map[x_key]
if "hidden" in x_reg:
print(f"{x_reg} elided by gdb")
elif "seen" not in x_reg:
print(f"{x_reg} wasn't seen in remote-registers")
def initial_register_read(reg_map):
"""
Do an initial read of all registers that we know gdb cares about
(so ignore the elided ones).
"""
frame = gdb.selected_frame()
for e in reg_map.values():
name = e["name"]
regnum = e["regnum"]
try:
if "hidden" in e:
value = frame.read_register(regnum)
e["initial"] = value
elif "seen" in e:
value = frame.read_register(name)
e["initial"] = value
except ValueError:
report(False, f"failed to read reg: {name}")
for x_key in reg_map.keys():
x_reg = reg_map[x_key]
if "seen" not in x_reg:
print(f"{x_reg} wasn't seen in remote-registers")
def complete_and_diff(reg_map):
"""
@ -144,18 +185,19 @@ def complete_and_diff(reg_map):
changed = 0
for e in reg_map.values():
name = e["name"]
old_val = e["initial"]
if "initial" in e and "hidden" not in e:
name = e["name"]
old_val = e["initial"]
try:
new_val = frame.read_register(name)
except:
report(False, f"failed to read {name} at end of run")
continue
try:
new_val = frame.read_register(name)
except ValueError:
report(False, f"failed to read {name} at end of run")
continue
if new_val != old_val:
print(f"{name} changes from {old_val} to {new_val}")
changed += 1
if new_val != old_val:
print(f"{name} changes from {old_val} to {new_val}")
changed += 1
# as long as something changed we can be confident its working
report(changed > 0, f"{changed} registers were changed")
@ -168,6 +210,7 @@ def run_test():
if reg_map is not None:
crosscheck_remote_xml(reg_map)
initial_register_read(reg_map)
complete_and_diff(reg_map)

View File

@ -43,11 +43,4 @@ PPC64_TESTS += signal_save_restore_xer
PPC64_TESTS += xxspltw
PPC64_TESTS += test-aes
ifneq ($(GDB),)
# Skip for now until vsx registers sorted out
run-gdbstub-registers:
$(call skip-test, $<, "BROKEN reading VSX registers")
endif
TESTS += $(PPC64_TESTS)

View File

@ -103,10 +103,6 @@ run-gdbstub-svc: hello-s390x-asm
--bin $< --test $(S390X_SRC)/gdbstub/test-svc.py, \
single-stepping svc)
# Skip for now until vx registers sorted out
run-gdbstub-registers:
$(call skip-test, $<, "BROKEN reading VX registers")
EXTRA_RUNS += run-gdbstub-signals-s390x run-gdbstub-svc
endif