summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2014-12-15tools/virtio: add virtio 1.0 in virtio_testMichael S. Tsirkin
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2014-12-15tools/virtio: enable -WerrorMichael S. Tsirkin
Seems to mostly be a positive. Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2014-12-15tools/virtio: 64 bit featuresMichael S. Tsirkin
Missed one place where vringh_test used long to pass features. Fix it up to u64. Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2014-12-15tools/virtio: fix vringh testMichael S. Tsirkin
Include missing virtio_config.h Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2014-12-15tools/virtio: more stubsMichael S. Tsirkin
As usual, add more stubs to fix test build after main codebase changes. Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2014-12-14virtio: core support for config generationMichael S. Tsirkin
virtio 1.0 spec says: Drivers MUST NOT assume reads from fields greater than 32 bits wide are atomic, nor are reads from multiple fields: drivers SHOULD read device configuration space fields like so: u32 before, after; do { before = get_config_generation(device); // read config entry/entries. after = get_config_generation(device); } while (after != before); Do exactly this, for transports that support it. Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2014-12-14virtio_pci: add VIRTIO_PCI_NO_LEGACYMichael S. Tsirkin
Add macro to disable all legacy register defines. Helpful to make sure legacy macros don't leak through into modern code. Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2014-12-14virtio_pci: move probe to common fileMichael S. Tsirkin
It turns out this make everything easier. Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2014-12-11virtio_pci_common.h: drop VIRTIO_PCI_NO_LEGACYMichael S. Tsirkin
Legacy drivers use virtio_pci_common.h too, we should not define VIRTIO_PCI_NO_LEGACY there. Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2014-12-11virtio_config: fix virtio_cread_bytesMichael S. Tsirkin
virtio_cread_bytes is implemented incorrectly in case length happens to be 2,4 or 8 bytes: transports and devices will assume it's an integer value that has to be converted to LE format. Let's just do multiple 1-byte reads: this also makes life easier for transports who only need to implement 1,2,4 and 8 byte reads. Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2014-12-11virtio: set VIRTIO_CONFIG_S_FEATURES_OK on restoreMichael S. Tsirkin
virtio 1.0 devices require that drivers set VIRTIO_CONFIG_S_FEATURES_OK after finalizing features. virtio core missed doing this on restore, fix it up. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
2014-12-09virtio_ccw: finalize_features error handlingCornelia Huck
We previously tried to use device even if finalize_features failed, but that's wrong since driver and device are now out of sync. Fail probe if we detect failures during finalize_features. Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2014-12-09virtio_ccw: future-proof finalize_featuresMichael S. Tsirkin
We never negotiate revision > 1, but just to make this code more likely to work when we do, require VERSION_1 with any revision >= 1. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com>
2014-12-09virtio_pci: rename virtio_pci -> virtio_pci_commonMichael S. Tsirkin
kbuild does not seem to like it when we name source files same as the module. Let's rename virtio_pci -> virtio_pci_common, and get rid of #include-ing c files. Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2014-12-09virtio_pci: update file descriptions and copyrightMichael S. Tsirkin
There's been a lot of changes since 2007. List main authors, add Red Hat copyright. Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2014-12-09virtio_pci: split out legacy device supportMichael S. Tsirkin
Move everything dealing with legacy devices out to virtio_pci_legacy.c. Expose common code APIs in virtio_pci.h Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2014-12-09virtio_pci: setup config vector indirectlyMichael S. Tsirkin
config vector setup is version specific, do it indirectly. Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2014-12-09virtio_pci: setup vqs indirectlyMichael S. Tsirkin
VQ setup is mostly version-specific, add another level of indirection to split the version-independent code out. Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2014-12-09virtio_pci: delete vqs indirectlyMichael S. Tsirkin
VQ deletion is mostly version-specific, add another level of indirection to split the version-independent code out. Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2014-12-09virtio_pci: use priv for vq notificationMichael S. Tsirkin
slightly reduce the amount of pointer chasing this needs to do. More importantly, this will easily generalize to virtio 1.0. Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2014-12-09virtio_pci: free up vq->privMichael S. Tsirkin
We don't need to go from vq to vq info on data path, so using direct vq->priv pointer for that seems like a waste. Let's build an array of vq infos, then we can use vq->index for that lookup. Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2014-12-09virtio_pci: fix coding style for structsMichael S. Tsirkin
should be struct foo { } not struct foo { } Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2014-12-09virtio_pci: add isr fieldMichael S. Tsirkin
Use isr field instead of direct access to ioaddr. This way generalizes easily to virtio 1.0. Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2014-12-09virtio: drop legacy_only driver flagMichael S. Tsirkin
legacy_only flag is now unused, drop it from core. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com>
2014-12-09virtio_balloon: drop legacy_only driver flagMichael S. Tsirkin
we have blacklisted balloon in core, no need for a driver flag. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com>
2014-12-09virtio_ccw: rev 1 devices set VIRTIO_F_VERSION_1Michael S. Tsirkin
What does it mean if rev 1 device does not set VIRTIO_F_VERSION_1? E.g. is it native endian? Let's not even try to drive such devices: fail attempts to finalize features. virtio core will detect this and bail out. Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2014-12-09virtio: allow finalize_features to failMichael S. Tsirkin
This will make it easy for transports to validate features and return failure. Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2014-12-09virtio_ccw: legacy: don't negotiate rev 1/featuresMichael S. Tsirkin
Legacy balloon device doesn't pretend to support revision 1 or 64 bit features. But just in case someone implements a broken one that does, let's not even try to drive legacy only devices using revision 1, and let's not give them a chance to say they support VIRTIO_F_VERSION_1 by not reading or writing high feature bits. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
2014-12-09virtio: add API to detect legacy devicesMichael S. Tsirkin
transports need to be able to detect legacy-only devices (ATM balloon only) to use legacy path to drive them. Add a core API to do just that. The implementation just blacklists balloon: not too pretty, but let's not over-engineer. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com>
2014-12-09virtio_console: fix sparse warningsMichael S. Tsirkin
CHECK drivers/char/virtio_console.c drivers/char/virtio_console.c:687:36: warning: incorrect type in argument 1 (different address spaces) drivers/char/virtio_console.c:687:36: expected void [noderef] <asn:1>*to drivers/char/virtio_console.c:687:36: got char *out_buf drivers/char/virtio_console.c:790:35: warning: incorrect type in argument 2 (different address spaces) drivers/char/virtio_console.c:790:35: expected char *out_buf drivers/char/virtio_console.c:790:35: got char [noderef] <asn:1>*ubuf fill_readbuf is reused with both kernel and userspace pointers, depending on value of to_user flag. Tag address parameter as __user, and cast to/from regular pointer type when we know it's safe. Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2014-12-09vhost: remove unnecessary forward declarations in vhost.hJason Wang
Signed-off-by: Jason Wang <jasowang@redhat.com> Acked-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2014-12-09virtio: drop VIRTIO_F_VERSION_1 from driversMichael S. Tsirkin
Core activates this bit automatically now, drop it from drivers that set it explicitly. Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2014-12-09virtio: make VIRTIO_F_VERSION_1 a transport bitMichael S. Tsirkin
Activate VIRTIO_F_VERSION_1 automatically unless legacy_only is set. Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2014-12-09virtio_balloon: add legacy_only flagMichael S. Tsirkin
We have no plans to support virtio 1.0 in balloon driver. Add an explicit flag to mark it legacy only. This will be used by follow-up patches. Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2014-12-09virtio_console: virtio 1.0 supportMichael S. Tsirkin
Pretty straight-forward, just use accessors for all fields. Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2014-12-09af_packet: virtio 1.0 stubsMichael S. Tsirkin
This merely fixes sparse warnings, without actually adding support for the new APIs. Still working out the best way to enable the new functionality. Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2014-12-09vhost/scsi: partial virtio 1.0 supportMichael S. Tsirkin
Include all endian conversions as required by virtio 1.0. Don't set virtio 1.0 yet, since that requires ANY_LAYOUT which we don't yet support. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Acked-by: Paolo Bonzini <pbonzini@redhat.com>
2014-12-09virtio_scsi: export to userspaceMichael S. Tsirkin
Replace uXX by __uXX and _packed by __attribute((packed)) as seems to be the norm for userspace headers. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Acked-by: Paolo Bonzini <pbonzini@redhat.com>
2014-12-09virtio_scsi: move to uapiMichael S. Tsirkin
Guests need to use virtio scsi API, so export it to uapi, nice to e.g. qemu and will help us remember this file affects ABI. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Acked-by: Paolo Bonzini <pbonzini@redhat.com>
2014-12-09virtio_scsi: v1.0 supportMichael S. Tsirkin
Note: for consistency, and to avoid sparse errors, convert all fields, even those no longer in use for virtio v1.0. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Acked-by: Paolo Bonzini <pbonzini@redhat.com>
2014-12-09macvtap: TUN_VNET_LE supportMichael S. Tsirkin
Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Jason Wang <jasowang@redhat.com>
2014-12-09tun: TUN_VNET_LE support, fix sparse warnings for virtio headersMichael S. Tsirkin
Pretty straight-forward: convert all fields to/from virtio endian-ness. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Jason Wang <jasowang@redhat.com>
2014-12-09tun: add VNET_LE flagMichael S. Tsirkin
virtio 1.0 modified virtio net header format, making all fields little endian. Users can tweak header format before submitting it to tun, but this means more data copies where none were necessary. And if the iovec is in RO memory, this means we might need to split iovec also means we might in theory overflow iovec max size. This patch adds a simpler way for applications to handle this, using new "little endian" flag in tun. As a result, tun simply byte-swaps header fields as appropriate. This is a NOP on LE architectures. Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2014-12-09tun: drop most type definesMichael S. Tsirkin
It's just as easy to use IFF_ flags directly, there's no point in adding our own defines. Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2014-12-09tun: move internal flag defines out of uapiMichael S. Tsirkin
TUN_ flags are internal and never exposed to userspace. Any application using it is almost certainly buggy. Move them out to tun.c. Note: we remove these completely in follow-up patches, this code movement is split out for ease of review. Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2014-12-09vhost/net: enable virtio 1.0Michael S. Tsirkin
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2014-12-09vhost/net: larger header for virtio 1.0Michael S. Tsirkin
Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Jason Wang <jasowang@redhat.com> Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
2014-12-09vhost/net: virtio 1.0 byte swapMichael S. Tsirkin
I had to add an explicit tag to suppress compiler warning: gcc isn't smart enough to notice that len is always initialized since function is called with size > 0. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
2014-12-09vhost: virtio 1.0 endian-ness supportMichael S. Tsirkin
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2014-12-09vhost: switch to __get/__put_user exclusivelyMichael S. Tsirkin
Most places in vhost can use __get/__put_user rather than get/put_user since addresses are pre-validated. This should be good for performance, but this also will help make code sparse-clean: get/put_user macros don't play well with __virtioXX bitwise tags. Switch to get/put_user to __ variants everywhere in vhost. There's one exception - for consistency switch that as well, and add an explicit access_ok check. Signed-off-by: Michael S. Tsirkin <mst@redhat.com>