* build system and Python cleanups

* fix netbsd VM build
 * allow non-relocatable installs
 * allow using command line options to configure qemu-ga
 * target/i386: check intercept for XSETBV
 * target/i386: fix CPUID_HT exposure
 -----BEGIN PGP SIGNATURE-----
 
 iQFIBAABCAAyFiEE8TM4V0tmI4mGbHaCv/vSX3jHroMFAmUvkQQUHHBib256aW5p
 QHJlZGhhdC5jb20ACgkQv/vSX3jHroM3pQgArXCsmnsjlng1chjCvKnIuVmaTYZ5
 aC9pcx7TlyM0+XWtTN0NQhFt71Te+3ioReXIQRvy5O68RNbEkiu8LXfOJhWAHbWk
 vZVtzHQuOZVizeZtUruKlDaw0nZ8bg+NI4aGLs6rs3WphEAM+tiLnZJ0BouiedKS
 e/COB/Hqjok+Ntksbfv5q7XpWjwQB0y2073vM1Mcf0ToOWFLFdL7x0SZ3hxyYlYl
 eoefp/8kbWeUWA7HuoOKmpiLIxmKnY7eXp+UCvdnEhnSce9sCxpn2nzqqLuPItTK
 V3GrJ2//+lrekPHyQvb8IjUMUrPOmzf8GadIE0tkfdHjEP72IsHk0VX81A==
 =rPte
 -----END PGP SIGNATURE-----

Merge tag 'for-upstream' of https://gitlab.com/bonzini/qemu into staging

* build system and Python cleanups
* fix netbsd VM build
* allow non-relocatable installs
* allow using command line options to configure qemu-ga
* target/i386: check intercept for XSETBV
* target/i386: fix CPUID_HT exposure

# -----BEGIN PGP SIGNATURE-----
#
# iQFIBAABCAAyFiEE8TM4V0tmI4mGbHaCv/vSX3jHroMFAmUvkQQUHHBib256aW5p
# QHJlZGhhdC5jb20ACgkQv/vSX3jHroM3pQgArXCsmnsjlng1chjCvKnIuVmaTYZ5
# aC9pcx7TlyM0+XWtTN0NQhFt71Te+3ioReXIQRvy5O68RNbEkiu8LXfOJhWAHbWk
# vZVtzHQuOZVizeZtUruKlDaw0nZ8bg+NI4aGLs6rs3WphEAM+tiLnZJ0BouiedKS
# e/COB/Hqjok+Ntksbfv5q7XpWjwQB0y2073vM1Mcf0ToOWFLFdL7x0SZ3hxyYlYl
# eoefp/8kbWeUWA7HuoOKmpiLIxmKnY7eXp+UCvdnEhnSce9sCxpn2nzqqLuPItTK
# V3GrJ2//+lrekPHyQvb8IjUMUrPOmzf8GadIE0tkfdHjEP72IsHk0VX81A==
# =rPte
# -----END PGP SIGNATURE-----
# gpg: Signature made Wed 18 Oct 2023 04:02:12 EDT
# gpg:                using RSA key F13338574B662389866C7682BFFBD25F78C7AE83
# gpg:                issuer "pbonzini@redhat.com"
# gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>" [full]
# gpg:                 aka "Paolo Bonzini <pbonzini@redhat.com>" [full]
# Primary key fingerprint: 46F5 9FBD 57D6 12E7 BFD4  E2F7 7E15 100C CD36 69B1
#      Subkey fingerprint: F133 3857 4B66 2389 866C  7682 BFFB D25F 78C7 AE83

* tag 'for-upstream' of https://gitlab.com/bonzini/qemu: (32 commits)
  configure: define "pkg-config" in addition to "pkgconfig"
  meson: add a note on why we use config_host for program paths
  meson-buildoptions: document the data at the top
  configure, meson: use command line options to configure qemu-ga
  configure: unify handling of several Debian cross containers
  configure: move environment-specific defaults to config-meson.cross
  configure: move target-specific defaults to an external machine file
  configure: remove some dead cruft
  configure: clean up PIE option handling
  configure: clean up plugin option handling
  configure, tests/tcg: simplify GDB conditionals
  tests/tcg/arm: move non-SVE tests out of conditional
  hw/remote: move stub vfu_object_set_bus_irq out of stubs/
  hw/xen: cleanup sourcesets
  configure: clean up handling of CFI option
  meson, cutils: allow non-relocatable installs
  meson: do not use set10
  meson: do not build shaders by default
  tracetool: avoid invalid escape in Python string
  tests/vm: avoid invalid escape in Python string
  ...

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
Stefan Hajnoczi 2023-10-18 06:20:41 -04:00
commit 604b70f6a4
38 changed files with 283 additions and 275 deletions

View file

@ -0,0 +1,9 @@
# target-specific defaults, can still be overridden on
# the command line
[built-in options]
bindir = ''
prefix = '/qemu'
[project options]
qemu_suffix = ''

286
configure vendored
View file

@ -94,7 +94,7 @@ quote_sh() {
printf "%s" "$1" | sed "s,','\\\\'',g; s,.*,'&'," printf "%s" "$1" | sed "s,','\\\\'',g; s,.*,'&',"
} }
print_error() { error_exit() {
(echo (echo
echo "ERROR: $1" echo "ERROR: $1"
while test -n "$2"; do while test -n "$2"; do
@ -102,10 +102,6 @@ print_error() {
shift shift
done done
echo) >&2 echo) >&2
}
error_exit() {
print_error "$@"
exit 1 exit 1
} }
@ -248,11 +244,8 @@ done
default_cflags='-O2 -g' default_cflags='-O2 -g'
git_submodules_action="update" git_submodules_action="update"
git="git"
docs="auto" docs="auto"
EXESUF="" EXESUF=""
prefix="/usr/local"
qemu_suffix="qemu"
system="yes" system="yes"
linux_user="" linux_user=""
bsd_user="" bsd_user=""
@ -261,12 +254,10 @@ subdirs=""
ninja="" ninja=""
python= python=
download="enabled" download="enabled"
bindir="bin"
skip_meson=no skip_meson=no
use_containers="yes" use_containers="yes"
gdb_bin=$(command -v "gdb-multiarch" || command -v "gdb") gdb_bin=$(command -v "gdb-multiarch" || command -v "gdb")
gdb_arches="" gdb_arches=""
werror=""
# Don't accept a target_list environment variable. # Don't accept a target_list environment variable.
unset target_list unset target_list
@ -322,7 +313,6 @@ objcopy="${OBJCOPY-${cross_prefix}objcopy}"
ld="${LD-${cross_prefix}ld}" ld="${LD-${cross_prefix}ld}"
ranlib="${RANLIB-${cross_prefix}ranlib}" ranlib="${RANLIB-${cross_prefix}ranlib}"
nm="${NM-${cross_prefix}nm}" nm="${NM-${cross_prefix}nm}"
smbd="$SMBD"
strip="${STRIP-${cross_prefix}strip}" strip="${STRIP-${cross_prefix}strip}"
widl="${WIDL-${cross_prefix}widl}" widl="${WIDL-${cross_prefix}widl}"
windres="${WINDRES-${cross_prefix}windres}" windres="${WINDRES-${cross_prefix}windres}"
@ -373,18 +363,6 @@ else
targetos=bogus targetos=bogus
fi fi
# OS specific
case $targetos in
windows)
plugins="no"
pie="no"
;;
haiku)
pie="no"
;;
esac
if test ! -z "$cpu" ; then if test ! -z "$cpu" ; then
# command line argument # command line argument
: :
@ -600,9 +578,6 @@ done
if test "$targetos" = "windows" ; then if test "$targetos" = "windows" ; then
EXESUF=".exe" EXESUF=".exe"
prefix="/qemu"
bindir=""
qemu_suffix=""
fi fi
meson_option_build_array() { meson_option_build_array() {
@ -625,7 +600,10 @@ meson_option_build_array() {
meson_options= meson_options=
meson_option_add() { meson_option_add() {
meson_options="$meson_options $(quote_sh "$1")" local arg
for arg; do
meson_options="$meson_options $(quote_sh "$arg")"
done
} }
meson_option_parse() { meson_option_parse() {
meson_options="$meson_options $(_meson_option_parse "$@")" meson_options="$meson_options $(_meson_option_parse "$@")"
@ -636,6 +614,14 @@ meson_option_parse() {
fi fi
} }
meson_add_machine_file() {
if test "$cross_compile" = "yes"; then
meson_option_add --cross-file "$1"
else
meson_option_add --native-file "$1"
fi
}
for opt do for opt do
optarg=$(expr "x$opt" : 'x[^=]*=\(.*\)') optarg=$(expr "x$opt" : 'x[^=]*=\(.*\)')
case "$opt" in case "$opt" in
@ -643,8 +629,6 @@ for opt do
;; ;;
--version|-V) exec cat "$source_path/VERSION" --version|-V) exec cat "$source_path/VERSION"
;; ;;
--prefix=*) prefix="$optarg"
;;
--cross-prefix=*) --cross-prefix=*)
;; ;;
--cc=*) --cc=*)
@ -665,8 +649,6 @@ for opt do
;; ;;
--ninja=*) ninja="$optarg" --ninja=*) ninja="$optarg"
;; ;;
--smbd=*) smbd="$optarg"
;;
--extra-cflags=*) --extra-cflags=*)
;; ;;
--extra-cxxflags=*) --extra-cxxflags=*)
@ -715,10 +697,6 @@ for opt do
;; ;;
--static) static="yes" --static) static="yes"
;; ;;
--bindir=*) bindir="$optarg"
;;
--with-suffix=*) qemu_suffix="$optarg"
;;
--host=*|--build=*|\ --host=*|--build=*|\
--disable-dependency-tracking|\ --disable-dependency-tracking|\
--sbindir=*|--sharedstatedir=*|\ --sbindir=*|--sharedstatedir=*|\
@ -738,7 +716,6 @@ for opt do
default_cflags='-O0 -g' default_cflags='-O0 -g'
;; ;;
--disable-tcg) tcg="disabled" --disable-tcg) tcg="disabled"
plugins="no"
;; ;;
--enable-tcg) tcg="enabled" --enable-tcg) tcg="enabled"
;; ;;
@ -763,25 +740,15 @@ for opt do
;; ;;
--disable-pie) pie="no" --disable-pie) pie="no"
;; ;;
--enable-werror) werror="yes" --enable-cfi) cfi=true
;; ;;
--disable-werror) werror="no" --disable-cfi) cfi=false
;;
--enable-cfi)
cfi="true";
meson_option_add -Db_lto=true
;;
--disable-cfi) cfi="false"
;; ;;
--disable-download) download="disabled"; git_submodules_action=validate; --disable-download) download="disabled"; git_submodules_action=validate;
;; ;;
--enable-download) download="enabled"; git_submodules_action=update; --enable-download) download="enabled"; git_submodules_action=update;
;; ;;
--enable-plugins) if test "$targetos" = "windows"; then --enable-plugins) plugins="yes"
error_exit "TCG plugins not currently supported on Windows platforms"
else
plugins="yes"
fi
;; ;;
--disable-plugins) plugins="no" --disable-plugins) plugins="no"
;; ;;
@ -807,11 +774,6 @@ then
git_submodules_action="validate" git_submodules_action="validate"
fi fi
# test for any invalid configuration combinations
if test "$plugins" = "yes" -a "$tcg" = "disabled"; then
error_exit "Can't enable plugins on non-TCG builds"
fi
if ! test -f "$source_path/subprojects/keycodemapdb/README" \ if ! test -f "$source_path/subprojects/keycodemapdb/README" \
&& test "$download" = disabled && test "$download" = disabled
then then
@ -887,7 +849,6 @@ Options: [defaults in brackets after descriptions]
Standard options: Standard options:
--help print this message --help print this message
--prefix=PREFIX install in PREFIX [$prefix]
--target-list=LIST set target list (default: build all) --target-list=LIST set target list (default: build all)
$(echo Available targets: $default_target_list | \ $(echo Available targets: $default_target_list | \
fold -s -w 53 | sed -e 's/^/ /') fold -s -w 53 | sed -e 's/^/ /')
@ -910,20 +871,14 @@ Advanced options (experts only):
--cross-prefix-ARCH=PREFIX cross compiler prefix when building ARCH guest test cases --cross-prefix-ARCH=PREFIX cross compiler prefix when building ARCH guest test cases
--python=PYTHON use specified python [$python] --python=PYTHON use specified python [$python]
--ninja=NINJA use specified ninja [$ninja] --ninja=NINJA use specified ninja [$ninja]
--smbd=SMBD use specified smbd [$smbd]
--static enable static build [$static] --static enable static build [$static]
--bindir=PATH install binaries in PATH
--with-suffix=SUFFIX suffix for QEMU data inside datadir/libdir/sysconfdir/docdir [$qemu_suffix]
--without-default-features default all --enable-* options to "disabled" --without-default-features default all --enable-* options to "disabled"
--without-default-devices do not include any device that is not needed to --without-default-devices do not include any device that is not needed to
start the emulator (only use if you are including start the emulator (only use if you are including
desired devices in configs/devices/) desired devices in configs/devices/)
--with-devices-ARCH=NAME override default configs/devices --with-devices-ARCH=NAME override default configs/devices
--enable-debug enable common debug build options --enable-debug enable common debug build options
--disable-werror disable compilation abort on warning
--cpu=CPU Build for host CPU [$cpu] --cpu=CPU Build for host CPU [$cpu]
--enable-plugins
enable plugins via shared library loading
--disable-containers don't use containers for cross-building --disable-containers don't use containers for cross-building
--container-engine=TYPE which container engine to use [$container_engine] --container-engine=TYPE which container engine to use [$container_engine]
--gdb=GDB-path gdb to use for gdbstub tests [$gdb_bin] --gdb=GDB-path gdb to use for gdbstub tests [$gdb_bin]
@ -1046,17 +1001,6 @@ if test -z "$ninja"; then
fi fi
fi fi
# Consult white-list to determine whether to enable werror
# by default. Only enable by default for git builds
if test -z "$werror" ; then
if test -e "$source_path/.git" && \
{ test "$targetos" = linux || test "$targetos" = "windows"; }; then
werror="yes"
else
werror="no"
fi
fi
if test "$targetos" = "bogus"; then if test "$targetos" = "bogus"; then
# Now that we know that we're not printing the help and that # Now that we know that we're not printing the help and that
# the compiler works (so the results of the check_defines we used # the compiler works (so the results of the check_defines we used
@ -1065,15 +1009,27 @@ if test "$targetos" = "bogus"; then
error_exit "Unrecognized host OS (uname -s reports '$(uname -s)')" error_exit "Unrecognized host OS (uname -s reports '$(uname -s)')"
fi fi
# test for any invalid configuration combinations
if test "$targetos" = "windows"; then
if test "$plugins" = "yes"; then
error_exit "TCG plugins not currently supported on Windows platforms"
fi
plugins="no"
fi
if test "$tcg" = "disabled" ; then
if test "$plugins" = "yes"; then
error_exit "Can't enable plugins on non-TCG builds"
fi
plugins="no"
fi
if test "$static" = "yes" ; then if test "$static" = "yes" ; then
if test "$plugins" = "yes"; then if test "$plugins" = "yes"; then
error_exit "static and plugins are mutually incompatible" error_exit "static and plugins are mutually incompatible"
else fi
plugins="no" plugins="no"
fi fi
fi if test "$plugins" != "no"; then
test "$plugins" = "" && plugins=yes plugins=yes
if test "$plugins" = "yes"; then
subdirs="$subdirs contrib/plugins" subdirs="$subdirs contrib/plugins"
fi fi
@ -1088,19 +1044,23 @@ static THREAD int tls_var;
int main(void) { return tls_var; } int main(void) { return tls_var; }
EOF EOF
if test "$targetos" = windows || test "$targetos" = haiku; then
if test "$pie" = "yes"; then
error_exit "PIE not available due to missing OS support"
fi
pie=no
fi
if test "$pie" != "no"; then
if test "$static" = "yes"; then if test "$static" = "yes"; then
if test "$pie" != "no" && compile_prog "-Werror -fPIE -DPIE" "-static-pie"; then pie_ldflags=-static-pie
else
pie_ldflags=-pie
fi
if compile_prog "-Werror -fPIE -DPIE" "$pie_ldflags"; then
pie="yes" pie="yes"
elif test "$pie" = "yes"; then elif test "$pie" = "yes"; then
error_exit "-static-pie not available due to missing toolchain support" error_exit "-static-pie not available due to missing toolchain support"
else
pie="no"
fi
elif test "$pie" != "no"; then
if compile_prog "-Werror -fPIE -DPIE" "-pie"; then
pie="yes"
elif test "$pie" = "yes"; then
error_exit "PIE not available due to missing toolchain support"
else else
echo "Disabling PIE due to missing toolchain support" echo "Disabling PIE due to missing toolchain support"
pie="no" pie="no"
@ -1139,6 +1099,18 @@ if test "$tcg" = "auto"; then
fi fi
fi fi
#########################################
# gdb test
if test -n "$gdb_bin"; then
gdb_version=$($gdb_bin --version | head -n 1)
if version_ge ${gdb_version##* } 9.1; then
gdb_arches=$($python "$source_path/scripts/probe-gdb-support.py" $gdb_bin)
else
gdb_bin=""
fi
fi
########################################## ##########################################
# big/little endian test # big/little endian test
cat > $TMPC << EOF cat > $TMPC << EOF
@ -1166,34 +1138,6 @@ EOF
fi fi
fi fi
########################################
# check if ccache is interfering with
# semantic analysis of macros
unset CCACHE_CPP2
ccache_cpp2=no
cat > $TMPC << EOF
static const int Z = 1;
#define fn() ({ Z; })
#define TAUT(X) ((X) == Z)
#define PAREN(X, Y) (X == Y)
#define ID(X) (X)
int main(void)
{
int x = 0, y = 0;
x = ID(x);
x = fn();
fn();
if (PAREN(x, y)) return 0;
if (TAUT(Z)) return 0;
return 0;
}
EOF
if ! compile_object "-Werror"; then
ccache_cpp2=yes
fi
########################################## ##########################################
# functions to probe cross compilers # functions to probe cross compilers
@ -1337,10 +1281,6 @@ probe_target_compiler() {
container_cross_prefix=aarch64-linux-gnu- container_cross_prefix=aarch64-linux-gnu-
container_cross_cc=${container_cross_prefix}gcc container_cross_cc=${container_cross_prefix}gcc
;; ;;
alpha)
container_image=debian-alpha-cross
container_cross_prefix=alpha-linux-gnu-
;;
arm) arm)
# We don't have any bigendian build tools so we only use this for ARM # We don't have any bigendian build tools so we only use this for ARM
container_image=debian-armhf-cross container_image=debian-armhf-cross
@ -1355,10 +1295,6 @@ probe_target_compiler() {
container_cross_prefix=hexagon-unknown-linux-musl- container_cross_prefix=hexagon-unknown-linux-musl-
container_cross_cc=${container_cross_prefix}clang container_cross_cc=${container_cross_prefix}clang
;; ;;
hppa)
container_image=debian-hppa-cross
container_cross_prefix=hppa-linux-gnu-
;;
i386) i386)
container_image=fedora-i386-cross container_image=fedora-i386-cross
container_cross_prefix= container_cross_prefix=
@ -1367,10 +1303,6 @@ probe_target_compiler() {
container_image=debian-loongarch-cross container_image=debian-loongarch-cross
container_cross_prefix=loongarch64-unknown-linux-gnu- container_cross_prefix=loongarch64-unknown-linux-gnu-
;; ;;
m68k)
container_image=debian-m68k-cross
container_cross_prefix=m68k-linux-gnu-
;;
microblaze) microblaze)
container_image=debian-microblaze-cross container_image=debian-microblaze-cross
container_cross_prefix=microblaze-linux-musl- container_cross_prefix=microblaze-linux-musl-
@ -1383,14 +1315,6 @@ probe_target_compiler() {
container_image=debian-mips64-cross container_image=debian-mips64-cross
container_cross_prefix=mips64-linux-gnuabi64- container_cross_prefix=mips64-linux-gnuabi64-
;; ;;
mipsel)
container_image=debian-mipsel-cross
container_cross_prefix=mipsel-linux-gnu-
;;
mips)
container_image=debian-mips-cross
container_cross_prefix=mips-linux-gnu-
;;
nios2) nios2)
container_image=debian-nios2-cross container_image=debian-nios2-cross
container_cross_prefix=nios2-linux-gnu- container_cross_prefix=nios2-linux-gnu-
@ -1405,22 +1329,6 @@ probe_target_compiler() {
container_cross_prefix=powerpc${target_arch#ppc}-linux-gnu- container_cross_prefix=powerpc${target_arch#ppc}-linux-gnu-
container_cross_cc=${container_cross_prefix}gcc-10 container_cross_cc=${container_cross_prefix}gcc-10
;; ;;
riscv64)
container_image=debian-riscv64-test-cross
container_cross_prefix=riscv64-linux-gnu-
;;
s390x)
container_image=debian-s390x-cross
container_cross_prefix=s390x-linux-gnu-
;;
sh4)
container_image=debian-sh4-cross
container_cross_prefix=sh4-linux-gnu-
;;
sparc64)
container_image=debian-sparc64-cross
container_cross_prefix=sparc64-linux-gnu-
;;
tricore) tricore)
container_image=debian-tricore-cross container_image=debian-tricore-cross
container_cross_prefix=tricore- container_cross_prefix=tricore-
@ -1435,6 +1343,11 @@ probe_target_compiler() {
# default to the dc232b cpu # default to the dc232b cpu
container_cross_prefix=/opt/2020.07/xtensa-dc232b-elf/bin/xtensa-dc232b-elf- container_cross_prefix=/opt/2020.07/xtensa-dc232b-elf/bin/xtensa-dc232b-elf-
;; ;;
*)
# Debian and GNU architecture names usually match
container_image=debian-$target_arch-cross
container_cross_prefix=$target_arch-linux-gnu-
;;
esac esac
: ${container_cross_cc:=${container_cross_prefix}gcc} : ${container_cross_cc:=${container_cross_prefix}gcc}
: ${container_cross_ar:=${container_cross_prefix}ar} : ${container_cross_ar:=${container_cross_prefix}ar}
@ -1679,25 +1592,9 @@ echo >> $config_host_mak
echo all: >> $config_host_mak echo all: >> $config_host_mak
if test "$targetos" = "windows"; then
echo "QEMU_GA_MANUFACTURER=${QEMU_GA_MANUFACTURER-QEMU}" >> $config_host_mak
echo "QEMU_GA_DISTRO=${QEMU_GA_DISTRO-Linux}" >> $config_host_mak
echo "QEMU_GA_VERSION=${QEMU_GA_VERSION-$(cat "$source_path"/VERSION)}" >> $config_host_mak
fi
echo "SRC_PATH=$source_path" >> $config_host_mak echo "SRC_PATH=$source_path" >> $config_host_mak
echo "TARGET_DIRS=$target_list" >> $config_host_mak echo "TARGET_DIRS=$target_list" >> $config_host_mak
echo "GDB=$gdb_bin" >> $config_host_mak
if test -n "$gdb_bin"; then
gdb_version=$($gdb_bin --version | head -n 1)
if version_ge ${gdb_version##* } 9.1; then
echo "HAVE_GDB_BIN=$gdb_bin" >> $config_host_mak
gdb_arches=$($python "$source_path/scripts/probe-gdb-support.py" $gdb_bin)
else
gdb_bin=""
fi
fi
if test "$container" != no; then if test "$container" != no; then
echo "RUNC=$runc" >> $config_host_mak echo "RUNC=$runc" >> $config_host_mak
fi fi
@ -1726,10 +1623,6 @@ if test "$default_targets" = "yes"; then
echo "CONFIG_DEFAULT_TARGETS=y" >> $config_host_mak echo "CONFIG_DEFAULT_TARGETS=y" >> $config_host_mak
fi fi
if test "$ccache_cpp2" = "yes"; then
echo "export CCACHE_CPP2=y" >> $config_host_mak
fi
# contrib/plugins configuration # contrib/plugins configuration
echo "# Automatically generated by configure - do not modify" > contrib/plugins/$config_host_mak echo "# Automatically generated by configure - do not modify" > contrib/plugins/$config_host_mak
echo "SRC_PATH=$source_path/contrib/plugins" >> contrib/plugins/$config_host_mak echo "SRC_PATH=$source_path/contrib/plugins" >> contrib/plugins/$config_host_mak
@ -1746,14 +1639,6 @@ mkdir -p tests/tcg
echo "# Automatically generated by configure - do not modify" > $config_host_mak echo "# Automatically generated by configure - do not modify" > $config_host_mak
echo "SRC_PATH=$source_path" >> $config_host_mak echo "SRC_PATH=$source_path" >> $config_host_mak
# versioned checked in the main config_host.mak above
if test -n "$gdb_bin"; then
echo "HAVE_GDB_BIN=$gdb_bin" >> $config_host_mak
fi
if test "$plugins" = "yes" ; then
echo "CONFIG_PLUGIN=y" >> $config_host_mak
fi
tcg_tests_targets= tcg_tests_targets=
for target in $target_list; do for target in $target_list; do
arch=${target%%-*} arch=${target%%-*}
@ -1786,7 +1671,7 @@ for target in $target_list; do
# will GDB work with these binaries? # will GDB work with these binaries?
if test "${gdb_arches#*$arch}" != "$gdb_arches"; then if test "${gdb_arches#*$arch}" != "$gdb_arches"; then
echo "HOST_GDB_SUPPORTS_ARCH=y" >> "$config_target_mak" echo "GDB=$gdb_bin" >> $config_target_mak
fi fi
echo "run-tcg-tests-$target: $qemu\$(EXESUF)" >> Makefile.prereqs echo "run-tcg-tests-$target: $qemu\$(EXESUF)" >> Makefile.prereqs
@ -1821,6 +1706,29 @@ if test "$skip_meson" = no; then
test -n "$objcc" && echo "objc_args = [$(meson_quote $OBJCFLAGS $EXTRA_OBJCFLAGS)]" >> $cross test -n "$objcc" && echo "objc_args = [$(meson_quote $OBJCFLAGS $EXTRA_OBJCFLAGS)]" >> $cross
echo "c_link_args = [$(meson_quote $CFLAGS $LDFLAGS $EXTRA_CFLAGS $EXTRA_LDFLAGS)]" >> $cross echo "c_link_args = [$(meson_quote $CFLAGS $LDFLAGS $EXTRA_CFLAGS $EXTRA_LDFLAGS)]" >> $cross
echo "cpp_link_args = [$(meson_quote $CXXFLAGS $LDFLAGS $EXTRA_CXXFLAGS $EXTRA_LDFLAGS)]" >> $cross echo "cpp_link_args = [$(meson_quote $CXXFLAGS $LDFLAGS $EXTRA_CXXFLAGS $EXTRA_LDFLAGS)]" >> $cross
# Only enable by default for git builds and on select OSes
echo "# environment defaults, can still be overridden on " >> $cross
echo "# the command line" >> $cross
if test -e "$source_path/.git" && \
{ test "$targetos" = linux || test "$targetos" = "windows"; }; then
echo 'werror = true' >> $cross
fi
echo "[project options]" >> $cross
if test "$SMBD" != ''; then
echo "smbd = $(meson_quote "$SMBD")" >> $cross
fi
if test "${QEMU_GA_MANUFACTURER}" != ''; then
echo "qemu_ga_manufacturer = $(meson_quote "${QEMU_GA_MANUFACTURER}")" >> $cross
fi
if test "${QEMU_GA_DISTRO}" != ''; then
echo "qemu_ga_distro = $(meson_quote "${QEMU_GA_DISTRO}")" >> $cross
fi
if test "${QEMU_GA_VERSION}" != ''; then
echo "qemu_ga_version = $(meson_quote "${QEMU_GA_VERSION}")" >> $cross
fi
echo >> $cross
echo "[binaries]" >> $cross echo "[binaries]" >> $cross
echo "c = [$(meson_quote $cc $CPU_CFLAGS)]" >> $cross echo "c = [$(meson_quote $cc $CPU_CFLAGS)]" >> $cross
test -n "$cxx" && echo "cpp = [$(meson_quote $cxx $CPU_CFLAGS)]" >> $cross test -n "$cxx" && echo "cpp = [$(meson_quote $cxx $CPU_CFLAGS)]" >> $cross
@ -1828,6 +1736,7 @@ if test "$skip_meson" = no; then
echo "ar = [$(meson_quote $ar)]" >> $cross echo "ar = [$(meson_quote $ar)]" >> $cross
echo "nm = [$(meson_quote $nm)]" >> $cross echo "nm = [$(meson_quote $nm)]" >> $cross
echo "pkgconfig = [$(meson_quote $pkg_config)]" >> $cross echo "pkgconfig = [$(meson_quote $pkg_config)]" >> $cross
echo "pkg-config = [$(meson_quote $pkg_config)]" >> $cross
echo "ranlib = [$(meson_quote $ranlib)]" >> $cross echo "ranlib = [$(meson_quote $ranlib)]" >> $cross
if has $sdl2_config; then if has $sdl2_config; then
echo "sdl2-config = [$(meson_quote $sdl2_config)]" >> $cross echo "sdl2-config = [$(meson_quote $sdl2_config)]" >> $cross
@ -1853,39 +1762,36 @@ if test "$skip_meson" = no; then
else else
echo "endian = 'little'" >> $cross echo "endian = 'little'" >> $cross
fi fi
cross_arg="--cross-file config-meson.cross"
native="config-meson.native.new" native="config-meson.native.new"
echo "# Automatically generated by configure - do not modify" > $native echo "# Automatically generated by configure - do not modify" > $native
echo "[binaries]" >> $native echo "[binaries]" >> $native
echo "c = [$(meson_quote $host_cc)]" >> $native echo "c = [$(meson_quote $host_cc)]" >> $native
mv $native config-meson.native mv $native config-meson.native
cross_arg="$cross_arg --native-file config-meson.native" meson_option_add --native-file
else meson_option_add config-meson.native
cross_arg="--native-file config-meson.cross"
fi fi
mv $cross config-meson.cross mv $cross config-meson.cross
meson_add_machine_file config-meson.cross
if test -f "$source_path/configs/meson/$targetos.txt"; then
meson_add_machine_file $source_path/configs/meson/$targetos.txt
fi
rm -rf meson-private meson-info meson-logs rm -rf meson-private meson-info meson-logs
# Built-in options
test "$download" = "disabled" && meson_option_add "--wrap-mode=nodownload" test "$download" = "disabled" && meson_option_add "--wrap-mode=nodownload"
test "$bindir" != "bin" && meson_option_add "-Dbindir=$bindir"
test "$default_feature" = no && meson_option_add -Dauto_features=disabled test "$default_feature" = no && meson_option_add -Dauto_features=disabled
test "$static" = yes && meson_option_add -Dprefer_static=true test "$static" = yes && meson_option_add -Dprefer_static=true
test "$pie" = no && meson_option_add -Db_pie=false test "$pie" = no && meson_option_add -Db_pie=false
test "$werror" = yes && meson_option_add -Dwerror=true
# QEMU options # QEMU options
test "$cfi" != false && meson_option_add "-Dcfi=$cfi" test "$cfi" != false && meson_option_add "-Dcfi=$cfi" "-Db_lto=$cfi"
test "$docs" != auto && meson_option_add "-Ddocs=$docs" test "$docs" != auto && meson_option_add "-Ddocs=$docs"
test -n "${LIB_FUZZING_ENGINE+xxx}" && meson_option_add "-Dfuzzing_engine=$LIB_FUZZING_ENGINE" test -n "${LIB_FUZZING_ENGINE+xxx}" && meson_option_add "-Dfuzzing_engine=$LIB_FUZZING_ENGINE"
test "$plugins" = yes && meson_option_add "-Dplugins=true" test "$plugins" = yes && meson_option_add "-Dplugins=true"
test "$qemu_suffix" != qemu && meson_option_add "-Dqemu_suffix=$qemu_suffix"
test "$smbd" != '' && meson_option_add "-Dsmbd=$smbd"
test "$tcg" != enabled && meson_option_add "-Dtcg=$tcg" test "$tcg" != enabled && meson_option_add "-Dtcg=$tcg"
run_meson() { run_meson() {
NINJA=$ninja $meson setup --prefix "$prefix" "$@" $cross_arg "$PWD" "$source_path" NINJA=$ninja $meson setup "$@" "$PWD" "$source_path"
} }
eval run_meson $meson_options eval run_meson $meson_options
if test "$?" -ne 0 ; then if test "$?" -ne 0 ; then

View file

@ -49,7 +49,7 @@ def serror(file, lnum, errtext):
def parse_directive(line): def parse_directive(line):
"""Return first word of line, if any""" """Return first word of line, if any"""
return re.split('\W', line)[0] return re.split(r'\W', line)[0]
def parse_defheading(file, lnum, line): def parse_defheading(file, lnum, line):
"""Handle a DEFHEADING directive""" """Handle a DEFHEADING directive"""

View file

@ -64,7 +64,6 @@ arm_ss.add(when: 'CONFIG_ARM_SMMUV3', if_true: files('smmuv3.c'))
arm_ss.add(when: 'CONFIG_FSL_IMX6UL', if_true: files('fsl-imx6ul.c', 'mcimx6ul-evk.c')) arm_ss.add(when: 'CONFIG_FSL_IMX6UL', if_true: files('fsl-imx6ul.c', 'mcimx6ul-evk.c'))
arm_ss.add(when: 'CONFIG_NRF51_SOC', if_true: files('nrf51_soc.c')) arm_ss.add(when: 'CONFIG_NRF51_SOC', if_true: files('nrf51_soc.c'))
arm_ss.add(when: 'CONFIG_XEN', if_true: files('xen_arm.c')) arm_ss.add(when: 'CONFIG_XEN', if_true: files('xen_arm.c'))
arm_ss.add_all(xen_ss)
system_ss.add(when: 'CONFIG_ARM_SMMUV3', if_true: files('smmu-common.c')) system_ss.add(when: 'CONFIG_ARM_SMMUV3', if_true: files('smmu-common.c'))
system_ss.add(when: 'CONFIG_EXYNOS4', if_true: files('exynos4_boards.c')) system_ss.add(when: 'CONFIG_EXYNOS4', if_true: files('exynos4_boards.c'))

View file

@ -32,6 +32,5 @@ subdir('kvm')
subdir('xen') subdir('xen')
i386_ss.add_all(xenpv_ss) i386_ss.add_all(xenpv_ss)
i386_ss.add_all(xen_ss)
hw_arch += {'i386': i386_ss} hw_arch += {'i386': i386_ss}

View file

@ -7,9 +7,11 @@ remote_ss.add(when: 'CONFIG_MULTIPROCESS', if_true: files('remote-obj.c'))
remote_ss.add(when: 'CONFIG_MULTIPROCESS', if_true: files('proxy.c')) remote_ss.add(when: 'CONFIG_MULTIPROCESS', if_true: files('proxy.c'))
remote_ss.add(when: 'CONFIG_MULTIPROCESS', if_true: files('iohub.c')) remote_ss.add(when: 'CONFIG_MULTIPROCESS', if_true: files('iohub.c'))
remote_ss.add(when: 'CONFIG_MULTIPROCESS', if_true: files('iommu.c')) remote_ss.add(when: 'CONFIG_MULTIPROCESS', if_true: files('iommu.c'))
remote_ss.add(when: 'CONFIG_VFIO_USER_SERVER', if_true: files('vfio-user-obj.c'))
remote_ss.add(when: 'CONFIG_VFIO_USER_SERVER', if_true: libvfio_user_dep) remote_ss.add(when: 'CONFIG_VFIO_USER_SERVER', if_true: libvfio_user_dep)
remote_ss.add(when: 'CONFIG_VFIO_USER_SERVER', if_true: files('vfio-user-obj.c'),
if_false: files('vfio-user-obj-stub.c'))
remote_ss.add(when: 'CONFIG_ALL', if_true: files('vfio-user-obj-stub.c'))
specific_ss.add(when: 'CONFIG_MULTIPROCESS', if_true: files('memory.c')) specific_ss.add(when: 'CONFIG_MULTIPROCESS', if_true: files('memory.c'))
specific_ss.add(when: 'CONFIG_MULTIPROCESS', if_true: files('proxy-memory-listener.c')) specific_ss.add(when: 'CONFIG_MULTIPROCESS', if_true: files('proxy-memory-listener.c'))

View file

@ -12,6 +12,10 @@ system_ss.add(when: ['CONFIG_XEN', xen], if_true: files(
)) ))
xen_specific_ss = ss.source_set() xen_specific_ss = ss.source_set()
xen_specific_ss.add(files(
'xen-mapcache.c',
'xen-hvm-common.c',
))
if have_xen_pci_passthrough if have_xen_pci_passthrough
xen_specific_ss.add(files( xen_specific_ss.add(files(
'xen-host-pci-device.c', 'xen-host-pci-device.c',
@ -26,10 +30,3 @@ else
endif endif
specific_ss.add_all(when: ['CONFIG_XEN', xen], if_true: xen_specific_ss) specific_ss.add_all(when: ['CONFIG_XEN', xen], if_true: xen_specific_ss)
xen_ss = ss.source_set()
xen_ss.add(when: 'CONFIG_XEN', if_true: files(
'xen-mapcache.c',
'xen-hvm-common.c',
))

View file

@ -212,4 +212,19 @@
# define QEMU_USED # define QEMU_USED
#endif #endif
/*
* Ugly CPP trick that is like "defined FOO", but also works in C
* code. Useful to replace #ifdef with "if" statements; assumes
* the symbol was defined with Meson's "config.set()", so it is empty
* if defined.
*/
#define IS_ENABLED(x) IS_EMPTY(x)
#define IS_EMPTY_JUNK_ junk,
#define IS_EMPTY(value) IS_EMPTY_(IS_EMPTY_JUNK_##value)
/* Expands to either SECOND_ARG(junk, 1, 0) or SECOND_ARG(IS_EMPTY_JUNK_CONFIG_FOO 1, 0) */
#define SECOND_ARG(first, second, ...) second
#define IS_EMPTY_(junk_maybecomma) SECOND_ARG(junk_maybecomma 1, 0)
#endif /* COMPILER_H */ #endif /* COMPILER_H */

View file

@ -2117,6 +2117,7 @@ config_host_data.set('CONFIG_OPENGL', opengl.found())
config_host_data.set('CONFIG_PLUGIN', get_option('plugins')) config_host_data.set('CONFIG_PLUGIN', get_option('plugins'))
config_host_data.set('CONFIG_RBD', rbd.found()) config_host_data.set('CONFIG_RBD', rbd.found())
config_host_data.set('CONFIG_RDMA', rdma.found()) config_host_data.set('CONFIG_RDMA', rdma.found())
config_host_data.set('CONFIG_RELOCATABLE', get_option('relocatable'))
config_host_data.set('CONFIG_SAFESTACK', get_option('safe_stack')) config_host_data.set('CONFIG_SAFESTACK', get_option('safe_stack'))
config_host_data.set('CONFIG_SDL', sdl.found()) config_host_data.set('CONFIG_SDL', sdl.found())
config_host_data.set('CONFIG_SDL_IMAGE', sdl_image.found()) config_host_data.set('CONFIG_SDL_IMAGE', sdl_image.found())
@ -2200,7 +2201,7 @@ if get_option('debug_stack_usage') and have_coroutine_pool
message('Disabling coroutine pool to measure stack usage') message('Disabling coroutine pool to measure stack usage')
have_coroutine_pool = false have_coroutine_pool = false
endif endif
config_host_data.set10('CONFIG_COROUTINE_POOL', have_coroutine_pool) config_host_data.set('CONFIG_COROUTINE_POOL', have_coroutine_pool)
config_host_data.set('CONFIG_DEBUG_GRAPH_LOCK', get_option('debug_graph_lock')) config_host_data.set('CONFIG_DEBUG_GRAPH_LOCK', get_option('debug_graph_lock'))
config_host_data.set('CONFIG_DEBUG_MUTEX', get_option('debug_mutex')) config_host_data.set('CONFIG_DEBUG_MUTEX', get_option('debug_mutex'))
config_host_data.set('CONFIG_DEBUG_STACK_USAGE', get_option('debug_stack_usage')) config_host_data.set('CONFIG_DEBUG_STACK_USAGE', get_option('debug_stack_usage'))
@ -4026,8 +4027,13 @@ summary(summary_info, bool_yn: true, section: 'Directories')
summary_info = {} summary_info = {}
summary_info += {'python': '@0@ (version: @1@)'.format(python.full_path(), python.language_version())} summary_info += {'python': '@0@ (version: @1@)'.format(python.full_path(), python.language_version())}
summary_info += {'sphinx-build': sphinx_build} summary_info += {'sphinx-build': sphinx_build}
if config_host.has_key('HAVE_GDB_BIN')
summary_info += {'gdb': config_host['HAVE_GDB_BIN']} # FIXME: the [binaries] section of machine files, which can be probed
# with find_program(), would be great for passing gdb and genisoimage
# paths from configure to Meson. However, there seems to be no way to
# hide a program (for example if gdb is too old).
if config_host.has_key('GDB')
summary_info += {'gdb': config_host['GDB']}
endif endif
summary_info += {'iasl': iasl} summary_info += {'iasl': iasl}
summary_info += {'genisoimage': config_host['GENISOIMAGE']} summary_info += {'genisoimage': config_host['GENISOIMAGE']}
@ -4060,6 +4066,7 @@ if 'simple' in get_option('trace_backends')
endif endif
summary_info += {'D-Bus display': dbus_display} summary_info += {'D-Bus display': dbus_display}
summary_info += {'QOM debugging': get_option('qom_cast_debug')} summary_info += {'QOM debugging': get_option('qom_cast_debug')}
summary_info += {'Relocatable install': get_option('relocatable')}
summary_info += {'vhost-kernel support': have_vhost_kernel} summary_info += {'vhost-kernel support': have_vhost_kernel}
summary_info += {'vhost-net support': have_vhost_net} summary_info += {'vhost-net support': have_vhost_net}
summary_info += {'vhost-user support': have_vhost_user} summary_info += {'vhost-user support': have_vhost_user}
@ -4363,3 +4370,21 @@ if host_arch == 'unknown' or not supported_oses.contains(targetos)
message('If you want to help supporting QEMU on this platform, please') message('If you want to help supporting QEMU on this platform, please')
message('contact the developers at qemu-devel@nongnu.org.') message('contact the developers at qemu-devel@nongnu.org.')
endif endif
actually_reloc = get_option('relocatable')
# check if get_relocated_path() is actually able to relocate paths
if get_option('relocatable') and \
not (get_option('prefix') / get_option('bindir')).startswith(get_option('prefix') / '')
message()
warning('bindir not included within prefix, the installation will not be relocatable.')
actually_reloc = false
endif
if not actually_reloc and (targetos == 'windows' or get_option('relocatable'))
if targetos == 'windows'
message()
warning('Windows installs should usually be relocatable.')
endif
message()
message('QEMU will have to be installed under ' + get_option('prefix') + '.')
message('Use --disable-relocatable to remove this warning.')
endif

View file

@ -101,6 +101,8 @@ option('cfi_debug', type: 'boolean', value: false,
description: 'Verbose errors in case of CFI violation') description: 'Verbose errors in case of CFI violation')
option('multiprocess', type: 'feature', value: 'auto', option('multiprocess', type: 'feature', value: 'auto',
description: 'Out of process device emulation support') description: 'Out of process device emulation support')
option('relocatable', type : 'boolean', value : 'true',
description: 'toggle relocatable install')
option('vfio_user_server', type: 'feature', value: 'disabled', option('vfio_user_server', type: 'feature', value: 'disabled',
description: 'vfio-user server support') description: 'vfio-user server support')
option('dbus_display', type: 'feature', value: 'auto', option('dbus_display', type: 'feature', value: 'auto',
@ -353,5 +355,12 @@ option('qom_cast_debug', type: 'boolean', value: true,
option('slirp_smbd', type : 'feature', value : 'auto', option('slirp_smbd', type : 'feature', value : 'auto',
description: 'use smbd (at path --smbd=*) in slirp networking') description: 'use smbd (at path --smbd=*) in slirp networking')
option('qemu_ga_manufacturer', type: 'string', value: 'QEMU',
description: '"manufacturer" name for qemu-ga registry entries')
option('qemu_ga_distro', type: 'string', value: 'Linux',
description: 'second path element in qemu-ga registry entries')
option('qemu_ga_version', type: 'string', value: '',
description: 'version number for qemu-ga installer')
option('hexagon_idef_parser', type : 'boolean', value : true, option('hexagon_idef_parser', type : 'boolean', value : true,
description: 'use idef-parser to automatically generate TCG code for the Hexagon frontend') description: 'use idef-parser to automatically generate TCG code for the Hexagon frontend')

View file

@ -145,6 +145,9 @@ if targetos == 'windows'
else else
libpcre = 'libpcre2' libpcre = 'libpcre2'
endif endif
qga_msi_version = get_option('qemu_ga_version') == '' \
? project.version() \
: get_option('qemu_ga_version')
qga_msi = custom_target('QGA MSI', qga_msi = custom_target('QGA MSI',
input: files('installer/qemu-ga.wxs'), input: files('installer/qemu-ga.wxs'),
output: 'qemu-ga-@0@.msi'.format(host_arch), output: 'qemu-ga-@0@.msi'.format(host_arch),
@ -155,9 +158,9 @@ if targetos == 'windows'
qemu_ga_msi_vss, qemu_ga_msi_vss,
'-D', 'BUILD_DIR=' + meson.project_build_root(), '-D', 'BUILD_DIR=' + meson.project_build_root(),
'-D', 'BIN_DIR=' + glib_pc.get_variable('bindir'), '-D', 'BIN_DIR=' + glib_pc.get_variable('bindir'),
'-D', 'QEMU_GA_VERSION=' + config_host['QEMU_GA_VERSION'], '-D', 'QEMU_GA_VERSION=' + qga_msi_version,
'-D', 'QEMU_GA_MANUFACTURER=' + config_host['QEMU_GA_MANUFACTURER'], '-D', 'QEMU_GA_MANUFACTURER=' + get_option('qemu_ga_manufacturer'),
'-D', 'QEMU_GA_DISTRO=' + config_host['QEMU_GA_DISTRO'], '-D', 'QEMU_GA_DISTRO=' + get_option('qemu_ga_distro'),
'-D', 'LIBPCRE=' + libpcre, '-D', 'LIBPCRE=' + libpcre,
]) ])
all_qga += [qga_msi] all_qga += [qga_msi]

0
scripts/feature_to_c.py Executable file → Normal file
View file

View file

@ -907,6 +907,7 @@ sub get_subsystem_name {
if (length($subsystem) > 20) { if (length($subsystem) > 20) {
$subsystem = substr($subsystem, 0, 17); $subsystem = substr($subsystem, 0, 17);
$subsystem =~ s/\s*$//; $subsystem =~ s/\s*$//;
$subsystem =~ s/[()]//g;
$subsystem = $subsystem . "..."; $subsystem = $subsystem . "...";
} }
return $subsystem; return $subsystem;

View file

@ -25,13 +25,15 @@ import textwrap
import shlex import shlex
import sys import sys
# Options with nonstandard names (e.g. --with/--without) or OS-dependent
# defaults. Try not to add any.
SKIP_OPTIONS = { SKIP_OPTIONS = {
"default_devices", "default_devices",
"fuzzing_engine", "fuzzing_engine",
"qemu_suffix",
"smbd",
} }
# Options whose name doesn't match the option for backwards compatibility
# reasons, because Meson gives them a funny name, or both
OPTION_NAMES = { OPTION_NAMES = {
"b_coverage": "gcov", "b_coverage": "gcov",
"b_lto": "lto", "b_lto": "lto",
@ -40,13 +42,25 @@ OPTION_NAMES = {
"malloc": "enable-malloc", "malloc": "enable-malloc",
"pkgversion": "with-pkgversion", "pkgversion": "with-pkgversion",
"qemu_firmwarepath": "firmwarepath", "qemu_firmwarepath": "firmwarepath",
"qemu_suffix": "with-suffix",
"trace_backends": "enable-trace-backends", "trace_backends": "enable-trace-backends",
"trace_file": "with-trace-file", "trace_file": "with-trace-file",
} }
# Options that configure autodetects, even though meson defines them as boolean
AUTO_OPTIONS = {
"plugins",
"werror",
}
# Builtin options that should be definable via configure. Some of the others
# we really do not want (e.g. c_args is defined via the native file, not
# via -D, because it's a mix of CFLAGS and --extra-cflags); for specific
# cases "../configure -D" can be used as an escape hatch.
BUILTIN_OPTIONS = { BUILTIN_OPTIONS = {
"b_coverage", "b_coverage",
"b_lto", "b_lto",
"bindir",
"datadir", "datadir",
"debug", "debug",
"includedir", "includedir",
@ -55,8 +69,10 @@ BUILTIN_OPTIONS = {
"localedir", "localedir",
"localstatedir", "localstatedir",
"mandir", "mandir",
"prefix",
"strip", "strip",
"sysconfdir", "sysconfdir",
"werror",
} }
LINE_WIDTH = 76 LINE_WIDTH = 76
@ -168,6 +184,7 @@ def cli_metavar(opt):
def print_help(options): def print_help(options):
print("meson_options_help() {") print("meson_options_help() {")
feature_opts = []
for opt in sorted(options, key=cli_help_key): for opt in sorted(options, key=cli_help_key):
key = cli_help_key(opt) key = cli_help_key(opt)
# The first section includes options that have an arguments, # The first section includes options that have an arguments,
@ -176,7 +193,7 @@ def print_help(options):
metavar = cli_metavar(opt) metavar = cli_metavar(opt)
left = f"--{key}={metavar}" left = f"--{key}={metavar}"
help_line(left, opt, 27, True) help_line(left, opt, 27, True)
elif opt["type"] == "boolean": elif opt["type"] == "boolean" and opt["name"] not in AUTO_OPTIONS:
left = f"--{key}" left = f"--{key}"
help_line(left, opt, 27, False) help_line(left, opt, 27, False)
elif allow_arg(opt): elif allow_arg(opt):
@ -185,15 +202,16 @@ def print_help(options):
else: else:
left = f"--{key}=CHOICE" left = f"--{key}=CHOICE"
help_line(left, opt, 27, True) help_line(left, opt, 27, True)
else:
feature_opts.append(opt)
sh_print() sh_print()
sh_print("Optional features, enabled with --enable-FEATURE and") sh_print("Optional features, enabled with --enable-FEATURE and")
sh_print("disabled with --disable-FEATURE, default is enabled if available") sh_print("disabled with --disable-FEATURE, default is enabled if available")
sh_print("(unless built with --without-default-features):") sh_print("(unless built with --without-default-features):")
sh_print() sh_print()
for opt in options: for opt in sorted(feature_opts, key=cli_option):
key = opt["name"].replace("_", "-") key = cli_option(opt)
if opt["type"] != "boolean" and not allow_arg(opt):
help_line(key, opt, 18, False) help_line(key, opt, 18, False)
print("}") print("}")

View file

@ -3,6 +3,7 @@ meson_options_help() {
printf "%s\n" ' --audio-drv-list=CHOICES Set audio driver list [default] (choices: alsa/co' printf "%s\n" ' --audio-drv-list=CHOICES Set audio driver list [default] (choices: alsa/co'
printf "%s\n" ' reaudio/default/dsound/jack/oss/pa/pipewire/sdl/s' printf "%s\n" ' reaudio/default/dsound/jack/oss/pa/pipewire/sdl/s'
printf "%s\n" ' ndio)' printf "%s\n" ' ndio)'
printf "%s\n" ' --bindir=VALUE Executable directory [bin]'
printf "%s\n" ' --block-drv-ro-whitelist=VALUE' printf "%s\n" ' --block-drv-ro-whitelist=VALUE'
printf "%s\n" ' set block driver read-only whitelist (by default' printf "%s\n" ' set block driver read-only whitelist (by default'
printf "%s\n" ' affects only QEMU, not tools like qemu-img)' printf "%s\n" ' affects only QEMU, not tools like qemu-img)'
@ -17,6 +18,7 @@ meson_options_help() {
printf "%s\n" ' code for the Hexagon frontend' printf "%s\n" ' code for the Hexagon frontend'
printf "%s\n" ' --disable-install-blobs install provided firmware blobs' printf "%s\n" ' --disable-install-blobs install provided firmware blobs'
printf "%s\n" ' --disable-qom-cast-debug cast debugging support' printf "%s\n" ' --disable-qom-cast-debug cast debugging support'
printf "%s\n" ' --disable-relocatable toggle relocatable install'
printf "%s\n" ' --docdir=VALUE Base directory for documentation installation' printf "%s\n" ' --docdir=VALUE Base directory for documentation installation'
printf "%s\n" ' (can be empty) [share/doc]' printf "%s\n" ' (can be empty) [share/doc]'
printf "%s\n" ' --enable-block-drv-whitelist-in-tools' printf "%s\n" ' --enable-block-drv-whitelist-in-tools'
@ -39,7 +41,6 @@ meson_options_help() {
printf "%s\n" ' jemalloc/system/tcmalloc)' printf "%s\n" ' jemalloc/system/tcmalloc)'
printf "%s\n" ' --enable-module-upgrades try to load modules from alternate paths for' printf "%s\n" ' --enable-module-upgrades try to load modules from alternate paths for'
printf "%s\n" ' upgrades' printf "%s\n" ' upgrades'
printf "%s\n" ' --enable-plugins TCG plugins via shared library loading'
printf "%s\n" ' --enable-rng-none dummy RNG, avoid using /dev/(u)random and' printf "%s\n" ' --enable-rng-none dummy RNG, avoid using /dev/(u)random and'
printf "%s\n" ' getrandom()' printf "%s\n" ' getrandom()'
printf "%s\n" ' --enable-safe-stack SafeStack Stack Smash Protection (requires' printf "%s\n" ' --enable-safe-stack SafeStack Stack Smash Protection (requires'
@ -62,6 +63,14 @@ meson_options_help() {
printf "%s\n" ' --localedir=VALUE Locale data directory [share/locale]' printf "%s\n" ' --localedir=VALUE Locale data directory [share/locale]'
printf "%s\n" ' --localstatedir=VALUE Localstate data directory [/var/local]' printf "%s\n" ' --localstatedir=VALUE Localstate data directory [/var/local]'
printf "%s\n" ' --mandir=VALUE Manual page directory [share/man]' printf "%s\n" ' --mandir=VALUE Manual page directory [share/man]'
printf "%s\n" ' --prefix=VALUE Installation prefix [/usr/local]'
printf "%s\n" ' --qemu-ga-distro=VALUE second path element in qemu-ga registry entries'
printf "%s\n" ' [Linux]'
printf "%s\n" ' --qemu-ga-manufacturer=VALUE'
printf "%s\n" ' "manufacturer" name for qemu-ga registry entries'
printf "%s\n" ' [QEMU]'
printf "%s\n" ' --qemu-ga-version=VALUE version number for qemu-ga installer'
printf "%s\n" ' --smbd=VALUE Path to smbd for slirp networking'
printf "%s\n" ' --sysconfdir=VALUE Sysconf data directory [etc]' printf "%s\n" ' --sysconfdir=VALUE Sysconf data directory [etc]'
printf "%s\n" ' --tls-priority=VALUE Default TLS protocol/cipher priority string' printf "%s\n" ' --tls-priority=VALUE Default TLS protocol/cipher priority string'
printf "%s\n" ' [NORMAL]' printf "%s\n" ' [NORMAL]'
@ -69,6 +78,8 @@ meson_options_help() {
printf "%s\n" ' auto/sigaltstack/ucontext/windows)' printf "%s\n" ' auto/sigaltstack/ucontext/windows)'
printf "%s\n" ' --with-pkgversion=VALUE use specified string as sub-version of the' printf "%s\n" ' --with-pkgversion=VALUE use specified string as sub-version of the'
printf "%s\n" ' package' printf "%s\n" ' package'
printf "%s\n" ' --with-suffix=VALUE Suffix for QEMU data/modules/config directories'
printf "%s\n" ' (can be empty) [qemu]'
printf "%s\n" ' --with-trace-file=VALUE Trace file prefix for simple backend [trace]' printf "%s\n" ' --with-trace-file=VALUE Trace file prefix for simple backend [trace]'
printf "%s\n" '' printf "%s\n" ''
printf "%s\n" 'Optional features, enabled with --enable-FEATURE and' printf "%s\n" 'Optional features, enabled with --enable-FEATURE and'
@ -148,6 +159,7 @@ meson_options_help() {
printf "%s\n" ' pa PulseAudio sound support' printf "%s\n" ' pa PulseAudio sound support'
printf "%s\n" ' parallels parallels image format support' printf "%s\n" ' parallels parallels image format support'
printf "%s\n" ' pipewire PipeWire sound support' printf "%s\n" ' pipewire PipeWire sound support'
printf "%s\n" ' plugins TCG plugins via shared library loading'
printf "%s\n" ' png PNG support with libpng' printf "%s\n" ' png PNG support with libpng'
printf "%s\n" ' pvrdma Enable PVRDMA support' printf "%s\n" ' pvrdma Enable PVRDMA support'
printf "%s\n" ' qcow1 qcow1 image format support' printf "%s\n" ' qcow1 qcow1 image format support'
@ -201,6 +213,7 @@ meson_options_help() {
printf "%s\n" ' vpc vpc image format support' printf "%s\n" ' vpc vpc image format support'
printf "%s\n" ' vte vte support for the gtk UI' printf "%s\n" ' vte vte support for the gtk UI'
printf "%s\n" ' vvfat vvfat image format support' printf "%s\n" ' vvfat vvfat image format support'
printf "%s\n" ' werror Treat warnings as errors'
printf "%s\n" ' whpx WHPX acceleration support' printf "%s\n" ' whpx WHPX acceleration support'
printf "%s\n" ' xen Xen backend support' printf "%s\n" ' xen Xen backend support'
printf "%s\n" ' xen-pci-passthrough' printf "%s\n" ' xen-pci-passthrough'
@ -229,6 +242,7 @@ _meson_option_parse() {
--disable-gcov) printf "%s" -Db_coverage=false ;; --disable-gcov) printf "%s" -Db_coverage=false ;;
--enable-lto) printf "%s" -Db_lto=true ;; --enable-lto) printf "%s" -Db_lto=true ;;
--disable-lto) printf "%s" -Db_lto=false ;; --disable-lto) printf "%s" -Db_lto=false ;;
--bindir=*) quote_sh "-Dbindir=$2" ;;
--enable-blkio) printf "%s" -Dblkio=enabled ;; --enable-blkio) printf "%s" -Dblkio=enabled ;;
--disable-blkio) printf "%s" -Dblkio=disabled ;; --disable-blkio) printf "%s" -Dblkio=disabled ;;
--block-drv-ro-whitelist=*) quote_sh "-Dblock_drv_ro_whitelist=$2" ;; --block-drv-ro-whitelist=*) quote_sh "-Dblock_drv_ro_whitelist=$2" ;;
@ -407,6 +421,7 @@ _meson_option_parse() {
--disable-plugins) printf "%s" -Dplugins=false ;; --disable-plugins) printf "%s" -Dplugins=false ;;
--enable-png) printf "%s" -Dpng=enabled ;; --enable-png) printf "%s" -Dpng=enabled ;;
--disable-png) printf "%s" -Dpng=disabled ;; --disable-png) printf "%s" -Dpng=disabled ;;
--prefix=*) quote_sh "-Dprefix=$2" ;;
--enable-pvrdma) printf "%s" -Dpvrdma=enabled ;; --enable-pvrdma) printf "%s" -Dpvrdma=enabled ;;
--disable-pvrdma) printf "%s" -Dpvrdma=disabled ;; --disable-pvrdma) printf "%s" -Dpvrdma=disabled ;;
--enable-qcow1) printf "%s" -Dqcow1=enabled ;; --enable-qcow1) printf "%s" -Dqcow1=enabled ;;
@ -414,6 +429,10 @@ _meson_option_parse() {
--enable-qed) printf "%s" -Dqed=enabled ;; --enable-qed) printf "%s" -Dqed=enabled ;;
--disable-qed) printf "%s" -Dqed=disabled ;; --disable-qed) printf "%s" -Dqed=disabled ;;
--firmwarepath=*) quote_sh "-Dqemu_firmwarepath=$(meson_option_build_array $2)" ;; --firmwarepath=*) quote_sh "-Dqemu_firmwarepath=$(meson_option_build_array $2)" ;;
--qemu-ga-distro=*) quote_sh "-Dqemu_ga_distro=$2" ;;
--qemu-ga-manufacturer=*) quote_sh "-Dqemu_ga_manufacturer=$2" ;;
--qemu-ga-version=*) quote_sh "-Dqemu_ga_version=$2" ;;
--with-suffix=*) quote_sh "-Dqemu_suffix=$2" ;;
--enable-qga-vss) printf "%s" -Dqga_vss=enabled ;; --enable-qga-vss) printf "%s" -Dqga_vss=enabled ;;
--disable-qga-vss) printf "%s" -Dqga_vss=disabled ;; --disable-qga-vss) printf "%s" -Dqga_vss=disabled ;;
--enable-qom-cast-debug) printf "%s" -Dqom_cast_debug=true ;; --enable-qom-cast-debug) printf "%s" -Dqom_cast_debug=true ;;
@ -422,6 +441,8 @@ _meson_option_parse() {
--disable-rbd) printf "%s" -Drbd=disabled ;; --disable-rbd) printf "%s" -Drbd=disabled ;;
--enable-rdma) printf "%s" -Drdma=enabled ;; --enable-rdma) printf "%s" -Drdma=enabled ;;
--disable-rdma) printf "%s" -Drdma=disabled ;; --disable-rdma) printf "%s" -Drdma=disabled ;;
--enable-relocatable) printf "%s" -Drelocatable=true ;;
--disable-relocatable) printf "%s" -Drelocatable=false ;;
--enable-replication) printf "%s" -Dreplication=enabled ;; --enable-replication) printf "%s" -Dreplication=enabled ;;
--disable-replication) printf "%s" -Dreplication=disabled ;; --disable-replication) printf "%s" -Dreplication=disabled ;;
--enable-rng-none) printf "%s" -Drng_none=true ;; --enable-rng-none) printf "%s" -Drng_none=true ;;
@ -446,6 +467,7 @@ _meson_option_parse() {
--disable-slirp-smbd) printf "%s" -Dslirp_smbd=disabled ;; --disable-slirp-smbd) printf "%s" -Dslirp_smbd=disabled ;;
--enable-smartcard) printf "%s" -Dsmartcard=enabled ;; --enable-smartcard) printf "%s" -Dsmartcard=enabled ;;
--disable-smartcard) printf "%s" -Dsmartcard=disabled ;; --disable-smartcard) printf "%s" -Dsmartcard=disabled ;;
--smbd=*) quote_sh "-Dsmbd=$2" ;;
--enable-snappy) printf "%s" -Dsnappy=enabled ;; --enable-snappy) printf "%s" -Dsnappy=enabled ;;
--disable-snappy) printf "%s" -Dsnappy=disabled ;; --disable-snappy) printf "%s" -Dsnappy=disabled ;;
--enable-sndio) printf "%s" -Dsndio=enabled ;; --enable-sndio) printf "%s" -Dsndio=enabled ;;
@ -522,6 +544,8 @@ _meson_option_parse() {
--disable-vte) printf "%s" -Dvte=disabled ;; --disable-vte) printf "%s" -Dvte=disabled ;;
--enable-vvfat) printf "%s" -Dvvfat=enabled ;; --enable-vvfat) printf "%s" -Dvvfat=enabled ;;
--disable-vvfat) printf "%s" -Dvvfat=disabled ;; --disable-vvfat) printf "%s" -Dvvfat=disabled ;;
--enable-werror) printf "%s" -Dwerror=true ;;
--disable-werror) printf "%s" -Dwerror=false ;;
--enable-whpx) printf "%s" -Dwhpx=enabled ;; --enable-whpx) printf "%s" -Dwhpx=enabled ;;
--disable-whpx) printf "%s" -Dwhpx=disabled ;; --disable-whpx) printf "%s" -Dwhpx=disabled ;;
--enable-xen) printf "%s" -Dxen=enabled ;; --enable-xen) printf "%s" -Dxen=enabled ;;

View file

@ -210,12 +210,12 @@ class Event(object):
""" """
_CRE = re.compile("((?P<props>[\w\s]+)\s+)?" _CRE = re.compile(r"((?P<props>[\w\s]+)\s+)?"
"(?P<name>\w+)" r"(?P<name>\w+)"
"\((?P<args>[^)]*)\)" r"\((?P<args>[^)]*)\)"
"\s*" r"\s*"
"(?:(?:(?P<fmt_trans>\".+),)?\s*(?P<fmt>\".+))?" r"(?:(?:(?P<fmt_trans>\".+),)?\s*(?P<fmt>\".+))?"
"\s*") r"\s*")
_VALID_PROPS = set(["disable", "vcpu"]) _VALID_PROPS = set(["disable", "vcpu"])
@ -326,7 +326,7 @@ class Event(object):
fmt) fmt)
# Star matching on PRI is dangerous as one might have multiple # Star matching on PRI is dangerous as one might have multiple
# arguments with that format, hence the non-greedy version of it. # arguments with that format, hence the non-greedy version of it.
_FMT = re.compile("(%[\d\.]*\w+|%.*?PRI\S+)") _FMT = re.compile(r"(%[\d\.]*\w+|%.*?PRI\S+)")
def formats(self): def formats(self):
"""List conversion specifiers in the argument print format string.""" """List conversion specifiers in the argument print format string."""

View file

@ -83,7 +83,7 @@ def c_fmt_to_stap(fmt):
# and "%ll" is not valid at all. Similarly the size_t # and "%ll" is not valid at all. Similarly the size_t
# based "%z" size qualifier is not valid. We just # based "%z" size qualifier is not valid. We just
# strip all size qualifiers for sanity. # strip all size qualifiers for sanity.
fmt = re.sub("%(\d*)(l+|z)(x|u|d)", "%\\1\\3", "".join(bits)) fmt = re.sub(r"%(\d*)(l+|z)(x|u|d)", r"%\1\3", "".join(bits))
return fmt return fmt
def generate(events, backend, group): def generate(events, backend, group):

View file

@ -65,4 +65,3 @@ else
stub_ss.add(files('qdev.c')) stub_ss.add(files('qdev.c'))
endif endif
stub_ss.add(files('semihost-all.c')) stub_ss.add(files('semihost-all.c'))
stub_ss.add(when: 'CONFIG_VFIO_USER_SERVER', if_false: files('vfio-user-obj.c'))

View file

@ -45,7 +45,7 @@ regre = re.compile(r"((?<!DUP)[MNORCPQXSGVZA])([stuvwxyzdefg]+)([.]?[LlHh]?)(\d+
immre = re.compile(r"[#]([rRsSuUm])(\d+)(?:[:](\d+))?") immre = re.compile(r"[#]([rRsSuUm])(\d+)(?:[:](\d+))?")
reg_or_immre = re.compile( reg_or_immre = re.compile(
r"(((?<!DUP)[MNRCOPQXSGVZA])([stuvwxyzdefg]+)" r"(((?<!DUP)[MNRCOPQXSGVZA])([stuvwxyzdefg]+)"
+ "([.]?[LlHh]?)(\d+S?))|([#]([rRsSuUm])(\d+)[:]?(\d+)?)" r"([.]?[LlHh]?)(\d+S?))|([#]([rRsSuUm])(\d+)[:]?(\d+)?)"
) )
relimmre = re.compile(r"[#]([rR])(\d+)(?:[:](\d+))?") relimmre = re.compile(r"[#]([rR])(\d+)(?:[:](\d+))?")
absimmre = re.compile(r"[#]([sSuUm])(\d+)(?:[:](\d+))?") absimmre = re.compile(r"[#]([sSuUm])(\d+)(?:[:](\d+))?")
@ -337,7 +337,7 @@ def read_attribs_file(name):
def read_overrides_file(name): def read_overrides_file(name):
overridere = re.compile("#define fGEN_TCG_([A-Za-z0-9_]+)\(.*") overridere = re.compile(r"#define fGEN_TCG_([A-Za-z0-9_]+)\(.*")
for line in open(name, "rt").readlines(): for line in open(name, "rt").readlines():
if not overridere.match(line): if not overridere.match(line):
continue continue

View file

@ -778,6 +778,7 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = {
}, },
.cpuid = {.eax = 1, .reg = R_EDX, }, .cpuid = {.eax = 1, .reg = R_EDX, },
.tcg_features = TCG_FEATURES, .tcg_features = TCG_FEATURES,
.no_autoenable_flags = CPUID_HT,
}, },
[FEAT_1_ECX] = { [FEAT_1_ECX] = {
.type = CPUID_FEATURE_WORD, .type = CPUID_FEATURE_WORD,

View file

@ -373,6 +373,8 @@ uint32_t kvm_arch_get_supported_cpuid(KVMState *s, uint32_t function,
if (function == 1 && reg == R_EDX) { if (function == 1 && reg == R_EDX) {
/* KVM before 2.6.30 misreports the following features */ /* KVM before 2.6.30 misreports the following features */
ret |= CPUID_MTRR | CPUID_PAT | CPUID_MCE | CPUID_MCA; ret |= CPUID_MTRR | CPUID_PAT | CPUID_MCE | CPUID_MCA;
/* KVM never reports CPUID_HT but QEMU can support when vcpus > 1 */
ret |= CPUID_HT;
} else if (function == 1 && reg == R_ECX) { } else if (function == 1 && reg == R_ECX) {
/* We can set the hypervisor flag, even if KVM does not return it on /* We can set the hypervisor flag, even if KVM does not return it on
* GET_SUPPORTED_CPUID * GET_SUPPORTED_CPUID

View file

@ -132,6 +132,7 @@
/* only included in documentation, maybe wrong */ /* only included in documentation, maybe wrong */
#define SVM_EXIT_MONITOR 0x08a #define SVM_EXIT_MONITOR 0x08a
#define SVM_EXIT_MWAIT 0x08b #define SVM_EXIT_MWAIT 0x08b
#define SVM_EXIT_XSETBV 0x08d
#define SVM_EXIT_NPF 0x400 #define SVM_EXIT_NPF 0x400
#define SVM_EXIT_ERR -1 #define SVM_EXIT_ERR -1

View file

@ -5916,6 +5916,7 @@ static bool disas_insn(DisasContext *s, CPUState *cpu)
| PREFIX_REPZ | PREFIX_REPNZ))) { | PREFIX_REPZ | PREFIX_REPNZ))) {
goto illegal_op; goto illegal_op;
} }
gen_svm_check_intercept(s, SVM_EXIT_XSETBV);
if (!check_cpl0(s)) { if (!check_cpl0(s)) {
break; break;
} }

View file

@ -43,7 +43,7 @@ VM_DEV_PARAMS = {'virtio-scsi-pci': ['-device', 'virtio-scsi-pci,id=scsi0'],
class VirtioMaxSegSettingsCheck(QemuSystemTest): class VirtioMaxSegSettingsCheck(QemuSystemTest):
@staticmethod @staticmethod
def make_pattern(props): def make_pattern(props):
pattern_items = ['{0} = \w+'.format(prop) for prop in props] pattern_items = [r'{0} = \w+'.format(prop) for prop in props]
return '|'.join(pattern_items) return '|'.join(pattern_items)
def query_virtqueue(self, vm, dev_type_name): def query_virtqueue(self, vm, dev_type_name):

View file

@ -186,7 +186,7 @@ def _check_binfmt_misc(executable):
(binary)) (binary))
return None, True return None, True
m = re.search("interpreter (\S+)\n", entry) m = re.search(r"interpreter (\S+)\n", entry)
interp = m.group(1) interp = m.group(1)
if interp and interp != executable: if interp and interp != executable:
print("binfmt_misc for %s does not point to %s, using %s" % print("binfmt_misc for %s does not point to %s, using %s" %

View file

@ -68,7 +68,7 @@ def run_linter(
:raise CalledProcessError: If the linter process exits with failure. :raise CalledProcessError: If the linter process exits with failure.
""" """
subprocess.run( subprocess.run(
('python3', '-m', tool, *args), (sys.executable, '-m', tool, *args),
env=env, env=env,
check=True, check=True,
stdout=subprocess.PIPE if suppress_output else None, stdout=subprocess.PIPE if suppress_output else None,

View file

@ -216,7 +216,7 @@ class TestEnv(ContextManager['TestEnv']):
self.source_iotests = source_dir self.source_iotests = source_dir
self.build_iotests = build_dir self.build_iotests = build_dir
self.build_root = os.path.join(self.build_iotests, '..', '..') self.build_root = Path(self.build_iotests).parent.parent
self.init_directories() self.init_directories()

View file

@ -73,11 +73,6 @@ endif
# System Registers Tests # System Registers Tests
AARCH64_TESTS += sysregs AARCH64_TESTS += sysregs
ifneq ($(CROSS_CC_HAS_SVE),)
# SVE ioctl test
AARCH64_TESTS += sve-ioctls
sve-ioctls: CFLAGS+=-march=armv8.1-a+sve
AARCH64_TESTS += test-aes AARCH64_TESTS += test-aes
test-aes: CFLAGS += -O -march=armv8-a+aes test-aes: CFLAGS += -O -march=armv8-a+aes
test-aes: test-aes-main.c.inc test-aes: test-aes-main.c.inc
@ -100,26 +95,29 @@ sha512-vector: sha512.c
TESTS += sha512-vector TESTS += sha512-vector
ifneq ($(CROSS_CC_HAS_SVE),) ifneq ($(CROSS_CC_HAS_SVE),)
# SVE ioctl test
AARCH64_TESTS += sve-ioctls
sve-ioctls: CFLAGS+=-march=armv8.1-a+sve
sha512-sve: CFLAGS=-O3 -march=armv8.1-a+sve sha512-sve: CFLAGS=-O3 -march=armv8.1-a+sve
sha512-sve: sha512.c sha512-sve: sha512.c
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $< -o $@ $(LDFLAGS) $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $< -o $@ $(LDFLAGS)
TESTS += sha512-sve TESTS += sha512-sve
endif
ifeq ($(HOST_GDB_SUPPORTS_ARCH),y) ifneq ($(GDB),)
GDB_SCRIPT=$(SRC_PATH)/tests/guest-debug/run-test.py GDB_SCRIPT=$(SRC_PATH)/tests/guest-debug/run-test.py
run-gdbstub-sysregs: sysregs run-gdbstub-sysregs: sysregs
$(call run-test, $@, $(GDB_SCRIPT) \ $(call run-test, $@, $(GDB_SCRIPT) \
--gdb $(HAVE_GDB_BIN) \ --gdb $(GDB) \
--qemu $(QEMU) --qargs "$(QEMU_OPTS)" \ --qemu $(QEMU) --qargs "$(QEMU_OPTS)" \
--bin $< --test $(AARCH64_SRC)/gdbstub/test-sve.py, \ --bin $< --test $(AARCH64_SRC)/gdbstub/test-sve.py, \
basic gdbstub SVE support) basic gdbstub SVE support)
run-gdbstub-sve-ioctls: sve-ioctls run-gdbstub-sve-ioctls: sve-ioctls
$(call run-test, $@, $(GDB_SCRIPT) \ $(call run-test, $@, $(GDB_SCRIPT) \
--gdb $(HAVE_GDB_BIN) \ --gdb $(GDB) \
--qemu $(QEMU) --qargs "$(QEMU_OPTS)" \ --qemu $(QEMU) --qargs "$(QEMU_OPTS)" \
--bin $< --test $(AARCH64_SRC)/gdbstub/test-sve-ioctl.py, \ --bin $< --test $(AARCH64_SRC)/gdbstub/test-sve-ioctl.py, \
basic gdbstub SVE ZLEN support) basic gdbstub SVE ZLEN support)

View file

@ -63,45 +63,39 @@ run-test-mmap: test-mmap
run-test-mmap-%: test-mmap run-test-mmap-%: test-mmap
$(call run-test, test-mmap-$*, $(QEMU) -p $* $<, $< ($* byte pages)) $(call run-test, test-mmap-$*, $(QEMU) -p $* $<, $< ($* byte pages))
ifneq ($(HAVE_GDB_BIN),) ifneq ($(GDB),)
ifeq ($(HOST_GDB_SUPPORTS_ARCH),y)
GDB_SCRIPT=$(SRC_PATH)/tests/guest-debug/run-test.py GDB_SCRIPT=$(SRC_PATH)/tests/guest-debug/run-test.py
run-gdbstub-sha1: sha1 run-gdbstub-sha1: sha1
$(call run-test, $@, $(GDB_SCRIPT) \ $(call run-test, $@, $(GDB_SCRIPT) \
--gdb $(HAVE_GDB_BIN) \ --gdb $(GDB) \
--qemu $(QEMU) --qargs "$(QEMU_OPTS)" \ --qemu $(QEMU) --qargs "$(QEMU_OPTS)" \
--bin $< --test $(MULTIARCH_SRC)/gdbstub/sha1.py, \ --bin $< --test $(MULTIARCH_SRC)/gdbstub/sha1.py, \
basic gdbstub support) basic gdbstub support)
run-gdbstub-qxfer-auxv-read: sha1 run-gdbstub-qxfer-auxv-read: sha1
$(call run-test, $@, $(GDB_SCRIPT) \ $(call run-test, $@, $(GDB_SCRIPT) \
--gdb $(HAVE_GDB_BIN) \ --gdb $(GDB) \
--qemu $(QEMU) --qargs "$(QEMU_OPTS)" \ --qemu $(QEMU) --qargs "$(QEMU_OPTS)" \
--bin $< --test $(MULTIARCH_SRC)/gdbstub/test-qxfer-auxv-read.py, \ --bin $< --test $(MULTIARCH_SRC)/gdbstub/test-qxfer-auxv-read.py, \
basic gdbstub qXfer:auxv:read support) basic gdbstub qXfer:auxv:read support)
run-gdbstub-proc-mappings: sha1 run-gdbstub-proc-mappings: sha1
$(call run-test, $@, $(GDB_SCRIPT) \ $(call run-test, $@, $(GDB_SCRIPT) \
--gdb $(HAVE_GDB_BIN) \ --gdb $(GDB) \
--qemu $(QEMU) --qargs "$(QEMU_OPTS)" \ --qemu $(QEMU) --qargs "$(QEMU_OPTS)" \
--bin $< --test $(MULTIARCH_SRC)/gdbstub/test-proc-mappings.py, \ --bin $< --test $(MULTIARCH_SRC)/gdbstub/test-proc-mappings.py, \
proc mappings support) proc mappings support)
run-gdbstub-thread-breakpoint: testthread run-gdbstub-thread-breakpoint: testthread
$(call run-test, $@, $(GDB_SCRIPT) \ $(call run-test, $@, $(GDB_SCRIPT) \
--gdb $(HAVE_GDB_BIN) \ --gdb $(GDB) \
--qemu $(QEMU) --qargs "$(QEMU_OPTS)" \ --qemu $(QEMU) --qargs "$(QEMU_OPTS)" \
--bin $< --test $(MULTIARCH_SRC)/gdbstub/test-thread-breakpoint.py, \ --bin $< --test $(MULTIARCH_SRC)/gdbstub/test-thread-breakpoint.py, \
hitting a breakpoint on non-main thread) hitting a breakpoint on non-main thread)
else else
run-gdbstub-%: run-gdbstub-%:
$(call skip-test, "gdbstub test $*", "no guest arch support") $(call skip-test, "gdbstub test $*", "need working gdb with $(patsubst -%,,$(TARGET_NAME)) support")
endif
else
run-gdbstub-%:
$(call skip-test, "gdbstub test $*", "need working gdb")
endif endif
EXTRA_RUNS += run-gdbstub-sha1 run-gdbstub-qxfer-auxv-read \ EXTRA_RUNS += run-gdbstub-sha1 run-gdbstub-qxfer-auxv-read \
run-gdbstub-proc-mappings run-gdbstub-thread-breakpoint run-gdbstub-proc-mappings run-gdbstub-thread-breakpoint

View file

@ -14,13 +14,12 @@ VPATH+=$(MULTIARCH_SYSTEM_SRC)
MULTIARCH_TEST_SRCS=$(wildcard $(MULTIARCH_SYSTEM_SRC)/*.c) MULTIARCH_TEST_SRCS=$(wildcard $(MULTIARCH_SYSTEM_SRC)/*.c)
MULTIARCH_TESTS = $(patsubst $(MULTIARCH_SYSTEM_SRC)/%.c, %, $(MULTIARCH_TEST_SRCS)) MULTIARCH_TESTS = $(patsubst $(MULTIARCH_SYSTEM_SRC)/%.c, %, $(MULTIARCH_TEST_SRCS))
ifneq ($(HAVE_GDB_BIN),) ifneq ($(GDB),)
ifeq ($(HOST_GDB_SUPPORTS_ARCH),y)
GDB_SCRIPT=$(SRC_PATH)/tests/guest-debug/run-test.py GDB_SCRIPT=$(SRC_PATH)/tests/guest-debug/run-test.py
run-gdbstub-memory: memory run-gdbstub-memory: memory
$(call run-test, $@, $(GDB_SCRIPT) \ $(call run-test, $@, $(GDB_SCRIPT) \
--gdb $(HAVE_GDB_BIN) \ --gdb $(GDB) \
--qemu $(QEMU) \ --qemu $(QEMU) \
--output $<.gdb.out \ --output $<.gdb.out \
--qargs \ --qargs \
@ -29,7 +28,7 @@ run-gdbstub-memory: memory
softmmu gdbstub support) softmmu gdbstub support)
run-gdbstub-interrupt: interrupt run-gdbstub-interrupt: interrupt
$(call run-test, $@, $(GDB_SCRIPT) \ $(call run-test, $@, $(GDB_SCRIPT) \
--gdb $(HAVE_GDB_BIN) \ --gdb $(GDB) \
--qemu $(QEMU) \ --qemu $(QEMU) \
--output $<.gdb.out \ --output $<.gdb.out \
--qargs \ --qargs \
@ -38,7 +37,7 @@ run-gdbstub-interrupt: interrupt
softmmu gdbstub support) softmmu gdbstub support)
run-gdbstub-untimely-packet: hello run-gdbstub-untimely-packet: hello
$(call run-test, $@, $(GDB_SCRIPT) \ $(call run-test, $@, $(GDB_SCRIPT) \
--gdb $(HAVE_GDB_BIN) \ --gdb $(GDB) \
--gdb-args "-ex 'set debug remote 1'" \ --gdb-args "-ex 'set debug remote 1'" \
--output untimely-packet.gdb.out \ --output untimely-packet.gdb.out \
--stderr untimely-packet.gdb.err \ --stderr untimely-packet.gdb.err \
@ -51,11 +50,7 @@ run-gdbstub-untimely-packet: hello
"GREP", file untimely-packet.gdb.err) "GREP", file untimely-packet.gdb.err)
else else
run-gdbstub-%: run-gdbstub-%:
$(call skip-test, "gdbstub test $*", "no guest arch support") $(call skip-test, "gdbstub test $*", "need working gdb with $(patsubst -%,,$(TARGET_NAME)) support")
endif
else
run-gdbstub-%:
$(call skip-test, "gdbstub test $*", "need working gdb")
endif endif
MULTIARCH_RUNS += run-gdbstub-memory run-gdbstub-interrupt run-gdbstub-untimely-packet MULTIARCH_RUNS += run-gdbstub-memory run-gdbstub-interrupt run-gdbstub-untimely-packet

View file

@ -81,12 +81,12 @@ $(Z15_TESTS): CFLAGS+=-march=z15 -O2
TESTS+=$(Z15_TESTS) TESTS+=$(Z15_TESTS)
endif endif
ifeq ($(HOST_GDB_SUPPORTS_ARCH),y) ifneq ($(GDB),)
GDB_SCRIPT=$(SRC_PATH)/tests/guest-debug/run-test.py GDB_SCRIPT=$(SRC_PATH)/tests/guest-debug/run-test.py
run-gdbstub-signals-s390x: signals-s390x run-gdbstub-signals-s390x: signals-s390x
$(call run-test, $@, $(GDB_SCRIPT) \ $(call run-test, $@, $(GDB_SCRIPT) \
--gdb $(HAVE_GDB_BIN) \ --gdb $(GDB) \
--qemu $(QEMU) --qargs "$(QEMU_OPTS)" \ --qemu $(QEMU) --qargs "$(QEMU_OPTS)" \
--bin $< --test $(S390X_SRC)/gdbstub/test-signals-s390x.py, \ --bin $< --test $(S390X_SRC)/gdbstub/test-signals-s390x.py, \
mixing signals and debugging) mixing signals and debugging)
@ -95,7 +95,7 @@ hello-s390x-asm: CFLAGS+=-nostdlib
run-gdbstub-svc: hello-s390x-asm run-gdbstub-svc: hello-s390x-asm
$(call run-test, $@, $(GDB_SCRIPT) \ $(call run-test, $@, $(GDB_SCRIPT) \
--gdb $(HAVE_GDB_BIN) \ --gdb $(GDB) \
--qemu $(QEMU) --qargs "$(QEMU_OPTS)" \ --qemu $(QEMU) --qargs "$(QEMU_OPTS)" \
--bin $< --test $(S390X_SRC)/gdbstub/test-svc.py, \ --bin $< --test $(S390X_SRC)/gdbstub/test-svc.py, \
single-stepping svc) single-stepping svc)

View file

@ -645,7 +645,7 @@ int main(int argc, char **argv)
* with a sentinel value. If there is no freelist this would legitimately * with a sentinel value. If there is no freelist this would legitimately
* crash, so skip it. * crash, so skip it.
*/ */
if (CONFIG_COROUTINE_POOL) { if (IS_ENABLED(CONFIG_COROUTINE_POOL)) {
g_test_add_func("/basic/no-dangling-access", test_no_dangling_access); g_test_add_func("/basic/no-dangling-access", test_no_dangling_access);
} }

View file

@ -331,8 +331,8 @@ class BaseVM(object):
def console_log(self, text): def console_log(self, text):
for line in re.split("[\r\n]", text): for line in re.split("[\r\n]", text):
# filter out terminal escape sequences # filter out terminal escape sequences
line = re.sub("\x1b\[[0-9;?]*[a-zA-Z]", "", line) line = re.sub("\x1b\\[[0-9;?]*[a-zA-Z]", "", line)
line = re.sub("\x1b\([0-9;?]*[a-zA-Z]", "", line) line = re.sub("\x1b\\([0-9;?]*[a-zA-Z]", "", line)
# replace unprintable chars # replace unprintable chars
line = re.sub("\x1b", "<esc>", line) line = re.sub("\x1b", "<esc>", line)
line = re.sub("[\x00-\x1f]", ".", line) line = re.sub("[\x00-\x1f]", ".", line)
@ -530,7 +530,7 @@ def get_qemu_version(qemu_path):
and return the major number.""" and return the major number."""
output = subprocess.check_output([qemu_path, '--version']) output = subprocess.check_output([qemu_path, '--version'])
version_line = output.decode("utf-8") version_line = output.decode("utf-8")
version_num = re.split(' |\(', version_line)[3].split('.')[0] version_num = re.split(r' |\(', version_line)[3].split('.')[0]
return int(version_num) return int(version_num)
def parse_config(config, args): def parse_config(config, args):

View file

@ -40,6 +40,9 @@ class NetBSDVM(basevm.BaseVM):
"gsed", "gsed",
"gettext-tools", "gettext-tools",
# libs: basic
"dtc",
# libs: crypto # libs: crypto
"gnutls", "gnutls",
@ -67,7 +70,8 @@ class NetBSDVM(basevm.BaseVM):
mkdir src build; cd src; mkdir src build; cd src;
tar -xf /dev/rld1a; tar -xf /dev/rld1a;
cd ../build cd ../build
../src/configure --disable-opengl {configure_opts}; ../src/configure --disable-opengl --extra-ldflags=-L/usr/pkg/lib \
--extra-cflags=-I/usr/pkg/include {configure_opts};
gmake --output-sync -j{jobs} {target} {verbose}; gmake --output-sync -j{jobs} {target} {verbose};
""" """
poweroff = "/sbin/poweroff" poweroff = "/sbin/poweroff"

View file

@ -10,5 +10,6 @@ foreach e : shaders
output: output, output: output,
capture: true, capture: true,
input: files('@0@.@1@'.format(e[0], e[1])), input: files('@0@.@1@'.format(e[0], e[1])),
build_by_default: false,
command: [shaderinclude, '@INPUT0@']) command: [shaderinclude, '@INPUT0@'])
endforeach endforeach

View file

@ -1178,9 +1178,11 @@ char *get_relocated_path(const char *dir)
#else #else
g_string_append(result, dir); g_string_append(result, dir);
#endif #endif
} else if (!starts_with_prefix(dir) || !starts_with_prefix(bindir)) { goto out;
g_string_assign(result, dir); }
} else {
if (IS_ENABLED(CONFIG_RELOCATABLE) &&
starts_with_prefix(dir) && starts_with_prefix(bindir)) {
g_string_assign(result, exec_dir); g_string_assign(result, exec_dir);
/* Advance over common components. */ /* Advance over common components. */
@ -1203,7 +1205,10 @@ char *get_relocated_path(const char *dir)
assert(G_IS_DIR_SEPARATOR(dir[-1])); assert(G_IS_DIR_SEPARATOR(dir[-1]));
g_string_append(result, dir - 1); g_string_append(result, dir - 1);
} }
goto out;
} }
g_string_assign(result, dir);
out:
return g_string_free(result, false); return g_string_free(result, false);
} }

View file

@ -57,7 +57,7 @@ Coroutine *qemu_coroutine_create(CoroutineEntry *entry, void *opaque)
{ {
Coroutine *co = NULL; Coroutine *co = NULL;
if (CONFIG_COROUTINE_POOL) { if (IS_ENABLED(CONFIG_COROUTINE_POOL)) {
CoroutineQSList *alloc_pool = get_ptr_alloc_pool(); CoroutineQSList *alloc_pool = get_ptr_alloc_pool();
co = QSLIST_FIRST(alloc_pool); co = QSLIST_FIRST(alloc_pool);
@ -99,7 +99,7 @@ static void coroutine_delete(Coroutine *co)
{ {
co->caller = NULL; co->caller = NULL;
if (CONFIG_COROUTINE_POOL) { if (IS_ENABLED(CONFIG_COROUTINE_POOL)) {
if (release_pool_size < qatomic_read(&pool_max_size) * 2) { if (release_pool_size < qatomic_read(&pool_max_size) * 2) {
QSLIST_INSERT_HEAD_ATOMIC(&release_pool, co, pool_next); QSLIST_INSERT_HEAD_ATOMIC(&release_pool, co, pool_next);
qatomic_inc(&release_pool_size); qatomic_inc(&release_pool_size);