diff options
77 files changed, 891 insertions, 398 deletions
diff --git a/VERSION b/VERSION index aefb917865..1f0ae9cf6e 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.6.92 +2.6.94 diff --git a/audio/trace-events b/audio/trace-events index 5638ea1a38..517359039e 100644 --- a/audio/trace-events +++ b/audio/trace-events @@ -1,4 +1,4 @@ -# See docs/trace-events.txt for syntax documentation. +# See docs/tracing.txt for syntax documentation. # audio/alsaaudio.c alsa_revents(int revents) "revents = %d" diff --git a/block/blkdebug.c b/block/blkdebug.c index fb29283f80..d5db166815 100644 --- a/block/blkdebug.c +++ b/block/blkdebug.c @@ -39,6 +39,9 @@ typedef struct BDRVBlkdebugState { int new_state; int align; + /* For blkdebug_refresh_filename() */ + char *config_file; + QLIST_HEAD(, BlkdebugRule) rules[BLKDBG__MAX]; QSIMPLEQ_HEAD(, BlkdebugRule) active_rules; QLIST_HEAD(, BlkdebugSuspendedReq) suspended_reqs; @@ -351,7 +354,6 @@ static int blkdebug_open(BlockDriverState *bs, QDict *options, int flags, BDRVBlkdebugState *s = bs->opaque; QemuOpts *opts; Error *local_err = NULL; - const char *config; uint64_t align; int ret; @@ -364,8 +366,8 @@ static int blkdebug_open(BlockDriverState *bs, QDict *options, int flags, } /* Read rules from config file or command line options */ - config = qemu_opt_get(opts, "config"); - ret = read_config(s, config, options, errp); + s->config_file = g_strdup(qemu_opt_get(opts, "config")); + ret = read_config(s, s->config_file, options, errp); if (ret) { goto out; } @@ -398,6 +400,9 @@ static int blkdebug_open(BlockDriverState *bs, QDict *options, int flags, fail_unref: bdrv_unref_child(bs, bs->file); out: + if (ret < 0) { + g_free(s->config_file); + } qemu_opts_del(opts); return ret; } @@ -515,6 +520,8 @@ static void blkdebug_close(BlockDriverState *bs) remove_rule(rule); } } + + g_free(s->config_file); } static void suspend_request(BlockDriverState *bs, BlkdebugRule *rule) @@ -679,6 +686,7 @@ static int blkdebug_truncate(BlockDriverState *bs, int64_t offset) static void blkdebug_refresh_filename(BlockDriverState *bs, QDict *options) { + BDRVBlkdebugState *s = bs->opaque; QDict *opts; const QDictEntry *e; bool force_json = false; @@ -700,8 +708,7 @@ static void blkdebug_refresh_filename(BlockDriverState *bs, QDict *options) if (!force_json && bs->file->bs->exact_filename[0]) { snprintf(bs->exact_filename, sizeof(bs->exact_filename), - "blkdebug:%s:%s", - qdict_get_try_str(options, "config") ?: "", + "blkdebug:%s:%s", s->config_file ?: "", bs->file->bs->exact_filename); } diff --git a/block/curl.c b/block/curl.c index da9f5e85de..426fb4d674 100644 --- a/block/curl.c +++ b/block/curl.c @@ -169,7 +169,7 @@ static int curl_sock_cb(CURL *curl, curl_socket_t fd, int action, state->sock_fd = fd; s = state->s; - DPRINTF("CURL (AIO): Sock action %d on fd %d\n", action, fd); + DPRINTF("CURL (AIO): Sock action %d on fd %d\n", action, (int)fd); switch (action) { case CURL_POLL_IN: aio_set_fd_handler(s->aio_context, fd, false, diff --git a/block/io.c b/block/io.c index d5493ba349..420944d80d 100644 --- a/block/io.c +++ b/block/io.c @@ -2283,11 +2283,11 @@ int coroutine_fn bdrv_co_flush(BlockDriverState *bs) int current_gen = bs->write_gen; /* Wait until any previous flushes are completed */ - while (bs->flush_started_gen != bs->flushed_gen) { + while (bs->active_flush_req != NULL) { qemu_co_queue_wait(&bs->flush_queue); } - bs->flush_started_gen = current_gen; + bs->active_flush_req = &req; /* Write back all layers by calling one driver function */ if (bs->drv->bdrv_co_flush) { @@ -2357,7 +2357,9 @@ flush_parent: out: /* Notify any pending flushes that we have completed */ bs->flushed_gen = current_gen; - qemu_co_queue_restart_all(&bs->flush_queue); + bs->active_flush_req = NULL; + /* Return value is ignored - it's ok if wait queue is empty */ + qemu_co_queue_next(&bs->flush_queue); tracked_request_end(&req); return ret; diff --git a/block/nbd.c b/block/nbd.c index 8d57220f18..6bc06d6198 100644 --- a/block/nbd.c +++ b/block/nbd.c @@ -42,6 +42,9 @@ typedef struct BDRVNBDState { NbdClientSession client; + + /* For nbd_refresh_filename() */ + char *path, *host, *port, *export, *tlscredsid; } BDRVNBDState; static int nbd_parse_uri(const char *filename, QDict *options) @@ -188,13 +191,15 @@ out: g_free(file); } -static SocketAddress *nbd_config(BDRVNBDState *s, QDict *options, char **export, - Error **errp) +static SocketAddress *nbd_config(BDRVNBDState *s, QemuOpts *opts, Error **errp) { SocketAddress *saddr; - if (qdict_haskey(options, "path") == qdict_haskey(options, "host")) { - if (qdict_haskey(options, "path")) { + s->path = g_strdup(qemu_opt_get(opts, "path")); + s->host = g_strdup(qemu_opt_get(opts, "host")); + + if (!s->path == !s->host) { + if (s->path) { error_setg(errp, "path and host may not be used at the same time."); } else { error_setg(errp, "one of path and host must be specified."); @@ -204,32 +209,28 @@ static SocketAddress *nbd_config(BDRVNBDState *s, QDict *options, char **export, saddr = g_new0(SocketAddress, 1); - if (qdict_haskey(options, "path")) { + if (s->path) { UnixSocketAddress *q_unix; saddr->type = SOCKET_ADDRESS_KIND_UNIX; q_unix = saddr->u.q_unix.data = g_new0(UnixSocketAddress, 1); - q_unix->path = g_strdup(qdict_get_str(options, "path")); - qdict_del(options, "path"); + q_unix->path = g_strdup(s->path); } else { InetSocketAddress *inet; + + s->port = g_strdup(qemu_opt_get(opts, "port")); + saddr->type = SOCKET_ADDRESS_KIND_INET; inet = saddr->u.inet.data = g_new0(InetSocketAddress, 1); - inet->host = g_strdup(qdict_get_str(options, "host")); - if (!qdict_get_try_str(options, "port")) { + inet->host = g_strdup(s->host); + inet->port = g_strdup(s->port); + if (!inet->port) { inet->port = g_strdup_printf("%d", NBD_DEFAULT_PORT); - } else { - inet->port = g_strdup(qdict_get_str(options, "port")); } - qdict_del(options, "host"); - qdict_del(options, "port"); } s->client.is_unix = saddr->type == SOCKET_ADDRESS_KIND_UNIX; - *export = g_strdup(qdict_get_try_str(options, "export")); - if (*export) { - qdict_del(options, "export"); - } + s->export = g_strdup(qemu_opt_get(opts, "export")); return saddr; } @@ -292,28 +293,66 @@ static QCryptoTLSCreds *nbd_get_tls_creds(const char *id, Error **errp) } +static QemuOptsList nbd_runtime_opts = { + .name = "nbd", + .head = QTAILQ_HEAD_INITIALIZER(nbd_runtime_opts.head), + .desc = { + { + .name = "host", + .type = QEMU_OPT_STRING, + .help = "TCP host to connect to", + }, + { + .name = "port", + .type = QEMU_OPT_STRING, + .help = "TCP port to connect to", + }, + { + .name = "path", + .type = QEMU_OPT_STRING, + .help = "Unix socket path to connect to", + }, + { + .name = "export", + .type = QEMU_OPT_STRING, + .help = "Name of the NBD export to open", + }, + { + .name = "tls-creds", + .type = QEMU_OPT_STRING, + .help = "ID of the TLS credentials to use", + }, + }, +}; + static int nbd_open(BlockDriverState *bs, QDict *options, int flags, Error **errp) { BDRVNBDState *s = bs->opaque; - char *export = NULL; + QemuOpts *opts = NULL; + Error *local_err = NULL; QIOChannelSocket *sioc = NULL; - SocketAddress *saddr; - const char *tlscredsid; + SocketAddress *saddr = NULL; QCryptoTLSCreds *tlscreds = NULL; const char *hostname = NULL; int ret = -EINVAL; + opts = qemu_opts_create(&nbd_runtime_opts, NULL, 0, &error_abort); + qemu_opts_absorb_qdict(opts, options, &local_err); + if (local_err) { + error_propagate(errp, local_err); + goto error; + } + /* Pop the config into our state object. Exit if invalid. */ - saddr = nbd_config(s, options, &export, errp); + saddr = nbd_config(s, opts, errp); if (!saddr) { goto error; } - tlscredsid = g_strdup(qdict_get_try_str(options, "tls-creds")); - if (tlscredsid) { - qdict_del(options, "tls-creds"); - tlscreds = nbd_get_tls_creds(tlscredsid, errp); + s->tlscredsid = g_strdup(qemu_opt_get(opts, "tls-creds")); + if (s->tlscredsid) { + tlscreds = nbd_get_tls_creds(s->tlscredsid, errp); if (!tlscreds) { goto error; } @@ -335,7 +374,7 @@ static int nbd_open(BlockDriverState *bs, QDict *options, int flags, } /* NBD handshake */ - ret = nbd_client_init(bs, sioc, export, + ret = nbd_client_init(bs, sioc, s->export, tlscreds, hostname, errp); error: if (sioc) { @@ -344,8 +383,15 @@ static int nbd_open(BlockDriverState *bs, QDict *options, int flags, if (tlscreds) { object_unref(OBJECT(tlscreds)); } + if (ret < 0) { + g_free(s->path); + g_free(s->host); + g_free(s->port); + g_free(s->export); + g_free(s->tlscredsid); + } qapi_free_SocketAddress(saddr); - g_free(export); + qemu_opts_del(opts); return ret; } @@ -362,7 +408,15 @@ static void nbd_refresh_limits(BlockDriverState *bs, Error **errp) static void nbd_close(BlockDriverState *bs) { + BDRVNBDState *s = bs->opaque; + nbd_client_close(bs); + + g_free(s->path); + g_free(s->host); + g_free(s->port); + g_free(s->export); + g_free(s->tlscredsid); } static int64_t nbd_getlength(BlockDriverState *bs) @@ -385,48 +439,45 @@ static void nbd_attach_aio_context(BlockDriverState *bs, static void nbd_refresh_filename(BlockDriverState *bs, QDict *options) { + BDRVNBDState *s = bs->opaque; QDict *opts = qdict_new(); - const char *path = qdict_get_try_str(options, "path"); - const char *host = qdict_get_try_str(options, "host"); - const char *port = qdict_get_try_str(options, "port"); - const char *export = qdict_get_try_str(options, "export"); - const char *tlscreds = qdict_get_try_str(options, "tls-creds"); qdict_put_obj(opts, "driver", QOBJECT(qstring_from_str("nbd"))); - if (path && export) { + if (s->path && s->export) { snprintf(bs->exact_filename, sizeof(bs->exact_filename), - "nbd+unix:///%s?socket=%s", export, path); - } else if (path && !export) { + "nbd+unix:///%s?socket=%s", s->export, s->path); + } else if (s->path && !s->export) { snprintf(bs->exact_filename, sizeof(bs->exact_filename), - "nbd+unix://?socket=%s", path); - } else if (!path && export && port) { + "nbd+unix://?socket=%s", s->path); + } else if (!s->path && s->export && s->port) { snprintf(bs->exact_filename, sizeof(bs->exact_filename), - "nbd://%s:%s/%s", host, port, export); - } else if (!path && export && !port) { + "nbd://%s:%s/%s", s->host, s->port, s->export); + } else if (!s->path && s->export && !s->port) { snprintf(bs->exact_filename, sizeof(bs->exact_filename), - "nbd://%s/%s", host, export); - } else if (!path && !export && port) { + "nbd://%s/%s", s->host, s->export); + } else if (!s->path && !s->export && s->port) { snprintf(bs->exact_filename, sizeof(bs->exact_filename), - "nbd://%s:%s", host, port); - } else if (!path && !export && !port) { + "nbd://%s:%s", s->host, s->port); + } else if (!s->path && !s->export && !s->port) { snprintf(bs->exact_filename, sizeof(bs->exact_filename), - "nbd://%s", host); + "nbd://%s", s->host); } - if (path) { - qdict_put_obj(opts, "path", QOBJECT(qstring_from_str(path))); - } else if (port) { - qdict_put_obj(opts, "host", QOBJECT(qstring_from_str(host))); - qdict_put_obj(opts, "port", QOBJECT(qstring_from_str(port))); + if (s->path) { + qdict_put_obj(opts, "path", QOBJECT(qstring_from_str(s->path))); + } else if (s->port) { + qdict_put_obj(opts, "host", QOBJECT(qstring_from_str(s->host))); + qdict_put_obj(opts, "port", QOBJECT(qstring_from_str(s->port))); } else { - qdict_put_obj(opts, "host", QOBJECT(qstring_from_str(host))); + qdict_put_obj(opts, "host", QOBJECT(qstring_from_str(s->host))); } - if (export) { - qdict_put_obj(opts, "export", QOBJECT(qstring_from_str(export))); + if (s->export) { + qdict_put_obj(opts, "export", QOBJECT(qstring_from_str(s->export))); } - if (tlscreds) { - qdict_put_obj(opts, "tls-creds", QOBJECT(qstring_from_str(tlscreds))); + if (s->tlscredsid) { + qdict_put_obj(opts, "tls-creds", + QOBJECT(qstring_from_str(s->tlscredsid))); } bs->full_open_options = opts; diff --git a/block/ssh.c b/block/ssh.c index bcbb0e4223..5ce12b633a 100644 --- a/block/ssh.c +++ b/block/ssh.c @@ -508,36 +508,73 @@ static int authenticate(BDRVSSHState *s, const char *user, Error **errp) return ret; } +static QemuOptsList ssh_runtime_opts = { + .name = "ssh", + .head = QTAILQ_HEAD_INITIALIZER(ssh_runtime_opts.head), + .desc = { + { + .name = "host", + .type = QEMU_OPT_STRING, + .help = "Host to connect to", + }, + { + .name = "port", + .type = QEMU_OPT_NUMBER, + .help = "Port to connect to", + }, + { + .name = "path", + .type = QEMU_OPT_STRING, + .help = "Path of the image on the host", + }, + { + .name = "user", + .type = QEMU_OPT_STRING, + .help = "User as which to connect", + }, + { + .name = "host_key_check", + .type = QEMU_OPT_STRING, + .help = "Defines how and what to check the host key against", + }, + }, +}; + static int connect_to_ssh(BDRVSSHState *s, QDict *options, int ssh_flags, int creat_mode, Error **errp) { int r, ret; + QemuOpts *opts = NULL; + Error *local_err = NULL; const char *host, *user, *path, *host_key_check; int port; - if (!qdict_haskey(options, "host")) { + opts = qemu_opts_create(&ssh_runtime_opts, NULL, 0, &error_abort); + qemu_opts_absorb_qdict(opts, options, &local_err); + if (local_err) { ret = -EINVAL; - error_setg(errp, "No hostname was specified"); + error_propagate(errp, local_err); goto err; } - host = qdict_get_str(options, "host"); - if (qdict_haskey(options, "port")) { - port = qdict_get_int(options, "port"); - } else { - port = 22; + host = qemu_opt_get(opts, "host"); + if (!host) { + ret = -EINVAL; + error_setg(errp, "No hostname was specified"); + goto err; } - if (!qdict_haskey(options, "path")) { + port = qemu_opt_get_number(opts, "port", 22); + + path = qemu_opt_get(opts, "path"); + if (!path) { ret = -EINVAL; error_setg(errp, "No path was specified"); goto err; } - path = qdict_get_str(options, "path"); - if (qdict_haskey(options, "user")) { - user = qdict_get_str(options, "user"); - } else { + user = qemu_opt_get(opts, "user"); + if (!user) { user = g_get_user_name(); if (!user) { error_setg_errno(errp, errno, "Can't get user name"); @@ -546,9 +583,8 @@ static int connect_to_ssh(BDRVSSHState *s, QDict *options, } } - if (qdict_haskey(options, "host_key_check")) { - host_key_check = qdict_get_str(options, "host_key_check"); - } else { + host_key_check = qemu_opt_get(opts, "host_key_check"); + if (!host_key_check) { host_key_check = "yes"; } @@ -612,21 +648,14 @@ static int connect_to_ssh(BDRVSSHState *s, QDict *options, goto err; } + qemu_opts_del(opts); + r = libssh2_sftp_fstat(s->sftp_handle, &s->attrs); if (r < 0) { sftp_error_setg(errp, s, "failed to read file attributes"); return -EINVAL; } - /* Delete the options we've used; any not deleted will cause the - * block layer to give an error about unused options. - */ - qdict_del(options, "host"); - qdict_del(options, "port"); - qdict_del(options, "user"); - qdict_del(options, "path"); - qdict_del(options, "host_key_check"); - return 0; err: @@ -646,6 +675,8 @@ static int connect_to_ssh(BDRVSSHState *s, QDict *options, } s->session = NULL; + qemu_opts_del(opts); + return ret; } diff --git a/block/trace-events b/block/trace-events index 978ef4f02a..05fa13c891 100644 --- a/block/trace-events +++ b/block/trace-events @@ -1,4 +1,4 @@ -# See docs/trace-events.txt for syntax documentation. +# See docs/tracing.txt for syntax documentation. # block.c bdrv_open_common(void *bs, const char *filename, int flags, const char *format_name) "bs %p filename \"%s\" flags %#x format_name \"%s\"" diff --git a/bsd-user/main.c b/bsd-user/main.c index b4a0a00c3f..0fb08e405d 100644 --- a/bsd-user/main.c +++ b/bsd-user/main.c @@ -17,6 +17,7 @@ * along with this program; if not, see <http://www.gnu.org/licenses/>. */ #include "qemu/osdep.h" +#include "qemu-version.h" #include <machine/trap.h> #include "qapi/error.h" diff --git a/configure b/configure index 8d849191db..4b808f9d17 100755 --- a/configure +++ b/configure @@ -4699,7 +4699,16 @@ roms= if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) -a \ "$targetos" != "Darwin" -a "$targetos" != "SunOS" -a \ "$softmmu" = yes ; then - roms="optionrom" + # Different host OS linkers have different ideas about the name of the ELF + # emulation. Linux and OpenBSD use 'elf_i386'; FreeBSD uses the _fbsd + # variant; and Windows uses i386pe. + for emu in elf_i386 elf_i386_fbsd i386pe; do + if "$ld" -verbose 2>&1 | grep -q "^[[:space:]]*$emu[[:space:]]*$"; then + ld_i386_emulation="$emu" + roms="optionrom" + break + fi + done fi if test "$cpu" = "ppc64" -a "$targetos" != "Darwin" ; then roms="$roms spapr-rtas" @@ -5539,6 +5548,7 @@ fi echo "LDFLAGS=$LDFLAGS" >> $config_host_mak echo "LDFLAGS_NOPIE=$LDFLAGS_NOPIE" >> $config_host_mak echo "LD_REL_FLAGS=$LD_REL_FLAGS" >> $config_host_mak +echo "LD_I386_EMULATION=$ld_i386_emulation" >> $config_host_mak echo "LIBS+=$LIBS" >> $config_host_mak echo "LIBS_TOOLS+=$libs_tools" >> $config_host_mak echo "PTHREAD_LIB=$PTHREAD_LIB" >> $config_host_mak diff --git a/crypto/trace-events b/crypto/trace-events index 71f1d99bf6..8181843723 100644 --- a/crypto/trace-events +++ b/crypto/trace-events @@ -1,4 +1,4 @@ -# See docs/trace-events.txt for syntax documentation. +# See docs/tracing.txt for syntax documentation. # crypto/tlscreds.c qcrypto_tls_creds_load_dh(void *creds, const char *filename) "TLS creds load DH creds=%p filename=%s" diff --git a/fpu/softfloat-specialize.h b/fpu/softfloat-specialize.h index 43d08903a5..f5aed72e8f 100644 --- a/fpu/softfloat-specialize.h +++ b/fpu/softfloat-specialize.h @@ -197,7 +197,7 @@ float128 float128_default_nan(float_status *status) | should be simply `float_exception_flags |= flags;'. *----------------------------------------------------------------------------*/ -void float_raise(int8_t flags, float_status *status) +void float_raise(uint8_t flags, float_status *status) { status->float_exception_flags |= flags; } diff --git a/hw/9pfs/trace-events b/hw/9pfs/trace-events index 63efa27a80..48d3d8abed 100644 --- a/hw/9pfs/trace-events +++ b/hw/9pfs/trace-events @@ -1,4 +1,4 @@ -# See docs/trace-events.txt for syntax documentation. +# See docs/tracing.txt for syntax documentation. # hw/9pfs/virtio-9p.c v9fs_rerror(uint16_t tag, uint8_t id, int err) "tag %d id %d err %d" diff --git a/hw/acpi/trace-events b/hw/acpi/trace-events index 5aa3ba67c8..c379607a3e 100644 --- a/hw/acpi/trace-events +++ b/hw/acpi/trace-events @@ -1,4 +1,4 @@ -# See docs/trace-events.txt for syntax documentation. +# See docs/tracing.txt for syntax documentation. # hw/acpi/memory_hotplug.c mhp_acpi_invalid_slot_selected(uint32_t slot) "0x%"PRIx32 diff --git a/hw/alpha/trace-events b/hw/alpha/trace-events index 7d52b5d1a3..e44ff01a09 100644 --- a/hw/alpha/trace-events +++ b/hw/alpha/trace-events @@ -1,4 +1,4 @@ -# See docs/trace-events.txt for syntax documentation. +# See docs/tracing.txt for syntax documentation. # hw/alpha/pci.c alpha_pci_iack_write(void) "" diff --git a/hw/arm/trace-events b/hw/arm/trace-events index d0dad16aed..d5f33a2a03 100644 --- a/hw/arm/trace-events +++ b/hw/arm/trace-events @@ -1,4 +1,4 @@ -# See docs/trace-events.txt for syntax documentation. +# See docs/tracing.txt for syntax documentation. # hw/arm/virt-acpi-build.c virt_acpi_setup(void) "No fw cfg or ACPI disabled. Bailing out." diff --git a/hw/audio/trace-events b/hw/audio/trace-events index 796f4a10df..3210386e86 100644 --- a/hw/audio/trace-events +++ b/hw/audio/trace-events @@ -1,4 +1,4 @@ -# See docs/trace-events.txt for syntax documentation. +# See docs/tracing.txt for syntax documentation. # hw/audio/cs4231.c cs4231_mem_readl_dreg(uint32_t reg, uint32_t ret) "read dreg %d: 0x%02x" diff --git a/hw/block/trace-events b/hw/block/trace-events index 31df44b399..d0dd94ff05 100644 --- a/hw/block/trace-events +++ b/hw/block/trace-events @@ -1,4 +1,4 @@ -# See docs/trace-events.txt for syntax documentation. +# See docs/tracing.txt for syntax documentation. # hw/block/virtio-blk.c virtio_blk_req_complete(void *req, int status) "req %p status %d" diff --git a/hw/char/trace-events b/hw/char/trace-events index 005fcd8ca7..d53577c99d 100644 --- a/hw/char/trace-events +++ b/hw/char/trace-events @@ -1,4 +1,4 @@ -# See docs/trace-events.txt for syntax documentation. +# See docs/tracing.txt for syntax documentation. # hw/char/virtio-serial-bus.c virtio_serial_send_control_event(unsigned int port, uint16_t event, uint16_t value) "port %u, event %u, value %u" diff --git a/hw/display/trace-events b/hw/display/trace-events index 78f04657a0..332ababd8e 100644 --- a/hw/display/trace-events +++ b/hw/display/trace-events @@ -1,4 +1,4 @@ -# See docs/trace-events.txt for syntax documentation. +# See docs/tracing.txt for syntax documentation. # hw/display/jazz_led.c jazz_led_read(uint64_t addr, uint8_t val) "read addr=0x%"PRIx64": 0x%x" diff --git a/hw/dma/trace-events b/hw/dma/trace-events index d8a56744e1..22878dfdb6 100644 --- a/hw/dma/trace-events +++ b/hw/dma/trace-events @@ -1,4 +1,4 @@ -# See docs/trace-events.txt for syntax documentation. +# See docs/tracing.txt for syntax documentation. # hw/dma/rc4030.c jazzio_read(uint64_t addr, uint32_t ret) "read reg[0x%"PRIx64"] = 0x%x" diff --git a/hw/i386/trace-events b/hw/i386/trace-events index b4882c1157..7735e46eaf 100644 --- a/hw/i386/trace-events +++ b/hw/i386/trace-events @@ -1,4 +1,4 @@ -# See docs/trace-events.txt for syntax documentation. +# See docs/tracing.txt for syntax documentation. # hw/i386/xen/xen_platform.c xen_platform_log(char *s) "xen platform: %s" diff --git a/hw/input/trace-events b/hw/input/trace-events index f24dff2f8b..8c4003f361 100644 --- a/hw/input/trace-events +++ b/hw/input/trace-events @@ -1,4 +1,4 @@ -# See docs/trace-events.txt for syntax documentation. +# See docs/tracing.txt for syntax documentation. # hw/input/ps2.c ps2_put_keycode(void *opaque, int keycode) "%p keycode %d" diff --git a/hw/intc/trace-events b/hw/intc/trace-events index 376dd18643..f12192c082 100644 --- a/hw/intc/trace-events +++ b/hw/intc/trace-events @@ -1,4 +1,4 @@ -# See docs/trace-events.txt for syntax documentation. +# See docs/tracing.txt for syntax documentation. # hw/intc/apic_common.c cpu_set_apic_base(uint64_t val) "%016"PRIx64 diff --git a/hw/isa/trace-events b/hw/isa/trace-events index 686282fd19..9faca41a97 100644 --- a/hw/isa/trace-events +++ b/hw/isa/trace-events @@ -1,4 +1,4 @@ -# See docs/trace-events.txt for syntax documentation. +# See docs/tracing.txt for syntax documentation. # hw/isa/pc87312.c pc87312_io_read(uint32_t addr, uint32_t val) "read addr=%x val=%x" diff --git a/hw/misc/trace-events b/hw/misc/trace-events index ea52a14d78..0cc556ca9f 100644 --- a/hw/misc/trace-events +++ b/hw/misc/trace-events @@ -1,4 +1,4 @@ -# See docs/trace-events.txt for syntax documentation. +# See docs/tracing.txt for syntax documentation. # hw/misc/eccmemctl.c ecc_mem_writel_mer(uint32_t val) "Write memory enable %08x" diff --git a/hw/net/e1000e.c b/hw/net/e1000e.c index d001c96668..bad43f474e 100644 --- a/hw/net/e1000e.c +++ b/hw/net/e1000e.c @@ -69,7 +69,6 @@ typedef struct E1000EState { uint16_t subsys_ven_used; uint16_t subsys_used; - uint32_t intr_state; bool disable_vnet; E1000ECore core; @@ -89,8 +88,6 @@ typedef struct E1000EState { #define E1000E_MSIX_TABLE (0x0000) #define E1000E_MSIX_PBA (0x2000) -#define E1000E_USE_MSIX BIT(0) - static uint64_t e1000e_mmio_read(void *opaque, hwaddr addr, unsigned size) { @@ -302,8 +299,6 @@ e1000e_init_msix(E1000EState *s) } else { if (!e1000e_use_msix_vectors(s, E1000E_MSIX_VEC_NUM)) { msix_uninit(d, &s->msix, &s->msix); - } else { - s->intr_state |= E1000E_USE_MSIX; } } } @@ -311,7 +306,7 @@ e1000e_init_msix(E1000EState *s) static void e1000e_cleanup_msix(E1000EState *s) { - if (s->intr_state & E1000E_USE_MSIX) { + if (msix_enabled(PCI_DEVICE(s))) { e1000e_unuse_msix_vectors(s, E1000E_MSIX_VEC_NUM); msix_uninit(PCI_DEVICE(s), &s->msix, &s->msix); } @@ -601,7 +596,6 @@ static const VMStateDescription e1000e_vmstate = { VMSTATE_MSIX(parent_obj, E1000EState), VMSTATE_UINT32(ioaddr, E1000EState), - VMSTATE_UINT32(intr_state, E1000EState), VMSTATE_UINT32(core.rxbuf_min_shift, E1000EState), VMSTATE_UINT8(core.rx_desc_len, E1000EState), VMSTATE_UINT32_ARRAY(core.rxbuf_sizes, E1000EState, diff --git a/hw/net/net_tx_pkt.c b/hw/net/net_tx_pkt.c index 53dfaa292c..20b25496e5 100644 --- a/hw/net/net_tx_pkt.c +++ b/hw/net/net_tx_pkt.c @@ -65,10 +65,9 @@ void net_tx_pkt_init(struct NetTxPkt **pkt, PCIDevice *pci_dev, p->pci_dev = pci_dev; - p->vec = g_malloc((sizeof *p->vec) * - (max_frags + NET_TX_PKT_PL_START_FRAG)); + p->vec = g_new(struct iovec, max_frags + NET_TX_PKT_PL_START_FRAG); - p->raw = g_malloc((sizeof *p->raw) * max_frags); + p->raw = g_new(struct iovec, max_frags); p->max_payload_frags = max_frags; p->max_raw_frags = max_frags; diff --git a/hw/net/trace-events b/hw/net/trace-events index aaa905fb11..8d38d7724d 100644 --- a/hw/net/trace-events +++ b/hw/net/trace-events @@ -1,4 +1,4 @@ -# See docs/trace-events.txt for syntax documentation. +# See docs/tracing.txt for syntax documentation. # hw/net/lance.c lance_mem_readw(uint64_t addr, uint32_t ret) "addr=%"PRIx64"val=0x%04x" diff --git a/hw/nvram/trace-events b/hw/nvram/trace-events index 325447d986..1f1e05ab69 100644 --- a/hw/nvram/trace-events +++ b/hw/nvram/trace-events @@ -1,4 +1,4 @@ -# See docs/trace-events.txt for syntax documentation. +# See docs/tracing.txt for syntax documentation. # hw/nvram/ds1225y.c nvram_read(uint32_t addr, uint32_t ret) "read addr %d: 0x%02x" diff --git a/hw/pci/trace-events b/hw/pci/trace-events index 285338ac4d..2b9cf24405 100644 --- a/hw/pci/trace-events +++ b/hw/pci/trace-events @@ -1,4 +1,4 @@ -# See docs/trace-events.txt for syntax documentation. +# See docs/tracing.txt for syntax documentation. # hw/pci/pci.c pci_update_mappings_del(void *d, uint32_t bus, uint32_t slot, uint32_t func, int bar, uint64_t addr, uint64_t size) "d=%p %02x:%02x.%x %d,%#"PRIx64"+%#"PRIx64 diff --git a/hw/ppc/ppc.c b/hw/ppc/ppc.c index e4252528a6..8945869009 100644 --- a/hw/ppc/ppc.c +++ b/hw/ppc/ppc.c @@ -33,6 +33,7 @@ #include "hw/timer/m48t59.h" #include "qemu/log.h" #include "qemu/error-report.h" +#include "qapi/error.h" #include "hw/loader.h" #include "sysemu/kvm.h" #include "kvm_ppc.h" @@ -1350,3 +1351,28 @@ PowerPCCPU *ppc_get_vcpu_by_dt_id(int cpu_dt_id) return NULL; } + +void ppc_cpu_parse_features(const char *cpu_model) +{ + CPUClass *cc; + ObjectClass *oc; + const char *typename; + gchar **model_pieces; + + model_pieces = g_strsplit(cpu_model, ",", 2); + if (!model_pieces[0]) { + error_report("Invalid/empty CPU model name"); + exit(1); + } + + oc = cpu_class_by_name(TYPE_POWERPC_CPU, model_pieces[0]); + if (oc == NULL) { + error_report("Unable to find CPU definition: %s", model_pieces[0]); + exit(1); + } + + typename = object_class_get_name(oc); + cc = CPU_CLASS(oc); + cc->parse_features(typename, model_pieces[1], &error_fatal); + g_strfreev(model_pieces); +} diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 0787c66486..30d6800ab3 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -1812,6 +1812,8 @@ static void ppc_spapr_init(MachineState *machine) machine->cpu_model = kvm_enabled() ? "host" : "POWER7"; } + ppc_cpu_parse_features(machine->cpu_model); + if (mc->query_hotpluggable_cpus) { char *type = spapr_get_cpu_core_type(machine->cpu_model); diff --git a/hw/ppc/trace-events b/hw/ppc/trace-events index 900679bc9d..dfeab93089 100644 --- a/hw/ppc/trace-events +++ b/hw/ppc/trace-events @@ -1,4 +1,4 @@ -# See docs/trace-events.txt for syntax documentation. +# See docs/tracing.txt for syntax documentation. # hw/ppc/spapr_pci.c spapr_pci_msi(const char *msg, uint32_t ca) "%s (cfg=%x)" diff --git a/hw/s390x/trace-events b/hw/s390x/trace-events index 72c4549e37..84ea964875 100644 --- a/hw/s390x/trace-events +++ b/hw/s390x/trace-events @@ -1,4 +1,4 @@ -# See docs/trace-events.txt for syntax documentation. +# See docs/tracing.txt for syntax documentation. # hw/s390x/css.c css_enable_facility(const char *facility) "CSS: enable %s" diff --git a/hw/scsi/trace-events b/hw/scsi/trace-events index 5f19e32076..ed64858fe3 100644 --- a/hw/scsi/trace-events +++ b/hw/scsi/trace-events @@ -1,4 +1,4 @@ -# See docs/trace-events.txt for syntax documentation. +# See docs/tracing.txt for syntax documentation. # hw/scsi/scsi-bus.c scsi_req_alloc(int target, int lun, int tag) "target %d lun %d tag %d" diff --git a/hw/sd/trace-events b/hw/sd/trace-events index b580a0fbd5..b17e7ba442 100644 --- a/hw/sd/trace-events +++ b/hw/sd/trace-events @@ -1,4 +1,4 @@ -# See docs/trace-events.txt for syntax documentation. +# See docs/tracing.txt for syntax documentation. # hw/sd/milkymist-memcard.c milkymist_memcard_memory_read(uint32_t addr, uint32_t value) "addr %08x value %08x" diff --git a/hw/sparc/trace-events b/hw/sparc/trace-events index ab677a39d8..30fb0373e7 100644 --- a/hw/sparc/trace-events +++ b/hw/sparc/trace-events @@ -1,4 +1,4 @@ -# See docs/trace-events.txt for syntax documentation. +# See docs/tracing.txt for syntax documentation. # hw/sparc/sun4m.c sun4m_cpu_interrupt(unsigned int level) "Set CPU IRQ %d" diff --git a/hw/timer/trace-events b/hw/timer/trace-events index 19db4bfc0b..3495c41c18 100644 --- a/hw/timer/trace-events +++ b/hw/timer/trace-events @@ -1,4 +1,4 @@ -# See docs/trace-events.txt for syntax documentation. +# See docs/tracing.txt for syntax documentation. # hw/timer/slavio_timer.c slavio_timer_get_out(uint64_t limit, uint32_t counthigh, uint32_t count) "limit %"PRIx64" count %x%08x" diff --git a/hw/usb/trace-events b/hw/usb/trace-events index ac2d951b08..2d42fd45da 100644 --- a/hw/usb/trace-events +++ b/hw/usb/trace-events @@ -1,4 +1,4 @@ -# See docs/trace-events.txt for syntax documentation. +# See docs/tracing.txt for syntax documentation. # hw/usb/core.c usb_packet_state_change(int bus, const char *port, int ep, void *p, const char *o, const char *n) "bus %d, port %s, ep %d, packet %p, state %s -> %s" diff --git a/hw/vfio/trace-events b/hw/vfio/trace-events index 4bb7690c46..da133221de 100644 --- a/hw/vfio/trace-events +++ b/hw/vfio/trace-events @@ -1,4 +1,4 @@ -# See docs/trace-events.txt for syntax documentation. +# See docs/tracing.txt for syntax documentation. # hw/vfio/pci.c vfio_intx_interrupt(const char *name, char line) " (%s) Pin %c" diff --git a/hw/virtio/trace-events b/hw/virtio/trace-events index 2853053505..55184d33b3 100644 --- a/hw/virtio/trace-events +++ b/hw/virtio/trace-events @@ -1,4 +1,4 @@ -# See docs/trace-events.txt for syntax documentation. +# See docs/tracing.txt for syntax documentation. # hw/virtio/virtio.c virtqueue_fill(void *vq, const void *elem, unsigned int len, unsigned int idx) "vq %p elem %p len %u idx %u" diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c index 1a7d53c8f4..b57454a4b7 100644 --- a/hw/virtio/vhost-user.c +++ b/hw/virtio/vhost-user.c @@ -263,6 +263,66 @@ static int vhost_user_set_log_base(struct vhost_dev *dev, uint64_t base, return 0; } +static int vhost_user_set_mem_table(struct vhost_dev *dev, + struct vhost_memory *mem) +{ + int fds[VHOST_MEMORY_MAX_NREGIONS]; + int i, fd; + size_t fd_num = 0; + bool reply_supported = virtio_has_feature(dev->protocol_features, + VHOST_USER_PROTOCOL_F_REPLY_ACK); + + VhostUserMsg msg = { + .request = VHOST_USER_SET_MEM_TABLE, + .flags = VHOST_USER_VERSION, + }; + + if (reply_supported) { + msg.flags |= VHOST_USER_NEED_REPLY_MASK; + } + + for (i = 0; i < dev->mem->nregions; ++i) { + struct vhost_memory_region *reg = dev->mem->regions + i; + ram_addr_t offset; + MemoryRegion *mr; + + assert((uintptr_t)reg->userspace_addr == reg->userspace_addr); + mr = memory_region_from_host((void *)(uintptr_t)reg->userspace_addr, + &offset); + fd = memory_region_get_fd(mr); + if (fd > 0) { + msg.payload.memory.regions[fd_num].userspace_addr = reg->userspace_addr; + msg.payload.memory.regions[fd_num].memory_size = reg->memory_size; + msg.payload.memory.regions[fd_num].guest_phys_addr = reg->guest_phys_addr; + msg.payload.memory.regions[fd_num].mmap_offset = offset; + assert(fd_num < VHOST_MEMORY_MAX_NREGIONS); + fds[fd_num++] = fd; + } + } + + msg.payload.memory.nregions = fd_num; + + if (!fd_num) { + error_report("Failed initializing vhost-user memory map, " + "consider using -object memory-backend-file share=on"); + return -1; + } + + msg.size = sizeof(msg.payload.memory.nregions); + msg.size += sizeof(msg.payload.memory.padding); + msg.size += fd_num * sizeof(VhostUserMemoryRegion); + + if (vhost_user_write(dev, &msg, fds, fd_num) < 0) { + return -1; + } + + if (reply_supported) { + return process_message_reply(dev, msg.request); + } + + return 0; +} + static int vhost_user_set_vring_addr(struct vhost_dev *dev, struct vhost_vring_addr *addr) { @@ -477,73 +537,6 @@ static int vhost_user_get_features(struct vhost_dev *dev, uint64_t *features) return vhost_user_get_u64(dev, VHOST_USER_GET_FEATURES, features); } -static int vhost_user_set_mem_table(struct vhost_dev *dev, - struct vhost_memory *mem) -{ - int fds[VHOST_MEMORY_MAX_NREGIONS]; - int i, fd; - size_t fd_num = 0; - uint64_t features; - bool reply_supported = virtio_has_feature(dev->protocol_features, - VHOST_USER_PROTOCOL_F_REPLY_ACK); - - VhostUserMsg msg = { - .request = VHOST_USER_SET_MEM_TABLE, - .flags = VHOST_USER_VERSION, - }; - - if (reply_supported) { - msg.flags |= VHOST_USER_NEED_REPLY_MASK; - } - - for (i = 0; i < dev->mem->nregions; ++i) { - struct vhost_memory_region *reg = dev->mem->regions + i; - ram_addr_t offset; - MemoryRegion *mr; - - assert((uintptr_t)reg->userspace_addr == reg->userspace_addr); - mr = memory_region_from_host((void *)(uintptr_t)reg->userspace_addr, - &offset); - fd = memory_region_get_fd(mr); - if (fd > 0) { - msg.payload.memory.regions[fd_num].userspace_addr - = reg->userspace_addr; - msg.payload.memory.regions[fd_num].memory_size = reg->memory_size; - msg.payload.memory.regions[fd_num].guest_phys_addr - = reg->guest_phys_addr; - msg.payload.memory.regions[fd_num].mmap_offset = offset; - assert(fd_num < VHOST_MEMORY_MAX_NREGIONS); - fds[fd_num++] = fd; - } - } - - msg.payload.memory.nregions = fd_num; - - if (!fd_num) { - error_report("Failed initializing vhost-user memory map, " - "consider using -object memory-backend-file share=on"); - return -1; - } - - msg.size = sizeof(msg.payload.memory.nregions); - msg.size += sizeof(msg.payload.memory.padding); - msg.size += fd_num * sizeof(VhostUserMemoryRegion); - - vhost_user_write(dev, &msg, fds, fd_num); - - if (reply_supported) { - return process_message_reply(dev, msg.request); - } else { - /* Note: It is (yet) unknown when the client application has finished - * remapping the GPA. - * Attempt to prevent a race by sending a command that requires a reply. - */ - vhost_user_get_features(dev, &features); - } - - return 0; -} - static int vhost_user_set_owner(struct vhost_dev *dev) { VhostUserMsg msg = { diff --git a/hw/xen/xen_pt_config_init.c b/hw/xen/xen_pt_config_init.c index 9869ffda01..6f18366f67 100644 --- a/hw/xen/xen_pt_config_init.c +++ b/hw/xen/xen_pt_config_init.c @@ -2049,9 +2049,8 @@ void xen_pt_config_init(XenPCIPassthroughState *s, Error **errp) for (j = 0; regs->size != 0; j++, regs++) { xen_pt_config_reg_init(s, reg_grp_entry, regs, &err); if (err) { - error_append_hint(&err, "Failed to initialize %d/%zu" - " reg 0x%x in grp_type = 0x%x (%d/%zu)", - j, ARRAY_SIZE(xen_pt_emu_reg_grps[i].emu_regs), + error_append_hint(&err, "Failed to init register %d" + " offsets 0x%x in grp_type = 0x%x (%d/%zu)", j, regs->offset, xen_pt_emu_reg_grps[i].grp_type, i, ARRAY_SIZE(xen_pt_emu_reg_grps)); error_propagate(errp, err); diff --git a/include/block/block_int.h b/include/block/block_int.h index 47665be81e..1e939de4fe 100644 --- a/include/block/block_int.h +++ b/include/block/block_int.h @@ -443,8 +443,8 @@ struct BlockDriverState { note this is a reference count */ CoQueue flush_queue; /* Serializing flush queue */ + BdrvTrackedRequest *active_flush_req; /* Flush request in flight */ unsigned int write_gen; /* Current data generation */ - unsigned int flush_started_gen; /* Generation for which flush has started */ unsigned int flushed_gen; /* Flushed write generation */ BlockDriver *drv; /* NULL means no media */ diff --git a/include/fpu/softfloat.h b/include/fpu/softfloat.h index 0e57ee53c0..1bde349b74 100644 --- a/include/fpu/softfloat.h +++ b/include/fpu/softfloat.h @@ -198,7 +198,7 @@ enum { typedef struct float_status { signed char float_detect_tininess; signed char float_rounding_mode; - signed char float_exception_flags; + uint8_t float_exception_flags; signed char floatx80_rounding_precision; /* should denormalised results go to zero and set the inexact flag? */ flag flush_to_zero; @@ -274,7 +274,7 @@ static inline flag get_default_nan_mode(float_status *status) | Routine to raise any or all of the software IEC/IEEE floating-point | exception flags. *----------------------------------------------------------------------------*/ -void float_raise(int8_t flags, float_status *status); +void float_raise(uint8_t flags, float_status *status); /*---------------------------------------------------------------------------- | If `a' is denormal and we are in flush-to-zero mode then set the diff --git a/include/glib-compat.h b/include/glib-compat.h index 01aa7b37a5..8d5a7f3801 100644 --- a/include/glib-compat.h +++ b/include/glib-compat.h @@ -48,6 +48,26 @@ static inline gint64 qemu_g_get_monotonic_time(void) gint g_poll_fixed(GPollFD *fds, guint nfds, gint timeout); #endif +#if !GLIB_CHECK_VERSION(2, 30, 0) +/* Not a 100% compatible implementation, but good enough for most + * cases. Placeholders are only supported at the end of the + * template. */ +static inline gchar *qemu_g_dir_make_tmp(gchar const *tmpl, GError **error) +{ + gchar *path = g_build_filename(g_get_tmp_dir(), tmpl ?: ".XXXXXX", NULL); + + if (mkdtemp(path) != NULL) { + return path; + } + /* Error occurred, clean up. */ + g_set_error(error, G_FILE_ERROR, g_file_error_from_errno(errno), + "mkdtemp() failed"); + g_free(path); + return NULL; +} +#define g_dir_make_tmp(tmpl, error) qemu_g_dir_make_tmp(tmpl, error) +#endif /* glib 2.30 */ + #if !GLIB_CHECK_VERSION(2, 31, 0) /* before glib-2.31, GMutex and GCond was dynamic-only (there was a separate * GStaticMutex, but it didn't work with condition variables). diff --git a/include/hw/ppc/ppc.h b/include/hw/ppc/ppc.h index 520c72a08d..00c1fb1e72 100644 --- a/include/hw/ppc/ppc.h +++ b/include/hw/ppc/ppc.h @@ -106,4 +106,5 @@ enum { /* ppc_booke.c */ void ppc_booke_timers_init(PowerPCCPU *cpu, uint32_t freq, uint32_t flags); +void ppc_cpu_parse_features(const char *cpu_model); #endif diff --git a/include/hw/virtio/virtio-gpu.h b/include/hw/virtio/virtio-gpu.h index e4f424ad4a..20d1cd683a 100644 --- a/include/hw/virtio/virtio-gpu.h +++ b/include/hw/virtio/virtio-gpu.h @@ -19,6 +19,7 @@ #include "ui/console.h" #include "hw/virtio/virtio.h" #include "hw/pci/pci.h" +#include "qemu/log.h" #include "standard-headers/linux/virtio_gpu.h" #define TYPE_VIRTIO_GPU "virtio-gpu-device" diff --git a/include/hw/xen/xen_common.h b/include/hw/xen/xen_common.h index 640c31e2c1..bd39287b8f 100644 --- a/include/hw/xen/xen_common.h +++ b/include/hw/xen/xen_common.h @@ -107,6 +107,44 @@ static inline int xen_get_vmport_regs_pfn(xc_interface *xc, domid_t dom, #endif +static inline int xen_get_default_ioreq_server_info(xc_interface *xc, + domid_t dom, + xen_pfn_t *ioreq_pfn, + xen_pfn_t *bufioreq_pfn, + evtchn_port_t + *bufioreq_evtchn) +{ + unsigned long param; + int rc; + + rc = xc_get_hvm_param(xc, dom, HVM_PARAM_IOREQ_PFN, ¶m); + if (rc < 0) { + fprintf(stderr, "failed to get HVM_PARAM_IOREQ_PFN\n"); + return -1; + } + + *ioreq_pfn = param; + + rc = xc_get_hvm_param(xc, dom, HVM_PARAM_BUFIOREQ_PFN, ¶m); + if (rc < 0) { + fprintf(stderr, "failed to get HVM_PARAM_BUFIOREQ_PFN\n"); + return -1; + } + + *bufioreq_pfn = param; + + rc = xc_get_hvm_param(xc, dom, HVM_PARAM_BUFIOREQ_EVTCHN, + ¶m); + if (rc < 0) { + fprintf(stderr, "failed to get HVM_PARAM_BUFIOREQ_EVTCHN\n"); + return -1; + } + + *bufioreq_evtchn = param; + + return 0; +} + /* Xen before 4.5 */ #if CONFIG_XEN_CTRL_INTERFACE_VERSION < 450 @@ -154,10 +192,9 @@ static inline void xen_unmap_pcidev(xc_interface *xc, domid_t dom, { } -static inline int xen_create_ioreq_server(xc_interface *xc, domid_t dom, - ioservid_t *ioservid) +static inline void xen_create_ioreq_server(xc_interface *xc, domid_t dom, + ioservid_t *ioservid) { - return 0; } static inline void xen_destroy_ioreq_server(xc_interface *xc, domid_t dom, @@ -171,35 +208,8 @@ static inline int xen_get_ioreq_server_info(xc_interface *xc, domid_t dom, xen_pfn_t *bufioreq_pfn, evtchn_port_t *bufioreq_evtchn) { - unsigned long param; - int rc; - - rc = xc_get_hvm_param(xc, dom, HVM_PARAM_IOREQ_PFN, ¶m); - if (rc < 0) { - fprintf(stderr, "failed to get HVM_PARAM_IOREQ_PFN\n"); - return -1; - } - - *ioreq_pfn = param; - - rc = xc_get_hvm_param(xc, dom, HVM_PARAM_BUFIOREQ_PFN, ¶m); - if (rc < 0) { - fprintf(stderr, "failed to get HVM_PARAM_BUFIOREQ_PFN\n"); - return -1; - } - - *bufioreq_pfn = param; - - rc = xc_get_hvm_param(xc, dom, HVM_PARAM_BUFIOREQ_EVTCHN, - ¶m); - if (rc < 0) { - fprintf(stderr, "failed to get HVM_PARAM_BUFIOREQ_EVTCHN\n"); - return -1; - } - - *bufioreq_evtchn = param; - - return 0; + return xen_get_default_ioreq_server_info(xc, dom, ioreq_pfn, bufioreq_pfn, + bufioreq_evtchn); } static inline int xen_set_ioreq_server_state(xc_interface *xc, domid_t dom, @@ -212,6 +222,8 @@ static inline int xen_set_ioreq_server_state(xc_interface *xc, domid_t dom, /* Xen 4.5 */ #else +static bool use_default_ioreq_server; + static inline void xen_map_memory_section(xc_interface *xc, domid_t dom, ioservid_t ioservid, MemoryRegionSection *section) @@ -220,6 +232,10 @@ static inline void xen_map_memory_section(xc_interface *xc, domid_t dom, ram_addr_t size = int128_get64(section->size); hwaddr end_addr = start_addr + size - 1; + if (use_default_ioreq_server) { + return; + } + trace_xen_map_mmio_range(ioservid, start_addr, end_addr); xc_hvm_map_io_range_to_ioreq_server(xc, dom, ioservid, 1, start_addr, end_addr); @@ -233,6 +249,11 @@ static inline void xen_unmap_memory_section(xc_interface *xc, domid_t dom, ram_addr_t size = int128_get64(section->size); hwaddr end_addr = start_addr + size - 1; + if (use_default_ioreq_server) { + return; + } + + trace_xen_unmap_mmio_range(ioservid, start_addr, end_addr); xc_hvm_unmap_io_range_from_ioreq_server(xc, dom, ioservid, 1, start_addr, end_addr); @@ -246,6 +267,11 @@ static inline void xen_map_io_section(xc_interface *xc, domid_t dom, ram_addr_t size = int128_get64(section->size); hwaddr end_addr = start_addr + size - 1; + if (use_default_ioreq_server) { + return; + } + + trace_xen_map_portio_range(ioservid, start_addr, end_addr); xc_hvm_map_io_range_to_ioreq_server(xc, dom, ioservid, 0, start_addr, end_addr); @@ -259,6 +285,10 @@ static inline void xen_unmap_io_section(xc_interface *xc, domid_t dom, ram_addr_t size = int128_get64(section->size); hwaddr end_addr = start_addr + size - 1; + if (use_default_ioreq_server) { + return; + } + trace_xen_unmap_portio_range(ioservid, start_addr, end_addr); xc_hvm_unmap_io_range_from_ioreq_server(xc, dom, ioservid, 0, start_addr, end_addr); @@ -268,6 +298,10 @@ static inline void xen_map_pcidev(xc_interface *xc, domid_t dom, ioservid_t ioservid, PCIDevice *pci_dev) { + if (use_default_ioreq_server) { + return; + } + trace_xen_map_pcidev(ioservid, pci_bus_num(pci_dev->bus), PCI_SLOT(pci_dev->devfn), PCI_FUNC(pci_dev->devfn)); xc_hvm_map_pcidev_to_ioreq_server(xc, dom, ioservid, @@ -280,6 +314,10 @@ static inline void xen_unmap_pcidev(xc_interface *xc, domid_t dom, ioservid_t ioservid, PCIDevice *pci_dev) { + if (use_default_ioreq_server) { + return; + } + trace_xen_unmap_pcidev(ioservid, pci_bus_num(pci_dev->bus), PCI_SLOT(pci_dev->devfn), PCI_FUNC(pci_dev->devfn)); xc_hvm_unmap_pcidev_from_ioreq_server(xc, dom, ioservid, @@ -288,22 +326,29 @@ static inline void xen_unmap_pcidev(xc_interface *xc, domid_t dom, PCI_FUNC(pci_dev->devfn)); } -static inline int xen_create_ioreq_server(xc_interface *xc, domid_t dom, - ioservid_t *ioservid) +static inline void xen_create_ioreq_server(xc_interface *xc, domid_t dom, + ioservid_t *ioservid) { int rc = xc_hvm_create_ioreq_server(xc, dom, HVM_IOREQSRV_BUFIOREQ_ATOMIC, ioservid); if (rc == 0) { trace_xen_ioreq_server_create(*ioservid); + return; } - return rc; + *ioservid = 0; + use_default_ioreq_server = true; + trace_xen_default_ioreq_server(); } static inline void xen_destroy_ioreq_server(xc_interface *xc, domid_t dom, ioservid_t ioservid) { + if (use_default_ioreq_server) { + return; + } + trace_xen_ioreq_server_destroy(ioservid); xc_hvm_destroy_ioreq_server(xc, dom, ioservid); } @@ -314,6 +359,12 @@ static inline int xen_get_ioreq_server_info(xc_interface *xc, domid_t dom, xen_pfn_t *bufioreq_pfn, evtchn_port_t *bufioreq_evtchn) { + if (use_default_ioreq_server) { + return xen_get_default_ioreq_server_info(xc, dom, ioreq_pfn, + bufioreq_pfn, + bufioreq_evtchn); + } + return xc_hvm_get_ioreq_server_info(xc, dom, ioservid, ioreq_pfn, bufioreq_pfn, bufioreq_evtchn); @@ -323,6 +374,10 @@ static inline int xen_set_ioreq_server_state(xc_interface *xc, domid_t dom, ioservid_t ioservid, bool enable) { + if (use_default_ioreq_server) { + return 0; + } + trace_xen_ioreq_server_state(ioservid, enable); return xc_hvm_set_ioreq_server_state(xc, dom, ioservid, enable); } diff --git a/io/trace-events b/io/trace-events index 1108c16b82..d064665f44 100644 --- a/io/trace-events +++ b/io/trace-events @@ -1,4 +1,4 @@ -# See docs/trace-events.txt for syntax documentation. +# See docs/tracing.txt for syntax documentation. # io/buffer.c buffer_resize(const char *buf, size_t olen, size_t len) "%s: old %zd, new %zd" diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 833f853200..ca06943f3b 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -289,6 +289,161 @@ static bitmask_transtbl fcntl_flags_tbl[] = { { 0, 0, 0, 0 } }; +enum { + QEMU_IFLA_BR_UNSPEC, + QEMU_IFLA_BR_FORWARD_DELAY, + QEMU_IFLA_BR_HELLO_TIME, + QEMU_IFLA_BR_MAX_AGE, + QEMU_IFLA_BR_AGEING_TIME, + QEMU_IFLA_BR_STP_STATE, + QEMU_IFLA_BR_PRIORITY, + QEMU_IFLA_BR_VLAN_FILTERING, + QEMU_IFLA_BR_VLAN_PROTOCOL, + QEMU_IFLA_BR_GROUP_FWD_MASK, + QEMU_IFLA_BR_ROOT_ID, + QEMU_IFLA_BR_BRIDGE_ID, + QEMU_IFLA_BR_ROOT_PORT, + QEMU_IFLA_BR_ROOT_PATH_COST, + QEMU_IFLA_BR_TOPOLOGY_CHANGE, + QEMU_IFLA_BR_TOPOLOGY_CHANGE_DETECTED, + QEMU_IFLA_BR_HELLO_TIMER, + QEMU_IFLA_BR_TCN_TIMER, + QEMU_IFLA_BR_TOPOLOGY_CHANGE_TIMER, + QEMU_IFLA_BR_GC_TIMER, + QEMU_IFLA_BR_GROUP_ADDR, + QEMU_IFLA_BR_FDB_FLUSH, + QEMU_IFLA_BR_MCAST_ROUTER, + QEMU_IFLA_BR_MCAST_SNOOPING, + QEMU_IFLA_BR_MCAST_QUERY_USE_IFADDR, + QEMU_IFLA_BR_MCAST_QUERIER, + QEMU_IFLA_BR_MCAST_HASH_ELASTICITY, + QEMU_IFLA_BR_MCAST_HASH_MAX, + QEMU_IFLA_BR_MCAST_LAST_MEMBER_CNT, + QEMU_IFLA_BR_MCAST_STARTUP_QUERY_CNT, + QEMU_IFLA_BR_MCAST_LAST_MEMBER_INTVL, + QEMU_IFLA_BR_MCAST_MEMBERSHIP_INTVL, + QEMU_IFLA_BR_MCAST_QUERIER_INTVL, + QEMU_IFLA_BR_MCAST_QUERY_INTVL, + QEMU_IFLA_BR_MCAST_QUERY_RESPONSE_INTVL, + QEMU_IFLA_BR_MCAST_STARTUP_QUERY_INTVL, + QEMU_IFLA_BR_NF_CALL_IPTABLES, + QEMU_IFLA_BR_NF_CALL_IP6TABLES, + QEMU_IFLA_BR_NF_CALL_ARPTABLES, + QEMU_IFLA_BR_VLAN_DEFAULT_PVID, + QEMU_IFLA_BR_PAD, + QEMU_IFLA_BR_VLAN_STATS_ENABLED, + QEMU_IFLA_BR_MCAST_STATS_ENABLED, + QEMU___IFLA_BR_MAX, +}; + +enum { + QEMU_IFLA_UNSPEC, + QEMU_IFLA_ADDRESS, + QEMU_IFLA_BROADCAST, + QEMU_IFLA_IFNAME, + QEMU_IFLA_MTU, + QEMU_IFLA_LINK, + QEMU_IFLA_QDISC, + QEMU_IFLA_STATS, + QEMU_IFLA_COST, + QEMU_IFLA_PRIORITY, + QEMU_IFLA_MASTER, + QEMU_IFLA_WIRELESS, + QEMU_IFLA_PROTINFO, + QEMU_IFLA_TXQLEN, + QEMU_IFLA_MAP, + QEMU_IFLA_WEIGHT, + QEMU_IFLA_OPERSTATE, + QEMU_IFLA_LINKMODE, + QEMU_IFLA_LINKINFO, + QEMU_IFLA_NET_NS_PID, + QEMU_IFLA_IFALIAS, + QEMU_IFLA_NUM_VF, + QEMU_IFLA_VFINFO_LIST, + QEMU_IFLA_STATS64, + QEMU_IFLA_VF_PORTS, + QEMU_IFLA_PORT_SELF, + QEMU_IFLA_AF_SPEC, + QEMU_IFLA_GROUP, + QEMU_IFLA_NET_NS_FD, + QEMU_IFLA_EXT_MASK, + QEMU_IFLA_PROMISCUITY, + QEMU_IFLA_NUM_TX_QUEUES, + QEMU_IFLA_NUM_RX_QUEUES, + QEMU_IFLA_CARRIER, + QEMU_IFLA_PHYS_PORT_ID, + QEMU_IFLA_CARRIER_CHANGES, + QEMU_IFLA_PHYS_SWITCH_ID, + QEMU_IFLA_LINK_NETNSID, + QEMU_IFLA_PHYS_PORT_NAME, + QEMU_IFLA_PROTO_DOWN, + QEMU_IFLA_GSO_MAX_SEGS, + QEMU_IFLA_GSO_MAX_SIZE, + QEMU_IFLA_PAD, + QEMU_IFLA_XDP, + QEMU___IFLA_MAX +}; + +enum { + QEMU_IFLA_BRPORT_UNSPEC, + QEMU_IFLA_BRPORT_STATE, + QEMU_IFLA_BRPORT_PRIORITY, + QEMU_IFLA_BRPORT_COST, + QEMU_IFLA_BRPORT_MODE, + QEMU_IFLA_BRPORT_GUARD, + QEMU_IFLA_BRPORT_PROTECT, + QEMU_IFLA_BRPORT_FAST_LEAVE, + QEMU_IFLA_BRPORT_LEARNING, + QEMU_IFLA_BRPORT_UNICAST_FLOOD, + QEMU_IFLA_BRPORT_PROXYARP, + QEMU_IFLA_BRPORT_LEARNING_SYNC, + QEMU_IFLA_BRPORT_PROXYARP_WIFI, + QEMU_IFLA_BRPORT_ROOT_ID, + QEMU_IFLA_BRPORT_BRIDGE_ID, + QEMU_IFLA_BRPORT_DESIGNATED_PORT, + QEMU_IFLA_BRPORT_DESIGNATED_COST, + QEMU_IFLA_BRPORT_ID, + QEMU_IFLA_BRPORT_NO, + QEMU_IFLA_BRPORT_TOPOLOGY_CHANGE_ACK, + QEMU_IFLA_BRPORT_CONFIG_PENDING, + QEMU_IFLA_BRPORT_MESSAGE_AGE_TIMER, + QEMU_IFLA_BRPORT_FORWARD_DELAY_TIMER, + QEMU_IFLA_BRPORT_HOLD_TIMER, + QEMU_IFLA_BRPORT_FLUSH, + QEMU_IFLA_BRPORT_MULTICAST_ROUTER, + QEMU_IFLA_BRPORT_PAD, + QEMU___IFLA_BRPORT_MAX +}; + +enum { + QEMU_IFLA_INFO_UNSPEC, + QEMU_IFLA_INFO_KIND, + QEMU_IFLA_INFO_DATA, + QEMU_IFLA_INFO_XSTATS, + QEMU_IFLA_INFO_SLAVE_KIND, + QEMU_IFLA_INFO_SLAVE_DATA, + QEMU___IFLA_INFO_MAX, +}; + +enum { + QEMU_IFLA_INET_UNSPEC, + QEMU_IFLA_INET_CONF, + QEMU___IFLA_INET_MAX, +}; + +enum { + QEMU_IFLA_INET6_UNSPEC, + QEMU_IFLA_INET6_FLAGS, + QEMU_IFLA_INET6_CONF, + QEMU_IFLA_INET6_STATS, + QEMU_IFLA_INET6_MCAST, + QEMU_IFLA_INET6_CACHEINFO, + QEMU_IFLA_INET6_ICMP6STATS, + QEMU_IFLA_INET6_TOKEN, + QEMU_IFLA_INET6_ADDR_GEN_MODE, + QEMU___IFLA_INET6_MAX +}; + typedef abi_long (*TargetFdDataFunc)(void *, size_t); typedef abi_long (*TargetFdAddrFunc)(void *, abi_ulong, socklen_t); typedef struct TargetFdTrans { @@ -1784,66 +1939,66 @@ static abi_long host_to_target_data_bridge_nlattr(struct nlattr *nlattr, switch (nlattr->nla_type) { /* no data */ - case IFLA_BR_FDB_FLUSH: + case QEMU_IFLA_BR_FDB_FLUSH: break; /* binary */ - case IFLA_BR_GROUP_ADDR: + case QEMU_IFLA_BR_GROUP_ADDR: break; /* uint8_t */ - case IFLA_BR_VLAN_FILTERING: - case IFLA_BR_TOPOLOGY_CHANGE: - case IFLA_BR_TOPOLOGY_CHANGE_DETECTED: - case IFLA_BR_MCAST_ROUTER: - case IFLA_BR_MCAST_SNOOPING: - case IFLA_BR_MCAST_QUERY_USE_IFADDR: - case IFLA_BR_MCAST_QUERIER: - case IFLA_BR_NF_CALL_IPTABLES: - case IFLA_BR_NF_CALL_IP6TABLES: - case IFLA_BR_NF_CALL_ARPTABLES: + case QEMU_IFLA_BR_VLAN_FILTERING: + case QEMU_IFLA_BR_TOPOLOGY_CHANGE: + case QEMU_IFLA_BR_TOPOLOGY_CHANGE_DETECTED: + case QEMU_IFLA_BR_MCAST_ROUTER: + case QEMU_IFLA_BR_MCAST_SNOOPING: + case QEMU_IFLA_BR_MCAST_QUERY_USE_IFADDR: + case QEMU_IFLA_BR_MCAST_QUERIER: + case QEMU_IFLA_BR_NF_CALL_IPTABLES: + case QEMU_IFLA_BR_NF_CALL_IP6TABLES: + case QEMU_IFLA_BR_NF_CALL_ARPTABLES: break; /* uint16_t */ - case IFLA_BR_PRIORITY: - case IFLA_BR_VLAN_PROTOCOL: - case IFLA_BR_GROUP_FWD_MASK: - case IFLA_BR_ROOT_PORT: - case IFLA_BR_VLAN_DEFAULT_PVID: + case QEMU_IFLA_BR_PRIORITY: + case QEMU_IFLA_BR_VLAN_PROTOCOL: + case QEMU_IFLA_BR_GROUP_FWD_MASK: + case QEMU_IFLA_BR_ROOT_PORT: + case QEMU_IFLA_BR_VLAN_DEFAULT_PVID: u16 = NLA_DATA(nlattr); *u16 = tswap16(*u16); break; /* uint32_t */ - case IFLA_BR_FORWARD_DELAY: - case IFLA_BR_HELLO_TIME: - case IFLA_BR_MAX_AGE: - case IFLA_BR_AGEING_TIME: - case IFLA_BR_STP_STATE: - case IFLA_BR_ROOT_PATH_COST: - case IFLA_BR_MCAST_HASH_ELASTICITY: - case IFLA_BR_MCAST_HASH_MAX: - case IFLA_BR_MCAST_LAST_MEMBER_CNT: - case IFLA_BR_MCAST_STARTUP_QUERY_CNT: + case QEMU_IFLA_BR_FORWARD_DELAY: + case QEMU_IFLA_BR_HELLO_TIME: + case QEMU_IFLA_BR_MAX_AGE: + case QEMU_IFLA_BR_AGEING_TIME: + case QEMU_IFLA_BR_STP_STATE: + case QEMU_IFLA_BR_ROOT_PATH_COST: + case QEMU_IFLA_BR_MCAST_HASH_ELASTICITY: + case QEMU_IFLA_BR_MCAST_HASH_MAX: + case QEMU_IFLA_BR_MCAST_LAST_MEMBER_CNT: + case QEMU_IFLA_BR_MCAST_STARTUP_QUERY_CNT: u32 = NLA_DATA(nlattr); *u32 = tswap32(*u32); break; /* uint64_t */ - case IFLA_BR_HELLO_TIMER: - case IFLA_BR_TCN_TIMER: - case IFLA_BR_GC_TIMER: - case IFLA_BR_TOPOLOGY_CHANGE_TIMER: - case IFLA_BR_MCAST_LAST_MEMBER_INTVL: - case IFLA_BR_MCAST_MEMBERSHIP_INTVL: - case IFLA_BR_MCAST_QUERIER_INTVL: - case IFLA_BR_MCAST_QUERY_INTVL: - case IFLA_BR_MCAST_QUERY_RESPONSE_INTVL: - case IFLA_BR_MCAST_STARTUP_QUERY_INTVL: + case QEMU_IFLA_BR_HELLO_TIMER: + case QEMU_IFLA_BR_TCN_TIMER: + case QEMU_IFLA_BR_GC_TIMER: + case QEMU_IFLA_BR_TOPOLOGY_CHANGE_TIMER: + case QEMU_IFLA_BR_MCAST_LAST_MEMBER_INTVL: + case QEMU_IFLA_BR_MCAST_MEMBERSHIP_INTVL: + case QEMU_IFLA_BR_MCAST_QUERIER_INTVL: + case QEMU_IFLA_BR_MCAST_QUERY_INTVL: + case QEMU_IFLA_BR_MCAST_QUERY_RESPONSE_INTVL: + case QEMU_IFLA_BR_MCAST_STARTUP_QUERY_INTVL: u64 = NLA_DATA(nlattr); *u64 = tswap64(*u64); break; /* ifla_bridge_id: uin8_t[] */ - case IFLA_BR_ROOT_ID: - case IFLA_BR_BRIDGE_ID: + case QEMU_IFLA_BR_ROOT_ID: + case QEMU_IFLA_BR_BRIDGE_ID: break; default: - gemu_log("Unknown IFLA_BR type %d\n", nlattr->nla_type); + gemu_log("Unknown QEMU_IFLA_BR type %d\n", nlattr->nla_type); break; } return 0; @@ -1858,47 +2013,47 @@ static abi_long host_to_target_slave_data_bridge_nlattr(struct nlattr *nlattr, switch (nlattr->nla_type) { /* uint8_t */ - case IFLA_BRPORT_STATE: - case IFLA_BRPORT_MODE: - case IFLA_BRPORT_GUARD: - case IFLA_BRPORT_PROTECT: - case IFLA_BRPORT_FAST_LEAVE: - case IFLA_BRPORT_LEARNING: - case IFLA_BRPORT_UNICAST_FLOOD: - case IFLA_BRPORT_PROXYARP: - case IFLA_BRPORT_LEARNING_SYNC: - case IFLA_BRPORT_PROXYARP_WIFI: - case IFLA_BRPORT_TOPOLOGY_CHANGE_ACK: - case IFLA_BRPORT_CONFIG_PENDING: - case IFLA_BRPORT_MULTICAST_ROUTER: + case QEMU_IFLA_BRPORT_STATE: + case QEMU_IFLA_BRPORT_MODE: + case QEMU_IFLA_BRPORT_GUARD: + case QEMU_IFLA_BRPORT_PROTECT: + case QEMU_IFLA_BRPORT_FAST_LEAVE: + case QEMU_IFLA_BRPORT_LEARNING: + case QEMU_IFLA_BRPORT_UNICAST_FLOOD: + case QEMU_IFLA_BRPORT_PROXYARP: + case QEMU_IFLA_BRPORT_LEARNING_SYNC: + case QEMU_IFLA_BRPORT_PROXYARP_WIFI: + case QEMU_IFLA_BRPORT_TOPOLOGY_CHANGE_ACK: + case QEMU_IFLA_BRPORT_CONFIG_PENDING: + case QEMU_IFLA_BRPORT_MULTICAST_ROUTER: break; /* uint16_t */ - case IFLA_BRPORT_PRIORITY: - case IFLA_BRPORT_DESIGNATED_PORT: - case IFLA_BRPORT_DESIGNATED_COST: - case IFLA_BRPORT_ID: - case IFLA_BRPORT_NO: + case QEMU_IFLA_BRPORT_PRIORITY: + case QEMU_IFLA_BRPORT_DESIGNATED_PORT: + case QEMU_IFLA_BRPORT_DESIGNATED_COST: + case QEMU_IFLA_BRPORT_ID: + case QEMU_IFLA_BRPORT_NO: u16 = NLA_DATA(nlattr); *u16 = tswap16(*u16); break; /* uin32_t */ - case IFLA_BRPORT_COST: + case QEMU_IFLA_BRPORT_COST: u32 = NLA_DATA(nlattr); *u32 = tswap32(*u32); break; /* uint64_t */ - case IFLA_BRPORT_MESSAGE_AGE_TIMER: - case IFLA_BRPORT_FORWARD_DELAY_TIMER: - case IFLA_BRPORT_HOLD_TIMER: + case QEMU_IFLA_BRPORT_MESSAGE_AGE_TIMER: + case QEMU_IFLA_BRPORT_FORWARD_DELAY_TIMER: + case QEMU_IFLA_BRPORT_HOLD_TIMER: u64 = NLA_DATA(nlattr); *u64 = tswap64(*u64); break; /* ifla_bridge_id: uint8_t[] */ - case IFLA_BRPORT_ROOT_ID: - case IFLA_BRPORT_BRIDGE_ID: + case QEMU_IFLA_BRPORT_ROOT_ID: + case QEMU_IFLA_BRPORT_BRIDGE_ID: break; default: - gemu_log("Unknown IFLA_BRPORT type %d\n", nlattr->nla_type); + gemu_log("Unknown QEMU_IFLA_BRPORT type %d\n", nlattr->nla_type); break; } return 0; @@ -1918,20 +2073,20 @@ static abi_long host_to_target_data_linkinfo_nlattr(struct nlattr *nlattr, switch (nlattr->nla_type) { /* string */ - case IFLA_INFO_KIND: + case QEMU_IFLA_INFO_KIND: li_context->name = NLA_DATA(nlattr); li_context->len = nlattr->nla_len - NLA_HDRLEN; break; - case IFLA_INFO_SLAVE_KIND: + case QEMU_IFLA_INFO_SLAVE_KIND: li_context->slave_name = NLA_DATA(nlattr); li_context->slave_len = nlattr->nla_len - NLA_HDRLEN; break; /* stats */ - case IFLA_INFO_XSTATS: + case QEMU_IFLA_INFO_XSTATS: /* FIXME: only used by CAN */ break; /* nested */ - case IFLA_INFO_DATA: + case QEMU_IFLA_INFO_DATA: if (strncmp(li_context->name, "bridge", li_context->len) == 0) { return host_to_target_for_each_nlattr(NLA_DATA(nlattr), @@ -1939,10 +2094,10 @@ static abi_long host_to_target_data_linkinfo_nlattr(struct nlattr *nlattr, NULL, host_to_target_data_bridge_nlattr); } else { - gemu_log("Unknown IFLA_INFO_KIND %s\n", li_context->name); + gemu_log("Unknown QEMU_IFLA_INFO_KIND %s\n", li_context->name); } break; - case IFLA_INFO_SLAVE_DATA: + case QEMU_IFLA_INFO_SLAVE_DATA: if (strncmp(li_context->slave_name, "bridge", li_context->slave_len) == 0) { return host_to_target_for_each_nlattr(NLA_DATA(nlattr), @@ -1950,12 +2105,12 @@ static abi_long host_to_target_data_linkinfo_nlattr(struct nlattr *nlattr, NULL, host_to_target_slave_data_bridge_nlattr); } else { - gemu_log("Unknown IFLA_INFO_SLAVE_KIND %s\n", + gemu_log("Unknown QEMU_IFLA_INFO_SLAVE_KIND %s\n", li_context->slave_name); } break; default: - gemu_log("Unknown host IFLA_INFO type: %d\n", nlattr->nla_type); + gemu_log("Unknown host QEMU_IFLA_INFO type: %d\n", nlattr->nla_type); break; } @@ -1969,7 +2124,7 @@ static abi_long host_to_target_data_inet_nlattr(struct nlattr *nlattr, int i; switch (nlattr->nla_type) { - case IFLA_INET_CONF: + case QEMU_IFLA_INET_CONF: u32 = NLA_DATA(nlattr); for (i = 0; i < (nlattr->nla_len - NLA_HDRLEN) / sizeof(*u32); i++) { @@ -1992,18 +2147,18 @@ static abi_long host_to_target_data_inet6_nlattr(struct nlattr *nlattr, switch (nlattr->nla_type) { /* binaries */ - case IFLA_INET6_TOKEN: + case QEMU_IFLA_INET6_TOKEN: break; /* uint8_t */ - case IFLA_INET6_ADDR_GEN_MODE: + case QEMU_IFLA_INET6_ADDR_GEN_MODE: break; /* uint32_t */ - case IFLA_INET6_FLAGS: + case QEMU_IFLA_INET6_FLAGS: u32 = NLA_DATA(nlattr); *u32 = tswap32(*u32); break; /* uint32_t[] */ - case IFLA_INET6_CONF: + case QEMU_IFLA_INET6_CONF: u32 = NLA_DATA(nlattr); for (i = 0; i < (nlattr->nla_len - NLA_HDRLEN) / sizeof(*u32); i++) { @@ -2011,7 +2166,7 @@ static abi_long host_to_target_data_inet6_nlattr(struct nlattr *nlattr, } break; /* ifla_cacheinfo */ - case IFLA_INET6_CACHEINFO: + case QEMU_IFLA_INET6_CACHEINFO: ci = NLA_DATA(nlattr); ci->max_reasm_len = tswap32(ci->max_reasm_len); ci->tstamp = tswap32(ci->tstamp); @@ -2019,8 +2174,8 @@ static abi_long host_to_target_data_inet6_nlattr(struct nlattr *nlattr, ci->retrans_time = tswap32(ci->retrans_time); break; /* uint64_t[] */ - case IFLA_INET6_STATS: - case IFLA_INET6_ICMP6STATS: + case QEMU_IFLA_INET6_STATS: + case QEMU_IFLA_INET6_ICMP6STATS: u64 = NLA_DATA(nlattr); for (i = 0; i < (nlattr->nla_len - NLA_HDRLEN) / sizeof(*u64); i++) { @@ -2062,37 +2217,37 @@ static abi_long host_to_target_data_link_rtattr(struct rtattr *rtattr) switch (rtattr->rta_type) { /* binary stream */ - case IFLA_ADDRESS: - case IFLA_BROADCAST: + case QEMU_IFLA_ADDRESS: + case QEMU_IFLA_BROADCAST: /* string */ - case IFLA_IFNAME: - case IFLA_QDISC: + case QEMU_IFLA_IFNAME: + case QEMU_IFLA_QDISC: break; /* uin8_t */ - case IFLA_OPERSTATE: - case IFLA_LINKMODE: - case IFLA_CARRIER: - case IFLA_PROTO_DOWN: + case QEMU_IFLA_OPERSTATE: + case QEMU_IFLA_LINKMODE: + case QEMU_IFLA_CARRIER: + case QEMU_IFLA_PROTO_DOWN: break; /* uint32_t */ - case IFLA_MTU: - case IFLA_LINK: - case IFLA_WEIGHT: - case IFLA_TXQLEN: - case IFLA_CARRIER_CHANGES: - case IFLA_NUM_RX_QUEUES: - case IFLA_NUM_TX_QUEUES: - case IFLA_PROMISCUITY: - case IFLA_EXT_MASK: - case IFLA_LINK_NETNSID: - case IFLA_GROUP: - case IFLA_MASTER: - case IFLA_NUM_VF: + case QEMU_IFLA_MTU: + case QEMU_IFLA_LINK: + case QEMU_IFLA_WEIGHT: + case QEMU_IFLA_TXQLEN: + case QEMU_IFLA_CARRIER_CHANGES: + case QEMU_IFLA_NUM_RX_QUEUES: + case QEMU_IFLA_NUM_TX_QUEUES: + case QEMU_IFLA_PROMISCUITY: + case QEMU_IFLA_EXT_MASK: + case QEMU_IFLA_LINK_NETNSID: + case QEMU_IFLA_GROUP: + case QEMU_IFLA_MASTER: + case QEMU_IFLA_NUM_VF: u32 = RTA_DATA(rtattr); *u32 = tswap32(*u32); break; /* struct rtnl_link_stats */ - case IFLA_STATS: + case QEMU_IFLA_STATS: st = RTA_DATA(rtattr); st->rx_packets = tswap32(st->rx_packets); st->tx_packets = tswap32(st->tx_packets); @@ -2125,7 +2280,7 @@ static abi_long host_to_target_data_link_rtattr(struct rtattr *rtattr) st->tx_compressed = tswap32(st->tx_compressed); break; /* struct rtnl_link_stats64 */ - case IFLA_STATS64: + case QEMU_IFLA_STATS64: st64 = RTA_DATA(rtattr); st64->rx_packets = tswap64(st64->rx_packets); st64->tx_packets = tswap64(st64->tx_packets); @@ -2158,7 +2313,7 @@ static abi_long host_to_target_data_link_rtattr(struct rtattr *rtattr) st64->tx_compressed = tswap64(st64->tx_compressed); break; /* struct rtnl_link_ifmap */ - case IFLA_MAP: + case QEMU_IFLA_MAP: map = RTA_DATA(rtattr); map->mem_start = tswap64(map->mem_start); map->mem_end = tswap64(map->mem_end); @@ -2166,17 +2321,17 @@ static abi_long host_to_target_data_link_rtattr(struct rtattr *rtattr) map->irq = tswap16(map->irq); break; /* nested */ - case IFLA_LINKINFO: + case QEMU_IFLA_LINKINFO: memset(&li_context, 0, sizeof(li_context)); return host_to_target_for_each_nlattr(RTA_DATA(rtattr), rtattr->rta_len, &li_context, host_to_target_data_linkinfo_nlattr); - case IFLA_AF_SPEC: + case QEMU_IFLA_AF_SPEC: return host_to_target_for_each_nlattr(RTA_DATA(rtattr), rtattr->rta_len, NULL, host_to_target_data_spec_nlattr); default: - gemu_log("Unknown host IFLA type: %d\n", rtattr->rta_type); + gemu_log("Unknown host QEMU_IFLA type: %d\n", rtattr->rta_type); break; } return 0; @@ -2343,7 +2498,7 @@ static abi_long target_to_host_data_link_rtattr(struct rtattr *rtattr) { switch (rtattr->rta_type) { default: - gemu_log("Unknown target IFLA type: %d\n", rtattr->rta_type); + gemu_log("Unknown target QEMU_IFLA type: %d\n", rtattr->rta_type); break; } return 0; @@ -9303,7 +9458,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, { int64_t res; #if !defined(__NR_llseek) - res = lseek(arg1, ((uint64_t)arg2 << 32) | arg3, arg5); + res = lseek(arg1, ((uint64_t)arg2 << 32) | (abi_ulong)arg3, arg5); if (res == -1) { ret = get_errno(res); } else { diff --git a/linux-user/trace-events b/linux-user/trace-events index 80a2e07812..fc71f91ccb 100644 --- a/linux-user/trace-events +++ b/linux-user/trace-events @@ -1,4 +1,4 @@ -# See docs/trace-events.txt for syntax documentation. +# See docs/tracing.txt for syntax documentation. # linux-user/signal.c user_setup_frame(void *env, uint64_t frame_addr) "env=%p frame_addr=%"PRIx64 diff --git a/migration/trace-events b/migration/trace-events index 8568dab814..dfee75abf4 100644 --- a/migration/trace-events +++ b/migration/trace-events @@ -1,4 +1,4 @@ -# See docs/trace-events.txt for syntax documentation. +# See docs/tracing.txt for syntax documentation. # migration/savevm.c qemu_loadvm_state_section(unsigned int section_type) "%d" diff --git a/net/net.c b/net/net.c index c124b11e4d..d51cb29882 100644 --- a/net/net.c +++ b/net/net.c @@ -1602,9 +1602,8 @@ void net_socket_rs_init(SocketReadState *rs, /* * Returns - * 0: SocketReadState is not ready - * 1: SocketReadState is ready - * otherwise error occurs + * 0: success + * -1: error occurs */ int net_fill_rstate(SocketReadState *rs, const uint8_t *buf, int size) { @@ -1652,10 +1651,11 @@ int net_fill_rstate(SocketReadState *rs, const uint8_t *buf, int size) if (rs->finalize) { rs->finalize(rs); } - return 1; } break; } } + + assert(size == 0); return 0; } diff --git a/net/slirp.c b/net/slirp.c index facc30ed18..b60893f9c5 100644 --- a/net/slirp.c +++ b/net/slirp.c @@ -131,7 +131,9 @@ static void net_slirp_cleanup(NetClientState *nc) SlirpState *s = DO_UPCAST(SlirpState, nc, nc); slirp_cleanup(s->slirp); - qemu_remove_exit_notifier(&s->exit_notifier); + if (s->exit_notifier.notify) { + qemu_remove_exit_notifier(&s->exit_notifier); + } slirp_smb_cleanup(s); QTAILQ_REMOVE(&slirp_stacks, s, entry); } diff --git a/net/trace-events b/net/trace-events index 32a0a8abb9..65c46a48fb 100644 --- a/net/trace-events +++ b/net/trace-events @@ -1,4 +1,4 @@ -# See docs/trace-events.txt for syntax documentation. +# See docs/tracing.txt for syntax documentation. # net/vhost-user.c vhost_user_event(const char *chr, int event) "chr: %s got event: %d" diff --git a/pc-bios/optionrom/Makefile b/pc-bios/optionrom/Makefile index 8aef152262..9bdc49798c 100644 --- a/pc-bios/optionrom/Makefile +++ b/pc-bios/optionrom/Makefile @@ -48,18 +48,8 @@ build-all: multiboot.bin linuxboot.bin linuxboot_dma.bin kvmvapic.bin %.o: %.S $(call quiet-command,$(CPP) $(QEMU_INCLUDES) $(QEMU_DGFLAGS) -c -o - $< | $(AS) $(ASFLAGS) -o $@," AS $(TARGET_DIR)$@") -ifdef CONFIG_WIN32 -LD_EMULATION = i386pe -else -ifdef CONFIG_BSD -LD_EMULATION = elf_i386_fbsd -else -LD_EMULATION = elf_i386 -endif -endif - %.img: %.o - $(call quiet-command,$(LD) $(LDFLAGS_NOPIE) -m $(LD_EMULATION) -T $(SRC_PATH)/pc-bios/optionrom/flat.lds -s -o $@ $<," Building $(TARGET_DIR)$@") + $(call quiet-command,$(LD) $(LDFLAGS_NOPIE) -m $(LD_I386_EMULATION) -T $(SRC_PATH)/pc-bios/optionrom/flat.lds -s -o $@ $<," Building $(TARGET_DIR)$@") %.raw: %.img $(call quiet-command,$(OBJCOPY) -O binary -j .text $< $@," Building $(TARGET_DIR)$@") diff --git a/pc-bios/s390-ccw/Makefile b/pc-bios/s390-ccw/Makefile index 4208cb4295..0ab25388a4 100644 --- a/pc-bios/s390-ccw/Makefile +++ b/pc-bios/s390-ccw/Makefile @@ -10,8 +10,10 @@ $(call set-vpath, $(SRC_PATH)/pc-bios/s390-ccw) .PHONY : all clean build-all OBJECTS = start.o main.o bootmap.o sclp-ascii.o virtio.o virtio-scsi.o -CFLAGS += -fPIE -fno-stack-protector -ffreestanding -march=z900 -CFLAGS += -fno-delete-null-pointer-checks -msoft-float +QEMU_CFLAGS := $(filter -W%, $(QEMU_CFLAGS)) +QEMU_CFLAGS += -ffreestanding -fno-delete-null-pointer-checks -msoft-float +QEMU_CFLAGS += -march=z900 -fPIE -fno-strict-aliasing +QEMU_CFLAGS += $(call cc-option, $(QEMU_CFLAGS), -fno-stack-protector) LDFLAGS += -Wl,-pie -nostdlib build-all: s390-ccw.img diff --git a/qemu-char.c b/qemu-char.c index 8a0ab05a7b..5f82ebb774 100644 --- a/qemu-char.c +++ b/qemu-char.c @@ -3176,7 +3176,9 @@ static int tcp_chr_wait_connected(CharDriverState *chr, Error **errp) TCPCharDriver *s = chr->opaque; QIOChannelSocket *sioc; - while (!s->connected) { + /* It can't wait on s->connected, since it is set asynchronously + * in TLS and telnet cases, only wait for an accepted socket */ + while (!s->ioc) { if (s->is_listen) { fprintf(stderr, "QEMU waiting for connection on: %s\n", chr->filename); diff --git a/qmp-commands.hx b/qmp-commands.hx index c8d360ad36..6866264e64 100644 --- a/qmp-commands.hx +++ b/qmp-commands.hx @@ -4802,8 +4802,6 @@ The consoles are visible in the qom tree, under /backend/console[$index]. They have a device link and head property, so it is possible to map which console belongs to which device and display. -Note: this command is experimental, and not a stable API. - Example (1): Press left mouse button. diff --git a/qom/trace-events b/qom/trace-events index 350fc1feb2..97db357207 100644 --- a/qom/trace-events +++ b/qom/trace-events @@ -1,4 +1,4 @@ -# See docs/trace-events.txt for syntax documentation. +# See docs/tracing.txt for syntax documentation. # qom/object.c object_dynamic_cast_assert(const char *type, const char *target, const char *file, int line, const char *func) "%s->%s (%s:%d:%s)" diff --git a/slirp/slirp.c b/slirp/slirp.c index 47a1652952..d67eda12f4 100644 --- a/slirp/slirp.c +++ b/slirp/slirp.c @@ -773,10 +773,10 @@ void slirp_pollfds_poll(GArray *pollfds, int select_error) static void arp_input(Slirp *slirp, const uint8_t *pkt, int pkt_len) { - struct arphdr *ah = (struct arphdr *)(pkt + ETH_HLEN); - uint8_t arp_reply[max(ETH_HLEN + sizeof(struct arphdr), 64)]; + struct slirp_arphdr *ah = (struct slirp_arphdr *)(pkt + ETH_HLEN); + uint8_t arp_reply[max(ETH_HLEN + sizeof(struct slirp_arphdr), 64)]; struct ethhdr *reh = (struct ethhdr *)arp_reply; - struct arphdr *rah = (struct arphdr *)(arp_reply + ETH_HLEN); + struct slirp_arphdr *rah = (struct slirp_arphdr *)(arp_reply + ETH_HLEN); int ar_op; struct ex_list *ex_ptr; @@ -890,9 +890,9 @@ static int if_encap4(Slirp *slirp, struct mbuf *ifm, struct ethhdr *eh, return 1; } if (!arp_table_search(slirp, iph->ip_dst.s_addr, ethaddr)) { - uint8_t arp_req[ETH_HLEN + sizeof(struct arphdr)]; + uint8_t arp_req[ETH_HLEN + sizeof(struct slirp_arphdr)]; struct ethhdr *reh = (struct ethhdr *)arp_req; - struct arphdr *rah = (struct arphdr *)(arp_req + ETH_HLEN); + struct slirp_arphdr *rah = (struct slirp_arphdr *)(arp_req + ETH_HLEN); if (!ifm->resolution_requested) { /* If the client addr is not known, send an ARP request */ diff --git a/slirp/slirp.h b/slirp/slirp.h index 624a850906..a1f3139134 100644 --- a/slirp/slirp.h +++ b/slirp/slirp.h @@ -105,7 +105,7 @@ struct ethhdr { unsigned short h_proto; /* packet type ID field */ }; -struct arphdr { +struct slirp_arphdr { unsigned short ar_hrd; /* format of hardware address */ unsigned short ar_pro; /* format of protocol address */ unsigned char ar_hln; /* length of hardware address */ @@ -124,7 +124,7 @@ struct arphdr { #define ARP_TABLE_SIZE 16 typedef struct ArpTable { - struct arphdr table[ARP_TABLE_SIZE]; + struct slirp_arphdr table[ARP_TABLE_SIZE]; int next_victim; } ArpTable; diff --git a/target-i386/kvm.c b/target-i386/kvm.c index 0b2016a77a..d1a25c5465 100644 --- a/target-i386/kvm.c +++ b/target-i386/kvm.c @@ -329,6 +329,13 @@ uint32_t kvm_arch_get_supported_cpuid(KVMState *s, uint32_t function, */ cpuid_1_edx = kvm_arch_get_supported_cpuid(s, 1, 0, R_EDX); ret |= cpuid_1_edx & CPUID_EXT2_AMD_ALIASES; + } else if (function == KVM_CPUID_FEATURES && reg == R_EAX) { + /* kvm_pv_unhalt is reported by GET_SUPPORTED_CPUID, but it can't + * be enabled without the in-kernel irqchip + */ + if (!kvm_irqchip_in_kernel()) { + ret &= ~(1U << KVM_FEATURE_PV_UNHALT); + } } /* fallback for older kernels */ diff --git a/target-i386/trace-events b/target-i386/trace-events index ccc49e31e8..05c5453d35 100644 --- a/target-i386/trace-events +++ b/target-i386/trace-events @@ -1,4 +1,4 @@ -# See docs/trace-events.txt for syntax documentation. +# See docs/tracing.txt for syntax documentation. # target-i386/kvm.c kvm_x86_fixup_msi_error(uint32_t gsi) "VT-d failed to remap interrupt for GSI %" PRIu32 diff --git a/target-ppc/trace-events b/target-ppc/trace-events index d37da2b665..8fcc3ce98c 100644 --- a/target-ppc/trace-events +++ b/target-ppc/trace-events @@ -1,4 +1,4 @@ -# See docs/trace-events.txt for syntax documentation. +# See docs/tracing.txt for syntax documentation. # target-ppc/kvm.c kvm_failed_spr_set(int str, const char *msg) "Warning: Unable to set SPR %d to KVM: %s" diff --git a/target-s390x/trace-events b/target-s390x/trace-events index 9589b1621a..df59f5f19f 100644 --- a/target-s390x/trace-events +++ b/target-s390x/trace-events @@ -1,4 +1,4 @@ -# See docs/trace-events.txt for syntax documentation. +# See docs/tracing.txt for syntax documentation. # target-s390x/mmu_helper.c get_skeys_nonzero(int rc) "SKEY: Call to get_skeys unexpectedly returned %d" diff --git a/target-sparc/trace-events b/target-sparc/trace-events index c75faf920d..bf52d9769b 100644 --- a/target-sparc/trace-events +++ b/target-sparc/trace-events @@ -1,4 +1,4 @@ -# See docs/trace-events.txt for syntax documentation. +# See docs/tracing.txt for syntax documentation. # target-sparc/mmu_helper.c mmu_helper_dfault(uint64_t address, uint64_t context, int mmu_idx, uint32_t tl) "DFAULT at %"PRIx64" context %"PRIx64" mmu_idx=%d tl=%d" diff --git a/tests/qemu-iotests/162 b/tests/qemu-iotests/162 new file mode 100755 index 0000000000..0b43ea3395 --- /dev/null +++ b/tests/qemu-iotests/162 @@ -0,0 +1,96 @@ +#!/bin/bash +# +# Test case for specifying runtime options of the wrong type to some +# block drivers +# +# Copyright (C) 2016 Red Hat, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +# + +# creator +owner=mreitz@redhat.com + +seq="$(basename $0)" +echo "QA output created by $seq" + +here="$PWD" +status=1 # failure is the default! + +# get standard environment, filters and checks +. ./common.rc +. ./common.filter + +_supported_fmt generic +_supported_os Linux + +echo +echo '=== NBD ===' +# NBD expects all of its arguments to be strings + +# So this should not crash +$QEMU_IMG info 'json:{"driver": "nbd", "host": 42}' + +# And this should not treat @port as if it had not been specified +# (We cannot use localhost with an invalid port here, but we need to use a +# non-existing domain, because otherwise the error message will not contain +# the port) +$QEMU_IMG info 'json:{"driver": "nbd", "host": "does.not.exist.example.com", "port": 42}' + +# This is a test for NBD's bdrv_refresh_filename() implementation: It expects +# either host or path to be set, but it must not assume that they are set to +# strings in the options QDict +$QEMU_NBD -k "$PWD/42" -f raw null-co:// & +sleep 0.5 +$QEMU_IMG info 'json:{"driver": "nbd", "path": 42}' | grep '^image' +rm -f 42 + + +echo +echo '=== SSH ===' +# SSH expects all of its arguments to be strings, except for @port, which is +# expected to be an integer + +# So "0" should be converted to an integer here (instead of crashing) +$QEMU_IMG info 'json:{"driver": "ssh", "host": "localhost", "port": "0", "path": "/foo"}' +# The same, basically (all values for --image-opts are seen as strings in qemu) +$QEMU_IMG info --image-opts \ + driver=ssh,host=localhost,port=0,path=/foo + +# This, however, should fail because of the wrong type +$QEMU_IMG info 'json:{"driver": "ssh", "host": "localhost", "port": 0.42, "path": "/foo"}' +# Not really the same: Here, "0.42" will be passed instead of 0.42, but still, +# qemu should not try to convert "0.42" to an integer +$QEMU_IMG info --image-opts \ + driver=ssh,host=localhost,port=0.42,path=/foo + + +echo +echo '=== blkdebug ===' +# blkdebug expects all of its arguments to be strings, but its +# bdrv_refresh_filename() implementation should not assume that they have been +# passed as strings in the original options QDict. +# So this should emit blkdebug:42:null-co:// as the filename: +touch 42 +$QEMU_IMG info 'json:{"driver": "blkdebug", "config": 42, + "image.driver": "null-co"}' \ + | grep '^image' +rm -f 42 + + +# success, all done +echo +echo '*** done' +rm -f $seq.full +status=0 diff --git a/tests/qemu-iotests/162.out b/tests/qemu-iotests/162.out new file mode 100644 index 0000000000..9bba72353a --- /dev/null +++ b/tests/qemu-iotests/162.out @@ -0,0 +1,17 @@ +QA output created by 162 + +=== NBD === +qemu-img: Could not open 'json:{"driver": "nbd", "host": 42}': Failed to connect socket: Invalid argument +qemu-img: Could not open 'json:{"driver": "nbd", "host": "does.not.exist.example.com", "port": 42}': address resolution failed for does.not.exist.example.com:42: Name or service not known +image: nbd+unix://?socket=42 + +=== SSH === +qemu-img: Could not open 'json:{"driver": "ssh", "host": "localhost", "port": "0", "path": "/foo"}': Failed to connect socket: Connection refused +qemu-img: Could not open 'driver=ssh,host=localhost,port=0,path=/foo': Failed to connect socket: Connection refused +qemu-img: Could not open 'json:{"driver": "ssh", "host": "localhost", "port": 0.42, "path": "/foo"}': Parameter 'port' expects a number +qemu-img: Could not open 'driver=ssh,host=localhost,port=0.42,path=/foo': Parameter 'port' expects a number + +=== blkdebug === +image: blkdebug:42:null-co:// + +*** done diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group index 3a3973e963..50ddeed80a 100644 --- a/tests/qemu-iotests/group +++ b/tests/qemu-iotests/group @@ -157,3 +157,4 @@ 155 rw auto 156 rw auto quick 157 auto +162 auto quick diff --git a/tests/test-logging.c b/tests/test-logging.c index cdf13c6ba5..a12585f70a 100644 --- a/tests/test-logging.c +++ b/tests/test-logging.c @@ -25,6 +25,7 @@ */ #include "qemu/osdep.h" +#include <glib/gstdio.h> #include "qemu-common.h" #include "qapi/error.h" @@ -86,24 +87,57 @@ static void test_parse_range(void) error_free_or_abort(&err); } -static void test_parse_path(void) +static void set_log_path_tmp(char const *dir, char const *tpl, Error **errp) { + gchar *file_path = g_build_filename(dir, tpl, NULL); + + qemu_set_log_filename(file_path, errp); + g_free(file_path); +} + +static void test_parse_path(gconstpointer data) +{ + gchar const *tmp_path = data; Error *err = NULL; - qemu_set_log_filename("/tmp/qemu.log", &error_abort); - qemu_set_log_filename("/tmp/qemu-%d.log", &error_abort); - qemu_set_log_filename("/tmp/qemu.log.%d", &error_abort); + set_log_path_tmp(tmp_path, "qemu.log", &error_abort); + set_log_path_tmp(tmp_path, "qemu-%d.log", &error_abort); + set_log_path_tmp(tmp_path, "qemu.log.%d", &error_abort); - qemu_set_log_filename("/tmp/qemu-%d%d.log", &err); + set_log_path_tmp(tmp_path, "qemu-%d%d.log", &err); error_free_or_abort(&err); } +/* Remove a directory and all its entries (non-recursive). */ +static void rmdir_full(gchar const *root) +{ + GDir *root_gdir = g_dir_open(root, 0, NULL); + gchar const *entry_name; + + g_assert_nonnull(root_gdir); + while ((entry_name = g_dir_read_name(root_gdir)) != NULL) { + gchar *entry_path = g_build_filename(root, entry_name, NULL); + g_assert(g_remove(entry_path) == 0); + g_free(entry_path); + } + g_dir_close(root_gdir); + g_assert(g_rmdir(root) == 0); +} + int main(int argc, char **argv) { + gchar *tmp_path = g_dir_make_tmp("qemu-test-logging.XXXXXX", NULL); + int rc; + g_test_init(&argc, &argv, NULL); + g_assert_nonnull(tmp_path); g_test_add_func("/logging/parse_range", test_parse_range); - g_test_add_func("/logging/parse_path", test_parse_path); + g_test_add_data_func("/logging/parse_path", tmp_path, test_parse_path); + + rc = g_test_run(); - return g_test_run(); + rmdir_full(tmp_path); + g_free(tmp_path); + return rc; } diff --git a/trace-events b/trace-events index 52c6a6cccf..616cc52378 100644 --- a/trace-events +++ b/trace-events @@ -60,6 +60,7 @@ spice_vmc_event(int event) "spice vmc event %d" # xen-hvm.c xen_ram_alloc(unsigned long ram_addr, unsigned long size) "requested: %#lx, size %#lx" xen_client_set_memory(uint64_t start_addr, unsigned long size, bool log_dirty) "%#"PRIx64" size %#lx, log_dirty %i" +xen_default_ioreq_server(void) "" xen_ioreq_server_create(uint32_t id) "id: %u" xen_ioreq_server_destroy(uint32_t id) "id: %u" xen_ioreq_server_state(uint32_t id, bool enable) "id: %u: enable: %i" diff --git a/ui/trace-events b/ui/trace-events index d36dbbb889..93fe5482e6 100644 --- a/ui/trace-events +++ b/ui/trace-events @@ -1,4 +1,4 @@ -# See docs/trace-events.txt for syntax documentation. +# See docs/tracing.txt for syntax documentation. # ui/console.c console_gfx_new(void) "" diff --git a/util/trace-events b/util/trace-events index 3ce5f1e04e..747e6baf75 100644 --- a/util/trace-events +++ b/util/trace-events @@ -1,4 +1,4 @@ -# See docs/trace-events.txt for syntax documentation. +# See docs/tracing.txt for syntax documentation. # util/oslib-win32.c # util/oslib-posix.c diff --git a/xen-hvm.c b/xen-hvm.c index 3b0343a8e6..2f348edf86 100644 --- a/xen-hvm.c +++ b/xen-hvm.c @@ -1203,11 +1203,7 @@ void xen_hvm_init(PCMachineState *pcms, MemoryRegion **ram_memory) goto err; } - rc = xen_create_ioreq_server(xen_xc, xen_domid, &state->ioservid); - if (rc < 0) { - perror("xen: ioreq server create"); - goto err; - } + xen_create_ioreq_server(xen_xc, xen_domid, &state->ioservid); state->exit.notify = xen_exit_notifier; qemu_add_exit_notifier(&state->exit); |