[PATCH RFC v2 02/12] virtio: cull virtio_bus_set_vdev_features

2014-11-25 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 v2 00/12] qemu: towards virtio-1 host support

2014-11-25 Thread Cornelia Huck
Hi, here's the next version of my virtio-1 qemu patchset. Using virtio-1 virtio-blk and virtio-net devices with a guest kernel built from 1416829787-14252-1-git-send-email-...@redhat.com still seems to work for the virtio-ccw transport. Changes from v1: - rebased against current master - don't

[PATCH RFC v2 04/12] s390x/virtio-ccw: fix check for WRITE_FEAT

2014-11-25 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 v2 03/12] virtio: support more feature bits

2014-11-25 Thread Cornelia Huck
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 functions dealing with getting and setting features with an additional index

[PATCH RFC v2 06/12] virtio: allow virtio-1 queue layout

2014-11-25 Thread Cornelia Huck
For virtio-1 devices, we allow a more complex queue layout that doesn't require descriptor table and rings on a physically-contigous memory area: add virtio_queue_set_rings() to allow transports to set this up. Signed-off-by: Cornelia Huck cornelia.h...@de.ibm.com --- hw/virtio/virtio.c

[PATCH RFC v2 05/12] virtio: introduce legacy virtio devices

2014-11-25 Thread Cornelia Huck
Introduce a helper function to indicate whether a virtio device is operating in legacy or virtio standard mode. It may be used to make decisions about the endianess of virtio accesses and other virtio-1 specific changes, enabling us to support transitional devices. Reviewed-by: Thomas Huth

[PATCH RFC v2 07/12] dataplane: allow virtio-1 devices

2014-11-25 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 |3 +- hw/scsi/virtio-scsi-dataplane.c |2 +- hw/virtio/Makefile.objs

[PATCH RFC v2 12/12] s390x/virtio-ccw: enable virtio 1.0

2014-11-25 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

[PATCH RFC v2 09/12] s390x/virtio-ccw: add virtio set-revision call

2014-11-25 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 v2 11/12] virtio-net/virtio-blk: enable virtio 1.0

2014-11-25 Thread Cornelia Huck
virtio-net (non-vhost) and virtio-blk have everything in place to support virtio 1.0: let's enable the feature bit for them. Note that VIRTIO_F_VERSION_1 is technically a transport feature; once every device is ready for virtio 1.0, we can move this setting this feature bit out of the individual

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

2014-11-25 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 v4 03/42] virtio: add virtio 1.0 feature bit

2014-11-25 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 v4 04/42] virtio: disable virtio 1.0 in transports

2014-11-25 Thread Michael S. Tsirkin
disable virtio 1.0 in transports that don't support it yet. We will gradually re-enable as support is added. Signed-off-by: Michael S. Tsirkin m...@redhat.com --- drivers/lguest/lguest_device.c | 3 ++- drivers/misc/mic/card/mic_virtio.c | 2 ++ drivers/s390/kvm/virtio_ccw.c | 3 ++-

[PATCH v4 06/42] virtio_ring: switch to new memory access APIs

2014-11-25 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 v4 02/42] virtio: add support for 64 bit features.

2014-11-25 Thread Michael S. Tsirkin
From: Rusty Russell ru...@rustcorp.com.au Change the u32 to a u64, and make sure to use 1ULL everywhere! Cc: Brian Swetland swetl...@google.com Cc: Christian Borntraeger borntrae...@de.ibm.com [Thomas Huth: fix up virtio-ccw get_features] Signed-off-by: Rusty Russell ru...@rustcorp.com.au

[PATCH v4 18/42] virtio_blk: make serial attribute static

2014-11-25 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 v4 12/42] virtio_net: v1.0 endianness

2014-11-25 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 v4 08/42] virtio: allow transports to get avail/used addresses

2014-11-25 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 v4 10/42] virtio: simplify feature bit handling

2014-11-25 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 a3df817..0f44cff 100644

[PATCH v4 05/42] virtio: memory access APIs

2014-11-25 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 v4 13/42] virtio_blk: v1.0 support

2014-11-25 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. Reviewed-by: Thomas Huth th...@linux.vnet.ibm.com Reviewed-by: David Hildenbrand d...@linux.vnet.ibm.com Signed-off-by: Cornelia Huck

[PATCH v4 22/42] virtio_net: stricter short buffer length checks

2014-11-25 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 --- drivers/net/virtio_net.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git

[PATCH v4 19/42] virtio_blk: fix race at module removal

2014-11-25 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 v4 20/42] virtio_net: pass vi around

2014-11-25 Thread Michael S. Tsirkin
Too many places poke at [rs]q-vq-vdev-priv just to get the 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 --- drivers/net/virtio_net.c | 38 -- 1 file changed,

[PATCH v4 24/42] virtio_net: enable v1.0 support

2014-11-25 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 v4 26/42] vhost/net: force len for TX to host endian

2014-11-25 Thread Michael S. Tsirkin
We use native endian-ness internally but never expose it to guest. Signed-off-by: Michael S. Tsirkin m...@redhat.com --- drivers/vhost/net.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c index 8dae2f7..dce5c58 100644 ---

[PATCH v4 25/42] vhost: add memory access wrappers

2014-11-25 Thread Michael S. Tsirkin
Signed-off-by: Michael S. Tsirkin m...@redhat.com --- drivers/vhost/vhost.h | 33 - 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/drivers/vhost/vhost.h b/drivers/vhost/vhost.h index 3eda654..b9032e8 100644 --- a/drivers/vhost/vhost.h +++

[PATCH v4 30/42] vhost/net: larger header for virtio 1.0

2014-11-25 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 v4 27/42] vhost: virtio 1.0 endian-ness support

2014-11-25 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 v4 41/42] vhost/scsi: partial virtio 1.0 support

2014-11-25 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 --- drivers/vhost/scsi.c | 22 -- 1 file changed, 12 insertions(+), 10 deletions(-)

[PATCH v4 40/42] virtio_scsi: export to userspace

2014-11-25 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 --- include/uapi/linux/virtio_scsi.h | 74 include/uapi/linux/Kbuild| 1 + 2 files changed,

Re: [PATCH RFC v2 00/12] qemu: towards virtio-1 host support

2014-11-25 Thread Michael S. Tsirkin
On Tue, Nov 25, 2014 at 02:24:11PM +0100, Cornelia Huck wrote: Hi, here's the next version of my virtio-1 qemu patchset. Using virtio-1 virtio-blk and virtio-net devices with a guest kernel built from 1416829787-14252-1-git-send-email-...@redhat.com still seems to work for the virtio-ccw

[PATCH v4 29/42] vhost/net: virtio 1.0 byte swap

2014-11-25 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 v4 28/42] vhost: make features 64 bit

2014-11-25 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 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/vhost/vhost.h b/drivers/vhost/vhost.h index b9032e8..1f321fd 100644 --- a/drivers/vhost/vhost.h +++

Re: [PATCH RFC v2 00/12] qemu: towards virtio-1 host support

2014-11-25 Thread Cornelia Huck
On Tue, 25 Nov 2014 18:44:10 +0200 Michael S. Tsirkin m...@redhat.com wrote: On Tue, Nov 25, 2014 at 02:24:11PM +0100, Cornelia Huck wrote: Hi, here's the next version of my virtio-1 qemu patchset. Using virtio-1 virtio-blk and virtio-net devices with a guest kernel built from

[PATCH v4 23/42] virtio_net: bigger header when VERSION_1 is set

2014-11-25 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 --- drivers/net/virtio_net.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c

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

2014-11-25 Thread Cornelia Huck
On Tue, 25 Nov 2014 18:41:35 +0200 Michael S. Tsirkin m...@redhat.com wrote: disable virtio 1.0 in transports that don't support it yet. I'd prefer if you disabled it for _every_ transport in this patch, until the needed infrastructure is in place. Else this is a bit confusing. We will

Re: [PATCH v4 09/42] virtio: set FEATURES_OK

2014-11-25 Thread Cornelia Huck
On Tue, 25 Nov 2014 18:42:01 +0200 Michael S. Tsirkin m...@redhat.com wrote: 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

Re: [PATCH v4 11/42] virtio: add legacy feature table support

2014-11-25 Thread Cornelia Huck
On Tue, 25 Nov 2014 18:42:09 +0200 Michael S. Tsirkin m...@redhat.com wrote: virtio blk has some legacy feature bits that modern drivers virtio-blk must not negotiate, but are needed for old legacy hosts (e.g. that dn't support virtio scsi). (that e.g. don't support virtio-scsi) Allow a

Re: [PATCH v4 13/42] virtio_blk: v1.0 support

2014-11-25 Thread Cornelia Huck
On Tue, 25 Nov 2014 18:42:18 +0200 Michael S. Tsirkin m...@redhat.com wrote: 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. Reviewed-by: Thomas Huth th...@linux.vnet.ibm.com

Re: [PATCH RFC v2 07/12] dataplane: allow virtio-1 devices

2014-11-25 Thread Greg Kurz
On Tue, 25 Nov 2014 14:24:18 +0100 Cornelia Huck cornelia.h...@de.ibm.com wrote: 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 --- We still have the same error as

Re: [PATCH RFC v2 07/12] dataplane: allow virtio-1 devices

2014-11-25 Thread Cornelia Huck
On Tue, 25 Nov 2014 18:55:56 +0100 Greg Kurz gk...@linux.vnet.ibm.com wrote: On Tue, 25 Nov 2014 14:24:18 +0100 Cornelia Huck cornelia.h...@de.ibm.com wrote: Handle endianness conversion for virtio-1 virtqueues correctly. Note that dataplane now needs to be built per-target.

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

2014-11-25 Thread Michael S. Tsirkin
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: disable virtio 1.0 in transports that don't support it yet. I'd prefer if you disabled it for _every_ transport in this patch, until the needed

Re: [PATCH v4 07/42] virtio_config: endian conversion for v1.0

2014-11-25 Thread Michael S. Tsirkin
On Tue, Nov 25, 2014 at 06:45:57PM +0100, Cornelia Huck wrote: On Tue, 25 Nov 2014 18:41:52 +0200 Michael S. Tsirkin m...@redhat.com wrote: We (ab)use virtio conversion functions for device-specific config space accesses. Reviewed-by: David Hildenbrand d...@linux.vnet.ibm.com

Re: [PATCH v12 09/11] pvqspinlock, x86: Add para-virtualization support

2014-11-25 Thread Waiman Long
On 10/27/2014 02:02 PM, Konrad Rzeszutek Wilk wrote: On Mon, Oct 27, 2014 at 01:38:20PM -0400, Waiman Long wrote: My concern is that spin_unlock() can be called in many places, including loadable kernel modules. Can the paravirt_patch_ident_32() function able to patch all of them in reasonable

Re: [PATCH 1/2] virito: introduce methods of fixing device features

2014-11-25 Thread Rusty Russell
Jason Wang jasow...@redhat.com writes: Buggy host may advertised buggy host features (a usual case is that host advertise a feature whose dependencies were missed). In this case, driver should detect and disable the buggy features by itself. Sorry, I've been focussing elsewhere. I would

Re: [PATCH 1/2] virito: introduce methods of fixing device features

2014-11-25 Thread Jason Wang
- Original Message - Jason Wang jasow...@redhat.com writes: Buggy host may advertised buggy host features (a usual case is that host advertise a feature whose dependencies were missed). In this case, driver should detect and disable the buggy features by itself. Sorry, I've