aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--accel/kvm/kvm-all.c4
-rw-r--r--authz/meson.build2
-rw-r--r--block.c2
-rw-r--r--block/block-backend.c19
-rw-r--r--block/file-posix.c136
-rw-r--r--block/io.c2
-rwxr-xr-xconfigure326
-rw-r--r--crypto/meson.build41
-rw-r--r--hw/core/machine.c132
-rw-r--r--hw/i386/pc.c108
-rw-r--r--hw/i386/x86.c15
-rw-r--r--hw/scsi/scsi-generic.c6
-rw-r--r--hw/usb/meson.build6
-rw-r--r--include/block/block_int.h7
-rw-r--r--include/hw/boards.h3
-rw-r--r--include/hw/i386/pc.h3
-rw-r--r--include/hw/i386/x86.h1
-rw-r--r--include/qemu/osdep.h28
-rw-r--r--include/sysemu/block-backend.h1
-rw-r--r--meson.build159
-rw-r--r--meson_options.txt14
-rw-r--r--qapi/block-core.json14
-rw-r--r--qapi/machine.json28
-rw-r--r--target/i386/cpu.c2
-rw-r--r--target/i386/cpu.h1
-rw-r--r--target/i386/kvm/kvm.c12
-rw-r--r--tests/unit/crypto-tls-psk-helpers.c6
-rw-r--r--tests/unit/crypto-tls-psk-helpers.h4
-rw-r--r--tests/unit/crypto-tls-x509-helpers.c4
-rw-r--r--tests/unit/crypto-tls-x509-helpers.h11
-rw-r--r--tests/unit/meson.build10
-rw-r--r--tests/unit/pkix_asn1_tab.c3
-rw-r--r--tests/unit/test-crypto-tlscredsx509.c12
-rw-r--r--tests/unit/test-crypto-tlssession.c12
-rw-r--r--tests/unit/test-io-channel-tls.c12
35 files changed, 492 insertions, 654 deletions
diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
index c7ec538..e5b10dd 100644
--- a/accel/kvm/kvm-all.c
+++ b/accel/kvm/kvm-all.c
@@ -411,7 +411,7 @@ static int do_kvm_destroy_vcpu(CPUState *cpu)
}
if (cpu->kvm_dirty_gfns) {
- ret = munmap(cpu->kvm_dirty_gfns, s->kvm_dirty_ring_size);
+ ret = munmap(cpu->kvm_dirty_gfns, s->kvm_dirty_ring_bytes);
if (ret < 0) {
goto err;
}
@@ -495,7 +495,7 @@ int kvm_init_vcpu(CPUState *cpu, Error **errp)
if (s->kvm_dirty_ring_size) {
/* Use MAP_SHARED to share pages with the kernel */
- cpu->kvm_dirty_gfns = mmap(NULL, s->kvm_dirty_ring_size,
+ cpu->kvm_dirty_gfns = mmap(NULL, s->kvm_dirty_ring_bytes,
PROT_READ | PROT_WRITE, MAP_SHARED,
cpu->kvm_fd,
PAGE_SIZE * KVM_DIRTY_LOG_PAGE_OFFSET);
diff --git a/authz/meson.build b/authz/meson.build
index 88fa776..42a1ec0 100644
--- a/authz/meson.build
+++ b/authz/meson.build
@@ -6,4 +6,4 @@ authz_ss.add(files(
'simple.c',
))
-authz_ss.add(when: ['CONFIG_AUTH_PAM', pam], if_true: files('pamacct.c'))
+authz_ss.add(when: pam, if_true: files('pamacct.c'))
diff --git a/block.c b/block.c
index 3f45689..1d37f13 100644
--- a/block.c
+++ b/block.c
@@ -54,7 +54,7 @@
#ifdef CONFIG_BSD
#include <sys/ioctl.h>
#include <sys/queue.h>
-#ifndef __DragonFly__
+#if defined(HAVE_SYS_DISK_H)
#include <sys/disk.h>
#endif
#endif
diff --git a/block/block-backend.c b/block/block-backend.c
index 15f1ea4..deb55c2 100644
--- a/block/block-backend.c
+++ b/block/block-backend.c
@@ -1953,16 +1953,29 @@ uint32_t blk_get_request_alignment(BlockBackend *blk)
return bs ? bs->bl.request_alignment : BDRV_SECTOR_SIZE;
}
+/* Returns the maximum hardware transfer length, in bytes; guaranteed nonzero */
+uint64_t blk_get_max_hw_transfer(BlockBackend *blk)
+{
+ BlockDriverState *bs = blk_bs(blk);
+ uint64_t max = INT_MAX;
+
+ if (bs) {
+ max = MIN_NON_ZERO(max, bs->bl.max_hw_transfer);
+ max = MIN_NON_ZERO(max, bs->bl.max_transfer);
+ }
+ return ROUND_DOWN(max, blk_get_request_alignment(blk));
+}
+
/* Returns the maximum transfer length, in bytes; guaranteed nonzero */
uint32_t blk_get_max_transfer(BlockBackend *blk)
{
BlockDriverState *bs = blk_bs(blk);
- uint32_t max = 0;
+ uint32_t max = INT_MAX;
if (bs) {
- max = bs->bl.max_transfer;
+ max = MIN_NON_ZERO(max, bs->bl.max_transfer);
}
- return MIN_NON_ZERO(max, INT_MAX);
+ return ROUND_DOWN(max, blk_get_request_alignment(blk));
}
int blk_get_max_iov(BlockBackend *blk)
diff --git a/block/file-posix.c b/block/file-posix.c
index b3fbb9b..a26eab0 100644
--- a/block/file-posix.c
+++ b/block/file-posix.c
@@ -42,6 +42,8 @@
#include "scsi/constants.h"
#if defined(__APPLE__) && (__MACH__)
+#include <sys/ioctl.h>
+#if defined(HAVE_HOST_BLOCK_DEVICE)
#include <paths.h>
#include <sys/param.h>
#include <IOKit/IOKitLib.h>
@@ -52,6 +54,7 @@
//#include <IOKit/storage/IOCDTypes.h>
#include <IOKit/storage/IODVDMedia.h>
#include <CoreFoundation/CoreFoundation.h>
+#endif /* defined(HAVE_HOST_BLOCK_DEVICE) */
#endif
#ifdef __sun__
@@ -178,7 +181,17 @@ typedef struct BDRVRawReopenState {
bool check_cache_dropped;
} BDRVRawReopenState;
-static int fd_open(BlockDriverState *bs);
+static int fd_open(BlockDriverState *bs)
+{
+ BDRVRawState *s = bs->opaque;
+
+ /* this is just to ensure s->fd is sane (its called by io ops) */
+ if (s->fd >= 0) {
+ return 0;
+ }
+ return -EIO;
+}
+
static int64_t raw_getlength(BlockDriverState *bs);
typedef struct RawPosixAIOData {
@@ -1147,22 +1160,27 @@ static void raw_reopen_abort(BDRVReopenState *state)
s->reopen_state = NULL;
}
-static int sg_get_max_transfer_length(int fd)
+static int hdev_get_max_hw_transfer(int fd, struct stat *st)
{
#ifdef BLKSECTGET
- int max_bytes = 0;
-
- if (ioctl(fd, BLKSECTGET, &max_bytes) == 0) {
- return max_bytes;
+ if (S_ISBLK(st->st_mode)) {
+ unsigned short max_sectors = 0;
+ if (ioctl(fd, BLKSECTGET, &max_sectors) == 0) {
+ return max_sectors * 512;
+ }
} else {
- return -errno;
+ int max_bytes = 0;
+ if (ioctl(fd, BLKSECTGET, &max_bytes) == 0) {
+ return max_bytes;
+ }
}
+ return -errno;
#else
return -ENOSYS;
#endif
}
-static int sg_get_max_segments(int fd)
+static int hdev_get_max_segments(int fd, struct stat *st)
{
#ifdef CONFIG_LINUX
char buf[32];
@@ -1171,15 +1189,20 @@ static int sg_get_max_segments(int fd)
int ret;
int sysfd = -1;
long max_segments;
- struct stat st;
- if (fstat(fd, &st)) {
- ret = -errno;
- goto out;
+ if (S_ISCHR(st->st_mode)) {
+ if (ioctl(fd, SG_GET_SG_TABLESIZE, &ret) == 0) {
+ return ret;
+ }
+ return -ENOTSUP;
+ }
+
+ if (!S_ISBLK(st->st_mode)) {
+ return -ENOTSUP;
}
sysfspath = g_strdup_printf("/sys/dev/block/%u:%u/queue/max_segments",
- major(st.st_rdev), minor(st.st_rdev));
+ major(st->st_rdev), minor(st->st_rdev));
sysfd = open(sysfspath, O_RDONLY);
if (sysfd == -1) {
ret = -errno;
@@ -1216,24 +1239,33 @@ out:
static void raw_refresh_limits(BlockDriverState *bs, Error **errp)
{
BDRVRawState *s = bs->opaque;
+ struct stat st;
+
+ raw_probe_alignment(bs, s->fd, errp);
+ bs->bl.min_mem_alignment = s->buf_align;
+ bs->bl.opt_mem_alignment = MAX(s->buf_align, qemu_real_host_page_size);
+
+ /*
+ * Maximum transfers are best effort, so it is okay to ignore any
+ * errors. That said, based on the man page errors in fstat would be
+ * very much unexpected; the only possible case seems to be ENOMEM.
+ */
+ if (fstat(s->fd, &st)) {
+ return;
+ }
- if (bs->sg) {
- int ret = sg_get_max_transfer_length(s->fd);
+ if (bs->sg || S_ISBLK(st.st_mode)) {
+ int ret = hdev_get_max_hw_transfer(s->fd, &st);
if (ret > 0 && ret <= BDRV_REQUEST_MAX_BYTES) {
- bs->bl.max_transfer = pow2floor(ret);
+ bs->bl.max_hw_transfer = ret;
}
- ret = sg_get_max_segments(s->fd);
+ ret = hdev_get_max_segments(s->fd, &st);
if (ret > 0) {
- bs->bl.max_transfer = MIN(bs->bl.max_transfer,
- ret * qemu_real_host_page_size);
+ bs->bl.max_iov = ret;
}
}
-
- raw_probe_alignment(bs, s->fd, errp);
- bs->bl.min_mem_alignment = s->buf_align;
- bs->bl.opt_mem_alignment = MAX(s->buf_align, qemu_real_host_page_size);
}
static int check_for_dasd(int fd)
@@ -1315,7 +1347,9 @@ static int handle_aiocb_ioctl(void *opaque)
RawPosixAIOData *aiocb = opaque;
int ret;
- ret = ioctl(aiocb->aio_fildes, aiocb->ioctl.cmd, aiocb->ioctl.buf);
+ do {
+ ret = ioctl(aiocb->aio_fildes, aiocb->ioctl.cmd, aiocb->ioctl.buf);
+ } while (ret == -1 && errno == EINTR);
if (ret == -1) {
return -errno;
}
@@ -2295,39 +2329,37 @@ static int64_t raw_getlength(BlockDriverState *bs)
again:
#endif
if (!fstat(fd, &sb) && (S_IFCHR & sb.st_mode)) {
+ size = 0;
#ifdef DIOCGMEDIASIZE
- if (ioctl(fd, DIOCGMEDIASIZE, (off_t *)&size))
-#elif defined(DIOCGPART)
- {
- struct partinfo pi;
- if (ioctl(fd, DIOCGPART, &pi) == 0)
- size = pi.media_size;
- else
- size = 0;
+ if (ioctl(fd, DIOCGMEDIASIZE, (off_t *)&size)) {
+ size = 0;
}
- if (size == 0)
#endif
-#if defined(__APPLE__) && defined(__MACH__)
- {
+#ifdef DIOCGPART
+ if (size == 0) {
+ struct partinfo pi;
+ if (ioctl(fd, DIOCGPART, &pi) == 0) {
+ size = pi.media_size;
+ }
+ }
+#endif
+#if defined(DKIOCGETBLOCKCOUNT) && defined(DKIOCGETBLOCKSIZE)
+ if (size == 0) {
uint64_t sectors = 0;
uint32_t sector_size = 0;
if (ioctl(fd, DKIOCGETBLOCKCOUNT, &sectors) == 0
&& ioctl(fd, DKIOCGETBLOCKSIZE, &sector_size) == 0) {
size = sectors * sector_size;
- } else {
- size = lseek(fd, 0LL, SEEK_END);
- if (size < 0) {
- return -errno;
- }
}
}
-#else
- size = lseek(fd, 0LL, SEEK_END);
+#endif
+ if (size == 0) {
+ size = lseek(fd, 0LL, SEEK_END);
+ }
if (size < 0) {
return -errno;
}
-#endif
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
switch(s->type) {
case FTYPE_CD:
@@ -3014,6 +3046,7 @@ static BlockStatsSpecific *raw_get_specific_stats(BlockDriverState *bs)
return stats;
}
+#if defined(HAVE_HOST_BLOCK_DEVICE)
static BlockStatsSpecific *hdev_get_specific_stats(BlockDriverState *bs)
{
BlockStatsSpecific *stats = g_new(BlockStatsSpecific, 1);
@@ -3023,6 +3056,7 @@ static BlockStatsSpecific *hdev_get_specific_stats(BlockDriverState *bs)
return stats;
}
+#endif /* HAVE_HOST_BLOCK_DEVICE */
static QemuOptsList raw_create_opts = {
.name = "raw-create-opts",
@@ -3238,6 +3272,8 @@ BlockDriver bdrv_file = {
/***********************************************/
/* host device */
+#if defined(HAVE_HOST_BLOCK_DEVICE)
+
#if defined(__APPLE__) && defined(__MACH__)
static kern_return_t GetBSDPath(io_iterator_t mediaIterator, char *bsdPath,
CFIndex maxPathSize, int flags);
@@ -3530,16 +3566,6 @@ hdev_co_ioctl(BlockDriverState *bs, unsigned long int req, void *buf)
}
#endif /* linux */
-static int fd_open(BlockDriverState *bs)
-{
- BDRVRawState *s = bs->opaque;
-
- /* this is just to ensure s->fd is sane (its called by io ops) */
- if (s->fd >= 0)
- return 0;
- return -EIO;
-}
-
static coroutine_fn int
hdev_co_pdiscard(BlockDriverState *bs, int64_t offset, int bytes)
{
@@ -3863,6 +3889,8 @@ static BlockDriver bdrv_host_cdrom = {
};
#endif /* __FreeBSD__ */
+#endif /* HAVE_HOST_BLOCK_DEVICE */
+
static void bdrv_file_init(void)
{
/*
@@ -3870,6 +3898,7 @@ static void bdrv_file_init(void)
* registered last will get probed first.
*/
bdrv_register(&bdrv_file);
+#if defined(HAVE_HOST_BLOCK_DEVICE)
bdrv_register(&bdrv_host_device);
#ifdef __linux__
bdrv_register(&bdrv_host_cdrom);
@@ -3877,6 +3906,7 @@ static void bdrv_file_init(void)
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
bdrv_register(&bdrv_host_cdrom);
#endif
+#endif /* HAVE_HOST_BLOCK_DEVICE */
}
block_init(bdrv_file_init);
diff --git a/block/io.c b/block/io.c
index 323854d..dd93364 100644
--- a/block/io.c
+++ b/block/io.c
@@ -127,6 +127,8 @@ static void bdrv_merge_limits(BlockLimits *dst, const BlockLimits *src)
{
dst->opt_transfer = MAX(dst->opt_transfer, src->opt_transfer);
dst->max_transfer = MIN_NON_ZERO(dst->max_transfer, src->max_transfer);
+ dst->max_hw_transfer = MIN_NON_ZERO(dst->max_hw_transfer,
+ src->max_hw_transfer);
dst->opt_mem_alignment = MAX(dst->opt_mem_alignment,
src->opt_mem_alignment);
dst->min_mem_alignment = MAX(dst->min_mem_alignment,
diff --git a/configure b/configure
index 38704b4..e799d90 100755
--- a/configure
+++ b/configure
@@ -372,10 +372,10 @@ trace_file="trace"
spice="$default_feature"
spice_protocol="auto"
rbd="auto"
-smartcard="$default_feature"
+smartcard="auto"
u2f="auto"
-libusb="$default_feature"
-usb_redir="$default_feature"
+libusb="auto"
+usb_redir="auto"
opengl="$default_feature"
cpuid_h="no"
avx2_opt="$default_feature"
@@ -404,13 +404,10 @@ seccomp="auto"
glusterfs="auto"
gtk="auto"
tls_priority="NORMAL"
-gnutls="$default_feature"
-nettle="$default_feature"
-nettle_xts="no"
-gcrypt="$default_feature"
-gcrypt_xts="no"
-qemu_private_xts="yes"
-auth_pam="$default_feature"
+gnutls="auto"
+nettle="auto"
+gcrypt="auto"
+auth_pam="auto"
vte="$default_feature"
virglrenderer="$default_feature"
tpm="$default_feature"
@@ -1280,21 +1277,21 @@ for opt do
;;
--enable-xfsctl) xfs="yes"
;;
- --disable-smartcard) smartcard="no"
+ --disable-smartcard) smartcard="disabled"
;;
- --enable-smartcard) smartcard="yes"
+ --enable-smartcard) smartcard="enabled"
;;
--disable-u2f) u2f="disabled"
;;
--enable-u2f) u2f="enabled"
;;
- --disable-libusb) libusb="no"
+ --disable-libusb) libusb="disabled"
;;
- --enable-libusb) libusb="yes"
+ --enable-libusb) libusb="enabled"
;;
- --disable-usb-redir) usb_redir="no"
+ --disable-usb-redir) usb_redir="disabled"
;;
- --enable-usb-redir) usb_redir="yes"
+ --enable-usb-redir) usb_redir="enabled"
;;
--disable-zlib-test)
;;
@@ -1374,21 +1371,21 @@ for opt do
;;
--tls-priority=*) tls_priority="$optarg"
;;
- --disable-gnutls) gnutls="no"
+ --disable-gnutls) gnutls="disabled"
;;
- --enable-gnutls) gnutls="yes"
+ --enable-gnutls) gnutls="enabled"
;;
- --disable-nettle) nettle="no"
+ --disable-nettle) nettle="disabled"
;;
- --enable-nettle) nettle="yes"
+ --enable-nettle) nettle="enabled"
;;
- --disable-gcrypt) gcrypt="no"
+ --disable-gcrypt) gcrypt="disabled"
;;
- --enable-gcrypt) gcrypt="yes"
+ --enable-gcrypt) gcrypt="enabled"
;;
- --disable-auth-pam) auth_pam="no"
+ --disable-auth-pam) auth_pam="disabled"
;;
- --enable-auth-pam) auth_pam="yes"
+ --enable-auth-pam) auth_pam="enabled"
;;
--enable-rdma) rdma="yes"
;;
@@ -2803,199 +2800,6 @@ EOF
fi
##########################################
-# GNUTLS probe
-
-if test "$gnutls" != "no"; then
- pass="no"
- if $pkg_config --exists "gnutls >= 3.5.18"; then
- gnutls_cflags=$($pkg_config --cflags gnutls)
- gnutls_libs=$($pkg_config --libs gnutls)
- # Packaging for the static libraries is not always correct.
- # At least ubuntu 18.04 ships only shared libraries.
- write_c_skeleton
- if compile_prog "" "$gnutls_libs" ; then
- pass="yes"
- fi
- fi
- if test "$pass" = "no" && test "$gnutls" = "yes"; then
- feature_not_found "gnutls" "Install gnutls devel >= 3.1.18"
- else
- gnutls="$pass"
- fi
-fi
-
-
-# If user didn't give a --disable/enable-gcrypt flag,
-# then mark as disabled if user requested nettle
-# explicitly
-if test -z "$gcrypt"
-then
- if test "$nettle" = "yes"
- then
- gcrypt="no"
- fi
-fi
-
-# If user didn't give a --disable/enable-nettle flag,
-# then mark as disabled if user requested gcrypt
-# explicitly
-if test -z "$nettle"
-then
- if test "$gcrypt" = "yes"
- then
- nettle="no"
- fi
-fi
-
-has_libgcrypt() {
- if ! has "libgcrypt-config"
- then
- return 1
- fi
-
- if test -n "$cross_prefix"
- then
- host=$(libgcrypt-config --host)
- if test "$host-" != $cross_prefix
- then
- return 1
- fi
- fi
-
- maj=`libgcrypt-config --version | awk -F . '{print $1}'`
- min=`libgcrypt-config --version | awk -F . '{print $2}'`
-
- if test $maj != 1 || test $min -lt 8
- then
- return 1
- fi
-
- return 0
-}
-
-
-if test "$nettle" != "no"; then
- pass="no"
- if $pkg_config --exists "nettle >= 3.4"; then
- nettle_cflags=$($pkg_config --cflags nettle)
- nettle_libs=$($pkg_config --libs nettle)
- # Link test to make sure the given libraries work (e.g for static).
- write_c_skeleton
- if compile_prog "" "$nettle_libs" ; then
- if test -z "$gcrypt"; then
- gcrypt="no"
- fi
- pass="yes"
- fi
- fi
- if test "$pass" = "yes"
- then
- cat > $TMPC << EOF
-#include <nettle/xts.h>
-int main(void) {
- return 0;
-}
-EOF
- if compile_prog "$nettle_cflags" "$nettle_libs" ; then
- nettle_xts=yes
- qemu_private_xts=no
- fi
- fi
- if test "$pass" = "no" && test "$nettle" = "yes"; then
- feature_not_found "nettle" "Install nettle devel >= 2.7.1"
- else
- nettle="$pass"
- fi
-fi
-
-if test "$gcrypt" != "no"; then
- pass="no"
- if has_libgcrypt; then
- gcrypt_cflags=$(libgcrypt-config --cflags)
- gcrypt_libs=$(libgcrypt-config --libs)
- # Debian has removed -lgpg-error from libgcrypt-config
- # as it "spreads unnecessary dependencies" which in
- # turn breaks static builds...
- if test "$static" = "yes"
- then
- gcrypt_libs="$gcrypt_libs -lgpg-error"
- fi
-
- # Link test to make sure the given libraries work (e.g for static).
- write_c_skeleton
- if compile_prog "" "$gcrypt_libs" ; then
- pass="yes"
- fi
- fi
- if test "$pass" = "yes"; then
- gcrypt="yes"
- cat > $TMPC << EOF
-#include <gcrypt.h>
-int main(void) {
- gcry_cipher_hd_t handle;
- gcry_cipher_open(&handle, GCRY_CIPHER_AES, GCRY_CIPHER_MODE_XTS, 0);
- return 0;
-}
-EOF
- if compile_prog "$gcrypt_cflags" "$gcrypt_libs" ; then
- gcrypt_xts=yes
- qemu_private_xts=no
- fi
- elif test "$gcrypt" = "yes"; then
- feature_not_found "gcrypt" "Install gcrypt devel >= 1.5.0"
- else
- gcrypt="no"
- fi
-fi
-
-
-if test "$gcrypt" = "yes" && test "$nettle" = "yes"
-then
- error_exit "Only one of gcrypt & nettle can be enabled"
-fi
-
-##########################################
-# libtasn1 - only for the TLS creds/session test suite
-
-tasn1=yes
-tasn1_cflags=""
-tasn1_libs=""
-if $pkg_config --exists "libtasn1"; then
- tasn1_cflags=$($pkg_config --cflags libtasn1)
- tasn1_libs=$($pkg_config --libs libtasn1)
-else
- tasn1=no
-fi
-
-
-##########################################
-# PAM probe
-
-if test "$auth_pam" != "no"; then
- cat > $TMPC <<EOF
-#include <security/pam_appl.h>
-#include <stdio.h>
-int main(void) {
- const char *service_name = "qemu";
- const char *user = "frank";
- const struct pam_conv pam_conv = { 0 };
- pam_handle_t *pamh = NULL;
- pam_start(service_name, user, &pam_conv, &pamh);
- return 0;
-}
-EOF
- if compile_prog "" "-lpam" ; then
- auth_pam=yes
- else
- if test "$auth_pam" = "yes"; then
- feature_not_found "PAM" "Install PAM development package"
- else
- auth_pam=no
- fi
- fi
-fi
-
-##########################################
# VTE probe
if test "$vte" != "no"; then
@@ -4176,48 +3980,6 @@ EOF
fi
fi
-# check for smartcard support
-if test "$smartcard" != "no"; then
- if $pkg_config --atleast-version=2.5.1 libcacard; then
- libcacard_cflags=$($pkg_config --cflags libcacard)
- libcacard_libs=$($pkg_config --libs libcacard)
- smartcard="yes"
- else
- if test "$smartcard" = "yes"; then
- feature_not_found "smartcard" "Install libcacard devel"
- fi
- smartcard="no"
- fi
-fi
-
-# check for libusb
-if test "$libusb" != "no" ; then
- if $pkg_config --atleast-version=1.0.13 libusb-1.0; then
- libusb="yes"
- libusb_cflags=$($pkg_config --cflags libusb-1.0)
- libusb_libs=$($pkg_config --libs libusb-1.0)
- else
- if test "$libusb" = "yes"; then
- feature_not_found "libusb" "Install libusb devel >= 1.0.13"
- fi
- libusb="no"
- fi
-fi
-
-# check for usbredirparser for usb network redirection support
-if test "$usb_redir" != "no" ; then
- if $pkg_config --atleast-version=0.6 libusbredirparser-0.5; then
- usb_redir="yes"
- usb_redir_cflags=$($pkg_config --cflags libusbredirparser-0.5)
- usb_redir_libs=$($pkg_config --libs libusbredirparser-0.5)
- else
- if test "$usb_redir" = "yes"; then
- feature_not_found "usb-redir" "Install usbredir devel"
- fi
- usb_redir="no"
- fi
-fi
-
##########################################
# check if we have VSS SDK headers for win
@@ -5709,30 +5471,6 @@ if test "$gdbus_codegen" != "" ; then
echo "GDBUS_CODEGEN=$gdbus_codegen" >> $config_host_mak
fi
echo "CONFIG_TLS_PRIORITY=\"$tls_priority\"" >> $config_host_mak
-if test "$gnutls" = "yes" ; then
- echo "CONFIG_GNUTLS=y" >> $config_host_mak
- echo "GNUTLS_CFLAGS=$gnutls_cflags" >> $config_host_mak
- echo "GNUTLS_LIBS=$gnutls_libs" >> $config_host_mak
-fi
-if test "$gcrypt" = "yes" ; then
- echo "CONFIG_GCRYPT=y" >> $config_host_mak
- echo "GCRYPT_CFLAGS=$gcrypt_cflags" >> $config_host_mak
- echo "GCRYPT_LIBS=$gcrypt_libs" >> $config_host_mak
-fi
-if test "$nettle" = "yes" ; then
- echo "CONFIG_NETTLE=y" >> $config_host_mak
- echo "NETTLE_CFLAGS=$nettle_cflags" >> $config_host_mak
- echo "NETTLE_LIBS=$nettle_libs" >> $config_host_mak
-fi
-if test "$qemu_private_xts" = "yes" ; then
- echo "CONFIG_QEMU_PRIVATE_XTS=y" >> $config_host_mak
-fi
-if test "$tasn1" = "yes" ; then
- echo "CONFIG_TASN1=y" >> $config_host_mak
-fi
-if test "$auth_pam" = "yes" ; then
- echo "CONFIG_AUTH_PAM=y" >> $config_host_mak
-fi
if test "$have_broken_size_max" = "yes" ; then
echo "HAVE_BROKEN_SIZE_MAX=y" >> $config_host_mak
fi
@@ -5845,24 +5583,6 @@ if test "$spice" = "yes" ; then
echo "SPICE_LIBS=$spice_libs" >> $config_host_mak
fi
-if test "$smartcard" = "yes" ; then
- echo "CONFIG_SMARTCARD=y" >> $config_host_mak
- echo "SMARTCARD_CFLAGS=$libcacard_cflags" >> $config_host_mak
- echo "SMARTCARD_LIBS=$libcacard_libs" >> $config_host_mak
-fi
-
-if test "$libusb" = "yes" ; then
- echo "CONFIG_USB_LIBUSB=y" >> $config_host_mak
- echo "LIBUSB_CFLAGS=$libusb_cflags" >> $config_host_mak
- echo "LIBUSB_LIBS=$libusb_libs" >> $config_host_mak
-fi
-
-if test "$usb_redir" = "yes" ; then
- echo "CONFIG_USB_REDIR=y" >> $config_host_mak
- echo "USB_REDIR_CFLAGS=$usb_redir_cflags" >> $config_host_mak
- echo "USB_REDIR_LIBS=$usb_redir_libs" >> $config_host_mak
-fi
-
if test "$opengl" = "yes" ; then
echo "CONFIG_OPENGL=y" >> $config_host_mak
echo "OPENGL_CFLAGS=$opengl_cflags" >> $config_host_mak
@@ -6190,8 +5910,6 @@ echo "LD_I386_EMULATION=$ld_i386_emulation" >> $config_host_mak
echo "EXESUF=$EXESUF" >> $config_host_mak
echo "HOST_DSOSUF=$HOST_DSOSUF" >> $config_host_mak
echo "LIBS_QGA=$libs_qga" >> $config_host_mak
-echo "TASN1_LIBS=$tasn1_libs" >> $config_host_mak
-echo "TASN1_CFLAGS=$tasn1_cflags" >> $config_host_mak
if test "$gcov" = "yes" ; then
echo "CONFIG_GCOV=y" >> $config_host_mak
fi
@@ -6437,12 +6155,14 @@ if test "$skip_meson" = no; then
-Dkvm=$kvm -Dhax=$hax -Dwhpx=$whpx -Dhvf=$hvf -Dnvmm=$nvmm \
-Dxen=$xen -Dxen_pci_passthrough=$xen_pci_passthrough -Dtcg=$tcg \
-Dcocoa=$cocoa -Dgtk=$gtk -Dmpath=$mpath -Dsdl=$sdl -Dsdl_image=$sdl_image \
+ -Dlibusb=$libusb -Dsmartcard=$smartcard -Dusb_redir=$usb_redir \
-Dvnc=$vnc -Dvnc_sasl=$vnc_sasl -Dvnc_jpeg=$vnc_jpeg -Dvnc_png=$vnc_png \
-Dgettext=$gettext -Dxkbcommon=$xkbcommon -Du2f=$u2f -Dvirtiofsd=$virtiofsd \
-Dcapstone=$capstone -Dslirp=$slirp -Dfdt=$fdt -Dbrlapi=$brlapi \
-Dcurl=$curl -Dglusterfs=$glusterfs -Dbzip2=$bzip2 -Dlibiscsi=$libiscsi \
-Dlibnfs=$libnfs -Diconv=$iconv -Dcurses=$curses -Dlibudev=$libudev\
-Drbd=$rbd -Dlzo=$lzo -Dsnappy=$snappy -Dlzfse=$lzfse \
+ -Dgnutls=$gnutls -Dnettle=$nettle -Dgcrypt=$gcrypt -Dauth_pam=$auth_pam \
-Dzstd=$zstd -Dseccomp=$seccomp -Dvirtfs=$virtfs -Dcap_ng=$cap_ng \
-Dattr=$attr -Ddefault_devices=$default_devices \
-Ddocs=$docs -Dsphinx_build=$sphinx_build -Dinstall_blobs=$blobs \
diff --git a/crypto/meson.build b/crypto/meson.build
index af7e80c..7cbf1a6 100644
--- a/crypto/meson.build
+++ b/crypto/meson.build
@@ -22,48 +22,31 @@ crypto_ss.add(files(
'tlssession.c',
))
-if 'CONFIG_NETTLE' in config_host
- crypto_ss.add(files('hash-nettle.c', 'hmac-nettle.c', 'pbkdf-nettle.c'))
-elif 'CONFIG_GCRYPT' in config_host
- crypto_ss.add(files('hash-gcrypt.c', 'pbkdf-gcrypt.c'))
- crypto_ss.add(files('hmac-gcrypt.c'))
+if nettle.found()
+ crypto_ss.add(nettle, files('hash-nettle.c', 'hmac-nettle.c', 'pbkdf-nettle.c'))
+elif gcrypt.found()
+ crypto_ss.add(gcrypt, files('hash-gcrypt.c', 'hmac-gcrypt.c', 'pbkdf-gcrypt.c'))
else
crypto_ss.add(files('hash-glib.c', 'hmac-glib.c', 'pbkdf-stub.c'))
endif
+if xts == 'private'
+ crypto_ss.add(files('xts.c'))
+endif
crypto_ss.add(when: 'CONFIG_SECRET_KEYRING', if_true: files('secret_keyring.c'))
-crypto_ss.add(when: 'CONFIG_QEMU_PRIVATE_XTS', if_true: files('xts.c'))
crypto_ss.add(when: 'CONFIG_AF_ALG', if_true: files('afalg.c', 'cipher-afalg.c', 'hash-afalg.c'))
-crypto_ss.add(when: 'CONFIG_GNUTLS', if_true: files('tls-cipher-suites.c'))
-
-if 'CONFIG_NETTLE' in config_host
- crypto_ss.add(nettle)
-elif 'CONFIG_GCRYPT' in config_host
- crypto_ss.add(gcrypt)
-endif
-
-if 'CONFIG_GNUTLS' in config_host
- crypto_ss.add(gnutls)
-endif
-
+crypto_ss.add(when: gnutls, if_true: files('tls-cipher-suites.c'))
util_ss.add(files('aes.c'))
util_ss.add(files('init.c'))
-if 'CONFIG_GCRYPT' in config_host
- util_ss.add(files('random-gcrypt.c'))
-elif 'CONFIG_GNUTLS' in config_host
- util_ss.add(files('random-gnutls.c'))
+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
util_ss.add(files('random-none.c'))
else
util_ss.add(files('random-platform.c'))
endif
-if 'CONFIG_GCRYPT' in config_host
- util_ss.add(gcrypt)
-endif
-
-if 'CONFIG_GNUTLS' in config_host
- util_ss.add(gnutls)
-endif
diff --git a/hw/core/machine.c b/hw/core/machine.c
index 55b9bc7..ffc076a 100644
--- a/hw/core/machine.c
+++ b/hw/core/machine.c
@@ -739,69 +739,63 @@ void machine_set_cpu_numa_node(MachineState *machine,
}
}
-static void smp_parse(MachineState *ms, QemuOpts *opts)
+static void smp_parse(MachineState *ms, SMPConfiguration *config, Error **errp)
{
- if (opts) {
- unsigned cpus = qemu_opt_get_number(opts, "cpus", 0);
- unsigned sockets = qemu_opt_get_number(opts, "sockets", 0);
- unsigned cores = qemu_opt_get_number(opts, "cores", 0);
- unsigned threads = qemu_opt_get_number(opts, "threads", 0);
-
- /* compute missing values, prefer sockets over cores over threads */
- if (cpus == 0 || sockets == 0) {
- cores = cores > 0 ? cores : 1;
- threads = threads > 0 ? threads : 1;
- if (cpus == 0) {
- sockets = sockets > 0 ? sockets : 1;
- cpus = cores * threads * sockets;
- } else {
- ms->smp.max_cpus =
- qemu_opt_get_number(opts, "maxcpus", cpus);
- sockets = ms->smp.max_cpus / (cores * threads);
- }
- } else if (cores == 0) {
- threads = threads > 0 ? threads : 1;
- cores = cpus / (sockets * threads);
- cores = cores > 0 ? cores : 1;
- } else if (threads == 0) {
- threads = cpus / (cores * sockets);
- threads = threads > 0 ? threads : 1;
- } else if (sockets * cores * threads < cpus) {
- error_report("cpu topology: "
- "sockets (%u) * cores (%u) * threads (%u) < "
- "smp_cpus (%u)",
- sockets, cores, threads, cpus);
- exit(1);
- }
+ unsigned cpus = config->has_cpus ? config->cpus : 0;
+ unsigned sockets = config->has_sockets ? config->sockets : 0;
+ unsigned cores = config->has_cores ? config->cores : 0;
+ unsigned threads = config->has_threads ? config->threads : 0;
- ms->smp.max_cpus =
- qemu_opt_get_number(opts, "maxcpus", cpus);
+ if (config->has_dies && config->dies != 0 && config->dies != 1) {
+ error_setg(errp, "dies not supported by this machine's CPU topology");
+ }
- if (ms->smp.max_cpus < cpus) {
- error_report("maxcpus must be equal to or greater than smp");
- exit(1);
+ /* compute missing values, prefer sockets over cores over threads */
+ if (cpus == 0 || sockets == 0) {
+ cores = cores > 0 ? cores : 1;
+ threads = threads > 0 ? threads : 1;
+ if (cpus == 0) {
+ sockets = sockets > 0 ? sockets : 1;
+ cpus = cores * threads * sockets;
+ } else {
+ ms->smp.max_cpus = config->has_maxcpus ? config->maxcpus : cpus;
+ sockets = ms->smp.max_cpus / (cores * threads);
}
+ } else if (cores == 0) {
+ threads = threads > 0 ? threads : 1;
+ cores = cpus / (sockets * threads);
+ cores = cores > 0 ? cores : 1;
+ } else if (threads == 0) {
+ threads = cpus / (cores * sockets);
+ threads = threads > 0 ? threads : 1;
+ } else if (sockets * cores * threads < cpus) {
+ error_setg(errp, "cpu topology: "
+ "sockets (%u) * cores (%u) * threads (%u) < "
+ "smp_cpus (%u)",
+ sockets, cores, threads, cpus);
+ return;
+ }
- if (sockets * cores * threads != ms->smp.max_cpus) {
- error_report("Invalid CPU topology: "
- "sockets (%u) * cores (%u) * threads (%u) "
- "!= maxcpus (%u)",
- sockets, cores, threads,
- ms->smp.max_cpus);
- exit(1);
- }
+ ms->smp.max_cpus = config->has_maxcpus ? config->maxcpus : cpus;
- ms->smp.cpus = cpus;
- ms->smp.cores = cores;
- ms->smp.threads = threads;
- ms->smp.sockets = sockets;
+ if (ms->smp.max_cpus < cpus) {
+ error_setg(errp, "maxcpus must be equal to or greater than smp");
+ return;
}
- if (ms->smp.cpus > 1) {
- Error *blocker = NULL;
- error_setg(&blocker, QERR_REPLAY_NOT_SUPPORTED, "smp");
- replay_add_blocker(blocker);
+ if (sockets * cores * threads != ms->smp.max_cpus) {
+ error_setg(errp, "Invalid CPU topology: "
+ "sockets (%u) * cores (%u) * threads (%u) "
+ "!= maxcpus (%u)",
+ sockets, cores, threads,
+ ms->smp.max_cpus);
+ return;
}
+
+ ms->smp.cpus = cpus;
+ ms->smp.cores = cores;
+ ms->smp.threads = threads;
+ ms->smp.sockets = sockets;
}
static void machine_class_init(ObjectClass *oc, void *data)
@@ -970,6 +964,7 @@ static void machine_initfn(Object *obj)
ms->smp.cpus = mc->default_cpus;
ms->smp.max_cpus = mc->default_cpus;
ms->smp.cores = 1;
+ ms->smp.dies = 1;
ms->smp.threads = 1;
ms->smp.sockets = 1;
}
@@ -1133,8 +1128,29 @@ MemoryRegion *machine_consume_memdev(MachineState *machine,
bool machine_smp_parse(MachineState *ms, QemuOpts *opts, Error **errp)
{
MachineClass *mc = MACHINE_GET_CLASS(ms);
+ ERRP_GUARD();
- mc->smp_parse(ms, opts);
+ if (opts) {
+ SMPConfiguration config = {
+ .has_cpus = !!qemu_opt_get(opts, "cpus"),
+ .cpus = qemu_opt_get_number(opts, "cpus", 0),
+ .has_sockets = !!qemu_opt_get(opts, "sockets"),
+ .sockets = qemu_opt_get_number(opts, "sockets", 0),
+ .has_dies = !!qemu_opt_get(opts, "dies"),
+ .dies = qemu_opt_get_number(opts, "dies", 0),
+ .has_cores = !!qemu_opt_get(opts, "cores"),
+ .cores = qemu_opt_get_number(opts, "cores", 0),
+ .has_threads = !!qemu_opt_get(opts, "threads"),
+ .threads = qemu_opt_get_number(opts, "threads", 0),
+ .has_maxcpus = !!qemu_opt_get(opts, "maxcpus"),
+ .maxcpus = qemu_opt_get_number(opts, "maxcpus", 0),
+ };
+
+ mc->smp_parse(ms, &config, errp);
+ if (*errp) {
+ return false;
+ }
+ }
/* sanity-check smp_cpus and max_cpus against mc */
if (ms->smp.cpus < mc->min_cpus) {
@@ -1150,6 +1166,12 @@ bool machine_smp_parse(MachineState *ms, QemuOpts *opts, Error **errp)
mc->name, mc->max_cpus);
return false;
}
+
+ if (ms->smp.cpus > 1) {
+ Error *blocker = NULL;
+ error_setg(&blocker, QERR_REPLAY_NOT_SUPPORTED, "smp");
+ replay_add_blocker(blocker);
+ }
return true;
}
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index c6d8d0d..8e1220d 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -710,73 +710,61 @@ void pc_acpi_smi_interrupt(void *opaque, int irq, int level)
* This function is very similar to smp_parse()
* in hw/core/machine.c but includes CPU die support.
*/
-void pc_smp_parse(MachineState *ms, QemuOpts *opts)
+static void pc_smp_parse(MachineState *ms, SMPConfiguration *config, Error **errp)
{
- X86MachineState *x86ms = X86_MACHINE(ms);
-
- if (opts) {
- unsigned cpus = qemu_opt_get_number(opts, "cpus", 0);
- unsigned sockets = qemu_opt_get_number(opts, "sockets", 0);
- unsigned dies = qemu_opt_get_number(opts, "dies", 1);
- unsigned cores = qemu_opt_get_number(opts, "cores", 0);
- unsigned threads = qemu_opt_get_number(opts, "threads", 0);
-
- /* compute missing values, prefer sockets over cores over threads */
- if (cpus == 0 || sockets == 0) {
- cores = cores > 0 ? cores : 1;
- threads = threads > 0 ? threads : 1;
- if (cpus == 0) {
- sockets = sockets > 0 ? sockets : 1;
- cpus = cores * threads * dies * sockets;
- } else {
- ms->smp.max_cpus =
- qemu_opt_get_number(opts, "maxcpus", cpus);
- sockets = ms->smp.max_cpus / (cores * threads * dies);
- }
- } else if (cores == 0) {
- threads = threads > 0 ? threads : 1;
- cores = cpus / (sockets * dies * threads);
- cores = cores > 0 ? cores : 1;
- } else if (threads == 0) {
- threads = cpus / (cores * dies * sockets);
- threads = threads > 0 ? threads : 1;
- } else if (sockets * dies * cores * threads < cpus) {
- error_report("cpu topology: "
- "sockets (%u) * dies (%u) * cores (%u) * threads (%u) < "
- "smp_cpus (%u)",
- sockets, dies, cores, threads, cpus);
- exit(1);
- }
-
- ms->smp.max_cpus =
- qemu_opt_get_number(opts, "maxcpus", cpus);
-
- if (ms->smp.max_cpus < cpus) {
- error_report("maxcpus must be equal to or greater than smp");
- exit(1);
+ unsigned cpus = config->has_cpus ? config->cpus : 0;
+ unsigned sockets = config->has_sockets ? config->sockets : 0;
+ unsigned dies = config->has_dies ? config->dies : 1;
+ unsigned cores = config->has_cores ? config->cores : 0;
+ unsigned threads = config->has_threads ? config->threads : 0;
+
+ /* compute missing values, prefer sockets over cores over threads */
+ if (cpus == 0 || sockets == 0) {
+ cores = cores > 0 ? cores : 1;
+ threads = threads > 0 ? threads : 1;
+ if (cpus == 0) {
+ sockets = sockets > 0 ? sockets : 1;
+ cpus = cores * threads * dies * sockets;
+ } else {
+ ms->smp.max_cpus = config->has_maxcpus ? config->maxcpus : cpus;
+ sockets = ms->smp.max_cpus / (cores * threads * dies);
}
+ } else if (cores == 0) {
+ threads = threads > 0 ? threads : 1;
+ cores = cpus / (sockets * dies * threads);
+ cores = cores > 0 ? cores : 1;
+ } else if (threads == 0) {
+ threads = cpus / (cores * dies * sockets);
+ threads = threads > 0 ? threads : 1;
+ } else if (sockets * dies * cores * threads < cpus) {
+ error_setg(errp, "cpu topology: "
+ "sockets (%u) * dies (%u) * cores (%u) * threads (%u) < "
+ "smp_cpus (%u)",
+ sockets, dies, cores, threads, cpus);
+ return;
+ }
- if (sockets * dies * cores * threads != ms->smp.max_cpus) {
- error_report("Invalid CPU topology deprecated: "
- "sockets (%u) * dies (%u) * cores (%u) * threads (%u) "
- "!= maxcpus (%u)",
- sockets, dies, cores, threads,
- ms->smp.max_cpus);
- exit(1);
- }
+ ms->smp.max_cpus = config->has_maxcpus ? config->maxcpus : cpus;
- ms->smp.cpus = cpus;
- ms->smp.cores = cores;
- ms->smp.threads = threads;
- ms->smp.sockets = sockets;
- x86ms->smp_dies = dies;
+ if (ms->smp.max_cpus < cpus) {
+ error_setg(errp, "maxcpus must be equal to or greater than smp");
+ return;
}
- if (ms->smp.cpus > 1) {
- Error *blocker = NULL;
- error_setg(&blocker, QERR_REPLAY_NOT_SUPPORTED, "smp");
- replay_add_blocker(blocker);
+ if (sockets * dies * cores * threads != ms->smp.max_cpus) {
+ error_setg(errp, "Invalid CPU topology deprecated: "
+ "sockets (%u) * dies (%u) * cores (%u) * threads (%u) "
+ "!= maxcpus (%u)",
+ sockets, dies, cores, threads,
+ ms->smp.max_cpus);
+ return;
}
+
+ ms->smp.cpus = cpus;
+ ms->smp.cores = cores;
+ ms->smp.threads = threads;
+ ms->smp.sockets = sockets;
+ ms->smp.dies = dies;
}
static
diff --git a/hw/i386/x86.c b/hw/i386/x86.c
index d30cf27..00448ed 100644
--- a/hw/i386/x86.c
+++ b/hw/i386/x86.c
@@ -64,7 +64,7 @@ inline void init_topo_info(X86CPUTopoInfo *topo_info,
{
MachineState *ms = MACHINE(x86ms);
- topo_info->dies_per_pkg = x86ms->smp_dies;
+ topo_info->dies_per_pkg = ms->smp.dies;
topo_info->cores_per_die = ms->smp.cores;
topo_info->threads_per_core = ms->smp.threads;
}
@@ -293,7 +293,7 @@ void x86_cpu_pre_plug(HotplugHandler *hotplug_dev,
init_topo_info(&topo_info, x86ms);
- env->nr_dies = x86ms->smp_dies;
+ env->nr_dies = ms->smp.dies;
/*
* If APIC ID is not set,
@@ -301,13 +301,13 @@ void x86_cpu_pre_plug(HotplugHandler *hotplug_dev,
*/
if (cpu->apic_id == UNASSIGNED_APIC_ID) {
int max_socket = (ms->smp.max_cpus - 1) /
- smp_threads / smp_cores / x86ms->smp_dies;
+ smp_threads / smp_cores / ms->smp.dies;
/*
* die-id was optional in QEMU 4.0 and older, so keep it optional
* if there's only one die per socket.
*/
- if (cpu->die_id < 0 && x86ms->smp_dies == 1) {
+ if (cpu->die_id < 0 && ms->smp.dies == 1) {
cpu->die_id = 0;
}
@@ -322,9 +322,9 @@ void x86_cpu_pre_plug(HotplugHandler *hotplug_dev,
if (cpu->die_id < 0) {
error_setg(errp, "CPU die-id is not set");
return;
- } else if (cpu->die_id > x86ms->smp_dies - 1) {
+ } else if (cpu->die_id > ms->smp.dies - 1) {
error_setg(errp, "Invalid CPU die-id: %u must be in range 0:%u",
- cpu->die_id, x86ms->smp_dies - 1);
+ cpu->die_id, ms->smp.dies - 1);
return;
}
if (cpu->core_id < 0) {
@@ -477,7 +477,7 @@ const CPUArchIdList *x86_possible_cpu_arch_ids(MachineState *ms)
&topo_info, &topo_ids);
ms->possible_cpus->cpus[i].props.has_socket_id = true;
ms->possible_cpus->cpus[i].props.socket_id = topo_ids.pkg_id;
- if (x86ms->smp_dies > 1) {
+ if (ms->smp.dies > 1) {
ms->possible_cpus->cpus[i].props.has_die_id = true;
ms->possible_cpus->cpus[i].props.die_id = topo_ids.die_id;
}
@@ -1269,7 +1269,6 @@ static void x86_machine_initfn(Object *obj)
x86ms->smm = ON_OFF_AUTO_AUTO;
x86ms->acpi = ON_OFF_AUTO_AUTO;
- x86ms->smp_dies = 1;
x86ms->pci_irq_mask = ACPI_BUILD_PCI_IRQS;
x86ms->oem_id = g_strndup(ACPI_BUILD_APPNAME6, 6);
x86ms->oem_table_id = g_strndup(ACPI_BUILD_APPNAME8, 8);
diff --git a/hw/scsi/scsi-generic.c b/hw/scsi/scsi-generic.c
index 40e0398..665baf9 100644
--- a/hw/scsi/scsi-generic.c
+++ b/hw/scsi/scsi-generic.c
@@ -179,10 +179,12 @@ static int scsi_handle_inquiry_reply(SCSIGenericReq *r, SCSIDevice *s, int len)
(r->req.cmd.buf[1] & 0x01)) {
page = r->req.cmd.buf[2];
if (page == 0xb0) {
- uint32_t max_transfer =
- blk_get_max_transfer(s->conf.blk) / s->blocksize;
+ uint64_t max_transfer = blk_get_max_hw_transfer(s->conf.blk);
+ uint32_t max_iov = blk_get_max_iov(s->conf.blk);
assert(max_transfer);
+ max_transfer = MIN_NON_ZERO(max_transfer, max_iov * qemu_real_host_page_size)
+ / s->blocksize;
stl_be_p(&r->buf[8], max_transfer);
/* Also take care of the opt xfer len. */
stl_be_p(&r->buf[12],
diff --git a/hw/usb/meson.build b/hw/usb/meson.build
index f357270..4f24b52 100644
--- a/hw/usb/meson.build
+++ b/hw/usb/meson.build
@@ -49,7 +49,7 @@ softmmu_ss.add(when: ['CONFIG_POSIX', 'CONFIG_USB_STORAGE_MTP'], if_true: files(
# smartcard
softmmu_ss.add(when: 'CONFIG_USB_SMARTCARD', if_true: files('dev-smartcard-reader.c'))
-if config_host.has_key('CONFIG_SMARTCARD')
+if cacard.found()
usbsmartcard_ss = ss.source_set()
usbsmartcard_ss.add(when: 'CONFIG_USB_SMARTCARD',
if_true: [cacard, files('ccid-card-emulated.c', 'ccid-card-passthru.c')])
@@ -64,7 +64,7 @@ if u2f.found()
endif
# usb redirect
-if config_host.has_key('CONFIG_USB_REDIR')
+if usbredir.found()
usbredir_ss = ss.source_set()
usbredir_ss.add(when: 'CONFIG_USB',
if_true: [usbredir, files('redirect.c', 'quirks.c')])
@@ -72,7 +72,7 @@ if config_host.has_key('CONFIG_USB_REDIR')
endif
# usb pass-through
-softmmu_ss.add(when: ['CONFIG_USB', 'CONFIG_USB_LIBUSB', libusb],
+softmmu_ss.add(when: ['CONFIG_USB', libusb],
if_true: files('host-libusb.c'),
if_false: files('host-stub.c'))
softmmu_ss.add(when: 'CONFIG_ALL', if_true: files('host-stub.c'))
diff --git a/include/block/block_int.h b/include/block/block_int.h
index 057d88b..f1a54db 100644
--- a/include/block/block_int.h
+++ b/include/block/block_int.h
@@ -695,6 +695,13 @@ typedef struct BlockLimits {
* clamped down. */
uint32_t max_transfer;
+ /* Maximal hardware transfer length in bytes. Applies whenever
+ * transfers to the device bypass the kernel I/O scheduler, for
+ * example with SG_IO. If larger than max_transfer or if zero,
+ * blk_get_max_hw_transfer will fall back to max_transfer.
+ */
+ uint64_t max_hw_transfer;
+
/* memory alignment, in bytes so that no bounce buffer is needed */
size_t min_mem_alignment;
diff --git a/include/hw/boards.h b/include/hw/boards.h
index 3d55d2b..1eae442 100644
--- a/include/hw/boards.h
+++ b/include/hw/boards.h
@@ -210,7 +210,7 @@ struct MachineClass {
void (*reset)(MachineState *state);
void (*wakeup)(MachineState *state);
int (*kvm_type)(MachineState *machine, const char *arg);
- void (*smp_parse)(MachineState *ms, QemuOpts *opts);
+ void (*smp_parse)(MachineState *ms, SMPConfiguration *config, Error **errp);
BlockInterfaceType block_default_type;
int units_per_default_bus;
@@ -282,6 +282,7 @@ typedef struct DeviceMemoryState {
*/
typedef struct CpuTopology {
unsigned int cpus;
+ unsigned int dies;
unsigned int cores;
unsigned int threads;
unsigned int sockets;
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index 1522a33..87294f2 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -19,7 +19,6 @@
* PCMachineState:
* @acpi_dev: link to ACPI PM device that performs ACPI hotplug handling
* @boot_cpus: number of present VCPUs
- * @smp_dies: number of dies per one package
*/
typedef struct PCMachineState {
/*< private >*/
@@ -139,8 +138,6 @@ extern int fd_bootchk;
void pc_acpi_smi_interrupt(void *opaque, int irq, int level);
-void pc_smp_parse(MachineState *ms, QemuOpts *opts);
-
void pc_guest_info_init(PCMachineState *pcms);
#define PCI_HOST_PROP_PCI_HOLE_START "pci-hole-start"
diff --git a/include/hw/i386/x86.h b/include/hw/i386/x86.h
index 25a1f16..6e9244a 100644
--- a/include/hw/i386/x86.h
+++ b/include/hw/i386/x86.h
@@ -62,7 +62,6 @@ struct X86MachineState {
unsigned pci_irq_mask;
unsigned apic_id_limit;
uint16_t boot_cpus;
- unsigned smp_dies;
OnOffAuto smm;
OnOffAuto acpi;
diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h
index 0a54bf7..c3656b7 100644
--- a/include/qemu/osdep.h
+++ b/include/qemu/osdep.h
@@ -319,11 +319,16 @@ extern "C" {
})
#endif
-/* Round number down to multiple */
+/*
+ * Round number down to multiple. Safe when m is not a power of 2 (see
+ * ROUND_DOWN for a faster version when a power of 2 is guaranteed).
+ */
#define QEMU_ALIGN_DOWN(n, m) ((n) / (m) * (m))
-/* Round number up to multiple. Safe when m is not a power of 2 (see
- * ROUND_UP for a faster version when a power of 2 is guaranteed) */
+/*
+ * Round number up to multiple. Safe when m is not a power of 2 (see
+ * ROUND_UP for a faster version when a power of 2 is guaranteed).
+ */
#define QEMU_ALIGN_UP(n, m) QEMU_ALIGN_DOWN((n) + (m) - 1, (m))
/* Check if n is a multiple of m */
@@ -340,11 +345,22 @@ extern "C" {
/* Check if pointer p is n-bytes aligned */
#define QEMU_PTR_IS_ALIGNED(p, n) QEMU_IS_ALIGNED((uintptr_t)(p), (n))
-/* Round number up to multiple. Requires that d be a power of 2 (see
+/*
+ * Round number down to multiple. Requires that d be a power of 2 (see
* QEMU_ALIGN_UP for a safer but slower version on arbitrary
- * numbers); works even if d is a smaller type than n. */
+ * numbers); works even if d is a smaller type than n.
+ */
+#ifndef ROUND_DOWN
+#define ROUND_DOWN(n, d) ((n) & -(0 ? (n) : (d)))
+#endif
+
+/*
+ * Round number up to multiple. Requires that d be a power of 2 (see
+ * QEMU_ALIGN_UP for a safer but slower version on arbitrary
+ * numbers); works even if d is a smaller type than n.
+ */
#ifndef ROUND_UP
-#define ROUND_UP(n, d) (((n) + (d) - 1) & -(0 ? (n) : (d)))
+#define ROUND_UP(n, d) ROUND_DOWN((n) + (d) - 1, (d))
#endif
#ifndef DIV_ROUND_UP
diff --git a/include/sysemu/block-backend.h b/include/sysemu/block-backend.h
index 5423e3d..9ac5f7b 100644
--- a/include/sysemu/block-backend.h
+++ b/include/sysemu/block-backend.h
@@ -208,6 +208,7 @@ void blk_eject(BlockBackend *blk, bool eject_flag);
int blk_get_flags(BlockBackend *blk);
uint32_t blk_get_request_alignment(BlockBackend *blk);
uint32_t blk_get_max_transfer(BlockBackend *blk);
+uint64_t blk_get_max_hw_transfer(BlockBackend *blk);
int blk_get_max_iov(BlockBackend *blk);
void blk_set_guest_block_size(BlockBackend *blk, int align);
void *blk_try_blockalign(BlockBackend *blk, size_t size);
diff --git a/meson.build b/meson.build
index a91b394..db6789a 100644
--- a/meson.build
+++ b/meson.build
@@ -183,7 +183,7 @@ if targetos == 'windows'
include_directories: include_directories('.'))
elif targetos == 'darwin'
coref = dependency('appleframeworks', modules: 'CoreFoundation')
- iokit = dependency('appleframeworks', modules: 'IOKit')
+ iokit = dependency('appleframeworks', modules: 'IOKit', required: false)
elif targetos == 'sunos'
socket = [cc.find_library('socket'),
cc.find_library('nsl'),
@@ -320,30 +320,11 @@ urcubp = not_found
if 'CONFIG_TRACE_UST' in config_host
urcubp = declare_dependency(link_args: config_host['URCU_BP_LIBS'].split())
endif
-gcrypt = not_found
-if 'CONFIG_GCRYPT' in config_host
- gcrypt = declare_dependency(compile_args: config_host['GCRYPT_CFLAGS'].split(),
- link_args: config_host['GCRYPT_LIBS'].split())
-endif
-nettle = not_found
-if 'CONFIG_NETTLE' in config_host
- nettle = declare_dependency(compile_args: config_host['NETTLE_CFLAGS'].split(),
- link_args: config_host['NETTLE_LIBS'].split())
-endif
-gnutls = not_found
-if 'CONFIG_GNUTLS' in config_host
- gnutls = declare_dependency(compile_args: config_host['GNUTLS_CFLAGS'].split(),
- link_args: config_host['GNUTLS_LIBS'].split())
-endif
pixman = not_found
if have_system or have_tools
pixman = dependency('pixman-1', required: have_system, version:'>=0.21.8',
method: 'pkg-config', kwargs: static_kwargs)
endif
-pam = not_found
-if 'CONFIG_AUTH_PAM' in config_host
- pam = cc.find_library('pam')
-endif
libaio = cc.find_library('aio', required: false)
zlib = dependency('zlib', required: true, kwargs: static_kwargs)
linux_io_uring = not_found
@@ -829,6 +810,54 @@ if 'CONFIG_OPENGL' in config_host
link_args: config_host['OPENGL_LIBS'].split())
endif
+gnutls = not_found
+if not get_option('gnutls').auto() or have_system
+ gnutls = dependency('gnutls', version: '>=3.5.18',
+ method: 'pkg-config',
+ required: get_option('gnutls'),
+ kwargs: static_kwargs)
+endif
+
+# Nettle has priority over gcrypt
+gcrypt = not_found
+nettle = not_found
+xts = 'private'
+if get_option('nettle').enabled() and get_option('gcrypt').enabled()
+ error('Only one of gcrypt & nettle can be enabled')
+elif (not get_option('nettle').auto() or have_system) and not get_option('gcrypt').enabled()
+ nettle = dependency('nettle', version: '>=3.4',
+ method: 'pkg-config',
+ required: get_option('nettle'),
+ kwargs: static_kwargs)
+ if nettle.found() and cc.has_header('nettle/xts.h', dependencies: nettle)
+ xts = 'nettle'
+ endif
+endif
+if (not get_option('gcrypt').auto() or have_system) and not nettle.found()
+ gcrypt = dependency('libgcrypt', version: '>=1.5',
+ method: 'config-tool',
+ required: get_option('gcrypt'),
+ kwargs: static_kwargs)
+ if gcrypt.found() and cc.compiles('''
+ #include <gcrypt.h>
+ int main(void) {
+ gcry_cipher_hd_t handle;
+ gcry_cipher_open(&handle, GCRY_CIPHER_AES, GCRY_CIPHER_MODE_XTS, 0);
+ return 0;
+ }
+ ''', dependencies: gcrypt)
+ xts = 'gcrypt'
+ endif
+ # Debian has removed -lgpg-error from libgcrypt-config
+ # as it "spreads unnecessary dependencies" which in
+ # turn breaks static builds...
+ if gcrypt.found() and enable_static
+ gcrypt = declare_dependency(dependencies: [
+ gcrypt,
+ cc.find_library('gpg-error', required: true, kwargs: static_kwargs)])
+ endif
+endif
+
gtk = not_found
gtkx11 = not_found
if not get_option('gtk').auto() or (have_system and not cocoa.found())
@@ -874,6 +903,31 @@ if get_option('vnc').enabled()
endif
endif
+pam = not_found
+if not get_option('auth_pam').auto() or have_system
+ pam = cc.find_library('pam', has_headers: ['security/pam_appl.h'],
+ required: get_option('auth_pam'),
+ kwargs: static_kwargs)
+endif
+if pam.found() and not cc.links('''
+ #include <stddef.h>
+ #include <security/pam_appl.h>
+ int main(void) {
+ const char *service_name = "qemu";
+ const char *user = "frank";
+ const struct pam_conv pam_conv = { 0 };
+ pam_handle_t *pamh = NULL;
+ pam_start(service_name, user, &pam_conv, &pamh);
+ return 0;
+ }''', dependencies: pam)
+ pam = not_found
+ if get_option('auth_pam').enabled()
+ error('could not link libpam')
+ else
+ warning('could not link libpam, disabling')
+ endif
+endif
+
snappy = not_found
if not get_option('snappy').auto() or have_system
snappy = cc.find_library('snappy', has_headers: ['snappy-c.h'],
@@ -922,9 +976,10 @@ if 'CONFIG_XEN_BACKEND' in config_host
link_args: config_host['XEN_LIBS'].split())
endif
cacard = not_found
-if 'CONFIG_SMARTCARD' in config_host
- cacard = declare_dependency(compile_args: config_host['SMARTCARD_CFLAGS'].split(),
- link_args: config_host['SMARTCARD_LIBS'].split())
+if not get_option('smartcard').auto() or have_system
+ cacard = dependency('libcacard', required: get_option('smartcard'),
+ version: '>=2.5.1', method: 'pkg-config',
+ kwargs: static_kwargs)
endif
u2f = not_found
if have_system
@@ -933,15 +988,18 @@ if have_system
kwargs: static_kwargs)
endif
usbredir = not_found
-if 'CONFIG_USB_REDIR' in config_host
- usbredir = declare_dependency(compile_args: config_host['USB_REDIR_CFLAGS'].split(),
- link_args: config_host['USB_REDIR_LIBS'].split())
+if not get_option('usb_redir').auto() or have_system
+ usbredir = dependency('libusbredirparser-0.5', required: get_option('usb_redir'),
+ version: '>=0.6', method: 'pkg-config',
+ kwargs: static_kwargs)
endif
libusb = not_found
-if 'CONFIG_USB_LIBUSB' in config_host
- libusb = declare_dependency(compile_args: config_host['LIBUSB_CFLAGS'].split(),
- link_args: config_host['LIBUSB_LIBS'].split())
+if not get_option('libusb').auto() or have_system
+ libusb = dependency('libusb-1.0', required: get_option('libusb'),
+ version: '>=1.0.13', method: 'pkg-config',
+ kwargs: static_kwargs)
endif
+
libpmem = not_found
if 'CONFIG_LIBPMEM' in config_host
libpmem = declare_dependency(compile_args: config_host['LIBPMEM_CFLAGS'].split(),
@@ -952,9 +1010,10 @@ if 'CONFIG_LIBDAXCTL' in config_host
libdaxctl = declare_dependency(link_args: config_host['LIBDAXCTL_LIBS'].split())
endif
tasn1 = not_found
-if 'CONFIG_TASN1' in config_host
- tasn1 = declare_dependency(compile_args: config_host['TASN1_CFLAGS'].split(),
- link_args: config_host['TASN1_LIBS'].split())
+if gnutls.found()
+ tasn1 = dependency('libtasn1',
+ method: 'pkg-config',
+ kwargs: static_kwargs)
endif
keyutils = dependency('libkeyutils', required: false,
method: 'pkg-config', kwargs: static_kwargs)
@@ -1089,6 +1148,9 @@ if get_option('cfi')
add_global_link_arguments(cfi_flags, native: false, language: ['c', 'cpp', 'objc'])
endif
+have_host_block_device = (targetos != 'darwin' or
+ cc.has_header('IOKit/storage/IOMedia.h'))
+
#################
# config-host.h #
#################
@@ -1156,6 +1218,7 @@ 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_USB_LIBUSB', libusb.found())
config_host_data.set('CONFIG_VHOST_USER_BLK_SERVER', have_vhost_user_blk_server)
config_host_data.set('CONFIG_VNC', vnc.found())
config_host_data.set('CONFIG_VNC_JPEG', jpeg.found())
@@ -1165,6 +1228,10 @@ config_host_data.set('CONFIG_VIRTFS', have_virtfs)
config_host_data.set('CONFIG_XKBCOMMON', xkbcommon.found())
config_host_data.set('CONFIG_KEYUTILS', keyutils.found())
config_host_data.set('CONFIG_GETTID', has_gettid)
+config_host_data.set('CONFIG_GNUTLS', gnutls.found())
+config_host_data.set('CONFIG_GCRYPT', gcrypt.found())
+config_host_data.set('CONFIG_NETTLE', nettle.found())
+config_host_data.set('CONFIG_QEMU_PRIVATE_XTS', xts == 'private')
config_host_data.set('CONFIG_MALLOC_TRIM', has_malloc_trim)
config_host_data.set('CONFIG_STATX', has_statx)
config_host_data.set('CONFIG_ZSTD', zstd.found())
@@ -1183,6 +1250,8 @@ config_host_data.set('HAVE_PTY_H', cc.has_header('pty.h'))
config_host_data.set('HAVE_SYS_IOCCOM_H', cc.has_header('sys/ioccom.h'))
config_host_data.set('HAVE_SYS_KCOV_H', cc.has_header('sys/kcov.h'))
config_host_data.set('HAVE_SYSTEM_FUNCTION', cc.has_function('system', prefix: '#include <stdlib.h>'))
+config_host_data.set('HAVE_HOST_BLOCK_DEVICE', have_host_block_device)
+config_host_data.set('HAVE_SYS_DISK_H', cc.has_header('sys/disk.h'))
config_host_data.set('CONFIG_PREADV', cc.has_function('preadv', prefix: '#include <sys/uio.h>'))
@@ -2565,7 +2634,6 @@ 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 += {'preadv support': config_host_data.get('CONFIG_PREADV')}
summary_info += {'fdatasync': config_host.has_key('CONFIG_FDATASYNC')}
summary_info += {'madvise': config_host.has_key('CONFIG_MADVISE')}
summary_info += {'posix_madvise': config_host.has_key('CONFIG_POSIX_MADVISE')}
@@ -2660,17 +2728,16 @@ summary(summary_info, bool_yn: true, section: 'Block layer support')
# Crypto
summary_info = {}
summary_info += {'TLS priority': config_host['CONFIG_TLS_PRIORITY']}
-summary_info += {'GNUTLS support': config_host.has_key('CONFIG_GNUTLS')}
+summary_info += {'GNUTLS support': gnutls.found()}
# TODO: add back version
-summary_info += {'libgcrypt': config_host.has_key('CONFIG_GCRYPT')}
-if config_host.has_key('CONFIG_GCRYPT')
- summary_info += {' hmac': config_host.has_key('CONFIG_GCRYPT_HMAC')}
- summary_info += {' XTS': not config_host.has_key('CONFIG_QEMU_PRIVATE_XTS')}
+summary_info += {'libgcrypt': gcrypt.found()}
+if gcrypt.found()
+ summary_info += {' XTS': xts != 'private'}
endif
# TODO: add back version
-summary_info += {'nettle': config_host.has_key('CONFIG_NETTLE')}
-if config_host.has_key('CONFIG_NETTLE')
- summary_info += {' XTS': not config_host.has_key('CONFIG_QEMU_PRIVATE_XTS')}
+summary_info += {'nettle': nettle.found()}
+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')}
@@ -2692,8 +2759,8 @@ summary_info += {'pixman': pixman.found()}
summary_info += {'VTE support': config_host.has_key('CONFIG_VTE')}
# TODO: add back version
summary_info += {'slirp support': slirp_opt == 'disabled' ? false : slirp_opt}
-summary_info += {'libtasn1': config_host.has_key('CONFIG_TASN1')}
-summary_info += {'PAM': config_host.has_key('CONFIG_AUTH_PAM')}
+summary_info += {'libtasn1': tasn1.found()}
+summary_info += {'PAM': pam.found()}
summary_info += {'iconv support': iconv.found()}
summary_info += {'curses support': curses.found()}
# TODO: add back version
@@ -2721,10 +2788,10 @@ summary_info += {'bpf support': libbpf.found()}
summary_info += {'spice support': config_host.has_key('CONFIG_SPICE')}
summary_info += {'rbd support': rbd.found()}
summary_info += {'xfsctl support': config_host.has_key('CONFIG_XFS')}
-summary_info += {'smartcard support': config_host.has_key('CONFIG_SMARTCARD')}
+summary_info += {'smartcard support': cacard.found()}
summary_info += {'U2F support': u2f.found()}
-summary_info += {'libusb': config_host.has_key('CONFIG_USB_LIBUSB')}
-summary_info += {'usb net redir': config_host.has_key('CONFIG_USB_REDIR')}
+summary_info += {'libusb': libusb.found()}
+summary_info += {'usb net redir': usbredir.found()}
summary_info += {'OpenGL support': config_host.has_key('CONFIG_OPENGL')}
summary_info += {'GBM': config_host.has_key('CONFIG_GBM')}
summary_info += {'libiscsi support': libiscsi.found()}
diff --git a/meson_options.txt b/meson_options.txt
index 3d304ca..f7ec9be 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -52,6 +52,8 @@ option('multiprocess', type: 'feature', value: 'auto',
option('attr', type : 'feature', value : 'auto',
description: 'attr/xattr support')
+option('auth_pam', type : 'feature', value : 'auto',
+ description: 'PAM access control')
option('brlapi', type : 'feature', value : 'auto',
description: 'brlapi character device driver')
option('bzip2', type : 'feature', value : 'auto',
@@ -76,8 +78,16 @@ option('iconv', type : 'feature', value : 'auto',
description: 'Font glyph conversion support')
option('curses', type : 'feature', value : 'auto',
description: 'curses UI')
+option('gnutls', type : 'feature', value : 'auto',
+ description: 'GNUTLS cryptography support')
+option('nettle', type : 'feature', value : 'auto',
+ description: 'nettle cryptography support')
+option('gcrypt', type : 'feature', value : 'auto',
+ description: 'libgcrypt cryptography support')
option('libudev', type : 'feature', value : 'auto',
description: 'Use libudev to enumerate host devices')
+option('libusb', type : 'feature', value : 'auto',
+ description: 'libusb support for USB passthrough')
option('lzfse', type : 'feature', value : 'auto',
description: 'lzfse support for DMG images')
option('lzo', type : 'feature', value : 'auto',
@@ -92,10 +102,14 @@ option('sdl_image', type : 'feature', value : 'auto',
description: 'SDL Image support for icons')
option('seccomp', type : 'feature', value : 'auto',
description: 'seccomp support')
+option('smartcard', type : 'feature', value : 'auto',
+ description: 'CA smartcard emulation support')
option('snappy', type : 'feature', value : 'auto',
description: 'snappy compression support')
option('u2f', type : 'feature', value : 'auto',
description: 'U2F emulation support')
+option('usb_redir', type : 'feature', value : 'auto',
+ description: 'libusbredir support')
option('vnc', type : 'feature', value : 'enabled',
description: 'VNC server')
option('vnc_jpeg', type : 'feature', value : 'auto',
diff --git a/qapi/block-core.json b/qapi/block-core.json
index 2ea2941..a54f37d 100644
--- a/qapi/block-core.json
+++ b/qapi/block-core.json
@@ -897,7 +897,8 @@
'discriminator': 'driver',
'data': {
'file': 'BlockStatsSpecificFile',
- 'host_device': 'BlockStatsSpecificFile',
+ 'host_device': { 'type': 'BlockStatsSpecificFile',
+ 'if': 'defined(HAVE_HOST_BLOCK_DEVICE)' },
'nvme': 'BlockStatsSpecificNvme' } }
##
@@ -2814,7 +2815,10 @@
{ 'enum': 'BlockdevDriver',
'data': [ 'blkdebug', 'blklogwrites', 'blkreplay', 'blkverify', 'bochs',
'cloop', 'compress', 'copy-on-read', 'dmg', 'file', 'ftp', 'ftps',
- 'gluster', 'host_cdrom', 'host_device', 'http', 'https', 'iscsi',
+ 'gluster',
+ {'name': 'host_cdrom', 'if': 'defined(HAVE_HOST_BLOCK_DEVICE)' },
+ {'name': 'host_device', 'if': 'defined(HAVE_HOST_BLOCK_DEVICE)' },
+ 'http', 'https', 'iscsi',
'luks', 'nbd', 'nfs', 'null-aio', 'null-co', 'nvme', 'parallels',
'preallocate', 'qcow', 'qcow2', 'qed', 'quorum', 'raw', 'rbd',
{ 'name': 'replication', 'if': 'defined(CONFIG_REPLICATION)' },
@@ -3995,8 +3999,10 @@
'ftp': 'BlockdevOptionsCurlFtp',
'ftps': 'BlockdevOptionsCurlFtps',
'gluster': 'BlockdevOptionsGluster',
- 'host_cdrom': 'BlockdevOptionsFile',
- 'host_device':'BlockdevOptionsFile',
+ 'host_cdrom': { 'type': 'BlockdevOptionsFile',
+ 'if': 'defined(HAVE_HOST_BLOCK_DEVICE)' },
+ 'host_device': { 'type': 'BlockdevOptionsFile',
+ 'if': 'defined(HAVE_HOST_BLOCK_DEVICE)' },
'http': 'BlockdevOptionsCurlHttp',
'https': 'BlockdevOptionsCurlHttps',
'iscsi': 'BlockdevOptionsIscsi',
diff --git a/qapi/machine.json b/qapi/machine.json
index e4d0f9b..c3210ee 100644
--- a/qapi/machine.json
+++ b/qapi/machine.json
@@ -1284,3 +1284,31 @@
##
{ 'event': 'MEM_UNPLUG_ERROR',
'data': { 'device': 'str', 'msg': 'str' } }
+
+##
+# @SMPConfiguration:
+#
+# Schema for CPU topology configuration. "0" or a missing value lets
+# QEMU figure out a suitable value based on the ones that are provided.
+#
+# @cpus: number of virtual CPUs in the virtual machine
+#
+# @sockets: number of sockets in the CPU topology
+#
+# @dies: number of dies per socket in the CPU topology
+#
+# @cores: number of cores per thread in the CPU topology
+#
+# @threads: number of threads per core in the CPU topology
+#
+# @maxcpus: maximum number of hotpluggable virtual CPUs in the virtual machine
+#
+# Since: 6.1
+##
+{ 'struct': 'SMPConfiguration', 'data': {
+ '*cpus': 'int',
+ '*sockets': 'int',
+ '*dies': 'int',
+ '*cores': 'int',
+ '*threads': 'int',
+ '*maxcpus': 'int' } }
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index a9fe166..d8f3ab3 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -1031,7 +1031,7 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = {
"vmx-invpcid-exit", "vmx-vmfunc", "vmx-shadow-vmcs", "vmx-encls-exit",
"vmx-rdseed-exit", "vmx-pml", NULL, NULL,
"vmx-xsaves", NULL, NULL, NULL,
- NULL, NULL, NULL, NULL,
+ NULL, "vmx-tsc-scaling", NULL, NULL,
NULL, NULL, NULL, NULL,
},
.msr = {
diff --git a/target/i386/cpu.h b/target/i386/cpu.h
index 1e11071..f7fa587 100644
--- a/target/i386/cpu.h
+++ b/target/i386/cpu.h
@@ -972,6 +972,7 @@ typedef uint64_t FeatureWordArray[FEATURE_WORDS];
#define VMX_SECONDARY_EXEC_RDSEED_EXITING 0x00010000
#define VMX_SECONDARY_EXEC_ENABLE_PML 0x00020000
#define VMX_SECONDARY_EXEC_XSAVES 0x00100000
+#define VMX_SECONDARY_EXEC_TSC_SCALING 0x02000000
#define VMX_PIN_BASED_EXT_INTR_MASK 0x00000001
#define VMX_PIN_BASED_NMI_EXITING 0x00000008
diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c
index ad950c3..04e4ec0 100644
--- a/target/i386/kvm/kvm.c
+++ b/target/i386/kvm/kvm.c
@@ -2700,8 +2700,6 @@ static uint64_t make_vmx_msr_value(uint32_t index, uint32_t features)
return must_be_one | (((uint64_t)can_be_one) << 32);
}
-#define VMCS12_MAX_FIELD_INDEX (0x17)
-
static void kvm_msr_entry_add_vmx(X86CPU *cpu, FeatureWordArray f)
{
uint64_t kvm_vmx_basic =
@@ -2791,8 +2789,14 @@ static void kvm_msr_entry_add_vmx(X86CPU *cpu, FeatureWordArray f)
CR0_PE_MASK | CR0_PG_MASK | CR0_NE_MASK);
kvm_msr_entry_add(cpu, MSR_IA32_VMX_CR4_FIXED0,
CR4_VMXE_MASK);
- kvm_msr_entry_add(cpu, MSR_IA32_VMX_VMCS_ENUM,
- VMCS12_MAX_FIELD_INDEX << 1);
+
+ if (f[FEAT_VMX_SECONDARY_CTLS] & VMX_SECONDARY_EXEC_TSC_SCALING) {
+ /* TSC multiplier (0x2032). */
+ kvm_msr_entry_add(cpu, MSR_IA32_VMX_VMCS_ENUM, 0x32);
+ } else {
+ /* Preemption timer (0x482E). */
+ kvm_msr_entry_add(cpu, MSR_IA32_VMX_VMCS_ENUM, 0x2E);
+ }
}
static void kvm_msr_entry_add_perf(X86CPU *cpu, FeatureWordArray f)
diff --git a/tests/unit/crypto-tls-psk-helpers.c b/tests/unit/crypto-tls-psk-helpers.c
index a839547..7f8a488 100644
--- a/tests/unit/crypto-tls-psk-helpers.c
+++ b/tests/unit/crypto-tls-psk-helpers.c
@@ -20,14 +20,10 @@
#include "qemu/osdep.h"
-/* Include this first because it defines QCRYPTO_HAVE_TLS_TEST_SUPPORT */
#include "crypto-tls-x509-helpers.h"
-
#include "crypto-tls-psk-helpers.h"
#include "qemu/sockets.h"
-#ifdef QCRYPTO_HAVE_TLS_TEST_SUPPORT
-
void test_tls_psk_init(const char *pskfile)
{
FILE *fp;
@@ -46,5 +42,3 @@ void test_tls_psk_cleanup(const char *pskfile)
{
unlink(pskfile);
}
-
-#endif /* QCRYPTO_HAVE_TLS_TEST_SUPPORT */
diff --git a/tests/unit/crypto-tls-psk-helpers.h b/tests/unit/crypto-tls-psk-helpers.h
index 5aa9951..faa645c 100644
--- a/tests/unit/crypto-tls-psk-helpers.h
+++ b/tests/unit/crypto-tls-psk-helpers.h
@@ -23,11 +23,7 @@
#include <gnutls/gnutls.h>
-#ifdef QCRYPTO_HAVE_TLS_TEST_SUPPORT
-
void test_tls_psk_init(const char *keyfile);
void test_tls_psk_cleanup(const char *keyfile);
-#endif /* QCRYPTO_HAVE_TLS_TEST_SUPPORT */
-
#endif
diff --git a/tests/unit/crypto-tls-x509-helpers.c b/tests/unit/crypto-tls-x509-helpers.c
index 9765859..fc609b3 100644
--- a/tests/unit/crypto-tls-x509-helpers.c
+++ b/tests/unit/crypto-tls-x509-helpers.c
@@ -24,8 +24,6 @@
#include "crypto/init.h"
#include "qemu/sockets.h"
-#ifdef QCRYPTO_HAVE_TLS_TEST_SUPPORT
-
/*
* This stores some static data that is needed when
* encoding extensions in the x509 certs
@@ -504,5 +502,3 @@ void test_tls_discard_cert(QCryptoTLSTestCertReq *req)
unlink(req->filename);
}
}
-
-#endif /* QCRYPTO_HAVE_TLS_TEST_SUPPORT */
diff --git a/tests/unit/crypto-tls-x509-helpers.h b/tests/unit/crypto-tls-x509-helpers.h
index 8fcd778..cf6329e 100644
--- a/tests/unit/crypto-tls-x509-helpers.h
+++ b/tests/unit/crypto-tls-x509-helpers.h
@@ -23,14 +23,7 @@
#include <gnutls/gnutls.h>
#include <gnutls/x509.h>
-
-#if !(defined WIN32) && \
- defined(CONFIG_TASN1)
-# define QCRYPTO_HAVE_TLS_TEST_SUPPORT
-#endif
-
-#ifdef QCRYPTO_HAVE_TLS_TEST_SUPPORT
-# include <libtasn1.h>
+#include <libtasn1.h>
/*
@@ -127,6 +120,4 @@ void test_tls_cleanup(const char *keyfile);
extern const asn1_static_node pkix_asn1_tab[];
-#endif /* QCRYPTO_HAVE_TLS_TEST_SUPPORT */
-
#endif
diff --git a/tests/unit/meson.build b/tests/unit/meson.build
index b3bc210..3e0504d 100644
--- a/tests/unit/meson.build
+++ b/tests/unit/meson.build
@@ -83,8 +83,8 @@ if have_block
'test-crypto-afsplit': [io],
'test-crypto-block': [io],
}
- if 'CONFIG_GNUTLS' in config_host and \
- 'CONFIG_TASN1' in config_host and \
+ if gnutls.found() and \
+ tasn1.found() and \
'CONFIG_POSIX' in config_host
tests += {
'test-crypto-tlscredsx509': ['crypto-tls-x509-helpers.c', 'pkix_asn1_tab.c',
@@ -94,10 +94,10 @@ if have_block
'test-io-channel-tls': ['io-channel-helpers.c', 'crypto-tls-x509-helpers.c', 'pkix_asn1_tab.c',
tasn1, io, crypto, gnutls]}
endif
- if 'CONFIG_AUTH_PAM' in config_host
+ if pam.found()
tests += {'test-authz-pam': [authz]}
endif
- if 'CONFIG_QEMU_PRIVATE_XTS' in config_host
+ if xts == 'private'
tests += {'test-crypto-xts': [crypto, io]}
endif
if 'CONFIG_POSIX' in config_host
@@ -106,7 +106,7 @@ if have_block
if 'CONFIG_REPLICATION' in config_host
tests += {'test-replication': [testblock]}
endif
- if 'CONFIG_NETTLE' in config_host or 'CONFIG_GCRYPT' in config_host
+ if nettle.found() or gcrypt.found()
tests += {'test-crypto-pbkdf': [io]}
endif
if 'CONFIG_EPOLL_CREATE1' in config_host
diff --git a/tests/unit/pkix_asn1_tab.c b/tests/unit/pkix_asn1_tab.c
index 15397cf..8952140 100644
--- a/tests/unit/pkix_asn1_tab.c
+++ b/tests/unit/pkix_asn1_tab.c
@@ -6,8 +6,6 @@
#include "qemu/osdep.h"
#include "crypto-tls-x509-helpers.h"
-#ifdef QCRYPTO_HAVE_TLS_TEST_SUPPORT
-
const asn1_static_node pkix_asn1_tab[] = {
{"PKIX1", 536875024, 0},
{0, 1073741836, 0},
@@ -1105,4 +1103,3 @@ const asn1_static_node pkix_asn1_tab[] = {
{0, 1048586, "2"},
{0, 0, 0}
};
-#endif /* QCRYPTO_HAVE_TLS_TEST_SUPPORT */
diff --git a/tests/unit/test-crypto-tlscredsx509.c b/tests/unit/test-crypto-tlscredsx509.c
index f487349..aab4149 100644
--- a/tests/unit/test-crypto-tlscredsx509.c
+++ b/tests/unit/test-crypto-tlscredsx509.c
@@ -25,8 +25,6 @@
#include "qapi/error.h"
#include "qemu/module.h"
-#ifdef QCRYPTO_HAVE_TLS_TEST_SUPPORT
-
#define WORKDIR "tests/test-crypto-tlscredsx509-work/"
#define KEYFILE WORKDIR "key-ctx.pem"
@@ -706,13 +704,3 @@ int main(int argc, char **argv)
return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
}
-
-#else /* ! QCRYPTO_HAVE_TLS_TEST_SUPPORT */
-
-int
-main(void)
-{
- return EXIT_SUCCESS;
-}
-
-#endif /* ! QCRYPTO_HAVE_TLS_TEST_SUPPORT */
diff --git a/tests/unit/test-crypto-tlssession.c b/tests/unit/test-crypto-tlssession.c
index 8b2453f..5f0da91 100644
--- a/tests/unit/test-crypto-tlssession.c
+++ b/tests/unit/test-crypto-tlssession.c
@@ -31,8 +31,6 @@
#include "qemu/sockets.h"
#include "authz/list.h"
-#ifdef QCRYPTO_HAVE_TLS_TEST_SUPPORT
-
#define WORKDIR "tests/test-crypto-tlssession-work/"
#define PSKFILE WORKDIR "keys.psk"
#define KEYFILE WORKDIR "key-ctx.pem"
@@ -648,13 +646,3 @@ int main(int argc, char **argv)
return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
}
-
-#else /* ! QCRYPTO_HAVE_TLS_TEST_SUPPORT */
-
-int
-main(void)
-{
- return EXIT_SUCCESS;
-}
-
-#endif /* ! QCRYPTO_HAVE_TLS_TEST_SUPPORT */
diff --git a/tests/unit/test-io-channel-tls.c b/tests/unit/test-io-channel-tls.c
index ad7554c..f6fb988 100644
--- a/tests/unit/test-io-channel-tls.c
+++ b/tests/unit/test-io-channel-tls.c
@@ -34,8 +34,6 @@
#include "authz/list.h"
#include "qom/object_interfaces.h"
-#ifdef QCRYPTO_HAVE_TLS_TEST_SUPPORT
-
#define WORKDIR "tests/test-io-channel-tls-work/"
#define KEYFILE WORKDIR "key-ctx.pem"
@@ -334,13 +332,3 @@ int main(int argc, char **argv)
return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
}
-
-#else /* ! QCRYPTO_HAVE_TLS_TEST_SUPPORT */
-
-int
-main(void)
-{
- return EXIT_SUCCESS;
-}
-
-#endif /* ! QCRYPTO_HAVE_TLS_TEST_SUPPORT */