summaryrefslogtreecommitdiff
path: root/include
AgeCommit message (Collapse)AuthorFilesLines
2014-07-01Merge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into ↵Peter Maydell4-24/+8
staging Block pull request # gpg: Signature made Tue 01 Jul 2014 09:47:15 BST using RSA key ID 81AB73C8 # gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>" # gpg: aka "Stefan Hajnoczi <stefanha@gmail.com>" * remotes/stefanha/tags/block-pull-request: (23 commits) block: add backing-file option to block-stream block: extend block-commit to accept a string for the backing file block: add helper function to determine if a BDS is in a chain block: add QAPI command to allow live backing file change qapi: Change back sector-count to sectors-count in quorum QAPI events. block/cow: Avoid use of uninitialized cow_bs in error path block: simplify bdrv_find_base() and bdrv_find_overlay() block: make 'top' argument to block-commit optional iotests: Add more tests to quick group iotests: Add qemu tests to quick group iotests: Simplify qemu-iotests-quick.sh qemu-img create: add 'nocow' option virtio-blk: remove need for explicit x-data-plane=on option qdev: drop iothread property type virtio-blk: replace x-iothread with iothread link property virtio-blk: move qdev properties into virtio-blk.c virtio: fix virtio-blk child refcount in transports virtio-blk: drop virtio_blk_set_conf() virtio-blk: use aliases instead of duplicate qdev properties qdev: add qdev_alias_all_properties() ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2014-07-01Merge remote-tracking branch 'remotes/bonzini/memory' into stagingPeter Maydell3-7/+57
* remotes/bonzini/memory: qdev: correctly send DEVICE_DELETED for recursively-deleted devices memory: do not give a name to the internal exec.c regions memory: MemoryRegion: Add size property memory: MemoryRegion: Add may-overlap and priority props memory: MemoryRegion: Add container and addr props memory: MemoryRegion: replace owner field with QOM parent memory: MemoryRegion: QOMify memory: MemoryRegion: use /machine as default owner libqtest: escape strings in QMP commands, fix leak qom: object: Ignore refs/unrefs of NULL qom: object: remove parent pointer when unparenting mc146818rtc: add "rtc-time" link to "/machine/rtc" qom: allow creating an alias of a child<> property qom: add a generic mechanism to resolve paths qom: add object_property_add_alias() Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2014-07-01block: extend block-commit to accept a string for the backing fileJeff Cody2-2/+4
On some image chains, QEMU may not always be able to resolve the filenames properly, when updating the backing file of an image after a block commit. For instance, certain relative pathnames may fail, or drives may have been specified originally by file descriptor (e.g. /dev/fd/???), or a relative protocol pathname may have been used. In these instances, QEMU may lack the information to be able to make the correct choice, but the user or management layer most likely does have that knowledge. With this extension to the block-commit api, the user is able to change the backing file of the overlay image as part of the block-commit operation. This allows the change to be 'safe', in the sense that if the attempt to write the overlay image metadata fails, then the block-commit operation returns failure, without disrupting the guest. If the commit top is the active layer, then specifying the backing file string will be treated as an error (there is no overlay image to modify in that case). If a backing file string is not specified in the command, the backing file string to use is determined in the same manner as it was previously. Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Jeff Cody <jcody@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2014-07-01block: add helper function to determine if a BDS is in a chainJeff Cody1-0/+1
This is a small helper function, to determine if 'base' is in the chain of BlockDriverState 'top'. It returns true if it is in the chain, and false otherwise. If either argument is NULL, it will also return false. Reviewed-by: Benoit Canet <benoit@irqsave.net> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Jeff Cody <jcody@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2014-07-01qdev: correctly send DEVICE_DELETED for recursively-deleted devicesPaolo Bonzini1-0/+1
When a device is unparented (i.e. made completely hidden from management) we want to send a DEVICE_DELETED event only if the device actually was realized. This avoids raising DEVICE_DELETED events when device_add fails. However, this does not work right for recursively-deleted devices: the whole tree is _first_ unrealized, _then_ unparented. Then device_unparent sees realized==false and fails to trigger the event. The solution is simply to move have_realized into the DeviceState struct. If device_add fails, we never set the new field to true and DEVICE_DELETED is not sent. Fixes qemu-iotests testcase 067 (broken by commit 5942a19, though that commit in turn fixed a possible segfault in the same test). Reported-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2014-07-01memory: MemoryRegion: Add may-overlap and priority propsPeter Crosthwaite1-1/+1
QOM propertyify the .may-overlap and .priority fields. The setters will re-add the memory as a subregion if needed (i.e. the values change when the memory region is already contained). Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com> [Remove setters. - Paolo] Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2014-07-01memory: MemoryRegion: replace owner field with QOM parentPaolo Bonzini1-1/+0
The two are now the same. Reviewed-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2014-07-01memory: MemoryRegion: QOMifyPeter Crosthwaite1-0/+6
QOMify memory regions as an Object. The former init() and destroy() routines become instance_init() and instance_finalize() resp. memory_region_init() is re-implemented to be: object_initialize() + set fields memory_region_destroy() is re-implemented to call unparent(). Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com> [Add newly-created MR as child, unparent on destruction. - Paolo] Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2014-07-01qom: add a generic mechanism to resolve pathsPaolo Bonzini1-5/+29
It may be desirable to have custom link<> properties that do more than just store an object. Even the addition of a "check" function is not enough if setting the link has side effects or if a non-standard reference counting is preferrable. Avoid the assumption that the opaque field of a link<> is a LinkProperty struct, by adding a generic "resolve" callback to ObjectProperty. This fixes aliases of link properties. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2014-07-01qemu-img create: add 'nocow' optionChunyan Liu1-0/+1
Add 'nocow' option so that users could have a chance to set NOCOW flag to newly created files. It's useful on btrfs file system to enhance performance. Btrfs has low performance when hosting VM images, even more when the guest in those VM are also using btrfs as file system. One way to mitigate this bad performance is to turn off COW attributes on VM files. Generally, there are two ways to turn off NOCOW on btrfs: a) by mounting fs with nodatacow, then all newly created files will be NOCOW. b) per file. Add the NOCOW file attribute. It could only be done to empty or new files. This patch tries the second way, according to the option, it could add NOCOW per file. For most block drivers, since the create file step is in raw-posix.c, so we can do setting NOCOW flag ioctl in raw-posix.c only. But there are some exceptions, like block/vpc.c and block/vdi.c, they are creating file by calling qemu_open directly. For them, do the same setting NOCOW flag ioctl work in them separately. [Fixed up 082.out due to the new 'nocow' creation option --Stefan] Signed-off-by: Chunyan Liu <cyliu@suse.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2014-07-01qom: add object_property_add_alias()Stefan Hajnoczi1-0/+20
Sometimes an object needs to present a property which is actually on another object, or it needs to provide an alias name for an existing property. Examples: a.foo -> b.foo a.old_name -> a.new_name The new object_property_add_alias() API allows objects to alias a property on the same object or another object. The source and target names can be different. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
2014-07-01qdev: drop iothread property typeStefan Hajnoczi1-3/+0
The iothread property type is no longer used and can be removed. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2014-07-01virtio-blk: move qdev properties into virtio-blk.cStefan Hajnoczi1-23/+0
There is no need to make DEFINE_VIRTIO_BLK_PROPERTIES() public. Inline it into virtio-blk.c so it cannot be used by mistake from other source files. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
2014-07-01virtio-blk: drop virtio_blk_set_conf()Stefan Hajnoczi1-2/+0
This function is no longer used since parent objects now use child aliases to set the VirtIOBlkConf directly. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
2014-07-01qdev: add qdev_alias_all_properties()Stefan Hajnoczi1-0/+2
The qdev_alias_all_properties() function creates QOM alias properties for each qdev property on a DeviceState. This is useful for parent objects that wish to forward property accesses to their children. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
2014-07-01virtio-blk: move x-data-plane qdev property to virtio-blk.hStefan Hajnoczi1-0/+8
Move the x-data-plane property. Originally it was outside since not every transport may wish to support dataplane. But that makes little sense when we have a dedicated CONFIG_VIRTIO_BLK_DATA_PLANE ifdef already. This move makes it easier to switch to property aliases in the next patch. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
2014-07-01virtio-blk: avoid qdev property definition duplicationStefan Hajnoczi1-8/+6
It becomes unwiedly to duplicate all virtio-blk qdev property definitions due to an #ifdef. The C preprocessor syntax makes it a little hard to resolve this cleanly but we can extract the #ifdef and call a macro it defines later. Avoiding duplication is important since it will only get worse when we move the x-data-plane qdev property here too. We'd have a combinatorial explosion since x-data-plane has its own #ifdef. Suggested-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
2014-07-01irq: Slim conversion of qemu_irq to QOMAndreas Färber1-0/+2
As a prequel to any big Pin refactoring plans, do an in-place conversion of qemu_irq to an Object, so that we can reference it in link<> properties. Signed-off-by: Andreas Färber <afaerber@suse.de> [ PC Changes: * Removed array-alloctor ref counting logic (limit changes just to * single IRQ allocator) * Removed WIP marking from subject line ] Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com> Acked-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
2014-07-01irq: Allocate IRQs individuallyPeter Crosthwaite1-1/+1
Allocate each IRQ individually on array allocations. This prepares for QOMification of IRQs, where pointers to individual IRQs may be taken and handed around for usage as QOM Links. The g_renew() scheme used here is too fragile and would break all existing links should an IRQ list be extended. We now have to pass the IRQ count to qemu_free_irqs(). We have so few call sites however, so this change is reasonably trivial. Cc: agarcia@igalia.com Cc: mst@redhat.com Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Acked-by: Alberto Garcia <agarcia@igalia.com> Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
2014-06-30Merge remote-tracking branch 'remotes/bonzini/nbd-next' into stagingPeter Maydell1-0/+12
* remotes/bonzini/nbd-next: nbd: Handle NBD_OPT_LIST option. nbd: Handle fixed new-style clients. nbd: Shutdown socket before closing. nbd: Don't validate from and len in NBD_CMD_DISC. nbd: Don't export a block device with no medium. Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2014-06-30nbd: Handle NBD_OPT_LIST option.Hani Benhabiles1-0/+3
Signed-off-by: Hani Benhabiles <kroosec@gmail.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2014-06-30nbd: Handle fixed new-style clients.Hani Benhabiles1-0/+9
When this flag is set, the server tells the client that it can send another option if the server received a request with an option that it doesn't understand instead of directly closing the connection. Also add link to the most up-to-date documentation. Signed-off-by: Hani Benhabiles <kroosec@gmail.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2014-06-29virtio: memory accessors for endian-ambivalent targetsGreg Kurz1-0/+170
This is the virtio-access.h header file taken from Rusty's "endian-ambivalent targets using legacy virtio" patch. It introduces helpers that should be used when accessing vring data or by drivers for data that contains headers. The virtio config space is also target endian, but the current code already handles that with the virtio_is_big_endian() helper. There is no obvious benefit at using the virtio accessors in this case. Now we have two distinct paths: a fast inline one for fixed endian targets, and a slow out-of-line one for targets that define the new TARGET_IS_BIENDIAN macro. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> [ relicensed virtio-access.h to GPLv2+ on Rusty's request, pass &address_space_memory to physical memory accessors, per-device endianness, virtio tswap16 and tswap64 helpers, faspath for fixed endian targets, Greg Kurz <gkurz@linux.vnet.ibm.com> ] Cc: Cédric Le Goater <clg@fr.ibm.com> Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com> Reviewed-by: Alexander Graf <agraf@suse.de> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2014-06-29virtio: add endian-ambivalent support to VirtIODeviceGreg Kurz1-3/+10
Some CPU families can dynamically change their endianness. This means we can have little endian ppc or big endian arm guests for example. This has an impact on legacy virtio data structures since they are target endian. We hence introduce a new property to track the endianness of each virtio device. It is reasonnably assumed that endianness won't change while the device is in use : we hence capture the device endianness when it gets reset. We migrate this property in a subsection, after the device descriptor. This means the load code must not rely on it until it is restored. As a consequence, the vring sanity checks had to be moved after the call to vmstate_load_state(). We enforce paranoia by poisoning the property at the begining of virtio_load(). Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2014-06-29cpu: introduce CPUClass::virtio_is_big_endian()Greg Kurz1-0/+1
If we want to support targets that can change endianness (modern PPC and ARM for the moment), we need to add a per-CPU class method to be called from the virtio code. The virtio_ prefix in the name is a hint for people to avoid misusage (aka. anywhere but from the virtio code). The default behaviour is to return the compile-time default target endianness. Suggested-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2014-06-29exec: introduce target_words_bigendian() helperGreg Kurz1-0/+6
We currently have a virtio_is_big_endian() helper that provides the target endianness to the virtio code. As of today, the helper returns a fixed compile-time value. Of course, this will have to change if we want to support target endianness changes at run-time. Let's move the TARGET_WORDS_BIGENDIAN bits out to a new helper and have virtio_is_big_endian() implemented on top of it. This patch doesn't change any functionality. Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2014-06-29virtio: introduce device specific migration callsGreg Kurz1-1/+3
In order to migrate virtio subsections, they should be streamed after the device itself. We need the device specific code to be called from the common migration code to achieve this. This patch introduces load and save methods for this purpose. Suggested-by: Andreas Färber <afaerber@suse.de> Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com> Reviewed-by: Alexander Graf <agraf@suse.de> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2014-06-29vhost-user: fix regions provied with VHOST_USER_SET_MEM_TABLE messageDamjan Marion1-0/+1
Old code was affected by memory gaps which resulted in buffer pointers pointing to address outside of the mapped regions. Here we are introducing following changes: - new function qemu_get_ram_block_host_ptr() returns host pointer to the ram block, it is needed to calculate offset of specific region in the host memory - new field mmap_offset is added to the VhostUserMemoryRegion. It contains offset where specific region starts in the mapped memory. As there is stil no wider adoption of vhost-user agreement was made that we will not bump version number due to this change - other fileds in VhostUserMemoryRegion struct are not changed, as they are all needed for usermode app implementation - region data is not taken from ram_list.blocks anymore, instead we use region data which is alredy calculated for use in vhost-net - Now multiple regions can have same FD and user applicaton can call mmap() multiple times with the same FD but with different offset (user needs to take care for offset page alignment) Signed-off-by: Damjan Marion <damarion@cisco.com> Acked-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Damjan Marion <damarion@cisco.com>
2014-06-29numa: Keep track of NUMA nodes present on the command-lineEduardo Habkost1-1/+6
Based on "enable sparse node numbering" patch from Nishanth Aravamudan, but without the code to actually support sparse node IDs. This just adds the code to keep track of present/non-present nodes on the command-line, without changing any behavior. Signed-off-by: Nishanth Aravamudan <nacc@linux.vnet.ibm.com> [Rename max_numa_node to max_numa_nodeid -Eduardo] [Initialize max_numa_nodeid to 0 -Eduardo] [Use MAX() macro when setting max_numa_nodeid -Eduardo] Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Hu Tao <hutao@cn.fujitsu.com> Reviewed-by: Eric Blake <eblake@redhat.com>
2014-06-29pc: Fix "prog_if" typo on PC_COMPAT_2_0Eduardo Habkost1-1/+1
The property name is "prog_if", not "prof_if". Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Reported-by: BALATON Zoltan <balaton@eik.bme.hu> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2014-06-29pc: Move q35 compat props to PC_COMPAT_*Eduardo Habkost1-37/+18
For each compat property on PC_Q35_COMPAT_*, there are only two possibilities: * If the device is never instantiated when using a machine other than pc-q35, then the compat property can be safely added to PC_COMPAT_*; * If the device can be instantiated when using a machine other than pc-q35, that means the other machines also need the compat property to be set. That means we don't need separate PC_Q35_COMPAT_* macros at all, today. The hpet.hpet-intcap case is interesting: piix and q35 do have something that emulates different defaults, but the machine-specific default is applied _after_ compat_props are applied, by simply checking if the property is zero (which is the real default on the hpet code). The hpet.hpet-intcap=0x4 compat property can (should?) be applied to piix too, because 0x4 was the default on both piix and q35 before the hpet-intcap property was introduced. Now, if one day we change the default HPET intcap on one of the PC machine-types again, we may want to introduce PC_{Q35,I440FX}_COMPAT macros. But while we don't need that, we can keep the code simple. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Cc: Liu Ping Fan <pingfank@linux.vnet.ibm.com> Cc: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2014-06-29Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into stagingPeter Maydell5-2/+42
Block patches for 2.1.0-rc0 # gpg: Signature made Fri 27 Jun 2014 19:50:32 BST using RSA key ID C88F2FD6 # gpg: Good signature from "Kevin Wolf <kwolf@redhat.com>" * remotes/kevin/tags/for-upstream: (47 commits) iotests: Fix 083 for out-of-tree builds iotests: Drop Python version from 065's Shebang iotests: Use $PYTHON for Python scripts iotests: Source common.env configure: Enable out-of-tree iotests iotests: Allow out-of-tree run block.c: Don't return success for bdrv_append_temp_snapshot() failure qemu-iotests: Add TestRepairQuorum to 041 to test drive-mirror node-name mode. block: Add replaces argument to drive-mirror blockjob: Fix recent BLOCK_JOB_ERROR regression blockjob: Fix recent BLOCK_JOB_READY regression virtio-blk: Rename complete_request_early to complete_request_vring virtio-blk: Unify {non-,}dataplane's request handlings virtio-blk: Schedule BH in the right context virtio-blk: Export request handling functions to dataplane virtio-blk: Make request completion function virtual block: acquire AioContext in qmp_query_blockstats() block: make bdrv_query_stats() static virtio-blk: Fix and clean up the in_sg and out_sg check virtio-blk: Fill in VirtIOBlockReq.out in dataplane code ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2014-06-29Merge remote-tracking branch 'remotes/qmp-unstable/queue/qmp' into stagingPeter Maydell1-1/+1
* remotes/qmp-unstable/queue/qmp: docs/qmp: Fix documentation of BLOCK_JOB_READY to match code char: report frontend open/closed state in 'query-chardev' virtio-serial: report frontend connection state via monitor qmp: add qmp-events.txt back qapi event: clean up in callers qapi script: clean up in scripts qapi: ignore generated event files qapi: move event defines Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2014-06-29Merge remote-tracking branch 'remotes/stefanha/tags/net-pull-request' into ↵Peter Maydell1-1/+1
staging Net patches # gpg: Signature made Fri 27 Jun 2014 14:10:57 BST using RSA key ID 81AB73C8 # gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>" # gpg: aka "Stefan Hajnoczi <stefanha@gmail.com>" * remotes/stefanha/tags/net-pull-request: hw/net/eepro100: Implement read-only bits in MDI registers net: move queue number into NICPeers net: L2TPv3 transport qemu-bridge-helper: Fix fd leak in main() Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2014-06-27block.c: Don't return success for bdrv_append_temp_snapshot() failureChen Gang1-1/+1
When failure occurs, 'ret' need be set, or may return 0 to indicate success. Previously, an error was set in errp, but 0 was returned anyway. So let bdrv_append_temp_snapshot() return an error code and use that for the bdrv_open() return value. Also, error_propagate() need be called only one time within a function. Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2014-06-27block: Add replaces argument to drive-mirrorBenoît Canet2-0/+7
drive-mirror will bdrv_swap the new BDS named node-name with the one pointed by replaces when the mirroring is finished. Signed-off-by: Benoit Canet <benoit@irqsave.net> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2014-06-27virtio-blk: Export request handling functions to dataplaneFam Zheng1-0/+9
So that dataplane can use virtio_blk_handle_request and virtio_submit_multiwrite. Signed-off-by: Fam Zheng <famz@redhat.com> Tested-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2014-06-27virtio-blk: Make request completion function virtualFam Zheng1-0/+3
virtio_blk_req_complete will call VirtIOBlock.complete_request() to push data and notify guest. No functional change. Later, this will allow dataplane to provide it's own (vring_) version. Signed-off-by: Fam Zheng <famz@redhat.com> Tested-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2014-06-27block: make bdrv_query_stats() staticStefan Hajnoczi1-1/+0
This function is only called from block/qapi.c. There is no need to keep it public. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Fam Zheng <famz@redhat.com> Tested-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2014-06-27virtio-blk: Convert VirtIOBlockReq.out to structrueFam Zheng1-1/+1
The virtio code currently assumes that the outhdr is in its own iovec. This is not guaranteed by the spec, so we should relax this assumption. Convert the VirtIOBlockReq.out field to structrue so that we can use iov_to_buf and then discard the header from the beginning of iovec. Suggested-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Fam Zheng <famz@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2014-06-27virtio-blk: Use VirtIOBlockReq.in to drop VirtIOBlockReq.inhdrFam Zheng1-4/+0
In current virtio spec, inhdr is a single byte, and is unlikely to change for both functionality and compatibility considerations. Non-dataplane uses .in, and we are on the way to converge them. So let's unify it to get cleaner code. Remove .inhdr and use .in. Signed-off-by: Fam Zheng <famz@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2014-06-27virtio-blk: Replace VirtIOBlockRequest with VirtIOBlockReqFam Zheng1-0/+4
Field "inhdr" is added temporarily for a more mechanical change, and will be dropped in the next commit. Signed-off-by: Fam Zheng <famz@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2014-06-27virtio-blk: Convert VirtIOBlockReq.elem to pointerFam Zheng1-1/+1
This will make converging with dataplane code easier. Add virtio_blk_free_request to handle the freeing of request internal fields. Signed-off-by: Fam Zheng <famz@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2014-06-27virtio-blk: Move VirtIOBlockReq to headerFam Zheng1-0/+11
For later reusing by dataplane code. Signed-off-by: Fam Zheng <famz@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2014-06-27qapi event: clean up in callersWenchao Xia1-1/+1
This patch improves docs and address small issues in event callers. Signed-off-by: Wenchao Xia <wenchaoqemu@gmail.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2014-06-27spapr_pci: Use XICS interrupt allocator and do not cache interrupts in PHBAlexey Kardashevskiy2-8/+14
Currently SPAPR PHB keeps track of all allocated MSI (here and below MSI stands for both MSI and MSIX) interrupt because XICS used to be unable to reuse interrupts. This is a problem for dynamic MSI reconfiguration which happens when guest reloads a driver or performs PCI hotplug. Another problem is that the existing implementation can enable MSI on 32 devices maximum (SPAPR_MSIX_MAX_DEVS=32) and there is no good reason for that. This makes use of new XICS ability to reuse interrupts. This reorganizes MSI information storage in sPAPRPHBState. Instead of static array of 32 descriptors (one per a PCI function), this patch adds a GHashTable when @config_addr is a key and (first_irq, num) pair is a value. GHashTable can dynamically grow and shrink so the initial limit of 32 devices is gone. This changes migration stream as @msi_table was a static array while new @msi_devs is a dynamic hash table. This adds temporary array which is used for migration, it is populated in "spapr_pci"::pre_save() callback and expanded into the hash table in post_load() callback. Since the destination side does not know the number of MSI-enabled devices in advance and cannot pre-allocate the temporary array to receive migration state, this makes use of new VMSTATE_STRUCT_VARRAY_ALLOC macro which allocates the array automatically. This resets the MSI configuration space when interrupts are released by the ibm,change-msi RTAS call. This fixed traces to be more informative. This changes vmstate_spapr_pci_msi name from "...lsi" to "...msi" which was incorrect by accident. As the internal representation changed, thus bumps migration version number. Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru> [agraf: drop g_malloc_n usage] Signed-off-by: Alexander Graf <agraf@suse.de>
2014-06-27vmstate: Add preallocation for migrating arrays (VMS_ALLOC flag)Alexey Kardashevskiy1-0/+11
There are few helpers already to support array migration. However they all require the destination side to preallocate arrays before migration which is not always possible due to unknown array size as it might be some sort of dynamic state. One of the examples is an array of MSIX-enabled devices in SPAPR PHB - this array may vary from 0 to 65536 entries and its size depends on guest's ability to enable MSIX or do PCI hotplug. This adds new VMSTATE_VARRAY_STRUCT_ALLOC macro which is pretty similar to VMSTATE_STRUCT_VARRAY_POINTER_INT32 but it can alloc memory for migratign array on the destination side. This defines VMS_ALLOC flag for a field. This changes vmstate_base_addr() to do the allocation when receiving migration. Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru> Reviewed-by: Juan Quintela <quintela@redhat.com> [agraf: drop g_malloc_n usage] Signed-off-by: Alexander Graf <agraf@suse.de>
2014-06-27xics: Implement xics_ics_free()Alexey Kardashevskiy1-0/+1
This implements interrupt release function so IRQs can be returned back to the pool for reuse in cases such as PCI hot plug. Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru> Signed-off-by: Alexander Graf <agraf@suse.de>
2014-06-27spapr: Move interrupt allocator to xicsAlexey Kardashevskiy2-10/+2
The current allocator returns IRQ numbers from a pool and does not support IRQs reuse in any form as it did not keep track of what it previously returned, it only keeps the last returned IRQ. Some use cases such as PCI hot(un)plug may require IRQ release and reallocation. This moves an allocator from SPAPR to XICS. This switches IRQ users to use new API. This uses LSI/MSI flags to know if interrupt is allocated. The interrupt release function will be posted as a separate patch. Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru> Signed-off-by: Alexander Graf <agraf@suse.de>
2014-06-27xics: Add flags for interruptsAlexey Kardashevskiy1-1/+5
The existing interrupt allocation scheme in SPAPR assumes that interrupts are allocated at the start time, continously and the config will not change. However, there are cases when this is not going to work such as: 1. migration - we will have to have an ability to choose interrupt numbers for devices in the command line and this will create gaps in interrupt space. 2. PCI hotplug - interrupts from unplugged device need to be returned back to interrupt pool, otherwise we will quickly run out of interrupts. This replaces a separate lslsi[] array with a byte in the ICSIRQState struct and defines "LSI" and "MSI" flags. Neither of these flags set signals that the descriptor is not allocated and not in use. Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru> Signed-off-by: Alexander Graf <agraf@suse.de>