summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--MAINTAINERS5
-rw-r--r--accel/tcg/translate-all.c1
-rw-r--r--backends/hostmem-file.c1
-rw-r--r--backends/hostmem.c1
-rw-r--r--backends/tpm/meson.build14
-rw-r--r--block/meson.build51
-rwxr-xr-xconfigure598
-rw-r--r--contrib/vhost-user-gpu/meson.build3
-rw-r--r--crypto/meson.build6
-rw-r--r--docs/devel/kconfig.rst10
-rw-r--r--docs/meson.build2
-rw-r--r--docs/system/arm/nuvoton.rst1
-rw-r--r--hw/acpi/meson.build4
-rw-r--r--hw/arm/Kconfig10
-rw-r--r--hw/arm/armv7m.c26
-rw-r--r--hw/arm/npcm7xx_boards.c32
-rw-r--r--hw/arm/nseries.c1
-rw-r--r--hw/core/generic-loader.c2
-rw-r--r--hw/core/guest-loader.c2
-rw-r--r--hw/display/bcm2835_fb.c2
-rw-r--r--hw/display/i2c-ddc.c2
-rw-r--r--hw/display/macfb.c4
-rw-r--r--hw/display/virtio-vga.c2
-rw-r--r--hw/dma/bcm2835_dma.c2
-rw-r--r--hw/i2c/Kconfig5
-rw-r--r--hw/i386/pc_piix.c2
-rw-r--r--hw/i386/sgx-epc.c2
-rw-r--r--hw/ide/core.c1
-rw-r--r--hw/intc/bcm2835_ic.c2
-rw-r--r--hw/intc/bcm2836_control.c2
-rw-r--r--hw/ipmi/ipmi.c4
-rw-r--r--hw/mem/nvdimm.c2
-rw-r--r--hw/mem/pc-dimm.c2
-rw-r--r--hw/misc/bcm2835_mbox.c2
-rw-r--r--hw/misc/bcm2835_powermgt.c2
-rw-r--r--hw/misc/bcm2835_property.c2
-rw-r--r--hw/misc/bcm2835_rng.c2
-rw-r--r--hw/misc/pvpanic-isa.c2
-rw-r--r--hw/misc/pvpanic-pci.c2
-rw-r--r--hw/net/fsl_etsec/etsec.c2
-rw-r--r--hw/ppc/prep_systemio.c2
-rw-r--r--hw/ppc/spapr_iommu.c2
-rw-r--r--hw/rtc/Kconfig2
-rw-r--r--hw/s390x/s390-pci-bus.c2
-rw-r--r--hw/s390x/sclp.c2
-rw-r--r--hw/s390x/tod-kvm.c2
-rw-r--r--hw/s390x/tod-tcg.c2
-rw-r--r--hw/s390x/tod.c2
-rw-r--r--hw/scsi/lsi53c895a.c2
-rw-r--r--hw/scsi/megasas.c1
-rw-r--r--hw/scsi/scsi-bus.c1
-rw-r--r--hw/scsi/scsi-disk.c1
-rw-r--r--hw/sd/allwinner-sdhost.c2
-rw-r--r--hw/sd/aspeed_sdhci.c2
-rw-r--r--hw/sd/bcm2835_sdhost.c2
-rw-r--r--hw/sd/cadence_sdhci.c2
-rw-r--r--hw/sd/npcm7xx_sdhci.c2
-rw-r--r--hw/sensor/Kconfig5
-rw-r--r--hw/timer/a9gtimer.c21
-rw-r--r--hw/usb/dev-mtp.c2
-rw-r--r--hw/usb/host-libusb.c2
-rw-r--r--hw/vfio/igd.c2
-rw-r--r--hw/virtio/virtio-balloon.c1
-rw-r--r--hw/virtio/virtio-pmem.c2
-rw-r--r--include/qemu/cacheinfo.h21
-rw-r--r--include/qemu/hw-version.h27
-rw-r--r--include/qemu/madvise.h95
-rw-r--r--include/qemu/mmap-alloc.h23
-rw-r--r--include/qemu/mprotect.h14
-rw-r--r--include/qemu/osdep.h132
-rw-r--r--meson.build429
-rw-r--r--meson_options.txt64
-rw-r--r--migration/meson.build4
-rw-r--r--migration/postcopy-ram.c1
-rw-r--r--migration/qemu-file.c1
-rw-r--r--migration/ram.c1
-rw-r--r--net/slirp.c16
-rw-r--r--plugins/loader.c1
-rw-r--r--qga/commands-win32.c6
-rw-r--r--qga/meson.build55
-rw-r--r--qga/vss-win32/install.cpp2
-rw-r--r--qga/vss-win32/meson.build52
-rw-r--r--qga/vss-win32/provider.cpp4
-rw-r--r--qga/vss-win32/qga-vss.tlbbin1528 -> 0 bytes
-rw-r--r--qga/vss-win32/requester.cpp4
-rw-r--r--qga/vss-win32/vss-common.h6
-rw-r--r--qom/object.c4
-rwxr-xr-xscripts/checkpatch.pl1
-rwxr-xr-xscripts/meson-buildoptions.py2
-rw-r--r--scripts/meson-buildoptions.sh89
-rw-r--r--softmmu/memory.c61
-rw-r--r--softmmu/meson.build5
-rw-r--r--softmmu/physmem.c1
-rw-r--r--softmmu/vl.c1
-rw-r--r--target/arm/cpu.c30
-rw-r--r--target/arm/cpu64.c365
-rw-r--r--target/arm/hvf/hvf.c83
-rw-r--r--target/i386/cpu.c3
-rw-r--r--target/i386/cpu.h4
-rw-r--r--target/i386/helper.c8
-rw-r--r--target/i386/tcg/translate.c15
-rw-r--r--target/s390x/cpu_models.c1
-rw-r--r--tcg/region.c3
-rw-r--r--tcg/tcg.c1
-rw-r--r--tests/Makefile.include2
-rwxr-xr-xtests/check-block.sh4
-rw-r--r--tests/meson.build2
-rw-r--r--tests/qemu-iotests/meson.build2
-rw-r--r--tests/qemu-iotests/testrunner.py5
-rw-r--r--tests/unit/meson.build6
-rw-r--r--tools/meson.build31
-rw-r--r--ui/cocoa.m15
-rw-r--r--util/atomic64.c1
-rw-r--r--util/cacheflush.c1
-rw-r--r--util/cacheinfo.c1
-rw-r--r--util/meson.build4
-rw-r--r--util/osdep.c3
-rw-r--r--util/oslib-posix.c1
118 files changed, 1311 insertions, 1286 deletions
diff --git a/MAINTAINERS b/MAINTAINERS
index 81aa31b5e1..c3b500345c 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2189,6 +2189,7 @@ F: tests/qtest/prom-env-test.c
VM Generation ID
S: Orphan
+R: Ani Sinha <ani@anisinha.ca>
F: hw/acpi/vmgenid.c
F: include/hw/acpi/vmgenid.h
F: docs/specs/vmgenid.txt
@@ -2204,6 +2205,7 @@ F: hw/misc/led.c
Unimplemented device
M: Peter Maydell <peter.maydell@linaro.org>
R: Philippe Mathieu-Daudé <f4bug@amsat.org>
+R: Ani Sinha <ani@anisinha.ca>
S: Maintained
F: include/hw/misc/unimp.h
F: hw/misc/unimp.c
@@ -2211,6 +2213,7 @@ F: hw/misc/unimp.c
Empty slot
M: Artyom Tarasenko <atar4qemu@gmail.com>
R: Philippe Mathieu-Daudé <f4bug@amsat.org>
+R: Ani Sinha <ani@anisinha.ca>
S: Maintained
F: include/hw/misc/empty_slot.h
F: hw/misc/empty_slot.c
@@ -2413,6 +2416,7 @@ F: audio/alsaaudio.c
Core Audio framework backend
M: Gerd Hoffmann <kraxel@redhat.com>
R: Christian Schoenebeck <qemu_oss@crudebyte.com>
+R: Akihiko Odaki <akihiko.odaki@gmail.com>
S: Odd Fixes
F: audio/coreaudio.c
@@ -2665,6 +2669,7 @@ F: util/drm.c
Cocoa graphics
M: Peter Maydell <peter.maydell@linaro.org>
+R: Akihiko Odaki <akihiko.odaki@gmail.com>
S: Odd Fixes
F: ui/cocoa.m
diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c
index bd71db59a9..5971cd53ab 100644
--- a/accel/tcg/translate-all.c
+++ b/accel/tcg/translate-all.c
@@ -51,6 +51,7 @@
#include "qemu/qemu-print.h"
#include "qemu/timer.h"
#include "qemu/main-loop.h"
+#include "qemu/cacheinfo.h"
#include "exec/log.h"
#include "sysemu/cpus.h"
#include "sysemu/cpu-timers.h"
diff --git a/backends/hostmem-file.c b/backends/hostmem-file.c
index cd038024fa..25141283c4 100644
--- a/backends/hostmem-file.c
+++ b/backends/hostmem-file.c
@@ -14,6 +14,7 @@
#include "qapi/error.h"
#include "qemu/error-report.h"
#include "qemu/module.h"
+#include "qemu/madvise.h"
#include "sysemu/hostmem.h"
#include "qom/object_interfaces.h"
#include "qom/object.h"
diff --git a/backends/hostmem.c b/backends/hostmem.c
index 4c05862ed5..b2a5e905e8 100644
--- a/backends/hostmem.c
+++ b/backends/hostmem.c
@@ -19,6 +19,7 @@
#include "qemu/config-file.h"
#include "qom/object_interfaces.h"
#include "qemu/mmap-alloc.h"
+#include "qemu/madvise.h"
#ifdef CONFIG_NUMA
#include <numaif.h>
diff --git a/backends/tpm/meson.build b/backends/tpm/meson.build
index 857929082e..7f2503f84e 100644
--- a/backends/tpm/meson.build
+++ b/backends/tpm/meson.build
@@ -1,8 +1,6 @@
-tpm_ss = ss.source_set()
-
-tpm_ss.add(files('tpm_backend.c'))
-tpm_ss.add(files('tpm_util.c'))
-tpm_ss.add(when: 'CONFIG_TPM_PASSTHROUGH', if_true: files('tpm_passthrough.c'))
-tpm_ss.add(when: 'CONFIG_TPM_EMULATOR', if_true: files('tpm_emulator.c'))
-
-softmmu_ss.add_all(when: 'CONFIG_TPM', if_true: tpm_ss)
+if have_tpm
+ softmmu_ss.add(files('tpm_backend.c'))
+ softmmu_ss.add(files('tpm_util.c'))
+ softmmu_ss.add(when: 'CONFIG_TPM_PASSTHROUGH', if_true: files('tpm_passthrough.c'))
+ softmmu_ss.add(when: 'CONFIG_TPM_EMULATOR', if_true: files('tpm_emulator.c'))
+endif
diff --git a/block/meson.build b/block/meson.build
index 90dc9983e5..8a1ce58c9c 100644
--- a/block/meson.build
+++ b/block/meson.build
@@ -45,25 +45,44 @@ block_ss.add(files(
softmmu_ss.add(when: 'CONFIG_TCG', if_true: files('blkreplay.c'))
-block_ss.add(when: 'CONFIG_QCOW1', if_true: files('qcow.c'))
-block_ss.add(when: 'CONFIG_VDI', if_true: files('vdi.c'))
-block_ss.add(when: 'CONFIG_CLOOP', if_true: files('cloop.c'))
-block_ss.add(when: 'CONFIG_BOCHS', if_true: files('bochs.c'))
-block_ss.add(when: 'CONFIG_VVFAT', if_true: files('vvfat.c'))
-block_ss.add(when: 'CONFIG_DMG', if_true: files('dmg.c'))
-block_ss.add(when: 'CONFIG_QED', if_true: files(
- 'qed-check.c',
- 'qed-cluster.c',
- 'qed-l2-cache.c',
- 'qed-table.c',
- 'qed.c',
-))
-block_ss.add(when: 'CONFIG_PARALLELS', if_true: files('parallels.c', 'parallels-ext.c'))
+if get_option('qcow1').allowed()
+ block_ss.add(files('qcow.c'))
+endif
+if get_option('vdi').allowed()
+ block_ss.add(files('vdi.c'))
+endif
+if get_option('cloop').allowed()
+ block_ss.add(files('cloop.c'))
+endif
+if get_option('bochs').allowed()
+ block_ss.add(files('bochs.c'))
+endif
+if get_option('vvfat').allowed()
+ block_ss.add(files('vvfat.c'))
+endif
+if get_option('dmg').allowed()
+ block_ss.add(files('dmg.c'))
+endif
+if get_option('qed').allowed()
+ block_ss.add(files(
+ 'qed-check.c',
+ 'qed-cluster.c',
+ 'qed-l2-cache.c',
+ 'qed-table.c',
+ 'qed.c',
+ ))
+endif
+if get_option('parallels').allowed()
+ block_ss.add(files('parallels.c', 'parallels-ext.c'))
+endif
+
block_ss.add(when: 'CONFIG_WIN32', if_true: files('file-win32.c', 'win32-aio.c'))
block_ss.add(when: 'CONFIG_POSIX', if_true: [files('file-posix.c'), coref, iokit])
block_ss.add(when: libiscsi, if_true: files('iscsi-opts.c'))
block_ss.add(when: 'CONFIG_LINUX', if_true: files('nvme.c'))
-block_ss.add(when: 'CONFIG_REPLICATION', if_true: files('replication.c'))
+if not get_option('replication').disabled()
+ block_ss.add(files('replication.c'))
+endif
block_ss.add(when: libaio, if_true: files('linux-aio.c'))
block_ss.add(when: linux_io_uring, if_true: files('io_uring.c'))
@@ -89,7 +108,7 @@ foreach m : [
endforeach
# those are not exactly regular block modules, so treat them apart
-if 'CONFIG_DMG' in config_host
+if get_option('dmg').allowed()
foreach m : [
[liblzfse, 'dmg-lzfse', liblzfse, 'dmg-lzfse.c'],
[libbzip2, 'dmg-bz2', [glib, libbzip2], 'dmg-bz2.c']
diff --git a/configure b/configure
index 3a29eff5cc..6d34ff8873 100755
--- a/configure
+++ b/configure
@@ -238,9 +238,7 @@ cross_prefix=""
audio_drv_list="default"
block_drv_rw_whitelist=""
block_drv_ro_whitelist=""
-block_drv_whitelist_tools="no"
host_cc="cc"
-libs_qga=""
debug_info="yes"
lto="false"
stack_protector=""
@@ -290,7 +288,6 @@ EXTRA_CXXFLAGS=""
EXTRA_LDFLAGS=""
xen_ctrl_version="$default_feature"
-membarrier="$default_feature"
vhost_kernel="$default_feature"
vhost_net="$default_feature"
vhost_crypto="$default_feature"
@@ -301,7 +298,6 @@ vhost_user_fs="$default_feature"
vhost_vdpa="$default_feature"
rdma="$default_feature"
pvrdma="$default_feature"
-gprof="no"
debug_tcg="no"
debug="no"
sanitizers="no"
@@ -313,49 +309,23 @@ modules="no"
module_upgrades="no"
prefix="/usr/local"
qemu_suffix="qemu"
-profiler="no"
softmmu="yes"
linux_user=""
bsd_user=""
pkgversion=""
pie=""
-qom_cast_debug="yes"
trace_backends="log"
trace_file="trace"
opengl="$default_feature"
-cpuid_h="no"
-avx2_opt="$default_feature"
-guest_agent="$default_feature"
-vss_win32_sdk="$default_feature"
-win_sdk="no"
-want_tools="$default_feature"
coroutine=""
-coroutine_pool="$default_feature"
-debug_stack_usage="no"
-crypto_afalg="no"
tls_priority="NORMAL"
-tpm="$default_feature"
-live_block_migration=${default_feature:-yes}
-numa="$default_feature"
-replication=${default_feature:-yes}
-bochs=${default_feature:-yes}
-cloop=${default_feature:-yes}
-dmg=${default_feature:-yes}
-qcow1=${default_feature:-yes}
-vdi=${default_feature:-yes}
-vvfat=${default_feature:-yes}
-qed=${default_feature:-yes}
-parallels=${default_feature:-yes}
-debug_mutex="no"
plugins="$default_feature"
-rng_none="no"
secret_keyring="$default_feature"
meson=""
meson_args=""
ninja=""
gio="$default_feature"
skip_meson=no
-slirp_smbd="$default_feature"
# The following Meson options are handled manually (still they
# are included in the automatically generated help message)
@@ -441,6 +411,7 @@ objcopy="${OBJCOPY-${cross_prefix}objcopy}"
ld="${LD-${cross_prefix}ld}"
ranlib="${RANLIB-${cross_prefix}ranlib}"
nm="${NM-${cross_prefix}nm}"
+smbd="$SMBD"
strip="${STRIP-${cross_prefix}strip}"
windres="${WINDRES-${cross_prefix}windres}"
pkg_config_exe="${PKG_CONFIG-${cross_prefix}pkg-config}"
@@ -560,7 +531,6 @@ darwin)
sunos)
solaris="yes"
make="${MAKE-gmake}"
- smbd="${SMBD-/usr/sfw/sbin/smbd}"
# needed for CMSG_ macros in sys/socket.h
QEMU_CFLAGS="-D_XOPEN_SOURCE=600 $QEMU_CFLAGS"
# needed for TIOCWIN* defines in termios.h
@@ -714,7 +684,6 @@ if test "$mingw32" = "yes" ; then
write_c_skeleton;
prefix="/qemu"
qemu_suffix=""
- libs_qga="-lws2_32 -lwinmm -lpowrprof -lwtsapi32 -lwininet -liphlpapi -lnetapi32 $libs_qga"
fi
werror=""
@@ -824,8 +793,6 @@ for opt do
;;
--without-default-features) # processed above
;;
- --enable-gprof) gprof="yes"
- ;;
--enable-gcov) gcov="yes"
;;
--static)
@@ -866,20 +833,12 @@ for opt do
# configure to be used by RPM and similar macros that set
# lots of directory switches by default.
;;
- --disable-qom-cast-debug) qom_cast_debug="no"
- ;;
- --enable-qom-cast-debug) qom_cast_debug="yes"
- ;;
--audio-drv-list=*) audio_drv_list="$optarg"
;;
--block-drv-rw-whitelist=*|--block-drv-whitelist=*) block_drv_rw_whitelist=$(echo "$optarg" | sed -e 's/,/ /g')
;;
--block-drv-ro-whitelist=*) block_drv_ro_whitelist=$(echo "$optarg" | sed -e 's/,/ /g')
;;
- --enable-block-drv-whitelist-in-tools) block_drv_whitelist_tools="yes"
- ;;
- --disable-block-drv-whitelist-in-tools) block_drv_whitelist_tools="no"
- ;;
--enable-debug-tcg) debug_tcg="yes"
;;
--disable-debug-tcg) debug_tcg="no"
@@ -887,7 +846,7 @@ for opt do
--enable-debug)
# Enable debugging options that aren't excessively noisy
debug_tcg="yes"
- debug_mutex="yes"
+ meson_option_parse --enable-debug-mutex ""
debug="yes"
fortify_source="no"
;;
@@ -916,8 +875,6 @@ for opt do
;;
--enable-tcg) tcg="enabled"
;;
- --enable-profiler) profiler="yes"
- ;;
--disable-system) softmmu="no"
;;
--enable-system) softmmu="yes"
@@ -969,24 +926,10 @@ for opt do
;;
--enable-fdt=*) fdt="$optarg"
;;
- --disable-membarrier) membarrier="no"
- ;;
- --enable-membarrier) membarrier="yes"
- ;;
--with-pkgversion=*) pkgversion="$optarg"
;;
--with-coroutine=*) coroutine="$optarg"
;;
- --disable-coroutine-pool) coroutine_pool="no"
- ;;
- --enable-coroutine-pool) coroutine_pool="yes"
- ;;
- --enable-debug-stack-usage) debug_stack_usage="yes"
- ;;
- --enable-crypto-afalg) crypto_afalg="yes"
- ;;
- --disable-crypto-afalg) crypto_afalg="no"
- ;;
--disable-vhost-net) vhost_net="no"
;;
--enable-vhost-net) vhost_net="yes"
@@ -1013,34 +956,6 @@ for opt do
;;
--disable-zlib-test)
;;
- --enable-guest-agent) guest_agent="yes"
- ;;
- --disable-guest-agent) guest_agent="no"
- ;;
- --with-vss-sdk) vss_win32_sdk=""
- ;;
- --with-vss-sdk=*) vss_win32_sdk="$optarg"
- ;;
- --without-vss-sdk) vss_win32_sdk="no"
- ;;
- --with-win-sdk) win_sdk=""
- ;;
- --with-win-sdk=*) win_sdk="$optarg"
- ;;
- --without-win-sdk) win_sdk="no"
- ;;
- --enable-tools) want_tools="yes"
- ;;
- --disable-tools) want_tools="no"
- ;;
- --disable-avx2) avx2_opt="no"
- ;;
- --enable-avx2) avx2_opt="yes"
- ;;
- --disable-avx512f) avx512f_opt="no"
- ;;
- --enable-avx512f) avx512f_opt="yes"
- ;;
--disable-virtio-blk-data-plane|--enable-virtio-blk-data-plane)
echo "$0: $opt is obsolete, virtio-blk data-plane is always on" >&2
;;
@@ -1060,54 +975,6 @@ for opt do
;;
--disable-pvrdma) pvrdma="no"
;;
- --disable-tpm) tpm="no"
- ;;
- --enable-tpm) tpm="yes"
- ;;
- --disable-live-block-migration) live_block_migration="no"
- ;;
- --enable-live-block-migration) live_block_migration="yes"
- ;;
- --disable-numa) numa="no"
- ;;
- --enable-numa) numa="yes"
- ;;
- --disable-replication) replication="no"
- ;;
- --enable-replication) replication="yes"
- ;;
- --disable-bochs) bochs="no"
- ;;
- --enable-bochs) bochs="yes"
- ;;
- --disable-cloop) cloop="no"
- ;;
- --enable-cloop) cloop="yes"
- ;;
- --disable-dmg) dmg="no"
- ;;
- --enable-dmg) dmg="yes"
- ;;
- --disable-qcow1) qcow1="no"
- ;;
- --enable-qcow1) qcow1="yes"
- ;;
- --disable-vdi) vdi="no"
- ;;
- --enable-vdi) vdi="yes"
- ;;
- --disable-vvfat) vvfat="no"
- ;;
- --enable-vvfat) vvfat="yes"
- ;;
- --disable-qed) qed="no"
- ;;
- --enable-qed) qed="yes"
- ;;
- --disable-parallels) parallels="no"
- ;;
- --enable-parallels) parallels="yes"
- ;;
--disable-vhost-user) vhost_user="no"
;;
--enable-vhost-user) vhost_user="yes"
@@ -1133,10 +1000,6 @@ for opt do
--with-git-submodules=*)
git_submodules_action="$optarg"
;;
- --enable-debug-mutex) debug_mutex=yes
- ;;
- --disable-debug-mutex) debug_mutex=no
- ;;
--enable-plugins) if test "$mingw32" = "yes"; then
error_exit "TCG plugins not currently supported on Windows platforms"
else
@@ -1151,10 +1014,6 @@ for opt do
;;
--gdb=*) gdb_bin="$optarg"
;;
- --enable-rng-none) rng_none=yes
- ;;
- --disable-rng-none) rng_none=no
- ;;
--enable-keyring) secret_keyring="yes"
;;
--disable-keyring) secret_keyring="no"
@@ -1163,10 +1022,6 @@ for opt do
;;
--disable-gio) gio=no
;;
- --enable-slirp-smbd) slirp_smbd=yes
- ;;
- --disable-slirp-smbd) slirp_smbd=no
- ;;
# backwards compatibility options
--enable-trace-backend=*) meson_option_parse "--enable-trace-backends=$optarg" "$optarg"
;;
@@ -1357,21 +1212,13 @@ Advanced options (experts only):
--block-drv-ro-whitelist=L
set block driver read-only whitelist
(by default affects only QEMU, not tools like qemu-img)
- --enable-block-drv-whitelist-in-tools
- use block whitelist also in tools instead of only QEMU
--with-trace-file=NAME Full PATH,NAME of file to store traces
Default:trace-<pid>
--cpu=CPU Build for host CPU [$cpu]
--with-coroutine=BACKEND coroutine backend. Supported options:
ucontext, sigaltstack, windows
--enable-gcov enable test coverage analysis with gcov
- --with-vss-sdk=SDK-path enable Windows VSS support in QEMU Guest Agent
- --with-win-sdk=SDK-path path to Windows Platform SDK (to build VSS .tlb)
--tls-priority default TLS protocol/cipher priority string
- --enable-gprof QEMU profiling with gprof
- --enable-profiler profiler support
- --enable-debug-stack-usage
- track the maximum stack usage of stacks created by qemu_alloc_stack
--enable-plugins
enable plugins via shared library loading
--disable-containers don't use containers for cross-building
@@ -1383,7 +1230,6 @@ cat << EOF
user supported user emulation targets
linux-user all linux usermode emulation targets
bsd-user all BSD usermode emulation targets
- guest-agent build the QEMU Guest Agent
pie Position Independent Executables
modules modules support (non-Windows)
module-upgrades try to load modules from alternate paths for upgrades
@@ -1392,7 +1238,6 @@ cat << EOF
lto Enable Link-Time Optimization.
safe-stack SafeStack Stack Smash Protection. Depends on
clang/llvm >= 3.7 and requires coroutine backend ucontext.
- membarrier membarrier system call (for Linux 4.14+ or Windows)
rdma Enable RDMA-based migration
pvrdma Enable PVRDMA support
vhost-net vhost-net kernel acceleration support
@@ -1402,29 +1247,8 @@ cat << EOF
vhost-kernel vhost kernel backend support
vhost-user vhost-user backend support
vhost-vdpa vhost-vdpa kernel backend support
- live-block-migration Block migration in the main migration stream
- coroutine-pool coroutine freelist (better performance)
- tpm TPM support
- numa libnuma support
- avx2 AVX2 optimization support
- avx512f AVX512F optimization support
- replication replication support
opengl opengl support
- qom-cast-debug cast debugging support
- tools build qemu-io, qemu-nbd and qemu-img tools
- bochs bochs image format support
- cloop cloop image format support
- dmg dmg image format support
- qcow1 qcow v1 image format support
- vdi vdi image format support
- vvfat vvfat image format support
- qed qed image format support
- parallels parallels image format support
- crypto-afalg Linux AF_ALG crypto backend driver
- debug-mutex mutex debugging support
- rng-none dummy RNG, avoid using /dev/(u)random and getrandom()
gio libgio support
- slirp-smbd use smbd (at path --smbd=*) in slirp networking
NOTE: The object files are built at the place where configure is launched
EOF
@@ -1826,16 +1650,6 @@ else
exit 1
fi
-##########################################
-# system tools
-if test -z "$want_tools"; then
- if test "$softmmu" = "no"; then
- want_tools=no
- else
- want_tools=yes
- fi
-fi
-
#########################################
# vhost interdependencies and host support
@@ -2426,21 +2240,6 @@ if test "$modules" = yes; then
fi
##########################################
-# TPM emulation is only on POSIX
-
-if test "$tpm" = ""; then
- if test "$mingw32" = "yes"; then
- tpm=no
- else
- tpm=yes
- fi
-elif test "$tpm" = "yes"; then
- if test "$mingw32" = "yes" ; then
- error_exit "TPM emulation only available on POSIX systems"
- fi
-fi
-
-##########################################
# fdt probe
case "$fdt" in
@@ -2479,26 +2278,6 @@ EOF
fi
fi
-##########################################
-# libnuma probe
-
-if test "$numa" != "no" ; then
- cat > $TMPC << EOF
-#include <numa.h>
-int main(void) { return numa_available(); }
-EOF
-
- if compile_prog "" "-lnuma" ; then
- numa=yes
- numa_libs="-lnuma"
- else
- if test "$numa" = "yes" ; then
- feature_not_found "numa" "install numactl devel"
- fi
- numa=no
- fi
-fi
-
# check for usbfs
have_usbfs=no
if test "$linux_user" = "yes"; then
@@ -2524,85 +2303,6 @@ EOF
fi
##########################################
-# check if we have VSS SDK headers for win
-
-guest_agent_with_vss="no"
-if test "$mingw32" = "yes" && test "$guest_agent" != "no" && \
- test "$vss_win32_sdk" != "no" ; then
- case "$vss_win32_sdk" in
- "") vss_win32_include="-isystem $source_path" ;;
- *\ *) # The SDK is installed in "Program Files" by default, but we cannot
- # handle path with spaces. So we symlink the headers into ".sdk/vss".
- vss_win32_include="-isystem $source_path/.sdk/vss"
- symlink "$vss_win32_sdk/inc" "$source_path/.sdk/vss/inc"
- ;;
- *) vss_win32_include="-isystem $vss_win32_sdk"
- esac
- cat > $TMPC << EOF
-#define __MIDL_user_allocate_free_DEFINED__
-#include <inc/win2003/vss.h>
-int main(void) { return VSS_CTX_BACKUP; }
-EOF
- if compile_prog "$vss_win32_include" "" ; then
- guest_agent_with_vss="yes"
- QEMU_CFLAGS="$QEMU_CFLAGS $vss_win32_include"
- libs_qga="-lole32 -loleaut32 -lshlwapi -lstdc++ -Wl,--enable-stdcall-fixup $libs_qga"
- qga_vss_provider="qga/vss-win32/qga-vss.dll qga/vss-win32/qga-vss.tlb"
- else
- if test "$vss_win32_sdk" != "" ; then
- echo "ERROR: Please download and install Microsoft VSS SDK:"
- echo "ERROR: http://www.microsoft.com/en-us/download/details.aspx?id=23490"
- echo "ERROR: On POSIX-systems, you can extract the SDK headers by:"
- echo "ERROR: scripts/extract-vsssdk-headers setup.exe"
- echo "ERROR: The headers are extracted in the directory \`inc'."
- feature_not_found "VSS support"
- fi
- fi
-fi
-
-##########################################
-# lookup Windows platform SDK (if not specified)
-# The SDK is needed only to build .tlb (type library) file of guest agent
-# VSS provider from the source. It is usually unnecessary because the
-# pre-compiled .tlb file is included.
-
-if test "$mingw32" = "yes" && test "$guest_agent" != "no" && \
- test "$guest_agent_with_vss" = "yes" ; then
- if test -z "$win_sdk"; then
- programfiles="$PROGRAMFILES"
- test -n "$PROGRAMW6432" && programfiles="$PROGRAMW6432"
- if test -n "$programfiles"; then
- win_sdk=$(ls -d "$programfiles/Microsoft SDKs/Windows/v"* | tail -1) 2>/dev/null
- else
- feature_not_found "Windows SDK"
- fi
- elif test "$win_sdk" = "no"; then
- win_sdk=""
- fi
-fi
-
-##########################################
-# check if mingw environment provides a recent ntddscsi.h
-guest_agent_ntddscsi="no"
-if test "$mingw32" = "yes" && test "$guest_agent" != "no"; then
- cat > $TMPC << EOF
-#include <windows.h>
-#include <ntddscsi.h>
-int main(void) {
-#if !defined(IOCTL_SCSI_GET_ADDRESS)
-#error Missing required ioctl definitions
-#endif
- SCSI_ADDRESS addr = { .Lun = 0, .TargetId = 0, .PathId = 0 };
- return addr.Lun;
-}
-EOF
- if compile_prog "" "" ; then
- guest_agent_ntddscsi=yes
- libs_qga="-lsetupapi -lcfgmgr32 $libs_qga"
- fi
-fi
-
-##########################################
# capstone
case "$capstone" in
@@ -2667,17 +2367,6 @@ else
esac
fi
-if test "$coroutine_pool" = ""; then
- coroutine_pool=yes
-fi
-
-if test "$debug_stack_usage" = "yes"; then
- if test "$coroutine_pool" = "yes"; then
- echo "WARN: disabling coroutine pool for stack usage debugging"
- coroutine_pool=no
- fi
-fi
-
##################################################
# SafeStack
@@ -2741,85 +2430,6 @@ fi
fi
########################################
-# check if cpuid.h is usable.
-
-cat > $TMPC << EOF
-#include <cpuid.h>
-int main(void) {
- unsigned a, b, c, d;
- unsigned max = __get_cpuid_max(0, 0);
-
- if (max >= 1) {
- __cpuid(1, a, b, c, d);
- }
-
- if (max >= 7) {
- __cpuid_count(7, 0, a, b, c, d);
- }
-
- return 0;
-}
-EOF
-if compile_prog "" "" ; then
- cpuid_h=yes
-fi
-
-##########################################
-# avx2 optimization requirement check
-#
-# There is no point enabling this if cpuid.h is not usable,
-# since we won't be able to select the new routines.
-
-if test "$cpuid_h" = "yes" && test "$avx2_opt" != "no"; then
- cat > $TMPC << EOF
-#pragma GCC push_options
-#pragma GCC target("avx2")
-#include <cpuid.h>
-#include <immintrin.h>
-static int bar(void *a) {
- __m256i x = *(__m256i *)a;
- return _mm256_testz_si256(x, x);
-}
-int main(int argc, char *argv[]) { return bar(argv[0]); }
-EOF
- if compile_object "-Werror" ; then
- avx2_opt="yes"
- else
- avx2_opt="no"
- fi
-fi
-
-##########################################
-# avx512f optimization requirement check
-#
-# There is no point enabling this if cpuid.h is not usable,
-# since we won't be able to select the new routines.
-# by default, it is turned off.
-# if user explicitly want to enable it, check environment
-
-if test "$cpuid_h" = "yes" && test "$avx512f_opt" = "yes"; then
- cat > $TMPC << EOF
-#pragma GCC push_options
-#pragma GCC target("avx512f")
-#include <cpuid.h>
-#include <immintrin.h>
-static int bar(void *a) {
- __m512i x = *(__m512i *)a;
- return _mm512_test_epi64_mask(x, x);
-}
-int main(int argc, char *argv[])
-{
- return bar(argv[0]);
-}
-EOF
- if ! compile_object "-Werror" ; then
- avx512f_opt="no"
- fi
-else
- avx512f_opt="no"
-fi
-
-########################################
# check if __[u]int128_t is usable.
int128=no
@@ -2915,63 +2525,6 @@ if test "$fortify_source" != "no"; then
fi
##########################################
-# check for usable membarrier system call
-if test "$membarrier" = "yes"; then
- have_membarrier=no
- if test "$mingw32" = "yes" ; then
- have_membarrier=yes
- elif test "$linux" = "yes" ; then
- cat > $TMPC << EOF
- #include <linux/membarrier.h>
- #include <sys/syscall.h>
- #include <unistd.h>
- #include <stdlib.h>
- int main(void) {
- syscall(__NR_membarrier, MEMBARRIER_CMD_QUERY, 0);
- syscall(__NR_membarrier, MEMBARRIER_CMD_SHARED, 0);
- exit(0);
- }
-EOF
- if compile_prog "" "" ; then
- have_membarrier=yes
- fi
- fi
- if test "$have_membarrier" = "no"; then
- feature_not_found "membarrier" "membarrier system call not available"
- fi
-else
- # Do not enable it by default even for Mingw32, because it doesn't
- # work on Wine.
- membarrier=no
-fi
-
-##########################################
-# check for usable AF_ALG environment
-have_afalg=no
-cat > $TMPC << EOF
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <linux/if_alg.h>
-int main(void) {
- int sock;
- sock = socket(AF_ALG, SOCK_SEQPACKET, 0);
- return sock;
-}
-EOF
-if compile_prog "" "" ; then
- have_afalg=yes
-fi
-if test "$crypto_afalg" = "yes"
-then
- if test "$have_afalg" != "yes"
- then
- error_exit "AF_ALG requested but could not be detected"
- fi
-fi
-
-
-##########################################
# checks for sanitizers
have_asan=no
@@ -3052,19 +2605,6 @@ case "$slirp" in
;;
esac
-# Check for slirp smbd dupport
-: ${smbd=${SMBD-/usr/sbin/smbd}}
-if test "$slirp_smbd" != "no" ; then
- if test "$mingw32" = "yes" ; then
- if test "$slirp_smbd" = "yes" ; then
- error_exit "Host smbd not supported on this platform."
- fi
- slirp_smbd=no
- else
- slirp_smbd=yes
- fi
-fi
-
##########################################
# check for usable __NR_keyctl syscall
@@ -3120,11 +2660,6 @@ alpha)
;;
esac
-if test "$gprof" = "yes" ; then
- QEMU_CFLAGS="-p $QEMU_CFLAGS"
- QEMU_LDFLAGS="-p $QEMU_LDFLAGS"
-fi
-
if test "$have_asan" = "yes"; then
QEMU_CFLAGS="-fsanitize=address $QEMU_CFLAGS"
QEMU_LDFLAGS="-fsanitize=address $QEMU_LDFLAGS"
@@ -3176,20 +2711,6 @@ if test "$mingw32" = "yes" ; then
done
fi
-# Probe for guest agent support/options
-
-if [ "$guest_agent" != "no" ]; then
- if [ "$softmmu" = no -a "$want_tools" = no ] ; then
- guest_agent=no
- elif [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" -o "$mingw32" = "yes" ] ; then
- guest_agent=yes
- elif [ "$guest_agent" != yes ]; then
- guest_agent=no
- else
- error_exit "Guest agent is not supported on this platform"
- fi
-fi
-
# Guest agent Windows MSI package
if test "$QEMU_GA_MANUFACTURER" = ""; then
@@ -3290,14 +2811,6 @@ if test "$debug_tcg" = "yes" ; then
fi
if test "$mingw32" = "yes" ; then
echo "CONFIG_WIN32=y" >> $config_host_mak
- if test "$guest_agent_with_vss" = "yes" ; then
- echo "CONFIG_QGA_VSS=y" >> $config_host_mak
- echo "QGA_VSS_PROVIDER=$qga_vss_provider" >> $config_host_mak
- echo "WIN_SDK=\"$win_sdk\"" >> $config_host_mak
- fi
- if test "$guest_agent_ntddscsi" = "yes" ; then
- echo "CONFIG_QGA_NTDDSCSI=y" >> $config_host_mak
- fi
echo "QEMU_GA_MSI_MINGW_DLL_PATH=${QEMU_GA_MSI_MINGW_DLL_PATH}" >> $config_host_mak
echo "QEMU_GA_MANUFACTURER=${QEMU_GA_MANUFACTURER}" >> $config_host_mak
echo "QEMU_GA_DISTRO=${QEMU_GA_DISTRO}" >> $config_host_mak
@@ -3320,27 +2833,8 @@ fi
if test "$static" = "yes" ; then
echo "CONFIG_STATIC=y" >> $config_host_mak
fi
-if test "$profiler" = "yes" ; then
- echo "CONFIG_PROFILER=y" >> $config_host_mak
-fi
-if test "$want_tools" = "yes" ; then
- echo "CONFIG_TOOLS=y" >> $config_host_mak
-fi
-if test "$guest_agent" = "yes" ; then
- echo "CONFIG_GUEST_AGENT=y" >> $config_host_mak
-fi
-if test "$slirp_smbd" = "yes" ; then
- echo "CONFIG_SLIRP_SMBD=y" >> $config_host_mak
- echo "CONFIG_SMBD_COMMAND=\"$smbd\"" >> $config_host_mak
-fi
-if test "$gprof" = "yes" ; then
- echo "CONFIG_GPROF=y" >> $config_host_mak
-fi
echo "CONFIG_BDRV_RW_WHITELIST=$block_drv_rw_whitelist" >> $config_host_mak
echo "CONFIG_BDRV_RO_WHITELIST=$block_drv_ro_whitelist" >> $config_host_mak
-if test "$block_drv_whitelist_tools" = "yes" ; then
- echo "CONFIG_BDRV_WHITELIST_TOOLS=y" >> $config_host_mak
-fi
qemu_version=$(head $source_path/VERSION)
echo "PKGVERSION=$pkgversion" >>$config_host_mak
echo "SRC_PATH=$source_path" >> $config_host_mak
@@ -3406,9 +2900,6 @@ fi
if test "$vhost_user_fs" = "yes" ; then
echo "CONFIG_VHOST_USER_FS=y" >> $config_host_mak
fi
-if test "$membarrier" = "yes" ; then
- echo "CONFIG_MEMBARRIER=y" >> $config_host_mak
-fi
if test "$tcg" = "enabled" -a "$tcg_interpreter" = "true" ; then
echo "CONFIG_TCG_INTERPRETER=y" >> $config_host_mak
fi
@@ -3419,37 +2910,12 @@ if test "$opengl" = "yes" ; then
echo "OPENGL_LIBS=$opengl_libs" >> $config_host_mak
fi
-if test "$avx2_opt" = "yes" ; then
- echo "CONFIG_AVX2_OPT=y" >> $config_host_mak
-fi
-
-if test "$avx512f_opt" = "yes" ; then
- echo "CONFIG_AVX512F_OPT=y" >> $config_host_mak
-fi
-
# XXX: suppress that
if [ "$bsd" = "yes" ] ; then
echo "CONFIG_BSD=y" >> $config_host_mak
fi
-if test "$qom_cast_debug" = "yes" ; then
- echo "CONFIG_QOM_CAST_DEBUG=y" >> $config_host_mak
-fi
-
echo "CONFIG_COROUTINE_BACKEND=$coroutine" >> $config_host_mak
-if test "$coroutine_pool" = "yes" ; then
- echo "CONFIG_COROUTINE_POOL=1" >> $config_host_mak
-else
- echo "CONFIG_COROUTINE_POOL=0" >> $config_host_mak
-fi
-
-if test "$debug_stack_usage" = "yes" ; then
- echo "CONFIG_DEBUG_STACK_USAGE=y" >> $config_host_mak
-fi
-
-if test "$crypto_afalg" = "yes" ; then
- echo "CONFIG_AF_ALG=y" >> $config_host_mak
-fi
if test "$have_asan_iface_fiber" = "yes" ; then
echo "CONFIG_ASAN_IFACE_FIBER=y" >> $config_host_mak
@@ -3459,10 +2925,6 @@ if test "$have_tsan" = "yes" && test "$have_tsan_iface_fiber" = "yes" ; then
echo "CONFIG_TSAN=y" >> $config_host_mak
fi
-if test "$cpuid_h" = "yes" ; then
- echo "CONFIG_CPUID_H=y" >> $config_host_mak
-fi
-
if test "$int128" = "yes" ; then
echo "CONFIG_INT128=y" >> $config_host_mak
fi
@@ -3475,14 +2937,6 @@ if test "$cmpxchg128" = "yes" ; then
echo "CONFIG_CMPXCHG128=y" >> $config_host_mak
fi
-if test "$live_block_migration" = "yes" ; then
- echo "CONFIG_LIVE_BLOCK_MIGRATION=y" >> $config_host_mak
-fi
-
-if test "$tpm" = "yes"; then
- echo 'CONFIG_TPM=y' >> $config_host_mak
-fi
-
if test "$rdma" = "yes" ; then
echo "CONFIG_RDMA=y" >> $config_host_mak
echo "RDMA_LIBS=$rdma_libs" >> $config_host_mak
@@ -3492,39 +2946,6 @@ if test "$pvrdma" = "yes" ; then
echo "CONFIG_PVRDMA=y" >> $config_host_mak
fi
-if test "$replication" = "yes" ; then
- echo "CONFIG_REPLICATION=y" >> $config_host_mak
-fi
-
-if test "$debug_mutex" = "yes" ; then
- echo "CONFIG_DEBUG_MUTEX=y" >> $config_host_mak
-fi
-
-if test "$bochs" = "yes" ; then
- echo "CONFIG_BOCHS=y" >> $config_host_mak
-fi
-if test "$cloop" = "yes" ; then
- echo "CONFIG_CLOOP=y" >> $config_host_mak
-fi
-if test "$dmg" = "yes" ; then
- echo "CONFIG_DMG=y" >> $config_host_mak
-fi
-if test "$qcow1" = "yes" ; then
- echo "CONFIG_QCOW1=y" >> $config_host_mak
-fi
-if test "$vdi" = "yes" ; then
- echo "CONFIG_VDI=y" >> $config_host_mak
-fi
-if test "$vvfat" = "yes" ; then
- echo "CONFIG_VVFAT=y" >> $config_host_mak
-fi
-if test "$qed" = "yes" ; then
- echo "CONFIG_QED=y" >> $config_host_mak
-fi
-if test "$parallels" = "yes" ; then
- echo "CONFIG_PARALLELS=y" >> $config_host_mak
-fi
-
if test "$plugins" = "yes" ; then
echo "CONFIG_PLUGIN=y" >> $config_host_mak
fi
@@ -3548,9 +2969,6 @@ echo "MESON=$meson" >> $config_host_mak
echo "NINJA=$ninja" >> $config_host_mak
echo "CC=$cc" >> $config_host_mak
echo "HOST_CC=$host_cc" >> $config_host_mak
-if $iasl -h > /dev/null 2>&1; then
- echo "CONFIG_IASL=$iasl" >> $config_host_mak
-fi
echo "AR=$ar" >> $config_host_mak
echo "AS=$as" >> $config_host_mak
echo "CCAS=$ccas" >> $config_host_mak
@@ -3567,11 +2985,6 @@ echo "QEMU_LDFLAGS=$QEMU_LDFLAGS" >> $config_host_mak
echo "LD_I386_EMULATION=$ld_i386_emulation" >> $config_host_mak
echo "STRIP=$strip" >> $config_host_mak
echo "EXESUF=$EXESUF" >> $config_host_mak
-echo "LIBS_QGA=$libs_qga" >> $config_host_mak
-
-if test "$rng_none" = "yes"; then
- echo "CONFIG_RNG_NONE=y" >> $config_host_mak
-fi
# use included Linux headers
if test "$linux" = "yes" ; then
@@ -3621,11 +3034,6 @@ if test "$default_targets" = "yes"; then
echo "CONFIG_DEFAULT_TARGETS=y" >> $config_host_mak
fi
-if test "$numa" = "yes"; then
- echo "CONFIG_NUMA=y" >> $config_host_mak
- echo "NUMA_LIBS=$numa_libs" >> $config_host_mak
-fi
-
if test "$ccache_cpp2" = "yes"; then
echo "export CCACHE_CPP2=y" >> $config_host_mak
fi
@@ -3778,8 +3186,10 @@ if test "$skip_meson" = no; then
-Daudio_drv_list=$audio_drv_list \
-Ddefault_devices=$default_devices \
-Ddocdir="$docdir" \
+ -Diasl="$($iasl -h >/dev/null 2>&1 && printf %s "$iasl")" \
-Dqemu_firmwarepath="$firmwarepath" \
-Dqemu_suffix="$qemu_suffix" \
+ -Dsmbd="$smbd" \
-Dsphinx_build="$sphinx_build" \
-Dtrace_file="$trace_file" \
-Doptimization=$(if test "$debug" = yes; then echo 0; else echo 2; fi) \
diff --git a/contrib/vhost-user-gpu/meson.build b/contrib/vhost-user-gpu/meson.build
index 92c8f3a86a..c8883c2d8e 100644
--- a/contrib/vhost-user-gpu/meson.build
+++ b/contrib/vhost-user-gpu/meson.build
@@ -1,5 +1,4 @@
-if 'CONFIG_TOOLS' in config_host and virgl.found() and gbm.found() \
- and 'CONFIG_LINUX' in config_host and pixman.found()
+if have_vhost_user_gpu
executable('vhost-user-gpu', files('vhost-user-gpu.c', 'virgl.c', 'vugbm.c'),
dependencies: [qemuutil, pixman, gbm, virgl, vhost_user, opengl],
install: true,
diff --git a/crypto/meson.build b/crypto/meson.build
index 95a6a83504..19c44bea89 100644
--- a/crypto/meson.build
+++ b/crypto/meson.build
@@ -35,7 +35,9 @@ else
endif
crypto_ss.add(when: 'CONFIG_SECRET_KEYRING', if_true: files('secret_keyring.c'))
-crypto_ss.add(when: 'CONFIG_AF_ALG', if_true: files('afalg.c', 'cipher-afalg.c', 'hash-afalg.c'))
+if have_afalg
+ crypto_ss.add(if_true: files('afalg.c', 'cipher-afalg.c', 'hash-afalg.c'))
+endif
crypto_ss.add(when: gnutls, if_true: files('tls-cipher-suites.c'))
util_ss.add(files('aes.c'))
@@ -48,7 +50,7 @@ if gcrypt.found()
util_ss.add(gcrypt, files('random-gcrypt.c'))
elif gnutls.found()
util_ss.add(gnutls, files('random-gnutls.c'))
-elif 'CONFIG_RNG_NONE' in config_host
+elif get_option('rng_none')
util_ss.add(files('random-none.c'))
else
util_ss.add(files('random-platform.c'))
diff --git a/docs/devel/kconfig.rst b/docs/devel/kconfig.rst
index a1cdbec751..69674d008a 100644
--- a/docs/devel/kconfig.rst
+++ b/docs/devel/kconfig.rst
@@ -192,11 +192,15 @@ declares its dependencies in different ways:
no directive and are not used in the Makefile either; they only appear
as conditions for ``default y`` directives.
- QEMU currently has two device groups, ``PCI_DEVICES`` and
- ``TEST_DEVICES``. PCI devices usually have a ``default y if
+ QEMU currently has three device groups, ``PCI_DEVICES``, ``I2C_DEVICES``,
+ and ``TEST_DEVICES``. PCI devices usually have a ``default y if
PCI_DEVICES`` directive rather than just ``default y``. This lets
some boards (notably s390) easily support a subset of PCI devices,
for example only VFIO (passthrough) and virtio-pci devices.
+ ``I2C_DEVICES`` is similar to ``PCI_DEVICES``. It contains i2c devices
+ that users might reasonably want to plug in to an i2c bus on any
+ board (and not ones which are very board-specific or that need
+ to be wired up in a way that can't be done on the command line).
``TEST_DEVICES`` instead is used for devices that are rarely used on
production virtual machines, but provide useful hooks to test QEMU
or KVM.
@@ -301,7 +305,7 @@ and also listed as follows in the top-level meson.build's host_kconfig
variable::
host_kconfig = \
- ('CONFIG_TPM' in config_host ? ['CONFIG_TPM=y'] : []) + \
+ (have_tpm ? ['CONFIG_TPM=y'] : []) + \
('CONFIG_SPICE' in config_host ? ['CONFIG_SPICE=y'] : []) + \
(have_ivshmem ? ['CONFIG_IVSHMEM=y'] : []) + \
...
diff --git a/docs/meson.build b/docs/meson.build
index 57b28a3146..831d4aea2b 100644
--- a/docs/meson.build
+++ b/docs/meson.build
@@ -37,8 +37,6 @@ endif
if build_docs
SPHINX_ARGS += ['-Dversion=' + meson.project_version(), '-Drelease=' + config_host['PKGVERSION']]
- have_ga = have_tools and config_host.has_key('CONFIG_GUEST_AGENT')
-
man_pages = {
'qemu-ga.8': (have_ga ? 'man8' : ''),
'qemu-ga-ref.7': (have_ga ? 'man7' : ''),
diff --git a/docs/system/arm/nuvoton.rst b/docs/system/arm/nuvoton.rst
index adf497e679..ef2792076a 100644
--- a/docs/system/arm/nuvoton.rst
+++ b/docs/system/arm/nuvoton.rst
@@ -21,6 +21,7 @@ Hyperscale applications. The following machines are based on this chip :
- ``quanta-gbs-bmc`` Quanta GBS server BMC
- ``quanta-gsj`` Quanta GSJ server BMC
- ``kudo-bmc`` Fii USA Kudo server BMC
+- ``mori-bmc`` Fii USA Mori server BMC
There are also two more SoCs, NPCM710 and NPCM705, which are single-core
variants of NPCM750 and NPCM730, respectively. These are currently not
diff --git a/hw/acpi/meson.build b/hw/acpi/meson.build
index f5b22983bb..8bea2e6933 100644
--- a/hw/acpi/meson.build
+++ b/hw/acpi/meson.build
@@ -25,7 +25,9 @@ acpi_ss.add(when: 'CONFIG_ACPI_X86_ICH', if_true: files('ich9.c', 'tco.c'))
acpi_ss.add(when: 'CONFIG_ACPI_ERST', if_true: files('erst.c'))
acpi_ss.add(when: 'CONFIG_IPMI', if_true: files('ipmi.c'), if_false: files('ipmi-stub.c'))
acpi_ss.add(when: 'CONFIG_PC', if_false: files('acpi-x86-stub.c'))
-acpi_ss.add(when: 'CONFIG_TPM', if_true: files('tpm.c'))
+if have_tpm
+ acpi_ss.add(files('tpm.c'))
+endif
softmmu_ss.add(when: 'CONFIG_ACPI', if_false: files('acpi-stub.c', 'aml-build-stub.c', 'ghes-stub.c'))
softmmu_ss.add_all(when: 'CONFIG_ACPI', if_true: acpi_ss)
softmmu_ss.add(when: 'CONFIG_ALL', if_true: files('acpi-stub.c', 'aml-build-stub.c',
diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig
index 2e0049196d..6945330030 100644
--- a/hw/arm/Kconfig
+++ b/hw/arm/Kconfig
@@ -46,6 +46,7 @@ config DIGIC
config EXYNOS4
bool
+ imply I2C_DEVICES
select A9MPCORE
select I2C
select LAN9118
@@ -184,6 +185,7 @@ config REALVIEW
bool
imply PCI_DEVICES
imply PCI_TESTDEV
+ imply I2C_DEVICES
select SMC91C111
select LAN9118
select A9MPCORE
@@ -229,6 +231,7 @@ config SABRELITE
config STELLARIS
bool
+ imply I2C_DEVICES
select ARM_V7M
select CMSDK_APB_WATCHDOG
select I2C
@@ -406,6 +409,7 @@ config NPCM7XX
config FSL_IMX25
bool
+ imply I2C_DEVICES
select IMX
select IMX_FEC
select IMX_I2C
@@ -414,6 +418,7 @@ config FSL_IMX25
config FSL_IMX31
bool
+ imply I2C_DEVICES
select SERIAL
select IMX
select IMX_I2C
@@ -422,6 +427,7 @@ config FSL_IMX31
config FSL_IMX6
bool
+ imply I2C_DEVICES
select A9MPCORE
select IMX
select IMX_FEC
@@ -450,6 +456,7 @@ config ASPEED_SOC
config MPS2
bool
+ imply I2C_DEVICES
select ARMSSE
select LAN9118
select MPS2_FPGAIO
@@ -466,6 +473,7 @@ config FSL_IMX7
bool
imply PCI_DEVICES
imply TEST_DEVICES
+ imply I2C_DEVICES
select A15MPCORE
select PCI
select IMX
@@ -481,6 +489,7 @@ config ARM_SMMUV3
config FSL_IMX6UL
bool
+ imply I2C_DEVICES
select A15MPCORE
select IMX
select IMX_FEC
@@ -495,6 +504,7 @@ config MICROBIT
config NRF51_SOC
bool
+ imply I2C_DEVICES
select I2C
select ARM_V7M
select UNIMP
diff --git a/hw/arm/armv7m.c b/hw/arm/armv7m.c
index ceb76df3cd..41cfca0f22 100644
--- a/hw/arm/armv7m.c
+++ b/hw/arm/armv7m.c
@@ -284,6 +284,12 @@ static void armv7m_realize(DeviceState *dev, Error **errp)
return;
}
+ /* cpuclk must be connected; refclk is optional */
+ if (!clock_has_source(s->cpuclk)) {
+ error_setg(errp, "armv7m: cpuclk must be connected");
+ return;
+ }
+
memory_region_add_subregion_overlap(&s->container, 0, s->board_memory, -1);
s->cpu = ARM_CPU(object_new_with_props(s->cpu_type, OBJECT(s), "cpu",
@@ -420,8 +426,18 @@ static void armv7m_realize(DeviceState *dev, Error **errp)
&s->sysreg_ns_mem);
}
- /* Create and map the systick devices */
- qdev_connect_clock_in(DEVICE(&s->systick[M_REG_NS]), "refclk", s->refclk);
+ /*
+ * Create and map the systick devices. Note that we only connect
+ * refclk if it has been connected to us; otherwise the systick
+ * device gets the wrong answer for clock_has_source(refclk), because
+ * it has an immediate source (the ARMv7M's clock object) but not
+ * an ultimate source, and then it won't correctly auto-select the
+ * CPU clock as its only possible clock source.
+ */
+ if (clock_has_source(s->refclk)) {
+ qdev_connect_clock_in(DEVICE(&s->systick[M_REG_NS]), "refclk",
+ s->refclk);
+ }
qdev_connect_clock_in(DEVICE(&s->systick[M_REG_NS]), "cpuclk", s->cpuclk);
if (!sysbus_realize(SYS_BUS_DEVICE(&s->systick[M_REG_NS]), errp)) {
return;
@@ -438,8 +454,10 @@ static void armv7m_realize(DeviceState *dev, Error **errp)
*/
object_initialize_child(OBJECT(dev), "systick-reg-s",
&s->systick[M_REG_S], TYPE_SYSTICK);
- qdev_connect_clock_in(DEVICE(&s->systick[M_REG_S]), "refclk",
- s->refclk);
+ if (clock_has_source(s->refclk)) {
+ qdev_connect_clock_in(DEVICE(&s->systick[M_REG_S]), "refclk",
+ s->refclk);
+ }
qdev_connect_clock_in(DEVICE(&s->systick[M_REG_S]), "cpuclk",
s->cpuclk);
diff --git a/hw/arm/npcm7xx_boards.c b/hw/arm/npcm7xx_boards.c
index d701e5cc55..0678a56156 100644
--- a/hw/arm/npcm7xx_boards.c
+++ b/hw/arm/npcm7xx_boards.c
@@ -34,6 +34,7 @@
#define QUANTA_GSJ_POWER_ON_STRAPS 0x00001fff
#define QUANTA_GBS_POWER_ON_STRAPS 0x000017ff
#define KUDO_BMC_POWER_ON_STRAPS 0x00001fff
+#define MORI_BMC_POWER_ON_STRAPS 0x00001fff
static const char npcm7xx_default_bootrom[] = "npcm7xx_bootrom.bin";
@@ -429,6 +430,21 @@ static void kudo_bmc_init(MachineState *machine)
npcm7xx_load_kernel(machine, soc);
}
+static void mori_bmc_init(MachineState *machine)
+{
+ NPCM7xxState *soc;
+
+ soc = npcm7xx_create_soc(machine, MORI_BMC_POWER_ON_STRAPS);
+ npcm7xx_connect_dram(soc, machine->ram);
+ qdev_realize(DEVICE(soc), NULL, &error_fatal);
+
+ npcm7xx_load_bootrom(machine, soc);
+ npcm7xx_connect_flash(&soc->fiu[1], 0, "mx66u51235f",
+ drive_get(IF_MTD, 3, 0));
+
+ npcm7xx_load_kernel(machine, soc);
+}
+
static void npcm7xx_set_soc_type(NPCM7xxMachineClass *nmc, const char *type)
{
NPCM7xxClass *sc = NPCM7XX_CLASS(object_class_by_name(type));
@@ -501,6 +517,18 @@ static void kudo_bmc_machine_class_init(ObjectClass *oc, void *data)
mc->default_ram_size = 1 * GiB;
};
+static void mori_bmc_machine_class_init(ObjectClass *oc, void *data)
+{
+ NPCM7xxMachineClass *nmc = NPCM7XX_MACHINE_CLASS(oc);
+ MachineClass *mc = MACHINE_CLASS(oc);
+
+ npcm7xx_set_soc_type(nmc, TYPE_NPCM730);
+
+ mc->desc = "Mori BMC (Cortex-A9)";
+ mc->init = mori_bmc_init;
+ mc->default_ram_size = 1 * GiB;
+}
+
static const TypeInfo npcm7xx_machine_types[] = {
{
.name = TYPE_NPCM7XX_MACHINE,
@@ -525,6 +553,10 @@ static const TypeInfo npcm7xx_machine_types[] = {
.name = MACHINE_TYPE_NAME("kudo-bmc"),
.parent = TYPE_NPCM7XX_MACHINE,
.class_init = kudo_bmc_machine_class_init,
+ }, {
+ .name = MACHINE_TYPE_NAME("mori-bmc"),
+ .parent = TYPE_NPCM7XX_MACHINE,
+ .class_init = mori_bmc_machine_class_init,
},
};
diff --git a/hw/arm/nseries.c b/hw/arm/nseries.c
index af3164c551..9c1cafae86 100644
--- a/hw/arm/nseries.c
+++ b/hw/arm/nseries.c
@@ -24,6 +24,7 @@
#include "chardev/char.h"
#include "qemu/cutils.h"
#include "qemu/bswap.h"
+#include "qemu/hw-version.h"
#include "sysemu/reset.h"
#include "sysemu/runstate.h"
#include "sysemu/sysemu.h"
diff --git a/hw/core/generic-loader.c b/hw/core/generic-loader.c
index 504ed7ca72..c666545aa0 100644
--- a/hw/core/generic-loader.c
+++ b/hw/core/generic-loader.c
@@ -207,7 +207,7 @@ static void generic_loader_class_init(ObjectClass *klass, void *data)
set_bit(DEVICE_CATEGORY_MISC, dc->categories);
}
-static TypeInfo generic_loader_info = {
+static const TypeInfo generic_loader_info = {
.name = TYPE_GENERIC_LOADER,
.parent = TYPE_DEVICE,
.instance_size = sizeof(GenericLoaderState),
diff --git a/hw/core/guest-loader.c b/hw/core/guest-loader.c
index d3f9d1a06e..391c875a29 100644
--- a/hw/core/guest-loader.c
+++ b/hw/core/guest-loader.c
@@ -129,7 +129,7 @@ static void guest_loader_class_init(ObjectClass *klass, void *data)
set_bit(DEVICE_CATEGORY_MISC, dc->categories);
}
-static TypeInfo guest_loader_info = {
+static const TypeInfo guest_loader_info = {
.name = TYPE_GUEST_LOADER,
.parent = TYPE_DEVICE,
.instance_size = sizeof(GuestLoaderState),
diff --git a/hw/display/bcm2835_fb.c b/hw/display/bcm2835_fb.c
index 2be77bdd3a..088fc3d51c 100644
--- a/hw/display/bcm2835_fb.c
+++ b/hw/display/bcm2835_fb.c
@@ -454,7 +454,7 @@ static void bcm2835_fb_class_init(ObjectClass *klass, void *data)
dc->vmsd = &vmstate_bcm2835_fb;
}
-static TypeInfo bcm2835_fb_info = {
+static const TypeInfo bcm2835_fb_info = {
.name = TYPE_BCM2835_FB,
.parent = TYPE_SYS_BUS_DEVICE,
.instance_size = sizeof(BCM2835FBState),
diff --git a/hw/display/i2c-ddc.c b/hw/display/i2c-ddc.c
index 13eb529fc1..146489518c 100644
--- a/hw/display/i2c-ddc.c
+++ b/hw/display/i2c-ddc.c
@@ -113,7 +113,7 @@ static void i2c_ddc_class_init(ObjectClass *oc, void *data)
isc->send = i2c_ddc_tx;
}
-static TypeInfo i2c_ddc_info = {
+static const TypeInfo i2c_ddc_info = {
.name = TYPE_I2CDDC,
.parent = TYPE_I2C_SLAVE,
.instance_size = sizeof(I2CDDCState),
diff --git a/hw/display/macfb.c b/hw/display/macfb.c
index 2eeb80cc3f..c9b468c10e 100644
--- a/hw/display/macfb.c
+++ b/hw/display/macfb.c
@@ -782,14 +782,14 @@ static void macfb_nubus_class_init(ObjectClass *klass, void *data)
device_class_set_props(dc, macfb_nubus_properties);
}
-static TypeInfo macfb_sysbus_info = {
+static const TypeInfo macfb_sysbus_info = {
.name = TYPE_MACFB,
.parent = TYPE_SYS_BUS_DEVICE,
.instance_size = sizeof(MacfbSysBusState),
.class_init = macfb_sysbus_class_init,
};
-static TypeInfo macfb_nubus_info = {
+static const TypeInfo macfb_nubus_info = {
.name = TYPE_NUBUS_MACFB,
.parent = TYPE_NUBUS_DEVICE,
.instance_size = sizeof(MacfbNubusState),
diff --git a/hw/display/virtio-vga.c b/hw/display/virtio-vga.c
index b23a75a04b..5a2f7a4540 100644
--- a/hw/display/virtio-vga.c
+++ b/hw/display/virtio-vga.c
@@ -220,7 +220,7 @@ static void virtio_vga_base_class_init(ObjectClass *klass, void *data)
virtio_vga_set_big_endian_fb);
}
-static TypeInfo virtio_vga_base_info = {
+static const TypeInfo virtio_vga_base_info = {
.name = TYPE_VIRTIO_VGA_BASE,
.parent = TYPE_VIRTIO_PCI,
.instance_size = sizeof(VirtIOVGABase),
diff --git a/hw/dma/bcm2835_dma.c b/hw/dma/bcm2835_dma.c
index eb0002a2b9..5e9306110d 100644
--- a/hw/dma/bcm2835_dma.c
+++ b/hw/dma/bcm2835_dma.c
@@ -394,7 +394,7 @@ static void bcm2835_dma_class_init(ObjectClass *klass, void *data)
dc->vmsd = &vmstate_bcm2835_dma;
}
-static TypeInfo bcm2835_dma_info = {
+static const TypeInfo bcm2835_dma_info = {
.name = TYPE_BCM2835_DMA,
.parent = TYPE_SYS_BUS_DEVICE,
.instance_size = sizeof(BCM2835DMAState),
diff --git a/hw/i2c/Kconfig b/hw/i2c/Kconfig
index 8217cb5041..9bb8870517 100644
--- a/hw/i2c/Kconfig
+++ b/hw/i2c/Kconfig
@@ -1,6 +1,11 @@
config I2C
bool
+config I2C_DEVICES
+ # Device group for i2c devices which can reasonably be user-plugged
+ # to any board's i2c bus
+ bool
+
config SMBUS
bool
select I2C
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index d9b344248d..8d33cf689d 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -867,7 +867,7 @@ static void isa_bridge_class_init(ObjectClass *klass, void *data)
k->class_id = PCI_CLASS_BRIDGE_ISA;
};
-static TypeInfo isa_bridge_info = {
+static const TypeInfo isa_bridge_info = {
.name = "igd-passthrough-isa-bridge",
.parent = TYPE_PCI_DEVICE,
.instance_size = sizeof(PCIDevice),
diff --git a/hw/i386/sgx-epc.c b/hw/i386/sgx-epc.c
index 96b2940d75..d664829d35 100644
--- a/hw/i386/sgx-epc.c
+++ b/hw/i386/sgx-epc.c
@@ -167,7 +167,7 @@ static void sgx_epc_class_init(ObjectClass *oc, void *data)
mdc->fill_device_info = sgx_epc_md_fill_device_info;
}
-static TypeInfo sgx_epc_info = {
+static const TypeInfo sgx_epc_info = {
.name = TYPE_SGX_EPC,
.parent = TYPE_DEVICE,
.instance_size = sizeof(SGXEPCDevice),
diff --git a/hw/ide/core.c b/hw/ide/core.c
index e28f8aad61..33463d9b8f 100644
--- a/hw/ide/core.c
+++ b/hw/ide/core.c
@@ -29,6 +29,7 @@
#include "qemu/error-report.h"
#include "qemu/main-loop.h"
#include "qemu/timer.h"
+#include "qemu/hw-version.h"
#include "sysemu/sysemu.h"
#include "sysemu/blockdev.h"
#include "sysemu/dma.h"
diff --git a/hw/intc/bcm2835_ic.c b/hw/intc/bcm2835_ic.c
index 9000d995e8..4513fad16f 100644
--- a/hw/intc/bcm2835_ic.c
+++ b/hw/intc/bcm2835_ic.c
@@ -227,7 +227,7 @@ static void bcm2835_ic_class_init(ObjectClass *klass, void *data)
dc->vmsd = &vmstate_bcm2835_ic;
}
-static TypeInfo bcm2835_ic_info = {
+static const TypeInfo bcm2835_ic_info = {
.name = TYPE_BCM2835_IC,
.parent = TYPE_SYS_BUS_DEVICE,
.instance_size = sizeof(BCM2835ICState),
diff --git a/hw/intc/bcm2836_control.c b/hw/intc/bcm2836_control.c
index 2ead76ffdc..b0589df188 100644
--- a/hw/intc/bcm2836_control.c
+++ b/hw/intc/bcm2836_control.c
@@ -392,7 +392,7 @@ static void bcm2836_control_class_init(ObjectClass *klass, void *data)
dc->vmsd = &vmstate_bcm2836_control;
}
-static TypeInfo bcm2836_control_info = {
+static const TypeInfo bcm2836_control_info = {
.name = TYPE_BCM2836_CONTROL,
.parent = TYPE_SYS_BUS_DEVICE,
.instance_size = sizeof(BCM2836ControlState),
diff --git a/hw/ipmi/ipmi.c b/hw/ipmi/ipmi.c
index 8d35c9fdd6..bbb07b151e 100644
--- a/hw/ipmi/ipmi.c
+++ b/hw/ipmi/ipmi.c
@@ -85,7 +85,7 @@ static void ipmi_interface_class_init(ObjectClass *class, void *data)
ik->do_hw_op = ipmi_do_hw_op;
}
-static TypeInfo ipmi_interface_type_info = {
+static const TypeInfo ipmi_interface_type_info = {
.name = TYPE_IPMI_INTERFACE,
.parent = TYPE_INTERFACE,
.class_size = sizeof(IPMIInterfaceClass),
@@ -120,7 +120,7 @@ static void bmc_class_init(ObjectClass *oc, void *data)
device_class_set_props(dc, ipmi_bmc_properties);
}
-static TypeInfo ipmi_bmc_type_info = {
+static const TypeInfo ipmi_bmc_type_info = {
.name = TYPE_IPMI_BMC,
.parent = TYPE_DEVICE,
.instance_size = sizeof(IPMIBmc),
diff --git a/hw/mem/nvdimm.c b/hw/mem/nvdimm.c
index 59959d5563..7c7d777781 100644
--- a/hw/mem/nvdimm.c
+++ b/hw/mem/nvdimm.c
@@ -264,7 +264,7 @@ static void nvdimm_class_init(ObjectClass *oc, void *data)
set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
}
-static TypeInfo nvdimm_info = {
+static const TypeInfo nvdimm_info = {
.name = TYPE_NVDIMM,
.parent = TYPE_PC_DIMM,
.class_size = sizeof(NVDIMMClass),
diff --git a/hw/mem/pc-dimm.c b/hw/mem/pc-dimm.c
index 03bd0dd60e..f27e1a11ba 100644
--- a/hw/mem/pc-dimm.c
+++ b/hw/mem/pc-dimm.c
@@ -291,7 +291,7 @@ static void pc_dimm_class_init(ObjectClass *oc, void *data)
mdc->fill_device_info = pc_dimm_md_fill_device_info;
}
-static TypeInfo pc_dimm_info = {
+static const TypeInfo pc_dimm_info = {
.name = TYPE_PC_DIMM,
.parent = TYPE_DEVICE,
.instance_size = sizeof(PCDIMMDevice),
diff --git a/hw/misc/bcm2835_mbox.c b/hw/misc/bcm2835_mbox.c
index 04e53c9828..1e4e061bc1 100644
--- a/hw/misc/bcm2835_mbox.c
+++ b/hw/misc/bcm2835_mbox.c
@@ -323,7 +323,7 @@ static void bcm2835_mbox_class_init(ObjectClass *klass, void *data)
dc->vmsd = &vmstate_bcm2835_mbox;
}
-static TypeInfo bcm2835_mbox_info = {
+static const TypeInfo bcm2835_mbox_info = {
.name = TYPE_BCM2835_MBOX,
.parent = TYPE_SYS_BUS_DEVICE,
.instance_size = sizeof(BCM2835MboxState),
diff --git a/hw/misc/bcm2835_powermgt.c b/hw/misc/bcm2835_powermgt.c
index 25fa804cbd..976f3d34e5 100644
--- a/hw/misc/bcm2835_powermgt.c
+++ b/hw/misc/bcm2835_powermgt.c
@@ -144,7 +144,7 @@ static void bcm2835_powermgt_class_init(ObjectClass *klass, void *data)
dc->vmsd = &vmstate_bcm2835_powermgt;
}
-static TypeInfo bcm2835_powermgt_info = {
+static const TypeInfo bcm2835_powermgt_info = {
.name = TYPE_BCM2835_POWERMGT,
.parent = TYPE_SYS_BUS_DEVICE,
.instance_size = sizeof(BCM2835PowerMgtState),
diff --git a/hw/misc/bcm2835_property.c b/hw/misc/bcm2835_property.c
index 76ea511d53..e94e951057 100644
--- a/hw/misc/bcm2835_property.c
+++ b/hw/misc/bcm2835_property.c
@@ -421,7 +421,7 @@ static void bcm2835_property_class_init(ObjectClass *klass, void *data)
dc->vmsd = &vmstate_bcm2835_property;
}
-static TypeInfo bcm2835_property_info = {
+static const TypeInfo bcm2835_property_info = {
.name = TYPE_BCM2835_PROPERTY,
.parent = TYPE_SYS_BUS_DEVICE,
.instance_size = sizeof(BCM2835PropertyState),
diff --git a/hw/misc/bcm2835_rng.c b/hw/misc/bcm2835_rng.c
index d0c4e64e88..b3c80cf186 100644
--- a/hw/misc/bcm2835_rng.c
+++ b/hw/misc/bcm2835_rng.c
@@ -131,7 +131,7 @@ static void bcm2835_rng_class_init(ObjectClass *klass, void *data)
dc->vmsd = &vmstate_bcm2835_rng;
}
-static TypeInfo bcm2835_rng_info = {
+static const TypeInfo bcm2835_rng_info = {
.name = TYPE_BCM2835_RNG,
.parent = TYPE_SYS_BUS_DEVICE,
.instance_size = sizeof(BCM2835RngState),
diff --git a/hw/misc/pvpanic-isa.c b/hw/misc/pvpanic-isa.c
index 7b66d58acc..a39fcdd1fc 100644
--- a/hw/misc/pvpanic-isa.c
+++ b/hw/misc/pvpanic-isa.c
@@ -77,7 +77,7 @@ static void pvpanic_isa_class_init(ObjectClass *klass, void *data)
set_bit(DEVICE_CATEGORY_MISC, dc->categories);
}
-static TypeInfo pvpanic_isa_info = {
+static const TypeInfo pvpanic_isa_info = {
.name = TYPE_PVPANIC_ISA_DEVICE,
.parent = TYPE_ISA_DEVICE,
.instance_size = sizeof(PVPanicISAState),
diff --git a/hw/misc/pvpanic-pci.c b/hw/misc/pvpanic-pci.c
index af8cbe2830..62e1be68c1 100644
--- a/hw/misc/pvpanic-pci.c
+++ b/hw/misc/pvpanic-pci.c
@@ -74,7 +74,7 @@ static void pvpanic_pci_class_init(ObjectClass *klass, void *data)
set_bit(DEVICE_CATEGORY_MISC, dc->categories);
}
-static TypeInfo pvpanic_pci_info = {
+static const TypeInfo pvpanic_pci_info = {
.name = TYPE_PVPANIC_PCI_DEVICE,
.parent = TYPE_PCI_DEVICE,
.instance_size = sizeof(PVPanicPCIState),
diff --git a/hw/net/fsl_etsec/etsec.c b/hw/net/fsl_etsec/etsec.c
index bd9d62b559..e7fc082518 100644
--- a/hw/net/fsl_etsec/etsec.c
+++ b/hw/net/fsl_etsec/etsec.c
@@ -430,7 +430,7 @@ static void etsec_class_init(ObjectClass *klass, void *data)
dc->user_creatable = true;
}
-static TypeInfo etsec_info = {
+static const TypeInfo etsec_info = {
.name = TYPE_ETSEC_COMMON,
.parent = TYPE_SYS_BUS_DEVICE,
.instance_size = sizeof(eTSEC),
diff --git a/hw/ppc/prep_systemio.c b/hw/ppc/prep_systemio.c
index b2bd783248..8c9b8dd67b 100644
--- a/hw/ppc/prep_systemio.c
+++ b/hw/ppc/prep_systemio.c
@@ -300,7 +300,7 @@ static void prep_systemio_class_initfn(ObjectClass *klass, void *data)
device_class_set_props(dc, prep_systemio_properties);
}
-static TypeInfo prep_systemio800_info = {
+static const TypeInfo prep_systemio800_info = {
.name = TYPE_PREP_SYSTEMIO,
.parent = TYPE_ISA_DEVICE,
.instance_size = sizeof(PrepSystemIoState),
diff --git a/hw/ppc/spapr_iommu.c b/hw/ppc/spapr_iommu.c
index db01071858..81e5a1aea3 100644
--- a/hw/ppc/spapr_iommu.c
+++ b/hw/ppc/spapr_iommu.c
@@ -685,7 +685,7 @@ static void spapr_tce_table_class_init(ObjectClass *klass, void *data)
spapr_register_hypercall(H_STUFF_TCE, h_stuff_tce);
}
-static TypeInfo spapr_tce_table_info = {
+static const TypeInfo spapr_tce_table_info = {
.name = TYPE_SPAPR_TCE_TABLE,
.parent = TYPE_DEVICE,
.instance_size = sizeof(SpaprTceTable),
diff --git a/hw/rtc/Kconfig b/hw/rtc/Kconfig
index f06e133b8a..730c272bc5 100644
--- a/hw/rtc/Kconfig
+++ b/hw/rtc/Kconfig
@@ -1,10 +1,12 @@
config DS1338
bool
depends on I2C
+ default y if I2C_DEVICES
config M41T80
bool
depends on I2C
+ default y if I2C_DEVICES
config M48T59
bool
diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c
index 01b58ebc70..4b2bdd94b3 100644
--- a/hw/s390x/s390-pci-bus.c
+++ b/hw/s390x/s390-pci-bus.c
@@ -1392,7 +1392,7 @@ static const TypeInfo s390_pci_device_info = {
.class_init = s390_pci_device_class_init,
};
-static TypeInfo s390_pci_iommu_info = {
+static const TypeInfo s390_pci_iommu_info = {
.name = TYPE_S390_PCI_IOMMU,
.parent = TYPE_OBJECT,
.instance_size = sizeof(S390PCIIOMMU),
diff --git a/hw/s390x/sclp.c b/hw/s390x/sclp.c
index 89c30a8a91..eff74479f4 100644
--- a/hw/s390x/sclp.c
+++ b/hw/s390x/sclp.c
@@ -460,7 +460,7 @@ static void sclp_class_init(ObjectClass *oc, void *data)
sc->service_interrupt = service_interrupt;
}
-static TypeInfo sclp_info = {
+static const TypeInfo sclp_info = {
.name = TYPE_SCLP,
.parent = TYPE_DEVICE,
.instance_init = sclp_init,
diff --git a/hw/s390x/tod-kvm.c b/hw/s390x/tod-kvm.c
index ec855811ae..9d0cbfbce2 100644
--- a/hw/s390x/tod-kvm.c
+++ b/hw/s390x/tod-kvm.c
@@ -147,7 +147,7 @@ static void kvm_s390_tod_init(Object *obj)
td->stopped = false;
}
-static TypeInfo kvm_s390_tod_info = {
+static const TypeInfo kvm_s390_tod_info = {
.name = TYPE_KVM_S390_TOD,
.parent = TYPE_S390_TOD,
.instance_size = sizeof(S390TODState),
diff --git a/hw/s390x/tod-tcg.c b/hw/s390x/tod-tcg.c
index 7646b4aa38..2d540dba65 100644
--- a/hw/s390x/tod-tcg.c
+++ b/hw/s390x/tod-tcg.c
@@ -73,7 +73,7 @@ static void qemu_s390_tod_init(Object *obj)
}
}
-static TypeInfo qemu_s390_tod_info = {
+static const TypeInfo qemu_s390_tod_info = {
.name = TYPE_QEMU_S390_TOD,
.parent = TYPE_S390_TOD,
.instance_size = sizeof(S390TODState),
diff --git a/hw/s390x/tod.c b/hw/s390x/tod.c
index fd5a36bf24..c81b1c0338 100644
--- a/hw/s390x/tod.c
+++ b/hw/s390x/tod.c
@@ -123,7 +123,7 @@ static void s390_tod_class_init(ObjectClass *oc, void *data)
dc->user_creatable = false;
}
-static TypeInfo s390_tod_info = {
+static const TypeInfo s390_tod_info = {
.name = TYPE_S390_TOD,
.parent = TYPE_DEVICE,
.instance_size = sizeof(S390TODState),
diff --git a/hw/scsi/lsi53c895a.c b/hw/scsi/lsi53c895a.c
index 4c431adb77..c8773f73f7 100644
--- a/hw/scsi/lsi53c895a.c
+++ b/hw/scsi/lsi53c895a.c
@@ -2352,7 +2352,7 @@ static void lsi53c810_class_init(ObjectClass *klass, void *data)
k->device_id = PCI_DEVICE_ID_LSI_53C810;
}
-static TypeInfo lsi53c810_info = {
+static const TypeInfo lsi53c810_info = {
.name = TYPE_LSI53C810,
.parent = TYPE_LSI53C895A,
.class_init = lsi53c810_class_init,
diff --git a/hw/scsi/megasas.c b/hw/scsi/megasas.c
index cd43945827..d5dfb412ba 100644
--- a/hw/scsi/megasas.c
+++ b/hw/scsi/megasas.c
@@ -28,6 +28,7 @@
#include "hw/pci/msix.h"
#include "qemu/iov.h"
#include "qemu/module.h"
+#include "qemu/hw-version.h"
#include "hw/scsi/scsi.h"
#include "scsi/constants.h"
#include "trace.h"
diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c
index 4057e04ce8..b2e2bc3c96 100644
--- a/hw/scsi/scsi-bus.c
+++ b/hw/scsi/scsi-bus.c
@@ -3,6 +3,7 @@
#include "qemu/error-report.h"
#include "qemu/module.h"
#include "qemu/option.h"
+#include "qemu/hw-version.h"
#include "hw/qdev-properties.h"
#include "hw/scsi/scsi.h"
#include "migration/qemu-file-types.h"
diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c
index 9c0dc7b946..3666b8d946 100644
--- a/hw/scsi/scsi-disk.c
+++ b/hw/scsi/scsi-disk.c
@@ -25,6 +25,7 @@
#include "qemu/error-report.h"
#include "qemu/main-loop.h"
#include "qemu/module.h"
+#include "qemu/hw-version.h"
#include "hw/scsi/scsi.h"
#include "migration/qemu-file-types.h"
#include "migration/vmstate.h"
diff --git a/hw/sd/allwinner-sdhost.c b/hw/sd/allwinner-sdhost.c
index de5bc49e68..041e45c680 100644
--- a/hw/sd/allwinner-sdhost.c
+++ b/hw/sd/allwinner-sdhost.c
@@ -835,7 +835,7 @@ static void allwinner_sdhost_sun5i_class_init(ObjectClass *klass, void *data)
sc->max_desc_size = 64 * KiB;
}
-static TypeInfo allwinner_sdhost_info = {
+static const TypeInfo allwinner_sdhost_info = {
.name = TYPE_AW_SDHOST,
.parent = TYPE_SYS_BUS_DEVICE,
.instance_init = allwinner_sdhost_init,
diff --git a/hw/sd/aspeed_sdhci.c b/hw/sd/aspeed_sdhci.c
index df1bdf1fa4..be8cafd65f 100644
--- a/hw/sd/aspeed_sdhci.c
+++ b/hw/sd/aspeed_sdhci.c
@@ -198,7 +198,7 @@ static void aspeed_sdhci_class_init(ObjectClass *classp, void *data)
device_class_set_props(dc, aspeed_sdhci_properties);
}
-static TypeInfo aspeed_sdhci_info = {
+static const TypeInfo aspeed_sdhci_info = {
.name = TYPE_ASPEED_SDHCI,
.parent = TYPE_SYS_BUS_DEVICE,
.instance_size = sizeof(AspeedSDHCIState),
diff --git a/hw/sd/bcm2835_sdhost.c b/hw/sd/bcm2835_sdhost.c
index 088a7ac6ed..9431c35914 100644
--- a/hw/sd/bcm2835_sdhost.c
+++ b/hw/sd/bcm2835_sdhost.c
@@ -436,7 +436,7 @@ static void bcm2835_sdhost_class_init(ObjectClass *klass, void *data)
dc->vmsd = &vmstate_bcm2835_sdhost;
}
-static TypeInfo bcm2835_sdhost_info = {
+static const TypeInfo bcm2835_sdhost_info = {
.name = TYPE_BCM2835_SDHOST,
.parent = TYPE_SYS_BUS_DEVICE,
.instance_size = sizeof(BCM2835SDHostState),
diff --git a/hw/sd/cadence_sdhci.c b/hw/sd/cadence_sdhci.c
index 56b8bae1c3..75db34befe 100644
--- a/hw/sd/cadence_sdhci.c
+++ b/hw/sd/cadence_sdhci.c
@@ -175,7 +175,7 @@ static void cadence_sdhci_class_init(ObjectClass *classp, void *data)
dc->vmsd = &vmstate_cadence_sdhci;
}
-static TypeInfo cadence_sdhci_info = {
+static const TypeInfo cadence_sdhci_info = {
.name = TYPE_CADENCE_SDHCI,
.parent = TYPE_SYS_BUS_DEVICE,
.instance_size = sizeof(CadenceSDHCIState),
diff --git a/hw/sd/npcm7xx_sdhci.c b/hw/sd/npcm7xx_sdhci.c
index ef503365df..b2f5b4a542 100644
--- a/hw/sd/npcm7xx_sdhci.c
+++ b/hw/sd/npcm7xx_sdhci.c
@@ -166,7 +166,7 @@ static void npcm7xx_sdhci_instance_init(Object *obj)
TYPE_SYSBUS_SDHCI);
}
-static TypeInfo npcm7xx_sdhci_info = {
+static const TypeInfo npcm7xx_sdhci_info = {
.name = TYPE_NPCM7XX_SDHCI,
.parent = TYPE_SYS_BUS_DEVICE,
.instance_size = sizeof(NPCM7xxSDHCIState),
diff --git a/hw/sensor/Kconfig b/hw/sensor/Kconfig
index b317f91b7b..215944decc 100644
--- a/hw/sensor/Kconfig
+++ b/hw/sensor/Kconfig
@@ -1,18 +1,22 @@
config TMP105
bool
depends on I2C
+ default y if I2C_DEVICES
config TMP421
bool
depends on I2C
+ default y if I2C_DEVICES
config DPS310
bool
depends on I2C
+ default y if I2C_DEVICES
config EMC141X
bool
depends on I2C
+ default y if I2C_DEVICES
config ADM1272
bool
@@ -25,3 +29,4 @@ config MAX34451
config LSM303DLHC_MAG
bool
depends on I2C
+ default y if I2C_DEVICES
diff --git a/hw/timer/a9gtimer.c b/hw/timer/a9gtimer.c
index 7233068a37..5e959b6d09 100644
--- a/hw/timer/a9gtimer.c
+++ b/hw/timer/a9gtimer.c
@@ -318,6 +318,12 @@ static void a9_gtimer_realize(DeviceState *dev, Error **errp)
}
}
+static bool vmstate_a9_gtimer_control_needed(void *opaque)
+{
+ A9GTimerState *s = opaque;
+ return s->control != 0;
+}
+
static const VMStateDescription vmstate_a9_gtimer_per_cpu = {
.name = "arm.cortex-a9-global-timer.percpu",
.version_id = 1,
@@ -331,6 +337,17 @@ static const VMStateDescription vmstate_a9_gtimer_per_cpu = {
}
};
+static const VMStateDescription vmstate_a9_gtimer_control = {
+ .name = "arm.cortex-a9-global-timer.control",
+ .version_id = 1,
+ .minimum_version_id = 1,
+ .needed = vmstate_a9_gtimer_control_needed,
+ .fields = (VMStateField[]) {
+ VMSTATE_UINT32(control, A9GTimerState),
+ VMSTATE_END_OF_LIST()
+ }
+};
+
static const VMStateDescription vmstate_a9_gtimer = {
.name = "arm.cortex-a9-global-timer",
.version_id = 1,
@@ -344,6 +361,10 @@ static const VMStateDescription vmstate_a9_gtimer = {
1, vmstate_a9_gtimer_per_cpu,
A9GTimerPerCPU),
VMSTATE_END_OF_LIST()
+ },
+ .subsections = (const VMStateDescription*[]) {
+ &vmstate_a9_gtimer_control,
+ NULL
}
};
diff --git a/hw/usb/dev-mtp.c b/hw/usb/dev-mtp.c
index c1d1694fd0..1e6ac76bef 100644
--- a/hw/usb/dev-mtp.c
+++ b/hw/usb/dev-mtp.c
@@ -2106,7 +2106,7 @@ static void usb_mtp_class_initfn(ObjectClass *klass, void *data)
device_class_set_props(dc, mtp_properties);
}
-static TypeInfo mtp_info = {
+static const TypeInfo mtp_info = {
.name = TYPE_USB_MTP,
.parent = TYPE_USB_DEVICE,
.instance_size = sizeof(MTPState),
diff --git a/hw/usb/host-libusb.c b/hw/usb/host-libusb.c
index d0d46dd0a4..2b35cb6cdd 100644
--- a/hw/usb/host-libusb.c
+++ b/hw/usb/host-libusb.c
@@ -1801,7 +1801,7 @@ static void usb_host_class_initfn(ObjectClass *klass, void *data)
set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories);
}
-static TypeInfo usb_host_dev_info = {
+static const TypeInfo usb_host_dev_info = {
.name = TYPE_USB_HOST_DEVICE,
.parent = TYPE_USB_DEVICE,
.instance_size = sizeof(USBHostDevice),
diff --git a/hw/vfio/igd.c b/hw/vfio/igd.c
index d4685709a3..afe3fe7efc 100644
--- a/hw/vfio/igd.c
+++ b/hw/vfio/igd.c
@@ -199,7 +199,7 @@ static void vfio_pci_igd_lpc_bridge_class_init(ObjectClass *klass, void *data)
k->class_id = PCI_CLASS_BRIDGE_ISA;
}
-static TypeInfo vfio_pci_igd_lpc_bridge_info = {
+static const TypeInfo vfio_pci_igd_lpc_bridge_info = {
.name = "vfio-pci-igd-lpc-bridge",
.parent = TYPE_PCI_DEVICE,
.class_init = vfio_pci_igd_lpc_bridge_class_init,
diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c
index 9a4f491b54..e6c1b0aa46 100644
--- a/hw/virtio/virtio-balloon.c
+++ b/hw/virtio/virtio-balloon.c
@@ -17,6 +17,7 @@
#include "qemu/iov.h"
#include "qemu/module.h"
#include "qemu/timer.h"
+#include "qemu/madvise.h"
#include "hw/virtio/virtio.h"
#include "hw/mem/pc-dimm.h"
#include "hw/qdev-properties.h"
diff --git a/hw/virtio/virtio-pmem.c b/hw/virtio/virtio-pmem.c
index d1aeb90a31..5419dca75e 100644
--- a/hw/virtio/virtio-pmem.c
+++ b/hw/virtio/virtio-pmem.c
@@ -182,7 +182,7 @@ static void virtio_pmem_class_init(ObjectClass *klass, void *data)
set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
}
-static TypeInfo virtio_pmem_info = {
+static const TypeInfo virtio_pmem_info = {
.name = TYPE_VIRTIO_PMEM,
.parent = TYPE_VIRTIO_DEVICE,
.class_size = sizeof(VirtIOPMEMClass),
diff --git a/include/qemu/cacheinfo.h b/include/qemu/cacheinfo.h
new file mode 100644
index 0000000000..019a157ea0
--- /dev/null
+++ b/include/qemu/cacheinfo.h
@@ -0,0 +1,21 @@
+/*
+ * QEMU host cacheinfo information
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+#ifndef QEMU_CACHEINFO_H
+#define QEMU_CACHEINFO_H
+
+/*
+ * These variables represent our best guess at the host icache and
+ * dcache sizes, expressed both as the size in bytes and as the
+ * base-2 log of the size in bytes. They are initialized at startup
+ * (via an attribute 'constructor' function).
+ */
+extern int qemu_icache_linesize;
+extern int qemu_icache_linesize_log;
+extern int qemu_dcache_linesize;
+extern int qemu_dcache_linesize_log;
+
+#endif
diff --git a/include/qemu/hw-version.h b/include/qemu/hw-version.h
new file mode 100644
index 0000000000..730a8c904d
--- /dev/null
+++ b/include/qemu/hw-version.h
@@ -0,0 +1,27 @@
+/*
+ * QEMU "hardware version" machinery
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+#ifndef QEMU_HW_VERSION_H
+#define QEMU_HW_VERSION_H
+
+/*
+ * Starting on QEMU 2.5, qemu_hw_version() returns "2.5+" by default
+ * instead of QEMU_VERSION, so setting hw_version on MachineClass
+ * is no longer mandatory.
+ *
+ * Do NOT change this string, or it will break compatibility on all
+ * machine classes that don't set hw_version.
+ */
+#define QEMU_HW_VERSION "2.5+"
+
+/* QEMU "hardware version" setting. Used to replace code that exposed
+ * QEMU_VERSION to guests in the past and need to keep compatibility.
+ * Do not use qemu_hw_version() in new code.
+ */
+void qemu_set_hw_version(const char *);
+const char *qemu_hw_version(void);
+
+#endif
diff --git a/include/qemu/madvise.h b/include/qemu/madvise.h
new file mode 100644
index 0000000000..e155f59a0d
--- /dev/null
+++ b/include/qemu/madvise.h
@@ -0,0 +1,95 @@
+/*
+ * QEMU madvise wrapper functions
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#ifndef QEMU_MADVISE_H
+#define QEMU_MADVISE_H
+
+#define QEMU_MADV_INVALID -1
+
+#if defined(CONFIG_MADVISE)
+
+#define QEMU_MADV_WILLNEED MADV_WILLNEED
+#define QEMU_MADV_DONTNEED MADV_DONTNEED
+#ifdef MADV_DONTFORK
+#define QEMU_MADV_DONTFORK MADV_DONTFORK
+#else
+#define QEMU_MADV_DONTFORK QEMU_MADV_INVALID
+#endif
+#ifdef MADV_MERGEABLE
+#define QEMU_MADV_MERGEABLE MADV_MERGEABLE
+#else
+#define QEMU_MADV_MERGEABLE QEMU_MADV_INVALID
+#endif
+#ifdef MADV_UNMERGEABLE
+#define QEMU_MADV_UNMERGEABLE MADV_UNMERGEABLE
+#else
+#define QEMU_MADV_UNMERGEABLE QEMU_MADV_INVALID
+#endif
+#ifdef MADV_DODUMP
+#define QEMU_MADV_DODUMP MADV_DODUMP
+#else
+#define QEMU_MADV_DODUMP QEMU_MADV_INVALID
+#endif
+#ifdef MADV_DONTDUMP
+#define QEMU_MADV_DONTDUMP MADV_DONTDUMP
+#else
+#define QEMU_MADV_DONTDUMP QEMU_MADV_INVALID
+#endif
+#ifdef MADV_HUGEPAGE
+#define QEMU_MADV_HUGEPAGE MADV_HUGEPAGE
+#else
+#define QEMU_MADV_HUGEPAGE QEMU_MADV_INVALID
+#endif
+#ifdef MADV_NOHUGEPAGE
+#define QEMU_MADV_NOHUGEPAGE MADV_NOHUGEPAGE
+#else
+#define QEMU_MADV_NOHUGEPAGE QEMU_MADV_INVALID
+#endif
+#ifdef MADV_REMOVE
+#define QEMU_MADV_REMOVE MADV_REMOVE
+#else
+#define QEMU_MADV_REMOVE QEMU_MADV_DONTNEED
+#endif
+#ifdef MADV_POPULATE_WRITE
+#define QEMU_MADV_POPULATE_WRITE MADV_POPULATE_WRITE
+#else
+#define QEMU_MADV_POPULATE_WRITE QEMU_MADV_INVALID
+#endif
+
+#elif defined(CONFIG_POSIX_MADVISE)
+
+#define QEMU_MADV_WILLNEED POSIX_MADV_WILLNEED
+#define QEMU_MADV_DONTNEED POSIX_MADV_DONTNEED
+#define QEMU_MADV_DONTFORK QEMU_MADV_INVALID
+#define QEMU_MADV_MERGEABLE QEMU_MADV_INVALID
+#define QEMU_MADV_UNMERGEABLE QEMU_MADV_INVALID
+#define QEMU_MADV_DODUMP QEMU_MADV_INVALID
+#define QEMU_MADV_DONTDUMP QEMU_MADV_INVALID
+#define QEMU_MADV_HUGEPAGE QEMU_MADV_INVALID
+#define QEMU_MADV_NOHUGEPAGE QEMU_MADV_INVALID
+#define QEMU_MADV_REMOVE QEMU_MADV_DONTNEED
+#define QEMU_MADV_POPULATE_WRITE QEMU_MADV_INVALID
+
+#else /* no-op */
+
+#define QEMU_MADV_WILLNEED QEMU_MADV_INVALID
+#define QEMU_MADV_DONTNEED QEMU_MADV_INVALID
+#define QEMU_MADV_DONTFORK QEMU_MADV_INVALID
+#define QEMU_MADV_MERGEABLE QEMU_MADV_INVALID
+#define QEMU_MADV_UNMERGEABLE QEMU_MADV_INVALID
+#define QEMU_MADV_DODUMP QEMU_MADV_INVALID
+#define QEMU_MADV_DONTDUMP QEMU_MADV_INVALID
+#define QEMU_MADV_HUGEPAGE QEMU_MADV_INVALID
+#define QEMU_MADV_NOHUGEPAGE QEMU_MADV_INVALID
+#define QEMU_MADV_REMOVE QEMU_MADV_INVALID
+#define QEMU_MADV_POPULATE_WRITE QEMU_MADV_INVALID
+
+#endif
+
+int qemu_madvise(void *addr, size_t len, int advice);
+
+#endif
diff --git a/include/qemu/mmap-alloc.h b/include/qemu/mmap-alloc.h
index 90d0eee705..5076695cc8 100644
--- a/include/qemu/mmap-alloc.h
+++ b/include/qemu/mmap-alloc.h
@@ -35,4 +35,27 @@ void *qemu_ram_mmap(int fd,
void qemu_ram_munmap(int fd, void *ptr, size_t size);
+/*
+ * Abstraction of PROT_ and MAP_ flags as passed to mmap(), for example,
+ * consumed by qemu_ram_mmap().
+ */
+
+/* Map PROT_READ instead of PROT_READ | PROT_WRITE. */
+#define QEMU_MAP_READONLY (1 << 0)
+
+/* Use MAP_SHARED instead of MAP_PRIVATE. */
+#define QEMU_MAP_SHARED (1 << 1)
+
+/*
+ * Use MAP_SYNC | MAP_SHARED_VALIDATE if supported. Ignored without
+ * QEMU_MAP_SHARED. If mapping fails, warn and fallback to !QEMU_MAP_SYNC.
+ */
+#define QEMU_MAP_SYNC (1 << 2)
+
+/*
+ * Use MAP_NORESERVE to skip reservation of swap space (or huge pages if
+ * applicable). Bail out if not supported/effective.
+ */
+#define QEMU_MAP_NORESERVE (1 << 3)
+
#endif
diff --git a/include/qemu/mprotect.h b/include/qemu/mprotect.h
new file mode 100644
index 0000000000..1e83d1433e
--- /dev/null
+++ b/include/qemu/mprotect.h
@@ -0,0 +1,14 @@
+/*
+ * QEMU mprotect functions
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+#ifndef QEMU_MPROTECT_H
+#define QEMU_MPROTECT_H
+
+int qemu_mprotect_rw(void *addr, size_t size);
+int qemu_mprotect_rwx(void *addr, size_t size);
+int qemu_mprotect_none(void *addr, size_t size);
+
+#endif
diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h
index ce12f64853..7bcce3bceb 100644
--- a/include/qemu/osdep.h
+++ b/include/qemu/osdep.h
@@ -401,112 +401,6 @@ static inline void qemu_cleanup_generic_vfree(void *p)
*/
#define QEMU_AUTO_VFREE __attribute__((cleanup(qemu_cleanup_generic_vfree)))
-/*
- * Abstraction of PROT_ and MAP_ flags as passed to mmap(), for example,
- * consumed by qemu_ram_mmap().
- */
-
-/* Map PROT_READ instead of PROT_READ | PROT_WRITE. */
-#define QEMU_MAP_READONLY (1 << 0)
-
-/* Use MAP_SHARED instead of MAP_PRIVATE. */
-#define QEMU_MAP_SHARED (1 << 1)
-
-/*
- * Use MAP_SYNC | MAP_SHARED_VALIDATE if supported. Ignored without
- * QEMU_MAP_SHARED. If mapping fails, warn and fallback to !QEMU_MAP_SYNC.
- */
-#define QEMU_MAP_SYNC (1 << 2)
-
-/*
- * Use MAP_NORESERVE to skip reservation of swap space (or huge pages if
- * applicable). Bail out if not supported/effective.
- */
-#define QEMU_MAP_NORESERVE (1 << 3)
-
-
-#define QEMU_MADV_INVALID -1
-
-#if defined(CONFIG_MADVISE)
-
-#define QEMU_MADV_WILLNEED MADV_WILLNEED
-#define QEMU_MADV_DONTNEED MADV_DONTNEED
-#ifdef MADV_DONTFORK
-#define QEMU_MADV_DONTFORK MADV_DONTFORK
-#else
-#define QEMU_MADV_DONTFORK QEMU_MADV_INVALID
-#endif
-#ifdef MADV_MERGEABLE
-#define QEMU_MADV_MERGEABLE MADV_MERGEABLE
-#else
-#define QEMU_MADV_MERGEABLE QEMU_MADV_INVALID
-#endif
-#ifdef MADV_UNMERGEABLE
-#define QEMU_MADV_UNMERGEABLE MADV_UNMERGEABLE
-#else
-#define QEMU_MADV_UNMERGEABLE QEMU_MADV_INVALID
-#endif
-#ifdef MADV_DODUMP
-#define QEMU_MADV_DODUMP MADV_DODUMP
-#else
-#define QEMU_MADV_DODUMP QEMU_MADV_INVALID
-#endif
-#ifdef MADV_DONTDUMP
-#define QEMU_MADV_DONTDUMP MADV_DONTDUMP
-#else
-#define QEMU_MADV_DONTDUMP QEMU_MADV_INVALID
-#endif
-#ifdef MADV_HUGEPAGE
-#define QEMU_MADV_HUGEPAGE MADV_HUGEPAGE
-#else
-#define QEMU_MADV_HUGEPAGE QEMU_MADV_INVALID
-#endif
-#ifdef MADV_NOHUGEPAGE
-#define QEMU_MADV_NOHUGEPAGE MADV_NOHUGEPAGE
-#else
-#define QEMU_MADV_NOHUGEPAGE QEMU_MADV_INVALID
-#endif
-#ifdef MADV_REMOVE
-#define QEMU_MADV_REMOVE MADV_REMOVE
-#else
-#define QEMU_MADV_REMOVE QEMU_MADV_DONTNEED
-#endif
-#ifdef MADV_POPULATE_WRITE
-#define QEMU_MADV_POPULATE_WRITE MADV_POPULATE_WRITE
-#else
-#define QEMU_MADV_POPULATE_WRITE QEMU_MADV_INVALID
-#endif
-
-#elif defined(CONFIG_POSIX_MADVISE)
-
-#define QEMU_MADV_WILLNEED POSIX_MADV_WILLNEED
-#define QEMU_MADV_DONTNEED POSIX_MADV_DONTNEED
-#define QEMU_MADV_DONTFORK QEMU_MADV_INVALID
-#define QEMU_MADV_MERGEABLE QEMU_MADV_INVALID
-#define QEMU_MADV_UNMERGEABLE QEMU_MADV_INVALID
-#define QEMU_MADV_DODUMP QEMU_MADV_INVALID
-#define QEMU_MADV_DONTDUMP QEMU_MADV_INVALID
-#define QEMU_MADV_HUGEPAGE QEMU_MADV_INVALID
-#define QEMU_MADV_NOHUGEPAGE QEMU_MADV_INVALID
-#define QEMU_MADV_REMOVE QEMU_MADV_DONTNEED
-#define QEMU_MADV_POPULATE_WRITE QEMU_MADV_INVALID
-
-#else /* no-op */
-
-#define QEMU_MADV_WILLNEED QEMU_MADV_INVALID
-#define QEMU_MADV_DONTNEED QEMU_MADV_INVALID
-#define QEMU_MADV_DONTFORK QEMU_MADV_INVALID
-#define QEMU_MADV_MERGEABLE QEMU_MADV_INVALID
-#define QEMU_MADV_UNMERGEABLE QEMU_MADV_INVALID
-#define QEMU_MADV_DODUMP QEMU_MADV_INVALID
-#define QEMU_MADV_DONTDUMP QEMU_MADV_INVALID
-#define QEMU_MADV_HUGEPAGE QEMU_MADV_INVALID
-#define QEMU_MADV_NOHUGEPAGE QEMU_MADV_INVALID
-#define QEMU_MADV_REMOVE QEMU_MADV_INVALID
-#define QEMU_MADV_POPULATE_WRITE QEMU_MADV_INVALID
-
-#endif
-
#ifdef _WIN32
#define HAVE_CHARDEV_SERIAL 1
#elif defined(__linux__) || defined(__sun__) || defined(__FreeBSD__) \
@@ -577,11 +471,6 @@ void sigaction_invoke(struct sigaction *action,
struct qemu_signalfd_siginfo *info);
#endif
-int qemu_madvise(void *addr, size_t len, int advice);
-int qemu_mprotect_rw(void *addr, size_t size);
-int qemu_mprotect_rwx(void *addr, size_t size);
-int qemu_mprotect_none(void *addr, size_t size);
-
/*
* Don't introduce new usage of this function, prefer the following
* qemu_open/qemu_create that take an "Error **errp"
@@ -645,22 +534,6 @@ static inline void qemu_timersub(const struct timeval *val1,
void qemu_set_cloexec(int fd);
-/* Starting on QEMU 2.5, qemu_hw_version() returns "2.5+" by default
- * instead of QEMU_VERSION, so setting hw_version on MachineClass
- * is no longer mandatory.
- *
- * Do NOT change this string, or it will break compatibility on all
- * machine classes that don't set hw_version.
- */
-#define QEMU_HW_VERSION "2.5+"
-
-/* QEMU "hardware version" setting. Used to replace code that exposed
- * QEMU_VERSION to guests in the past and need to keep compatibility.
- * Do not use qemu_hw_version() in new code.
- */
-void qemu_set_hw_version(const char *);
-const char *qemu_hw_version(void);
-
void fips_set_state(bool requested);
bool fips_get_state(void);
@@ -727,11 +600,6 @@ pid_t qemu_fork(Error **errp);
extern uintptr_t qemu_real_host_page_size;
extern intptr_t qemu_real_host_page_mask;
-extern int qemu_icache_linesize;
-extern int qemu_icache_linesize_log;
-extern int qemu_dcache_linesize;
-extern int qemu_dcache_linesize_log;
-
/*
* After using getopt or getopt_long, if you need to parse another set
* of options, then you must reset optind. Unfortunately the way to
diff --git a/meson.build b/meson.build
index ae5f7eec6e..8df40bfac4 100644
--- a/meson.build
+++ b/meson.build
@@ -1,4 +1,4 @@
-project('qemu', ['c'], meson_version: '>=0.58.2',
+project('qemu', ['c'], meson_version: '>=0.59.3',
default_options: ['warning_level=1', 'c_std=gnu11', 'cpp_std=gnu++11', 'b_colorout=auto',
'b_staticpic=false', 'stdsplit=false'],
version: files('VERSION'))
@@ -44,6 +44,20 @@ config_host_data = configuration_data()
genh = []
qapi_trace_events = []
+bsd_oses = ['gnu/kfreebsd', 'freebsd', 'netbsd', 'openbsd', 'dragonfly', 'darwin']
+supported_oses = ['windows', 'freebsd', 'netbsd', 'openbsd', 'darwin', 'sunos', 'linux']
+supported_cpus = ['ppc', 'ppc64', 's390x', 'riscv', 'x86', 'x86_64',
+ 'arm', 'aarch64', 'loongarch64', 'mips', 'mips64', 'sparc', 'sparc64']
+
+cpu = host_machine.cpu_family()
+
+# Unify riscv* to a single family.
+if cpu in ['riscv32', 'riscv64']
+ cpu = 'riscv'
+endif
+
+targetos = host_machine.system()
+
target_dirs = config_host['TARGET_DIRS'].split()
have_linux_user = false
have_bsd_user = false
@@ -54,24 +68,18 @@ foreach target : target_dirs
have_system = have_system or target.endswith('-softmmu')
endforeach
have_user = have_linux_user or have_bsd_user
-have_tools = 'CONFIG_TOOLS' in config_host
+have_tools = get_option('tools') \
+ .disable_auto_if(not have_system) \
+ .allowed()
+have_ga = get_option('guest_agent') \
+ .disable_auto_if(not have_system and not have_tools) \
+ .require(targetos in ['sunos', 'linux', 'windows'],
+ error_message: 'unsupported OS for QEMU guest agent') \
+ .allowed()
have_block = have_system or have_tools
python = import('python').find_installation()
-supported_oses = ['windows', 'freebsd', 'netbsd', 'openbsd', 'darwin', 'sunos', 'linux']
-supported_cpus = ['ppc', 'ppc64', 's390x', 'riscv', 'x86', 'x86_64',
- 'arm', 'aarch64', 'loongarch64', 'mips', 'mips64', 'sparc', 'sparc64']
-
-cpu = host_machine.cpu_family()
-
-# Unify riscv* to a single family.
-if cpu in ['riscv32', 'riscv64']
- cpu = 'riscv'
-endif
-
-targetos = host_machine.system()
-
if cpu not in supported_cpus
host_arch = 'unknown'
elif cpu == 'x86'
@@ -99,7 +107,7 @@ else
endif
kvm_targets_c = '""'
-if not get_option('kvm').disabled() and targetos == 'linux'
+if get_option('kvm').allowed() and targetos == 'linux'
kvm_targets_c = '"' + '" ,"'.join(kvm_targets) + '"'
endif
config_host_data.set('CONFIG_KVM_TARGETS', kvm_targets_c)
@@ -163,6 +171,16 @@ endif
# Compiler flags #
##################
+qemu_cflags = config_host['QEMU_CFLAGS'].split()
+qemu_cxxflags = config_host['QEMU_CXXFLAGS'].split()
+qemu_ldflags = config_host['QEMU_LDFLAGS'].split()
+
+if get_option('gprof')
+ qemu_cflags += ['-p']
+ qemu_cxxflags += ['-p']
+ qemu_ldflags += ['-p']
+endif
+
# Specify linker-script with add_project_link_arguments so that it is not placed
# within a linker --start-group/--end-group pair
if get_option('fuzzing')
@@ -198,12 +216,9 @@ if get_option('fuzzing')
endif
endif
-add_global_arguments(config_host['QEMU_CFLAGS'].split(),
- native: false, language: ['c', 'objc'])
-add_global_arguments(config_host['QEMU_CXXFLAGS'].split(),
- native: false, language: 'cpp')
-add_global_link_arguments(config_host['QEMU_LDFLAGS'].split(),
- native: false, language: ['c', 'cpp', 'objc'])
+add_global_arguments(qemu_cflags, native: false, language: ['c', 'objc'])
+add_global_arguments(qemu_cxxflags, native: false, language: ['cpp'])
+add_global_link_arguments(qemu_ldflags, native: false, language: ['c', 'cpp', 'objc'])
if targetos == 'linux'
add_project_arguments('-isystem', meson.current_source_dir() / 'linux-headers',
@@ -269,14 +284,16 @@ if 'syslog' in get_option('trace_backends') and not cc.compiles('''
endif
# Miscellaneous Linux-only features
-if targetos != 'linux' and get_option('mpath').enabled()
- error('Multipath is supported only on Linux')
-endif
+get_option('mpath') \
+ .require(targetos == 'linux', error_message: 'Multipath is supported only on Linux')
-if targetos != 'linux' and get_option('multiprocess').enabled()
- error('Multiprocess QEMU is supported only on Linux')
-endif
-multiprocess_allowed = targetos == 'linux' and not get_option('multiprocess').disabled()
+multiprocess_allowed = get_option('multiprocess') \
+ .require(targetos == 'linux', error_message: 'Multiprocess QEMU is supported only on Linux') \
+ .allowed()
+
+have_tpm = get_option('tpm') \
+ .require(targetos != 'windows', error_message: 'TPM emulation only available on POSIX systems') \
+ .allowed()
# Target-specific libraries and flags
libm = cc.find_library('m', required: false)
@@ -290,8 +307,12 @@ iokit = []
emulator_link_args = []
nvmm =not_found
hvf = not_found
+midl = not_found
+widl = not_found
host_dsosuf = '.so'
if targetos == 'windows'
+ midl = find_program('midl', required: false)
+ widl = find_program('widl', required: false)
socket = cc.find_library('ws2_32')
winmm = cc.find_library('winmm')
@@ -313,7 +334,7 @@ elif targetos == 'haiku'
cc.find_library('network'),
cc.find_library('bsd')]
elif targetos == 'openbsd'
- if not get_option('tcg').disabled() and target_dirs.length() > 0
+ if get_option('tcg').allowed() and target_dirs.length() > 0
# Disable OpenBSD W^X if available
emulator_link_args = cc.get_supported_link_arguments('-Wl,-z,wxneeded')
endif
@@ -321,16 +342,16 @@ endif
# Target-specific configuration of accelerators
accelerators = []
-if not get_option('kvm').disabled() and targetos == 'linux'
+if get_option('kvm').allowed() and targetos == 'linux'
accelerators += 'CONFIG_KVM'
endif
-if not get_option('xen').disabled() and 'CONFIG_XEN_BACKEND' in config_host
+if get_option('xen').allowed() and 'CONFIG_XEN_BACKEND' in config_host
accelerators += 'CONFIG_XEN'
- have_xen_pci_passthrough = not get_option('xen_pci_passthrough').disabled() and targetos == 'linux'
+ have_xen_pci_passthrough = get_option('xen_pci_passthrough').allowed() and targetos == 'linux'
else
have_xen_pci_passthrough = false
endif
-if not get_option('whpx').disabled() and targetos == 'windows'
+if get_option('whpx').allowed() and targetos == 'windows'
if get_option('whpx').enabled() and host_machine.cpu() != 'x86_64'
error('WHPX requires 64-bit host')
elif cc.has_header('WinHvPlatform.h', required: get_option('whpx')) and \
@@ -338,14 +359,14 @@ if not get_option('whpx').disabled() and targetos == 'windows'
accelerators += 'CONFIG_WHPX'
endif
endif
-if not get_option('hvf').disabled()
+if get_option('hvf').allowed()
hvf = dependency('appleframeworks', modules: 'Hypervisor',
required: get_option('hvf'))
if hvf.found()
accelerators += 'CONFIG_HVF'
endif
endif
-if not get_option('hax').disabled()
+if get_option('hax').allowed()
if get_option('hax').enabled() or targetos in ['windows', 'darwin', 'netbsd']
accelerators += 'CONFIG_HAX'
endif
@@ -358,7 +379,7 @@ if targetos == 'netbsd'
endif
tcg_arch = host_arch
-if not get_option('tcg').disabled()
+if get_option('tcg').allowed()
if host_arch == 'unknown'
if get_option('tcg_interpreter')
warning('Unsupported CPU @0@, will use TCG with TCI (slow)'.format(cpu))
@@ -472,7 +493,7 @@ libattr_test = '''
libattr = not_found
have_old_libattr = false
-if not get_option('attr').disabled()
+if get_option('attr').allowed()
if cc.links(libattr_test)
libattr = declare_dependency()
else
@@ -604,7 +625,9 @@ if not get_option('zstd').auto() or have_block
method: 'pkg-config', kwargs: static_kwargs)
endif
virgl = not_found
-if not get_option('virglrenderer').auto() or have_system
+
+have_vhost_user_gpu = have_tools and targetos == 'linux' and pixman.found()
+if not get_option('virglrenderer').auto() or have_system or have_vhost_user_gpu
virgl = dependency('virglrenderer',
method: 'pkg-config',
required: get_option('virglrenderer'),
@@ -628,7 +651,7 @@ endif
mpathlibs = [libudev]
mpathpersist = not_found
mpathpersist_new_api = false
-if targetos == 'linux' and have_tools and not get_option('mpath').disabled()
+if targetos == 'linux' and have_tools and get_option('mpath').allowed()
mpath_test_source_new = '''
#include <libudev.h>
#include <mpath_persist.h>
@@ -697,7 +720,7 @@ endif
iconv = not_found
curses = not_found
-if have_system and not get_option('curses').disabled()
+if have_system and get_option('curses').allowed()
curses_test = '''
#if defined(__APPLE__) || defined(__OpenBSD__)
#define _XOPEN_SOURCE_EXTENDED 1
@@ -759,7 +782,7 @@ if have_system and not get_option('curses').disabled()
endforeach
endif
endif
- if not get_option('iconv').disabled()
+ if get_option('iconv').allowed()
foreach link_args : [ ['-liconv'], [] ]
# Programs will be linked with glib and this will bring in libiconv on FreeBSD.
# We need to use libiconv if available because mixing libiconv's headers with
@@ -938,7 +961,7 @@ if liblzfse.found() and not cc.links('''
endif
oss = not_found
-if have_system and not get_option('oss').disabled()
+if get_option('oss').allowed() and have_system
if not cc.has_header('sys/soundcard.h')
# not found
elif targetos == 'netbsd'
@@ -983,6 +1006,7 @@ if (have_system or have_tools) and (virgl.found() or opengl.found())
gbm = dependency('gbm', method: 'pkg-config', required: false,
kwargs: static_kwargs)
endif
+have_vhost_user_gpu = have_vhost_user_gpu and virgl.found() and gbm.found()
gnutls = not_found
gnutls_crypto = not_found
@@ -1092,7 +1116,7 @@ vnc = not_found
png = not_found
jpeg = not_found
sasl = not_found
-if have_system and not get_option('vnc').disabled()
+if get_option('vnc').allowed() and have_system
vnc = declare_dependency() # dummy dependency
png = dependency('libpng', required: get_option('vnc_png'),
method: 'pkg-config', kwargs: static_kwargs)
@@ -1166,14 +1190,28 @@ if lzo.found() and not cc.links('''
endif
endif
+numa = not_found
+if not get_option('numa').auto() or have_system or have_tools
+ numa = cc.find_library('numa', has_headers: ['numa.h'],
+ required: get_option('numa'),
+ kwargs: static_kwargs)
+endif
+if numa.found() and not cc.links('''
+ #include <numa.h>
+ int main(void) { return numa_available(); }
+ ''', dependencies: numa)
+ numa = not_found
+ if get_option('numa').enabled()
+ error('could not link numa')
+ else
+ warning('could not link numa, disabling')
+ endif
+endif
+
rdma = not_found
if 'CONFIG_RDMA' in config_host
rdma = declare_dependency(link_args: config_host['RDMA_LIBS'].split())
endif
-numa = not_found
-if 'CONFIG_NUMA' in config_host
- numa = declare_dependency(link_args: config_host['NUMA_LIBS'].split())
-endif
xen = not_found
if 'CONFIG_XEN_BACKEND' in config_host
xen = declare_dependency(compile_args: config_host['XEN_CFLAGS'].split(),
@@ -1236,7 +1274,7 @@ selinux = dependency('libselinux',
malloc = []
if get_option('malloc') == 'system'
has_malloc_trim = \
- not get_option('malloc_trim').disabled() and \
+ get_option('malloc_trim').allowed() and \
cc.links('''#include <malloc.h>
int main(void) { malloc_trim(0); return 0; }''')
else
@@ -1268,19 +1306,13 @@ statx_test = gnu_source_prefix + '''
has_statx = cc.links(statx_test)
-have_vhost_user_blk_server = (targetos == 'linux' and
- 'CONFIG_VHOST_USER' in config_host)
-
-if get_option('vhost_user_blk_server').enabled()
- if targetos != 'linux'
- error('vhost_user_blk_server requires linux')
- elif 'CONFIG_VHOST_USER' not in config_host
- error('vhost_user_blk_server requires vhost-user support')
- endif
-elif get_option('vhost_user_blk_server').disabled() or not have_system
- have_vhost_user_blk_server = false
-endif
-
+have_vhost_user_blk_server = get_option('vhost_user_blk_server') \
+ .require(targetos == 'linux',
+ error_message: 'vhost_user_blk_server requires linux') \
+ .require('CONFIG_VHOST_USER' in config_host,
+ error_message: 'vhost_user_blk_server requires vhost-user support') \
+ .disable_auto_if(not have_system) \
+ .allowed()
if get_option('fuse').disabled() and get_option('fuse_lseek').enabled()
error('Cannot enable fuse-lseek while fuse is disabled')
@@ -1291,7 +1323,7 @@ fuse = dependency('fuse3', required: get_option('fuse'),
kwargs: static_kwargs)
fuse_lseek = not_found
-if not get_option('fuse_lseek').disabled()
+if get_option('fuse_lseek').allowed()
if fuse.version().version_compare('>=3.8')
# Dummy dependency
fuse_lseek = declare_dependency()
@@ -1407,41 +1439,33 @@ endif
have_host_block_device = (targetos != 'darwin' or
cc.has_header('IOKit/storage/IOMedia.h'))
-dbus_display = false
-if not get_option('dbus_display').disabled()
- # FIXME enable_modules shouldn't be necessary, but: https://github.com/mesonbuild/meson/issues/8333
- dbus_display = gio.version().version_compare('>=2.64') and config_host.has_key('GDBUS_CODEGEN') and enable_modules
- if get_option('dbus_display').enabled() and not dbus_display
- error('Requirements missing to enable -display dbus (glib>=2.64 && --enable-modules)')
- endif
-endif
-
-have_virtfs = (targetos == 'linux' and
- have_system and
- libattr.found() and
- libcap_ng.found())
+# FIXME enable_modules shouldn't be necessary, but: https://github.com/mesonbuild/meson/issues/8333
+dbus_display = get_option('dbus_display') \
+ .require(gio.version().version_compare('>=2.64'),
+ error_message: '-display dbus requires glib>=2.64') \
+ .require(enable_modules,
+ error_message: '-display dbus requires --enable-modules') \
+ .require(config_host.has_key('GDBUS_CODEGEN'),
+ error_message: '-display dbus requires gdbus-codegen') \
+ .allowed()
+
+have_virtfs = get_option('virtfs') \
+ .require(targetos == 'linux',
+ error_message: 'virtio-9p (virtfs) requires Linux') \
+ .require(libattr.found() and libcap_ng.found(),
+ error_message: 'virtio-9p (virtfs) requires libcap-ng-devel and libattr-devel') \
+ .disable_auto_if(not have_tools and not have_system) \
+ .allowed()
have_virtfs_proxy_helper = have_virtfs and have_tools
-if get_option('virtfs').enabled()
- if not have_virtfs
- if targetos != 'linux'
- error('virtio-9p (virtfs) requires Linux')
- elif not libcap_ng.found() or not libattr.found()
- error('virtio-9p (virtfs) requires libcap-ng-devel and libattr-devel')
- elif not have_system
- error('virtio-9p (virtfs) needs system emulation support')
- endif
- endif
-elif get_option('virtfs').disabled()
- have_virtfs = false
-endif
-
foreach k : get_option('trace_backends')
config_host_data.set('CONFIG_TRACE_' + k.to_upper(), true)
endforeach
config_host_data.set_quoted('CONFIG_TRACE_FILE', get_option('trace_file'))
-
+if get_option('iasl') != ''
+ config_host_data.set_quoted('CONFIG_IASL', get_option('iasl'))
+endif
config_host_data.set_quoted('CONFIG_BINDIR', get_option('prefix') / get_option('bindir'))
config_host_data.set_quoted('CONFIG_PREFIX', get_option('prefix'))
config_host_data.set_quoted('CONFIG_QEMU_CONFDIR', get_option('prefix') / qemu_confdir)
@@ -1455,9 +1479,21 @@ config_host_data.set_quoted('CONFIG_QEMU_LOCALSTATEDIR', get_option('prefix') /
config_host_data.set_quoted('CONFIG_QEMU_MODDIR', get_option('prefix') / qemu_moddir)
config_host_data.set_quoted('CONFIG_SYSCONFDIR', get_option('prefix') / get_option('sysconfdir'))
+have_slirp_smbd = get_option('slirp_smbd') \
+ .require(targetos != 'windows', error_message: 'Host smbd not supported on this platform.') \
+ .allowed()
+if have_slirp_smbd
+ smbd_path = get_option('smbd')
+ if smbd_path == ''
+ smbd_path = (targetos == 'solaris' ? '/usr/sfw/sbin/smbd' : '/usr/sbin/smbd')
+ endif
+ config_host_data.set_quoted('CONFIG_SMBD_COMMAND', smbd_path)
+endif
+
config_host_data.set('HOST_' + host_arch.to_upper(), 1)
config_host_data.set('CONFIG_ATTR', libattr.found())
+config_host_data.set('CONFIG_BDRV_WHITELIST_TOOLS', get_option('block_drv_whitelist_in_tools'))
config_host_data.set('CONFIG_BRLAPI', brlapi.found())
config_host_data.set('CONFIG_COCOA', cocoa.found())
config_host_data.set('CONFIG_FUZZ', get_option('fuzzing'))
@@ -1490,11 +1526,14 @@ config_host_data.set('CONFIG_LIBSSH', libssh.found())
config_host_data.set('CONFIG_LINUX_AIO', libaio.found())
config_host_data.set('CONFIG_LINUX_IO_URING', linux_io_uring.found())
config_host_data.set('CONFIG_LIBPMEM', libpmem.found())
+config_host_data.set('CONFIG_NUMA', numa.found())
+config_host_data.set('CONFIG_PROFILER', get_option('profiler'))
config_host_data.set('CONFIG_RBD', rbd.found())
config_host_data.set('CONFIG_SDL', sdl.found())
config_host_data.set('CONFIG_SDL_IMAGE', sdl_image.found())
config_host_data.set('CONFIG_SECCOMP', seccomp.found())
config_host_data.set('CONFIG_SNAPPY', snappy.found())
+config_host_data.set('CONFIG_TPM', have_tpm)
config_host_data.set('CONFIG_USB_LIBUSB', libusb.found())
config_host_data.set('CONFIG_VDE', vde.found())
config_host_data.set('CONFIG_VHOST_USER_BLK_SERVER', have_vhost_user_blk_server)
@@ -1537,6 +1576,19 @@ config_host_data.set_quoted('CONFIG_HOST_DSOSUF', host_dsosuf)
config_host_data.set('HAVE_HOST_BLOCK_DEVICE', have_host_block_device)
config_host_data.set('HOST_WORDS_BIGENDIAN', host_machine.endian() == 'big')
+have_coroutine_pool = get_option('coroutine_pool')
+if get_option('debug_stack_usage') and have_coroutine_pool
+ message('Disabling coroutine pool to measure stack usage')
+ have_coroutine_pool = false
+endif
+config_host_data.set10('CONFIG_COROUTINE_POOL', have_coroutine_pool)
+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_GPROF', get_option('gprof'))
+config_host_data.set('CONFIG_LIVE_BLOCK_MIGRATION', get_option('live_block_migration').allowed())
+config_host_data.set('CONFIG_QOM_CAST_DEBUG', get_option('qom_cast_debug'))
+config_host_data.set('CONFIG_REPLICATION', get_option('live_block_migration').allowed())
+
# has_header
config_host_data.set('CONFIG_EPOLL', cc.has_header('sys/epoll.h'))
config_host_data.set('CONFIG_LINUX_MAGIC_H', cc.has_header('linux/magic.h'))
@@ -1714,7 +1766,7 @@ config_host_data.set('HAVE_MLOCKALL', cc.links(gnu_source_prefix + '''
}'''))
have_l2tpv3 = false
-if not get_option('l2tpv3').disabled() and have_system
+if get_option('l2tpv3').allowed() and have_system
have_l2tpv3 = cc.has_type('struct mmsghdr',
prefix: gnu_source_prefix + '''
#include <sys/socket.h>
@@ -1723,7 +1775,7 @@ endif
config_host_data.set('CONFIG_L2TPV3', have_l2tpv3)
have_netmap = false
-if not get_option('netmap').disabled() and have_system
+if get_option('netmap').allowed() and have_system
have_netmap = cc.compiles('''
#include <inttypes.h>
#include <net/if.h>
@@ -1780,6 +1832,86 @@ config_host_data.set('CONFIG_GETAUXVAL', cc.links(gnu_source_prefix + '''
return getauxval(AT_HWCAP) == 0;
}'''))
+have_cpuid_h = cc.links('''
+ #include <cpuid.h>
+ int main(void) {
+ unsigned a, b, c, d;
+ unsigned max = __get_cpuid_max(0, 0);
+
+ if (max >= 1) {
+ __cpuid(1, a, b, c, d);
+ }
+
+ if (max >= 7) {
+ __cpuid_count(7, 0, a, b, c, d);
+ }
+
+ return 0;
+ }''')
+config_host_data.set('CONFIG_CPUID_H', have_cpuid_h)
+
+config_host_data.set('CONFIG_AVX2_OPT', get_option('avx2') \
+ .require(have_cpuid_h, error_message: 'cpuid.h not available, cannot enable AVX2') \
+ .require(cc.links('''
+ #pragma GCC push_options
+ #pragma GCC target("avx2")
+ #include <cpuid.h>
+ #include <immintrin.h>
+ static int bar(void *a) {
+ __m256i x = *(__m256i *)a;
+ return _mm256_testz_si256(x, x);
+ }
+ int main(int argc, char *argv[]) { return bar(argv[0]); }
+ '''), error_message: 'AVX2 not available').allowed())
+
+config_host_data.set('CONFIG_AVX512F_OPT', get_option('avx512f') \
+ .require(have_cpuid_h, error_message: 'cpuid.h not available, cannot enable AVX512F') \
+ .require(cc.links('''
+ #pragma GCC push_options
+ #pragma GCC target("avx512f")
+ #include <cpuid.h>
+ #include <immintrin.h>
+ static int bar(void *a) {
+ __m512i x = *(__m512i *)a;
+ return _mm512_test_epi64_mask(x, x);
+ }
+ int main(int argc, char *argv[]) { return bar(argv[0]); }
+ '''), error_message: 'AVX512F not available').allowed())
+
+if get_option('membarrier').disabled()
+ have_membarrier = false
+elif targetos == 'windows'
+ have_membarrier = true
+elif targetos == 'linux'
+ have_membarrier = cc.compiles('''
+ #include <linux/membarrier.h>
+ #include <sys/syscall.h>
+ #include <unistd.h>
+ #include <stdlib.h>
+ int main(void) {
+ syscall(__NR_membarrier, MEMBARRIER_CMD_QUERY, 0);
+ syscall(__NR_membarrier, MEMBARRIER_CMD_SHARED, 0);
+ exit(0);
+ }''')
+endif
+config_host_data.set('CONFIG_MEMBARRIER', get_option('membarrier') \
+ .require(have_membarrier, error_message: 'membarrier system call not available') \
+ .allowed())
+
+have_afalg = get_option('crypto_afalg') \
+ .require(cc.compiles(gnu_source_prefix + '''
+ #include <errno.h>
+ #include <sys/types.h>
+ #include <sys/socket.h>
+ #include <linux/if_alg.h>
+ int main(void) {
+ int sock;
+ sock = socket(AF_ALG, SOCK_SEQPACKET, 0);
+ return sock;
+ }
+ '''), error_message: 'AF_ALG requested but could not be detected').allowed()
+config_host_data.set('CONFIG_AF_ALG', have_afalg)
+
config_host_data.set('CONFIG_AF_VSOCK', cc.compiles(gnu_source_prefix + '''
#include <errno.h>
#include <sys/types.h>
@@ -1800,10 +1932,33 @@ config_host_data.set('CONFIG_AF_VSOCK', cc.compiles(gnu_source_prefix + '''
return -1;
}'''))
+have_vss = false
+if targetos == 'windows' and link_language == 'cpp'
+ have_vss = cxx.compiles('''
+ #define __MIDL_user_allocate_free_DEFINED__
+ #include <inc/win2003/vss.h>
+ int main(void) { return VSS_CTX_BACKUP; }''')
+endif
+
+have_ntddscsi = false
+if targetos == 'windows'
+ have_ntddscsi = cc.compiles('''
+ #include <windows.h>
+ #include <ntddscsi.h>
+ int main(void) {
+ #if !defined(IOCTL_SCSI_GET_ADDRESS)
+ #error Missing required ioctl definitions
+ #endif
+ SCSI_ADDRESS addr = { .Lun = 0, .TargetId = 0, .PathId = 0 };
+ return addr.Lun;
+ }
+''')
+endif
+config_host_data.set('HAVE_NTDDSCSI', have_ntddscsi)
+
ignored = ['CONFIG_QEMU_INTERP_PREFIX', # actually per-target
'HAVE_GDB_BIN']
arrays = ['CONFIG_BDRV_RW_WHITELIST', 'CONFIG_BDRV_RO_WHITELIST']
-strings = ['CONFIG_IASL']
foreach k, v: config_host
if ignored.contains(k)
# do nothing
@@ -1812,8 +1967,6 @@ foreach k, v: config_host
v = '"' + '", "'.join(v.split()) + '", '
endif
config_host_data.set(k, v)
- elif strings.contains(k)
- config_host_data.set_quoted(k, v)
elif k.startswith('CONFIG_')
config_host_data.set(k, v == 'y' ? 1 : v)
endif
@@ -1865,7 +2018,7 @@ endif
have_ivshmem = config_host_data.get('CONFIG_EVENTFD')
host_kconfig = \
(get_option('fuzzing') ? ['CONFIG_FUZZ=y'] : []) + \
- ('CONFIG_TPM' in config_host ? ['CONFIG_TPM=y'] : []) + \
+ (have_tpm ? ['CONFIG_TPM=y'] : []) + \
(spice.found() ? ['CONFIG_SPICE=y'] : []) + \
(have_ivshmem ? ['CONFIG_IVSHMEM=y'] : []) + \
('CONFIG_OPENGL' in config_host ? ['CONFIG_OPENGL=y'] : []) + \
@@ -2602,7 +2755,9 @@ if have_block
'job.c',
'qemu-io-cmds.c',
))
- block_ss.add(when: 'CONFIG_REPLICATION', if_true: files('replication.c'))
+ if config_host_data.get('CONFIG_REPLICATION')
+ block_ss.add(files('replication.c'))
+ endif
subdir('nbd')
subdir('scsi')
@@ -3097,11 +3252,7 @@ if 'CONFIG_PLUGIN' in config_host
install_headers('include/qemu/qemu-plugin.h')
endif
-if 'CONFIG_GUEST_AGENT' in config_host
- subdir('qga')
-elif get_option('guest_agent_msi').enabled()
- error('Guest agent MSI requested, but the guest agent is not being built')
-endif
+subdir('qga')
# Don't build qemu-keymap if xkbcommon is not explicitly enabled
# when we don't build tools or system
@@ -3223,12 +3374,17 @@ summary_info += {'sphinx-build': sphinx_build}
if config_host.has_key('HAVE_GDB_BIN')
summary_info += {'gdb': config_host['HAVE_GDB_BIN']}
endif
+if get_option('iasl') != ''
+ summary_info += {'iasl': get_option('iasl')}
+else
+ summary_info += {'iasl': false}
+endif
summary_info += {'genisoimage': config_host['GENISOIMAGE']}
-if targetos == 'windows' and config_host.has_key('CONFIG_GUEST_AGENT')
+if targetos == 'windows' and have_ga
summary_info += {'wixl': wixl}
endif
-if slirp_opt != 'disabled' and 'CONFIG_SLIRP_SMBD' in config_host
- summary_info += {'smbd': config_host['CONFIG_SMBD_COMMAND']}
+if slirp_opt != 'disabled' and have_system
+ summary_info += {'smbd': have_slirp_smbd ? smbd_path : false}
endif
summary(summary_info, bool_yn: true, section: 'Host binaries')
@@ -3252,7 +3408,7 @@ if 'simple' in get_option('trace_backends')
summary_info += {'Trace output file': get_option('trace_file') + '-<pid>'}
endif
summary_info += {'D-Bus display': dbus_display}
-summary_info += {'QOM debugging': config_host.has_key('CONFIG_QOM_CAST_DEBUG')}
+summary_info += {'QOM debugging': get_option('qom_cast_debug')}
summary_info += {'vhost-kernel support': config_host.has_key('CONFIG_VHOST_KERNEL')}
summary_info += {'vhost-net support': config_host.has_key('CONFIG_VHOST_NET')}
summary_info += {'vhost-crypto support': config_host.has_key('CONFIG_VHOST_CRYPTO')}
@@ -3262,7 +3418,7 @@ summary_info += {'vhost-user support': config_host.has_key('CONFIG_VHOST_USER')}
summary_info += {'vhost-user-blk server support': have_vhost_user_blk_server}
summary_info += {'vhost-user-fs support': config_host.has_key('CONFIG_VHOST_USER_FS')}
summary_info += {'vhost-vdpa support': config_host.has_key('CONFIG_VHOST_VDPA')}
-summary_info += {'build guest agent': config_host.has_key('CONFIG_GUEST_AGENT')}
+summary_info += {'build guest agent': have_ga}
summary(summary_info, bool_yn: true, section: 'Configurable features')
# Compilation information
@@ -3279,11 +3435,6 @@ endif
if targetos == 'darwin'
summary_info += {'Objective-C compiler': ' '.join(meson.get_compiler('objc').cmd_array())}
endif
-if targetos == 'windows'
- if 'WIN_SDK' in config_host
- summary_info += {'Windows SDK': config_host['WIN_SDK']}
- endif
-endif
summary_info += {'CFLAGS': ' '.join(get_option('c_args')
+ ['-O' + get_option('optimization')]
+ (get_option('debug') ? ['-g'] : []))}
@@ -3298,18 +3449,18 @@ if link_args.length() > 0
endif
summary_info += {'QEMU_CFLAGS': config_host['QEMU_CFLAGS']}
summary_info += {'QEMU_LDFLAGS': config_host['QEMU_LDFLAGS']}
-summary_info += {'profiler': config_host.has_key('CONFIG_PROFILER')}
+summary_info += {'profiler': get_option('profiler')}
summary_info += {'link-time optimization (LTO)': get_option('b_lto')}
summary_info += {'PIE': get_option('b_pie')}
summary_info += {'static build': config_host.has_key('CONFIG_STATIC')}
summary_info += {'malloc trim support': has_malloc_trim}
-summary_info += {'membarrier': config_host.has_key('CONFIG_MEMBARRIER')}
-summary_info += {'debug stack usage': config_host.has_key('CONFIG_DEBUG_STACK_USAGE')}
-summary_info += {'mutex debugging': config_host.has_key('CONFIG_DEBUG_MUTEX')}
+summary_info += {'membarrier': have_membarrier}
+summary_info += {'debug stack usage': get_option('debug_stack_usage')}
+summary_info += {'mutex debugging': get_option('debug_mutex')}
summary_info += {'memory allocator': get_option('malloc')}
-summary_info += {'avx2 optimization': config_host.has_key('CONFIG_AVX2_OPT')}
-summary_info += {'avx512f optimization': config_host.has_key('CONFIG_AVX512F_OPT')}
-summary_info += {'gprof enabled': config_host.has_key('CONFIG_GPROF')}
+summary_info += {'avx2 optimization': config_host_data.get('CONFIG_AVX2_OPT')}
+summary_info += {'avx512f optimization': config_host_data.get('CONFIG_AVX512F_OPT')}
+summary_info += {'gprof enabled': get_option('gprof')}
summary_info += {'gcov': get_option('b_coverage')}
summary_info += {'thread sanitizer': config_host.has_key('CONFIG_TSAN')}
summary_info += {'CFI support': get_option('cfi')}
@@ -3372,23 +3523,23 @@ summary(summary_info, bool_yn: true, section: 'Targets and accelerators')
# Block layer
summary_info = {}
summary_info += {'coroutine backend': config_host['CONFIG_COROUTINE_BACKEND']}
-summary_info += {'coroutine pool': config_host['CONFIG_COROUTINE_POOL'] == '1'}
+summary_info += {'coroutine pool': have_coroutine_pool}
if have_block
summary_info += {'Block whitelist (rw)': config_host['CONFIG_BDRV_RW_WHITELIST']}
summary_info += {'Block whitelist (ro)': config_host['CONFIG_BDRV_RO_WHITELIST']}
- summary_info += {'Use block whitelist in tools': config_host.has_key('CONFIG_BDRV_WHITELIST_TOOLS')}
+ summary_info += {'Use block whitelist in tools': get_option('block_drv_whitelist_in_tools')}
summary_info += {'VirtFS support': have_virtfs}
summary_info += {'build virtiofs daemon': have_virtiofsd}
- summary_info += {'Live block migration': config_host.has_key('CONFIG_LIVE_BLOCK_MIGRATION')}
- summary_info += {'replication support': config_host.has_key('CONFIG_REPLICATION')}
- summary_info += {'bochs support': config_host.has_key('CONFIG_BOCHS')}
- summary_info += {'cloop support': config_host.has_key('CONFIG_CLOOP')}
- summary_info += {'dmg support': config_host.has_key('CONFIG_DMG')}
- summary_info += {'qcow v1 support': config_host.has_key('CONFIG_QCOW1')}
- summary_info += {'vdi support': config_host.has_key('CONFIG_VDI')}
- summary_info += {'vvfat support': config_host.has_key('CONFIG_VVFAT')}
- summary_info += {'qed support': config_host.has_key('CONFIG_QED')}
- summary_info += {'parallels support': config_host.has_key('CONFIG_PARALLELS')}
+ summary_info += {'Live block migration': config_host_data.get('CONFIG_LIVE_BLOCK_MIGRATION')}
+ summary_info += {'replication support': config_host_data.get('CONFIG_REPLICATION')}
+ summary_info += {'bochs support': get_option('bochs').allowed()}
+ summary_info += {'cloop support': get_option('cloop').allowed()}
+ summary_info += {'dmg support': get_option('dmg').allowed()}
+ summary_info += {'qcow v1 support': get_option('qcow1').allowed()}
+ summary_info += {'vdi support': get_option('vdi').allowed()}
+ summary_info += {'vvfat support': get_option('vvfat').allowed()}
+ summary_info += {'qed support': get_option('qed').allowed()}
+ summary_info += {'parallels support': get_option('parallels').allowed()}
summary_info += {'FUSE exports': fuse}
endif
summary(summary_info, bool_yn: true, section: 'Block layer support')
@@ -3405,8 +3556,8 @@ summary_info += {'nettle': nettle}
if nettle.found()
summary_info += {' XTS': xts != 'private'}
endif
-summary_info += {'crypto afalg': config_host.has_key('CONFIG_AF_ALG')}
-summary_info += {'rng-none': config_host.has_key('CONFIG_RNG_NONE')}
+summary_info += {'AF_ALG support': have_afalg}
+summary_info += {'rng-none': get_option('rng_none')}
summary_info += {'Linux keyring': config_host.has_key('CONFIG_SECRET_KEYRING')}
summary(summary_info, bool_yn: true, section: 'Crypto')
@@ -3472,21 +3623,21 @@ summary_info += {'GBM': gbm}
summary_info += {'libiscsi support': libiscsi}
summary_info += {'libnfs support': libnfs}
if targetos == 'windows'
- if config_host.has_key('CONFIG_GUEST_AGENT')
- summary_info += {'QGA VSS support': config_host.has_key('CONFIG_QGA_VSS')}
- summary_info += {'QGA w32 disk info': config_host.has_key('CONFIG_QGA_NTDDSCSI')}
+ if have_ga
+ summary_info += {'QGA VSS support': have_qga_vss}
+ summary_info += {'QGA w32 disk info': have_ntddscsi}
endif
endif
summary_info += {'seccomp support': seccomp}
summary_info += {'GlusterFS support': glusterfs}
-summary_info += {'TPM support': config_host.has_key('CONFIG_TPM')}
+summary_info += {'TPM support': have_tpm}
summary_info += {'libssh support': libssh}
summary_info += {'lzo support': lzo}
summary_info += {'snappy support': snappy}
summary_info += {'bzip2 support': libbzip2}
summary_info += {'lzfse support': liblzfse}
summary_info += {'zstd support': zstd}
-summary_info += {'NUMA host support': config_host.has_key('CONFIG_NUMA')}
+summary_info += {'NUMA host support': numa}
summary_info += {'capstone': capstone_opt == 'internal' ? capstone_opt : capstone}
summary_info += {'libpmem support': libpmem}
summary_info += {'libdaxctl support': libdaxctl}
diff --git a/meson_options.txt b/meson_options.txt
index 95d527f773..52b11cead4 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -8,8 +8,12 @@ option('docdir', type : 'string', value : 'doc',
description: 'Base directory for documentation installation (can be empty)')
option('qemu_firmwarepath', type : 'string', value : '',
description: 'search PATH for firmware files')
+option('smbd', type : 'string', value : '',
+ description: 'Path to smbd for slirp networking')
option('sphinx_build', type : 'string', value : '',
description: 'Use specified sphinx-build [$sphinx_build] for building document (default to be empty)')
+option('iasl', type : 'string', value : '',
+ description: 'Path to ACPI disassembler')
option('default_devices', type : 'boolean', value : true,
description: 'Include a default selection of devices in emulators')
option('audio_drv_list', type: 'array', value: ['default'],
@@ -34,8 +38,14 @@ option('install_blobs', type : 'boolean', value : true,
description: 'install provided firmware blobs')
option('sparse', type : 'feature', value : 'auto',
description: 'sparse checker')
+option('guest_agent', type : 'feature', value : 'auto',
+ description: 'Build QEMU Guest Agent')
option('guest_agent_msi', type : 'feature', value : 'auto',
description: 'Build MSI package for the QEMU Guest Agent')
+option('tools', type : 'feature', value : 'auto',
+ description: 'build support utilities that come with QEMU')
+option('qga_vss', type : 'feature', value: 'auto',
+ description: 'build QGA VSS support (broken with MinGW)')
option('malloc_trim', type : 'feature', value : 'auto',
description: 'enable libc malloc_trim() for memory optimization')
@@ -68,6 +78,18 @@ option('multiprocess', type: 'feature', value: 'auto',
description: 'Out of process device emulation support')
option('dbus_display', type: 'feature', value: 'auto',
description: '-display dbus support')
+option('tpm', type : 'feature', value : 'auto',
+ description: 'TPM support')
+
+# Do not enable it by default even for Mingw32, because it doesn't
+# work on Wine.
+option('membarrier', type: 'feature', value: 'disabled',
+ description: 'membarrier system call (for Linux 4.14+ or Windows')
+
+option('avx2', type: 'feature', value: 'auto',
+ description: 'AVX2 optimizations')
+option('avx512f', type: 'feature', value: 'disabled',
+ description: 'AVX512F optimizations')
option('attr', type : 'feature', value : 'auto',
description: 'attr/xattr support')
@@ -93,6 +115,8 @@ option('libnfs', type : 'feature', value : 'auto',
description: 'libnfs block device driver')
option('mpath', type : 'feature', value : 'auto',
description: 'Multipath persistent reservation passthrough')
+option('numa', type : 'feature', value : 'auto',
+ description: 'libnuma support')
option('iconv', type : 'feature', value : 'auto',
description: 'Font glyph conversion support')
option('curses', type : 'feature', value : 'auto',
@@ -103,6 +127,8 @@ option('nettle', type : 'feature', value : 'auto',
description: 'nettle cryptography support')
option('gcrypt', type : 'feature', value : 'auto',
description: 'libgcrypt cryptography support')
+option('crypto_afalg', type : 'feature', value : 'disabled',
+ description: 'Linux AF_ALG crypto backend driver')
option('libdaxctl', type : 'feature', value : 'auto',
description: 'libdaxctl support')
option('libpmem', type : 'feature', value : 'auto',
@@ -206,3 +232,41 @@ option('fdt', type: 'combo', value: 'auto',
option('selinux', type: 'feature', value: 'auto',
description: 'SELinux support in qemu-nbd')
+option('live_block_migration', type: 'feature', value: 'auto',
+ description: 'block migration in the main migration stream')
+option('replication', type: 'feature', value: 'auto',
+ description: 'replication support')
+option('bochs', type: 'feature', value: 'auto',
+ description: 'bochs image format support')
+option('cloop', type: 'feature', value: 'auto',
+ description: 'cloop image format support')
+option('dmg', type: 'feature', value: 'auto',
+ description: 'dmg image format support')
+option('qcow1', type: 'feature', value: 'auto',
+ description: 'qcow1 image format support')
+option('vdi', type: 'feature', value: 'auto',
+ description: 'vdi image format support')
+option('vvfat', type: 'feature', value: 'auto',
+ description: 'vvfat image format support')
+option('qed', type: 'feature', value: 'auto',
+ description: 'qed image format support')
+option('parallels', type: 'feature', value: 'auto',
+ description: 'parallels image format support')
+option('block_drv_whitelist_in_tools', type: 'boolean', value: false,
+ description: 'use block whitelist also in tools instead of only QEMU')
+option('rng_none', type: 'boolean', value: false,
+ description: 'dummy RNG, avoid using /dev/(u)random and getrandom()')
+option('coroutine_pool', type: 'boolean', value: true,
+ description: 'coroutine freelist (better performance)')
+option('debug_mutex', type: 'boolean', value: false,
+ description: 'mutex debugging support')
+option('debug_stack_usage', type: 'boolean', value: false,
+ description: 'measure coroutine stack usage')
+option('qom_cast_debug', type: 'boolean', value: false,
+ description: 'cast debugging support')
+option('gprof', type: 'boolean', value: false,
+ description: 'QEMU profiling with gprof')
+option('profiler', type: 'boolean', value: false,
+ description: 'profiler support')
+option('slirp_smbd', type : 'feature', value : 'auto',
+ description: 'use smbd (at path --smbd=*) in slirp networking')
diff --git a/migration/meson.build b/migration/meson.build
index f8714dcb15..8b5ca5c047 100644
--- a/migration/meson.build
+++ b/migration/meson.build
@@ -28,7 +28,9 @@ softmmu_ss.add(files(
), gnutls)
softmmu_ss.add(when: ['CONFIG_RDMA', rdma], if_true: files('rdma.c'))
-softmmu_ss.add(when: 'CONFIG_LIVE_BLOCK_MIGRATION', if_true: files('block.c'))
+if get_option('live_block_migration').allowed()
+ softmmu_ss.add(files('block.c'))
+endif
softmmu_ss.add(when: zstd, if_true: files('multifd-zstd.c'))
specific_ss.add(when: 'CONFIG_SOFTMMU',
diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c
index e662dd05cc..2a2cc5faf8 100644
--- a/migration/postcopy-ram.c
+++ b/migration/postcopy-ram.c
@@ -18,6 +18,7 @@
#include "qemu/osdep.h"
#include "qemu/rcu.h"
+#include "qemu/madvise.h"
#include "exec/target_page.h"
#include "migration.h"
#include "qemu-file.h"
diff --git a/migration/qemu-file.c b/migration/qemu-file.c
index 6338d8e2ff..1479cddad9 100644
--- a/migration/qemu-file.c
+++ b/migration/qemu-file.c
@@ -23,6 +23,7 @@
*/
#include "qemu/osdep.h"
#include <zlib.h>
+#include "qemu/madvise.h"
#include "qemu/error-report.h"
#include "qemu/iov.h"
#include "migration.h"
diff --git a/migration/ram.c b/migration/ram.c
index 91ca743ac8..781f0745dc 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -30,6 +30,7 @@
#include "qemu/cutils.h"
#include "qemu/bitops.h"
#include "qemu/bitmap.h"
+#include "qemu/madvise.h"
#include "qemu/main-loop.h"
#include "xbzrle.h"
#include "ram.h"
diff --git a/net/slirp.c b/net/slirp.c
index ad3a838e0b..bc5e9e4f77 100644
--- a/net/slirp.c
+++ b/net/slirp.c
@@ -27,7 +27,7 @@
#include "net/slirp.h"
-#if defined(CONFIG_SLIRP_SMBD)
+#if defined(CONFIG_SMBD_COMMAND)
#include <pwd.h>
#include <sys/wait.h>
#endif
@@ -91,7 +91,7 @@ typedef struct SlirpState {
Slirp *slirp;
Notifier poll_notifier;
Notifier exit_notifier;
-#if defined(CONFIG_SLIRP_SMBD)
+#if defined(CONFIG_SMBD_COMMAND)
gchar *smb_dir;
#endif
GSList *fwd;
@@ -104,7 +104,7 @@ static QTAILQ_HEAD(, SlirpState) slirp_stacks =
static int slirp_hostfwd(SlirpState *s, const char *redir_str, Error **errp);
static int slirp_guestfwd(SlirpState *s, const char *config_str, Error **errp);
-#if defined(CONFIG_SLIRP_SMBD)
+#if defined(CONFIG_SMBD_COMMAND)
static int slirp_smb(SlirpState *s, const char *exported_dir,
struct in_addr vserver_addr, Error **errp);
static void slirp_smb_cleanup(SlirpState *s);
@@ -377,7 +377,7 @@ static int net_slirp_init(NetClientState *peer, const char *model,
struct in6_addr ip6_prefix;
struct in6_addr ip6_host;
struct in6_addr ip6_dns;
-#if defined(CONFIG_SLIRP_SMBD)
+#if defined(CONFIG_SMBD_COMMAND)
struct in_addr smbsrv = { .s_addr = 0 };
#endif
NetClientState *nc;
@@ -487,7 +487,7 @@ static int net_slirp_init(NetClientState *peer, const char *model,
return -1;
}
-#if defined(CONFIG_SLIRP_SMBD)
+#if defined(CONFIG_SMBD_COMMAND)
if (vsmbserver && !inet_aton(vsmbserver, &smbsrv)) {
error_setg(errp, "Failed to parse SMB address");
return -1;
@@ -602,7 +602,7 @@ static int net_slirp_init(NetClientState *peer, const char *model,
}
}
}
-#if defined(CONFIG_SLIRP_SMBD)
+#if defined(CONFIG_SMBD_COMMAND)
if (smb_export) {
if (slirp_smb(s, smb_export, smbsrv, errp) < 0) {
goto error;
@@ -794,7 +794,7 @@ void hmp_hostfwd_add(Monitor *mon, const QDict *qdict)
}
-#if defined(CONFIG_SLIRP_SMBD)
+#if defined(CONFIG_SMBD_COMMAND)
/* automatic user mode samba server configuration */
static void slirp_smb_cleanup(SlirpState *s)
@@ -909,7 +909,7 @@ static int slirp_smb(SlirpState* s, const char *exported_dir,
return 0;
}
-#endif /* defined(CONFIG_SLIRP_SMBD) */
+#endif /* defined(CONFIG_SMBD_COMMAND) */
static int guestfwd_can_read(void *opaque)
{
diff --git a/plugins/loader.c b/plugins/loader.c
index a4ec281692..4883b0a1cb 100644
--- a/plugins/loader.c
+++ b/plugins/loader.c
@@ -24,6 +24,7 @@
#include "qemu/rcu_queue.h"
#include "qemu/qht.h"
#include "qemu/bitmap.h"
+#include "qemu/cacheinfo.h"
#include "qemu/xxhash.h"
#include "qemu/plugin.h"
#include "hw/core/cpu.h"
diff --git a/qga/commands-win32.c b/qga/commands-win32.c
index 484cb1c6bd..4fbbad793f 100644
--- a/qga/commands-win32.c
+++ b/qga/commands-win32.c
@@ -18,7 +18,7 @@
#include <ws2tcpip.h>
#include <iptypes.h>
#include <iphlpapi.h>
-#ifdef CONFIG_QGA_NTDDSCSI
+#ifdef HAVE_NTDDSCSI
#include <winioctl.h>
#include <ntddscsi.h>
#endif
@@ -474,7 +474,7 @@ void qmp_guest_file_flush(int64_t handle, Error **errp)
}
}
-#ifdef CONFIG_QGA_NTDDSCSI
+#ifdef HAVE_NTDDSCSI
static GuestDiskBusType win2qemu[] = {
[BusTypeUnknown] = GUEST_DISK_BUS_TYPE_UNKNOWN,
@@ -1111,7 +1111,7 @@ GuestDiskInfoList *qmp_guest_get_disks(Error **errp)
return NULL;
}
-#endif /* CONFIG_QGA_NTDDSCSI */
+#endif /* HAVE_NTDDSCSI */
static GuestFilesystemInfo *build_guest_fsinfo(char *guid, Error **errp)
{
diff --git a/qga/meson.build b/qga/meson.build
index 1ee9dca60b..54f2da5b07 100644
--- a/qga/meson.build
+++ b/qga/meson.build
@@ -1,3 +1,33 @@
+if not have_ga
+ if get_option('guest_agent_msi').enabled()
+ error('Guest agent MSI requested, but the guest agent is not being built')
+ endif
+ have_qga_vss = false
+ subdir_done()
+endif
+
+have_qga_vss = get_option('qga_vss') \
+ .require(targetos == 'windows',
+ error_message: 'VSS support requires Windows') \
+ .require(link_language == 'cpp',
+ error_message: 'VSS support requires a C++ compiler') \
+ .require(have_vss, error_message: '''VSS support requires VSS headers.
+ If your Visual Studio installation doesn't have the VSS headers,
+ Please download and install Microsoft VSS SDK:
+ http://www.microsoft.com/en-us/download/details.aspx?id=23490
+ On POSIX-systems, MinGW doesn't yet provide working headers.
+ you can extract the SDK headers by:
+ $ scripts/extract-vsssdk-headers setup.exe
+ The headers are extracted in the directory 'inc/win2003'.
+ Then run configure with: --extra-cxxflags="-isystem /path/to/vss/inc/win2003"''') \
+ .require(midl.found() or widl.found(),
+ error_message: 'VSS support requires midl or widl') \
+ .require(not enable_static,
+ error_message: 'VSS support requires dynamic linking with GLib') \
+ .allowed()
+
+all_qga = []
+
qga_qapi_outputs = [
'qga-qapi-commands.c',
'qga-qapi-commands.h',
@@ -50,19 +80,26 @@ qga_ss.add(when: 'CONFIG_WIN32', if_true: files(
qga_ss = qga_ss.apply(config_host, strict: false)
+gen_tlb = []
+qga_libs = []
+if targetos == 'windows'
+ qga_libs += ['-lws2_32', '-lwinmm', '-lpowrprof', '-lwtsapi32', '-lwininet', '-liphlpapi', '-lnetapi32']
+ if have_qga_vss
+ qga_libs += ['-lole32', '-loleaut32', '-lshlwapi', '-lstdc++', '-Wl,--enable-stdcall-fixup']
+ subdir('vss-win32')
+ endif
+ if have_ntddscsi
+ qga_libs += ['-lsetupapi', '-lcfgmgr32']
+ endif
+endif
+
qga = executable('qemu-ga', qga_ss.sources(),
- link_args: config_host['LIBS_QGA'].split(),
+ link_args: qga_libs,
dependencies: [qemuutil, libudev],
install: true)
-all_qga = [qga]
+all_qga += qga
if targetos == 'windows'
- if 'CONFIG_QGA_VSS' in config_host
- subdir('vss-win32')
- else
- gen_tlb = []
- endif
-
qemu_ga_msi_arch = {
'x86': ['-D', 'Arch=32'],
'x86_64': ['-a', 'x64', '-D', 'Arch=64']
@@ -77,7 +114,7 @@ if targetos == 'windows'
if wixl.found()
deps = [gen_tlb, qga]
qemu_ga_msi_vss = []
- if 'CONFIG_QGA_VSS' in config_host
+ if have_qga_vss
qemu_ga_msi_vss = ['-D', 'InstallVss']
deps += qga_vss
endif
diff --git a/qga/vss-win32/install.cpp b/qga/vss-win32/install.cpp
index 40de133774..efc5bb9909 100644
--- a/qga/vss-win32/install.cpp
+++ b/qga/vss-win32/install.cpp
@@ -13,7 +13,7 @@
#include "qemu/osdep.h"
#include "vss-common.h"
-#include <inc/win2003/vscoordint.h>
+#include <vscoordint.h>
#include "install.h"
#include <wbemidl.h>
#include <comdef.h>
diff --git a/qga/vss-win32/meson.build b/qga/vss-win32/meson.build
index 90825edef3..71c50d0866 100644
--- a/qga/vss-win32/meson.build
+++ b/qga/vss-win32/meson.build
@@ -1,36 +1,38 @@
-if add_languages('cpp', required: false)
- glib_dynamic = dependency('glib-2.0', static: false)
- link_args = cc.get_supported_link_arguments(['-fstack-protector-all', '-fstack-protector-strong',
- '-Wl,--add-stdcall-alias', '-Wl,--enable-stdcall-fixup'])
+link_args = cc.get_supported_link_arguments([
+ '-fstack-protector-all',
+ '-fstack-protector-strong',
+ '-Wl,--add-stdcall-alias',
+ '-Wl,--enable-stdcall-fixup'
+])
- qga_vss = shared_module('qga-vss', ['requester.cpp', 'provider.cpp', 'install.cpp'],
- name_prefix: '',
- cpp_args: ['-Wno-unknown-pragmas', '-Wno-delete-non-virtual-dtor', '-Wno-non-virtual-dtor'],
- link_args: link_args,
- vs_module_defs: 'qga-vss.def',
- dependencies: [glib_dynamic, socket,
- cc.find_library('ole32'),
- cc.find_library('oleaut32'),
- cc.find_library('shlwapi'),
- cc.find_library('uuid'),
- cc.find_library('intl')])
+qga_vss = shared_module(
+ 'qga-vss',
+ ['requester.cpp', 'provider.cpp', 'install.cpp'],
+ name_prefix: '',
+ cpp_args: ['-Wno-unknown-pragmas', '-Wno-delete-non-virtual-dtor', '-Wno-non-virtual-dtor'],
+ link_args: link_args,
+ vs_module_defs: 'qga-vss.def',
+ dependencies: [
+ glib,
+ socket,
+ cc.find_library('ole32'),
+ cc.find_library('oleaut32'),
+ cc.find_library('shlwapi'),
+ cc.find_library('uuid'),
+ cc.find_library('intl')
+ ]
+)
- all_qga += qga_vss
-endif
+all_qga += qga_vss
-# rules to build qga-vss.tlb
-# Currently, only native build is supported because building .tlb
-# (TypeLibrary) from .idl requires WindowsSDK and MIDL (and cl.exe in VC++).
-midl = find_program('midl', required: false)
if midl.found()
gen_tlb = custom_target('gen-tlb',
input: 'qga-vss.idl',
output: 'qga-vss.tlb',
- command: [midl, '-tlb', '-I' + config_host['WIN_SDK'],
- '@INPUT@', '@OUTPUT@'])
+ command: [midl, '@INPUT@', '/tlb', '@OUTPUT@'])
else
gen_tlb = custom_target('gen-tlb',
- input: 'qga-vss.tlb',
+ input: 'qga-vss.idl',
output: 'qga-vss.tlb',
- command: ['cp', '@INPUT@', '@OUTPUT@'])
+ command: [widl, '-t', '@INPUT@', '-o', '@OUTPUT@'])
endif
diff --git a/qga/vss-win32/provider.cpp b/qga/vss-win32/provider.cpp
index 72d8b0e19d..fd187fb66f 100644
--- a/qga/vss-win32/provider.cpp
+++ b/qga/vss-win32/provider.cpp
@@ -12,8 +12,8 @@
#include "qemu/osdep.h"
#include "vss-common.h"
-#include <inc/win2003/vscoordint.h>
-#include <inc/win2003/vsprov.h>
+#include <vscoordint.h>
+#include <vsprov.h>
#define VSS_TIMEOUT_MSEC (60*1000)
diff --git a/qga/vss-win32/qga-vss.tlb b/qga/vss-win32/qga-vss.tlb
deleted file mode 100644
index 226452a186..0000000000
--- a/qga/vss-win32/qga-vss.tlb
+++ /dev/null
Binary files differ
diff --git a/qga/vss-win32/requester.cpp b/qga/vss-win32/requester.cpp
index 940a2c8f55..4513324dd2 100644
--- a/qga/vss-win32/requester.cpp
+++ b/qga/vss-win32/requester.cpp
@@ -14,8 +14,8 @@
#include "vss-common.h"
#include "requester.h"
#include "install.h"
-#include <inc/win2003/vswriter.h>
-#include <inc/win2003/vsbackup.h>
+#include <vswriter.h>
+#include <vsbackup.h>
/* Max wait time for frozen event (VSS can only hold writes for 10 seconds) */
#define VSS_TIMEOUT_FREEZE_MSEC 60000
diff --git a/qga/vss-win32/vss-common.h b/qga/vss-win32/vss-common.h
index 61c170b52e..54f8de8c88 100644
--- a/qga/vss-win32/vss-common.h
+++ b/qga/vss-win32/vss-common.h
@@ -46,11 +46,7 @@
#undef VSS_E_MAXIMUM_NUMBER_OF_VOLUMES_REACHED
#undef VSS_E_MAXIMUM_NUMBER_OF_SNAPSHOTS_REACHED
-/*
- * VSS headers must be installed from Microsoft VSS SDK 7.2 available at:
- * http://www.microsoft.com/en-us/download/details.aspx?id=23490
- */
-#include <inc/win2003/vss.h>
+#include <vss.h>
#include "vss-handles.h"
/* Macros to convert char definitions to wchar */
diff --git a/qom/object.c b/qom/object.c
index 4f0677cca9..9f7a33139d 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -2793,13 +2793,13 @@ static void object_class_init(ObjectClass *klass, void *data)
static void register_types(void)
{
- static TypeInfo interface_info = {
+ static const TypeInfo interface_info = {
.name = TYPE_INTERFACE,
.class_size = sizeof(InterfaceClass),
.abstract = true,
};
- static TypeInfo object_info = {
+ static const TypeInfo object_info = {
.name = TYPE_OBJECT,
.instance_size = sizeof(Object),
.class_init = object_class_init,
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 5e50111060..ddd8148d87 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2882,6 +2882,7 @@ sub process {
SCSIBusInfo|
SCSIReqOps|
Spice[A-Z][a-zA-Z0-9]*Interface|
+ TypeInfo|
USBDesc[A-Z][a-zA-Z0-9]*|
VhostOps|
VMStateDescription|
diff --git a/scripts/meson-buildoptions.py b/scripts/meson-buildoptions.py
index 98ae944148..693be7b966 100755
--- a/scripts/meson-buildoptions.py
+++ b/scripts/meson-buildoptions.py
@@ -30,8 +30,10 @@ SKIP_OPTIONS = {
"default_devices",
"docdir",
"fuzzing_engine",
+ "iasl",
"qemu_firmwarepath",
"qemu_suffix",
+ "smbd",
"sphinx_build",
"trace_file",
}
diff --git a/scripts/meson-buildoptions.sh b/scripts/meson-buildoptions.sh
index 48a454cece..9ee684ef03 100644
--- a/scripts/meson-buildoptions.sh
+++ b/scripts/meson-buildoptions.sh
@@ -1,16 +1,29 @@
# This file is generated by meson-buildoptions.py, do not edit!
meson_options_help() {
+ printf "%s\n" ' --enable-block-drv-whitelist-in-tools'
+ printf "%s\n" ' use block whitelist also in tools instead of only'
+ printf "%s\n" ' QEMU'
printf "%s\n" ' --enable-capstone[=CHOICE]'
printf "%s\n" ' Whether and how to find the capstone library'
printf "%s\n" ' (choices: auto/disabled/enabled/internal/system)'
printf "%s\n" ' --enable-cfi Control-Flow Integrity (CFI)'
printf "%s\n" ' --enable-cfi-debug Verbose errors in case of CFI violation'
+ printf "%s\n" ' --disable-coroutine-pool coroutine freelist (better performance)'
+ printf "%s\n" ' --enable-debug-mutex mutex debugging support'
+ printf "%s\n" ' --enable-debug-stack-usage'
+ printf "%s\n" ' measure coroutine stack usage'
printf "%s\n" ' --enable-fdt[=CHOICE] Whether and how to find the libfdt library'
printf "%s\n" ' (choices: auto/disabled/enabled/internal/system)'
printf "%s\n" ' --enable-fuzzing build fuzzing targets'
+ printf "%s\n" ' --enable-gprof QEMU profiling with gprof'
printf "%s\n" ' --disable-install-blobs install provided firmware blobs'
printf "%s\n" ' --enable-malloc=CHOICE choose memory allocator to use [system] (choices:'
printf "%s\n" ' jemalloc/system/tcmalloc)'
+ printf "%s\n" ' --enable-profiler profiler support'
+ printf "%s\n" ' --enable-qga-vss build QGA VSS support'
+ printf "%s\n" ' --enable-qom-cast-debug cast debugging support'
+ printf "%s\n" ' --enable-rng-none dummy RNG, avoid using /dev/(u)random and'
+ printf "%s\n" ' getrandom()'
printf "%s\n" ' --enable-slirp[=CHOICE] Whether and how to find the slirp library'
printf "%s\n" ' (choices: auto/disabled/enabled/internal/system)'
printf "%s\n" ' --enable-strip Strip targets on install'
@@ -26,15 +39,21 @@ meson_options_help() {
printf "%s\n" ' alsa ALSA sound support'
printf "%s\n" ' attr attr/xattr support'
printf "%s\n" ' auth-pam PAM access control'
+ printf "%s\n" ' avx2 AVX2 optimizations'
+ printf "%s\n" ' avx512f AVX512F optimizations'
+ printf "%s\n" ' bochs bochs image format support'
printf "%s\n" ' bpf eBPF support'
printf "%s\n" ' brlapi brlapi character device driver'
printf "%s\n" ' bzip2 bzip2 support for DMG images'
printf "%s\n" ' cap-ng cap_ng support'
+ printf "%s\n" ' cloop cloop image format support'
printf "%s\n" ' cocoa Cocoa user interface (macOS only)'
printf "%s\n" ' coreaudio CoreAudio sound support'
+ printf "%s\n" ' crypto-afalg Linux AF_ALG crypto backend driver'
printf "%s\n" ' curl CURL block device driver'
printf "%s\n" ' curses curses UI'
printf "%s\n" ' dbus-display -display dbus support'
+ printf "%s\n" ' dmg dmg image format support'
printf "%s\n" ' docs Documentations build support'
printf "%s\n" ' dsound DirectSound sound support'
printf "%s\n" ' fuse FUSE block device export'
@@ -44,6 +63,7 @@ meson_options_help() {
printf "%s\n" ' glusterfs Glusterfs block device driver'
printf "%s\n" ' gnutls GNUTLS cryptography support'
printf "%s\n" ' gtk GTK+ user interface'
+ printf "%s\n" ' guest-agent Build QEMU Guest Agent'
printf "%s\n" ' guest-agent-msi Build MSI package for the QEMU Guest Agent'
printf "%s\n" ' hax HAX acceleration support'
printf "%s\n" ' hvf HVF acceleration support'
@@ -60,30 +80,42 @@ meson_options_help() {
printf "%s\n" ' libusb libusb support for USB passthrough'
printf "%s\n" ' linux-aio Linux AIO support'
printf "%s\n" ' linux-io-uring Linux io_uring support'
+ printf "%s\n" ' live-block-migration'
+ printf "%s\n" ' block migration in the main migration stream'
printf "%s\n" ' lzfse lzfse support for DMG images'
printf "%s\n" ' lzo lzo compression support'
printf "%s\n" ' malloc-trim enable libc malloc_trim() for memory optimization'
+ printf "%s\n" ' membarrier membarrier system call (for Linux 4.14+ or Windows'
printf "%s\n" ' mpath Multipath persistent reservation passthrough'
printf "%s\n" ' multiprocess Out of process device emulation support'
printf "%s\n" ' netmap netmap network backend support'
printf "%s\n" ' nettle nettle cryptography support'
+ printf "%s\n" ' numa libnuma support'
printf "%s\n" ' nvmm NVMM acceleration support'
printf "%s\n" ' oss OSS sound support'
printf "%s\n" ' pa PulseAudio sound support'
+ printf "%s\n" ' parallels parallels image format support'
+ printf "%s\n" ' qcow1 qcow1 image format support'
+ printf "%s\n" ' qed qed image format support'
printf "%s\n" ' rbd Ceph block device driver'
+ printf "%s\n" ' replication replication support'
printf "%s\n" ' sdl SDL user interface'
printf "%s\n" ' sdl-image SDL Image support for icons'
printf "%s\n" ' seccomp seccomp support'
printf "%s\n" ' selinux SELinux support in qemu-nbd'
+ printf "%s\n" ' slirp-smbd use smbd (at path --smbd=*) in slirp networking'
printf "%s\n" ' smartcard CA smartcard emulation support'
printf "%s\n" ' snappy snappy compression support'
printf "%s\n" ' sparse sparse checker'
printf "%s\n" ' spice Spice server support'
printf "%s\n" ' spice-protocol Spice protocol support'
printf "%s\n" ' tcg TCG support'
+ printf "%s\n" ' tools build support utilities that come with QEMU'
+ printf "%s\n" ' tpm TPM support'
printf "%s\n" ' u2f U2F emulation support'
printf "%s\n" ' usb-redir libusbredir support'
printf "%s\n" ' vde vde network backend support'
+ printf "%s\n" ' vdi vdi image format support'
printf "%s\n" ' vhost-user-blk-server'
printf "%s\n" ' build vhost-user-blk server'
printf "%s\n" ' virglrenderer virgl rendering support'
@@ -94,6 +126,7 @@ meson_options_help() {
printf "%s\n" ' vnc-png PNG compression for VNC server'
printf "%s\n" ' vnc-sasl SASL authentication for VNC server'
printf "%s\n" ' vte vte support for the gtk UI'
+ printf "%s\n" ' vvfat vvfat image format support'
printf "%s\n" ' whpx WHPX acceleration support'
printf "%s\n" ' xen Xen backend support'
printf "%s\n" ' xen-pci-passthrough'
@@ -109,6 +142,14 @@ _meson_option_parse() {
--disable-attr) printf "%s" -Dattr=disabled ;;
--enable-auth-pam) printf "%s" -Dauth_pam=enabled ;;
--disable-auth-pam) printf "%s" -Dauth_pam=disabled ;;
+ --enable-avx2) printf "%s" -Davx2=enabled ;;
+ --disable-avx2) printf "%s" -Davx2=disabled ;;
+ --enable-avx512f) printf "%s" -Davx512f=enabled ;;
+ --disable-avx512f) printf "%s" -Davx512f=disabled ;;
+ --enable-block-drv-whitelist-in-tools) printf "%s" -Dblock_drv_whitelist_in_tools=true ;;
+ --disable-block-drv-whitelist-in-tools) printf "%s" -Dblock_drv_whitelist_in_tools=false ;;
+ --enable-bochs) printf "%s" -Dbochs=enabled ;;
+ --disable-bochs) printf "%s" -Dbochs=disabled ;;
--enable-bpf) printf "%s" -Dbpf=enabled ;;
--disable-bpf) printf "%s" -Dbpf=disabled ;;
--enable-brlapi) printf "%s" -Dbrlapi=enabled ;;
@@ -124,16 +165,28 @@ _meson_option_parse() {
--disable-cfi) printf "%s" -Dcfi=false ;;
--enable-cfi-debug) printf "%s" -Dcfi_debug=true ;;
--disable-cfi-debug) printf "%s" -Dcfi_debug=false ;;
+ --enable-cloop) printf "%s" -Dcloop=enabled ;;
+ --disable-cloop) printf "%s" -Dcloop=disabled ;;
--enable-cocoa) printf "%s" -Dcocoa=enabled ;;
--disable-cocoa) printf "%s" -Dcocoa=disabled ;;
--enable-coreaudio) printf "%s" -Dcoreaudio=enabled ;;
--disable-coreaudio) printf "%s" -Dcoreaudio=disabled ;;
+ --enable-coroutine-pool) printf "%s" -Dcoroutine_pool=true ;;
+ --disable-coroutine-pool) printf "%s" -Dcoroutine_pool=false ;;
+ --enable-crypto-afalg) printf "%s" -Dcrypto_afalg=enabled ;;
+ --disable-crypto-afalg) printf "%s" -Dcrypto_afalg=disabled ;;
--enable-curl) printf "%s" -Dcurl=enabled ;;
--disable-curl) printf "%s" -Dcurl=disabled ;;
--enable-curses) printf "%s" -Dcurses=enabled ;;
--disable-curses) printf "%s" -Dcurses=disabled ;;
--enable-dbus-display) printf "%s" -Ddbus_display=enabled ;;
--disable-dbus-display) printf "%s" -Ddbus_display=disabled ;;
+ --enable-debug-mutex) printf "%s" -Ddebug_mutex=true ;;
+ --disable-debug-mutex) printf "%s" -Ddebug_mutex=false ;;
+ --enable-debug-stack-usage) printf "%s" -Ddebug_stack_usage=true ;;
+ --disable-debug-stack-usage) printf "%s" -Ddebug_stack_usage=false ;;
+ --enable-dmg) printf "%s" -Ddmg=enabled ;;
+ --disable-dmg) printf "%s" -Ddmg=disabled ;;
--enable-docs) printf "%s" -Ddocs=enabled ;;
--disable-docs) printf "%s" -Ddocs=disabled ;;
--enable-dsound) printf "%s" -Ddsound=enabled ;;
@@ -155,8 +208,12 @@ _meson_option_parse() {
--disable-glusterfs) printf "%s" -Dglusterfs=disabled ;;
--enable-gnutls) printf "%s" -Dgnutls=enabled ;;
--disable-gnutls) printf "%s" -Dgnutls=disabled ;;
+ --enable-gprof) printf "%s" -Dgprof=true ;;
+ --disable-gprof) printf "%s" -Dgprof=false ;;
--enable-gtk) printf "%s" -Dgtk=enabled ;;
--disable-gtk) printf "%s" -Dgtk=disabled ;;
+ --enable-guest-agent) printf "%s" -Dguest_agent=enabled ;;
+ --disable-guest-agent) printf "%s" -Dguest_agent=disabled ;;
--enable-guest-agent-msi) printf "%s" -Dguest_agent_msi=enabled ;;
--disable-guest-agent-msi) printf "%s" -Dguest_agent_msi=disabled ;;
--enable-hax) printf "%s" -Dhax=enabled ;;
@@ -191,6 +248,8 @@ _meson_option_parse() {
--disable-linux-aio) printf "%s" -Dlinux_aio=disabled ;;
--enable-linux-io-uring) printf "%s" -Dlinux_io_uring=enabled ;;
--disable-linux-io-uring) printf "%s" -Dlinux_io_uring=disabled ;;
+ --enable-live-block-migration) printf "%s" -Dlive_block_migration=enabled ;;
+ --disable-live-block-migration) printf "%s" -Dlive_block_migration=disabled ;;
--enable-lzfse) printf "%s" -Dlzfse=enabled ;;
--disable-lzfse) printf "%s" -Dlzfse=disabled ;;
--enable-lzo) printf "%s" -Dlzo=enabled ;;
@@ -198,6 +257,8 @@ _meson_option_parse() {
--enable-malloc=*) quote_sh "-Dmalloc=$2" ;;
--enable-malloc-trim) printf "%s" -Dmalloc_trim=enabled ;;
--disable-malloc-trim) printf "%s" -Dmalloc_trim=disabled ;;
+ --enable-membarrier) printf "%s" -Dmembarrier=enabled ;;
+ --disable-membarrier) printf "%s" -Dmembarrier=disabled ;;
--enable-mpath) printf "%s" -Dmpath=enabled ;;
--disable-mpath) printf "%s" -Dmpath=disabled ;;
--enable-multiprocess) printf "%s" -Dmultiprocess=enabled ;;
@@ -206,14 +267,32 @@ _meson_option_parse() {
--disable-netmap) printf "%s" -Dnetmap=disabled ;;
--enable-nettle) printf "%s" -Dnettle=enabled ;;
--disable-nettle) printf "%s" -Dnettle=disabled ;;
+ --enable-numa) printf "%s" -Dnuma=enabled ;;
+ --disable-numa) printf "%s" -Dnuma=disabled ;;
--enable-nvmm) printf "%s" -Dnvmm=enabled ;;
--disable-nvmm) printf "%s" -Dnvmm=disabled ;;
--enable-oss) printf "%s" -Doss=enabled ;;
--disable-oss) printf "%s" -Doss=disabled ;;
--enable-pa) printf "%s" -Dpa=enabled ;;
--disable-pa) printf "%s" -Dpa=disabled ;;
+ --enable-parallels) printf "%s" -Dparallels=enabled ;;
+ --disable-parallels) printf "%s" -Dparallels=disabled ;;
+ --enable-profiler) printf "%s" -Dprofiler=true ;;
+ --disable-profiler) printf "%s" -Dprofiler=false ;;
+ --enable-qcow1) printf "%s" -Dqcow1=enabled ;;
+ --disable-qcow1) printf "%s" -Dqcow1=disabled ;;
+ --enable-qed) printf "%s" -Dqed=enabled ;;
+ --disable-qed) printf "%s" -Dqed=disabled ;;
+ --enable-qga-vss) printf "%s" -Dqga_vss=enabled ;;
+ --disable-qga-vss) printf "%s" -Dqga_vss=disabled ;;
+ --enable-qom-cast-debug) printf "%s" -Dqom_cast_debug=true ;;
+ --disable-qom-cast-debug) printf "%s" -Dqom_cast_debug=false ;;
--enable-rbd) printf "%s" -Drbd=enabled ;;
--disable-rbd) printf "%s" -Drbd=disabled ;;
+ --enable-replication) printf "%s" -Dreplication=enabled ;;
+ --disable-replication) printf "%s" -Dreplication=disabled ;;
+ --enable-rng-none) printf "%s" -Drng_none=true ;;
+ --disable-rng-none) printf "%s" -Drng_none=false ;;
--enable-sdl) printf "%s" -Dsdl=enabled ;;
--disable-sdl) printf "%s" -Dsdl=disabled ;;
--enable-sdl-image) printf "%s" -Dsdl_image=enabled ;;
@@ -225,6 +304,8 @@ _meson_option_parse() {
--enable-slirp) printf "%s" -Dslirp=enabled ;;
--disable-slirp) printf "%s" -Dslirp=disabled ;;
--enable-slirp=*) quote_sh "-Dslirp=$2" ;;
+ --enable-slirp-smbd) printf "%s" -Dslirp_smbd=enabled ;;
+ --disable-slirp-smbd) printf "%s" -Dslirp_smbd=disabled ;;
--enable-smartcard) printf "%s" -Dsmartcard=enabled ;;
--disable-smartcard) printf "%s" -Dsmartcard=disabled ;;
--enable-snappy) printf "%s" -Dsnappy=enabled ;;
@@ -241,6 +322,10 @@ _meson_option_parse() {
--disable-tcg) printf "%s" -Dtcg=disabled ;;
--enable-tcg-interpreter) printf "%s" -Dtcg_interpreter=true ;;
--disable-tcg-interpreter) printf "%s" -Dtcg_interpreter=false ;;
+ --enable-tools) printf "%s" -Dtools=enabled ;;
+ --disable-tools) printf "%s" -Dtools=disabled ;;
+ --enable-tpm) printf "%s" -Dtpm=enabled ;;
+ --disable-tpm) printf "%s" -Dtpm=disabled ;;
--enable-trace-backends=*) quote_sh "-Dtrace_backends=$2" ;;
--enable-u2f) printf "%s" -Du2f=enabled ;;
--disable-u2f) printf "%s" -Du2f=disabled ;;
@@ -248,6 +333,8 @@ _meson_option_parse() {
--disable-usb-redir) printf "%s" -Dusb_redir=disabled ;;
--enable-vde) printf "%s" -Dvde=enabled ;;
--disable-vde) printf "%s" -Dvde=disabled ;;
+ --enable-vdi) printf "%s" -Dvdi=enabled ;;
+ --disable-vdi) printf "%s" -Dvdi=disabled ;;
--enable-vhost-user-blk-server) printf "%s" -Dvhost_user_blk_server=enabled ;;
--disable-vhost-user-blk-server) printf "%s" -Dvhost_user_blk_server=disabled ;;
--enable-virglrenderer) printf "%s" -Dvirglrenderer=enabled ;;
@@ -266,6 +353,8 @@ _meson_option_parse() {
--disable-vnc-sasl) printf "%s" -Dvnc_sasl=disabled ;;
--enable-vte) printf "%s" -Dvte=enabled ;;
--disable-vte) printf "%s" -Dvte=disabled ;;
+ --enable-vvfat) printf "%s" -Dvvfat=enabled ;;
+ --disable-vvfat) printf "%s" -Dvvfat=disabled ;;
--enable-whpx) printf "%s" -Dwhpx=enabled ;;
--disable-whpx) printf "%s" -Dwhpx=disabled ;;
--enable-xen) printf "%s" -Dxen=enabled ;;
diff --git a/softmmu/memory.c b/softmmu/memory.c
index 678dc62f06..8060c6de78 100644
--- a/softmmu/memory.c
+++ b/softmmu/memory.c
@@ -2790,19 +2790,32 @@ void memory_global_after_dirty_log_sync(void)
MEMORY_LISTENER_CALL_GLOBAL(log_global_after_sync, Forward);
}
+/*
+ * Dirty track stop flags that are postponed due to VM being stopped. Should
+ * only be used within vmstate_change hook.
+ */
+static unsigned int postponed_stop_flags;
static VMChangeStateEntry *vmstate_change;
+static void memory_global_dirty_log_stop_postponed_run(void);
void memory_global_dirty_log_start(unsigned int flags)
{
- unsigned int old_flags = global_dirty_tracking;
+ unsigned int old_flags;
+
+ assert(flags && !(flags & (~GLOBAL_DIRTY_MASK)));
if (vmstate_change) {
- qemu_del_vm_change_state_handler(vmstate_change);
- vmstate_change = NULL;
+ /* If there is postponed stop(), operate on it first */
+ postponed_stop_flags &= ~flags;
+ memory_global_dirty_log_stop_postponed_run();
}
- assert(flags && !(flags & (~GLOBAL_DIRTY_MASK)));
- assert(!(global_dirty_tracking & flags));
+ flags &= ~global_dirty_tracking;
+ if (!flags) {
+ return;
+ }
+
+ old_flags = global_dirty_tracking;
global_dirty_tracking |= flags;
trace_global_dirty_changed(global_dirty_tracking);
@@ -2830,29 +2843,45 @@ static void memory_global_dirty_log_do_stop(unsigned int flags)
}
}
+/*
+ * Execute the postponed dirty log stop operations if there is, then reset
+ * everything (including the flags and the vmstate change hook).
+ */
+static void memory_global_dirty_log_stop_postponed_run(void)
+{
+ /* This must be called with the vmstate handler registered */
+ assert(vmstate_change);
+
+ /* Note: postponed_stop_flags can be cleared in log start routine */
+ if (postponed_stop_flags) {
+ memory_global_dirty_log_do_stop(postponed_stop_flags);
+ postponed_stop_flags = 0;
+ }
+
+ qemu_del_vm_change_state_handler(vmstate_change);
+ vmstate_change = NULL;
+}
+
static void memory_vm_change_state_handler(void *opaque, bool running,
RunState state)
{
- unsigned int flags = (unsigned int)(uintptr_t)opaque;
if (running) {
- memory_global_dirty_log_do_stop(flags);
-
- if (vmstate_change) {
- qemu_del_vm_change_state_handler(vmstate_change);
- vmstate_change = NULL;
- }
+ memory_global_dirty_log_stop_postponed_run();
}
}
void memory_global_dirty_log_stop(unsigned int flags)
{
if (!runstate_is_running()) {
+ /* Postpone the dirty log stop, e.g., to when VM starts again */
if (vmstate_change) {
- return;
+ /* Batch with previous postponed flags */
+ postponed_stop_flags |= flags;
+ } else {
+ postponed_stop_flags = flags;
+ vmstate_change = qemu_add_vm_change_state_handler(
+ memory_vm_change_state_handler, NULL);
}
- vmstate_change = qemu_add_vm_change_state_handler(
- memory_vm_change_state_handler,
- (void *)(uintptr_t)flags);
return;
}
diff --git a/softmmu/meson.build b/softmmu/meson.build
index d8e03018ab..39f766ce7c 100644
--- a/softmmu/meson.build
+++ b/softmmu/meson.build
@@ -27,6 +27,9 @@ softmmu_ss.add(files(
'qdev-monitor.c',
), sdl, libpmem, libdaxctl)
-softmmu_ss.add(when: 'CONFIG_TPM', if_true: files('tpm.c'))
+if have_tpm
+ softmmu_ss.add(files('tpm.c'))
+endif
+
softmmu_ss.add(when: seccomp, if_true: files('qemu-seccomp.c'))
softmmu_ss.add(when: fdt, if_true: files('device_tree.c'))
diff --git a/softmmu/physmem.c b/softmmu/physmem.c
index dddf70edf5..a13289a594 100644
--- a/softmmu/physmem.c
+++ b/softmmu/physmem.c
@@ -23,6 +23,7 @@
#include "qemu/cutils.h"
#include "qemu/cacheflush.h"
+#include "qemu/madvise.h"
#ifdef CONFIG_TCG
#include "hw/core/tcg-cpu-ops.h"
diff --git a/softmmu/vl.c b/softmmu/vl.c
index 5e1b35ba48..1fe028800f 100644
--- a/softmmu/vl.c
+++ b/softmmu/vl.c
@@ -36,6 +36,7 @@
#include "qemu-version.h"
#include "qemu/cutils.h"
#include "qemu/help_option.h"
+#include "qemu/hw-version.h"
#include "qemu/uuid.h"
#include "sysemu/reset.h"
#include "sysemu/runstate.h"
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
index 525974b936..c085dc10ee 100644
--- a/target/arm/cpu.c
+++ b/target/arm/cpu.c
@@ -40,7 +40,6 @@
#include "sysemu/tcg.h"
#include "sysemu/hw_accel.h"
#include "kvm_arm.h"
-#include "hvf_arm.h"
#include "disas/capstone.h"
#include "fpu/softfloat.h"
@@ -2080,31 +2079,6 @@ static void arm_cpu_class_init(ObjectClass *oc, void *data)
#endif /* CONFIG_TCG */
}
-#if defined(CONFIG_KVM) || defined(CONFIG_HVF)
-static void arm_host_initfn(Object *obj)
-{
- ARMCPU *cpu = ARM_CPU(obj);
-
-#ifdef CONFIG_KVM
- kvm_arm_set_cpu_features_from_host(cpu);
- if (arm_feature(&cpu->env, ARM_FEATURE_AARCH64)) {
- aarch64_add_sve_properties(obj);
- aarch64_add_pauth_properties(obj);
- }
-#else
- hvf_arm_set_cpu_features_from_host(cpu);
-#endif
- arm_cpu_post_init(obj);
-}
-
-static const TypeInfo host_arm_cpu_type_info = {
- .name = TYPE_ARM_HOST_CPU,
- .parent = TYPE_AARCH64_CPU,
- .instance_init = arm_host_initfn,
-};
-
-#endif
-
static void arm_cpu_instance_init(Object *obj)
{
ARMCPUClass *acc = ARM_CPU_GET_CLASS(obj);
@@ -2152,10 +2126,6 @@ static const TypeInfo arm_cpu_type_info = {
static void arm_cpu_register_types(void)
{
type_register_static(&arm_cpu_type_info);
-
-#if defined(CONFIG_KVM) || defined(CONFIG_HVF)
- type_register_static(&host_arm_cpu_type_info);
-#endif
}
type_init(arm_cpu_register_types)
diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c
index 8786be7783..1171ab16b9 100644
--- a/target/arm/cpu64.c
+++ b/target/arm/cpu64.c
@@ -29,7 +29,9 @@
#include "hw/loader.h"
#endif
#include "sysemu/kvm.h"
+#include "sysemu/hvf.h"
#include "kvm_arm.h"
+#include "hvf_arm.h"
#include "qapi/visitor.h"
#include "hw/qdev-properties.h"
@@ -631,9 +633,10 @@ void arm_cpu_pauth_finalize(ARMCPU *cpu, Error **errp)
uint64_t t;
/* Exit early if PAuth is enabled, and fall through to disable it */
- if (kvm_enabled() && cpu->prop_pauth) {
+ if ((kvm_enabled() || hvf_enabled()) && cpu->prop_pauth) {
if (!cpu_isar_feature(aa64_pauth, cpu)) {
- error_setg(errp, "'pauth' feature not supported by KVM on this host");
+ error_setg(errp, "'pauth' feature not supported by %s on this host",
+ kvm_enabled() ? "KVM" : "hvf");
}
return;
@@ -670,10 +673,14 @@ void aarch64_add_pauth_properties(Object *obj)
/* Default to PAUTH on, with the architected algorithm on TCG. */
qdev_property_add_static(DEVICE(obj), &arm_cpu_pauth_property);
- if (kvm_enabled()) {
+ if (kvm_enabled() || hvf_enabled()) {
/*
* Mirror PAuth support from the probed sysregs back into the
- * property for KVM. Is it just a bit backward? Yes it is!
+ * property for KVM or hvf. Is it just a bit backward? Yes it is!
+ * Note that prop_pauth is true whether the host CPU supports the
+ * architected QARMA5 algorithm or the IMPDEF one. We don't
+ * provide the separate pauth-impdef property for KVM or hvf,
+ * only for TCG.
*/
cpu->prop_pauth = cpu_isar_feature(aa64_pauth, cpu);
} else {
@@ -681,6 +688,24 @@ void aarch64_add_pauth_properties(Object *obj)
}
}
+static void aarch64_host_initfn(Object *obj)
+{
+#if defined(CONFIG_KVM)
+ ARMCPU *cpu = ARM_CPU(obj);
+ kvm_arm_set_cpu_features_from_host(cpu);
+ if (arm_feature(&cpu->env, ARM_FEATURE_AARCH64)) {
+ aarch64_add_sve_properties(obj);
+ aarch64_add_pauth_properties(obj);
+ }
+#elif defined(CONFIG_HVF)
+ ARMCPU *cpu = ARM_CPU(obj);
+ hvf_arm_set_cpu_features_from_host(cpu);
+ aarch64_add_pauth_properties(obj);
+#else
+ g_assert_not_reached();
+#endif
+}
+
/* -cpu max: if KVM is enabled, like -cpu host (best possible with this host);
* otherwise, a CPU with as many features enabled as our emulation supports.
* The version of '-cpu max' for qemu-system-arm is defined in cpu.c;
@@ -689,174 +714,179 @@ void aarch64_add_pauth_properties(Object *obj)
static void aarch64_max_initfn(Object *obj)
{
ARMCPU *cpu = ARM_CPU(obj);
+ uint64_t t;
+ uint32_t u;
- if (kvm_enabled()) {
- kvm_arm_set_cpu_features_from_host(cpu);
- } else {
- uint64_t t;
- uint32_t u;
- aarch64_a57_initfn(obj);
+ if (kvm_enabled() || hvf_enabled()) {
+ /* With KVM or HVF, '-cpu max' is identical to '-cpu host' */
+ aarch64_host_initfn(obj);
+ return;
+ }
- /*
- * Reset MIDR so the guest doesn't mistake our 'max' CPU type for a real
- * one and try to apply errata workarounds or use impdef features we
- * don't provide.
- * An IMPLEMENTER field of 0 means "reserved for software use";
- * ARCHITECTURE must be 0xf indicating "v7 or later, check ID registers
- * to see which features are present";
- * the VARIANT, PARTNUM and REVISION fields are all implementation
- * defined and we choose to define PARTNUM just in case guest
- * code needs to distinguish this QEMU CPU from other software
- * implementations, though this shouldn't be needed.
- */
- t = FIELD_DP64(0, MIDR_EL1, IMPLEMENTER, 0);
- t = FIELD_DP64(t, MIDR_EL1, ARCHITECTURE, 0xf);
- t = FIELD_DP64(t, MIDR_EL1, PARTNUM, 'Q');
- t = FIELD_DP64(t, MIDR_EL1, VARIANT, 0);
- t = FIELD_DP64(t, MIDR_EL1, REVISION, 0);
- cpu->midr = t;
-
- t = cpu->isar.id_aa64isar0;
- t = FIELD_DP64(t, ID_AA64ISAR0, AES, 2); /* AES + PMULL */
- t = FIELD_DP64(t, ID_AA64ISAR0, SHA1, 1);
- t = FIELD_DP64(t, ID_AA64ISAR0, SHA2, 2); /* SHA512 */
- t = FIELD_DP64(t, ID_AA64ISAR0, CRC32, 1);
- t = FIELD_DP64(t, ID_AA64ISAR0, ATOMIC, 2);
- t = FIELD_DP64(t, ID_AA64ISAR0, RDM, 1);
- t = FIELD_DP64(t, ID_AA64ISAR0, SHA3, 1);
- t = FIELD_DP64(t, ID_AA64ISAR0, SM3, 1);
- t = FIELD_DP64(t, ID_AA64ISAR0, SM4, 1);
- t = FIELD_DP64(t, ID_AA64ISAR0, DP, 1);
- t = FIELD_DP64(t, ID_AA64ISAR0, FHM, 1);
- t = FIELD_DP64(t, ID_AA64ISAR0, TS, 2); /* v8.5-CondM */
- t = FIELD_DP64(t, ID_AA64ISAR0, TLB, 2); /* FEAT_TLBIRANGE */
- t = FIELD_DP64(t, ID_AA64ISAR0, RNDR, 1);
- cpu->isar.id_aa64isar0 = t;
-
- t = cpu->isar.id_aa64isar1;
- t = FIELD_DP64(t, ID_AA64ISAR1, DPB, 2);
- t = FIELD_DP64(t, ID_AA64ISAR1, JSCVT, 1);
- t = FIELD_DP64(t, ID_AA64ISAR1, FCMA, 1);
- t = FIELD_DP64(t, ID_AA64ISAR1, SB, 1);
- t = FIELD_DP64(t, ID_AA64ISAR1, SPECRES, 1);
- t = FIELD_DP64(t, ID_AA64ISAR1, BF16, 1);
- t = FIELD_DP64(t, ID_AA64ISAR1, FRINTTS, 1);
- t = FIELD_DP64(t, ID_AA64ISAR1, LRCPC, 2); /* ARMv8.4-RCPC */
- t = FIELD_DP64(t, ID_AA64ISAR1, I8MM, 1);
- cpu->isar.id_aa64isar1 = t;
-
- t = cpu->isar.id_aa64pfr0;
- t = FIELD_DP64(t, ID_AA64PFR0, SVE, 1);
- t = FIELD_DP64(t, ID_AA64PFR0, FP, 1);
- t = FIELD_DP64(t, ID_AA64PFR0, ADVSIMD, 1);
- t = FIELD_DP64(t, ID_AA64PFR0, SEL2, 1);
- t = FIELD_DP64(t, ID_AA64PFR0, DIT, 1);
- cpu->isar.id_aa64pfr0 = t;
-
- t = cpu->isar.id_aa64pfr1;
- t = FIELD_DP64(t, ID_AA64PFR1, BT, 1);
- t = FIELD_DP64(t, ID_AA64PFR1, SSBS, 2);
- /*
- * Begin with full support for MTE. This will be downgraded to MTE=0
- * during realize if the board provides no tag memory, much like
- * we do for EL2 with the virtualization=on property.
- */
- t = FIELD_DP64(t, ID_AA64PFR1, MTE, 3);
- cpu->isar.id_aa64pfr1 = t;
-
- t = cpu->isar.id_aa64mmfr0;
- t = FIELD_DP64(t, ID_AA64MMFR0, PARANGE, 5); /* PARange: 48 bits */
- cpu->isar.id_aa64mmfr0 = t;
-
- t = cpu->isar.id_aa64mmfr1;
- t = FIELD_DP64(t, ID_AA64MMFR1, HPDS, 1); /* HPD */
- t = FIELD_DP64(t, ID_AA64MMFR1, LO, 1);
- t = FIELD_DP64(t, ID_AA64MMFR1, VH, 1);
- t = FIELD_DP64(t, ID_AA64MMFR1, PAN, 2); /* ATS1E1 */
- t = FIELD_DP64(t, ID_AA64MMFR1, VMIDBITS, 2); /* VMID16 */
- t = FIELD_DP64(t, ID_AA64MMFR1, XNX, 1); /* TTS2UXN */
- cpu->isar.id_aa64mmfr1 = t;
-
- t = cpu->isar.id_aa64mmfr2;
- t = FIELD_DP64(t, ID_AA64MMFR2, UAO, 1);
- t = FIELD_DP64(t, ID_AA64MMFR2, CNP, 1); /* TTCNP */
- t = FIELD_DP64(t, ID_AA64MMFR2, ST, 1); /* TTST */
- cpu->isar.id_aa64mmfr2 = t;
-
- t = cpu->isar.id_aa64zfr0;
- t = FIELD_DP64(t, ID_AA64ZFR0, SVEVER, 1);
- t = FIELD_DP64(t, ID_AA64ZFR0, AES, 2); /* PMULL */
- t = FIELD_DP64(t, ID_AA64ZFR0, BITPERM, 1);
- t = FIELD_DP64(t, ID_AA64ZFR0, BFLOAT16, 1);
- t = FIELD_DP64(t, ID_AA64ZFR0, SHA3, 1);
- t = FIELD_DP64(t, ID_AA64ZFR0, SM4, 1);
- t = FIELD_DP64(t, ID_AA64ZFR0, I8MM, 1);
- t = FIELD_DP64(t, ID_AA64ZFR0, F32MM, 1);
- t = FIELD_DP64(t, ID_AA64ZFR0, F64MM, 1);
- cpu->isar.id_aa64zfr0 = t;
-
- /* Replicate the same data to the 32-bit id registers. */
- u = cpu->isar.id_isar5;
- u = FIELD_DP32(u, ID_ISAR5, AES, 2); /* AES + PMULL */
- u = FIELD_DP32(u, ID_ISAR5, SHA1, 1);
- u = FIELD_DP32(u, ID_ISAR5, SHA2, 1);
- u = FIELD_DP32(u, ID_ISAR5, CRC32, 1);
- u = FIELD_DP32(u, ID_ISAR5, RDM, 1);
- u = FIELD_DP32(u, ID_ISAR5, VCMA, 1);
- cpu->isar.id_isar5 = u;
-
- u = cpu->isar.id_isar6;
- u = FIELD_DP32(u, ID_ISAR6, JSCVT, 1);
- u = FIELD_DP32(u, ID_ISAR6, DP, 1);
- u = FIELD_DP32(u, ID_ISAR6, FHM, 1);
- u = FIELD_DP32(u, ID_ISAR6, SB, 1);
- u = FIELD_DP32(u, ID_ISAR6, SPECRES, 1);
- u = FIELD_DP32(u, ID_ISAR6, BF16, 1);
- u = FIELD_DP32(u, ID_ISAR6, I8MM, 1);
- cpu->isar.id_isar6 = u;
-
- u = cpu->isar.id_pfr0;
- u = FIELD_DP32(u, ID_PFR0, DIT, 1);
- cpu->isar.id_pfr0 = u;
-
- u = cpu->isar.id_pfr2;
- u = FIELD_DP32(u, ID_PFR2, SSBS, 1);
- cpu->isar.id_pfr2 = u;
-
- u = cpu->isar.id_mmfr3;
- u = FIELD_DP32(u, ID_MMFR3, PAN, 2); /* ATS1E1 */
- cpu->isar.id_mmfr3 = u;
-
- u = cpu->isar.id_mmfr4;
- u = FIELD_DP32(u, ID_MMFR4, HPDS, 1); /* AA32HPD */
- u = FIELD_DP32(u, ID_MMFR4, AC2, 1); /* ACTLR2, HACTLR2 */
- u = FIELD_DP32(u, ID_MMFR4, CNP, 1); /* TTCNP */
- u = FIELD_DP32(u, ID_MMFR4, XNX, 1); /* TTS2UXN */
- cpu->isar.id_mmfr4 = u;
-
- t = cpu->isar.id_aa64dfr0;
- t = FIELD_DP64(t, ID_AA64DFR0, PMUVER, 5); /* v8.4-PMU */
- cpu->isar.id_aa64dfr0 = t;
-
- u = cpu->isar.id_dfr0;
- u = FIELD_DP32(u, ID_DFR0, PERFMON, 5); /* v8.4-PMU */
- cpu->isar.id_dfr0 = u;
-
- u = cpu->isar.mvfr1;
- u = FIELD_DP32(u, MVFR1, FPHP, 3); /* v8.2-FP16 */
- u = FIELD_DP32(u, MVFR1, SIMDHP, 2); /* v8.2-FP16 */
- cpu->isar.mvfr1 = u;
+ /* '-cpu max' for TCG: we currently do this as "A57 with extra things" */
+
+ aarch64_a57_initfn(obj);
+
+ /*
+ * Reset MIDR so the guest doesn't mistake our 'max' CPU type for a real
+ * one and try to apply errata workarounds or use impdef features we
+ * don't provide.
+ * An IMPLEMENTER field of 0 means "reserved for software use";
+ * ARCHITECTURE must be 0xf indicating "v7 or later, check ID registers
+ * to see which features are present";
+ * the VARIANT, PARTNUM and REVISION fields are all implementation
+ * defined and we choose to define PARTNUM just in case guest
+ * code needs to distinguish this QEMU CPU from other software
+ * implementations, though this shouldn't be needed.
+ */
+ t = FIELD_DP64(0, MIDR_EL1, IMPLEMENTER, 0);
+ t = FIELD_DP64(t, MIDR_EL1, ARCHITECTURE, 0xf);
+ t = FIELD_DP64(t, MIDR_EL1, PARTNUM, 'Q');
+ t = FIELD_DP64(t, MIDR_EL1, VARIANT, 0);
+ t = FIELD_DP64(t, MIDR_EL1, REVISION, 0);
+ cpu->midr = t;
+
+ t = cpu->isar.id_aa64isar0;
+ t = FIELD_DP64(t, ID_AA64ISAR0, AES, 2); /* AES + PMULL */
+ t = FIELD_DP64(t, ID_AA64ISAR0, SHA1, 1);
+ t = FIELD_DP64(t, ID_AA64ISAR0, SHA2, 2); /* SHA512 */
+ t = FIELD_DP64(t, ID_AA64ISAR0, CRC32, 1);
+ t = FIELD_DP64(t, ID_AA64ISAR0, ATOMIC, 2);
+ t = FIELD_DP64(t, ID_AA64ISAR0, RDM, 1);
+ t = FIELD_DP64(t, ID_AA64ISAR0, SHA3, 1);
+ t = FIELD_DP64(t, ID_AA64ISAR0, SM3, 1);
+ t = FIELD_DP64(t, ID_AA64ISAR0, SM4, 1);
+ t = FIELD_DP64(t, ID_AA64ISAR0, DP, 1);
+ t = FIELD_DP64(t, ID_AA64ISAR0, FHM, 1);
+ t = FIELD_DP64(t, ID_AA64ISAR0, TS, 2); /* v8.5-CondM */
+ t = FIELD_DP64(t, ID_AA64ISAR0, TLB, 2); /* FEAT_TLBIRANGE */
+ t = FIELD_DP64(t, ID_AA64ISAR0, RNDR, 1);
+ cpu->isar.id_aa64isar0 = t;
+
+ t = cpu->isar.id_aa64isar1;
+ t = FIELD_DP64(t, ID_AA64ISAR1, DPB, 2);
+ t = FIELD_DP64(t, ID_AA64ISAR1, JSCVT, 1);
+ t = FIELD_DP64(t, ID_AA64ISAR1, FCMA, 1);
+ t = FIELD_DP64(t, ID_AA64ISAR1, SB, 1);
+ t = FIELD_DP64(t, ID_AA64ISAR1, SPECRES, 1);
+ t = FIELD_DP64(t, ID_AA64ISAR1, BF16, 1);
+ t = FIELD_DP64(t, ID_AA64ISAR1, FRINTTS, 1);
+ t = FIELD_DP64(t, ID_AA64ISAR1, LRCPC, 2); /* ARMv8.4-RCPC */
+ t = FIELD_DP64(t, ID_AA64ISAR1, I8MM, 1);
+ cpu->isar.id_aa64isar1 = t;
+
+ t = cpu->isar.id_aa64pfr0;
+ t = FIELD_DP64(t, ID_AA64PFR0, SVE, 1);
+ t = FIELD_DP64(t, ID_AA64PFR0, FP, 1);
+ t = FIELD_DP64(t, ID_AA64PFR0, ADVSIMD, 1);
+ t = FIELD_DP64(t, ID_AA64PFR0, SEL2, 1);
+ t = FIELD_DP64(t, ID_AA64PFR0, DIT, 1);
+ cpu->isar.id_aa64pfr0 = t;
+
+ t = cpu->isar.id_aa64pfr1;
+ t = FIELD_DP64(t, ID_AA64PFR1, BT, 1);
+ t = FIELD_DP64(t, ID_AA64PFR1, SSBS, 2);
+ /*
+ * Begin with full support for MTE. This will be downgraded to MTE=0
+ * during realize if the board provides no tag memory, much like
+ * we do for EL2 with the virtualization=on property.
+ */
+ t = FIELD_DP64(t, ID_AA64PFR1, MTE, 3);
+ cpu->isar.id_aa64pfr1 = t;
+
+ t = cpu->isar.id_aa64mmfr0;
+ t = FIELD_DP64(t, ID_AA64MMFR0, PARANGE, 5); /* PARange: 48 bits */
+ cpu->isar.id_aa64mmfr0 = t;
+
+ t = cpu->isar.id_aa64mmfr1;
+ t = FIELD_DP64(t, ID_AA64MMFR1, HPDS, 1); /* HPD */
+ t = FIELD_DP64(t, ID_AA64MMFR1, LO, 1);
+ t = FIELD_DP64(t, ID_AA64MMFR1, VH, 1);
+ t = FIELD_DP64(t, ID_AA64MMFR1, PAN, 2); /* ATS1E1 */
+ t = FIELD_DP64(t, ID_AA64MMFR1, VMIDBITS, 2); /* VMID16 */
+ t = FIELD_DP64(t, ID_AA64MMFR1, XNX, 1); /* TTS2UXN */
+ cpu->isar.id_aa64mmfr1 = t;
+
+ t = cpu->isar.id_aa64mmfr2;
+ t = FIELD_DP64(t, ID_AA64MMFR2, UAO, 1);
+ t = FIELD_DP64(t, ID_AA64MMFR2, CNP, 1); /* TTCNP */
+ t = FIELD_DP64(t, ID_AA64MMFR2, ST, 1); /* TTST */
+ cpu->isar.id_aa64mmfr2 = t;
+
+ t = cpu->isar.id_aa64zfr0;
+ t = FIELD_DP64(t, ID_AA64ZFR0, SVEVER, 1);
+ t = FIELD_DP64(t, ID_AA64ZFR0, AES, 2); /* PMULL */
+ t = FIELD_DP64(t, ID_AA64ZFR0, BITPERM, 1);
+ t = FIELD_DP64(t, ID_AA64ZFR0, BFLOAT16, 1);
+ t = FIELD_DP64(t, ID_AA64ZFR0, SHA3, 1);
+ t = FIELD_DP64(t, ID_AA64ZFR0, SM4, 1);
+ t = FIELD_DP64(t, ID_AA64ZFR0, I8MM, 1);
+ t = FIELD_DP64(t, ID_AA64ZFR0, F32MM, 1);
+ t = FIELD_DP64(t, ID_AA64ZFR0, F64MM, 1);
+ cpu->isar.id_aa64zfr0 = t;
+
+ /* Replicate the same data to the 32-bit id registers. */
+ u = cpu->isar.id_isar5;
+ u = FIELD_DP32(u, ID_ISAR5, AES, 2); /* AES + PMULL */
+ u = FIELD_DP32(u, ID_ISAR5, SHA1, 1);
+ u = FIELD_DP32(u, ID_ISAR5, SHA2, 1);
+ u = FIELD_DP32(u, ID_ISAR5, CRC32, 1);
+ u = FIELD_DP32(u, ID_ISAR5, RDM, 1);
+ u = FIELD_DP32(u, ID_ISAR5, VCMA, 1);
+ cpu->isar.id_isar5 = u;
+
+ u = cpu->isar.id_isar6;
+ u = FIELD_DP32(u, ID_ISAR6, JSCVT, 1);
+ u = FIELD_DP32(u, ID_ISAR6, DP, 1);
+ u = FIELD_DP32(u, ID_ISAR6, FHM, 1);
+ u = FIELD_DP32(u, ID_ISAR6, SB, 1);
+ u = FIELD_DP32(u, ID_ISAR6, SPECRES, 1);
+ u = FIELD_DP32(u, ID_ISAR6, BF16, 1);
+ u = FIELD_DP32(u, ID_ISAR6, I8MM, 1);
+ cpu->isar.id_isar6 = u;
+
+ u = cpu->isar.id_pfr0;
+ u = FIELD_DP32(u, ID_PFR0, DIT, 1);
+ cpu->isar.id_pfr0 = u;
+
+ u = cpu->isar.id_pfr2;
+ u = FIELD_DP32(u, ID_PFR2, SSBS, 1);
+ cpu->isar.id_pfr2 = u;
+
+ u = cpu->isar.id_mmfr3;
+ u = FIELD_DP32(u, ID_MMFR3, PAN, 2); /* ATS1E1 */
+ cpu->isar.id_mmfr3 = u;
+
+ u = cpu->isar.id_mmfr4;
+ u = FIELD_DP32(u, ID_MMFR4, HPDS, 1); /* AA32HPD */
+ u = FIELD_DP32(u, ID_MMFR4, AC2, 1); /* ACTLR2, HACTLR2 */
+ u = FIELD_DP32(u, ID_MMFR4, CNP, 1); /* TTCNP */
+ u = FIELD_DP32(u, ID_MMFR4, XNX, 1); /* TTS2UXN */
+ cpu->isar.id_mmfr4 = u;
+
+ t = cpu->isar.id_aa64dfr0;
+ t = FIELD_DP64(t, ID_AA64DFR0, PMUVER, 5); /* v8.4-PMU */
+ cpu->isar.id_aa64dfr0 = t;
+
+ u = cpu->isar.id_dfr0;
+ u = FIELD_DP32(u, ID_DFR0, PERFMON, 5); /* v8.4-PMU */
+ cpu->isar.id_dfr0 = u;
+
+ u = cpu->isar.mvfr1;
+ u = FIELD_DP32(u, MVFR1, FPHP, 3); /* v8.2-FP16 */
+ u = FIELD_DP32(u, MVFR1, SIMDHP, 2); /* v8.2-FP16 */
+ cpu->isar.mvfr1 = u;
#ifdef CONFIG_USER_ONLY
- /* For usermode -cpu max we can use a larger and more efficient DCZ
- * blocksize since we don't have to follow what the hardware does.
- */
- cpu->ctr = 0x80038003; /* 32 byte I and D cacheline size, VIPT icache */
- cpu->dcz_blocksize = 7; /* 512 bytes */
+ /*
+ * For usermode -cpu max we can use a larger and more efficient DCZ
+ * blocksize since we don't have to follow what the hardware does.
+ */
+ cpu->ctr = 0x80038003; /* 32 byte I and D cacheline size, VIPT icache */
+ cpu->dcz_blocksize = 7; /* 512 bytes */
#endif
- bitmap_fill(cpu->sve_vq_supported, ARM_MAX_VQ);
- }
+ bitmap_fill(cpu->sve_vq_supported, ARM_MAX_VQ);
aarch64_add_pauth_properties(obj);
aarch64_add_sve_properties(obj);
@@ -917,6 +947,9 @@ static const ARMCPUInfo aarch64_cpus[] = {
{ .name = "cortex-a72", .initfn = aarch64_a72_initfn },
{ .name = "a64fx", .initfn = aarch64_a64fx_initfn },
{ .name = "max", .initfn = aarch64_max_initfn },
+#if defined(CONFIG_KVM) || defined(CONFIG_HVF)
+ { .name = "host", .initfn = aarch64_host_initfn },
+#endif
};
static bool aarch64_cpu_get_aarch64(Object *obj, Error **errp)
diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c
index 0dc96560d3..4d4ddab348 100644
--- a/target/arm/hvf/hvf.c
+++ b/target/arm/hvf/hvf.c
@@ -35,9 +35,34 @@
ENCODE_AA64_CP_REG(CP_REG_ARM64_SYSREG_CP, crn, crm, op0, op1, op2)
#define PL1_WRITE_MASK 0x4
+#define SYSREG_OP0_SHIFT 20
+#define SYSREG_OP0_MASK 0x3
+#define SYSREG_OP0(sysreg) ((sysreg >> SYSREG_OP0_SHIFT) & SYSREG_OP0_MASK)
+#define SYSREG_OP1_SHIFT 14
+#define SYSREG_OP1_MASK 0x7
+#define SYSREG_OP1(sysreg) ((sysreg >> SYSREG_OP1_SHIFT) & SYSREG_OP1_MASK)
+#define SYSREG_CRN_SHIFT 10
+#define SYSREG_CRN_MASK 0xf
+#define SYSREG_CRN(sysreg) ((sysreg >> SYSREG_CRN_SHIFT) & SYSREG_CRN_MASK)
+#define SYSREG_CRM_SHIFT 1
+#define SYSREG_CRM_MASK 0xf
+#define SYSREG_CRM(sysreg) ((sysreg >> SYSREG_CRM_SHIFT) & SYSREG_CRM_MASK)
+#define SYSREG_OP2_SHIFT 17
+#define SYSREG_OP2_MASK 0x7
+#define SYSREG_OP2(sysreg) ((sysreg >> SYSREG_OP2_SHIFT) & SYSREG_OP2_MASK)
+
#define SYSREG(op0, op1, crn, crm, op2) \
- ((op0 << 20) | (op2 << 17) | (op1 << 14) | (crn << 10) | (crm << 1))
-#define SYSREG_MASK SYSREG(0x3, 0x7, 0xf, 0xf, 0x7)
+ ((op0 << SYSREG_OP0_SHIFT) | \
+ (op1 << SYSREG_OP1_SHIFT) | \
+ (crn << SYSREG_CRN_SHIFT) | \
+ (crm << SYSREG_CRM_SHIFT) | \
+ (op2 << SYSREG_OP2_SHIFT))
+#define SYSREG_MASK \
+ SYSREG(SYSREG_OP0_MASK, \
+ SYSREG_OP1_MASK, \
+ SYSREG_CRN_MASK, \
+ SYSREG_CRM_MASK, \
+ SYSREG_OP2_MASK)
#define SYSREG_OSLAR_EL1 SYSREG(2, 0, 1, 0, 4)
#define SYSREG_OSLSR_EL1 SYSREG(2, 0, 1, 1, 4)
#define SYSREG_OSDLR_EL1 SYSREG(2, 0, 1, 3, 4)
@@ -729,6 +754,15 @@ static bool hvf_handle_psci_call(CPUState *cpu)
return true;
}
+static bool is_id_sysreg(uint32_t reg)
+{
+ return SYSREG_OP0(reg) == 3 &&
+ SYSREG_OP1(reg) == 0 &&
+ SYSREG_CRN(reg) == 0 &&
+ SYSREG_CRM(reg) >= 1 &&
+ SYSREG_CRM(reg) < 8;
+}
+
static int hvf_sysreg_read(CPUState *cpu, uint32_t reg, uint32_t rt)
{
ARMCPU *arm_cpu = ARM_CPU(cpu);
@@ -781,23 +815,28 @@ static int hvf_sysreg_read(CPUState *cpu, uint32_t reg, uint32_t rt)
/* Dummy register */
break;
default:
+ if (is_id_sysreg(reg)) {
+ /* ID system registers read as RES0 */
+ val = 0;
+ break;
+ }
cpu_synchronize_state(cpu);
trace_hvf_unhandled_sysreg_read(env->pc, reg,
- (reg >> 20) & 0x3,
- (reg >> 14) & 0x7,
- (reg >> 10) & 0xf,
- (reg >> 1) & 0xf,
- (reg >> 17) & 0x7);
+ SYSREG_OP0(reg),
+ SYSREG_OP1(reg),
+ SYSREG_CRN(reg),
+ SYSREG_CRM(reg),
+ SYSREG_OP2(reg));
hvf_raise_exception(cpu, EXCP_UDEF, syn_uncategorized());
return 1;
}
trace_hvf_sysreg_read(reg,
- (reg >> 20) & 0x3,
- (reg >> 14) & 0x7,
- (reg >> 10) & 0xf,
- (reg >> 1) & 0xf,
- (reg >> 17) & 0x7,
+ SYSREG_OP0(reg),
+ SYSREG_OP1(reg),
+ SYSREG_CRN(reg),
+ SYSREG_CRM(reg),
+ SYSREG_OP2(reg),
val);
hvf_set_reg(cpu, rt, val);
@@ -886,11 +925,11 @@ static int hvf_sysreg_write(CPUState *cpu, uint32_t reg, uint64_t val)
CPUARMState *env = &arm_cpu->env;
trace_hvf_sysreg_write(reg,
- (reg >> 20) & 0x3,
- (reg >> 14) & 0x7,
- (reg >> 10) & 0xf,
- (reg >> 1) & 0xf,
- (reg >> 17) & 0x7,
+ SYSREG_OP0(reg),
+ SYSREG_OP1(reg),
+ SYSREG_CRN(reg),
+ SYSREG_CRM(reg),
+ SYSREG_OP2(reg),
val);
switch (reg) {
@@ -960,11 +999,11 @@ static int hvf_sysreg_write(CPUState *cpu, uint32_t reg, uint64_t val)
default:
cpu_synchronize_state(cpu);
trace_hvf_unhandled_sysreg_write(env->pc, reg,
- (reg >> 20) & 0x3,
- (reg >> 14) & 0x7,
- (reg >> 10) & 0xf,
- (reg >> 1) & 0xf,
- (reg >> 17) & 0x7);
+ SYSREG_OP0(reg),
+ SYSREG_OP1(reg),
+ SYSREG_CRN(reg),
+ SYSREG_CRM(reg),
+ SYSREG_OP2(reg));
hvf_raise_exception(cpu, EXCP_UDEF, syn_uncategorized());
return 1;
}
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index aa9e636800..6c7ef1099b 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -21,6 +21,7 @@
#include "qemu/units.h"
#include "qemu/cutils.h"
#include "qemu/qemu-print.h"
+#include "qemu/hw-version.h"
#include "cpu.h"
#include "tcg/helper-tcg.h"
#include "sysemu/reset.h"
@@ -645,7 +646,7 @@ void x86_cpu_vendor_words2str(char *dst, uint32_t vendor1,
CPUID_7_0_EBX_HLE, CPUID_7_0_EBX_AVX2,
CPUID_7_0_EBX_INVPCID, CPUID_7_0_EBX_RTM,
CPUID_7_0_EBX_RDSEED */
-#define TCG_7_0_ECX_FEATURES (CPUID_7_0_ECX_PKU | \
+#define TCG_7_0_ECX_FEATURES (CPUID_7_0_ECX_UMIP | CPUID_7_0_ECX_PKU | \
/* CPUID_7_0_ECX_OSPKE is dynamic */ \
CPUID_7_0_ECX_LA57 | CPUID_7_0_ECX_PKS)
#define TCG_7_0_EDX_FEATURES 0
diff --git a/target/i386/cpu.h b/target/i386/cpu.h
index 9911d7c871..e69ab5dd78 100644
--- a/target/i386/cpu.h
+++ b/target/i386/cpu.h
@@ -167,6 +167,7 @@ typedef enum X86Seg {
#define HF_IOBPT_SHIFT 24 /* an io breakpoint enabled */
#define HF_MPX_EN_SHIFT 25 /* MPX Enabled (CR4+XCR0+BNDCFGx) */
#define HF_MPX_IU_SHIFT 26 /* BND registers in-use */
+#define HF_UMIP_SHIFT 27 /* CR4.UMIP */
#define HF_CPL_MASK (3 << HF_CPL_SHIFT)
#define HF_INHIBIT_IRQ_MASK (1 << HF_INHIBIT_IRQ_SHIFT)
@@ -192,6 +193,7 @@ typedef enum X86Seg {
#define HF_IOBPT_MASK (1 << HF_IOBPT_SHIFT)
#define HF_MPX_EN_MASK (1 << HF_MPX_EN_SHIFT)
#define HF_MPX_IU_MASK (1 << HF_MPX_IU_SHIFT)
+#define HF_UMIP_MASK (1 << HF_UMIP_SHIFT)
/* hflags2 */
@@ -258,7 +260,7 @@ typedef enum X86Seg {
(~(target_ulong)(CR4_VME_MASK | CR4_PVI_MASK | CR4_TSD_MASK \
| CR4_DE_MASK | CR4_PSE_MASK | CR4_PAE_MASK \
| CR4_MCE_MASK | CR4_PGE_MASK | CR4_PCE_MASK \
- | CR4_OSFXSR_MASK | CR4_OSXMMEXCPT_MASK |CR4_UMIP_MASK \
+ | CR4_OSFXSR_MASK | CR4_OSXMMEXCPT_MASK | CR4_UMIP_MASK \
| CR4_LA57_MASK \
| CR4_FSGSBASE_MASK | CR4_PCIDE_MASK | CR4_OSXSAVE_MASK \
| CR4_SMEP_MASK | CR4_SMAP_MASK | CR4_PKE_MASK | CR4_PKS_MASK))
diff --git a/target/i386/helper.c b/target/i386/helper.c
index 0639aea11b..fa409e9c44 100644
--- a/target/i386/helper.c
+++ b/target/i386/helper.c
@@ -175,7 +175,7 @@ void cpu_x86_update_cr4(CPUX86State *env, uint32_t new_cr4)
}
/* Clear bits we're going to recompute. */
- hflags = env->hflags & ~(HF_OSFXSR_MASK | HF_SMAP_MASK);
+ hflags = env->hflags & ~(HF_OSFXSR_MASK | HF_SMAP_MASK | HF_UMIP_MASK);
/* SSE handling */
if (!(env->features[FEAT_1_EDX] & CPUID_SSE)) {
@@ -191,6 +191,12 @@ void cpu_x86_update_cr4(CPUX86State *env, uint32_t new_cr4)
if (new_cr4 & CR4_SMAP_MASK) {
hflags |= HF_SMAP_MASK;
}
+ if (!(env->features[FEAT_7_0_ECX] & CPUID_7_0_ECX_UMIP)) {
+ new_cr4 &= ~CR4_UMIP_MASK;
+ }
+ if (new_cr4 & CR4_UMIP_MASK) {
+ hflags |= HF_UMIP_MASK;
+ }
if (!(env->features[FEAT_7_0_ECX] & CPUID_7_0_ECX_PKU)) {
new_cr4 &= ~CR4_PKE_MASK;
diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c
index 77878cd832..2a94d33742 100644
--- a/target/i386/tcg/translate.c
+++ b/target/i386/tcg/translate.c
@@ -7382,6 +7382,9 @@ static target_ulong disas_insn(DisasContext *s, CPUState *cpu)
case 0: /* sldt */
if (!PE(s) || VM86(s))
goto illegal_op;
+ if (s->flags & HF_UMIP_MASK && !check_cpl0(s)) {
+ break;
+ }
gen_svm_check_intercept(s, SVM_EXIT_LDTR_READ);
tcg_gen_ld32u_tl(s->T0, cpu_env,
offsetof(CPUX86State, ldt.selector));
@@ -7401,6 +7404,9 @@ static target_ulong disas_insn(DisasContext *s, CPUState *cpu)
case 1: /* str */
if (!PE(s) || VM86(s))
goto illegal_op;
+ if (s->flags & HF_UMIP_MASK && !check_cpl0(s)) {
+ break;
+ }
gen_svm_check_intercept(s, SVM_EXIT_TR_READ);
tcg_gen_ld32u_tl(s->T0, cpu_env,
offsetof(CPUX86State, tr.selector));
@@ -7439,6 +7445,9 @@ static target_ulong disas_insn(DisasContext *s, CPUState *cpu)
modrm = x86_ldub_code(env, s);
switch (modrm) {
CASE_MODRM_MEM_OP(0): /* sgdt */
+ if (s->flags & HF_UMIP_MASK && !check_cpl0(s)) {
+ break;
+ }
gen_svm_check_intercept(s, SVM_EXIT_GDTR_READ);
gen_lea_modrm(env, s, modrm);
tcg_gen_ld32u_tl(s->T0,
@@ -7495,6 +7504,9 @@ static target_ulong disas_insn(DisasContext *s, CPUState *cpu)
break;
CASE_MODRM_MEM_OP(1): /* sidt */
+ if (s->flags & HF_UMIP_MASK && !check_cpl0(s)) {
+ break;
+ }
gen_svm_check_intercept(s, SVM_EXIT_IDTR_READ);
gen_lea_modrm(env, s, modrm);
tcg_gen_ld32u_tl(s->T0, cpu_env, offsetof(CPUX86State, idt.limit));
@@ -7670,6 +7682,9 @@ static target_ulong disas_insn(DisasContext *s, CPUState *cpu)
break;
CASE_MODRM_OP(4): /* smsw */
+ if (s->flags & HF_UMIP_MASK && !check_cpl0(s)) {
+ break;
+ }
gen_svm_check_intercept(s, SVM_EXIT_READ_CR0);
tcg_gen_ld_tl(s->T0, cpu_env, offsetof(CPUX86State, cr[0]));
/*
diff --git a/target/s390x/cpu_models.c b/target/s390x/cpu_models.c
index 11e06cc51f..17ae771939 100644
--- a/target/s390x/cpu_models.c
+++ b/target/s390x/cpu_models.c
@@ -19,6 +19,7 @@
#include "qapi/error.h"
#include "qapi/visitor.h"
#include "qemu/module.h"
+#include "qemu/hw-version.h"
#include "qemu/qemu-print.h"
#ifndef CONFIG_USER_ONLY
#include "sysemu/sysemu.h"
diff --git a/tcg/region.c b/tcg/region.c
index 9cc30d4922..72afb35738 100644
--- a/tcg/region.c
+++ b/tcg/region.c
@@ -24,6 +24,9 @@
#include "qemu/osdep.h"
#include "qemu/units.h"
+#include "qemu/madvise.h"
+#include "qemu/mprotect.h"
+#include "qemu/cacheinfo.h"
#include "qapi/error.h"
#include "exec/exec-all.h"
#include "tcg/tcg.h"
diff --git a/tcg/tcg.c b/tcg/tcg.c
index 5d2f0d8b10..528277d1d3 100644
--- a/tcg/tcg.c
+++ b/tcg/tcg.c
@@ -36,6 +36,7 @@
#include "qemu/qemu-print.h"
#include "qemu/timer.h"
#include "qemu/cacheflush.h"
+#include "qemu/cacheinfo.h"
/* Note: the long term plan is to reduce the dependencies on the QEMU
CPU definitions. Currently they are used for qemu_ld/st
diff --git a/tests/Makefile.include b/tests/Makefile.include
index 646c8b1334..e7153c8e91 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -150,7 +150,7 @@ check-acceptance: check-acceptance-deprecated-warning | check-avocado
.PHONY: check-block check check-clean get-vm-images
check:
-ifeq ($(CONFIG_TOOLS)$(CONFIG_POSIX),yy)
+ifneq ($(.check-block.deps),)
check: check-block
check-block: run-ninja
$(if $(MAKE.n),,+)$(MESON) test $(MTESTARGS) $(.mtestargs) --verbose \
diff --git a/tests/check-block.sh b/tests/check-block.sh
index 720a46bc36..18f7433901 100755
--- a/tests/check-block.sh
+++ b/tests/check-block.sh
@@ -18,10 +18,6 @@ skip() {
exit 0
}
-if grep -q "CONFIG_GPROF=y" config-host.mak 2>/dev/null ; then
- skip "GPROF is enabled ==> Not running the qemu-iotests."
-fi
-
# Disable tests with any sanitizer except for specific ones
SANITIZE_FLAGS=$( grep "CFLAGS.*-fsanitize" config-host.mak 2>/dev/null )
ALLOWED_SANITIZE_FLAGS="safe-stack cfi-icall"
diff --git a/tests/meson.build b/tests/meson.build
index 079c8f3727..1d05109eb4 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -85,7 +85,7 @@ if 'CONFIG_TCG' in config_all
subdir('fp')
endif
-if not get_option('tcg').disabled()
+if get_option('tcg').allowed()
if 'CONFIG_PLUGIN' in config_host
subdir('plugin')
endif
diff --git a/tests/qemu-iotests/meson.build b/tests/qemu-iotests/meson.build
index 5be3c74127..9747bb68a5 100644
--- a/tests/qemu-iotests/meson.build
+++ b/tests/qemu-iotests/meson.build
@@ -1,4 +1,4 @@
-if have_tools and targetos != 'windows'
+if have_tools and targetos != 'windows' and not get_option('gprof')
qemu_iotests_binaries = [qemu_img, qemu_io, qemu_nbd, qsd]
qemu_iotests_env = {'PYTHON': python.full_path()}
qemu_iotests_formats = {
diff --git a/tests/qemu-iotests/testrunner.py b/tests/qemu-iotests/testrunner.py
index 0eace147b8..9a94273975 100644
--- a/tests/qemu-iotests/testrunner.py
+++ b/tests/qemu-iotests/testrunner.py
@@ -404,7 +404,10 @@ class TestRunner(ContextManager['TestRunner']):
if res.status == 'fail':
failed.append(name)
if res.diff:
- print('\n'.join(res.diff))
+ if self.tap:
+ print('\n'.join(res.diff), file=sys.stderr)
+ else:
+ print('\n'.join(res.diff))
elif res.status == 'not run':
notrun.append(name)
elif res.status == 'pass':
diff --git a/tests/unit/meson.build b/tests/unit/meson.build
index 64a5e7bfde..3a51759ebc 100644
--- a/tests/unit/meson.build
+++ b/tests/unit/meson.build
@@ -106,7 +106,7 @@ if have_block
if 'CONFIG_POSIX' in config_host
tests += {'test-image-locking': [testblock]}
endif
- if 'CONFIG_REPLICATION' in config_host
+ if config_host_data.get('CONFIG_REPLICATION')
tests += {'test-replication': [testblock]}
endif
if nettle.found() or gcrypt.found()
@@ -149,9 +149,7 @@ if have_system
endif
endif
-if 'CONFIG_TSAN' not in config_host and \
- 'CONFIG_GUEST_AGENT' in config_host and \
- 'CONFIG_LINUX' in config_host
+if have_ga and targetos == 'linux' and 'CONFIG_TSAN' not in config_host
tests += {'test-qga': ['../qtest/libqtest.c']}
test_deps += {'test-qga': qga}
endif
diff --git a/tools/meson.build b/tools/meson.build
index 3e5a0abfa2..46977af84f 100644
--- a/tools/meson.build
+++ b/tools/meson.build
@@ -1,25 +1,12 @@
-have_virtiofsd = (targetos == 'linux' and
- have_tools and
- seccomp.found() and
- libcap_ng.found() and
- 'CONFIG_VHOST_USER' in config_host)
-
-if get_option('virtiofsd').enabled()
- if not have_virtiofsd
- if targetos != 'linux'
- error('virtiofsd requires Linux')
- elif not seccomp.found() or not libcap_ng.found()
- error('virtiofsd requires libcap-ng-devel and seccomp-devel')
- elif 'CONFIG_VHOST_USER' not in config_host
- error('virtiofsd needs vhost-user support')
- else
- # Disabled all the tools but virtiofsd.
- have_virtiofsd = true
- endif
- endif
-elif get_option('virtiofsd').disabled() or not have_system
- have_virtiofsd = false
-endif
+have_virtiofsd = get_option('virtiofsd') \
+ .require(targetos == 'linux',
+ error_message: 'virtiofsd requires Linux') \
+ .require(seccomp.found() and libcap_ng.found(),
+ error_message: 'virtiofsd requires libcap-ng-devel and seccomp-devel') \
+ .require('CONFIG_VHOST_USER' in config_host,
+ error_message: 'virtiofsd needs vhost-user-support') \
+ .disable_auto_if(not have_tools and not have_system) \
+ .allowed()
if have_virtiofsd
subdir('virtiofsd')
diff --git a/ui/cocoa.m b/ui/cocoa.m
index ac18e14ce0..a8f1cdaf92 100644
--- a/ui/cocoa.m
+++ b/ui/cocoa.m
@@ -100,7 +100,6 @@ static int gArgc;
static char **gArgv;
static bool stretch_video;
static NSTextField *pauseLabel;
-static NSArray * supportedImageFileTypes;
static QemuSemaphore display_init_sem;
static QemuSemaphore app_started_sem;
@@ -1168,10 +1167,6 @@ QemuCocoaView *cocoaView;
[pauseLabel setTextColor: [NSColor blackColor]];
[pauseLabel sizeToFit];
- // set the supported image file types that can be opened
- supportedImageFileTypes = [NSArray arrayWithObjects: @"img", @"iso", @"dmg",
- @"qcow", @"qcow2", @"cloop", @"vmdk", @"cdr",
- @"toast", nil];
[self make_about_window];
}
return self;
@@ -1414,7 +1409,6 @@ QemuCocoaView *cocoaView;
openPanel = [NSOpenPanel openPanel];
[openPanel setCanChooseFiles: YES];
[openPanel setAllowsMultipleSelection: NO];
- [openPanel setAllowedFileTypes: supportedImageFileTypes];
if([openPanel runModal] == NSModalResponseOK) {
NSString * file = [[[openPanel URLs] objectAtIndex: 0] path];
if(file == nil) {
@@ -1680,7 +1674,9 @@ static void create_initial_menus(void)
/* Returns a name for a given console */
static NSString * getConsoleName(QemuConsole * console)
{
- return [NSString stringWithFormat: @"%s", qemu_console_get_label(console)];
+ g_autofree char *label = qemu_console_get_label(console);
+
+ return [NSString stringWithUTF8String:label];
}
/* Add an entry to the View menu for each console */
@@ -1715,11 +1711,6 @@ static void addRemovableDevicesMenuItems(void)
currentDevice = qmp_query_block(NULL);
pointerToFree = currentDevice;
- if(currentDevice == NULL) {
- NSBeep();
- QEMU_Alert(@"Failed to query for block devices!");
- return;
- }
menu = [[[NSApp mainMenu] itemWithTitle:@"Machine"] submenu];
diff --git a/util/atomic64.c b/util/atomic64.c
index 93037d5b11..22983a970f 100644
--- a/util/atomic64.c
+++ b/util/atomic64.c
@@ -7,6 +7,7 @@
#include "qemu/osdep.h"
#include "qemu/atomic.h"
#include "qemu/thread.h"
+#include "qemu/cacheinfo.h"
#ifdef CONFIG_ATOMIC64
#error This file must only be compiled if !CONFIG_ATOMIC64
diff --git a/util/cacheflush.c b/util/cacheflush.c
index 933355b0c9..4b57186d89 100644
--- a/util/cacheflush.c
+++ b/util/cacheflush.c
@@ -7,6 +7,7 @@
#include "qemu/osdep.h"
#include "qemu/cacheflush.h"
+#include "qemu/cacheinfo.h"
#include "qemu/bitops.h"
diff --git a/util/cacheinfo.c b/util/cacheinfo.c
index b182f0b693..ab1644d490 100644
--- a/util/cacheinfo.c
+++ b/util/cacheinfo.c
@@ -9,6 +9,7 @@
#include "qemu/osdep.h"
#include "qemu/host-utils.h"
#include "qemu/atomic.h"
+#include "qemu/cacheinfo.h"
int qemu_icache_linesize = 0;
int qemu_icache_linesize_log;
diff --git a/util/meson.build b/util/meson.build
index c9a9cc1cf5..3736988b9f 100644
--- a/util/meson.build
+++ b/util/meson.build
@@ -35,7 +35,9 @@ util_ss.add(files('crc32c.c'))
util_ss.add(files('uuid.c'))
util_ss.add(files('getauxval.c'))
util_ss.add(files('rcu.c'))
-util_ss.add(when: 'CONFIG_MEMBARRIER', if_true: files('sys_membarrier.c'))
+if have_membarrier
+ util_ss.add(files('sys_membarrier.c'))
+endif
util_ss.add(files('log.c'))
util_ss.add(files('pagesize.c'))
util_ss.add(files('qdist.c'))
diff --git a/util/osdep.c b/util/osdep.c
index 67fbf22778..723cdcb004 100644
--- a/util/osdep.c
+++ b/util/osdep.c
@@ -38,6 +38,9 @@ extern int madvise(char *, size_t, int);
#include "qemu/cutils.h"
#include "qemu/sockets.h"
#include "qemu/error-report.h"
+#include "qemu/madvise.h"
+#include "qemu/mprotect.h"
+#include "qemu/hw-version.h"
#include "monitor/monitor.h"
static bool fips_enabled = false;
diff --git a/util/oslib-posix.c b/util/oslib-posix.c
index ac0dbc2adc..f2be7321c5 100644
--- a/util/oslib-posix.c
+++ b/util/oslib-posix.c
@@ -36,6 +36,7 @@
#include "trace.h"
#include "qapi/error.h"
#include "qemu/error-report.h"
+#include "qemu/madvise.h"
#include "qemu/sockets.h"
#include "qemu/thread.h"
#include <libgen.h>