summaryrefslogtreecommitdiffstats
path: root/hw/virtio.c
Commit message (Collapse)AuthorAgeFilesLines
* virtio: move vmstate change tracking to coreMichael S. Tsirkin2011-01-101-0/+22
| | | | | | | | Move tracking vmstate change from virtio-net to virtio.c as it is going to be used by virito-blk and virtio-pci for the ioeventfd support. Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* virtio: fix up VQ checksMichael S. Tsirkin2010-11-241-11/+16
| | | | | | | | | | When migration triggers before a VQ is initialized, base pa is 0 and last_used_index must be 0 too: we don't have a ring to compare to. Reported-by: Juan Quintela <quintela@redhat.com> Tested-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* virtio: Convert fprintf() to error_report()Stefan Hajnoczi2010-11-241-17/+18
| | | | | | Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> (cherry picked from commit cd92f4cc22fbe12a7bf60c9430731f768dc1537c)
* virtio: sanity-check available indexMichael S. Tsirkin2010-10-271-0/+11
| | | | | | | | Checking available index upon load instead of only when vm is running makes is easier to debug failures. Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* virtio: invoke set_status callback on resetMichael S. Tsirkin2010-10-071-0/+2
| | | | | | | | | | | As status is set to 0 on reset, invoke the relevant callback. This makes for a cleaner code in devices as they don't need to duplicate the code in their reset routine, as well as excercises this path a little more. In particular this makes it possible to unify vhost-net handling code with the following patch. Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* trace: Trace virtqueue operationsStefan Hajnoczi2010-09-091-0/+8
| | | | | | | | This patch adds trace events for virtqueue operations including adding/removing buffers, notifying the guest, and receiving a notify from the guest. Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
* virtio: Factor virtqueue_map_sg outKevin Wolf2010-08-301-14/+24
| | | | | | | Separate the mapping of requests to host memory from the descriptor iteration. The next patch will make use of it in a different context. Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* virtio: invoke set_features on loadMichael S. Tsirkin2010-05-121-0/+2
| | | | | | | | | | After migration, vhost was not getting features acked because set_features callback was never invoked. The fix is just to invoke that callback. Reported-by: David L Stevens <dlstevens@us.ibm.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Tested-by: David L Stevens <dlstevens@us.ibm.com>
* win32: Fix compiler errors from u_int64_tStefan Weil2010-04-011-1/+1
| | | | | | | | | | | | | | | | | u_int64_t raises compiler error messages: CC libhw32/virtio.o /qemu/ar7/hw/virtio.c: In function ‘virtio_queue_get_avail_size’: /qemu/ar7/hw/virtio.c:776: error: ‘u_int64_t’ undeclared (first use in this function) /qemu/ar7/hw/virtio.c:776: error: (Each undeclared identifier is reported only once /qemu/ar7/hw/virtio.c:776: error: for each function it appears in.) Replacing u_int64_t by uint64_t helps. Cc: Michael S. Tsirkin <mst@redhat.com> Cc: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* virtio: notifier support + APIs for queue fieldsMichael S. Tsirkin2010-04-011-1/+79
| | | | | | | | | vhost needs physical addresses for ring and other queue fields, so add APIs for these. In particular, add binding API to set host/guest notifiers. Will be used by vhost. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* virtio: Remove duplicate macro definition for max. virtqueues, bump up the maxAmit Shah2010-01-201-2/+0
| | | | | | | | | | | VIRTIO_PCI_QUEUE_MAX is redefined in hw/virtio.c. Let's just keep it in hw/virtio.h. Also, bump up the value of the maximum allowed virtqueues to 64. This is in preparation to allow multiple ports per virtio-console device. Signed-off-by: Amit Shah <amit.shah@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* virtio: add features as qdev propertiesMichael S. Tsirkin2010-01-111-1/+1
| | | | | | | | | | | | | Add feature bits as properties to virtio. This makes it possible to e.g. define machine without indirect buffer support, which is required for 0.10 compatibility, or without hardware checksum support, which is required for 0.11 compatibility. Since default values for optional features are now set by qdev, get_features callback has been modified: it sets non-optional bits, and clears bits not supported by host. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Acked-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* virtio: rename features -> guest_featuresMichael S. Tsirkin2010-01-111-4/+4
| | | | | | | | | Rename features->guest_features. This is what they are, avoid confusion with host features which we also need to keep around. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* virtio: verify features on loadMichael S. Tsirkin2009-12-121-1/+10
| | | | | | | | | | | | migrating between hosts which have different features might break silently, if the migration destination does not support some features supported by source. Prevent this from happening by comparing acked feature bits with the mask supported by the device. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* qemu/virtio: make wmb compiler barrier + commentsMichael S. Tsirkin2009-10-301-1/+4
| | | | | | | | | | wmb must be at least a compiler barrier, even without SMP. Further, we likely need some rmb()/mb() as well: I have not audited the code but lguest has mb(), add a comment for now. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Revert "Get rid of _t suffix"Anthony Liguori2009-10-011-28/+28
| | | | | | | | | | | | In the very least, a change like this requires discussion on the list. The naming convention is goofy and it causes a massive merge problem. Something like this _must_ be presented on the list first so people can provide input and cope with it. This reverts commit 99a0949b720a0936da2052cb9a46db04ffc6db29. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Get rid of _t suffixmalc2009-10-011-28/+28
| | | | | | | Some not so obvious bits, slirp and Xen were left alone for the time being. Signed-off-by: malc <av1474@comtv.ru>
* qemu: init all queues to NO_VECTOR valueMichael S. Tsirkin2009-09-111-0/+3
| | | | | | | | | | | initialize vectors for all vqs to VIRTIO_NO_VECTOR rather than 0 which is a valid vector. This fixes migration which happened before driver was loaded. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reported-by: Amit Shah <amit.shah@redhat.com> Tested-by: Amit Shah <amit.shah@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* qemu: remove control vector saveMichael S. Tsirkin2009-07-091-3/+0
| | | | | | | | control vector is saved/restored by virtio-pci, it does not belong in virtio. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* qemu/virtio: virtio save/load bindingsMichael S. Tsirkin2009-06-241-17/+16
| | | | | | | Implement bindings for virtio save/load. Use them in virtio pci. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* qemu/virtio: virtio support for many interrupt vectorsMichael S. Tsirkin2009-06-241-15/+44
| | | | | | | | | | | | Extend virtio to support many interrupt vectors, and rearrange code in preparation for multi-vector support (mostly move reset out to bindings, because we will have to reset the vectors in transport-specific code). Actual bindings in pci, and use in net, to follow. Load and save are not connected to bindings yet, so they are left stubbed out for now. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* virtio: add support for indirect ring entriesMark McLoughlin2009-06-221-5/+46
| | | | | | | | | | | | | | | | | | Support a new feature flag for indirect ring entries. These are ring entries which point to a table of buffer descriptors. The idea here is to increase the ring capacity by allowing a larger effective ring size whereby the ring size dictates the number of requests that may be outstanding, rather than the size of those requests. This should be most effective in the case of block I/O where we can potentially benefit by concurrently dispatching a large number of large requests. Even in the simple case of single segment block requests, this results in a threefold increase in ring capacity. Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* virtio: make vring_desc_*() take phys addrsMark McLoughlin2009-06-221-26/+33
| | | | | | | | | | | Change the vring descriptor helpers to take the physical address of the descriptor table rather than a virtqueue. This is needed in order to allow these helpers to be used with an indirect descriptor table. Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Introduce reset notifier orderJan Kiszka2009-05-221-1/+2
| | | | | | | | | | | | | | | Add the parameter 'order' to qemu_register_reset and sort callbacks on registration. On system reset, callbacks with lower order will be invoked before those with higher order. Update all existing users to the standard order 0. Note: At least for x86, the existing users seem to assume that handlers are called in their registration order. Therefore, the patch preserves this property. If someone feels bored, (s)he could try to identify this dependency and express it properly on callback registration. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Separate virtio PCI codePaul Brook2009-05-181-218/+56
| | | | | | Split the PCI host bindings from the VRing transport implementation. Signed-off-by: Paul Brook <paul@codesourcery.com>
* Virtio-net qdev conversionPaul Brook2009-05-141-8/+2
| | | | Signed-off-by: Paul Brook <paul@codesourcery.com>
* use PCI_HEADER_TYPE.Isaku Yamahata2009-05-031-1/+1
| | | | | | use symbolic value instead of 0x0e and related value. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
* Introduce VLANClientState::cleanup() (Mark McLoughlin)aliguori2009-04-171-0/+7
| | | | | | | | | | | We're currently leaking memory and file descriptors on device hot-unplug. Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7150 c046a42c-6fe2-441c-8c8c-71466251a162
* Fix oops on 2.6.25 guest (Rusty Russell)aliguori2009-04-051-1/+8
| | | | | | | | | | | | | | I believe this is behind the following: https://bugs.edge.launchpad.net/ubuntu/jaunty/+source/linux/+bug/331128 virtio_pci in 2.6.25 didn't do feature negotiation correctly: it acked every bit. Fortunately, we can detect this. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6975 c046a42c-6fe2-441c-8c8c-71466251a162
* Use the DMA api to map virtio elements.aliguori2009-03-281-82/+17
| | | | | | | Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6904 c046a42c-6fe2-441c-8c8c-71466251a162
* virtio: Allow guest to defer VIRTIO_F_NOTIFY_ON_EMPTY (Alex Williamson)aliguori2009-03-201-3/+4
| | | | | | | | | | | | | | | There may be cases where the guest does not want the avail queue interrupt, even when it's empty. For the virtio-net case, the guest may use a different buffering scheme or decide polling for used buffers is more efficient. This can be accomplished by simply checking for whether the guest has acknowledged the existing notify on empty flag. Signed-off-by: Alex Williamson <alex.williamson@hp.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6865 c046a42c-6fe2-441c-8c8c-71466251a162
* hw: remove error handling from qemu_malloc() callers (Avi Kivity)aliguori2009-02-051-2/+1
| | | | | | | | Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6529 c046a42c-6fe2-441c-8c8c-71466251a162
* Add and use #defines for PCI device classesblueswir12009-02-011-5/+3
| | | | | | | | | | | | | This patch adds and uses #defines for PCI device classes and subclases, using a new pci_config_set_class() function, similar to the recently added pci_config_set_vendor_id() and pci_config_set_device_id(). Change since v1: fixed compilation of hw/sun4u.c Signed-off-by: Stuart Brady <stuart.brady@gmail.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6491 c046a42c-6fe2-441c-8c8c-71466251a162
* Don't notify virtio devices before S_DRIVER_OK (Mark McLoughlin)aliguori2009-01-291-0/+3
| | | | | | | | | | | | | | | | Current Linux guests oops if the host notifies of a config change before a driver has been bound to the device. It's pretty pointless for us to do notify of config changes before status is S_DRIVER_OK anyway, so let's just not do it. Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6471 c046a42c-6fe2-441c-8c8c-71466251a162
* Define PCI vendor and device IDs in pci.h (Stuart Brady)aliguori2009-01-261-4/+2
| | | | | | | | | | | | | | | This patch defines PCI vendor and device IDs in pci.h (matching those from Linux's pci_ids.h), and uses those definitions where appropriate. Change from v1: Introduces pci_config_set_vendor_id() / pci_config_set_device_id() accessors as suggested by Anthony Liguori. Signed-off-by: Stuart Brady <stuart.brady@gmail.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6442 c046a42c-6fe2-441c-8c8c-71466251a162
* Rename fls to qemu_flsblueswir12008-12-111-1/+1
| | | | | | | Fix compiler warning on OSX, reported by Andreas Faerber. git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5982 c046a42c-6fe2-441c-8c8c-71466251a162
* Fix some new warnings introduced after r5022blueswir12008-12-071-1/+1
| | | | git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5933 c046a42c-6fe2-441c-8c8c-71466251a162
* Fix windows build after virtio changesaliguori2008-12-041-14/+25
| | | | | | | | | | Windows does not have sys/uio.h and does not have err.h. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5877 c046a42c-6fe2-441c-8c8c-71466251a162
* Remove TARGET_PAGE_SIZE from virtio interface (Hollis Blanchard)aliguori2008-12-041-3/+13
| | | | | | | | | | | | | | | | TARGET_PAGE_SIZE should only be used internal to qemu, not in guest/host interfaces. The virtio frontend code in Linux uses two constants (PFN shift and vring alignment) for the interface, so update qemu to match. I've tested this with PowerPC KVM and confirmed that it fixes virtio problems when using non-TARGET_PAGE_SIZE pages in the guest. Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5871 c046a42c-6fe2-441c-8c8c-71466251a162
* Virtio core supportaliguori2008-12-041-0/+847
This patch adds core support for VirtIO. VirtIO is a paravirtualization framework that has been in Linux since 2.6.21. A PCI transport has been available since 2.6.25. Network drivers are also available for Windows. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5869 c046a42c-6fe2-441c-8c8c-71466251a162
OpenPOWER on IntegriCloud