aboutsummaryrefslogtreecommitdiff
path: root/util
AgeCommit message (Collapse)AuthorFilesLines
2020-11-03Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into stagingPeter Maydell1-1/+7
Block layer patches: - iotests: Fix pylint/mypy warnings with Python 3.9 - qmp: fix aio_poll() assertion failure on Windows - Some minor fixes # gpg: Signature made Tue 03 Nov 2020 15:25:01 GMT # gpg: using RSA key DC3DEB159A9AF95D3D7456FE7F09B272C88F2FD6 # gpg: issuer "kwolf@redhat.com" # gpg: Good signature from "Kevin Wolf <kwolf@redhat.com>" [full] # Primary key fingerprint: DC3D EB15 9A9A F95D 3D74 56FE 7F09 B272 C88F 2FD6 * remotes/kevin/tags/for-upstream: block/vvfat: Fix bad printf format specifiers iotests: Use Python 3 style super() iotests: Disable unsubscriptable-object in pylint iotests.py: Fix type check errors in wait_migration() qemu-img convert: Free @sn_opts in all error cases qmp: fix aio_poll() assertion failure on Windows Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2020-11-03qmp: fix aio_poll() assertion failure on WindowsVolker Rümelin1-1/+7
Commit 9ce44e2ce2 "qmp: Move dispatcher to a coroutine" modified aio_poll() in util/aio-posix.c to avoid an assertion failure. This change is missing in util/aio-win32.c. Apply the changes to util/aio-posix.c to util/aio-win32.c too. This fixes an assertion failure on Windows whenever QEMU exits. $ ./qemu-system-x86_64.exe -machine pc,accel=tcg -display gtk ** ERROR:../qemu/util/aio-win32.c:337:aio_poll: assertion failed: (in_aio_context_home_thread(ctx)) Bail out! ERROR:../qemu/util/aio-win32.c:337:aio_poll: assertion failed: (in_aio_context_home_thread(ctx)) Fixes: 9ce44e2ce2 ("qmp: Move dispatcher to a coroutine") Signed-off-by: Volker Rümelin <vr_qemu@t-online.de> Message-Id: <20201021064033.8600-1-vr_qemu@t-online.de> Tested-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2020-11-03sockets: Make abstract UnixSocketAddress depend on CONFIG_LINUXMarkus Armbruster1-10/+30
The abstract socket namespace is a non-portable Linux extension. An attempt to use it elsewhere should fail with ENOENT (the abstract address looks like a "" pathname, which does not resolve). We report this failure like Failed to connect socket abc: No such file or directory Tolerable, although ENOTSUP would be better. However, introspection lies: it has @abstract regardless of host support. Easy enough to fix: since Linux provides them since 2.2, 'if': 'defined(CONFIG_LINUX)' should do. The above failure becomes Parameter 'backend.data.addr.data.abstract' is unexpected I consider this an improvement. Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2020-11-03sockets: Bypass "replace empty @path" for abstract unix socketsMarkus Armbruster1-1/+1
unix_listen_saddr() replaces empty @path by unique value. It obtains the value by creating and deleting a unique temporary file with mkstemp(). This is racy, as the comment explains. It's also entirely undocumented as far as I can tell. Goes back to commit d247d25f18 "sockets: helper functions for qemu (Gerd Hoffman)", v0.10.0. Since abstract socket addresses have no connection with filesystem pathnames, making them up with mkstemp() seems inappropriate. Bypass the replacement of empty @path. Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2020-11-03sockets: Fix socket_sockaddr_to_address_unix() for abstract socketsMarkus Armbruster1-2/+12
Commit 776b97d360 "qemu-sockets: add abstract UNIX domain socket support" neglected to update socket_sockaddr_to_address_unix(). The function returns a non-abstract socket address for abstract sockets (wrong) with a null @path (also wrong; a non-optional QAPI str member must never be null). The null @path is due to confused code going back all the way to commit 17c55decec "sockets: add helpers for creating SocketAddress from a socket". Add the required special case, and simplify the confused code. Fixes: 776b97d3605ed0fc94443048fdf988c7725e38a9 Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2020-11-03sockets: Fix default of UnixSocketAddress member @tightMarkus Armbruster1-2/+2
An optional bool member of a QAPI struct can be false, true, or absent. The previous commit demonstrated that socket_listen() and socket_connect() are broken for absent @tight, and indeed QMP chardev- add also defaults absent member @tight to false instead of true. In C, QAPI members are represented by two fields, has_MEMBER and MEMBER. We have: has_MEMBER MEMBER false true false true true true absent false false/ignore When has_MEMBER is false, MEMBER should be set to false on write, and ignored on read. For QMP, the QAPI visitors handle absent @tight by setting both @has_tight and @tight to false. unix_listen_saddr() and unix_connect_saddr() however use @tight only, disregarding @has_tight. This is wrong and means that absent @tight defaults to false whereas it should default to true. The same is true for @has_abstract, though @abstract defaults to false and therefore has the same behavior for all of QMP, HMP and CLI. Fix unix_listen_saddr() and unix_connect_saddr() to check @has_abstract/@has_tight, and to default absent @tight to true. However, this is only half of the story. HMP chardev-add and CLI -chardev so far correctly defaulted @tight to true, but defaults to false again with the above fix for HMP and CLI. In fact, the "tight" and "abstract" options now break completely. Digging deeper, we find that qemu_chr_parse_socket() also ignores @has_tight, leaving it false when it sets @tight. That is also wrong, but the two wrongs cancelled out. Fix qemu_chr_parse_socket() to set @has_tight and @has_abstract; writing testcases for HMP and CLI is left for another day. Fixes: 776b97d3605ed0fc94443048fdf988c7725e38a9 Reported-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2020-10-31Merge remote-tracking branch ↵Peter Maydell1-1/+7
'remotes/kraxel/tags/modules-20201029-pull-request' into staging modules: build virtio-gpu-pci & virtio-vga modular. modules: various bugfixes, mostly for macos. # gpg: Signature made Thu 29 Oct 2020 11:09:41 GMT # gpg: using RSA key 4CB6D8EED3E87138 # gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>" [full] # gpg: aka "Gerd Hoffmann <gerd@kraxel.org>" [full] # gpg: aka "Gerd Hoffmann (private) <kraxel@gmail.com>" [full] # Primary key fingerprint: A032 8CFF B93A 17A7 9901 FE7D 4CB6 D8EE D3E8 7138 * remotes/kraxel/tags/modules-20201029-pull-request: modules: turn off lazy binding modules: unbreak them on macos virtio-gpu: only compile virtio-gpu-3d.c for CONFIG_VIRGL=y virtio-gpu: add virtio-vga module virtio-gpu: add virtio-gpu-pci module Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2020-10-29util: include the target address in socket connect failuresDaniel P. Berrangé1-13/+19
Reporting "Failed to connect socket" is essentially useless for a user attempting to diagnose failure. It needs to include the target address details. Similarly when failing to create a socket we should include the socket family info, so the user understands what particular feature was missing in their kernel build (IPv6, VSock in particular). Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2020-10-29modules: turn off lazy bindingGerd Hoffmann1-1/+1
We want missing symbols fail module load right away instead of having qemu abort later on in case lazy binding fails. Can happen -- for example -- when trying to load a module for a pci device (virtio-gpu-pci) into a qemu without pci support (qemu-system-avr). Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Message-id: 20201028054944.5772-1-kraxel@redhat.com
2020-10-29virtio-gpu: add virtio-vga moduleGerd Hoffmann1-0/+3
Build virtio-gpu vga devices modular. Must be a separate module because not all qemu softmmu variants come with VGA support. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-id: 20201023064618.21409-3-kraxel@redhat.com
2020-10-29virtio-gpu: add virtio-gpu-pci moduleGerd Hoffmann1-0/+3
Build virtio-gpu pci devices modular. Must be a separate module because not all qemu softmmu variants come with PCI support. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Message-id: 20201023064618.21409-2-kraxel@redhat.com
2020-10-26Merge remote-tracking branch 'remotes/bonzini-gitlab/tags/for-upstream' into ↵Peter Maydell1-1/+1
staging * fix --disable-tcg builds (Claudio) * Fixes for macOS --enable-modules build and OpenBSD curses/iconv detection (myself) * Start preparing for meson 0.56 (myself) * Move directory configuration to meson (myself) * Start untangling qemu_init (myself) * Windows fixes (Sunil) * Remove -no-kbm (Thomas) # gpg: Signature made Mon 26 Oct 2020 11:12:17 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 * remotes/bonzini-gitlab/tags/for-upstream: machine: move SMP initialization from vl.c machine: move UP defaults to class_base_init machine: remove deprecated -machine enforce-config-section option win32: boot broken when bind & data dir are the same WHPX: Fix WHPX build break configure: move install_blobs from configure to meson configure: remove unused variable from config-host.mak configure: move directory options from config-host.mak to meson configure: allow configuring localedir Makefile: separate meson rerun from the rest of the ninja invocation Remove deprecated -no-kvm option replay: do not build if TCG is not available qtest: unbreak non-TCG builds in bios-tables-test hw/core/qdev-clock: add a reference on aliased clocks do not use colons in test names meson: rewrite curses/iconv test build: fix macOS --enable-modules build Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2020-10-26win32: boot broken when bind & data dir are the sameSunil Muthuswamy1-1/+1
With upstream commit#ea1edcd7da1a "vl: relocate paths to data directories", the data dir logic was unified between POSIX & Win32. That patch moved to using 'get_relocated_path()', to find the data dir. There is a latent bug in get_relocated_path which can cause it to spin indefinitely, when the bind dir is the same as the passed in dir (in this case, it was the data dir). Signed-off-by: Sunil Muthuswamy <sunilmut@microsoft.com> Message-Id: <SN4PR2101MB08802BF242C429A15DDB32ACC01B0@SN4PR2101MB0880.namprd21.prod.outlook.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2020-10-23util/vhost-user-server: use static library in meson.buildStefan Hajnoczi1-1/+3
Don't compile contrib/libvhost-user/libvhost-user.c again. Instead build the static library once and then reuse it throughout QEMU. Also switch from CONFIG_LINUX to CONFIG_VHOST_USER, which is what the vhost-user tools (vhost-user-gpu, etc) do. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Message-id: 20200924151549.913737-14-stefanha@redhat.com [Added CONFIG_LINUX again because libvhost-user doesn't build on macOS. --Stefan] Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2020-10-23util/vhost-user-server: move header to include/Stefan Hajnoczi2-66/+1
Headers used by other subsystems are located in include/. Also add the vhost-user-server and vhost-user-blk-server headers to MAINTAINERS. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Message-id: 20200924151549.913737-13-stefanha@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2020-10-23block/export: convert vhost-user-blk server to block export APIStefan Hajnoczi1-1/+9
Use the new QAPI block exports API instead of defining our own QOM objects. This is a large change because the lifecycle of VuBlockDev needs to follow BlockExportDriver. QOM properties are replaced by QAPI options objects. VuBlockDev is renamed VuBlkExport and contains a BlockExport field. Several fields can be dropped since BlockExport already has equivalents. The file names and meson build integration will be adjusted in a future patch. libvhost-user should probably be built as a static library that is linked into QEMU instead of as a .c file that results in duplicate compilation. The new command-line syntax is: $ qemu-storage-daemon \ --blockdev file,node-name=drive0,filename=test.img \ --export vhost-user-blk,node-name=drive0,id=export0,unix-socket=/tmp/vhost-user-blk.sock Note that unix-socket is optional because we may wish to accept chardevs too in the future. Markus noted that supported address families are not explicit in the QAPI schema. It is unlikely that support for more address families will be added since file descriptor passing is required and few address families support it. If a new address family needs to be added, then the QAPI 'features' syntax can be used to advertize them. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Acked-by: Markus Armbruster <armbru@redhat.com> Message-id: 20200924151549.913737-12-stefanha@redhat.com [Skip test on big-endian host architectures because this device doesn't support them yet (as already mentioned in a code comment). --Stefan] Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2020-10-23util/vhost-user-server: rework vu_client_trip() coroutine lifecycleStefan Hajnoczi2-120/+152
The vu_client_trip() coroutine is leaked during AioContext switching. It is also unsafe to destroy the vu_dev in panic_cb() since its callers still access it in some cases. Rework the lifecycle to solve these safety issues. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Message-id: 20200924151549.913737-10-stefanha@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2020-10-23util/vhost-user-server: check EOF when reading payloadStefan Hajnoczi1-2/+4
Unexpected EOF is an error that must be reported. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Message-id: 20200924151549.913737-9-stefanha@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2020-10-23util/vhost-user-server: fix memory leak in vu_message_read()Stefan Hajnoczi1-27/+23
fds[] is leaked when qio_channel_readv_full() fails. Use vmsg->fds[] instead of keeping a local fds[] array. Then we can reuse goto fail to clean up fds. vmsg->fd_num must be zeroed before the loop to make this safe. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Message-id: 20200924151549.913737-8-stefanha@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2020-10-23util/vhost-user-server: drop unused DevicePanicNotifierStefan Hajnoczi2-9/+0
The device panic notifier callback is not used. Drop it. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Message-id: 20200924151549.913737-7-stefanha@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2020-10-23util/vhost-user-server: drop unnecessary watch deletionStefan Hajnoczi1-15/+4
Explicitly deleting watches is not necessary since libvhost-user calls remove_watch() during vu_deinit(). Add an assertion to check this though. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Message-id: 20200924151549.913737-5-stefanha@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2020-10-23util/vhost-user-server: drop unnecessary QOM castStefan Hajnoczi1-1/+1
We already have access to the value with the correct type (ioc and sioc are the same QIOChannel). Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Message-id: 20200924151549.913737-4-stefanha@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2020-10-23util/vhost-user-server: s/fileds/fields/ typo fixStefan Hajnoczi1-1/+1
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Message-id: 20200924151549.913737-3-stefanha@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2020-10-23block: move logical block size check function to a common utility functionCoiby Xu3-0/+66
Move the constants from hw/core/qdev-properties.c to util/block-helpers.h so that knowledge of the min/max values is Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Coiby Xu <coiby.xu@gmail.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Acked-by: Eduardo Habkost <ehabkost@redhat.com> Message-id: 20200918080912.321299-5-coiby.xu@gmail.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2020-10-23util/vhost-user-server: generic vhost user serverCoiby Xu3-0/+494
Sharing QEMU devices via vhost-user protocol. Only one vhost-user client can connect to the server one time. Suggested-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Coiby Xu <coiby.xu@gmail.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-id: 20200918080912.321299-4-coiby.xu@gmail.com [Fixed size_t %lu -> %zu format string compiler error. --Stefan] Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2020-10-21opengl: build opengl helper code modularGerd Hoffmann1-0/+7
Removes opengl dependency from core qemu. The number of shared libraries for qemu-system-x86_64 goes down from 66 to 60 on my system. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-id: 20201019075224.14803-15-kraxel@redhat.com
2020-10-21modules: add spice dependenciesGerd Hoffmann1-0/+5
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-id: 20201019075224.14803-12-kraxel@redhat.com
2020-10-21modules: dependencies infrastructureGerd Hoffmann1-5/+27
Allow modules depending on other modules. module_load_file() gets the option to export symbols (by not adding the G_MODULE_BIND_LOCAL flag). module_load_one() will check the module dependency list to figure (a) whenever are other modules must be loaded first, or (b) the module should export the symbols. The dependencies are specificed as static list in the source code for now as I expect the list will stay small. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-id: 20201019075224.14803-11-kraxel@redhat.com
2020-10-16util/cutils: Introduce freq_to_str() to display Hertz unitsPhilippe Mathieu-Daudé1-0/+14
Introduce freq_to_str() to convert frequency values in human friendly units using the SI units for Hertz. Suggested-by: Luc Michel <luc@lmichel.fr> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Reviewed-by: Luc Michel <luc@lmichel.fr> Message-Id: <20201012095804.3335117-2-f4bug@amsat.org>
2020-10-16Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into stagingPeter Maydell1-27/+76
Block layer patches: - qemu-storage-daemon: Remove QemuOpts from --object parser - monitor: Fix order in monitor_cleanup() - Deprecate the sheepdog block driver # gpg: Signature made Thu 15 Oct 2020 15:48:10 BST # gpg: using RSA key DC3DEB159A9AF95D3D7456FE7F09B272C88F2FD6 # gpg: issuer "kwolf@redhat.com" # gpg: Good signature from "Kevin Wolf <kwolf@redhat.com>" [full] # Primary key fingerprint: DC3D EB15 9A9A F95D 3D74 56FE 7F09 B272 C88F 2FD6 * remotes/kevin/tags/for-upstream: block: deprecate the sheepdog block driver block: drop moderated sheepdog mailing list from MAINTAINERS file monitor: Fix order in monitor_cleanup() qemu-storage-daemon: Remove QemuOpts from --object parser qom: Add user_creatable_print_help_from_qdict() qom: Factor out helpers from user_creatable_print_help() keyval: Parse help options keyval: Fix parsing of ',' in value of implied key test-keyval: Demonstrate misparse of ',' with implied key keyval: Fix and clarify grammar Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2020-10-15keyval: Parse help optionsKevin Wolf1-12/+51
This adds a special meaning for 'help' and '?' as options to the keyval parser. Instead of being an error (because of a missing value) or a value for an implied key, they now request help, which is a new boolean output of the parser in addition to the QDict. A new parameter 'p_help' is added to keyval_parse() that contains on return whether help was requested. If NULL is passed, requesting help results in an error and all other cases work like before. Turning previous error cases into help is a compatible extension. The behaviour potentially changes for implied keys: They could previously get 'help' as their value, which is now interpreted as requesting help. This is not a problem in practice because 'help' and '?' are not a valid values for the implied key of any option parsed with keyval_parse(): * audiodev: union Audiodev, implied key "driver" is enum AudiodevDriver, "help" and "?" are not among its values * display: union DisplayOptions, implied key "type" is enum DisplayType, "help" and "?" are not among its values * blockdev: union BlockdevOptions, implied key "driver is enum BlockdevDriver, "help" and "?" are not among its values * export: union BlockExport, implied key "type" is enum BlockExportType, "help" and "?" are not among its values * monitor: struct MonitorOptions, implied key "mode" is enum MonitorMode, "help" and "?" are not among its values * nbd-server: struct NbdServerOptions, no implied key. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20201011073505.1185335-5-armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2020-10-15keyval: Fix parsing of ',' in value of implied keyMarkus Armbruster1-11/+17
The previous commit demonstrated documentation and code disagree on parsing of ',' in the value of an implied key. Fix the code to match the documentation. This breaks uses of keyval_parse() that pass an implied key and accept a value containing ','. None of the existing uses does: * audiodev: implied key "driver" is enum AudiodevDriver, none of the values contains ',' * display: implied key "type" is enum DisplayType, none of the values contains ',' * blockdev: implied key "driver is enum BlockdevDriver, none of the values contains ',' * export: implied key "type" is enum BlockExportType, none of the values contains ',' * monitor: implied key "mode" is enum MonitorMode, none of the values contains ',' * nbd-server: no implied key. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20201011073505.1185335-4-armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2020-10-15keyval: Fix and clarify grammarMarkus Armbruster1-6/+10
The grammar has a few issues: * key-fragment = / [^=,.]* / Prose restricts key fragments: they "must be valid QAPI names or consist only of decimal digits". Technically, '' consists only of decimal digits. The code rejects that. Fix the grammar. * val = { / [^,]* / | ',,' } Use + instead of *. Accepts the same language. * val-no-key = / [^=,]* / The code rejects an empty value. Fix the grammar. * Section "Additional syntax for use with an implied key" is confusing. Rewrite it. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20201011073505.1185335-2-armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2020-10-15chardev/spice: build spice chardevs as moduleGerd Hoffmann1-0/+2
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Message-id: 20201014121120.13482-8-kraxel@redhat.com
2020-10-15modules: update qom object module commentGerd Hoffmann1-1/+3
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-id: 20200923103728.12026-1-kraxel@redhat.com
2020-10-15module: silence errors for module_load_qom_all().Gerd Hoffmann1-10/+10
Add mayfail bool parameter to module loading functions. Set it to true for module_load_qom_all() because device modules might not load into all system emulation variants. qemu-system-s390x for example will not load qxl because it lacks vga support. Makes "make check" less chatty. Drop module_loaded_qom_all check in module_load_qom_one to make sure we see errors for explicit load requests, i.e. module_load_qom_one("qxl") failing will log an error no matter whenever module_load_qom_all() was called before or not. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Acked-by: Paolo Bonzini <pbonzini@redhat.com> Message-id: 20200923091217.22662-1-kraxel@redhat.com
2020-10-14win32: Simplify gmtime_r detection not depends on if _POSIX_C_SOURCE are ↵Yonggang Luo1-2/+2
defined on msys2/mingw We remove the CONFIG_LOCALTIME_R detection option in configure, and move the check existence of gmtime_r from configure into C header and source directly by using macro `_POSIX_THREAD_SAFE_FUNCTIONS`. Before this patch, the configure script are always assume the compiler doesn't define _POSIX_C_SOURCE macro at all, but that's not true, because thirdparty library such as ncursesw may define -D_POSIX_C_SOURCE in it's pkg-config file. And that C Flags will added -D_POSIX_C_SOURCE into each QEMU_CFLAGS. And that's causing the following compiling error: n file included from C:/work/xemu/qemu/include/qemu/osdep.h:119, from ../softmmu/main.c:25: C:/work/xemu/qemu/include/sysemu/os-win32.h:53:12: error: redundant redeclaration of 'gmtime_r' [-Werror=redundant-decls] 53 | struct tm *gmtime_r(const time_t *timep, struct tm *result); | ^~~~~~~~ In file included from C:/work/xemu/qemu/include/qemu/osdep.h:94, from ../softmmu/main.c:25: C:/CI-Tools/msys64/mingw64/x86_64-w64-mingw32/include/time.h:284:36: note: previous definition of 'gmtime_r' was here 284 | __forceinline struct tm *__CRTDECL gmtime_r(const time_t *_Time, struct tm *_Tm) { | ^~~~~~~~ In file included from C:/work/xemu/qemu/include/qemu/osdep.h:119, from ../softmmu/main.c:25: C:/work/xemu/qemu/include/sysemu/os-win32.h:55:12: error: redundant redeclaration of 'localtime_r' [-Werror=redundant-decls] 55 | struct tm *localtime_r(const time_t *timep, struct tm *result); | ^~~~~~~~~~~ In file included from C:/work/xemu/qemu/include/qemu/osdep.h:94, from ../softmmu/main.c:25: C:/CI-Tools/msys64/mingw64/x86_64-w64-mingw32/include/time.h:281:36: note: previous definition of 'localtime_r' was here 281 | __forceinline struct tm *__CRTDECL localtime_r(const time_t *_Time, struct tm *_Tm) { | ^~~~~~~~~~~ Compiling C object libcommon.fa.p/hw_gpio_zaurus.c.obj In file included from C:/work/xemu/qemu/include/qemu/osdep.h:119, from ../hw/i2c/smbus_slave.c:16: C:/work/xemu/qemu/include/sysemu/os-win32.h:53:12: error: redundant redeclaration of 'gmtime_r' [-Werror=redundant-decls] 53 | struct tm *gmtime_r(const time_t *timep, struct tm *result); | ^~~~~~~~ In file included from C:/work/xemu/qemu/include/qemu/osdep.h:94, from ../hw/i2c/smbus_slave.c:16: C:/CI-Tools/msys64/mingw64/x86_64-w64-mingw32/include/time.h:284:36: note: previous definition of 'gmtime_r' was here 284 | __forceinline struct tm *__CRTDECL gmtime_r(const time_t *_Time, struct tm *_Tm) { | ^~~~~~~~ In file included from C:/work/xemu/qemu/include/qemu/osdep.h:119, from ../hw/i2c/smbus_slave.c:16: C:/work/xemu/qemu/include/sysemu/os-win32.h:55:12: error: redundant redeclaration of 'localtime_r' [-Werror=redundant-decls] 55 | struct tm *localtime_r(const time_t *timep, struct tm *result); | ^~~~~~~~~~~ In file included from C:/work/xemu/qemu/include/qemu/osdep.h:94, from ../hw/i2c/smbus_slave.c:16: C:/CI-Tools/msys64/mingw64/x86_64-w64-mingw32/include/time.h:281:36: note: previous definition of 'localtime_r' was here 281 | __forceinline struct tm *__CRTDECL localtime_r(const time_t *_Time, struct tm *_Tm) { | ^~~~~~~~~~~ Compiling C object libcommon.fa.p/hw_dma_xilinx_axidma.c.obj After this patch, whenever ncursesw or other thirdparty libraries tried to define or not define _POSIX_C_SOURCE, the source will building properly. Because now, we don't make any assumption if _POSIX_C_SOURCE are defined. We solely relied on if the macro `_POSIX_THREAD_SAFE_FUNCTIONS` are defined in msys2/mingw header. The _POSIX_THREAD_SAFE_FUNCTIONS are defined in mingw header like this: ``` #if defined(_POSIX_C_SOURCE) && !defined(_POSIX_THREAD_SAFE_FUNCTIONS) #define _POSIX_THREAD_SAFE_FUNCTIONS 200112L #endif #ifdef _POSIX_THREAD_SAFE_FUNCTIONS __forceinline struct tm *__CRTDECL localtime_r(const time_t *_Time, struct tm *_Tm) { return localtime_s(_Tm, _Time) ? NULL : _Tm; } __forceinline struct tm *__CRTDECL gmtime_r(const time_t *_Time, struct tm *_Tm) { return gmtime_s(_Tm, _Time) ? NULL : _Tm; } __forceinline char *__CRTDECL ctime_r(const time_t *_Time, char *_Str) { return ctime_s(_Str, 0x7fffffff, _Time) ? NULL : _Str; } __forceinline char *__CRTDECL asctime_r(const struct tm *_Tm, char * _Str) { return asctime_s(_Str, 0x7fffffff, _Tm) ? NULL : _Str; } #endif ``` Signed-off-by: Yonggang Luo <luoyonggang@gmail.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Message-id: 20201012234348.1427-5-luoyonggang@gmail.com Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2020-10-09util/async: Add aio_co_reschedule_self()Kevin Wolf1-0/+30
Add a function that can be used to move the currently running coroutine to a different AioContext (and therefore potentially a different thread). Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Message-Id: <20201005155855.256490-12-kwolf@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
2020-10-09qmp: Move dispatcher to a coroutineKevin Wolf1-1/+7
This moves the QMP dispatcher to a coroutine and runs all QMP command handlers that declare 'coroutine': true in coroutine context so they can avoid blocking the main loop while doing I/O or waiting for other events. For commands that are not declared safe to run in a coroutine, the dispatcher drops out of coroutine context by calling the QMP command handler from a bottom half. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20201005155855.256490-10-kwolf@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
2020-10-09monitor: Use getter/setter functions for cur_monKevin Wolf3-4/+6
cur_mon really needs to be coroutine-local as soon as we move monitor command handlers to coroutines and let them yield. As a first step, just remove all direct accesses to cur_mon so that we can implement this in the getter function later. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Message-Id: <20201005155855.256490-4-kwolf@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
2020-10-06Merge remote-tracking branch 'remotes/bonzini-gitlab/tags/for-upstream' into ↵Peter Maydell2-12/+14
staging * Reverse debugging (Pavel) * CFLAGS cleanup (Paolo) * ASLR fix (Mark) * cpus.c refactoring (Claudio) # gpg: Signature made Tue 06 Oct 2020 07:35:09 BST # 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 * remotes/bonzini-gitlab/tags/for-upstream: (37 commits) tests/acceptance: add reverse debugging test replay: create temporary snapshot at debugger connection replay: describe reverse debugging in docs/replay.txt gdbstub: add reverse continue support in replay mode gdbstub: add reverse step support in replay mode replay: flush rr queue before loading the vmstate replay: implement replay-seek command replay: introduce breakpoint at the specified step replay: introduce info hmp/qmp command qapi: introduce replay.json for record/replay-related stuff migration: introduce icount field for snapshots qcow2: introduce icount field for snapshots replay: provide an accessor for rr filename replay: don't record interrupt poll configure: don't enable ASLR for --enable-debug Windows builds configure: consistently pass CFLAGS/CXXFLAGS/LDFLAGS to meson configure: do not clobber environment CFLAGS/CXXFLAGS/LDFLAGS dtc: Convert Makefile bits to meson bits slirp: Convert Makefile bits to meson bits accel/tcg: use current_machine as it is always set for softmmu ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2020-10-05cpus: prepare new CpusAccel cpu accelerator interfaceClaudio Fontana1-7/+1
The new interface starts unused, will start being used by the next patches. It provides methods for each accelerator to start a vcpu, kick a vcpu, synchronize state, get cpu virtual clock and elapsed ticks. In qemu_wait_io_event, make it clear that APC is used only for HAX on Windows. Signed-off-by: Claudio Fontana <cfontana@suse.de> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2020-10-05icount: rename functions to be consistent with the module nameClaudio Fontana2-3/+3
Signed-off-by: Claudio Fontana <cfontana@suse.de> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2020-10-05cpu-timers, icount: new modulesClaudio Fontana2-7/+15
refactoring of cpus.c continues with cpu timer state extraction. cpu-timers: responsible for the softmmu cpu timers state, including cpu clocks and ticks. icount: counts the TCG instructions executed. As such it is specific to the TCG accelerator. Therefore, it is built only under CONFIG_TCG. One complication is due to qtest, which uses an icount field to warp time as part of qtest (qtest_clock_warp). In order to solve this problem, provide a separate counter for qtest. This requires fixing assumptions scattered in the code that qtest_enabled() implies icount_enabled(), checking each specific case. Signed-off-by: Claudio Fontana <cfontana@suse.de> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> [remove redundant initialization with qemu_spice_init] Reviewed-by: Alex Bennée <alex.bennee@linaro.org> [fix lingering calls to icount_get] Signed-off-by: Claudio Fontana <cfontana@suse.de> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2020-10-05util/vfio-helpers: Rework the IOVA allocator to avoid IOVA reserved regionsEric Auger1-4/+53
Introduce the qemu_vfio_find_fixed/temp_iova helpers which respectively allocate IOVAs from the bottom/top parts of the usable IOVA range, without picking within host IOVA reserved windows. The allocation remains basic: if the size is too big for the remaining of the current usable IOVA range, we jump to the next one, leaving a hole in the address map. Signed-off-by: Eric Auger <eric.auger@redhat.com> Message-id: 20200929085550.30926-3-eric.auger@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2020-10-05util/vfio-helpers: Collect IOVA reserved regionsEric Auger1-2/+70
The IOVA allocator currently ignores host reserved regions. As a result some chosen IOVAs may collide with some of them, resulting in VFIO MAP_DMA errors later on. This happens on ARM where the MSI reserved window quickly is encountered: [0x8000000, 0x8100000]. since 5.4 kernel, VFIO returns the usable IOVA regions. So let's enumerate them in the prospect to avoid them, later on. Signed-off-by: Eric Auger <eric.auger@redhat.com> Message-id: 20200929085550.30926-2-eric.auger@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2020-10-05util/vfio-helpers: Pass page protections to qemu_vfio_pci_map_bar()Philippe Mathieu-Daudé1-2/+2
Pages are currently mapped READ/WRITE. To be able to use different protections, add a new argument to qemu_vfio_pci_map_bar(). Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Message-Id: <20200922083821.578519-2-philmd@redhat.com>
2020-09-30module: relocate path to modulesPaolo Bonzini1-1/+2
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2020-09-30oslib-posix: relocate path to /varPaolo Bonzini1-2/+4
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2020-09-30cutils: introduce get_relocated_pathPaolo Bonzini1-0/+61
Add the function that will compute a relocated version of the directories in CONFIG_QEMU_*DIR and CONFIG_QEMU_*PATH. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>