* Atomic memslot updates for KVM (Emanuele, David)

* Always send errors to logfile when daemonized (Greg)
 * Add support for IDE CompactFlash card (Lubomir)
 * First round of build system cleanups (myself)
 * First round of feature removals (myself)
 * Reduce "qemu/accel.h" inclusion (Philippe)
 -----BEGIN PGP SIGNATURE-----
 
 iQFIBAABCAAyFiEE8TM4V0tmI4mGbHaCv/vSX3jHroMFAmO3Ym0UHHBib256aW5p
 QHJlZGhhdC5jb20ACgkQv/vSX3jHroNYmwf+LHEw+4T0fk1+2NfgIzH3+8s1EqDm
 Ai56EjxO/p5NUptflXAnhn4P3LawswmmNE0ZIFFFBgwG5E9L+Jj/u5efuLu4uYPg
 bboEBDn8nxSNN2l08u9TyS6kSWSxbwwrs7i2+V+4uQIlVIcCHu+A0vpXns4vWwY0
 zZGF8CgJKDQdPIxdXrH8+6/xtadQ8uDkYsAWDiY/nhozCsCUTAZGTXWEQbHJLARI
 Z4X+Cmz/NFB9G4ka6K/y0HbQw99KA8G/EMPUSglN0ya10yjpyzrmeI7IlIves+5U
 8lhCZXyBhaV9GXlIK1vIgEXlHf83C19a+v0DpW0bpxK631n2VR5y3CArBg==
 =2Koq
 -----END PGP SIGNATURE-----

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

* Atomic memslot updates for KVM (Emanuele, David)
* Always send errors to logfile when daemonized (Greg)
* Add support for IDE CompactFlash card (Lubomir)
* First round of build system cleanups (myself)
* First round of feature removals (myself)
* Reduce "qemu/accel.h" inclusion (Philippe)

# gpg: Signature made Thu 05 Jan 2023 23:51:09 GMT
# gpg:                using RSA key F13338574B662389866C7682BFFBD25F78C7AE83
# gpg:                issuer "pbonzini@redhat.com"
# gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>" [full]
# gpg:                 aka "Paolo Bonzini <pbonzini@redhat.com>" [full]
# Primary key fingerprint: 46F5 9FBD 57D6 12E7 BFD4  E2F7 7E15 100C CD36 69B1
#      Subkey fingerprint: F133 3857 4B66 2389 866C  7682 BFFB D25F 78C7 AE83

* tag 'for-upstream' of https://gitlab.com/bonzini/qemu: (24 commits)
  i386: SGX: remove deprecated member of SGXInfo
  target/i386: Add SGX aex-notify and EDECCSSA support
  util: remove support -chardev tty and -chardev parport
  util: remove support for hex numbers with a scaling suffix
  KVM: remove support for kernel-irqchip=off
  docs: do not talk about past removal as happening in the future
  meson: accept relative symlinks in "meson introspect --installed" data
  meson: cleanup compiler detection
  meson: support meson 0.64 -Doptimization=plain
  configure: test all warnings
  tests/qapi-schema: remove Meson workaround
  meson: cleanup dummy-cpus.c rules
  meson: tweak hardening options for Windows
  configure: remove backwards-compatibility and obsolete options
  configure: preserve qemu-ga variables
  configure: cleanup $cpu tests
  configure: remove dead function
  configure: remove useless write_c_skeleton
  ide: Add "ide-cf" driver, a CompactFlash card
  ide: Add 8-bit data mode
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2023-01-08 14:27:40 +00:00
commit 3d83b78285
28 changed files with 272 additions and 269 deletions

View File

@ -11,10 +11,5 @@ if have_system
subdir('stubs') subdir('stubs')
endif endif
dummy_ss = ss.source_set() # qtest
dummy_ss.add(files( softmmu_ss.add(files('dummy-cpus.c'))
'dummy-cpus.c',
))
specific_ss.add_all(when: ['CONFIG_SOFTMMU'], if_true: dummy_ss)
specific_ss.add_all(when: ['CONFIG_XEN'], if_true: dummy_ss)

View File

@ -530,19 +530,6 @@ static const ChardevClass *char_get_class(const char *driver, Error **errp)
return cc; return cc;
} }
static struct ChardevAlias {
const char *typename;
const char *alias;
bool deprecation_warning_printed;
} chardev_alias_table[] = {
#ifdef HAVE_CHARDEV_PARPORT
{ "parallel", "parport" },
#endif
#ifdef HAVE_CHARDEV_SERIAL
{ "serial", "tty" },
#endif
};
typedef struct ChadevClassFE { typedef struct ChadevClassFE {
void (*fn)(const char *name, void *opaque); void (*fn)(const char *name, void *opaque);
void *opaque; void *opaque;
@ -578,28 +565,12 @@ help_string_append(const char *name, void *opaque)
g_string_append_printf(str, "\n %s", name); g_string_append_printf(str, "\n %s", name);
} }
static const char *chardev_alias_translate(const char *name)
{
int i;
for (i = 0; i < (int)ARRAY_SIZE(chardev_alias_table); i++) {
if (g_strcmp0(chardev_alias_table[i].alias, name) == 0) {
if (!chardev_alias_table[i].deprecation_warning_printed) {
warn_report("The alias '%s' is deprecated, use '%s' instead",
name, chardev_alias_table[i].typename);
chardev_alias_table[i].deprecation_warning_printed = true;
}
return chardev_alias_table[i].typename;
}
}
return name;
}
ChardevBackend *qemu_chr_parse_opts(QemuOpts *opts, Error **errp) ChardevBackend *qemu_chr_parse_opts(QemuOpts *opts, Error **errp)
{ {
Error *local_err = NULL; Error *local_err = NULL;
const ChardevClass *cc; const ChardevClass *cc;
ChardevBackend *backend = NULL; ChardevBackend *backend = NULL;
const char *name = chardev_alias_translate(qemu_opt_get(opts, "backend")); const char *name = qemu_opt_get(opts, "backend");
if (name == NULL) { if (name == NULL) {
error_setg(errp, "chardev: \"%s\" missing backend", error_setg(errp, "chardev: \"%s\" missing backend",
@ -637,7 +608,7 @@ Chardev *qemu_chr_new_from_opts(QemuOpts *opts, GMainContext *context,
const ChardevClass *cc; const ChardevClass *cc;
Chardev *chr = NULL; Chardev *chr = NULL;
ChardevBackend *backend = NULL; ChardevBackend *backend = NULL;
const char *name = chardev_alias_translate(qemu_opt_get(opts, "backend")); const char *name = qemu_opt_get(opts, "backend");
const char *id = qemu_opts_id(opts); const char *id = qemu_opts_id(opts);
char *bid = NULL; char *bid = NULL;

74
configure vendored
View File

@ -211,10 +211,6 @@ version_ge () {
done done
} }
glob() {
eval test -z '"${1#'"$2"'}"'
}
if printf %s\\n "$source_path" "$PWD" | grep -q "[[:space:]:]"; if printf %s\\n "$source_path" "$PWD" | grep -q "[[:space:]:]";
then then
error_exit "main directory cannot contain spaces nor colons" error_exit "main directory cannot contain spaces nor colons"
@ -342,9 +338,6 @@ for opt do
;; ;;
esac esac
done done
# OS specific
# Using uname is really, really broken. Once we have the right set of checks
# we can eliminate its usage altogether.
# Preferred compiler: # Preferred compiler:
# ${CC} (if set) # ${CC} (if set)
@ -387,8 +380,6 @@ sdl2_config="${SDL2_CONFIG-${cross_prefix}sdl2-config}"
# 2s-complement style results. (Both clang and gcc agree that it # 2s-complement style results. (Both clang and gcc agree that it
# provides these semantics.) # provides these semantics.)
QEMU_CFLAGS="-fno-strict-aliasing -fno-common -fwrapv" QEMU_CFLAGS="-fno-strict-aliasing -fno-common -fwrapv"
QEMU_CFLAGS="-Wundef -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS"
QEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS"
QEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS" QEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS"
QEMU_LDFLAGS= QEMU_LDFLAGS=
@ -495,13 +486,6 @@ sunos)
QEMU_CFLAGS="-D_XOPEN_SOURCE=600 $QEMU_CFLAGS" QEMU_CFLAGS="-D_XOPEN_SOURCE=600 $QEMU_CFLAGS"
# needed for TIOCWIN* defines in termios.h # needed for TIOCWIN* defines in termios.h
QEMU_CFLAGS="-D__EXTENSIONS__ $QEMU_CFLAGS" QEMU_CFLAGS="-D__EXTENSIONS__ $QEMU_CFLAGS"
# $(uname -m) returns i86pc even on an x86_64 box, so default based on isainfo
# Note that this check is broken for cross-compilation: if you're
# cross-compiling to one of these OSes then you'll need to specify
# the correct CPU with the --cpu option.
if test -z "$cpu" && test "$(isainfo -k)" = "amd64"; then
cpu="x86_64"
fi
;; ;;
haiku) haiku)
pie="no" pie="no"
@ -556,16 +540,21 @@ elif check_define __aarch64__ ; then
elif check_define __loongarch64 ; then elif check_define __loongarch64 ; then
cpu="loongarch64" cpu="loongarch64"
else else
# Using uname is really broken, but it is just a fallback for architectures
# that are going to use TCI anyway
cpu=$(uname -m) cpu=$(uname -m)
echo "WARNING: unrecognized host CPU, proceeding with 'uname -m' output '$cpu'"
fi fi
# Normalise host CPU name, set multilib cflags # Normalise host CPU name and set multilib cflags. The canonicalization
# isn't really necessary, because the architectures that we check for
# should not hit the 'uname -m' case, but better safe than sorry.
# Note that this case should only have supported host CPUs, not guests. # Note that this case should only have supported host CPUs, not guests.
case "$cpu" in case "$cpu" in
armv*b|armv*l|arm) armv*b|armv*l|arm)
cpu="arm" ;; cpu="arm" ;;
i386|i486|i586|i686|i86pc|BePC) i386|i486|i586|i686)
cpu="i386" cpu="i386"
CPU_CFLAGS="-m32" ;; CPU_CFLAGS="-m32" ;;
x32) x32)
@ -640,7 +629,6 @@ if test "$mingw32" = "yes" ; then
EXESUF=".exe" EXESUF=".exe"
# MinGW needs -mthreads for TLS and macro _MT. # MinGW needs -mthreads for TLS and macro _MT.
CONFIGURE_CFLAGS="-mthreads $CONFIGURE_CFLAGS" CONFIGURE_CFLAGS="-mthreads $CONFIGURE_CFLAGS"
write_c_skeleton;
prefix="/qemu" prefix="/qemu"
bindir="" bindir=""
qemu_suffix="" qemu_suffix=""
@ -855,17 +843,6 @@ for opt do
;; ;;
--with-coroutine=*) coroutine="$optarg" --with-coroutine=*) coroutine="$optarg"
;; ;;
--disable-zlib-test)
;;
--disable-virtio-blk-data-plane|--enable-virtio-blk-data-plane)
echo "$0: $opt is obsolete, virtio-blk data-plane is always on" >&2
;;
--enable-vhdx|--disable-vhdx)
echo "$0: $opt is obsolete, VHDX driver is always built" >&2
;;
--enable-uuid|--disable-uuid)
echo "$0: $opt is obsolete, UUID support is always built" >&2
;;
--with-git=*) git="$optarg" --with-git=*) git="$optarg"
;; ;;
--with-git-submodules=*) --with-git-submodules=*)
@ -885,19 +862,10 @@ for opt do
;; ;;
--gdb=*) gdb_bin="$optarg" --gdb=*) gdb_bin="$optarg"
;; ;;
# backwards compatibility options
--enable-trace-backend=*) meson_option_parse "--enable-trace-backends=$optarg" "$optarg"
;;
--disable-blobs) meson_option_parse --disable-install-blobs ""
;;
--enable-vfio-user-server) vfio_user_server="enabled" --enable-vfio-user-server) vfio_user_server="enabled"
;; ;;
--disable-vfio-user-server) vfio_user_server="disabled" --disable-vfio-user-server) vfio_user_server="disabled"
;; ;;
--enable-tcmalloc) meson_option_parse --enable-malloc=tcmalloc tcmalloc
;;
--enable-jemalloc) meson_option_parse --enable-malloc=jemalloc jemalloc
;;
# everything else has the same name in configure and meson # everything else has the same name in configure and meson
--*) meson_option_parse "$opt" "$optarg" --*) meson_option_parse "$opt" "$optarg"
;; ;;
@ -1198,6 +1166,11 @@ fi
# just silently disable some features, so it's too error prone. # just silently disable some features, so it's too error prone.
warn_flags= warn_flags=
add_to warn_flags -Wundef
add_to warn_flags -Wwrite-strings
add_to warn_flags -Wmissing-prototypes
add_to warn_flags -Wstrict-prototypes
add_to warn_flags -Wredundant-decls
add_to warn_flags -Wold-style-declaration add_to warn_flags -Wold-style-declaration
add_to warn_flags -Wold-style-definition add_to warn_flags -Wold-style-definition
add_to warn_flags -Wtype-limits add_to warn_flags -Wtype-limits
@ -2237,20 +2210,6 @@ if test "$have_ubsan" = "yes"; then
QEMU_LDFLAGS="-fsanitize=undefined $QEMU_LDFLAGS" QEMU_LDFLAGS="-fsanitize=undefined $QEMU_LDFLAGS"
fi fi
##########################################
# Guest agent Windows MSI package
if test "$QEMU_GA_MANUFACTURER" = ""; then
QEMU_GA_MANUFACTURER=QEMU
fi
if test "$QEMU_GA_DISTRO" = ""; then
QEMU_GA_DISTRO=Linux
fi
if test "$QEMU_GA_VERSION" = ""; then
QEMU_GA_VERSION=$(cat "$source_path"/VERSION)
fi
####################################### #######################################
# cross-compiled firmware targets # cross-compiled firmware targets
@ -2346,9 +2305,9 @@ if test "$debug_tcg" = "yes" ; then
fi fi
if test "$mingw32" = "yes" ; then if test "$mingw32" = "yes" ; then
echo "CONFIG_WIN32=y" >> $config_host_mak echo "CONFIG_WIN32=y" >> $config_host_mak
echo "QEMU_GA_MANUFACTURER=${QEMU_GA_MANUFACTURER}" >> $config_host_mak echo "QEMU_GA_MANUFACTURER=${QEMU_GA_MANUFACTURER-QEMU}" >> $config_host_mak
echo "QEMU_GA_DISTRO=${QEMU_GA_DISTRO}" >> $config_host_mak echo "QEMU_GA_DISTRO=${QEMU_GA_DISTRO-Linux}" >> $config_host_mak
echo "QEMU_GA_VERSION=${QEMU_GA_VERSION}" >> $config_host_mak echo "QEMU_GA_VERSION=${QEMU_GA_VERSION-$(cat "$source_path"/VERSION)}" >> $config_host_mak
else else
echo "CONFIG_POSIX=y" >> $config_host_mak echo "CONFIG_POSIX=y" >> $config_host_mak
fi fi
@ -2663,6 +2622,9 @@ preserve_env PKG_CONFIG
preserve_env PKG_CONFIG_LIBDIR preserve_env PKG_CONFIG_LIBDIR
preserve_env PKG_CONFIG_PATH preserve_env PKG_CONFIG_PATH
preserve_env PYTHON preserve_env PYTHON
preserve_env QEMU_GA_MANUFACTURER
preserve_env QEMU_GA_DISTRO
preserve_env QEMU_GA_VERSION
preserve_env SDL2_CONFIG preserve_env SDL2_CONFIG
preserve_env SMBD preserve_env SMBD
preserve_env STRIP preserve_env STRIP

View File

@ -39,12 +39,6 @@ should specify an ``audiodev=`` property. Additionally, when using
vnc, you should specify an ``audiodev=`` property if you plan to vnc, you should specify an ``audiodev=`` property if you plan to
transmit audio through the VNC protocol. transmit audio through the VNC protocol.
``-chardev`` backend aliases ``tty`` and ``parport`` (since 6.0)
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
``tty`` and ``parport`` are aliases that will be removed. Instead, the
actual backend names ``serial`` and ``parallel`` should be used.
Short-form boolean options (since 6.0) Short-form boolean options (since 6.0)
'''''''''''''''''''''''''''''''''''''' ''''''''''''''''''''''''''''''''''''''
@ -58,21 +52,6 @@ and will cause a warning.
The replacement for the ``nodelay`` short-form boolean option is ``nodelay=on`` The replacement for the ``nodelay`` short-form boolean option is ``nodelay=on``
rather than ``delay=off``. rather than ``delay=off``.
Userspace local APIC with KVM (x86, since 6.0)
''''''''''''''''''''''''''''''''''''''''''''''
Using ``-M kernel-irqchip=off`` with x86 machine types that include a local
APIC is deprecated. The ``split`` setting is supported, as is using
``-M kernel-irqchip=off`` with the ISA PC machine type.
hexadecimal sizes with scaling multipliers (since 6.0)
''''''''''''''''''''''''''''''''''''''''''''''''''''''
Input parameters that take a size value should only use a size suffix
(such as 'k' or 'M') when the base is written in decimal, and not when
the value is hexadecimal. That is, '0x20M' is deprecated, and should
be written either as '32M' or as '0x2000000'.
``-spice password=string`` (since 6.0) ``-spice password=string`` (since 6.0)
'''''''''''''''''''''''''''''''''''''' ''''''''''''''''''''''''''''''''''''''
@ -186,19 +165,6 @@ accepted incorrect commands will return an error. Users should make sure that
all arguments passed to ``device_add`` are consistent with the documented all arguments passed to ``device_add`` are consistent with the documented
property types. property types.
``query-sgx`` return value member ``section-size`` (since 7.0)
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Member ``section-size`` in return value elements with meta-type ``uint64`` is
deprecated. Use ``sections`` instead.
``query-sgx-capabilities`` return value member ``section-size`` (since 7.0)
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Member ``section-size`` in return value elements with meta-type ``uint64`` is
deprecated. Use ``sections`` instead.
System accelerators System accelerators
------------------- -------------------

View File

@ -408,6 +408,19 @@ pcspk-audiodev=<name>``.
Use ``-device`` instead. Use ``-device`` instead.
Hexadecimal sizes with scaling multipliers (since 8.0)
''''''''''''''''''''''''''''''''''''''''''''''''''''''
Input parameters that take a size value should only use a size suffix
(such as 'k' or 'M') when the base is written in decimal, and not when
the value is hexadecimal. That is, '0x20M' should be written either as
'32M' or as '0x2000000'.
``-chardev`` backend aliases ``tty`` and ``parport`` (removed in 8.0)
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
``tty`` and ``parport`` used to be aliases for ``serial`` and ``parallel``
respectively. The actual backend names should be used instead.
QEMU Machine Protocol (QMP) commands QEMU Machine Protocol (QMP) commands
------------------------------------ ------------------------------------
@ -494,6 +507,19 @@ type of array items in query-named-block-nodes.
Specify the properties for the object as top-level arguments instead. Specify the properties for the object as top-level arguments instead.
``query-sgx`` return value member ``section-size`` (removed in 8.0)
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Member ``section-size`` in the return value of ``query-sgx``
was superseded by ``sections``.
``query-sgx-capabilities`` return value member ``section-size`` (removed in 8.0)
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Member ``section-size`` in the return value of ``query-sgx-capabilities``
was superseded by ``sections``.
Human Monitor Protocol (HMP) commands Human Monitor Protocol (HMP) commands
------------------------------------- -------------------------------------
@ -565,9 +591,8 @@ KVM guest support on 32-bit Arm hosts (removed in 5.2)
'''''''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''''''''''''''''''''''''''''''''''''''''''''''
The Linux kernel has dropped support for allowing 32-bit Arm systems The Linux kernel has dropped support for allowing 32-bit Arm systems
to host KVM guests as of the 5.7 kernel. Accordingly, QEMU is deprecating to host KVM guests as of the 5.7 kernel, and was thus removed from QEMU
its support for this configuration and will remove it in a future version. as well. Running 32-bit guests on a 64-bit Arm host remains supported.
Running 32-bit guests on a 64-bit Arm host remains supported.
RISC-V ISA Specific CPUs (removed in 5.1) RISC-V ISA Specific CPUs (removed in 5.1)
''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''''''''''''
@ -617,6 +642,16 @@ x86 ``Icelake-Client`` CPU (removed in 7.1)
There isn't ever Icelake Client CPU, it is some wrong and imaginary one. There isn't ever Icelake Client CPU, it is some wrong and imaginary one.
Use ``Icelake-Server`` instead. Use ``Icelake-Server`` instead.
System accelerators
-------------------
Userspace local APIC with KVM (x86, removed 8.0)
''''''''''''''''''''''''''''''''''''''''''''''''
``-M kernel-irqchip=off`` cannot be used on KVM if the CPU model includes
a local APIC. The ``split`` setting is supported, as is using ``-M
kernel-irqchip=off`` when the CPU does not have a local APIC.
System emulator machines System emulator machines
------------------------ ------------------------

View File

@ -216,11 +216,11 @@ LEGACY-CHARDEV translates to -chardev HOST-OPTS... as follows:
* unix:FNAME becomes -chardev socket,path=FNAME * unix:FNAME becomes -chardev socket,path=FNAME
* /dev/parportN becomes -chardev parport,file=/dev/parportN * /dev/parportN becomes -chardev parallel,file=/dev/parportN
* /dev/ppiN likewise * /dev/ppiN likewise
* Any other /dev/FNAME becomes -chardev tty,path=/dev/FNAME * Any other /dev/FNAME becomes -chardev serial,path=/dev/FNAME
* mon:LEGACY-CHARDEV is special: it multiplexes the monitor onto the * mon:LEGACY-CHARDEV is special: it multiplexes the monitor onto the
character device defined by LEGACY-CHARDEV. -chardev provides more character device defined by LEGACY-CHARDEV. -chardev provides more

View File

@ -12,6 +12,7 @@
#include "qemu/osdep.h" #include "qemu/osdep.h"
#include "qemu/option.h" #include "qemu/option.h"
#include "qemu/accel.h"
#include "qapi/qmp/qerror.h" #include "qapi/qmp/qerror.h"
#include "sysemu/replay.h" #include "sysemu/replay.h"
#include "qemu/units.h" #include "qemu/units.h"

View File

@ -1368,7 +1368,7 @@ static MemTxResult amdvi_mem_ir_write(void *opaque, hwaddr addr,
return MEMTX_ERROR; return MEMTX_ERROR;
} }
apic_get_class()->send_msi(&to); apic_get_class(NULL)->send_msi(&to);
trace_amdvi_mem_ir_write(to.address, to.data); trace_amdvi_mem_ir_write(to.address, to.data);
return MEMTX_OK; return MEMTX_OK;

View File

@ -396,7 +396,7 @@ static void vtd_generate_interrupt(IntelIOMMUState *s, hwaddr mesg_addr_reg,
trace_vtd_irq_generate(msi.address, msi.data); trace_vtd_irq_generate(msi.address, msi.data);
apic_get_class()->send_msi(&msi); apic_get_class(NULL)->send_msi(&msi);
} }
/* Generate a fault event to software via MSI if conditions are met. /* Generate a fault event to software via MSI if conditions are met.
@ -3529,7 +3529,7 @@ static MemTxResult vtd_mem_ir_write(void *opaque, hwaddr addr,
return MEMTX_ERROR; return MEMTX_ERROR;
} }
apic_get_class()->send_msi(&to); apic_get_class(NULL)->send_msi(&to);
return MEMTX_OK; return MEMTX_OK;
} }

View File

@ -83,7 +83,7 @@ static uint64_t sgx_calc_section_metric(uint64_t low, uint64_t high)
((high & MAKE_64BIT_MASK(0, 20)) << 32); ((high & MAKE_64BIT_MASK(0, 20)) << 32);
} }
static SGXEPCSectionList *sgx_calc_host_epc_sections(uint64_t *size) static SGXEPCSectionList *sgx_calc_host_epc_sections(void)
{ {
SGXEPCSectionList *head = NULL, **tail = &head; SGXEPCSectionList *head = NULL, **tail = &head;
SGXEPCSection *section; SGXEPCSection *section;
@ -106,7 +106,6 @@ static SGXEPCSectionList *sgx_calc_host_epc_sections(uint64_t *size)
section = g_new0(SGXEPCSection, 1); section = g_new0(SGXEPCSection, 1);
section->node = j++; section->node = j++;
section->size = sgx_calc_section_metric(ecx, edx); section->size = sgx_calc_section_metric(ecx, edx);
*size += section->size;
QAPI_LIST_APPEND(tail, section); QAPI_LIST_APPEND(tail, section);
} }
@ -157,7 +156,6 @@ SGXInfo *qmp_query_sgx_capabilities(Error **errp)
{ {
SGXInfo *info = NULL; SGXInfo *info = NULL;
uint32_t eax, ebx, ecx, edx; uint32_t eax, ebx, ecx, edx;
uint64_t size = 0;
int fd = qemu_open_old("/dev/sgx_vepc", O_RDWR); int fd = qemu_open_old("/dev/sgx_vepc", O_RDWR);
if (fd < 0) { if (fd < 0) {
@ -175,8 +173,7 @@ SGXInfo *qmp_query_sgx_capabilities(Error **errp)
info->sgx1 = eax & (1U << 0) ? true : false; info->sgx1 = eax & (1U << 0) ? true : false;
info->sgx2 = eax & (1U << 1) ? true : false; info->sgx2 = eax & (1U << 1) ? true : false;
info->sections = sgx_calc_host_epc_sections(&size); info->sections = sgx_calc_host_epc_sections();
info->section_size = size;
close(fd); close(fd);
@ -223,14 +220,12 @@ SGXInfo *qmp_query_sgx(Error **errp)
return NULL; return NULL;
} }
SGXEPCState *sgx_epc = &pcms->sgx_epc;
info = g_new0(SGXInfo, 1); info = g_new0(SGXInfo, 1);
info->sgx = true; info->sgx = true;
info->sgx1 = true; info->sgx1 = true;
info->sgx2 = true; info->sgx2 = true;
info->flc = true; info->flc = true;
info->section_size = sgx_epc->size;
info->sections = sgx_get_epc_sections_list(); info->sections = sgx_get_epc_sections_list();
return info; return info;
@ -241,6 +236,7 @@ void hmp_info_sgx(Monitor *mon, const QDict *qdict)
Error *err = NULL; Error *err = NULL;
SGXEPCSectionList *section_list, *section; SGXEPCSectionList *section_list, *section;
g_autoptr(SGXInfo) info = qmp_query_sgx(&err); g_autoptr(SGXInfo) info = qmp_query_sgx(&err);
uint64_t size = 0;
if (err) { if (err) {
error_report_err(err); error_report_err(err);
@ -254,8 +250,6 @@ void hmp_info_sgx(Monitor *mon, const QDict *qdict)
info->sgx2 ? "enabled" : "disabled"); info->sgx2 ? "enabled" : "disabled");
monitor_printf(mon, "FLC support: %s\n", monitor_printf(mon, "FLC support: %s\n",
info->flc ? "enabled" : "disabled"); info->flc ? "enabled" : "disabled");
monitor_printf(mon, "size: %" PRIu64 "\n",
info->section_size);
section_list = info->sections; section_list = info->sections;
for (section = section_list; section; section = section->next) { for (section = section_list; section; section = section->next) {
@ -263,7 +257,10 @@ void hmp_info_sgx(Monitor *mon, const QDict *qdict)
section->value->node); section->value->node);
monitor_printf(mon, "size=%" PRIu64 "\n", monitor_printf(mon, "size=%" PRIu64 "\n",
section->value->size); section->value->size);
size += section->value->size;
} }
monitor_printf(mon, "total size=%" PRIu64 "\n",
size);
} }
bool sgx_epc_get_section(int section_nr, uint64_t *addr, uint64_t *size) bool sgx_epc_get_section(int section_nr, uint64_t *addr, uint64_t *size)

View File

@ -1648,6 +1648,13 @@ static bool cmd_set_features(IDEState *s, uint8_t cmd)
/* XXX: valid for CDROM ? */ /* XXX: valid for CDROM ? */
switch (s->feature) { switch (s->feature) {
case 0x01: /* 8-bit I/O enable (CompactFlash) */
case 0x81: /* 8-bit I/O disable (CompactFlash) */
if (s->drive_kind != IDE_CFATA) {
goto abort_cmd;
}
s->io8 = !(s->feature & 0x80);
return true;
case 0x02: /* write cache enable */ case 0x02: /* write cache enable */
blk_set_enable_write_cache(s->blk, true); blk_set_enable_write_cache(s->blk, true);
identify_data = (uint16_t *)s->identify_data; identify_data = (uint16_t *)s->identify_data;
@ -2374,12 +2381,20 @@ void ide_data_writew(void *opaque, uint32_t addr, uint32_t val)
} }
p = s->data_ptr; p = s->data_ptr;
if (p + 2 > s->data_end) { if (s->io8) {
return; if (p + 1 > s->data_end) {
} return;
}
*(uint16_t *)p = le16_to_cpu(val); *p++ = val;
p += 2; } else {
if (p + 2 > s->data_end) {
return;
}
*(uint16_t *)p = le16_to_cpu(val);
p += 2;
}
s->data_ptr = p; s->data_ptr = p;
if (p >= s->data_end) { if (p >= s->data_end) {
s->status &= ~DRQ_STAT; s->status &= ~DRQ_STAT;
@ -2401,12 +2416,20 @@ uint32_t ide_data_readw(void *opaque, uint32_t addr)
} }
p = s->data_ptr; p = s->data_ptr;
if (p + 2 > s->data_end) { if (s->io8) {
return 0; if (p + 1 > s->data_end) {
} return 0;
}
ret = cpu_to_le16(*(uint16_t *)p); ret = *p++;
p += 2; } else {
if (p + 2 > s->data_end) {
return 0;
}
ret = cpu_to_le16(*(uint16_t *)p);
p += 2;
}
s->data_ptr = p; s->data_ptr = p;
if (p >= s->data_end) { if (p >= s->data_end) {
s->status &= ~DRQ_STAT; s->status &= ~DRQ_STAT;

View File

@ -283,6 +283,11 @@ static void ide_cd_realize(IDEDevice *dev, Error **errp)
ide_dev_initfn(dev, IDE_CD, errp); ide_dev_initfn(dev, IDE_CD, errp);
} }
static void ide_cf_realize(IDEDevice *dev, Error **errp)
{
ide_dev_initfn(dev, IDE_CFATA, errp);
}
#define DEFINE_IDE_DEV_PROPERTIES() \ #define DEFINE_IDE_DEV_PROPERTIES() \
DEFINE_BLOCK_PROPERTIES(IDEDrive, dev.conf), \ DEFINE_BLOCK_PROPERTIES(IDEDrive, dev.conf), \
DEFINE_BLOCK_ERROR_PROPERTIES(IDEDrive, dev.conf), \ DEFINE_BLOCK_ERROR_PROPERTIES(IDEDrive, dev.conf), \
@ -341,6 +346,32 @@ static const TypeInfo ide_cd_info = {
.class_init = ide_cd_class_init, .class_init = ide_cd_class_init,
}; };
static Property ide_cf_properties[] = {
DEFINE_IDE_DEV_PROPERTIES(),
DEFINE_BLOCK_CHS_PROPERTIES(IDEDrive, dev.conf),
DEFINE_PROP_BIOS_CHS_TRANS("bios-chs-trans",
IDEDrive, dev.chs_trans, BIOS_ATA_TRANSLATION_AUTO),
DEFINE_PROP_END_OF_LIST(),
};
static void ide_cf_class_init(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
IDEDeviceClass *k = IDE_DEVICE_CLASS(klass);
k->realize = ide_cf_realize;
dc->fw_name = "drive";
dc->desc = "virtual CompactFlash card";
device_class_set_props(dc, ide_cf_properties);
}
static const TypeInfo ide_cf_info = {
.name = "ide-cf",
.parent = TYPE_IDE_DEVICE,
.instance_size = sizeof(IDEDrive),
.class_init = ide_cf_class_init,
};
static void ide_device_class_init(ObjectClass *klass, void *data) static void ide_device_class_init(ObjectClass *klass, void *data)
{ {
DeviceClass *k = DEVICE_CLASS(klass); DeviceClass *k = DEVICE_CLASS(klass);
@ -365,6 +396,7 @@ static void ide_register_types(void)
type_register_static(&ide_bus_info); type_register_static(&ide_bus_info);
type_register_static(&ide_hd_info); type_register_static(&ide_hd_info);
type_register_static(&ide_cd_info); type_register_static(&ide_cd_info);
type_register_static(&ide_cf_info);
type_register_static(&ide_device_type_info); type_register_static(&ide_device_type_info);
} }

View File

@ -6,7 +6,6 @@
#include "exec/memory.h" #include "exec/memory.h"
#include "sysemu/hostmem.h" #include "sysemu/hostmem.h"
#include "sysemu/blockdev.h" #include "sysemu/blockdev.h"
#include "qemu/accel.h"
#include "qapi/qapi-types-machine.h" #include "qapi/qapi-types-machine.h"
#include "qemu/module.h" #include "qemu/module.h"
#include "qom/object.h" #include "qom/object.h"

View File

@ -226,6 +226,6 @@ static inline int apic_get_bit(uint32_t *tab, int index)
return !!(tab[i] & mask); return !!(tab[i] & mask);
} }
APICCommonClass *apic_get_class(void); APICCommonClass *apic_get_class(Error **errp);
#endif /* QEMU_APIC_INTERNAL_H */ #endif /* QEMU_APIC_INTERNAL_H */

View File

@ -402,6 +402,7 @@ struct IDEState {
uint8_t select; uint8_t select;
uint8_t status; uint8_t status;
bool io8;
bool reset_reverts; bool reset_reverts;
/* set for lba48 access */ /* set for lba48 access */

View File

@ -26,10 +26,10 @@
#include "qom/object.h" #include "qom/object.h"
#include "exec/hwaddr.h" #include "exec/hwaddr.h"
typedef struct AccelState { struct AccelState {
/*< private >*/ /*< private >*/
Object parent_obj; Object parent_obj;
} AccelState; };
typedef struct AccelClass { typedef struct AccelClass {
/*< private >*/ /*< private >*/

View File

@ -21,6 +21,7 @@
* Incomplete struct types * Incomplete struct types
* Please keep this list in case-insensitive alphabetical order. * Please keep this list in case-insensitive alphabetical order.
*/ */
typedef struct AccelState AccelState;
typedef struct AdapterInfo AdapterInfo; typedef struct AdapterInfo AdapterInfo;
typedef struct AddressSpace AddressSpace; typedef struct AddressSpace AddressSpace;
typedef struct AioContext AioContext; typedef struct AioContext AioContext;

View File

@ -14,8 +14,8 @@ keyval = import('keyval')
ss = import('sourceset') ss = import('sourceset')
fs = import('fs') fs = import('fs')
targetos = host_machine.system()
sh = find_program('sh') sh = find_program('sh')
cc = meson.get_compiler('c')
config_host = keyval.load(meson.current_build_dir() / 'config-host.mak') config_host = keyval.load(meson.current_build_dir() / 'config-host.mak')
enable_modules = 'CONFIG_MODULES' in config_host enable_modules = 'CONFIG_MODULES' in config_host
enable_static = 'CONFIG_STATIC' in config_host enable_static = 'CONFIG_STATIC' in config_host
@ -23,6 +23,18 @@ enable_static = 'CONFIG_STATIC' in config_host
# Allow both shared and static libraries unless --enable-static # Allow both shared and static libraries unless --enable-static
static_kwargs = enable_static ? {'static': true} : {} static_kwargs = enable_static ? {'static': true} : {}
cc = meson.get_compiler('c')
all_languages = ['c']
if add_languages('cpp', required: false, native: false)
all_languages += ['cpp']
cxx = meson.get_compiler('cpp')
endif
if targetos == 'darwin' and \
add_languages('objc', required: get_option('cocoa'), native: false)
all_languages += ['objc']
objc = meson.get_compiler('objc')
endif
# Temporary directory used for files created while # Temporary directory used for files created while
# configure runs. Since it is in the build directory # configure runs. Since it is in the build directory
# we can safely blow away any previous version of it # we can safely blow away any previous version of it
@ -58,8 +70,6 @@ if cpu in ['riscv32', 'riscv64']
cpu = 'riscv' cpu = 'riscv'
endif endif
targetos = host_machine.system()
target_dirs = config_host['TARGET_DIRS'].split() target_dirs = config_host['TARGET_DIRS'].split()
have_linux_user = false have_linux_user = false
have_bsd_user = false have_bsd_user = false
@ -165,7 +175,7 @@ if 'dtrace' in get_option('trace_backends')
# semaphores are linked into the main binary and not the module's shared # semaphores are linked into the main binary and not the module's shared
# object. # object.
add_global_arguments('-DSTAP_SDT_V2', add_global_arguments('-DSTAP_SDT_V2',
native: false, language: ['c', 'cpp', 'objc']) native: false, language: all_languages)
endif endif
endif endif
@ -193,10 +203,7 @@ qemu_ldflags += cc.get_supported_link_arguments('-Wl,-z,relro', '-Wl,-z,now')
if targetos == 'windows' if targetos == 'windows'
qemu_ldflags += cc.get_supported_link_arguments('-Wl,--no-seh', '-Wl,--nxcompat') qemu_ldflags += cc.get_supported_link_arguments('-Wl,--no-seh', '-Wl,--nxcompat')
# Disable ASLR for debug builds to allow debugging with gdb qemu_ldflags += cc.get_supported_link_arguments('-Wl,--dynamicbase', '-Wl,--high-entropy-va')
if get_option('optimization') == '0'
qemu_ldflags += cc.get_supported_link_arguments('-Wl,--dynamicbase')
endif
endif endif
if get_option('gprof') if get_option('gprof')
@ -210,7 +217,7 @@ endif
if get_option('fuzzing') if get_option('fuzzing')
add_project_link_arguments(['-Wl,-T,', add_project_link_arguments(['-Wl,-T,',
(meson.current_source_dir() / 'tests/qtest/fuzz/fork_fuzz.ld')], (meson.current_source_dir() / 'tests/qtest/fuzz/fork_fuzz.ld')],
native: false, language: ['c', 'cpp', 'objc']) native: false, language: all_languages)
# Specify a filter to only instrument code that is directly related to # Specify a filter to only instrument code that is directly related to
# virtual-devices. # virtual-devices.
@ -223,7 +230,7 @@ if get_option('fuzzing')
args: ['-fsanitize-coverage-allowlist=/dev/null', args: ['-fsanitize-coverage-allowlist=/dev/null',
'-fsanitize-coverage=trace-pc'] ) '-fsanitize-coverage=trace-pc'] )
add_global_arguments('-fsanitize-coverage-allowlist=instrumentation-filter', add_global_arguments('-fsanitize-coverage-allowlist=instrumentation-filter',
native: false, language: ['c', 'cpp', 'objc']) native: false, language: all_languages)
endif endif
if get_option('fuzzing_engine') == '' if get_option('fuzzing_engine') == ''
@ -232,9 +239,9 @@ if get_option('fuzzing')
# everything with fsanitize=fuzzer-no-link. Otherwise, the linker will be # everything with fsanitize=fuzzer-no-link. Otherwise, the linker will be
# unable to bind the fuzzer-related callbacks added by instrumentation. # unable to bind the fuzzer-related callbacks added by instrumentation.
add_global_arguments('-fsanitize=fuzzer-no-link', add_global_arguments('-fsanitize=fuzzer-no-link',
native: false, language: ['c', 'cpp', 'objc']) native: false, language: all_languages)
add_global_link_arguments('-fsanitize=fuzzer-no-link', add_global_link_arguments('-fsanitize=fuzzer-no-link',
native: false, language: ['c', 'cpp', 'objc']) native: false, language: all_languages)
# For the actual fuzzer binaries, we need to link against the libfuzzer # For the actual fuzzer binaries, we need to link against the libfuzzer
# library. They need to be configurable, to support OSS-Fuzz # library. They need to be configurable, to support OSS-Fuzz
fuzz_exe_ldflags = ['-fsanitize=fuzzer'] fuzz_exe_ldflags = ['-fsanitize=fuzzer']
@ -245,15 +252,11 @@ if get_option('fuzzing')
endif endif
endif endif
add_global_arguments(qemu_cflags, native: false, language: ['c'])
add_global_arguments(qemu_objcflags, native: false, language: ['objc'])
# Check that the C++ compiler exists and works with the C compiler. # Check that the C++ compiler exists and works with the C compiler.
link_language = 'c' link_language = 'c'
linker = cc linker = cc
qemu_cxxflags = [] qemu_cxxflags = []
if add_languages('cpp', required: false, native: false) if 'cpp' in all_languages
cxx = meson.get_compiler('cpp')
add_global_arguments(['-D__STDC_LIMIT_MACROS', '-D__STDC_CONSTANT_MACROS', '-D__STDC_FORMAT_MACROS'], add_global_arguments(['-D__STDC_LIMIT_MACROS', '-D__STDC_CONSTANT_MACROS', '-D__STDC_FORMAT_MACROS'],
native: false, language: 'cpp') native: false, language: 'cpp')
foreach k: qemu_cflags foreach k: qemu_cflags
@ -262,7 +265,6 @@ if add_languages('cpp', required: false, native: false)
qemu_cxxflags += [k] qemu_cxxflags += [k]
endif endif
endforeach endforeach
add_global_arguments(qemu_cxxflags, native: false, language: 'cpp')
if cxx.links(files('scripts/main.c'), args: qemu_cflags) if cxx.links(files('scripts/main.c'), args: qemu_cflags)
link_language = 'cpp' link_language = 'cpp'
@ -278,22 +280,21 @@ if targetos != 'sunos' and not config_host.has_key('CONFIG_TSAN')
qemu_ldflags += linker.get_supported_link_arguments('-Wl,--warn-common') qemu_ldflags += linker.get_supported_link_arguments('-Wl,--warn-common')
endif endif
add_global_link_arguments(qemu_ldflags, native: false, language: ['c', 'cpp', 'objc']) add_global_link_arguments(qemu_ldflags, native: false, language: all_languages)
add_global_arguments(qemu_cflags, native: false, language: 'c')
add_global_arguments(qemu_cxxflags, native: false, language: 'cpp')
add_global_arguments(qemu_objcflags, native: false, language: 'objc')
if targetos == 'linux' if targetos == 'linux'
add_project_arguments('-isystem', meson.current_source_dir() / 'linux-headers', add_project_arguments('-isystem', meson.current_source_dir() / 'linux-headers',
'-isystem', 'linux-headers', '-isystem', 'linux-headers',
language: ['c', 'cpp']) language: all_languages)
endif endif
add_project_arguments('-iquote', '.', add_project_arguments('-iquote', '.',
'-iquote', meson.current_source_dir(), '-iquote', meson.current_source_dir(),
'-iquote', meson.current_source_dir() / 'include', '-iquote', meson.current_source_dir() / 'include',
language: ['c', 'cpp', 'objc']) language: all_languages)
if host_machine.system() == 'darwin'
add_languages('objc', required: false, native: false)
endif
sparse = find_program('cgcc', required: get_option('sparse')) sparse = find_program('cgcc', required: get_option('sparse'))
if sparse.found() if sparse.found()
@ -476,7 +477,7 @@ if get_option('tcg').allowed()
tcg_arch = 'ppc' tcg_arch = 'ppc'
endif endif
add_project_arguments('-iquote', meson.current_source_dir() / 'tcg' / tcg_arch, add_project_arguments('-iquote', meson.current_source_dir() / 'tcg' / tcg_arch,
language: ['c', 'cpp', 'objc']) language: all_languages)
accelerators += 'CONFIG_TCG' accelerators += 'CONFIG_TCG'
config_host += { 'CONFIG_TCG': 'y' } config_host += { 'CONFIG_TCG': 'y' }
@ -502,7 +503,7 @@ endif
# The path to glib.h is added to all compilation commands. This was # The path to glib.h is added to all compilation commands. This was
# grandfathered in from the QEMU Makefiles. # grandfathered in from the QEMU Makefiles.
add_project_arguments(config_host['GLIB_CFLAGS'].split(), add_project_arguments(config_host['GLIB_CFLAGS'].split(),
native: false, language: ['c', 'cpp', 'objc']) native: false, language: all_languages)
glib = declare_dependency(compile_args: config_host['GLIB_CFLAGS'].split(), glib = declare_dependency(compile_args: config_host['GLIB_CFLAGS'].split(),
link_args: config_host['GLIB_LIBS'].split(), link_args: config_host['GLIB_LIBS'].split(),
version: config_host['GLIB_VERSION'], version: config_host['GLIB_VERSION'],
@ -1727,8 +1728,8 @@ if get_option('cfi')
error('-fno-sanitize-trap=cfi-icall is not supported by the compiler') error('-fno-sanitize-trap=cfi-icall is not supported by the compiler')
endif endif
endif endif
add_global_arguments(cfi_flags, native: false, language: ['c', 'cpp', 'objc']) add_global_arguments(cfi_flags, native: false, language: all_languages)
add_global_link_arguments(cfi_flags, native: false, language: ['c', 'cpp', 'objc']) add_global_link_arguments(cfi_flags, native: false, language: all_languages)
endif endif
have_host_block_device = (targetos != 'darwin' or have_host_block_device = (targetos != 'darwin' or
@ -3758,26 +3759,28 @@ endif
if targetos == 'darwin' if targetos == 'darwin'
summary_info += {'Objective-C compiler': ' '.join(meson.get_compiler('objc').cmd_array())} summary_info += {'Objective-C compiler': ' '.join(meson.get_compiler('objc').cmd_array())}
endif endif
summary_info += {'CFLAGS': ' '.join(get_option('c_args') option_cflags = (get_option('debug') ? ['-g'] : [])
+ ['-O' + get_option('optimization')] if get_option('optimization') != 'plain'
+ (get_option('debug') ? ['-g'] : []))} option_cflags += ['-O' + get_option('optimization')]
endif
summary_info += {'CFLAGS': ' '.join(get_option('c_args') + option_cflags)}
if link_language == 'cpp' if link_language == 'cpp'
summary_info += {'CXXFLAGS': ' '.join(get_option('cpp_args') summary_info += {'CXXFLAGS': ' '.join(get_option('cpp_args') + option_cflags)}
+ ['-O' + get_option('optimization')]
+ (get_option('debug') ? ['-g'] : []))}
endif endif
if targetos == 'darwin' if targetos == 'darwin'
summary_info += {'OBJCFLAGS': ' '.join(get_option('objc_args') summary_info += {'OBJCFLAGS': ' '.join(get_option('objc_args') + option_cflags)}
+ ['-O' + get_option('optimization')]
+ (get_option('debug') ? ['-g'] : []))}
endif endif
link_args = get_option(link_language + '_link_args') link_args = get_option(link_language + '_link_args')
if link_args.length() > 0 if link_args.length() > 0
summary_info += {'LDFLAGS': ' '.join(link_args)} summary_info += {'LDFLAGS': ' '.join(link_args)}
endif endif
summary_info += {'QEMU_CFLAGS': ' '.join(qemu_cflags)} summary_info += {'QEMU_CFLAGS': ' '.join(qemu_cflags)}
summary_info += {'QEMU_CXXFLAGS': ' '.join(qemu_cxxflags)} if 'cpp' in all_languages
summary_info += {'QEMU_OBJCFLAGS': ' '.join(qemu_objcflags)} summary_info += {'QEMU_CXXFLAGS': ' '.join(qemu_cxxflags)}
endif
if 'objc' in all_languages
summary_info += {'QEMU_OBJCFLAGS': ' '.join(qemu_objcflags)}
endif
summary_info += {'QEMU_LDFLAGS': ' '.join(qemu_ldflags)} summary_info += {'QEMU_LDFLAGS': ' '.join(qemu_ldflags)}
summary_info += {'profiler': get_option('profiler')} summary_info += {'profiler': get_option('profiler')}
summary_info += {'link-time optimization (LTO)': get_option('b_lto')} summary_info += {'link-time optimization (LTO)': get_option('b_lto')}

View File

@ -329,14 +329,8 @@
# #
# @flc: true if FLC is supported # @flc: true if FLC is supported
# #
# @section-size: The EPC section size for guest
# Redundant with @sections. Just for backward compatibility.
#
# @sections: The EPC sections info for guest (Since: 7.0) # @sections: The EPC sections info for guest (Since: 7.0)
# #
# Features:
# @deprecated: Member @section-size is deprecated. Use @sections instead.
#
# Since: 6.2 # Since: 6.2
## ##
{ 'struct': 'SGXInfo', { 'struct': 'SGXInfo',
@ -344,8 +338,6 @@
'sgx1': 'bool', 'sgx1': 'bool',
'sgx2': 'bool', 'sgx2': 'bool',
'flc': 'bool', 'flc': 'bool',
'section-size': { 'type': 'uint64',
'features': [ 'deprecated' ] },
'sections': ['SGXEPCSection']}, 'sections': ['SGXEPCSection']},
'if': 'TARGET_I386' } 'if': 'TARGET_I386' }
@ -362,7 +354,7 @@
# #
# -> { "execute": "query-sgx" } # -> { "execute": "query-sgx" }
# <- { "return": { "sgx": true, "sgx1" : true, "sgx2" : true, # <- { "return": { "sgx": true, "sgx1" : true, "sgx2" : true,
# "flc": true, "section-size" : 96468992, # "flc": true,
# "sections": [{"node": 0, "size": 67108864}, # "sections": [{"node": 0, "size": 67108864},
# {"node": 1, "size": 29360128}]} } # {"node": 1, "size": 29360128}]} }
# #
@ -382,7 +374,7 @@
# #
# -> { "execute": "query-sgx-capabilities" } # -> { "execute": "query-sgx-capabilities" }
# <- { "return": { "sgx": true, "sgx1" : true, "sgx2" : true, # <- { "return": { "sgx": true, "sgx1" : true, "sgx2" : true,
# "flc": true, "section-size" : 96468992, # "flc": true,
# "section" : [{"node": 0, "size": 67108864}, # "section" : [{"node": 0, "size": 67108864},
# {"node": 1, "size": 29360128}]} } # {"node": 1, "size": 29360128}]} }
# #

View File

@ -3379,11 +3379,9 @@ DEF("chardev", HAS_ARG, QEMU_OPTION_chardev,
#if defined(__linux__) || defined(__sun__) || defined(__FreeBSD__) \ #if defined(__linux__) || defined(__sun__) || defined(__FreeBSD__) \
|| defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
"-chardev serial,id=id,path=path[,mux=on|off][,logfile=PATH][,logappend=on|off]\n" "-chardev serial,id=id,path=path[,mux=on|off][,logfile=PATH][,logappend=on|off]\n"
"-chardev tty,id=id,path=path[,mux=on|off][,logfile=PATH][,logappend=on|off]\n"
#endif #endif
#if defined(__linux__) || defined(__FreeBSD__) || defined(__DragonFly__) #if defined(__linux__) || defined(__FreeBSD__) || defined(__DragonFly__)
"-chardev parallel,id=id,path=path[,mux=on|off][,logfile=PATH][,logappend=on|off]\n" "-chardev parallel,id=id,path=path[,mux=on|off][,logfile=PATH][,logappend=on|off]\n"
"-chardev parport,id=id,path=path[,mux=on|off][,logfile=PATH][,logappend=on|off]\n"
#endif #endif
#if defined(CONFIG_SPICE) #if defined(CONFIG_SPICE)
"-chardev spicevmc,id=id,name=name[,debug=debug][,logfile=PATH][,logappend=on|off]\n" "-chardev spicevmc,id=id,name=name[,debug=debug][,logfile=PATH][,logappend=on|off]\n"
@ -3398,7 +3396,7 @@ The general form of a character device option is:
``-chardev backend,id=id[,mux=on|off][,options]`` ``-chardev backend,id=id[,mux=on|off][,options]``
Backend is one of: ``null``, ``socket``, ``udp``, ``msmouse``, Backend is one of: ``null``, ``socket``, ``udp``, ``msmouse``,
``vc``, ``ringbuf``, ``file``, ``pipe``, ``console``, ``serial``, ``vc``, ``ringbuf``, ``file``, ``pipe``, ``console``, ``serial``,
``pty``, ``stdio``, ``braille``, ``tty``, ``parallel``, ``parport``, ``pty``, ``stdio``, ``braille``, ``parallel``,
``spicevmc``, ``spiceport``. The specific backend will determine the ``spicevmc``, ``spiceport``. The specific backend will determine the
applicable options. applicable options.
@ -3622,15 +3620,8 @@ The available backends are:
Connect to a local BrlAPI server. ``braille`` does not take any Connect to a local BrlAPI server. ``braille`` does not take any
options. options.
``-chardev tty,id=id,path=path``
``tty`` is only available on Linux, Sun, FreeBSD, NetBSD, OpenBSD
and DragonFlyBSD hosts. It is an alias for ``serial``.
``path`` specifies the path to the tty. ``path`` is required.
``-chardev parallel,id=id,path=path`` ``-chardev parallel,id=id,path=path``
\ \
``-chardev parport,id=id,path=path``
``parallel`` is only available on Linux, FreeBSD and DragonFlyBSD ``parallel`` is only available on Linux, FreeBSD and DragonFlyBSD
hosts. hosts.

View File

@ -188,7 +188,7 @@
--enable-tcg \ --enable-tcg \
--enable-tools \ --enable-tools \
--enable-tpm \ --enable-tpm \
--enable-trace-backend=dtrace \ --enable-trace-backends=dtrace \
--enable-usb-redir \ --enable-usb-redir \
--enable-virtiofsd \ --enable-virtiofsd \
--enable-vhost-kernel \ --enable-vhost-kernel \

View File

@ -17,7 +17,6 @@ introspect = os.environ.get('MESONINTROSPECT')
out = subprocess.run([*introspect.split(' '), '--installed'], out = subprocess.run([*introspect.split(' '), '--installed'],
stdout=subprocess.PIPE, check=True).stdout stdout=subprocess.PIPE, check=True).stdout
for source, dest in json.loads(out).items(): for source, dest in json.loads(out).items():
assert os.path.isabs(source)
bundle_dest = destdir_join('qemu-bundle', dest) bundle_dest = destdir_join('qemu-bundle', dest)
path = os.path.dirname(bundle_dest) path = os.path.dirname(bundle_dest)
try: try:

View File

@ -247,12 +247,16 @@ void x86_cpu_machine_reset_cb(void *opaque)
cpu_reset(CPU(cpu)); cpu_reset(CPU(cpu));
} }
APICCommonClass *apic_get_class(void) APICCommonClass *apic_get_class(Error **errp)
{ {
const char *apic_type = "apic"; const char *apic_type = "apic";
/* TODO: in-kernel irqchip for hvf */ /* TODO: in-kernel irqchip for hvf */
if (kvm_apic_in_kernel()) { if (kvm_enabled()) {
if (!kvm_apic_in_kernel()) {
error_setg(errp, "KVM does not support userspace APIC");
return NULL;
}
apic_type = "kvm-apic"; apic_type = "kvm-apic";
} else if (xen_enabled()) { } else if (xen_enabled()) {
apic_type = "xen-apic"; apic_type = "xen-apic";
@ -266,10 +270,13 @@ APICCommonClass *apic_get_class(void)
void x86_cpu_apic_create(X86CPU *cpu, Error **errp) void x86_cpu_apic_create(X86CPU *cpu, Error **errp)
{ {
APICCommonState *apic; APICCommonState *apic;
ObjectClass *apic_class = OBJECT_CLASS(apic_get_class()); APICCommonClass *apic_class = apic_get_class(errp);
cpu->apic_state = DEVICE(object_new_with_class(apic_class)); if (!apic_class) {
return;
}
cpu->apic_state = DEVICE(object_new_with_class(OBJECT_CLASS(apic_class)));
object_property_add_child(OBJECT(cpu), "lapic", object_property_add_child(OBJECT(cpu), "lapic",
OBJECT(cpu->apic_state)); OBJECT(cpu->apic_state));
object_unref(OBJECT(cpu->apic_state)); object_unref(OBJECT(cpu->apic_state));

View File

@ -1233,7 +1233,7 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = {
.feat_names = { .feat_names = {
"sgx1", "sgx2", NULL, NULL, "sgx1", "sgx2", NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, "sgx-edeccssa",
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
@ -1273,7 +1273,7 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = {
.feat_names = { .feat_names = {
NULL, "sgx-debug", "sgx-mode64", NULL, NULL, "sgx-debug", "sgx-mode64", NULL,
"sgx-provisionkey", "sgx-tokenkey", NULL, "sgx-kss", "sgx-provisionkey", "sgx-tokenkey", NULL, "sgx-kss",
NULL, NULL, NULL, NULL, NULL, NULL, "sgx-aex-notify", NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,

View File

@ -277,10 +277,6 @@ if build_docs
command: ['perl', '-pe', '$x = chr 13; s/$x$//', '@INPUT@'], command: ['perl', '-pe', '$x = chr 13; s/$x$//', '@INPUT@'],
capture: true) capture: true)
# "full_path()" needed here to work around test('QAPI rST doc', diff, args: ['-u', qapi_doc_ref_nocr[0], qapi_doc_out_nocr[0]],
# https://github.com/mesonbuild/meson/issues/7585
test('QAPI rST doc', diff, args: ['-u', qapi_doc_ref_nocr[0].full_path(),
qapi_doc_out_nocr[0].full_path()],
depends: [qapi_doc_ref_nocr, qapi_doc_out_nocr],
suite: ['qapi-schema', 'qapi-doc']) suite: ['qapi-schema', 'qapi-doc'])
endif endif

View File

@ -2315,6 +2315,14 @@ static void test_qemu_strtosz_invalid(void)
g_assert_cmpint(res, ==, 0xbaadf00d); g_assert_cmpint(res, ==, 0xbaadf00d);
g_assert(endptr == str); g_assert(endptr == str);
/* No suffixes */
str = "0x18M";
endptr = NULL;
err = qemu_strtosz(str, &endptr, &res);
g_assert_cmpint(err, ==, -EINVAL);
g_assert_cmpint(res, ==, 0xbaadf00d);
g_assert(endptr == str);
/* No negative values */ /* No negative values */
str = "-0"; str = "-0";
endptr = NULL; endptr = NULL;

View File

@ -197,10 +197,8 @@ static int64_t suffix_mul(char suffix, int64_t unit)
* fractional portion is truncated to byte * fractional portion is truncated to byte
* - 0x7fEE - hexadecimal, unit determined by @default_suffix * - 0x7fEE - hexadecimal, unit determined by @default_suffix
* *
* The following cause a deprecation warning, and may be removed in the future
* - 0xabc{kKmMgGtTpP} - hex with scaling suffix
*
* The following are intentionally not supported * The following are intentionally not supported
* - hex with scaling suffix, such as 0x20M
* - octal, such as 08 * - octal, such as 08
* - fractional hex, such as 0x1.8 * - fractional hex, such as 0x1.8
* - floating point exponents, such as 1e3 * - floating point exponents, such as 1e3
@ -222,7 +220,6 @@ static int do_strtosz(const char *nptr, const char **end,
int retval; int retval;
const char *endptr, *f; const char *endptr, *f;
unsigned char c; unsigned char c;
bool hex = false;
uint64_t val, valf = 0; uint64_t val, valf = 0;
int64_t mul; int64_t mul;
@ -237,17 +234,16 @@ static int do_strtosz(const char *nptr, const char **end,
goto out; goto out;
} }
if (val == 0 && (*endptr == 'x' || *endptr == 'X')) { if (val == 0 && (*endptr == 'x' || *endptr == 'X')) {
/* Input looks like hex, reparse, and insist on no fraction. */ /* Input looks like hex; reparse, and insist on no fraction or suffix. */
retval = qemu_strtou64(nptr, &endptr, 16, &val); retval = qemu_strtou64(nptr, &endptr, 16, &val);
if (retval) { if (retval) {
goto out; goto out;
} }
if (*endptr == '.') { if (*endptr == '.' || suffix_mul(*endptr, unit) > 0) {
endptr = nptr; endptr = nptr;
retval = -EINVAL; retval = -EINVAL;
goto out; goto out;
} }
hex = true;
} else if (*endptr == '.') { } else if (*endptr == '.') {
/* /*
* Input looks like a fraction. Make sure even 1.k works * Input looks like a fraction. Make sure even 1.k works
@ -272,10 +268,6 @@ static int do_strtosz(const char *nptr, const char **end,
c = *endptr; c = *endptr;
mul = suffix_mul(c, unit); mul = suffix_mul(c, unit);
if (mul > 0) { if (mul > 0) {
if (hex) {
warn_report("Using a multiplier suffix on hex numbers "
"is deprecated: %s", nptr);
}
endptr++; endptr++;
} else { } else {
mul = suffix_mul(default_suffix, unit); mul = suffix_mul(default_suffix, unit);

View File

@ -45,7 +45,6 @@ static __thread FILE *thread_file;
static __thread Notifier qemu_log_thread_cleanup_notifier; static __thread Notifier qemu_log_thread_cleanup_notifier;
int qemu_loglevel; int qemu_loglevel;
static bool log_append;
static bool log_per_thread; static bool log_per_thread;
static GArray *debug_regions; static GArray *debug_regions;
@ -80,13 +79,15 @@ static int log_thread_id(void)
static void qemu_log_thread_cleanup(Notifier *n, void *unused) static void qemu_log_thread_cleanup(Notifier *n, void *unused)
{ {
fclose(thread_file); if (thread_file != stderr) {
thread_file = NULL; fclose(thread_file);
thread_file = NULL;
}
} }
/* Lock/unlock output. */ /* Lock/unlock output. */
FILE *qemu_log_trylock(void) static FILE *qemu_log_trylock_with_err(Error **errp)
{ {
FILE *logfile; FILE *logfile;
@ -97,6 +98,9 @@ FILE *qemu_log_trylock(void)
= g_strdup_printf(global_filename, log_thread_id()); = g_strdup_printf(global_filename, log_thread_id());
logfile = fopen(filename, "w"); logfile = fopen(filename, "w");
if (!logfile) { if (!logfile) {
error_setg_errno(errp, errno,
"Error opening logfile %s for thread %d",
filename, log_thread_id());
return NULL; return NULL;
} }
thread_file = logfile; thread_file = logfile;
@ -123,6 +127,11 @@ FILE *qemu_log_trylock(void)
return logfile; return logfile;
} }
FILE *qemu_log_trylock(void)
{
return qemu_log_trylock_with_err(NULL);
}
void qemu_log_unlock(FILE *logfile) void qemu_log_unlock(FILE *logfile)
{ {
if (logfile) { if (logfile) {
@ -266,40 +275,61 @@ static bool qemu_set_log_internal(const char *filename, bool changed_name,
#endif #endif
qemu_loglevel = log_flags; qemu_loglevel = log_flags;
/*
* In all cases we only log if qemu_loglevel is set.
* Also:
* If per-thread, open the file for each thread in qemu_log_lock.
* If not daemonized we will always log either to stderr
* or to a file (if there is a filename).
* If we are daemonized, we will only log if there is a filename.
*/
daemonized = is_daemonized(); daemonized = is_daemonized();
need_to_open_file = log_flags && !per_thread && (!daemonized || filename); need_to_open_file = false;
if (!daemonized) {
/*
* If not daemonized we only log if qemu_loglevel is set, either to
* stderr or to a file (if there is a filename).
* If per-thread, open the file for each thread in qemu_log_trylock().
*/
need_to_open_file = qemu_loglevel && !log_per_thread;
} else {
/*
* If we are daemonized, we will only log if there is a filename.
*/
need_to_open_file = filename != NULL;
}
if (logfile && (!need_to_open_file || changed_name)) { if (logfile) {
qatomic_rcu_set(&global_file, NULL); fflush(logfile);
if (logfile != stderr) { if (changed_name && logfile != stderr) {
RCUCloseFILE *r = g_new0(RCUCloseFILE, 1); RCUCloseFILE *r = g_new0(RCUCloseFILE, 1);
r->fd = logfile; r->fd = logfile;
qatomic_rcu_set(&global_file, NULL);
call_rcu(r, rcu_close_file, rcu); call_rcu(r, rcu_close_file, rcu);
logfile = NULL;
} }
logfile = NULL; }
if (log_per_thread && daemonized) {
logfile = thread_file;
} }
if (!logfile && need_to_open_file) { if (!logfile && need_to_open_file) {
if (filename) { if (filename) {
logfile = fopen(filename, log_append ? "a" : "w"); if (log_per_thread) {
if (!logfile) { logfile = qemu_log_trylock_with_err(errp);
error_setg_errno(errp, errno, "Error opening logfile %s", if (!logfile) {
filename); return false;
return false; }
qemu_log_unlock(logfile);
} else {
logfile = fopen(filename, "w");
if (!logfile) {
error_setg_errno(errp, errno, "Error opening logfile %s",
filename);
return false;
}
} }
/* In case we are a daemon redirect stderr to logfile */ /* In case we are a daemon redirect stderr to logfile */
if (daemonized) { if (daemonized) {
dup2(fileno(logfile), STDERR_FILENO); dup2(fileno(logfile), STDERR_FILENO);
fclose(logfile); fclose(logfile);
/* This will skip closing logfile in rcu_close_file. */ /*
* This will skip closing logfile in rcu_close_file()
* or qemu_log_thread_cleanup().
*/
logfile = stderr; logfile = stderr;
} }
} else { } else {
@ -308,9 +338,11 @@ static bool qemu_set_log_internal(const char *filename, bool changed_name,
logfile = stderr; logfile = stderr;
} }
log_append = 1; if (log_per_thread && daemonized) {
thread_file = logfile;
qatomic_rcu_set(&global_file, logfile); } else {
qatomic_rcu_set(&global_file, logfile);
}
} }
return true; return true;
} }