diff options
Diffstat (limited to 'util')
-rw-r--r-- | util/base64.c | 2 | ||||
-rw-r--r-- | util/buffer.c | 2 | ||||
-rw-r--r-- | util/cutils.c | 5 | ||||
-rw-r--r-- | util/filemonitor-inotify.c | 2 | ||||
-rw-r--r-- | util/filemonitor-stub.c | 2 | ||||
-rw-r--r-- | util/log.c | 2 | ||||
-rw-r--r-- | util/meson.build | 2 | ||||
-rw-r--r-- | util/oslib-win32.c | 2 | ||||
-rw-r--r-- | util/qemu-coroutine-lock.c | 6 | ||||
-rw-r--r-- | util/qemu-option.c | 20 | ||||
-rw-r--r-- | util/vfio-helpers.c | 14 |
11 files changed, 28 insertions, 31 deletions
diff --git a/util/base64.c b/util/base64.c index 9d3c46cbcc..811111ac4f 100644 --- a/util/base64.c +++ b/util/base64.c @@ -6,7 +6,7 @@ * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/util/buffer.c b/util/buffer.c index d8bb874534..743eaa930d 100644 --- a/util/buffer.c +++ b/util/buffer.c @@ -6,7 +6,7 @@ * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/util/cutils.c b/util/cutils.c index c395974fab..0b5073b330 100644 --- a/util/cutils.c +++ b/util/cutils.c @@ -891,10 +891,11 @@ char *freq_to_str(uint64_t freq_hz) double freq = freq_hz; size_t idx = 0; - while (freq >= 1000.0 && idx < ARRAY_SIZE(suffixes)) { + while (freq >= 1000.0) { freq /= 1000.0; idx++; } + assert(idx < ARRAY_SIZE(suffixes)); return g_strdup_printf("%0.3g %sHz", freq, suffixes[idx]); } @@ -937,7 +938,7 @@ char *get_relocated_path(const char *dir) /* Fail if qemu_init_exec_dir was not called. */ assert(exec_dir[0]); if (!starts_with_prefix(dir) || !starts_with_prefix(bindir)) { - return strdup(dir); + return g_strdup(dir); } result = g_string_new(exec_dir); diff --git a/util/filemonitor-inotify.c b/util/filemonitor-inotify.c index b5f4b93f3f..2c45f7f176 100644 --- a/util/filemonitor-inotify.c +++ b/util/filemonitor-inotify.c @@ -6,7 +6,7 @@ * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/util/filemonitor-stub.c b/util/filemonitor-stub.c index 2c0e97edd8..93fef65345 100644 --- a/util/filemonitor-stub.c +++ b/util/filemonitor-stub.c @@ -6,7 +6,7 @@ * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/util/log.c b/util/log.c index 4b423062aa..2ee1500bee 100644 --- a/util/log.c +++ b/util/log.c @@ -6,7 +6,7 @@ * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/util/meson.build b/util/meson.build index c5159ad79d..f359af0d46 100644 --- a/util/meson.build +++ b/util/meson.build @@ -66,7 +66,7 @@ if have_block util_ss.add(files('main-loop.c')) util_ss.add(files('nvdimm-utils.c')) util_ss.add(files('qemu-coroutine.c', 'qemu-coroutine-lock.c', 'qemu-coroutine-io.c')) - util_ss.add(when: ['CONFIG_LINUX', 'CONFIG_VHOST_USER'], if_true: [ + util_ss.add(when: 'CONFIG_LINUX', if_true: [ files('vhost-user-server.c'), vhost_user ]) util_ss.add(files('block-helpers.c')) diff --git a/util/oslib-win32.c b/util/oslib-win32.c index e99debfb8d..23a7c7320b 100644 --- a/util/oslib-win32.c +++ b/util/oslib-win32.c @@ -373,7 +373,7 @@ const char *qemu_get_exec_dir(void) * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/util/qemu-coroutine-lock.c b/util/qemu-coroutine-lock.c index 36927b5f88..5816bf8900 100644 --- a/util/qemu-coroutine-lock.c +++ b/util/qemu-coroutine-lock.c @@ -85,15 +85,13 @@ static bool qemu_co_queue_do_restart(CoQueue *queue, bool single) return true; } -bool coroutine_fn qemu_co_queue_next(CoQueue *queue) +bool qemu_co_queue_next(CoQueue *queue) { - assert(qemu_in_coroutine()); return qemu_co_queue_do_restart(queue, true); } -void coroutine_fn qemu_co_queue_restart_all(CoQueue *queue) +void qemu_co_queue_restart_all(CoQueue *queue) { - assert(qemu_in_coroutine()); qemu_co_queue_do_restart(queue, false); } diff --git a/util/qemu-option.c b/util/qemu-option.c index b9f93a7f8b..acefbc23fa 100644 --- a/util/qemu-option.c +++ b/util/qemu-option.c @@ -96,21 +96,6 @@ const char *get_opt_value(const char *p, char **value) return offset; } -static bool parse_option_bool(const char *name, const char *value, bool *ret, - Error **errp) -{ - if (!strcmp(value, "on")) { - *ret = 1; - } else if (!strcmp(value, "off")) { - *ret = 0; - } else { - error_setg(errp, QERR_INVALID_PARAMETER_VALUE, - name, "'on' or 'off'"); - return false; - } - return true; -} - static bool parse_option_number(const char *name, const char *value, uint64_t *ret, Error **errp) { @@ -363,7 +348,7 @@ static bool qemu_opt_get_bool_helper(QemuOpts *opts, const char *name, if (opt == NULL) { def_val = find_default_by_name(opts, name); if (def_val) { - parse_option_bool(name, def_val, &ret, &error_abort); + qapi_bool_parse(name, def_val, &ret, &error_abort); } return ret; } @@ -471,8 +456,7 @@ static bool qemu_opt_parse(QemuOpt *opt, Error **errp) /* nothing */ return true; case QEMU_OPT_BOOL: - return parse_option_bool(opt->name, opt->str, &opt->value.boolean, - errp); + return qapi_bool_parse(opt->name, opt->str, &opt->value.boolean, errp); case QEMU_OPT_NUMBER: return parse_option_number(opt->name, opt->str, &opt->value.uint, errp); diff --git a/util/vfio-helpers.c b/util/vfio-helpers.c index 804768d5c6..97dfa3fd57 100644 --- a/util/vfio-helpers.c +++ b/util/vfio-helpers.c @@ -16,6 +16,7 @@ #include "qapi/error.h" #include "exec/ramlist.h" #include "exec/cpu-common.h" +#include "exec/memory.h" #include "trace.h" #include "qemu/error-report.h" #include "standard-headers/linux/pci_regs.h" @@ -513,8 +514,20 @@ QEMUVFIOState *qemu_vfio_open_pci(const char *device, Error **errp) int r; QEMUVFIOState *s = g_new0(QEMUVFIOState, 1); + /* + * VFIO may pin all memory inside mappings, resulting it in pinning + * all memory inside RAM blocks unconditionally. + */ + r = ram_block_discard_disable(true); + if (r) { + error_setg_errno(errp, -r, "Cannot set discarding of RAM broken"); + g_free(s); + return NULL; + } + r = qemu_vfio_init_pci(s, device, errp); if (r) { + ram_block_discard_disable(false); g_free(s); return NULL; } @@ -846,4 +859,5 @@ void qemu_vfio_close(QEMUVFIOState *s) close(s->device); close(s->group); close(s->container); + ram_block_discard_disable(false); } |