History | View | Annotate | Download (36.5 kB)
Revert "virtio-pci: replace byte swap hack"
This reverts commit 9807caccd605d09a72495637959568d690e10175.
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
virtio-pci: replace byte swap hack
Remove byte swaps by declaring the config spaceas native endian.
Merge remote-tracking branch 'stefanha/block' into staging
virtio-blk: add x-data-plane=on|off performance feature
The virtio-blk-data-plane feature is easy to integrate intohw/virtio-blk.c. The data plane can be started and stopped similar tovhost-net.
Users can take advantage of the virtio-blk-data-plane feature using the...
virtio-blk: restore VirtIOBlkConf->config_wce flag
Two slightly different versions of a patch to conditionally setVIRTIO_BLK_F_CONFIG_WCE through the "config-wce" qdev property have beenapplied (ea776abca and eec7f96c2). David Gibson<david@gibson.dropbear.id.au> noticed that the "config-wce"...
virtio-pci: don't poll masked vectors
At the moment, when irqfd is in use but a vector is masked,qemu will poll it and handle vector masks in userspace.Since almost no one ever looks at the pending bits,it is better to defer this until pending bitsare actually read....
msi: add API to get notified about pending bit poll
Update all users.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
virtio: make bindings typesafe
Move bindings from opaque to DeviceState.This gives us better type safety with no performance cost.Add macros to make future QOM work easier.
softmmu: move include files to include/sysemu/
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
misc: move include files to include/qemu/
net: do not include net.h everywhere
Merge commit '1dd3a74d2ee2d873cde0b390b536e45420b3fe05' into HEAD
pci: update all users to look in pci/
update all users so we can remove the makefile hack.
virtio-blk: Remove duplicate property definition
For the virtio-blk device (via virtio-pci) the property "config-wce" isdefined in two places. First, it's defined from theDEFINE_VIRTIO_BLK_FEATURES macro, second it's defined directly invirtio-pci, just two lines above the call to that macro....
virtio-rng-pci: create a default backend if none exists
This allows you to specify:
$ qemu -device virtio-rng-pci
And things will Just Work with a reasonable default.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
virtio-rng: hardware random number generator device
The Linux kernel already has a virtio-rng driver, this is the deviceimplementation.
When the guest asks for entropy from the virtio hwrng, it puts a bufferin the vq. We then put entropy into that buffer, and push it back to...
virtio-rng: add rate limiting support
This adds parameters to virtio-rng-pci to allow rate limiting the entropy aguest receives. An example command line:
$ qemu -device virtio-rng-pci,max-bytes=1024,period=1000
Would limit entropy collection to 1Kb/s....
virtio-pci: convert PIO to new memory api read/write
Signed-off-by: Alexander Graf <agraf@suse.de>
Rename target_phys_addr_t to hwaddr
target_phys_addr_t is unwieldly, violates the C standard (_t suffixes arereserved) and its purpose doesn't match the name (most target_phys_addr_taddresses are not target specific). Replace it with a finger-friendly,...
kvm: Clean up irqfd API
No need to expose the fd-based interface, everyone will already be finewith the more handy EventNotifier variant. Rename the latter to clarifythat we are still talking about irqfds here.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>...
msix: make [un]use vectors on reset/load optional
The facility to use/unuse vectors dynamically is helpfulfor virtio but little else: everyone just seems to usevectors in their init function.
Avoid clearing msix vector use info on reset and load.For virtio, clear it explicitly....
virtio-blk: hide VIRTIO_BLK_F_CONFIG_WCE from old machine types
QEMU has a policy of keeping a stable guest device ABI. When new guest devicefeatures are introduced they must not change hardware info seen by existingguests. This is important because operating systems or applications may...
kvm: Decouple 'MSI routing via irqfds' from 'kernel irqchip'
Decouple another x86-specific assumption about what irqchips imply.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>Signed-off-by: Avi Kivity <avi@redhat.com>
virtio: fix vhost handling
Commit b1f416aa8d870fab71030abc9401cfc77b948e8e breaks vhost_netbecause it always registers the virtio_pci_host_notifier_read() handlerfunction on the ioeventfd, even when vhost_net.ko is using the ioeventfd.The result is both QEMU and vhost_net.ko polling on the same eventfd...
Merge remote-tracking branch 'mst/tags/for_anthony' into staging
Merge branch pci into master
Merge master and pci branch, resolve build breakage in hw/esp.cintroduced by f90c2bcd.
Conflicts: hw/esp.c
virtio-scsi: enable MSI-X support
While virtio-scsi does support multiqueue, the default number ofinterrupt vectors is not enough to actually enable usage ofmultiple queues in the driver; this is because with only 2vectors the driver will not be able to use a separate...
virtio-scsi: add ioeventfd support
Probably due to bad merge months ago, virtio-scsi-pci did not haveioeventfd support. Fix this and enable it by default, as is thecase for other virtio-pci devices.
Merge remote-tracking branch 'kwolf/for-anthony' into staging
virtio-blk: qdev properties for disk geometry
Geometry needs to be qdev properties, because it belongs to thedisk's guest part.
Maintain backward compatibility exactly like for serial: fall back toDriveInfo's geometry, set with -drive cyls=...
Bonus: info qtree now shows the geometry....
virtio: move common ioeventfd handling out of virtio-pci
All transports can use the same event handler for the ioeventfd, thoughthe exact setup (address/memory region) will be specific.
This lets virtio use event_notifier_set_handler.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>...
virtio: move common irqfd handling out of virtio-pci
All transports can use the same event handler for the irqfd, though theexact mechanics of the assignment will be specific. Note that thereare three states: handled by the kernel, handled in userspace, disabled....
memory: pass EventNotifier, not eventfd
Under Win32, EventNotifiers will not have event_notifier_get_fd, so wecannot call it in common code such as hw/virtio-pci.c. Pass a pointer tothe notifier, and only retrieve the file descriptor in kvm-specific code....
pci: convert PCIUnregisterFunc to void
Not a single driver has any possibility of failure on theirexit function, let's keep it that way.
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
virtio: Convert to msix_init_exclusive_bar() interface
Simple conversion.
msi: Invoke msi/msix_reset from PCI core
There is no point in pushing this burden to the devices, they tend toforget to call them (like intel-hda, ahci, xhci did). Instead, resetfunctions are now called from pci_device_reset. They do nothing ifMSI/MSI-X is not in use....
msi: Invoke msi/msix_write_config from PCI core
Also this functions is better invoked by the core than by each and everydevice. This allows to drop the config_write callbacks from ich andintel-hda.
CC: Alexander Graf <agraf@suse.de>CC: Gerd Hoffmann <kraxel@redhat.com>...
Merge remote-tracking branch 'qemu-kvm/uq/master' into staging
virtio-blk: blockdev_mark_auto_del is transport-independent
Move it from virtio_blk_exit_pci to virtio_blk_exit.
This is included here because the next patch removes proxy->block.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
virtio-blk: define VirtIOBlkConf
We will have to add another field to the virtio-blk configuration inthe next patch. Avoid a proliferation of arguments to virtio_blk_init.
virtio-blk: always enable VIRTIO_BLK_F_SCSI
VIRTIO_BLK_F_SCSI is supposed to mean whether the host can parseSCSI requests, not execute them. You could run QEMU with scsi=onand a file-backed disk, and QEMU would fail all SCSI requests eventhough it advertises VIRTIO_BLK_F_SCSI....
virtio/vhost: Add support for KVM in-kernel MSI injection
Make use of the new vector notifier to track changes of the MSI-Xconfiguration of virtio PCI devices. On enabling events, we establishthe required virtual IRQ to MSI-X message route and link the signaling...
virtio-pci: add missing 'static'
There are no outside references to virtio_portio.Add missing 'static' specifier.
Reviewed-by: Stefan Weil <sw@weilnetz.de>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
virtio-pci: change virtio balloon PCI class code
Currently the virtio balloon device, when using the virtio-pci interfaceadvertises itself with PCI class code MEMORY_RAM. This is wrong; theballoon is vaguely related to memory, but is nothing like a PCI memory...
virtio-scsi: Add virtio-scsi stub device
Add a useless virtio SCSI HBA device:
qemu -device virtio-scsi-pci
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
qom: Unify type registration
Replace device_init() with generalized type_init().
While at it, unify naming convention: type_init([$prefix_]register_types)Also, type_init() is a function, so add preceding blank line wherenecessary and don't put a semicolon after the closing brace....
qdev: remove baked in notion of aliases (v2)
Limit them to the device_add functionality. Device aliases were a hack basedon the fact that virtio was modeled the wrong way. The mechanism for aliasingis very limited in that only one alias can exist for any device....
qdev: register all types natively through QEMU Object Model
This was done in a mostly automated fashion. I did it in three steps and thenrebased it into a single step which avoids repeatedly touching every file inthe tree.
The first step was a sed-based addition of the parent type to the subclass...
pci: convert to QEMU Object Model
qdev: prepare source tree for code conversion
These are various small stylistic changes which help make things moreconsistent such that the automated conversion script can be simpler.
It's not necessary to agree or disagree with these style changes because all...
virtio-pci: Fix endianness of virtio config
The virtio config area in PIO space is a bit special. The initialheader is little endian but the rest (device specific) is guestnative endian.
The PIO accessors for PCI on machines that don't have native IO ports...
prepare for future GPLv2+ relicensing
All files under GPLv2 will get GPLv2+ changes starting tomorrow.event_notifier.c and exec-obsolete.h were only ever touched by Red Hatemployees and can be relicensed now.
virtio-pci: use pci macros
Signed-off-by: Hui Kai Ran <hkran@linux.vnet.ibm.com>Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
hw/9pfs: Add qdev.reset callback for virtio-9p-pci device
Add the device reset callback
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
virtio: add and use virtio_set_features
vdev->guest_features is not masking features that are not supported bythe guest. Fix this by introducing a common wrapper to be used by allvirtio bus implementations.
Revert "virtio: Add PCI memory BAR in addition to PIO BAR"
This reverts commit 46d95bfec7f9429d5228078219413d7e33496d65.
virtio: Add PCI memory BAR in addition to PIO BAR
Currently, virtio devices are usually presented to the guest as anemulated PCI device, virtio_pci. Although the actual IO operationsare done through system memory, the configuration of the virtio device...
hw/9pfs: Use ioeventfd for 9p
With ioeventfd:[root@qemu-img-64 storage]# dd if=/dev/zero of=/storage/testx bs=8k count=131072 oflag=direct131072+0 records in131072+0 records out1073741824 bytes (1.1 GB) copied, 26.767 s, 40.1 MB/s
Without:[root@qemu-img-64 storage]# dd if=/dev/zero of=/storage/testx bs=8k count=131072 oflag=direct...
msix: convert to memory API
The msix table is defined as a subregion, to allow for a BAR thatmixes device specific regions with the msix table.
Reviewed-by: Richard Henderson <rth@twiddle.net>Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>Signed-off-by: Avi Kivity <avi@redhat.com>...
pci: rename pci_register_bar_region() to pci_register_bar()
Reviewed-by: Richard Henderson <rth@twiddle.net>Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>Signed-off-by: Avi Kivity <avi@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
virtio-pci: convert to memory API
except msix.
[jan: fix build][aliguori: fix build]
Merge remote-tracking branch 'mst/for_anthony' into staging
virtio-balloon: Add exit handler, fix memleaks
Add an exit handler that will free up RAM after a virtio-balloon deviceis unplugged.
Signed-off-by: Amit Shah <amit.shah@redhat.com>Reviewed-by: Markus Armbruster <armbru@redhat.com>Acked-by: Michael S. Tsirkin <mst@redhat.com>
virtio-balloon: Check if balloon registration failed
Multiple balloon registrations are not allowed; check if theregistration with the qemu balloon api succeeded. If not, fail thedevice init.
Signed-off-by: Amit Shah <amit.shah@redhat.com>Reviewed-by: Markus Armbruster <armbru@redhat.com>...
virtio-pci: use generic logic for command access
In practice, guests don't generate config requeststhat cross a word boundary, so the logic todetect command word access is correct becausePCI_COMMAND is 0x4. But depending on this istricky, further, it will break with guests...
virtio-blk: Turn drive serial into a qdev property
It needs to be a qdev property, because it belongs to the drive'sguest part. Precedence: commit a0fef654 and 6ced55a5.
Bonus: info qtree now shows the serial number.
Signed-off-by: Markus Armbruster <armbru@redhat.com>...
Merge remote-tracking branch 'origin/master' into pci
Conflicts: hw/virtio-pci.c
virtio-pci.c: convert to PCIDEviceInfo to initialize ids
use PCIDeviceInfo to initialize ids.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
virtio: guard against negative vq notifies
The virtio_queue_notify() function checks that the virtqueue number isless than the maximum number of virtqueues. A signed comparison is usedbut the virtqueue number could be negative if a buggy or malicious guest...
virtio-9p: Move 9p device registration into virtio-9p.c
This patch move the 9p device registration into its own file
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>Signed-off-by: Venkateswararao Jujjuri (JV) <jvrao@linux.vnet.ibm.com>
PXE: Use consistent naming for PXE ROMs
And add missing ROMs to tarbin build target.
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
virtio: use generic name when possible
We have two different virtio buses: pci and s390. The abstraction pathtaken in qemu is to have generic aliases for each device type in thearchitecture specific qdev devices.
So let's make use of these aliases whenever we can and define them...
virtio-pci: fix bus master work around on load
Commit c81131db15dd1844d0db1d51f3cd7a105cfd2cf3detects old guests by comparing virtio andPCI status. It attempts to do this on load,as well, but load_config callback in a bindingis invoked too early and so the virtio status...
virtio-serial: Enable ioeventfd
Enable ioeventfd for virtio-serial devices by default. Commit25db9ebe15125deb32958c6df74996f745edf1f9 lists the benefits of usingioeventfd.
Copying a file from guest to host over a virtio-serial channel didn'tshow much difference in time or io_exit rate....
virtio-serial: Use a struct to pass config information from proxy
Instead of using a single variable to pass to the virtio_serial_initfunction, use a struct so that expanding the number of variables to bepassed on later is easier.
Signed-off-by: Amit Shah <amit.shah@redhat.com>
vhost: force vhost off for non-MSI guests
When MSI is off, each interrupt needs to be bounced through the iothread when it's set/cleared, so vhost-net causes more context switches andhigher CPU utilization than userspace virtio which handles networking in...
ioeventfd: error handling cleanup
- Don't return status from start/stop functions where it's ignored- report errors to make debugging easier- assert on unexpected failures- don't disable notifiers on error so that we'll retry when guest driver restarts...
virtio-pci: Use ioeventfd for virtqueue notify
Virtqueue notify is currently handled synchronously in userspace virtio. Thisprevents the vcpu from executing guest code while hardware emulation codehandles the notify.
On systems that support KVM, the ioeventfd mechanism can be used to make...
virtio-pci: Rename bugs field to flags
The VirtIOPCIProxy bugs field is currently used to enable workaroundsfor older guests. Rename it to flags so that other per-device behaviorcan be tracked.
A later patch uses the flags field to remember whether ioeventfd should...
Introduce fw_name field to DeviceInfo structure.
Add "fw_name" to DeviceInfo to use in device path building. Incontrast to "name" "fw_name" should refer to functionality deviceprovides instead of particular device model like "name" does.
Signed-off-by: Gleb Natapov <gleb@redhat.com>...
virtio-pci: Convert fprintf() to error_report()
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
virtfs: enable MSI-X
This patch enables MSI-X for virtfs-9p-pci. It also adds acompat property to pc-0.13 which turns it of there to staycompatible to 0.13-stable.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
virtio: change set guest notifier to per-device
When using irqfd with vhost-net to inject interrupts,a single evenfd might inject multiple interrupts.Implementing this is much easier with a singleper-device callback to set guest notifiers.
virtio-net: Introduce a new bottom half packet TX
Based on a patch from Mark McLoughlin, this patch introduces a newbottom half packet transmitter that avoids the latency imposed bythe tx_timer approach. Rather than scheduling a timer when a TXpacket comes in, schedule a bottom half to be run from the iothread....
virtio-net: Limit number of packets sent per TX flush
If virtio_net_flush_tx() is called with notification disabled, we canrace with the guest, processing packets at the same rate as theyget produced. The trouble is that this means we have no guaranteed...
virtio-net: Make tx_timer timeout configurable
Add an option to make the TX mitigation timer adjustable as a deviceoption. The 150us hard coded default used currently is reasonable,but may not be suitable for all workloads, this gives us a way toadjust it using a single binary. We can't support any random option...
Rearrange block headers
Changing block.h or blockdev.h resulted in recompiling most objects.
Move DriveInfo typedef and BlockInterfaceType enum definitionsto qemu-common.h and rearrange blockdev.h use to decrease churn.
virtio-serial: Cleanup on device hot-unplug
Free malloc'ed memory, unregister from savevm and clean up virtio-commonbits on device hot-unplug.
This was found performing a migration after device hot-unplug.
Reported-by: <lihuang@redhat.com>Signed-off-by: Amit Shah <amit.shah@redhat.com>...
virtio-blk: Create exit function to unregister savevm
Otherwise we can't migrate after we've removed a virtio block device.
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
virtio-pci: Check for virtio_blk_init() failure
It can't actually fail now, but the next commit will change that.
s390_virtio_blk_init() already checks for failure, butvirtio_blk_init_pci() doesn't. Fix that.
virtio-blk: Fix virtio-blk-s390 to require drive
Move the check from virtio_blk_init_pci(), where it protects onlyvirtio-blk-pci, to virtio_blk_init(). Without that, virtio-blk-s390initializes without a drive. I figure that can lead to null pointerdereferences....
pci: don't overwrite multi functio bit in pci header type.
Don't overwrite pci header type.Otherwise, multi function bit which pci_init_header_type() setsappropriately is lost.Anyway PCI_HEADER_TYPE_NORMAL is zero, so it is unnecessary to zerowhich is already zero cleared....
qdev: Decouple qdev_prop_drive from DriveInfo
Make the property point to BlockDriverState, cutting out the DriveInfomiddleman. This prepares the ground for block devices that don't havea DriveInfo.
Currently all user-defined ones have a DriveInfo, because the only way...
blockdev: Clean up automatic drive deletion
We automatically delete blockdev host parts on unplug of the guestdevice. Too much magic, but we can't change that now.
The delete happens early in the guest device teardown, before theconnection to the host part is severed. Thus, the guest part's...
virtio-pci: fix bus master bug setting on load
The comment suggests we're checking for the driver in the readystate and bus master disabled, but the code is checking that it'snot in the ready state.
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>...
virtio-9p: Make infrastructure for the new security model.
This patch adds required infrastructure for the new security model.
- A new configure option for attr/xattr.- if CONFIG_VIRTFS will be defined if both CONFIG_LINUX and CONFIG_ATTR defined.- Defines routines related to both security models....
blockdev: Collect block device code in new blockdev.c
Anything that moves hundreds of lines out of vl.c can't be all bad.
Signed-off-by: Markus Armbruster <armbru@redhat.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
virtio-9p: Add a virtio 9p device to qemu
This patch doesn't implement the 9p protocol handlingcode. It adds a simple device which dump the protocol data.
[jvrao@linux.vnet.ibm.com: Little-Endian to host format conversion][aneesh.kumar@linux.vnet.ibm.com: Multiple-mounts support]...
virtio: add set_status callback
vhost net backend needs to be notified whenfrontend status changes. Add a callback,similar to set_features.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
virtio-pci: fill in notifier support
Support host/guest notifiers in virtio-pci.The last one only with kvm, that's okaybecause vhost relies on kvm anyway.
Note on kvm usage: kvm ioeventfd APIis implemented on non-kvm systems as well,this is the reason we don't need if (kvm_enabled())...