Re: [PATCH RFC v3 11/12] virtio-net/virtio-blk: enable virtio 1.0

2014-11-27 Thread Cornelia Huck
On Wed, 26 Nov 2014 20:50:05 +0200 Michael S. Tsirkin m...@redhat.com wrote: On Wed, Nov 26, 2014 at 06:28:42PM +0100, Cornelia Huck wrote: virtio-net (non-vhost) and virtio-blk have everything in place to support virtio 1.0: let's enable the feature bit for them. Hmm I doubt that. At

Re: [PATCH v4 04/42] virtio: disable virtio 1.0 in transports

2014-11-27 Thread Michael S. Tsirkin
On Wed, Nov 26, 2014 at 10:09:54AM +0100, Cornelia Huck wrote: On Tue, 25 Nov 2014 23:20:11 +0200 Michael S. Tsirkin m...@redhat.com wrote: On Tue, Nov 25, 2014 at 06:29:42PM +0100, Cornelia Huck wrote: On Tue, 25 Nov 2014 18:41:35 +0200 Michael S. Tsirkin m...@redhat.com wrote:

Re: [PATCH v4 04/42] virtio: disable virtio 1.0 in transports

2014-11-27 Thread Cornelia Huck
On Thu, 27 Nov 2014 12:54:34 +0200 Michael S. Tsirkin m...@redhat.com wrote: On Wed, Nov 26, 2014 at 10:09:54AM +0100, Cornelia Huck wrote: The old s390 virtio transport in kvm_virtio.c is not part of virtio 1.0. It might or might not be a good idea to add code in kvm_virtio.c

Re: [PATCH v4 04/42] virtio: disable virtio 1.0 in transports

2014-11-27 Thread Michael S. Tsirkin
On Thu, Nov 27, 2014 at 12:02:52PM +0100, Cornelia Huck wrote: On Thu, 27 Nov 2014 12:54:34 +0200 Michael S. Tsirkin m...@redhat.com wrote: On Wed, Nov 26, 2014 at 10:09:54AM +0100, Cornelia Huck wrote: The old s390 virtio transport in kvm_virtio.c is not part of virtio 1.0. It

[PATCH v5 04/45] virtio: assert 32 bit features in transports

2014-11-27 Thread Michael S. Tsirkin
At this point, no transports set any of the high 32 feature bits. Since transports generally can't (yet) cope with such bits, add BUG_ON checks to make sure they are not set by mistake. Based on rproc patch by Rusty. Signed-off-by: Rusty Russell ru...@rustcorp.com.au Signed-off-by: Michael S.

[PATCH v5 01/45] virtio: use u32, not bitmap for struct virtio_device's features

2014-11-27 Thread Michael S. Tsirkin
From: Rusty Russell ru...@rustcorp.com.au It seemed like a good idea, but it's actually a pain when we get more than 32 feature bits. Just change it to a u32 for now. Cc: Brian Swetland swetl...@google.com Cc: Christian Borntraeger borntrae...@de.ibm.com Signed-off-by: Rusty Russell

[PATCH v5 03/45] virtio: add support for 64 bit features.

2014-11-27 Thread Michael S. Tsirkin
From: Rusty Russell ru...@rustcorp.com.au Change the u32 to a u64, and make sure to use 1ULL in all devices. Note: transports are unchanged, and only set low 32 bit. This ensures that no transport sets e.g. VERSION_1 by mistake without proper support. MST: drop most transport-specific changes.

[PATCH v5 06/45] virtio: add virtio 1.0 feature bit

2014-11-27 Thread Michael S. Tsirkin
Based on original patches by Rusty Russell, Thomas Huth and Cornelia Huck. Note: at this time, we do not negotiate this feature bit in core, drivers have to declare VERSION_1 support explicitly. For this reason we treat this bit as a device bit and not as a transport bit for now. After all

[PATCH v5 07/45] virtio: memory access APIs

2014-11-27 Thread Michael S. Tsirkin
virtio 1.0 makes all memory structures LE, so we need APIs to conditionally do a byteswap on BE architectures. To make it easier to check code statically, add virtio specific types for multi-byte integers in memory. Add low level wrappers that do a byteswap conditionally, these will be useful

[PATCH v5 09/45] virtio_config: endian conversion for v1.0

2014-11-27 Thread Michael S. Tsirkin
We (ab)use virtio conversion functions for device-specific config space accesses. Based on original patches by Cornelia and Rusty. Signed-off-by: Rusty Russell ru...@rustcorp.com.au Signed-off-by: Cornelia Huck cornelia.h...@de.ibm.com Signed-off-by: Michael S. Tsirkin m...@redhat.com ---

[PATCH v5 08/45] virtio_ring: switch to new memory access APIs

2014-11-27 Thread Michael S. Tsirkin
Use virtioXX_to_cpu and friends for access to all multibyte structures in memory. Note: this is intentionally mechanical. A follow-up patch will split long lines etc. Signed-off-by: Michael S. Tsirkin m...@redhat.com --- drivers/virtio/virtio_ring.c | 89

[PATCH v5 11/45] virtio: set FEATURES_OK

2014-11-27 Thread Michael S. Tsirkin
set FEATURES_OK as per virtio 1.0 spec Signed-off-by: Michael S. Tsirkin m...@redhat.com --- include/uapi/linux/virtio_config.h | 2 ++ drivers/virtio/virtio.c| 29 ++--- 2 files changed, 24 insertions(+), 7 deletions(-) diff --git

[PATCH v5 10/45] virtio: allow transports to get avail/used addresses

2014-11-27 Thread Michael S. Tsirkin
From: Cornelia Huck cornelia.h...@de.ibm.com For virtio-1, we can theoretically have a more complex virtqueue layout with avail and used buffers not on a contiguous memory area with the descriptor table. For now, it's fine for a transport driver to stay with the old layout: It needs, however, a

[PATCH v5 13/45] virtio: add legacy feature table support

2014-11-27 Thread Michael S. Tsirkin
virtio-blk has some legacy feature bits that modern drivers must not negotiate, but are needed for old legacy hosts (that e.g. don't support virtio-scsi). Allow a separate legacy feature table for such cases. Signed-off-by: Michael S. Tsirkin m...@redhat.com --- include/linux/virtio.h | 4

[PATCH v5 12/45] virtio: simplify feature bit handling

2014-11-27 Thread Michael S. Tsirkin
Now that we use u64 for bits, we can simply them together. Signed-off-by: Michael S. Tsirkin m...@redhat.com --- drivers/virtio/virtio.c | 10 ++ 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/virtio/virtio.c b/drivers/virtio/virtio.c index 6faa014..498bded 100644

[PATCH v5 15/45] virtio_blk: v1.0 support

2014-11-27 Thread Michael S. Tsirkin
Based on patch by Cornelia Huck. Note: for consistency, and to avoid sparse errors, convert all fields, even those no longer in use for virtio v1.0. Signed-off-by: Cornelia Huck cornelia.h...@de.ibm.com Signed-off-by: Michael S. Tsirkin m...@redhat.com ---

[PATCH v5 14/45] virtio_net: v1.0 endianness

2014-11-27 Thread Michael S. Tsirkin
Based on patches by Rusty Russell, Cornelia Huck. Note: more code changes are needed for 1.0 support (due to different header size). So we don't advertize support for 1.0 yet. Signed-off-by: Rusty Russell ru...@rustcorp.com.au Signed-off-by: Cornelia Huck cornelia.h...@de.ibm.com Signed-off-by:

[PATCH v5 20/45] virtio_blk: make serial attribute static

2014-11-27 Thread Michael S. Tsirkin
It's never declared so no need to make it extern. Signed-off-by: Michael S. Tsirkin m...@redhat.com --- drivers/block/virtio_blk.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c index f601f16..055f3df 100644 ---

[PATCH v5 23/45] virtio_net: get rid of virtio_net_hdr/skb_vnet_hdr

2014-11-27 Thread Michael S. Tsirkin
virtio 1.0 doesn't use virtio_net_hdr anymore, and in fact, it's not really useful since virtio_net_hdr_mrg_rxbuf includes that as the first field anyway. Let's drop it, precalculate header len and store within vi instead. This way we can also remove struct skb_vnet_hdr. Signed-off-by: Michael

[PATCH v5 22/45] virtio_net: pass vi around

2014-11-27 Thread Michael S. Tsirkin
Too many places poke at [rs]q-vq-vdev-priv just to get the vi structure. Let's just pass the pointer around: seems cleaner, and might even be faster. Signed-off-by: Michael S. Tsirkin m...@redhat.com Reviewed-by: Cornelia Huck cornelia.h...@de.ibm.com --- drivers/net/virtio_net.c | 38

[PATCH v5 21/45] virtio_blk: fix race at module removal

2014-11-27 Thread Michael S. Tsirkin
If a device appears while module is being removed, driver will get a callback after we've given up on the major number. In theory this means this major number can get reused by something else, resulting in a conflict. Signed-off-by: Michael S. Tsirkin m...@redhat.com ---

[PATCH v5 25/45] virtio_net: bigger header when VERSION_1 is set

2014-11-27 Thread Michael S. Tsirkin
With VERSION_1 virtio_net uses same header size whether mergeable buffers are enabled or not. Signed-off-by: Michael S. Tsirkin m...@redhat.com Reviewed-by: Cornelia Huck cornelia.h...@de.ibm.com --- drivers/net/virtio_net.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git

[PATCH v5 24/45] virtio_net: stricter short buffer length checks

2014-11-27 Thread Michael S. Tsirkin
Our buffer length check is not strict enough for mergeable buffers: buffer can still be shorter that header + address by 2 bytes. Fix that up. Signed-off-by: Michael S. Tsirkin m...@redhat.com Reviewed-by: Cornelia Huck cornelia.h...@de.ibm.com --- drivers/net/virtio_net.c | 2 +- 1 file

[PATCH v5 26/45] virtio_net: enable v1.0 support

2014-11-27 Thread Michael S. Tsirkin
Now that we have completed 1.0 support, enable it in our driver. Signed-off-by: Michael S. Tsirkin m...@redhat.com --- drivers/net/virtio_net.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index a0e64cf..c6a72d3 100644 ---

[PATCH v5 27/45] vhost: make features 64 bit

2014-11-27 Thread Michael S. Tsirkin
We need to use bit 32 for virtio 1.0 Signed-off-by: Michael S. Tsirkin m...@redhat.com --- drivers/vhost/vhost.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/vhost/vhost.h b/drivers/vhost/vhost.h index 3eda654..c624b09 100644 --- a/drivers/vhost/vhost.h +++

[PATCH v5 29/45] vhost/net: force len for TX to host endian

2014-11-27 Thread Michael S. Tsirkin
vhost/net keeps a copy of some used ring but (ab)uses length field for internal house-keeping. This works because for tx used length is always 0. Suppress sparse errors: we use native endian-ness internally but never expose it to guest. Signed-off-by: Michael S. Tsirkin m...@redhat.com ---

[PATCH v5 30/45] vhost: virtio 1.0 endian-ness support

2014-11-27 Thread Michael S. Tsirkin
Signed-off-by: Michael S. Tsirkin m...@redhat.com --- drivers/vhost/vhost.c | 93 +++ 1 file changed, 56 insertions(+), 37 deletions(-) diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c index c90f437..4d379ed 100644 ---

[PATCH v5 33/45] virtio_net: disable mac write for virtio 1.0

2014-11-27 Thread Michael S. Tsirkin
The spec states that mac in config space is only driver-writable in the legacy case. Fence writing it in virtnet_set_mac_address() in the virtio 1.0 case. Suggested-by: Cornelia Huck cornelia.h...@de.ibm.com Signed-off-by: Michael S. Tsirkin m...@redhat.com --- drivers/net/virtio_net.c | 3 ++-

[PATCH v5 34/45] vhost/net: enable virtio 1.0

2014-11-27 Thread Michael S. Tsirkin
Signed-off-by: Michael S. Tsirkin m...@redhat.com --- drivers/vhost/net.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c index 1ac58d0..984242e 100644 --- a/drivers/vhost/net.c +++ b/drivers/vhost/net.c @@ -61,7 +61,8 @@

[PATCH v5 35/45] vhost/net: suppress compiler warning

2014-11-27 Thread Michael S. Tsirkin
len is always initialized since function is called with size 0. Signed-off-by: Michael S. Tsirkin m...@redhat.com --- drivers/vhost/net.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c index 984242e..54ffbb0 100644 ---

[PATCH v5 41/45] virtio_scsi: v1.0 support

2014-11-27 Thread Michael 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 m...@redhat.com Acked-by: Paolo Bonzini pbonz...@redhat.com --- include/linux/virtio_scsi.h | 32 +++-

[PATCH v5 44/45] vhost/scsi: partial virtio 1.0 support

2014-11-27 Thread Michael 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 m...@redhat.com Acked-by: Paolo Bonzini pbonz...@redhat.com --- drivers/vhost/scsi.c | 22 -- 1

[PATCH v5 43/45] virtio_scsi: export to userspace

2014-11-27 Thread Michael 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 m...@redhat.com Acked-by: Paolo Bonzini pbonz...@redhat.com --- include/uapi/linux/virtio_scsi.h | 74

[PATCH RFC v4 00/16] qemu: towards virtio-1 host support

2014-11-27 Thread Cornelia Huck
Yet another version of the virtio-1 support patches. This one has seen some (very) light testing with the virtio-1 guest support patches currently on vhost-next. Changes from v3: - Add support for FEATURES_OK. We refuse to set features after the driver has set this in the status field, and we

[PATCH RFC v4 01/16] linux-headers/virtio_config: Update with VIRTIO_F_VERSION_1

2014-11-27 Thread Cornelia Huck
From: Thomas Huth th...@linux.vnet.ibm.com Add the new VIRTIO_F_VERSION_1 definition to the virtio_config.h linux header. Signed-off-by: Thomas Huth th...@linux.vnet.ibm.com Signed-off-by: Cornelia Huck cornelia.h...@de.ibm.com --- linux-headers/linux/virtio_config.h |3 +++ 1 file changed,

[PATCH RFC v4 02/16] virtio: cull virtio_bus_set_vdev_features

2014-11-27 Thread Cornelia Huck
The only user of this function was virtio-ccw, and it should use virtio_set_features() like everybody else: We need to make sure that bad features are masked out properly, which this function did not do. Reviewed-by: Thomas Huth th...@linux.vnet.ibm.com Signed-off-by: Cornelia Huck

[PATCH RFC v4 04/16] s390x/virtio-ccw: fix check for WRITE_FEAT

2014-11-27 Thread Cornelia Huck
We need to check guest feature size, not host feature size to find out whether we should call virtio_set_features(). This check is possible now that vdev-guest_features is an array. Reviewed-by: Thomas Huth th...@linux.vnet.ibm.com Signed-off-by: Cornelia Huck cornelia.h...@de.ibm.com ---

[PATCH RFC v4 09/16] s390x/virtio-ccw: add virtio set-revision call

2014-11-27 Thread Cornelia Huck
From: Thomas Huth th...@linux.vnet.ibm.com Handle the virtio-ccw revision according to what the guest sets. When revision 1 is selected, we have a virtio-1 standard device with byteswapping for the virtio rings. When a channel gets disabled, we have to revert to the legacy behavior in case the

[PATCH RFC v4 11/16] virtio: disallow late feature changes for virtio-1

2014-11-27 Thread Cornelia Huck
For virtio-1 devices, the driver must not attempt to set feature bits after it set FEATURES_OK in the device status. Simply reject it in that case. Signed-off-by: Cornelia Huck cornelia.h...@de.ibm.com --- hw/virtio/virtio.c | 17 +++-- include/hw/virtio/virtio.h |2 ++

[PATCH RFC v4 12/16] virtio: allow to fail setting status

2014-11-27 Thread Cornelia Huck
virtio-1 allow setting of the FEATURES_OK status bit to fail if the negotiated feature bits are inconsistent: let's fail virtio_set_status() in that case and update virtio-ccw to post an error to the guest. Signed-off-by: Cornelia Huck cornelia.h...@de.ibm.com --- hw/s390x/virtio-ccw.c |

[PATCH RFC v4 07/16] dataplane: allow virtio-1 devices

2014-11-27 Thread Cornelia Huck
Handle endianness conversion for virtio-1 virtqueues correctly. Note that dataplane now needs to be built per-target. Signed-off-by: Cornelia Huck cornelia.h...@de.ibm.com --- hw/block/dataplane/virtio-blk.c |4 +- hw/scsi/virtio-scsi-dataplane.c |2 +-

[PATCH RFC v4 08/16] s390x/css: Add a callback for when subchannel gets disabled

2014-11-27 Thread Cornelia Huck
From: Thomas Huth th...@linux.vnet.ibm.com We need a possibility to run code when a subchannel gets disabled. This patch adds the necessary infrastructure. Signed-off-by: Thomas Huth th...@linux.vnet.ibm.com Signed-off-by: Cornelia Huck cornelia.h...@de.ibm.com --- hw/s390x/css.c | 12

[PATCH RFC v4 14/16] virtio-net: no writeable mac for virtio-1

2014-11-27 Thread Cornelia Huck
Devices operating as virtio 1.0 may not allow writes to the mac address in config space. Signed-off-by: Cornelia Huck cornelia.h...@de.ibm.com --- hw/net/virtio-net.c |1 + 1 file changed, 1 insertion(+) diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index 1e214b5..ad477bf 100644

[PATCH RFC v4 15/16] virtio-net: support longer header

2014-11-27 Thread Cornelia Huck
virtio-1 devices always use num_buffers in the header, even if mergeable rx buffers have not been negotiated. Signed-off-by: Cornelia Huck cornelia.h...@de.ibm.com --- hw/net/virtio-net.c |9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/hw/net/virtio-net.c

[PATCH RFC v4 13/16] s390x/virtio-ccw: enable virtio 1.0

2014-11-27 Thread Cornelia Huck
virtio-ccw should now have everything in place to operate virtio 1.0 devices, so let's enable revision 1. Signed-off-by: Cornelia Huck cornelia.h...@de.ibm.com --- hw/s390x/virtio-ccw.h |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/s390x/virtio-ccw.h

Re: [PATCH RFC v4 00/16] qemu: towards virtio-1 host support

2014-11-27 Thread Michael S. Tsirkin
On Thu, Nov 27, 2014 at 04:16:33PM +0100, Cornelia Huck wrote: Yet another version of the virtio-1 support patches. This one has seen some (very) light testing with the virtio-1 guest support patches currently on vhost-next. Changes from v3: - Add support for FEATURES_OK. We refuse to

Re: [PATCH RFC v4 00/16] qemu: towards virtio-1 host support

2014-11-27 Thread Cornelia Huck
On Thu, 27 Nov 2014 17:24:22 +0200 Michael S. Tsirkin m...@redhat.com wrote: On Thu, Nov 27, 2014 at 04:16:33PM +0100, Cornelia Huck wrote: Yet another version of the virtio-1 support patches. This one has seen some (very) light testing with the virtio-1 guest support patches currently

Re: [PATCH RFC v4 03/16] virtio: support more feature bits

2014-11-27 Thread Michael S. Tsirkin
On Thu, Nov 27, 2014 at 04:16:36PM +0100, Cornelia Huck wrote: With virtio-1, we support more than 32 feature bits. Let's make vdev-guest_features depend on the number of supported feature bits, allowing us to grow the feature bits automatically. We also need to enhance the internal

Re: [PATCH RFC v4 03/16] virtio: support more feature bits

2014-11-27 Thread Cornelia Huck
On Thu, 27 Nov 2014 17:34:19 +0200 Michael S. Tsirkin m...@redhat.com wrote: On Thu, Nov 27, 2014 at 04:16:36PM +0100, Cornelia Huck wrote: With virtio-1, we support more than 32 feature bits. Let's make vdev-guest_features depend on the number of supported feature bits, allowing us to

Re: [PATCH RFC v4 00/16] qemu: towards virtio-1 host support

2014-11-27 Thread Michael S. Tsirkin
On Thu, Nov 27, 2014 at 04:31:39PM +0100, Cornelia Huck wrote: On Thu, 27 Nov 2014 17:24:22 +0200 Michael S. Tsirkin m...@redhat.com wrote: On Thu, Nov 27, 2014 at 04:16:33PM +0100, Cornelia Huck wrote: Yet another version of the virtio-1 support patches. This one has seen some

Re: [PATCH RFC v4 03/16] virtio: support more feature bits

2014-11-27 Thread Michael S. Tsirkin
On Thu, Nov 27, 2014 at 04:40:29PM +0100, Cornelia Huck wrote: On Thu, 27 Nov 2014 17:34:19 +0200 Michael S. Tsirkin m...@redhat.com wrote: On Thu, Nov 27, 2014 at 04:16:36PM +0100, Cornelia Huck wrote: With virtio-1, we support more than 32 feature bits. Let's make vdev-guest_features

Re: [PATCH RFC v4 00/16] qemu: towards virtio-1 host support

2014-11-27 Thread Cornelia Huck
On Thu, 27 Nov 2014 17:42:11 +0200 Michael S. Tsirkin m...@redhat.com wrote: On Thu, Nov 27, 2014 at 04:31:39PM +0100, Cornelia Huck wrote: On Thu, 27 Nov 2014 17:24:22 +0200 Michael S. Tsirkin m...@redhat.com wrote: On Thu, Nov 27, 2014 at 04:16:33PM +0100, Cornelia Huck wrote:

Re: [PATCH v5 01/45] virtio: use u32, not bitmap for struct virtio_device's features

2014-11-27 Thread David Hildenbrand
From: Rusty Russell ru...@rustcorp.com.au It seemed like a good idea, but it's actually a pain when we get more than 32 feature bits. Just change it to a u32 for now. Cc: Brian Swetland swetl...@google.com Cc: Christian Borntraeger borntrae...@de.ibm.com Signed-off-by: Rusty Russell

Re: [PATCH RFC v4 00/16] qemu: towards virtio-1 host support

2014-11-27 Thread Michael S. Tsirkin
On Thu, Nov 27, 2014 at 05:06:51PM +0100, Cornelia Huck wrote: On Thu, 27 Nov 2014 17:42:11 +0200 Michael S. Tsirkin m...@redhat.com wrote: On Thu, Nov 27, 2014 at 04:31:39PM +0100, Cornelia Huck wrote: On Thu, 27 Nov 2014 17:24:22 +0200 Michael S. Tsirkin m...@redhat.com wrote:

Re: [PATCH v5 01/45] virtio: use u32, not bitmap for struct virtio_device's features

2014-11-27 Thread Michael S. Tsirkin
On Thu, Nov 27, 2014 at 05:15:42PM +0100, David Hildenbrand wrote: From: Rusty Russell ru...@rustcorp.com.au It seemed like a good idea, but it's actually a pain when we get more than 32 feature bits. Just change it to a u32 for now. Cc: Brian Swetland swetl...@google.com Cc:

Re: [PATCH RFC v4 00/16] qemu: towards virtio-1 host support

2014-11-27 Thread Cornelia Huck
On Thu, 27 Nov 2014 18:18:25 +0200 Michael S. Tsirkin m...@redhat.com wrote: On Thu, Nov 27, 2014 at 05:06:51PM +0100, Cornelia Huck wrote: So we should have a per-device callback into the transport layer, say check_legacy()? I would just have 2 masks: legacy_features and features. But

Re: [PATCH v5 01/45] virtio: use u32, not bitmap for struct virtio_device's features

2014-11-27 Thread David Hildenbrand
That's the whole reason for the patch. I guess you disagree with it, but it's much easier to deal with simple integers. Well, I can live with it :) clear_bit() and friends are just easier to understand when scanning the code (at least for me).

Re: [PATCH RFC v4 00/16] qemu: towards virtio-1 host support

2014-11-27 Thread Michael S. Tsirkin
On Thu, Nov 27, 2014 at 05:28:42PM +0100, Cornelia Huck wrote: On Thu, 27 Nov 2014 18:18:25 +0200 Michael S. Tsirkin m...@redhat.com wrote: On Thu, Nov 27, 2014 at 05:06:51PM +0100, Cornelia Huck wrote: So we should have a per-device callback into the transport layer, say

Re: [PATCH RFC v4 00/16] qemu: towards virtio-1 host support

2014-11-27 Thread Michael S. Tsirkin
On Thu, Nov 27, 2014 at 05:28:42PM +0100, Cornelia Huck wrote: On Thu, 27 Nov 2014 18:18:25 +0200 Michael S. Tsirkin m...@redhat.com wrote: On Thu, Nov 27, 2014 at 05:06:51PM +0100, Cornelia Huck wrote: So we should have a per-device callback into the transport layer, say

Re: [PATCH v3 26/41] vhost: virtio 1.0 endian-ness support

2014-11-27 Thread Cedric Le Goater
Hi Michael, Do you have a tree from where I could pull these patches ? Thanks, C. On 11/24/2014 12:54 PM, Michael S. Tsirkin wrote: Signed-off-by: Michael S. Tsirkin m...@redhat.com --- drivers/vhost/vhost.c | 93 +++ 1 file changed, 56

[PATCH v6 02/46] virtio: use u32, not bitmap for features

2014-11-27 Thread Michael S. Tsirkin
It seemed like a good idea to use bitmap for features in struct virtio_device, but it's actually a pain, and seems to become even more painful when we get more than 32 feature bits. Just change it to a u32 for now. Based on patch by Rusty. Suggested-by: David Hildenbrand d...@linux.vnet.ibm.com

[PATCH v6 01/46] virtio: add low-level APIs for feature bits

2014-11-27 Thread Michael S. Tsirkin
Add low level APIs to test/set/clear feature bits. For use by transports, to make it easier to write code independent of feature bit array format. Signed-off-by: Michael S. Tsirkin m...@redhat.com --- include/linux/virtio_config.h | 53 --- 1 file changed,

[PATCH v6 07/46] virtio: add virtio 1.0 feature bit

2014-11-27 Thread Michael S. Tsirkin
Based on original patches by Rusty Russell, Thomas Huth and Cornelia Huck. Note: at this time, we do not negotiate this feature bit in core, drivers have to declare VERSION_1 support explicitly. For this reason we treat this bit as a device bit and not as a transport bit for now. After all

[PATCH v6 04/46] virtio: add support for 64 bit features.

2014-11-27 Thread Michael S. Tsirkin
Change u32 to u64, and use BIT_ULL and 1ULL everywhere. Note: transports are unchanged, and only set low 32 bit. This guarantees that no transport sets e.g. VERSION_1 by mistake without proper support. Based on patch by Rusty. Signed-off-by: Rusty Russell ru...@rustcorp.com.au Signed-off-by:

[PATCH v6 10/46] virtio_config: endian conversion for v1.0

2014-11-27 Thread Michael S. Tsirkin
We (ab)use virtio conversion functions for device-specific config space accesses. Based on original patches by Cornelia and Rusty. Signed-off-by: Rusty Russell ru...@rustcorp.com.au Signed-off-by: Cornelia Huck cornelia.h...@de.ibm.com Signed-off-by: Michael S. Tsirkin m...@redhat.com ---

[PATCH v6 08/46] virtio: memory access APIs

2014-11-27 Thread Michael S. Tsirkin
virtio 1.0 makes all memory structures LE, so we need APIs to conditionally do a byteswap on BE architectures. To make it easier to check code statically, add virtio specific types for multi-byte integers in memory. Add low level wrappers that do a byteswap conditionally, these will be useful

[PATCH v6 11/46] virtio: allow transports to get avail/used addresses

2014-11-27 Thread Michael S. Tsirkin
From: Cornelia Huck cornelia.h...@de.ibm.com For virtio-1, we can theoretically have a more complex virtqueue layout with avail and used buffers not on a contiguous memory area with the descriptor table. For now, it's fine for a transport driver to stay with the old layout: It needs, however, a

[PATCH v6 13/46] virtio: simplify feature bit handling

2014-11-27 Thread Michael S. Tsirkin
Now that we use u64 for bits, we can simply them together. Signed-off-by: Michael S. Tsirkin m...@redhat.com --- drivers/virtio/virtio.c | 10 ++ 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/virtio/virtio.c b/drivers/virtio/virtio.c index 9248125..3e78f4b 100644

[PATCH v6 12/46] virtio: set FEATURES_OK

2014-11-27 Thread Michael S. Tsirkin
set FEATURES_OK as per virtio 1.0 spec Signed-off-by: Michael S. Tsirkin m...@redhat.com --- include/uapi/linux/virtio_config.h | 2 ++ drivers/virtio/virtio.c| 29 ++--- 2 files changed, 24 insertions(+), 7 deletions(-) diff --git

[PATCH v6 15/46] virtio_net: v1.0 endianness

2014-11-27 Thread Michael S. Tsirkin
Based on patches by Rusty Russell, Cornelia Huck. Note: more code changes are needed for 1.0 support (due to different header size). So we don't advertize support for 1.0 yet. Signed-off-by: Rusty Russell ru...@rustcorp.com.au Signed-off-by: Cornelia Huck cornelia.h...@de.ibm.com Signed-off-by:

[PATCH v6 14/46] virtio: add legacy feature table support

2014-11-27 Thread Michael S. Tsirkin
virtio-blk has some legacy feature bits that modern drivers must not negotiate, but are needed for old legacy hosts (that e.g. don't support virtio-scsi). Allow a separate legacy feature table for such cases. Signed-off-by: Michael S. Tsirkin m...@redhat.com --- include/linux/virtio.h | 4

[PATCH v6 16/46] virtio_blk: v1.0 support

2014-11-27 Thread Michael S. Tsirkin
Based on patch by Cornelia Huck. Note: for consistency, and to avoid sparse errors, convert all fields, even those no longer in use for virtio v1.0. Signed-off-by: Cornelia Huck cornelia.h...@de.ibm.com Signed-off-by: Michael S. Tsirkin m...@redhat.com ---

[PATCH v6 21/46] virtio_blk: make serial attribute static

2014-11-27 Thread Michael S. Tsirkin
It's never declared so no need to make it extern. Signed-off-by: Michael S. Tsirkin m...@redhat.com --- drivers/block/virtio_blk.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c index f601f16..055f3df 100644 ---

[PATCH v6 22/46] virtio_blk: fix race at module removal

2014-11-27 Thread Michael S. Tsirkin
If a device appears while module is being removed, driver will get a callback after we've given up on the major number. In theory this means this major number can get reused by something else, resulting in a conflict. Signed-off-by: Michael S. Tsirkin m...@redhat.com ---

[PATCH v6 23/46] virtio_net: pass vi around

2014-11-27 Thread Michael S. Tsirkin
Too many places poke at [rs]q-vq-vdev-priv just to get the vi structure. Let's just pass the pointer around: seems cleaner, and might even be faster. Signed-off-by: Michael S. Tsirkin m...@redhat.com Reviewed-by: Cornelia Huck cornelia.h...@de.ibm.com --- drivers/net/virtio_net.c | 38

[PATCH v6 26/46] virtio_net: bigger header when VERSION_1 is set

2014-11-27 Thread Michael S. Tsirkin
With VERSION_1 virtio_net uses same header size whether mergeable buffers are enabled or not. Signed-off-by: Michael S. Tsirkin m...@redhat.com Reviewed-by: Cornelia Huck cornelia.h...@de.ibm.com --- drivers/net/virtio_net.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git

[PATCH v6 28/46] vhost: make features 64 bit

2014-11-27 Thread Michael S. Tsirkin
We need to use bit 32 for virtio 1.0 Signed-off-by: Michael S. Tsirkin m...@redhat.com --- drivers/vhost/vhost.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/vhost/vhost.h b/drivers/vhost/vhost.h index 3eda654..c624b09 100644 --- a/drivers/vhost/vhost.h +++

[PATCH v6 29/46] vhost: add memory access wrappers

2014-11-27 Thread Michael S. Tsirkin
Add guest memory access wrappers to handle virtio endianness conversions. Signed-off-by: Michael S. Tsirkin m...@redhat.com --- drivers/vhost/vhost.h | 31 +++ 1 file changed, 31 insertions(+) diff --git a/drivers/vhost/vhost.h b/drivers/vhost/vhost.h index

[PATCH v6 30/46] vhost/net: force len for TX to host endian

2014-11-27 Thread Michael S. Tsirkin
vhost/net keeps a copy of some used ring but (ab)uses length field for internal house-keeping. This works because for tx used length is always 0. Suppress sparse errors: we use native endian-ness internally but never expose it to guest. Signed-off-by: Michael S. Tsirkin m...@redhat.com ---

[PATCH v6 32/46] vhost/net: virtio 1.0 byte swap

2014-11-27 Thread Michael S. Tsirkin
Signed-off-by: Michael S. Tsirkin m...@redhat.com --- drivers/vhost/net.c | 12 +++- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c index dce5c58..cae22f9 100644 --- a/drivers/vhost/net.c +++ b/drivers/vhost/net.c @@ -416,7 +416,7

[PATCH v6 34/46] virtio_net: disable mac write for virtio 1.0

2014-11-27 Thread Michael S. Tsirkin
The spec states that mac in config space is only driver-writable in the legacy case. Fence writing it in virtnet_set_mac_address() in the virtio 1.0 case. Suggested-by: Cornelia Huck cornelia.h...@de.ibm.com Signed-off-by: Michael S. Tsirkin m...@redhat.com --- drivers/net/virtio_net.c | 3 ++-

[PATCH v6 31/46] vhost: virtio 1.0 endian-ness support

2014-11-27 Thread Michael S. Tsirkin
Signed-off-by: Michael S. Tsirkin m...@redhat.com --- drivers/vhost/vhost.c | 93 +++ 1 file changed, 56 insertions(+), 37 deletions(-) diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c index c90f437..4d379ed 100644 ---

[PATCH v6 33/46] vhost/net: larger header for virtio 1.0

2014-11-27 Thread Michael S. Tsirkin
Signed-off-by: Michael S. Tsirkin m...@redhat.com --- drivers/vhost/net.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c index cae22f9..1ac58d0 100644 --- a/drivers/vhost/net.c +++ b/drivers/vhost/net.c @@ -1027,7 +1027,8 @@ static

[PATCH v6 35/46] vhost/net: enable virtio 1.0

2014-11-27 Thread Michael S. Tsirkin
Signed-off-by: Michael S. Tsirkin m...@redhat.com --- drivers/vhost/net.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c index 1ac58d0..984242e 100644 --- a/drivers/vhost/net.c +++ b/drivers/vhost/net.c @@ -61,7 +61,8 @@

[PATCH v6 36/46] vhost/net: suppress compiler warning

2014-11-27 Thread Michael S. Tsirkin
len is always initialized since function is called with size 0. Signed-off-by: Michael S. Tsirkin m...@redhat.com --- drivers/vhost/net.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c index 984242e..54ffbb0 100644 ---

[PATCH v6 44/46] virtio_scsi: export to userspace

2014-11-27 Thread Michael 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 m...@redhat.com Acked-by: Paolo Bonzini pbonz...@redhat.com --- include/uapi/linux/virtio_scsi.h | 74

[PATCH v6 45/46] vhost/scsi: partial virtio 1.0 support

2014-11-27 Thread Michael 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 m...@redhat.com Acked-by: Paolo Bonzini pbonz...@redhat.com --- drivers/vhost/scsi.c | 22 -- 1

[PATCH v6 42/46] virtio_scsi: v1.0 support

2014-11-27 Thread Michael 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 m...@redhat.com Acked-by: Paolo Bonzini pbonz...@redhat.com --- include/linux/virtio_scsi.h | 32 +++-