summaryrefslogtreecommitdiffstats
path: root/contrib
Commit message (Collapse)AuthorAgeFilesLines
...
* contrib/gitdm: Add Qualcomm to the domain mapPhilippe Mathieu-Daudé2020-10-091-0/+1
| | | | | | | | | | | There is a number of contributions from this domain, add its own entry to the gitdm domain map. Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Taylor Simpson <tsimpson@quicinc.com> Message-Id: <20201006160653.2391972-8-f4bug@amsat.org> Message-Id: <20201007160038.26953-14-alex.bennee@linaro.org>
* contrib/gitdm: Add Nuvia to the domain mapPhilippe Mathieu-Daudé2020-10-091-0/+1
| | | | | | | | | | | There is a number of contributions from this domain, add its own entry to the gitdm domain map. Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Graeme Gregory <graeme@nuviainc.com> Message-Id: <20201006160653.2391972-7-f4bug@amsat.org> Message-Id: <20201007160038.26953-13-alex.bennee@linaro.org>
* contrib/gitdm: Add Google to the domain mapPhilippe Mathieu-Daudé2020-10-091-1/+2
| | | | | | | | | | | There is a number of contributors from this domain, add its own entry to the gitdm domain map. Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Acked-by: Erik Kline <ek@google.com> Message-Id: <20201006160653.2391972-6-f4bug@amsat.org> Message-Id: <20201007160038.26953-12-alex.bennee@linaro.org>
* contrib/gitdm: Add ByteDance to the domain mapPhilippe Mathieu-Daudé2020-10-091-0/+1
| | | | | | | | | | | There is a number of contributors from this domain, add its own entry to the gitdm domain map. Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Acked-by: Jiachen Zhang <zhangjiachen.jaycee@bytedance.com> Message-Id: <20201006160653.2391972-5-f4bug@amsat.org> Message-Id: <20201007160038.26953-11-alex.bennee@linaro.org>
* contrib/gitdm: Add Baidu to the domain mapPhilippe Mathieu-Daudé2020-10-091-0/+1
| | | | | | | | | | | There is a number of contributors from this domain, add its own entry to the gitdm domain map. Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Chai Wen <chaiwen@baidu.com> Message-Id: <20201006160653.2391972-4-f4bug@amsat.org> Message-Id: <20201007160038.26953-10-alex.bennee@linaro.org>
* contrib/gitdm: Add more individual contributorsPhilippe Mathieu-Daudé2020-10-091-0/+7
| | | | | | | | | | | | | | | | | These individual contributors have a number of contributions, add them to the 'individual' group map. Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Acked-by: Helge Deller <deller@gmx.de> Acked-by: Stefan Weil <sw@weilnetz.de> Acked-by: Niek Linnenbank <nieklinnenbank@gmail.com> Acked-by: David Carlier <devnexen@gmail.com> Acked-by: Paul Zimmerman <pauldzim@gmail.com> Acked-by: Volker Rümelin <vr_qemu@t-online.de> Acked-by: Finn Thain <fthain@telegraphics.com.au> Message-Id: <20201006160653.2391972-3-f4bug@amsat.org> Message-Id: <20201007160038.26953-9-alex.bennee@linaro.org>
* contrib/gitdm: Add more academic domainsPhilippe Mathieu-Daudé2020-10-091-0/+4
| | | | | | | | | | | | | | | There is a number of contributions from these academic domains. Add the entries to the gitdm 'academic' domain map. Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Alexander Bulekov <alxndr@bu.edu> Reviewed-by: Dayeol Lee <dayeol@berkeley.edu> Acked-by: Fan Yang <Fan_Yang@sjtu.edu.cn> Acked-by: Xinyu Li <precinct@mail.ustc.edu.cn> Acked-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de> Message-Id: <20201006160653.2391972-2-f4bug@amsat.org> Message-Id: <20201007160038.26953-8-alex.bennee@linaro.org>
* libvhost-user: return on error in vu_log_queue_fill()Stefan Hajnoczi2020-09-291-0/+1
| | | | | | | | | | | vu_panic() is not guaranteed to exit the program. Return early when errors are encountered. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Message-Id: <20200921113420.154378-3-stefanha@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* libvhost-user: return early on virtqueue errorsStefan Hajnoczi2020-09-291-8/+17
| | | | | | | | | | | | | | vu_panic() is not guaranteed to exit the program. Return early when errors are encountered. Note that libvhost-user does not have an "unmap" operation for mapped descriptors. Therefore it is correct to return without explicit cleanup. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Message-Id: <20200921113420.154378-2-stefanha@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* qemu/atomic.h: rename atomic_ to qatomic_Stefan Hajnoczi2020-09-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | clang's C11 atomic_fetch_*() functions only take a C11 atomic type pointer argument. QEMU uses direct types (int, etc) and this causes a compiler error when a QEMU code calls these functions in a source file that also included <stdatomic.h> via a system header file: $ CC=clang CXX=clang++ ./configure ... && make ../util/async.c:79:17: error: address argument to atomic operation must be a pointer to _Atomic type ('unsigned int *' invalid) Avoid using atomic_*() names in QEMU's atomic.h since that namespace is used by <stdatomic.h>. Prefix QEMU's APIs with 'q' so that atomic.h and <stdatomic.h> can co-exist. I checked /usr/include on my machine and searched GitHub for existing "qatomic_" users but there seem to be none. This patch was generated using: $ git grep -h -o '\<atomic\(64\)\?_[a-z0-9_]\+' include/qemu/atomic.h | \ sort -u >/tmp/changed_identifiers $ for identifier in $(</tmp/changed_identifiers); do sed -i "s%\<$identifier\>%q$identifier%g" \ $(git grep -I -l "\<$identifier\>") done I manually fixed line-wrap issues and misaligned rST tables. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Acked-by: Paolo Bonzini <pbonzini@redhat.com> Message-Id: <20200923105646.47864-1-stefanha@redhat.com>
* libvhost-user: handle endianness as mandated by the specMarc Hartmayer2020-09-231-34/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | Since virtio existed even before it got standardized, the virtio standard defines the following types of virtio devices: + legacy device (pre-virtio 1.0) + non-legacy or VIRTIO 1.0 device + transitional device (which can act both as legacy and non-legacy) Virtio 1.0 defines the fields of the virtqueues as little endian, while legacy uses guest's native endian [1]. Currently libvhost-user does not handle virtio endianness at all, i.e. it works only if the native endianness matches with whatever is actually needed. That means things break spectacularly on big-endian targets. Let us handle virtio endianness for non-legacy as required by the virtio specification [1] and fence legacy virtio, as there is no safe way to figure out the needed endianness conversions for all cases. The fencing of legacy virtio devices is done in `vu_set_features_exec`. [1] https://docs.oasis-open.org/virtio/virtio/v1.1/cs01/virtio-v1.1-cs01.html#x1-210003 Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com> Message-id: 20200901150019.29229-3-mhartmay@linux.ibm.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
* contrib/: fix some comment spelling errorszhaolichang2020-09-174-7/+7
| | | | | | | | | | | I found that there are many spelling errors in the comments of qemu, so I used the spellcheck tool to check the spelling errors and finally found some spelling errors in the contrib folder. Signed-off-by: zhaolichang <zhaolichang@huawei.com> Reviewed-by: Alex Bennee <alex.bennee@linaro.org> Message-Id: <20200917075029.313-11-zhaolichang@huawei.com> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
* plugins: move the more involved plugins to contribAlex Bennée2020-09-105-0/+1082
| | | | | | | | | | | | | | We have an exploding complexity problem in the testing so lets just move the more involved plugins into contrib. tests/plugins still exist for the basic plugins that exercise the API. We restore the old pre-meson style Makefile for contrib as it also doubles as a guide for out-of-tree plugin builds. While we are at it add some examples to the documentation and a specific plugins build target. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20200909112742.25730-11-alex.bennee@linaro.org>
* meson: use meson datadir instead of qemu_datadirMarc-André Lureau2020-09-011-1/+1
| | | | | | | | | | When cross-compiling, by default qemu_datadir is 'c:\Program Files\QEMU', which is not recognized as being an absolute path, and meson will end up adding the prefix again. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20200826110419.528931-6-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* meson: move pixman detection to mesonPaolo Bonzini2020-08-271-1/+2
| | | | | | | | | | | | | | | | | When pixman is not installed (or too old), but virglrenderer is available and "configure" has been run with "--disable-system", the build currently aborts when trying to compile vhost-user-gpu (since it requires pixman). Let's skip the build of vhost-user-gpu when pixman is not installed or too old. Instead of adding CONFIG_PIXMAN, it is simpler to move the detection to pixman. Based on a patch by Thomas Huth. <thuth@redhat.com> Fixes: 9b52b17ba5 ("configure: Allow to build tools without pixman") Reported-by: Rafael Kitover <rkitover@gmail.com> Reported-by: Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* contrib/elf2dmp: convert to mesonMarc-André Lureau2020-08-212-4/+5
| | | | | Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* contrib/ivshmem: convert to mesonMarc-André Lureau2020-08-214-2/+8
| | | | | Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* contrib/vhost-user-gpu: convert to mesonMarc-André Lureau2020-08-212-10/+13
| | | | | Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* contrib/vhost-user-input: convert to mesonMarc-André Lureau2020-08-212-1/+5
| | | | | Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* contrib/rdmacm-mux: convert to MesonPaolo Bonzini2020-08-212-3/+9
| | | | | | | We can use config-host.mak to decide whether the tool has to be built, apart from that the conversion is straightforward. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* contrib/vhost-user-scsi: convert to MesonPaolo Bonzini2020-08-212-1/+7
| | | | | | | The libiscsi pkg-config information is extracted from config-host.mak and used to link vhost-user-blk. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* vhost-user-scsi: add compatibility for libiscsi 1.9.0Paolo Bonzini2020-08-211-0/+2
| | | | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* contrib/vhost-user-blk: convert to MesonPaolo Bonzini2020-08-212-1/+6
| | | | | | | The GLib pkg-config information is extracted from config-host.mak and used to link vhost-user-blk. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* contrib/libvhost-user: convert to MesonPaolo Bonzini2020-08-212-1/+3
| | | | | | | Since libqemuutil.a has been converted to Meson, the conversion is straightforward. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* meson: rename included C source files to .c.incPaolo Bonzini2020-08-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | With Makefiles that have automatically generated dependencies, you generated includes are set as dependencies of the Makefile, so that they are built before everything else and they are available when first building the .c files. Alternatively you can use a fine-grained dependency, e.g. target/arm/translate.o: target/arm/decode-neon-shared.inc.c With Meson you have only one choice and it is a third option, namely "build at the beginning of the corresponding target"; the way you express it is to list the includes in the sources of that target. The problem is that Meson decides if something is a source vs. a generated include by looking at the extension: '.c', '.cc', '.m', '.C' are sources, while everything else is considered an include---including '.inc.c'. Use '.c.inc' to avoid this, as it is consistent with our other convention of using '.rst.inc' for included reStructuredText files. The editorconfig file is adjusted. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* libvhost-user: Report descriptor index on panicPhilippe Mathieu-Daudé2020-07-271-2/+2
| | | | | | | | | | | | | | | We want to report the index of the descriptor, not its pointer. Fixes: 7b2e5c65f4 ("contrib: add libvhost-user") Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20200723171935.18535-1-philmd@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Raphael Norwitz <raphael.norwitz@nutanix.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Cc: qemu-stable@nongnu.org Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* qemu-option: Use returned bool to check for failureMarkus Armbruster2020-07-101-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The previous commit enables conversion of foo(..., &err); if (err) { ... } to if (!foo(..., &err)) { ... } for QemuOpts functions that now return true / false on success / error. Coccinelle script: @@ identifier fun = { opts_do_parse, parse_option_bool, parse_option_number, parse_option_size, qemu_opt_parse, qemu_opt_rename, qemu_opt_set, qemu_opt_set_bool, qemu_opt_set_number, qemu_opts_absorb_qdict, qemu_opts_do_parse, qemu_opts_from_qdict_entry, qemu_opts_set, qemu_opts_validate }; expression list args, args2; typedef Error; Error *err; @@ - fun(args, &err, args2); - if (err) + if (!fun(args, &err, args2)) { ... } A few line breaks tidied up manually. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Message-Id: <20200707160613.848843-15-armbru@redhat.com> [Conflict with commit 0b6786a9c1 "block/amend: refactor qcow2 amend options" resolved by rerunning Coccinelle on master's version]
* libvhost-user: advertise vring featuresStefan Hajnoczi2020-06-122-3/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | libvhost-user implements several vring features without advertising them. There is no way for the vhost-user master to detect support for these features. Things more or less work today because QEMU assumes the vhost-user backend always implements certain feature bits like VIRTIO_RING_F_EVENT_IDX. This is not documented anywhere. This patch explicitly advertises features implemented in libvhost-user so that the vhost-user master does not need to make undocumented assumptions. Feature bits that libvhost-user now advertises can be removed from vhost-user-blk.c. Devices should not be responsible for advertising vring feature bits, that is libvhost-user's job. Cc: Marc-André Lureau <marcandre.lureau@redhat.com> Cc: Jason Wang <jasowang@redhat.com> Cc: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Message-Id: <20200529161338.456017-1-stefanha@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
* Lift max ram slots limit in libvhost-userRaphael Norwitz2020-06-122-12/+20
| | | | | | | | | | | | | | | | | | | | Historically, VMs with vhost-user devices could hot-add memory a maximum of 8 times. Now that the VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS protocol feature has been added, VMs with vhost-user backends which support this new feature can support a configurable number of ram slots up to the maximum supported by the target platform. This change adds VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS support for backends built with libvhost-user, and increases the number of supported ram slots from 8 to 32. Memory hot-add, hot-remove and postcopy migration were tested with the vhost-user-bridge sample. Signed-off-by: Raphael Norwitz <raphael.norwitz@nutanix.com> Message-Id: <1588533678-23450-11-git-send-email-raphael.norwitz@nutanix.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* Support individual region unmap in libvhost-userRaphael Norwitz2020-06-122-0/+64
| | | | | | | | | | | | | | | | | | | When the VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS protocol feature is enabled, on memory hot-unplug qemu will transmit memory regions to remove individually using the new message VHOST_USER_REM_MEM_REG message. With this change, vhost-user backends build with libvhost-user can now unmap individual memory regions when receiving the VHOST_USER_REM_MEM_REG message. Qemu only sends VHOST_USER_REM_MEM_REG messages when the VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS feature is negotiated, and support for that feature has not yet been added in libvhost-user, this new functionality is not yet used. Signed-off-by: Raphael Norwitz <raphael.norwitz@nutanix.com> Message-Id: <1588533678-23450-10-git-send-email-raphael.norwitz@nutanix.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* Support adding individual regions in libvhost-userRaphael Norwitz2020-06-122-0/+110
| | | | | | | | | | | | | | | | | | When the VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS is enabled, qemu will transmit memory regions to a backend individually using the new message VHOST_USER_ADD_MEM_REG. With this change vhost-user backends built with libvhost-user can now map in new memory regions when VHOST_USER_ADD_MEM_REG messages are received. Qemu only sends VHOST_USER_ADD_MEM_REG messages when the VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS feature is negotiated, and since it is not yet supported in libvhost-user, this new functionality is not yet used. Signed-off-by: Raphael Norwitz <raphael.norwitz@nutanix.com> Message-Id: <1588533678-23450-9-git-send-email-raphael.norwitz@nutanix.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* Support ram slot configuration in libvhost-userRaphael Norwitz2020-06-122-0/+20
| | | | | | | | | | | | | | | | | | | The VHOST_USER_GET_MAX_MEM_SLOTS message allows a vhost-user backend to specify a maximum number of ram slots it is willing to support. This change adds support for libvhost-user to process this message. For now the backend will reply with 8 as the maximum number of regions supported. libvhost-user does not yet support the vhost-user protocol feature VHOST_USER_PROTOCOL_F_CONFIGIRE_MEM_SLOTS, so qemu should never send the VHOST_USER_GET_MAX_MEM_SLOTS message. Therefore this new functionality is not currently used. Signed-off-by: Raphael Norwitz <raphael.norwitz@nutanix.com> Message-Id: <1588533678-23450-8-git-send-email-raphael.norwitz@nutanix.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
* Refactor out libvhost-user fault generation logicRaphael Norwitz2020-06-121-68/+79
| | | | | | | | | | | | | | | | | In libvhost-user, the incoming postcopy migration path for setting the backend's memory tables has become convolued. In particular, moving the logic which starts generating faults, having received the final ACK from qemu can be moved to a separate function. This simplifies the code substantially. This logic will also be needed by the postcopy path once the VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS feature is supported. Signed-off-by: Raphael Norwitz <raphael.norwitz@nutanix.com> Message-Id: <1588533678-23450-7-git-send-email-raphael.norwitz@nutanix.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
* vhost-user-gpu: Release memory returned by vu_queue_pop() with free()Philippe Mathieu-Daudé2020-04-152-3/+3
| | | | | | | | | | | vu_queue_pop() returns memory that must be freed with free(). Cc: qemu-stable@nongnu.org Reported-by: Coverity (CID 1421887 ALLOC_FREE_MISMATCH) Suggested-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
* build-sys: do not make qemu-ga link with pixmanMarc-André Lureau2020-03-162-3/+3
| | | | | | | | | | | | | | | | | | | | | | Since commit d52c454aadcdae74506f315ebf8b58bb79a05573 ("contrib: add vhost-user-gpu"), qemu-ga is linking with pixman. This is because the Make-based build-system use a global namespace for variables, and we rely on "main.o-libs" for different linking targets. Note: this kind of variable clashing is hard to fix or prevent currently. meson should help, as declarations have a linear dependency and doesn't rely so much on variables and clever tricks. Note2: we have a lot of main.c (or other duplicated names!) in tree. Imho, it would be annoying and a bad workaroud to rename all those to avoid conflicts like I did here. Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1811670 Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20200311160923.882474-1-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* misc: Replace zero-length arrays with flexible array member (automatic)Philippe Mathieu-Daudé2020-03-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Description copied from Linux kernel commit from Gustavo A. R. Silva (see [3]): --v-- description start --v-- The current codebase makes use of the zero-length array language extension to the C90 standard, but the preferred mechanism to declare variable-length types such as these ones is a flexible array member [1], introduced in C99: struct foo { int stuff; struct boo array[]; }; By making use of the mechanism above, we will get a compiler warning in case the flexible array does not occur last in the structure, which will help us prevent some kind of undefined behavior bugs from being unadvertenly introduced [2] to the Linux codebase from now on. --^-- description end --^-- Do the similar housekeeping in the QEMU codebase (which uses C99 since commit 7be41675f7cb). All these instances of code were found with the help of the following Coccinelle script: @@ identifier s, m, a; type t, T; @@ struct s { ... t m; - T a[0]; + T a[]; }; @@ identifier s, m, a; type t, T; @@ struct s { ... t m; - T a[0]; + T a[]; } QEMU_PACKED; [1] https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html [2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=76497732932f [3] https://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux.git/commit/?id=17642a2fbd2c1 Inspired-by: Gustavo A. R. Silva <gustavo@embeddedor.com> Reviewed-by: David Hildenbrand <david@redhat.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* libvhost-user: implement in-band notificationsJohannes Berg2020-02-272-3/+114
| | | | | | | | | | | | | | | | | | | | | Add support for VHOST_USER_PROTOCOL_F_IN_BAND_NOTIFICATIONS, but as it's not desired by default, don't enable it unless the device implementation opts in by returning it from its protocol features callback. Note that I updated vu_set_vring_err_exec(), but didn't add any sending of the VHOST_USER_SLAVE_VRING_ERR message as there's no write to the err_fd today either. This also adds vu_queue_notify_sync() which can be used to force a synchronous notification if inband notifications are supported. Previously, I had left out the slave->master direction handling of F_REPLY_ACK, this now adds some code to support it as well. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Message-Id: <20200123081708.7817-7-johannes@sipsolutions.net> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* libvhost-user: handle NOFD flag in call/kick/err betterJohannes Berg2020-02-271-8/+16
| | | | | | | | | | | | | The code here is odd, for example will it print out invalid file descriptor numbers that were never sent in the message. Clean that up a bit so it's actually possible to implement a device that uses polling. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Message-Id: <20200123081708.7817-5-johannes@sipsolutions.net> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* libvhost-user-glib: use g_main_context_get_thread_default()Johannes Berg2020-02-271-1/+1
| | | | | | | | | | | | | | If we use NULL, we just get the main program default mainloop here. Using g_main_context_get_thread_default() has basically the same effect, but it lets us start different devices in different threads with different mainloops, which can be useful. Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com> Message-Id: <20200123081708.7817-4-johannes@sipsolutions.net> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* libvhost-user-glib: fix VugDev main fd cleanupJohannes Berg2020-02-273-7/+15
| | | | | | | | | | | | | | | | | | | | | | | If you try to make a device implementation that can handle multiple connections and allow disconnections (which requires overriding the VHOST_USER_NONE handling), then glib will warn that we remove a src while it's still on the mainloop, and will poll() an FD that doesn't exist anymore. Fix this by making vug_source_new() require pairing with the new vug_source_destroy() so we can keep the GSource referenced in the meantime. Note that this requires calling the new API in vhost-user-input. vhost-user-gpu also uses vug_source_new(), but never seems to free the result at all, so I haven't changed anything there. Fixes: 8bb7ddb78a1c ("libvhost-user: add glib source helper") Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com> Message-Id: <20200123081708.7817-3-johannes@sipsolutions.net> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* libvhost-user: implement VHOST_USER_PROTOCOL_F_REPLY_ACKJohannes Berg2020-02-271-2/+10
| | | | | | | | | | | | | | | | This is really simple, since we know whether a response is already requested or not, so we can just send a (successful) response when there isn't one already. Given that, it's not all _that_ useful but the master can at least be sure the message was processed, and we can exercise more code paths using the example code. Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com> Message-Id: <20200123081708.7817-2-johannes@sipsolutions.net> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* contrib/rdmacm-mux: Remove superfluous semicolonPhilippe Mathieu-Daudé2020-02-181-1/+1
| | | | | | | | | | Fixes: a5d2f6f8773 Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> Acked-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: Juan Quintela <quintela@redhat.com> Message-Id: <20200218094402.26625-14-philmd@redhat.com> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
* libvhost-user: Fix some memtable remap casesDr. David Alan Gilbert2020-01-232-8/+28
| | | | | | | | | | | | | | | If a new setmemtable command comes in once the vhost threads are running, it will remap the guests address space and the threads will now be looking in the wrong place. Fortunately we're running this command under lock, so we can update the queue mappings so that threads will look in the new-right place. Note: This doesn't fix things that the threads might be doing without a lock (e.g. a readv/writev!) That's for another time. Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
* contrib/libvhost-user: Protect slave fd with mutexDr. David Alan Gilbert2020-01-232-4/+23
| | | | | | | | | | | In future patches we'll be performing commands on the slave-fd driven by commands on queues, since those queues will be driven by individual threads we need to make sure they don't attempt to use the slave-fd for multiple commands in parallel. Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
* Implement backend program convention command for vhost-user-blkMicky Yun Chan2020-01-051-45/+65
| | | | | | | | | | This patch is to add standard commands defined in docs/interop/vhost-user.rst For vhost-user-* program Signed-off-by: Micky Yun Chan (michiboo) <chanmickyyun@gmail.com> Message-Id: <20191209015331.5455-1-chanmickyyun@gmail.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* Merge remote-tracking branch 'remotes/kraxel/tags/vga-20191220-pull-request' ↵Peter Maydell2020-01-031-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | into staging vga: two little bugfixes. # gpg: Signature made Fri 20 Dec 2019 06:06:04 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/vga-20191220-pull-request: display/bochs-display: fix memory leak vhost-user-gpu: Drop trailing json comma Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
| * vhost-user-gpu: Drop trailing json commaCole Robinson2019-12-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Trailing comma is not valid json: $ cat contrib/vhost-user-gpu/50-qemu-gpu.json.in | jq parse error: Expected another key-value pair at line 5, column 1 Signed-off-by: Cole Robinson <crobinso@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Li Qiang <liq3ea@gmail.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-id: 7f5dd2ac9f3504e2699f23e69bc3d8051b729832.1568925097.git.crobinso@redhat.com Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* | vhost-user-scsi: fix printf format warningMarc-André Lureau2019-12-171-1/+1
|/ | | | | | | | | | Fixes: ../contrib/vhost-user-scsi/vhost-user-scsi.c:118:57: error: format specifies type 'unsigned char' but the argument has type 'int' [-Werror,-Wformat] g_warning("Unable to determine cdb len (0x%02hhX)", cdb[0] >> 5); Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* vhost-user-input: use free(elem) instead of g_free(elem)Stefan Hajnoczi2019-11-201-2/+2
| | | | | | | | | | | | The virtqueue element returned by vu_queue_pop() is allocated using malloc(3) by virtqueue_alloc_element(). Use the matching free(3) function instead of glib's g_free(). Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Message-Id: <20191119111626.112206-1-stefanha@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
* libvhost-user: Zero memory allocated for VuVirtqInflightDescXie Yongji2019-11-201-1/+1
| | | | | | | | | | | | | | | Use a zero-initialized VuVirtqInflightDesc struct to avoid that scan-build reports that vq->resubmit_list[0].counter may be garbage value in vu_check_queue_inflights(). Fixes: 5f9ff1eff ("libvhost-user: Support tracking inflight I/O in shared memory") Reported-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Xie Yongji <xieyongji@baidu.com> Message-Id: <20191119075759.4334-1-xieyongji@baidu.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>