summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* block: Add "file" output parameter to block status query functionsFam Zheng2019-11-2917-35/+66
| | | | | | | | | | | | | | | | | | The added parameter can be used to return the BDS pointer which the valid offset is referring to. Its value should be ignored unless BDRV_BLOCK_OFFSET_VALID in ret is set. Until block drivers fill in the right value, let's clear it explicitly right before calling .bdrv_get_block_status. The "bs->file" condition in bdrv_co_get_block_status is kept now to keep iotest case 102 passing, and will be fixed once all drivers return the right file pointer. Signed-off-by: Fam Zheng <famz@redhat.com> Message-id: 1453780743-16806-2-git-send-email-famz@redhat.com Reviewed-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Max Reitz <mreitz@redhat.com>
* block: acquire in bdrv_query_image_infoPaolo Bonzini2019-11-291-2/+7
| | | | | | | | | | NFS calls aio_poll inside bdrv_get_allocated_size. This requires acquiring the AioContext. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Message-id: 1450867706-19860-1-git-send-email-pbonzini@redhat.com Reviewed-by: Fam Zheng <famz@redhat.com> Signed-off-by: Max Reitz <mreitz@redhat.com>
* iotests: Add test for block jobs and BDS ejectionMax Reitz2019-11-293-0/+246
| | | | | | | Suggested-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* iotests: Add test for multiple BB on BDS treeMax Reitz2019-11-293-0/+101
| | | | | | | | | | | | | | | This adds a test for having multiple BlockBackends in one BDS tree. In this case, there is one BB for the protocol BDS and one BB for the format BDS in a simple two-BDS tree (with the protocol BDS and BB added first). When bdrv_close_all() is executed, no cached data from any BDS should be lost; the protocol BDS may not be closed until the format BDS is closed. Otherwise, metadata updates may be lost. Signed-off-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* block: Rewrite bdrv_close_all()Max Reitz2019-11-291-8/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | This patch rewrites bdrv_close_all(): Until now, all root BDSs have been force-closed. This is bad because it can lead to cached data not being flushed to disk. Instead, try to make all reference holders relinquish their reference voluntarily: 1. All BlockBackend users are handled by making all BBs simply eject their BDS tree. Since a BDS can never be on top of a BB, this will not cause any of the issues as seen with the force-closing of BDSs. The references will be relinquished and any further access to the BB will fail gracefully. 2. All BDSs which are owned by the monitor itself (because they do not have a BB) are relinquished next. 3. Besides BBs and the monitor, block jobs and other BDSs are the only things left that can hold a reference to BDSs. After every remaining block job has been canceled, there should not be any BDSs left (and the loop added here will always terminate (as long as NDEBUG is not defined), because either all_bdrv_states will be empty or there will not be any block job left to cancel, failing the assertion). Signed-off-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* block: Add blk_remove_all_bs()Max Reitz2019-11-292-0/+16
| | | | | | | | | | | | | | | When bdrv_close_all() is called, instead of force-closing all root BlockDriverStates, it is better to just drop the reference from all BlockBackends and let them be closed automatically. This prevents BDS from getting closed that are still referenced by other BDS, which may result in loss of cached data. This patch adds a function for doing that, but does not yet incorporate it in bdrv_close_all(). Signed-off-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* blockdev: Keep track of monitor-owned BDSMax Reitz2019-11-294-1/+37
| | | | | | | | As a side effect, we can now make x-blockdev-del's check whether a BDS is actually owned by the monitor explicit. Signed-off-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* block: Add list of all BlockDriverStatesMax Reitz2019-11-292-0/+9
| | | | | | | | | | | We need this list so that bdrv_close_all() can keep track of which BDSs are still open after having removed the BDSs from all of the BBs and having released all monitor BDS references. Signed-off-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Fam Zheng <famz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* block: Make bdrv_close() staticMax Reitz2019-11-292-2/+3
| | | | | | | | | | | | | | There are no users of bdrv_close() left, except for one of bdrv_open()'s failure paths, bdrv_close_all() and bdrv_delete(), and that is good. Make bdrv_close() static so nobody makes the mistake of directly using bdrv_close() again. Signed-off-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Alberto Garcia <berto@igalia.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Fam Zheng <famz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* blockdev: Use blk_remove_bs() in do_drive_del()Max Reitz2019-11-291-1/+1
| | | | | | | Signed-off-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Fam Zheng <famz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* block: Use blk_remove_bs() in blk_delete()Max Reitz2019-11-291-4/+3
| | | | | | | Signed-off-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Fam Zheng <famz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* block: Remove BDS close notifierMax Reitz2019-11-295-19/+0
| | | | | | | | | It is unused now, so we can remove it. Signed-off-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Fam Zheng <famz@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* nbd: Switch from close to eject notifierMax Reitz2019-11-292-35/+18
| | | | | | | | | | | The NBD code uses the BDS close notifier to determine when a medium is ejected. However, now it should use the BB's BDS removal notifier for that instead of the BDS's close notifier. Signed-off-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Fam Zheng <famz@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* virtio-scsi: Catch BDS-BB removal/insertionMax Reitz2019-11-292-0/+65
| | | | | | | | Make use of the BDS-BB removal and insertion notifiers to remove or set up, respectively, virtio-scsi's op blockers. Signed-off-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* virtio-blk: Functions for op blocker managementMax Reitz2019-11-291-18/+59
| | | | | | | | | | | Put the code for setting up and removing op blockers into an own function, respectively. Then, we can invoke those functions whenever a BDS is removed from an virtio-blk BB or inserted into it. Signed-off-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Fam Zheng <famz@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* block: Add BB-BDS remove/insert notifiersMax Reitz2019-11-292-0/+22
| | | | | | | | | | | | | | | | | bdrv_close() no longer signifies ejection of a medium, this is now done by removing the BDS from the BB. Therefore, we want to have a notifier for that in the BB instead of a close notifier in the BDS. The former is added now, the latter is removed later. Symmetrically, another notifier list is added that is invoked whenever a BDS is inserted. We will need that for virtio-blk and virtio-scsi, which can then remove their op blockers on BDS ejection and set them up on insertion. Signed-off-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Fam Zheng <famz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* iotests: Add test for eject under NBD serverMax Reitz2019-11-293-0/+109
| | | | | | | | | | This patch adds a test for ejecting the BlockBackend an NBD server is connected to (the NBD server is supposed to stop). Signed-off-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Fam Zheng <famz@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* block: Release named dirty bitmaps in bdrv_close()Max Reitz2019-11-291-8/+31
| | | | | | | | | | | | | bdrv_delete() is not very happy about deleting BlockDriverStates with dirty bitmaps still attached to them. In the past, we got around that very easily by relying on bdrv_close_all() bypassing bdrv_delete(), and bdrv_close() simply ignoring that condition. We should fix that by releasing all named dirty bitmaps in bdrv_close() (there should not be any unnamed bitmaps left) and moving the assertion from bdrv_delete() there. Signed-off-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* block: Remove unused struct definition BlockFinishDataFam Zheng2019-11-291-8/+0
| | | | | | | | | Unused since 94db6d2d3. Signed-off-by: Fam Zheng <famz@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Max Reitz <mreitz@redhat.com>
* iotests: Add test for a nonexistent NBD exportMax Reitz2019-11-293-0/+81
| | | | | | | | | Trying to connect to a nonexistent NBD export should not crash the server. Signed-off-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* iotests: Make redirecting qemu's stderr optionalMax Reitz2019-11-291-2/+13
| | | | | | | | | | | | | | | Redirecting qemu's stderr to stdout makes working with the stderr output difficult due to the other file descriptor magic performed in _launch_qemu ("ambiguous redirect"). Add an option which specifies whether stderr should be redirected to stdout or not (allowing for other modes to be added in the future). Signed-off-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: John Snow <jsnow@redhat.com> Reviewed-by: Fam Zheng <famz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* iotests: Make _filter_nbd support more URL typesMax Reitz2019-11-291-1/+2
| | | | | | | | | | | | | This function should support URLs of the "nbd://" format (without swallowing the export name), and for "nbd:///" URLs it should replace "?socket=$TEST_DIR" by "?socket=TEST_DIR" because putting the Unix socket files into the test directory makes sense. Signed-off-by: Max Reitz <mreitz@redhat.com> Reviewed-by: John Snow <jsnow@redhat.com> Reviewed-by: Fam Zheng <famz@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* iotests: Make _filter_nbd drop log linesMax Reitz2019-11-292-11/+1
| | | | | | | | | The NBD log lines ("/your/source/dir/nbd/xyz.c:function():line: error") should not be converted to empty lines but removed altogether. Signed-off-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* iotests: Move _filter_nbd into common.filterMax Reitz2019-11-292-12/+12
| | | | | | | | | _filter_nbd can be useful for other NBD tests, too, therefore it should reside in common.filter. Signed-off-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* iotests: Change coding style of _filter_nbd in 083Max Reitz2019-11-291-9/+10
| | | | | | | | | | | | | In order to be able to move _filter_nbd to common.filter in the next patch, its coding style needs to be adapted to that of common.filter. That means, we have to convert tabs to four spaces, adjust the alignment of the last line (done with spaces already, assuming one tab equals eight spaces), fix the line length of the comment, and add a line break before the opening brace. Signed-off-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* iotests: Rename filter_nbd to _filter_nbd in 083Max Reitz2019-11-291-2/+2
| | | | | | | | | | | | | | | | | | | In the patch after the next, this function is moved to common.filter. Therefore, its name should be preceded by an underscore to signify its global availability. To keep the code motion patch clean, we cannot rename it in the same patch, so we need to choose some order of renaming vs. motion. It is better to keep a supposedly global function used by only a single test in that test than to keep a supposedly local function in a common* file and use it from a test, so we should rename the function before moving it. Signed-off-by: Max Reitz <mreitz@redhat.com> Reviewed-by: John Snow <jsnow@redhat.com> Reviewed-by: Fam Zheng <famz@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* nbd: client_close on error in nbd_co_client_startMax Reitz2019-11-291-2/+1
| | | | | | | | | | | Use client_close() if an error in nbd_co_client_start() occurs instead of manually inlining parts of it. This fixes an assertion error on the server side if nbd_negotiate() fails. Signed-off-by: Max Reitz <mreitz@redhat.com> Acked-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* iotests: Limit supported formats for 118Max Reitz2019-11-291-1/+3
| | | | | | | | | Image formats used in test 118 need to support image creation. Reported-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* vmdk: Fix converting to streamOptimizedFam Zheng2019-11-291-1/+5
| | | | | | | | | | | Commit d62d9dc4b8 lifted streamOptimized images's version to 3, but we now refuse to open version 3 images read-write. We need to make streamOptimized an exception to allow converting to it. This fixes the accidentally broken iotests case 059 for the same reason. Signed-off-by: Fam Zheng <famz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Max Reitz <mreitz@redhat.com>
* block/qapi: Emit tray_open only if there is a trayMax Reitz2019-11-293-7/+3
| | | | | | | Signed-off-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Alberto Garcia <berto@igalia.com> Message-id: 1454096953-31773-5-git-send-email-mreitz@redhat.com
* Revert "hw/block/fdc: Implement tray status"Max Reitz2019-11-293-99/+43
| | | | | | | | | | | | | | | | | | This reverts the changes that commit 2e1280e8ff95b3145bc6262accc9d447718e5318 applied to hw/block/fdc.c; also, an additional case of drv->media_inserted use has crept in since, which is replaced by a call to blk_is_inserted(). That commit changed tests/fdc-test.c, too, because after it, one less TRAY_MOVED event would be emitted when executing 'change' on an empty drive. However, now, no TRAY_MOVED events will be emitted at all, and the tray_open status returned by query-block will always be false, necessitating (different) changes to tests/fdc-test.c and iotest 118, which is why this patch is not a pure revert of said commit. Signed-off-by: Max Reitz <mreitz@redhat.com> Message-id: 1454096953-31773-4-git-send-email-mreitz@redhat.com Reviewed-by: Eric Blake <eblake@redhat.com>
* blockdev: Fix 'change' for slot devicesMax Reitz2019-11-292-4/+30
| | | | | | | | | | | | | | | | | | | 'change' and related operations did not work when used on guest devices featuring removable media but no actual tray, because blk_dev_is_tray_open() always returned false for them and the blockdev-{insert,remove}-medium commands required it to return true. Fix this by making blockdev-{insert,remove}-medium work on tray-less devices. Also, blockdev-{open,close}-tray are now explicitly no-ops when invoked on such devices, and blk_dev_change_media_cb() is instead called by blockdev-{insert,remove}-medium (for tray-less devices only). Reported-by: Peter Maydell <peter.maydell@linaro.org> Cc: qemu-stable <qemu-stable@nongnu.org> Signed-off-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Alberto Garcia <berto@igalia.com> Message-id: 1454096953-31773-3-git-send-email-mreitz@redhat.com Reviewed-by: Eric Blake <eblake@redhat.com>
* block: Add blk_dev_has_tray()Max Reitz2019-11-292-1/+10
| | | | | | | | | | | | | Pull out the check whether a block device has a tray from blk_dev_is_tray_open() into its own function so both attributes (whether there is a tray vs. whether that tray is open) can be queried independently. Cc: qemu-stable <qemu-stable@nongnu.org> Signed-off-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Alberto Garcia <berto@igalia.com> Message-id: 1454096953-31773-2-git-send-email-mreitz@redhat.com
* ehci: update irq on resetGerd Hoffmann2019-11-291-0/+1
| | | | | | | | | | | | | | After clearing the status register we also have to update the irq line status. Otherwise a irq which happends to be pending at reset time causes a interrupt storm. And the guest can't stop as the status register doesn't indicate any pending interrupt. Both NetBSD and FreeBSD hang on shutdown because of that. Cc: qemu-stable@nongnu.org Reported-by: Andrey Korolyov <andrey@xdel.ru> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Message-id: 1453203884-4125-1-git-send-email-kraxel@redhat.com
* usb: check page select value while processing iTDPrasad J Pandit2019-11-291-4/+6
| | | | | | | | | | | While processing isochronous transfer descriptors(iTD), the page select(PG) field value could lead to an OOB read access. Add check to avoid it. Reported-by: Qinghao Tang <luodalongde@gmail.com> Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org> Message-id: 1453233406-12165-1-git-send-email-ppandit@redhat.com Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* sdl: shorten the GUI refresh interval when mouse or keyboard is activeJindřich Makovička2019-11-293-0/+46
| | | | | Signed-off-by: Jindřich Makovička <makovick@gmail.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* gtk: use qemu_chr_alloc() to allocate CharDriverStateDaniel P. Berrange2019-11-291-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The gd_vc_handler() callback is using g_malloc0() to allocate the CharDriverState struct. As a result the logfd field is getting initialized to 0, instead of -1 when no logfile is requested. The result is that when running $ qemu-system-i386 -nodefaults -chardev vc,id=mon0 -mon chardev=mon0 qemu duplicates all monitor output to stdout as well as the GTK window. Not using qemu_chr_alloc() was already a bug, but harmless until this commit commit d0d7708ba29cbcc343364a46bff981e0ff88366f Author: Daniel P. Berrange <berrange@redhat.com> Date: Mon Jan 11 12:44:41 2016 +0000 qemu-char: add logfile facility to all chardev backends which exposed the problem as a behaviour regression Reported-by: Hervé Poussineau <hpoussin@reactos.org> Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Tested-by: Hervé Poussineau <hpoussin@reactos.org> Message-id: 1453377386-10190-1-git-send-email-berrange@redhat.com Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* crypto: ensure qcrypto_hash_digest_len is always definedDaniel P. Berrange2019-11-291-13/+17
| | | | | | | | | The qcrypto_hash_digest_len method was accidentally inside a CONFIG_GNUTLS_HASH block, even though it doesn't depend on gnutls. Re-arrange it to be unconditionally defined. Reviewed-by: Fam Zheng <famz@redhat.com> Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* audio: Clean up includesPeter Maydell2019-11-2932-8/+32
| | | | | | | | | | | Clean up includes so that osdep.h is included first and headers which it implies are not included manually. This commit was created with scripts/clean-includes. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Message-id: 1453138432-8324-1-git-send-email-peter.maydell@linaro.org Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* char: remove qemu_chr_open_eventfdMarc-André Lureau2019-11-292-16/+0
| | | | | | | | | Broken since d0d7708ba29cbc, since the backend is NULL. And now no longer needed by ivshmem. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com>
* ivshmem: use a single eventfd callback, get rid of CharDriverMarc-André Lureau2019-11-291-37/+18
| | | | | | | | | | | | | | | | | | Simplify the interrupt handling by having a single callback on irq&msi cases. Remove usage of CharDriver, replace it with qemu_set_fd_handler(). Use event_notifier_test_and_clear() to read the eventfd. Before this patch, ivshmem writes the first byte received to s->intrstatus. But ivshmem_device_spec.txt says "The status register is set to 1 when an interrupt occurs." Fortunately, the byte usually comes from another ivshmem device, and those always write 1. After this commit, follows the specification, set to 1 when an interrupt occurs. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Acked-by: Markus Armbruster <armbru@redhat.com>
* ivshmem: generalize ivshmem_setup_interruptsMarc-André Lureau2019-11-291-11/+12
| | | | | | | | Call ivshmem_setup_interrupts() with or without MSI, always allocate msi_vectors that is going to be used in all case in the following patch. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com>
* ivshmem-test: test both msi & irq casesMarc-André Lureau2019-11-291-16/+37
| | | | | | | | Recent commit 660c97ee introduced a regression in irq case, make sure this code path is also tested. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com>
* libqos: remove some leaksMarc-André Lureau2019-11-291-0/+2
| | | | | | | qpci_device_find() returns allocated data, don't leak it. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com>
* ivshmem-test: leak fixesMarc-André Lureau2019-11-291-11/+17
| | | | | | | | Add a cleanup_vm() function to free QPCIDevice & QPCIBus when cleaning up the IVState. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com>
* ivshmem: remove redundant assignment, fix crash with msi=offMarc-André Lureau2019-11-291-3/+0
| | | | | | | | Fix crash when msi=false introduced in 660c97ee (msi_vectors is NULL in this case) Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com>
* ivshmem: no need for opaque argumentMarc-André Lureau2019-11-291-2/+2
| | | | | Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com>
* nvme: generate OpenFirmware device path in the "bootorder" fw_cfg fileLaszlo Ersek2019-11-291-36/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Background on QEMU boot indices ------------------------------- Normally, the "bootindex" property is configured for bootable devices with: DEVICE_instance_init() device_add_bootindex_property(..., "bootindex", ...) object_property_add(..., device_get_bootindex, device_set_bootindex, ...) and when the bootindex is set on the QEMU command line, with -device DEVICE,...,bootindex=N the setter that was configured above is invoked: device_set_bootindex() /* parse boot index */ visit_type_int32() /* verify unicity */ check_boot_index() /* store parsed boot index */ ... /* insert device path to boot order */ add_boot_device_path() In the last step, add_boot_device_path() ensures that an OpenFirmware device path will show up in the "bootorder" fw_cfg file, at a position corresponding to the device's boot index. Thus guest firmware (SeaBIOS and OVMF) can try to boot off the device with the right priority. NVMe boot index --------------- In QEMU commit 33739c712982, nvma: ide: add bootindex to qom property the following generic setters / getters: - device_set_bootindex() - device_get_bootindex() were open-coded for NVMe, under the names - nvme_set_bootindex() - nvme_get_bootindex() Plus nvme_instance_init() was added to configure the "bootindex" property manually, designating the open-coded getter & setter, rather than calling device_add_bootindex_property(). Crucially, nvme_set_bootindex() avoided the final add_boot_device_path() call. This fact is spelled out in the message of commit 33739c712982, and it was presumably the entire reason for all of the code duplication. Now, Vladislav filed an RFE for OVMF <https://github.com/tianocore/edk2/issues/48>; OVMF should boot off NVMe devices. It is simple to build edk2's existent NvmExpressDxe driver into OVMF, but the boot order matching logic in OVMF can only handle NVMe if the "bootorder" fw_cfg file includes such devices. Therefore this patch converts the NVMe device model to device_set_bootindex() all the way. Device paths ------------ device_set_bootindex() accepts an optional parameter called "suffix". When present, it is expected to take the form of an OpenFirmware device path node, and it gets appended as last node to the otherwise auto-generated OFW path. For NVMe, the auto-generated part is /pci@i0cf8/pci8086,5845@6[,1] ^ ^ ^ ^ | | PCI slot and (present when nonzero) | | function of the NVMe controller, both hex | "driver name" component, built from PCI vendor & device IDs PCI root at system bus port, PIO to which here we append the suffix /namespace@1,0 ^ ^ | big endian (MSB at lowest address) numeric interpretation | of the 64-bit IEEE Extended Unique Identifier, aka EUI-64, | hex 32-bit NVMe namespace identifier, aka NSID, hex resulting in the OFW device path /pci@i0cf8/pci8086,5845@6[,1]/namespace@1,0 The reason for including the NSID and the EUI-64 is that an NVMe device can in theory produce several different namespaces (distinguished by NSID). Additionally, each of those may (optionally) have an EUI-64 value. For now, QEMU only provides namespace 1. Furthermore, QEMU doesn't even represent the EUI-64 as a standalone field; it is embedded (and left unused) inside the "NvmeIdNs.res30" array, at the last eight bytes. (Which is fine, since EUI-64 can be left zero-filled if unsupported by the device.) Based on the above, we set the "unit address" part of the last ("namespace") node to fixed "1,0". OVMF will then map the above OFW device path to the following UEFI device path fragment, for boot order processing: PciRoot(0x0)/Pci(0x6,0x1)/NVMe(0x1,00-00-00-00-00-00-00-00) ^ ^ ^ ^ ^ ^ | | | | | octets of the EUI-64 in address order | | | | NSID | | | NVMe namespace messaging device path node | PCI slot and function PCI root bridge Cc: Keith Busch <keith.busch@intel.com> (supporter:nvme) Cc: Kevin Wolf <kwolf@redhat.com> (supporter:Block layer core) Cc: qemu-block@nongnu.org (open list:nvme) Cc: Gonglei <arei.gonglei@huawei.com> Cc: Vladislav Vovchenko <vladislav.vovchenko@sk.com> Cc: Feng Tian <feng.tian@intel.com> Cc: Gerd Hoffmann <kraxel@redhat.com> Cc: Kevin O'Connor <kevin@koconnor.net> Signed-off-by: Laszlo Ersek <lersek@redhat.com> Acked-by: Gonglei <arei.gonglei@huawei.com> Acked-by: Keith Busch <keith.busch@intel.com> Tested-by: Vladislav Vovchenko <vladislav.vovchenko@sk.com> Message-id: 1453850483-27511-1-git-send-email-lersek@redhat.com Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* crypto: register properties against the class instead of objectDaniel P. Berrange2019-11-294-72/+66
| | | | | | | This converts the tlscredsx509, tlscredsanon and secret objects to register their properties against the class rather than object. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* crypto: fix description of @errp parameter initializationDaniel P. Berrange2019-11-293-14/+14
| | | | | | | The "Error **errp" parameters must be NULL initialized not uninitialized. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
OpenPOWER on IntegriCloud