* [PATCH v6 02/46] virtio: use u32, not bitmap for features
[not found] <1417118789-18231-1-git-send-email-mst@redhat.com>
@ 2014-11-27 20:07 ` Michael S. Tsirkin
2014-11-28 12:44 ` Cornelia Huck
2014-11-27 20:07 ` [PATCH v6 04/46] virtio: add support for 64 bit features Michael S. Tsirkin
` (6 subsequent siblings)
7 siblings, 1 reply; 17+ messages in thread
From: Michael S. Tsirkin @ 2014-11-27 20:07 UTC (permalink / raw)
To: linux-kernel
Cc: David Miller, cornelia.huck, rusty, nab, pbonzini, thuth, dahi,
Rusty Russell, Arnd Bergmann, Greg Kroah-Hartman, Amit Shah,
Ohad Ben-Cohen, Christian Borntraeger, linux390,
Martin Schwidefsky, Heiko Carstens, Ashutosh Dixit, Nikhil Rao,
Siva Yerramreddy, Joel Stanley, virtualization, lguest,
linux-s390
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 <dahi@linux.vnet.ibm.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
include/linux/virtio.h | 3 +--
include/linux/virtio_config.h | 6 +++---
tools/virtio/linux/virtio.h | 22 +---------------------
tools/virtio/linux/virtio_config.h | 2 +-
drivers/char/virtio_console.c | 2 +-
drivers/lguest/lguest_device.c | 8 ++++----
drivers/misc/mic/card/mic_virtio.c | 2 +-
drivers/remoteproc/remoteproc_virtio.c | 2 +-
drivers/s390/kvm/kvm_virtio.c | 2 +-
drivers/s390/kvm/virtio_ccw.c | 23 +++++++++--------------
drivers/virtio/virtio.c | 10 +++++-----
drivers/virtio/virtio_mmio.c | 8 ++------
drivers/virtio/virtio_pci.c | 3 +--
drivers/virtio/virtio_ring.c | 2 +-
tools/virtio/virtio_test.c | 5 ++---
tools/virtio/vringh_test.c | 16 ++++++++--------
16 files changed, 42 insertions(+), 74 deletions(-)
diff --git a/include/linux/virtio.h b/include/linux/virtio.h
index 65261a7..7828a7f 100644
--- a/include/linux/virtio.h
+++ b/include/linux/virtio.h
@@ -101,8 +101,7 @@ struct virtio_device {
const struct virtio_config_ops *config;
const struct vringh_config_ops *vringh_config;
struct list_head vqs;
- /* Note that this is a Linux set_bit-style bitmap. */
- unsigned long features[1];
+ u32 features;
void *priv;
};
diff --git a/include/linux/virtio_config.h b/include/linux/virtio_config.h
index 249fcd6..1761106 100644
--- a/include/linux/virtio_config.h
+++ b/include/linux/virtio_config.h
@@ -92,7 +92,7 @@ static inline bool __virtio_test_bit(const struct virtio_device *vdev,
else
BUG_ON(fbit >= 32);
- return test_bit(fbit, vdev->features);
+ return vdev->features & BIT(fbit);
}
/**
@@ -109,7 +109,7 @@ static inline void __virtio_set_bit(struct virtio_device *vdev,
else
BUG_ON(fbit >= 32);
- set_bit(fbit, vdev->features);
+ vdev->features |= BIT(fbit);
}
/**
@@ -126,7 +126,7 @@ static inline void __virtio_clear_bit(struct virtio_device *vdev,
else
BUG_ON(fbit >= 32);
- clear_bit(fbit, vdev->features);
+ vdev->features &= ~BIT(fbit);
}
/**
diff --git a/tools/virtio/linux/virtio.h b/tools/virtio/linux/virtio.h
index 5a2d1f0..72bff70 100644
--- a/tools/virtio/linux/virtio.h
+++ b/tools/virtio/linux/virtio.h
@@ -6,31 +6,11 @@
/* TODO: empty stubs for now. Broken but enough for virtio_ring.c */
#define list_add_tail(a, b) do {} while (0)
#define list_del(a) do {} while (0)
-
-#define BIT_WORD(nr) ((nr) / BITS_PER_LONG)
-#define BITS_PER_BYTE 8
-#define BITS_PER_LONG (sizeof(long) * BITS_PER_BYTE)
-#define BIT_MASK(nr) (1UL << ((nr) % BITS_PER_LONG))
-
-/* TODO: Not atomic as it should be:
- * we don't use this for anything important. */
-static inline void clear_bit(int nr, volatile unsigned long *addr)
-{
- unsigned long mask = BIT_MASK(nr);
- unsigned long *p = ((unsigned long *)addr) + BIT_WORD(nr);
-
- *p &= ~mask;
-}
-
-static inline int test_bit(int nr, const volatile unsigned long *addr)
-{
- return 1UL & (addr[BIT_WORD(nr)] >> (nr & (BITS_PER_LONG-1)));
-}
/* end of stubs */
struct virtio_device {
void *dev;
- unsigned long features[1];
+ u32 features;
};
struct virtqueue {
diff --git a/tools/virtio/linux/virtio_config.h b/tools/virtio/linux/virtio_config.h
index 5049967..83b27e8 100644
--- a/tools/virtio/linux/virtio_config.h
+++ b/tools/virtio/linux/virtio_config.h
@@ -2,5 +2,5 @@
#define VIRTIO_TRANSPORT_F_END 32
#define virtio_has_feature(dev, feature) \
- test_bit((feature), (dev)->features)
+ (__virtio_test_bit((dev), feature))
diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c
index cf7a561..8d00aa7 100644
--- a/drivers/char/virtio_console.c
+++ b/drivers/char/virtio_console.c
@@ -355,7 +355,7 @@ static inline bool use_multiport(struct ports_device *portdev)
*/
if (!portdev->vdev)
return 0;
- return portdev->vdev->features[0] & (1 << VIRTIO_CONSOLE_F_MULTIPORT);
+ return __virtio_test_bit(portdev->vdev, VIRTIO_CONSOLE_F_MULTIPORT);
}
static DEFINE_SPINLOCK(dma_bufs_lock);
diff --git a/drivers/lguest/lguest_device.c b/drivers/lguest/lguest_device.c
index d0a1d8a..97aeb7d 100644
--- a/drivers/lguest/lguest_device.c
+++ b/drivers/lguest/lguest_device.c
@@ -137,14 +137,14 @@ static void lg_finalize_features(struct virtio_device *vdev)
vring_transport_features(vdev);
/*
- * The vdev->feature array is a Linux bitmask: this isn't the same as a
- * the simple array of bits used by lguest devices for features. So we
- * do this slow, manual conversion which is completely general.
+ * Since lguest is currently x86-only, we're little-endian. That
+ * means we could just memcpy. But it's not time critical, and in
+ * case someone copies this code, we do it the slow, obvious way.
*/
memset(out_features, 0, desc->feature_len);
bits = min_t(unsigned, desc->feature_len, sizeof(vdev->features)) * 8;
for (i = 0; i < bits; i++) {
- if (test_bit(i, vdev->features))
+ if (__virtio_test_bit(vdev, i))
out_features[i / 8] |= (1 << (i % 8));
}
diff --git a/drivers/misc/mic/card/mic_virtio.c b/drivers/misc/mic/card/mic_virtio.c
index e647947..4f070ad 100644
--- a/drivers/misc/mic/card/mic_virtio.c
+++ b/drivers/misc/mic/card/mic_virtio.c
@@ -101,7 +101,7 @@ static void mic_finalize_features(struct virtio_device *vdev)
bits = min_t(unsigned, feature_len,
sizeof(vdev->features)) * 8;
for (i = 0; i < bits; i++) {
- if (test_bit(i, vdev->features))
+ if (__virtio_test_bit(vdev, i))
iowrite8(ioread8(&out_features[i / 8]) | (1 << (i % 8)),
&out_features[i / 8]);
}
diff --git a/drivers/remoteproc/remoteproc_virtio.c b/drivers/remoteproc/remoteproc_virtio.c
index a34b506..dafaf38 100644
--- a/drivers/remoteproc/remoteproc_virtio.c
+++ b/drivers/remoteproc/remoteproc_virtio.c
@@ -231,7 +231,7 @@ static void rproc_virtio_finalize_features(struct virtio_device *vdev)
* Remember the finalized features of our vdev, and provide it
* to the remote processor once it is powered on.
*/
- rsc->gfeatures = vdev->features[0];
+ rsc->gfeatures = vdev->features;
}
static void rproc_virtio_get(struct virtio_device *vdev, unsigned offset,
diff --git a/drivers/s390/kvm/kvm_virtio.c b/drivers/s390/kvm/kvm_virtio.c
index 6431290..fcd312d 100644
--- a/drivers/s390/kvm/kvm_virtio.c
+++ b/drivers/s390/kvm/kvm_virtio.c
@@ -106,7 +106,7 @@ static void kvm_finalize_features(struct virtio_device *vdev)
memset(out_features, 0, desc->feature_len);
bits = min_t(unsigned, desc->feature_len, sizeof(vdev->features)) * 8;
for (i = 0; i < bits; i++) {
- if (test_bit(i, vdev->features))
+ if (__virtio_test_bit(vdev, i))
out_features[i / 8] |= (1 << (i % 8));
}
}
diff --git a/drivers/s390/kvm/virtio_ccw.c b/drivers/s390/kvm/virtio_ccw.c
index bda52f1..1dbee95 100644
--- a/drivers/s390/kvm/virtio_ccw.c
+++ b/drivers/s390/kvm/virtio_ccw.c
@@ -701,7 +701,6 @@ static void virtio_ccw_finalize_features(struct virtio_device *vdev)
{
struct virtio_ccw_device *vcdev = to_vc_device(vdev);
struct virtio_feature_desc *features;
- int i;
struct ccw1 *ccw;
ccw = kzalloc(sizeof(*ccw), GFP_DMA | GFP_KERNEL);
@@ -715,19 +714,15 @@ static void virtio_ccw_finalize_features(struct virtio_device *vdev)
/* Give virtio_ring a chance to accept features. */
vring_transport_features(vdev);
- for (i = 0; i < sizeof(*vdev->features) / sizeof(features->features);
- i++) {
- int highbits = i % 2 ? 32 : 0;
- features->index = i;
- features->features = cpu_to_le32(vdev->features[i / 2]
- >> highbits);
- /* Write the feature bits to the host. */
- ccw->cmd_code = CCW_CMD_WRITE_FEAT;
- ccw->flags = 0;
- ccw->count = sizeof(*features);
- ccw->cda = (__u32)(unsigned long)features;
- ccw_io_helper(vcdev, ccw, VIRTIO_CCW_DOING_WRITE_FEAT);
- }
+ features->index = 0;
+ features->features = cpu_to_le32(vdev->features);
+ /* Write the feature bits to the host. */
+ ccw->cmd_code = CCW_CMD_WRITE_FEAT;
+ ccw->flags = 0;
+ ccw->count = sizeof(*features);
+ ccw->cda = (__u32)(unsigned long)features;
+ ccw_io_helper(vcdev, ccw, VIRTIO_CCW_DOING_WRITE_FEAT);
+
out_free:
kfree(features);
kfree(ccw);
diff --git a/drivers/virtio/virtio.c b/drivers/virtio/virtio.c
index df598dd..2b9aafb 100644
--- a/drivers/virtio/virtio.c
+++ b/drivers/virtio/virtio.c
@@ -49,9 +49,9 @@ static ssize_t features_show(struct device *_d,
/* We actually represent this as a bitstring, as it could be
* arbitrary length in future. */
- for (i = 0; i < ARRAY_SIZE(dev->features)*BITS_PER_LONG; i++)
+ for (i = 0; i < sizeof(dev->features)*8; i++)
len += sprintf(buf+len, "%c",
- test_bit(i, dev->features) ? '1' : '0');
+ __virtio_test_bit(dev, i) ? '1' : '0');
len += sprintf(buf+len, "\n");
return len;
}
@@ -168,18 +168,18 @@ static int virtio_dev_probe(struct device *_d)
device_features = dev->config->get_features(dev);
/* Features supported by both device and driver into dev->features. */
- memset(dev->features, 0, sizeof(dev->features));
+ dev->features = 0;
for (i = 0; i < drv->feature_table_size; i++) {
unsigned int f = drv->feature_table[i];
BUG_ON(f >= 32);
if (device_features & (1 << f))
- set_bit(f, dev->features);
+ __virtio_set_bit(dev, f);
}
/* Transport features always preserved to pass to finalize_features. */
for (i = VIRTIO_TRANSPORT_F_START; i < VIRTIO_TRANSPORT_F_END; i++)
if (device_features & (1 << i))
- set_bit(i, dev->features);
+ __virtio_set_bit(dev, i);
dev->config->finalize_features(dev);
diff --git a/drivers/virtio/virtio_mmio.c b/drivers/virtio/virtio_mmio.c
index ef9a165..eb5b0e2 100644
--- a/drivers/virtio/virtio_mmio.c
+++ b/drivers/virtio/virtio_mmio.c
@@ -155,16 +155,12 @@ static u32 vm_get_features(struct virtio_device *vdev)
static void vm_finalize_features(struct virtio_device *vdev)
{
struct virtio_mmio_device *vm_dev = to_virtio_mmio_device(vdev);
- int i;
/* Give virtio_ring a chance to accept features. */
vring_transport_features(vdev);
- for (i = 0; i < ARRAY_SIZE(vdev->features); i++) {
- writel(i, vm_dev->base + VIRTIO_MMIO_GUEST_FEATURES_SEL);
- writel(vdev->features[i],
- vm_dev->base + VIRTIO_MMIO_GUEST_FEATURES);
- }
+ writel(0, vm_dev->base + VIRTIO_MMIO_GUEST_FEATURES_SEL);
+ writel(vdev->features, vm_dev->base + VIRTIO_MMIO_GUEST_FEATURES);
}
static void vm_get(struct virtio_device *vdev, unsigned offset,
diff --git a/drivers/virtio/virtio_pci.c b/drivers/virtio/virtio_pci.c
index d34ebfa..ab95a4c 100644
--- a/drivers/virtio/virtio_pci.c
+++ b/drivers/virtio/virtio_pci.c
@@ -120,8 +120,7 @@ static void vp_finalize_features(struct virtio_device *vdev)
vring_transport_features(vdev);
/* We only support 32 feature bits. */
- BUILD_BUG_ON(ARRAY_SIZE(vdev->features) != 1);
- iowrite32(vdev->features[0], vp_dev->ioaddr+VIRTIO_PCI_GUEST_FEATURES);
+ iowrite32(vdev->features, vp_dev->ioaddr+VIRTIO_PCI_GUEST_FEATURES);
}
/* virtio config->get() implementation */
diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
index 3b1f89b..839247c 100644
--- a/drivers/virtio/virtio_ring.c
+++ b/drivers/virtio/virtio_ring.c
@@ -781,7 +781,7 @@ void vring_transport_features(struct virtio_device *vdev)
break;
default:
/* We don't understand this bit. */
- clear_bit(i, vdev->features);
+ __virtio_clear_bit(vdev, i);
}
}
}
diff --git a/tools/virtio/virtio_test.c b/tools/virtio/virtio_test.c
index 00ea679..db3437c 100644
--- a/tools/virtio/virtio_test.c
+++ b/tools/virtio/virtio_test.c
@@ -60,7 +60,7 @@ void vhost_vq_setup(struct vdev_info *dev, struct vq_info *info)
{
struct vhost_vring_state state = { .index = info->idx };
struct vhost_vring_file file = { .index = info->idx };
- unsigned long long features = dev->vdev.features[0];
+ unsigned long long features = dev->vdev.features;
struct vhost_vring_addr addr = {
.index = info->idx,
.desc_user_addr = (uint64_t)(unsigned long)info->vring.desc,
@@ -113,8 +113,7 @@ static void vdev_info_init(struct vdev_info* dev, unsigned long long features)
{
int r;
memset(dev, 0, sizeof *dev);
- dev->vdev.features[0] = features;
- dev->vdev.features[1] = features >> 32;
+ dev->vdev.features = features;
dev->buf_size = 1024;
dev->buf = malloc(dev->buf_size);
assert(dev->buf);
diff --git a/tools/virtio/vringh_test.c b/tools/virtio/vringh_test.c
index 14a4f4c..9d4b1bc 100644
--- a/tools/virtio/vringh_test.c
+++ b/tools/virtio/vringh_test.c
@@ -304,7 +304,7 @@ static int parallel_test(unsigned long features,
close(to_guest[1]);
close(to_host[0]);
- gvdev.vdev.features[0] = features;
+ gvdev.vdev.features = features;
gvdev.to_host_fd = to_host[1];
gvdev.notifies = 0;
@@ -449,13 +449,13 @@ int main(int argc, char *argv[])
bool fast_vringh = false, parallel = false;
getrange = getrange_iov;
- vdev.features[0] = 0;
+ vdev.features = 0;
while (argv[1]) {
if (strcmp(argv[1], "--indirect") == 0)
- vdev.features[0] |= (1 << VIRTIO_RING_F_INDIRECT_DESC);
+ __virtio_set_bit(&vdev, VIRTIO_RING_F_INDIRECT_DESC);
else if (strcmp(argv[1], "--eventidx") == 0)
- vdev.features[0] |= (1 << VIRTIO_RING_F_EVENT_IDX);
+ __virtio_set_bit(&vdev, VIRTIO_RING_F_EVENT_IDX);
else if (strcmp(argv[1], "--slow-range") == 0)
getrange = getrange_slow;
else if (strcmp(argv[1], "--fast-vringh") == 0)
@@ -468,7 +468,7 @@ int main(int argc, char *argv[])
}
if (parallel)
- return parallel_test(vdev.features[0], getrange, fast_vringh);
+ return parallel_test(vdev.features, getrange, fast_vringh);
if (posix_memalign(&__user_addr_min, PAGE_SIZE, USER_MEM) != 0)
abort();
@@ -483,7 +483,7 @@ int main(int argc, char *argv[])
/* Set up host side. */
vring_init(&vrh.vring, RINGSIZE, __user_addr_min, ALIGN);
- vringh_init_user(&vrh, vdev.features[0], RINGSIZE, true,
+ vringh_init_user(&vrh, vdev.features, RINGSIZE, true,
vrh.vring.desc, vrh.vring.avail, vrh.vring.used);
/* No descriptor to get yet... */
@@ -652,13 +652,13 @@ int main(int argc, char *argv[])
}
/* Test weird (but legal!) indirect. */
- if (vdev.features[0] & (1 << VIRTIO_RING_F_INDIRECT_DESC)) {
+ if (__virtio_test_bit(&vdev, VIRTIO_RING_F_INDIRECT_DESC)) {
char *data = __user_addr_max - USER_MEM/4;
struct vring_desc *d = __user_addr_max - USER_MEM/2;
struct vring vring;
/* Force creation of direct, which we modify. */
- vdev.features[0] &= ~(1 << VIRTIO_RING_F_INDIRECT_DESC);
+ __virtio_clear_bit(&vdev, VIRTIO_RING_F_INDIRECT_DESC);
vq = vring_new_virtqueue(0, RINGSIZE, ALIGN, &vdev, true,
__user_addr_min,
never_notify_host,
--
MST
^ permalink raw reply related [flat|nested] 17+ messages in thread* Re: [PATCH v6 02/46] virtio: use u32, not bitmap for features
2014-11-27 20:07 ` [PATCH v6 02/46] virtio: use u32, not bitmap for features Michael S. Tsirkin
@ 2014-11-28 12:44 ` Cornelia Huck
2014-11-29 17:34 ` Michael S. Tsirkin
0 siblings, 1 reply; 17+ messages in thread
From: Cornelia Huck @ 2014-11-28 12:44 UTC (permalink / raw)
To: Michael S. Tsirkin
Cc: linux-kernel, David Miller, rusty, nab, pbonzini, thuth, dahi,
Rusty Russell, Arnd Bergmann, Greg Kroah-Hartman, Amit Shah,
Ohad Ben-Cohen, Christian Borntraeger, linux390,
Martin Schwidefsky, Heiko Carstens, Ashutosh Dixit, Nikhil Rao,
Siva Yerramreddy, Joel Stanley, virtualization, lguest,
linux-s390
On Thu, 27 Nov 2014 22:07:41 +0200
"Michael S. Tsirkin" <mst@redhat.com> wrote:
> 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 <dahi@linux.vnet.ibm.com>
> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> diff --git a/drivers/virtio/virtio_pci.c b/drivers/virtio/virtio_pci.c
> index d34ebfa..ab95a4c 100644
> --- a/drivers/virtio/virtio_pci.c
> +++ b/drivers/virtio/virtio_pci.c
> @@ -120,8 +120,7 @@ static void vp_finalize_features(struct virtio_device *vdev)
> vring_transport_features(vdev);
>
> /* We only support 32 feature bits. */
I think you can kill this comment...
> - BUILD_BUG_ON(ARRAY_SIZE(vdev->features) != 1);
> - iowrite32(vdev->features[0], vp_dev->ioaddr+VIRTIO_PCI_GUEST_FEATURES);
> + iowrite32(vdev->features, vp_dev->ioaddr+VIRTIO_PCI_GUEST_FEATURES);
...and add blanks around '+', as you're touching this line anyway.
> }
>
> /* virtio config->get() implementation */
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v6 02/46] virtio: use u32, not bitmap for features
2014-11-28 12:44 ` Cornelia Huck
@ 2014-11-29 17:34 ` Michael S. Tsirkin
0 siblings, 0 replies; 17+ messages in thread
From: Michael S. Tsirkin @ 2014-11-29 17:34 UTC (permalink / raw)
To: Cornelia Huck
Cc: linux-kernel, David Miller, rusty, nab, pbonzini, thuth, dahi,
Rusty Russell, Arnd Bergmann, Greg Kroah-Hartman, Amit Shah,
Ohad Ben-Cohen, Christian Borntraeger, linux390,
Martin Schwidefsky, Heiko Carstens, Ashutosh Dixit, Nikhil Rao,
Siva Yerramreddy, Joel Stanley, virtualization, lguest,
linux-s390
On Fri, Nov 28, 2014 at 01:44:57PM +0100, Cornelia Huck wrote:
> On Thu, 27 Nov 2014 22:07:41 +0200
> "Michael S. Tsirkin" <mst@redhat.com> wrote:
>
> > 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 <dahi@linux.vnet.ibm.com>
> > Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
> > Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
> > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
>
> > diff --git a/drivers/virtio/virtio_pci.c b/drivers/virtio/virtio_pci.c
> > index d34ebfa..ab95a4c 100644
> > --- a/drivers/virtio/virtio_pci.c
> > +++ b/drivers/virtio/virtio_pci.c
> > @@ -120,8 +120,7 @@ static void vp_finalize_features(struct virtio_device *vdev)
> > vring_transport_features(vdev);
> >
> > /* We only support 32 feature bits. */
>
> I think you can kill this comment...
Why? It's still true for virtio pci at this point, that's why we
just do iowrite32 here.
> > - BUILD_BUG_ON(ARRAY_SIZE(vdev->features) != 1);
> > - iowrite32(vdev->features[0], vp_dev->ioaddr+VIRTIO_PCI_GUEST_FEATURES);
> > + iowrite32(vdev->features, vp_dev->ioaddr+VIRTIO_PCI_GUEST_FEATURES);
>
> ...and add blanks around '+', as you're touching this line anyway.
>
> > }
> >
> > /* virtio config->get() implementation */
>
> Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH v6 04/46] virtio: add support for 64 bit features.
[not found] <1417118789-18231-1-git-send-email-mst@redhat.com>
2014-11-27 20:07 ` [PATCH v6 02/46] virtio: use u32, not bitmap for features Michael S. Tsirkin
@ 2014-11-27 20:07 ` Michael S. Tsirkin
2014-11-28 8:52 ` David Hildenbrand
2014-11-28 12:47 ` Cornelia Huck
2014-11-27 20:08 ` [PATCH v6 05/46] virtio: assert 32 bit features in transports Michael S. Tsirkin
` (5 subsequent siblings)
7 siblings, 2 replies; 17+ messages in thread
From: Michael S. Tsirkin @ 2014-11-27 20:07 UTC (permalink / raw)
To: linux-kernel
Cc: David Miller, cornelia.huck, rusty, nab, pbonzini, thuth, dahi,
Rusty Russell, Ohad Ben-Cohen, Christian Borntraeger, linux390,
Martin Schwidefsky, Heiko Carstens, Greg Kroah-Hartman,
Siva Yerramreddy, Joel Stanley, lguest, linux-s390,
virtualization
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 <rusty@rustcorp.com.au>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
include/linux/virtio.h | 2 +-
include/linux/virtio_config.h | 20 ++++++++++----------
tools/virtio/linux/virtio.h | 2 +-
drivers/lguest/lguest_device.c | 2 +-
drivers/misc/mic/card/mic_virtio.c | 2 +-
drivers/remoteproc/remoteproc_virtio.c | 2 +-
drivers/s390/kvm/kvm_virtio.c | 2 +-
drivers/s390/kvm/virtio_ccw.c | 2 +-
drivers/virtio/virtio.c | 8 ++++----
drivers/virtio/virtio_mmio.c | 2 +-
drivers/virtio/virtio_pci.c | 2 +-
11 files changed, 23 insertions(+), 23 deletions(-)
diff --git a/include/linux/virtio.h b/include/linux/virtio.h
index 7828a7f..149284e 100644
--- a/include/linux/virtio.h
+++ b/include/linux/virtio.h
@@ -101,7 +101,7 @@ struct virtio_device {
const struct virtio_config_ops *config;
const struct vringh_config_ops *vringh_config;
struct list_head vqs;
- u32 features;
+ u64 features;
void *priv;
};
diff --git a/include/linux/virtio_config.h b/include/linux/virtio_config.h
index 1761106..b465c3f 100644
--- a/include/linux/virtio_config.h
+++ b/include/linux/virtio_config.h
@@ -66,7 +66,7 @@ struct virtio_config_ops {
vq_callback_t *callbacks[],
const char *names[]);
void (*del_vqs)(struct virtio_device *);
- u32 (*get_features)(struct virtio_device *vdev);
+ u64 (*get_features)(struct virtio_device *vdev);
void (*finalize_features)(struct virtio_device *vdev);
const char *(*bus_name)(struct virtio_device *vdev);
int (*set_vq_affinity)(struct virtqueue *vq, int cpu);
@@ -88,11 +88,11 @@ static inline bool __virtio_test_bit(const struct virtio_device *vdev,
{
/* Did you forget to fix assumptions on max features? */
if (__builtin_constant_p(fbit))
- BUILD_BUG_ON(fbit >= 32);
+ BUILD_BUG_ON(fbit >= 64);
else
- BUG_ON(fbit >= 32);
+ BUG_ON(fbit >= 64);
- return vdev->features & BIT(fbit);
+ return vdev->features & BIT_ULL(fbit);
}
/**
@@ -105,11 +105,11 @@ static inline void __virtio_set_bit(struct virtio_device *vdev,
{
/* Did you forget to fix assumptions on max features? */
if (__builtin_constant_p(fbit))
- BUILD_BUG_ON(fbit >= 32);
+ BUILD_BUG_ON(fbit >= 64);
else
- BUG_ON(fbit >= 32);
+ BUG_ON(fbit >= 64);
- vdev->features |= BIT(fbit);
+ vdev->features |= BIT_ULL(fbit);
}
/**
@@ -122,11 +122,11 @@ static inline void __virtio_clear_bit(struct virtio_device *vdev,
{
/* Did you forget to fix assumptions on max features? */
if (__builtin_constant_p(fbit))
- BUILD_BUG_ON(fbit >= 32);
+ BUILD_BUG_ON(fbit >= 64);
else
- BUG_ON(fbit >= 32);
+ BUG_ON(fbit >= 64);
- vdev->features &= ~BIT(fbit);
+ vdev->features &= ~BIT_ULL(fbit);
}
/**
diff --git a/tools/virtio/linux/virtio.h b/tools/virtio/linux/virtio.h
index 72bff70..8eb6421 100644
--- a/tools/virtio/linux/virtio.h
+++ b/tools/virtio/linux/virtio.h
@@ -10,7 +10,7 @@
struct virtio_device {
void *dev;
- u32 features;
+ u64 features;
};
struct virtqueue {
diff --git a/drivers/lguest/lguest_device.c b/drivers/lguest/lguest_device.c
index 97aeb7d..d81170a 100644
--- a/drivers/lguest/lguest_device.c
+++ b/drivers/lguest/lguest_device.c
@@ -94,7 +94,7 @@ static unsigned desc_size(const struct lguest_device_desc *desc)
}
/* This gets the device's feature bits. */
-static u32 lg_get_features(struct virtio_device *vdev)
+static u64 lg_get_features(struct virtio_device *vdev)
{
unsigned int i;
u32 features = 0;
diff --git a/drivers/misc/mic/card/mic_virtio.c b/drivers/misc/mic/card/mic_virtio.c
index d5da9ff..f5e7561 100644
--- a/drivers/misc/mic/card/mic_virtio.c
+++ b/drivers/misc/mic/card/mic_virtio.c
@@ -68,7 +68,7 @@ static inline struct device *mic_dev(struct mic_vdev *mvdev)
}
/* This gets the device's feature bits. */
-static u32 mic_get_features(struct virtio_device *vdev)
+static u64 mic_get_features(struct virtio_device *vdev)
{
unsigned int i, bits;
u32 features = 0;
diff --git a/drivers/remoteproc/remoteproc_virtio.c b/drivers/remoteproc/remoteproc_virtio.c
index dafaf38..62897db 100644
--- a/drivers/remoteproc/remoteproc_virtio.c
+++ b/drivers/remoteproc/remoteproc_virtio.c
@@ -207,7 +207,7 @@ static void rproc_virtio_reset(struct virtio_device *vdev)
}
/* provide the vdev features as retrieved from the firmware */
-static u32 rproc_virtio_get_features(struct virtio_device *vdev)
+static u64 rproc_virtio_get_features(struct virtio_device *vdev)
{
struct rproc_vdev *rvdev = vdev_to_rvdev(vdev);
struct fw_rsc_vdev *rsc;
diff --git a/drivers/s390/kvm/kvm_virtio.c b/drivers/s390/kvm/kvm_virtio.c
index fcd312d..2336c7e 100644
--- a/drivers/s390/kvm/kvm_virtio.c
+++ b/drivers/s390/kvm/kvm_virtio.c
@@ -80,7 +80,7 @@ static unsigned desc_size(const struct kvm_device_desc *desc)
}
/* This gets the device's feature bits. */
-static u32 kvm_get_features(struct virtio_device *vdev)
+static u64 kvm_get_features(struct virtio_device *vdev)
{
unsigned int i;
u32 features = 0;
diff --git a/drivers/s390/kvm/virtio_ccw.c b/drivers/s390/kvm/virtio_ccw.c
index 1dbee95..56d7895 100644
--- a/drivers/s390/kvm/virtio_ccw.c
+++ b/drivers/s390/kvm/virtio_ccw.c
@@ -660,7 +660,7 @@ static void virtio_ccw_reset(struct virtio_device *vdev)
kfree(ccw);
}
-static u32 virtio_ccw_get_features(struct virtio_device *vdev)
+static u64 virtio_ccw_get_features(struct virtio_device *vdev)
{
struct virtio_ccw_device *vcdev = to_vc_device(vdev);
struct virtio_feature_desc *features;
diff --git a/drivers/virtio/virtio.c b/drivers/virtio/virtio.c
index 2b9aafb..746d350 100644
--- a/drivers/virtio/virtio.c
+++ b/drivers/virtio/virtio.c
@@ -159,7 +159,7 @@ static int virtio_dev_probe(struct device *_d)
int err, i;
struct virtio_device *dev = dev_to_virtio(_d);
struct virtio_driver *drv = drv_to_virtio(dev->dev.driver);
- u32 device_features;
+ u64 device_features;
/* We have a driver! */
add_status(dev, VIRTIO_CONFIG_S_DRIVER);
@@ -171,14 +171,14 @@ static int virtio_dev_probe(struct device *_d)
dev->features = 0;
for (i = 0; i < drv->feature_table_size; i++) {
unsigned int f = drv->feature_table[i];
- BUG_ON(f >= 32);
- if (device_features & (1 << f))
+ BUG_ON(f >= 64);
+ if (device_features & (1ULL << f))
__virtio_set_bit(dev, f);
}
/* Transport features always preserved to pass to finalize_features. */
for (i = VIRTIO_TRANSPORT_F_START; i < VIRTIO_TRANSPORT_F_END; i++)
- if (device_features & (1 << i))
+ if (device_features & (1ULL << i))
__virtio_set_bit(dev, i);
dev->config->finalize_features(dev);
diff --git a/drivers/virtio/virtio_mmio.c b/drivers/virtio/virtio_mmio.c
index eb5b0e2..c63d0ef 100644
--- a/drivers/virtio/virtio_mmio.c
+++ b/drivers/virtio/virtio_mmio.c
@@ -142,7 +142,7 @@ struct virtio_mmio_vq_info {
/* Configuration interface */
-static u32 vm_get_features(struct virtio_device *vdev)
+static u64 vm_get_features(struct virtio_device *vdev)
{
struct virtio_mmio_device *vm_dev = to_virtio_mmio_device(vdev);
diff --git a/drivers/virtio/virtio_pci.c b/drivers/virtio/virtio_pci.c
index ab95a4c..80be24a 100644
--- a/drivers/virtio/virtio_pci.c
+++ b/drivers/virtio/virtio_pci.c
@@ -102,7 +102,7 @@ static struct virtio_pci_device *to_vp_device(struct virtio_device *vdev)
}
/* virtio config->get_features() implementation */
-static u32 vp_get_features(struct virtio_device *vdev)
+static u64 vp_get_features(struct virtio_device *vdev)
{
struct virtio_pci_device *vp_dev = to_vp_device(vdev);
--
MST
^ permalink raw reply related [flat|nested] 17+ messages in thread* Re: [PATCH v6 04/46] virtio: add support for 64 bit features.
2014-11-27 20:07 ` [PATCH v6 04/46] virtio: add support for 64 bit features Michael S. Tsirkin
@ 2014-11-28 8:52 ` David Hildenbrand
2014-11-28 12:47 ` Cornelia Huck
1 sibling, 0 replies; 17+ messages in thread
From: David Hildenbrand @ 2014-11-28 8:52 UTC (permalink / raw)
To: Michael S. Tsirkin
Cc: linux-kernel, David Miller, cornelia.huck, rusty, nab, pbonzini,
thuth, Rusty Russell, Ohad Ben-Cohen, Christian Borntraeger,
linux390, Martin Schwidefsky, Heiko Carstens, Greg Kroah-Hartman,
Siva Yerramreddy, Joel Stanley, lguest, linux-s390,
virtualization
> 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 <rusty@rustcorp.com.au>
> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---
Reviewed-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v6 04/46] virtio: add support for 64 bit features.
2014-11-27 20:07 ` [PATCH v6 04/46] virtio: add support for 64 bit features Michael S. Tsirkin
2014-11-28 8:52 ` David Hildenbrand
@ 2014-11-28 12:47 ` Cornelia Huck
1 sibling, 0 replies; 17+ messages in thread
From: Cornelia Huck @ 2014-11-28 12:47 UTC (permalink / raw)
To: Michael S. Tsirkin
Cc: linux-kernel, David Miller, rusty, nab, pbonzini, thuth, dahi,
Rusty Russell, Ohad Ben-Cohen, Christian Borntraeger, linux390,
Martin Schwidefsky, Heiko Carstens, Greg Kroah-Hartman,
Siva Yerramreddy, Joel Stanley, lguest, linux-s390,
virtualization
On Thu, 27 Nov 2014 22:07:55 +0200
"Michael S. Tsirkin" <mst@redhat.com> wrote:
> 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 <rusty@rustcorp.com.au>
> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---
> include/linux/virtio.h | 2 +-
> include/linux/virtio_config.h | 20 ++++++++++----------
> tools/virtio/linux/virtio.h | 2 +-
> drivers/lguest/lguest_device.c | 2 +-
> drivers/misc/mic/card/mic_virtio.c | 2 +-
> drivers/remoteproc/remoteproc_virtio.c | 2 +-
> drivers/s390/kvm/kvm_virtio.c | 2 +-
> drivers/s390/kvm/virtio_ccw.c | 2 +-
> drivers/virtio/virtio.c | 8 ++++----
> drivers/virtio/virtio_mmio.c | 2 +-
> drivers/virtio/virtio_pci.c | 2 +-
> 11 files changed, 23 insertions(+), 23 deletions(-)
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH v6 05/46] virtio: assert 32 bit features in transports
[not found] <1417118789-18231-1-git-send-email-mst@redhat.com>
2014-11-27 20:07 ` [PATCH v6 02/46] virtio: use u32, not bitmap for features Michael S. Tsirkin
2014-11-27 20:07 ` [PATCH v6 04/46] virtio: add support for 64 bit features Michael S. Tsirkin
@ 2014-11-27 20:08 ` Michael S. Tsirkin
2014-11-28 8:54 ` David Hildenbrand
2014-11-28 12:50 ` Cornelia Huck
2014-11-27 20:08 ` [PATCH v6 06/46] virtio_ccw: add support for 64 bit features Michael S. Tsirkin
` (4 subsequent siblings)
7 siblings, 2 replies; 17+ messages in thread
From: Michael S. Tsirkin @ 2014-11-27 20:08 UTC (permalink / raw)
To: linux-kernel
Cc: David Miller, cornelia.huck, rusty, nab, pbonzini, thuth, dahi,
Rusty Russell, Ohad Ben-Cohen, Christian Borntraeger, linux390,
Martin Schwidefsky, Heiko Carstens, Sudeep Dutt, Siva Yerramreddy,
lguest, linux-s390, virtualization
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 <rusty@rustcorp.com.au>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
drivers/lguest/lguest_device.c | 3 +++
drivers/misc/mic/card/mic_virtio.c | 3 +++
drivers/remoteproc/remoteproc_virtio.c | 3 +++
drivers/s390/kvm/kvm_virtio.c | 3 +++
drivers/s390/kvm/virtio_ccw.c | 3 +++
drivers/virtio/virtio_mmio.c | 3 +++
drivers/virtio/virtio_pci.c | 3 +++
7 files changed, 21 insertions(+)
diff --git a/drivers/lguest/lguest_device.c b/drivers/lguest/lguest_device.c
index d81170a..9b77b66 100644
--- a/drivers/lguest/lguest_device.c
+++ b/drivers/lguest/lguest_device.c
@@ -136,6 +136,9 @@ static void lg_finalize_features(struct virtio_device *vdev)
/* Give virtio_ring a chance to accept features. */
vring_transport_features(vdev);
+ /* Make sure we don't have any features > 32 bits! */
+ BUG_ON((u32)vdev->features != vdev->features);
+
/*
* Since lguest is currently x86-only, we're little-endian. That
* means we could just memcpy. But it's not time critical, and in
diff --git a/drivers/misc/mic/card/mic_virtio.c b/drivers/misc/mic/card/mic_virtio.c
index f5e7561..d027d29 100644
--- a/drivers/misc/mic/card/mic_virtio.c
+++ b/drivers/misc/mic/card/mic_virtio.c
@@ -96,6 +96,9 @@ static void mic_finalize_features(struct virtio_device *vdev)
/* Give virtio_ring a chance to accept features. */
vring_transport_features(vdev);
+ /* Make sure we don't have any features > 32 bits! */
+ BUG_ON((u32)vdev->features != vdev->features);
+
memset_io(out_features, 0, feature_len);
bits = min_t(unsigned, feature_len,
sizeof(vdev->features)) * 8;
diff --git a/drivers/remoteproc/remoteproc_virtio.c b/drivers/remoteproc/remoteproc_virtio.c
index 62897db..627737e 100644
--- a/drivers/remoteproc/remoteproc_virtio.c
+++ b/drivers/remoteproc/remoteproc_virtio.c
@@ -227,6 +227,9 @@ static void rproc_virtio_finalize_features(struct virtio_device *vdev)
/* Give virtio_ring a chance to accept features */
vring_transport_features(vdev);
+ /* Make sure we don't have any features > 32 bits! */
+ BUG_ON((u32)vdev->features != vdev->features);
+
/*
* Remember the finalized features of our vdev, and provide it
* to the remote processor once it is powered on.
diff --git a/drivers/s390/kvm/kvm_virtio.c b/drivers/s390/kvm/kvm_virtio.c
index 2336c7e..f5575cc 100644
--- a/drivers/s390/kvm/kvm_virtio.c
+++ b/drivers/s390/kvm/kvm_virtio.c
@@ -103,6 +103,9 @@ static void kvm_finalize_features(struct virtio_device *vdev)
/* Give virtio_ring a chance to accept features. */
vring_transport_features(vdev);
+ /* Make sure we don't have any features > 32 bits! */
+ BUG_ON((u32)vdev->features != vdev->features);
+
memset(out_features, 0, desc->feature_len);
bits = min_t(unsigned, desc->feature_len, sizeof(vdev->features)) * 8;
for (i = 0; i < bits; i++) {
diff --git a/drivers/s390/kvm/virtio_ccw.c b/drivers/s390/kvm/virtio_ccw.c
index 56d7895..244d611 100644
--- a/drivers/s390/kvm/virtio_ccw.c
+++ b/drivers/s390/kvm/virtio_ccw.c
@@ -714,6 +714,9 @@ static void virtio_ccw_finalize_features(struct virtio_device *vdev)
/* Give virtio_ring a chance to accept features. */
vring_transport_features(vdev);
+ /* Make sure we don't have any features > 32 bits! */
+ BUG_ON((u32)vdev->features != vdev->features);
+
features->index = 0;
features->features = cpu_to_le32(vdev->features);
/* Write the feature bits to the host. */
diff --git a/drivers/virtio/virtio_mmio.c b/drivers/virtio/virtio_mmio.c
index c63d0ef..aec1dae 100644
--- a/drivers/virtio/virtio_mmio.c
+++ b/drivers/virtio/virtio_mmio.c
@@ -159,6 +159,9 @@ static void vm_finalize_features(struct virtio_device *vdev)
/* Give virtio_ring a chance to accept features. */
vring_transport_features(vdev);
+ /* Make sure we don't have any features > 32 bits! */
+ BUG_ON((u32)vdev->features != vdev->features);
+
writel(0, vm_dev->base + VIRTIO_MMIO_GUEST_FEATURES_SEL);
writel(vdev->features, vm_dev->base + VIRTIO_MMIO_GUEST_FEATURES);
}
diff --git a/drivers/virtio/virtio_pci.c b/drivers/virtio/virtio_pci.c
index 80be24a..8eeaadd 100644
--- a/drivers/virtio/virtio_pci.c
+++ b/drivers/virtio/virtio_pci.c
@@ -119,6 +119,9 @@ static void vp_finalize_features(struct virtio_device *vdev)
/* Give virtio_ring a chance to accept features. */
vring_transport_features(vdev);
+ /* Make sure we don't have any features > 32 bits! */
+ BUG_ON((u32)vdev->features != vdev->features);
+
/* We only support 32 feature bits. */
iowrite32(vdev->features, vp_dev->ioaddr+VIRTIO_PCI_GUEST_FEATURES);
}
--
MST
^ permalink raw reply related [flat|nested] 17+ messages in thread* Re: [PATCH v6 05/46] virtio: assert 32 bit features in transports
2014-11-27 20:08 ` [PATCH v6 05/46] virtio: assert 32 bit features in transports Michael S. Tsirkin
@ 2014-11-28 8:54 ` David Hildenbrand
2014-11-28 12:50 ` Cornelia Huck
1 sibling, 0 replies; 17+ messages in thread
From: David Hildenbrand @ 2014-11-28 8:54 UTC (permalink / raw)
To: Michael S. Tsirkin
Cc: linux-kernel, David Miller, cornelia.huck, rusty, nab, pbonzini,
thuth, Rusty Russell, Ohad Ben-Cohen, Christian Borntraeger,
linux390, Martin Schwidefsky, Heiko Carstens, Sudeep Dutt,
Siva Yerramreddy, lguest, linux-s390, virtualization
> 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 <rusty@rustcorp.com.au>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---
> drivers/lguest/lguest_device.c | 3 +++
> drivers/misc/mic/card/mic_virtio.c | 3 +++
> drivers/remoteproc/remoteproc_virtio.c | 3 +++
> drivers/s390/kvm/kvm_virtio.c | 3 +++
> drivers/s390/kvm/virtio_ccw.c | 3 +++
> drivers/virtio/virtio_mmio.c | 3 +++
> drivers/virtio/virtio_pci.c | 3 +++
> 7 files changed, 21 insertions(+)
>
Looks sane to me.
Reviewed-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v6 05/46] virtio: assert 32 bit features in transports
2014-11-27 20:08 ` [PATCH v6 05/46] virtio: assert 32 bit features in transports Michael S. Tsirkin
2014-11-28 8:54 ` David Hildenbrand
@ 2014-11-28 12:50 ` Cornelia Huck
1 sibling, 0 replies; 17+ messages in thread
From: Cornelia Huck @ 2014-11-28 12:50 UTC (permalink / raw)
To: Michael S. Tsirkin
Cc: linux-kernel, David Miller, rusty, nab, pbonzini, thuth, dahi,
Rusty Russell, Ohad Ben-Cohen, Christian Borntraeger, linux390,
Martin Schwidefsky, Heiko Carstens, Sudeep Dutt, Siva Yerramreddy,
lguest, linux-s390, virtualization
On Thu, 27 Nov 2014 22:08:02 +0200
"Michael S. Tsirkin" <mst@redhat.com> wrote:
> 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 <rusty@rustcorp.com.au>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---
> drivers/lguest/lguest_device.c | 3 +++
> drivers/misc/mic/card/mic_virtio.c | 3 +++
> drivers/remoteproc/remoteproc_virtio.c | 3 +++
> drivers/s390/kvm/kvm_virtio.c | 3 +++
> drivers/s390/kvm/virtio_ccw.c | 3 +++
> drivers/virtio/virtio_mmio.c | 3 +++
> drivers/virtio/virtio_pci.c | 3 +++
> 7 files changed, 21 insertions(+)
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH v6 06/46] virtio_ccw: add support for 64 bit features.
[not found] <1417118789-18231-1-git-send-email-mst@redhat.com>
` (2 preceding siblings ...)
2014-11-27 20:08 ` [PATCH v6 05/46] virtio: assert 32 bit features in transports Michael S. Tsirkin
@ 2014-11-27 20:08 ` Michael S. Tsirkin
2014-11-28 12:56 ` Cornelia Huck
2014-11-27 20:09 ` [PATCH v6 17/46] KVM: s390: Set virtio-ccw transport revision Michael S. Tsirkin
` (3 subsequent siblings)
7 siblings, 1 reply; 17+ messages in thread
From: Michael S. Tsirkin @ 2014-11-27 20:08 UTC (permalink / raw)
To: linux-kernel
Cc: David Miller, cornelia.huck, rusty, nab, pbonzini, thuth, dahi,
Rusty Russell, Christian Borntraeger, linux390,
Martin Schwidefsky, Heiko Carstens, linux-s390
Negotiate full 64 bit features.
Change u32 to u64, make sure to use 1ULL everywhere.
Note: devices guarantee that VERSION_1 is clear unless
revision 1 is negotiated.
Based on patches by Rusty, Thomas Huth and Cornelia.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
drivers/s390/kvm/virtio_ccw.c | 30 +++++++++++++++++++++++-------
1 file changed, 23 insertions(+), 7 deletions(-)
diff --git a/drivers/s390/kvm/virtio_ccw.c b/drivers/s390/kvm/virtio_ccw.c
index 244d611..abba04d 100644
--- a/drivers/s390/kvm/virtio_ccw.c
+++ b/drivers/s390/kvm/virtio_ccw.c
@@ -664,7 +664,8 @@ static u64 virtio_ccw_get_features(struct virtio_device *vdev)
{
struct virtio_ccw_device *vcdev = to_vc_device(vdev);
struct virtio_feature_desc *features;
- int ret, rc;
+ int ret;
+ u64 rc;
struct ccw1 *ccw;
ccw = kzalloc(sizeof(*ccw), GFP_DMA | GFP_KERNEL);
@@ -677,7 +678,6 @@ static u64 virtio_ccw_get_features(struct virtio_device *vdev)
goto out_free;
}
/* Read the feature bits from the host. */
- /* TODO: Features > 32 bits */
features->index = 0;
ccw->cmd_code = CCW_CMD_READ_FEAT;
ccw->flags = 0;
@@ -691,6 +691,16 @@ static u64 virtio_ccw_get_features(struct virtio_device *vdev)
rc = le32_to_cpu(features->features);
+ /* Read second half feature bits from the host. */
+ features->index = 1;
+ ccw->cmd_code = CCW_CMD_READ_FEAT;
+ ccw->flags = 0;
+ ccw->count = sizeof(*features);
+ ccw->cda = (__u32)(unsigned long)features;
+ ret = ccw_io_helper(vcdev, ccw, VIRTIO_CCW_DOING_READ_FEAT);
+ if (ret == 0)
+ rc |= (u64)le32_to_cpu(features->features) << 32;
+
out_free:
kfree(features);
kfree(ccw);
@@ -714,12 +724,18 @@ static void virtio_ccw_finalize_features(struct virtio_device *vdev)
/* Give virtio_ring a chance to accept features. */
vring_transport_features(vdev);
- /* Make sure we don't have any features > 32 bits! */
- BUG_ON((u32)vdev->features != vdev->features);
-
features->index = 0;
- features->features = cpu_to_le32(vdev->features);
- /* Write the feature bits to the host. */
+ features->features = cpu_to_le32((u32)vdev->features);
+ /* Write the first half of the feature bits to the host. */
+ ccw->cmd_code = CCW_CMD_WRITE_FEAT;
+ ccw->flags = 0;
+ ccw->count = sizeof(*features);
+ ccw->cda = (__u32)(unsigned long)features;
+ ccw_io_helper(vcdev, ccw, VIRTIO_CCW_DOING_WRITE_FEAT);
+
+ features->index = 1;
+ features->features = cpu_to_le32(vdev->features >> 32);
+ /* Write the second half of the feature bits to the host. */
ccw->cmd_code = CCW_CMD_WRITE_FEAT;
ccw->flags = 0;
ccw->count = sizeof(*features);
--
MST
^ permalink raw reply related [flat|nested] 17+ messages in thread* Re: [PATCH v6 06/46] virtio_ccw: add support for 64 bit features.
2014-11-27 20:08 ` [PATCH v6 06/46] virtio_ccw: add support for 64 bit features Michael S. Tsirkin
@ 2014-11-28 12:56 ` Cornelia Huck
0 siblings, 0 replies; 17+ messages in thread
From: Cornelia Huck @ 2014-11-28 12:56 UTC (permalink / raw)
To: Michael S. Tsirkin
Cc: linux-kernel, David Miller, rusty, nab, pbonzini, thuth, dahi,
Rusty Russell, Christian Borntraeger, linux390,
Martin Schwidefsky, Heiko Carstens, linux-s390
On Thu, 27 Nov 2014 22:08:09 +0200
"Michael S. Tsirkin" <mst@redhat.com> wrote:
> Negotiate full 64 bit features.
> Change u32 to u64, make sure to use 1ULL everywhere.
>
> Note: devices guarantee that VERSION_1 is clear unless
> revision 1 is negotiated.
>
> Based on patches by Rusty, Thomas Huth and Cornelia.
>
> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---
> drivers/s390/kvm/virtio_ccw.c | 30 +++++++++++++++++++++++-------
> 1 file changed, 23 insertions(+), 7 deletions(-)
>
> @@ -691,6 +691,16 @@ static u64 virtio_ccw_get_features(struct virtio_device *vdev)
>
> rc = le32_to_cpu(features->features);
>
> + /* Read second half feature bits from the host. */
s/half feature bits/half of the feature bits/
> + features->index = 1;
> + ccw->cmd_code = CCW_CMD_READ_FEAT;
> + ccw->flags = 0;
> + ccw->count = sizeof(*features);
> + ccw->cda = (__u32)(unsigned long)features;
We don't need to re-setup the ccw, but it probably doesn't hurt for
clarity.
> + ret = ccw_io_helper(vcdev, ccw, VIRTIO_CCW_DOING_READ_FEAT);
> + if (ret == 0)
> + rc |= (u64)le32_to_cpu(features->features) << 32;
> +
> out_free:
> kfree(features);
> kfree(ccw);
Looks good.
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH v6 17/46] KVM: s390: Set virtio-ccw transport revision
[not found] <1417118789-18231-1-git-send-email-mst@redhat.com>
` (3 preceding siblings ...)
2014-11-27 20:08 ` [PATCH v6 06/46] virtio_ccw: add support for 64 bit features Michael S. Tsirkin
@ 2014-11-27 20:09 ` Michael S. Tsirkin
2014-11-27 20:09 ` [PATCH v6 18/46] KVM: s390: virtio-ccw revision 1 SET_VQ Michael S. Tsirkin
` (2 subsequent siblings)
7 siblings, 0 replies; 17+ messages in thread
From: Michael S. Tsirkin @ 2014-11-27 20:09 UTC (permalink / raw)
To: linux-kernel
Cc: David Miller, cornelia.huck, rusty, nab, pbonzini, thuth, dahi,
Christian Borntraeger, linux390, Martin Schwidefsky,
Heiko Carstens, linux-s390
From: Thomas Huth <thuth@linux.vnet.ibm.com>
With the new SET-VIRTIO-REVISION command of the virtio 1.0 standard, we
can now negotiate the virtio-ccw revision after setting a channel online.
Note that we don't negotiate version 1 yet.
[Cornelia Huck: reworked revision loop a bit]
Reviewed-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
drivers/s390/kvm/virtio_ccw.c | 63 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 63 insertions(+)
diff --git a/drivers/s390/kvm/virtio_ccw.c b/drivers/s390/kvm/virtio_ccw.c
index abba04d..193e8f1 100644
--- a/drivers/s390/kvm/virtio_ccw.c
+++ b/drivers/s390/kvm/virtio_ccw.c
@@ -55,6 +55,7 @@ struct virtio_ccw_device {
struct ccw_device *cdev;
__u32 curr_io;
int err;
+ unsigned int revision; /* Transport revision */
wait_queue_head_t wait_q;
spinlock_t lock;
struct list_head virtqueues;
@@ -86,6 +87,15 @@ struct virtio_thinint_area {
u8 isc;
} __packed;
+struct virtio_rev_info {
+ __u16 revision;
+ __u16 length;
+ __u8 data[];
+};
+
+/* the highest virtio-ccw revision we support */
+#define VIRTIO_CCW_REV_MAX 0
+
struct virtio_ccw_vq_info {
struct virtqueue *vq;
int num;
@@ -122,6 +132,7 @@ static struct airq_info *airq_areas[MAX_AIRQ_AREAS];
#define CCW_CMD_WRITE_STATUS 0x31
#define CCW_CMD_READ_VQ_CONF 0x32
#define CCW_CMD_SET_IND_ADAPTER 0x73
+#define CCW_CMD_SET_VIRTIO_REV 0x83
#define VIRTIO_CCW_DOING_SET_VQ 0x00010000
#define VIRTIO_CCW_DOING_RESET 0x00040000
@@ -134,6 +145,7 @@ static struct airq_info *airq_areas[MAX_AIRQ_AREAS];
#define VIRTIO_CCW_DOING_READ_VQ_CONF 0x02000000
#define VIRTIO_CCW_DOING_SET_CONF_IND 0x04000000
#define VIRTIO_CCW_DOING_SET_IND_ADAPTER 0x08000000
+#define VIRTIO_CCW_DOING_SET_VIRTIO_REV 0x10000000
#define VIRTIO_CCW_INTPARM_MASK 0xffff0000
static struct virtio_ccw_device *to_vc_device(struct virtio_device *vdev)
@@ -933,6 +945,7 @@ static void virtio_ccw_int_handler(struct ccw_device *cdev,
case VIRTIO_CCW_DOING_RESET:
case VIRTIO_CCW_DOING_READ_VQ_CONF:
case VIRTIO_CCW_DOING_SET_IND_ADAPTER:
+ case VIRTIO_CCW_DOING_SET_VIRTIO_REV:
vcdev->curr_io &= ~activity;
wake_up(&vcdev->wait_q);
break;
@@ -1048,6 +1061,51 @@ static int virtio_ccw_offline(struct ccw_device *cdev)
return 0;
}
+static int virtio_ccw_set_transport_rev(struct virtio_ccw_device *vcdev)
+{
+ struct virtio_rev_info *rev;
+ struct ccw1 *ccw;
+ int ret;
+
+ ccw = kzalloc(sizeof(*ccw), GFP_DMA | GFP_KERNEL);
+ if (!ccw)
+ return -ENOMEM;
+ rev = kzalloc(sizeof(*rev), GFP_DMA | GFP_KERNEL);
+ if (!rev) {
+ kfree(ccw);
+ return -ENOMEM;
+ }
+
+ /* Set transport revision */
+ ccw->cmd_code = CCW_CMD_SET_VIRTIO_REV;
+ ccw->flags = 0;
+ ccw->count = sizeof(*rev);
+ ccw->cda = (__u32)(unsigned long)rev;
+
+ vcdev->revision = VIRTIO_CCW_REV_MAX;
+ do {
+ rev->revision = vcdev->revision;
+ /* none of our supported revisions carry payload */
+ rev->length = 0;
+ ret = ccw_io_helper(vcdev, ccw,
+ VIRTIO_CCW_DOING_SET_VIRTIO_REV);
+ if (ret == -EOPNOTSUPP) {
+ if (vcdev->revision == 0)
+ /*
+ * The host device does not support setting
+ * the revision: let's operate it in legacy
+ * mode.
+ */
+ ret = 0;
+ else
+ vcdev->revision--;
+ }
+ } while (ret == -EOPNOTSUPP);
+
+ kfree(ccw);
+ kfree(rev);
+ return ret;
+}
static int virtio_ccw_online(struct ccw_device *cdev)
{
@@ -1088,6 +1146,11 @@ static int virtio_ccw_online(struct ccw_device *cdev)
spin_unlock_irqrestore(get_ccwdev_lock(cdev), flags);
vcdev->vdev.id.vendor = cdev->id.cu_type;
vcdev->vdev.id.device = cdev->id.cu_model;
+
+ ret = virtio_ccw_set_transport_rev(vcdev);
+ if (ret)
+ goto out_free;
+
ret = register_virtio_device(&vcdev->vdev);
if (ret) {
dev_warn(&cdev->dev, "Failed to register virtio device: %d\n",
--
MST
^ permalink raw reply related [flat|nested] 17+ messages in thread* [PATCH v6 18/46] KVM: s390: virtio-ccw revision 1 SET_VQ
[not found] <1417118789-18231-1-git-send-email-mst@redhat.com>
` (4 preceding siblings ...)
2014-11-27 20:09 ` [PATCH v6 17/46] KVM: s390: Set virtio-ccw transport revision Michael S. Tsirkin
@ 2014-11-27 20:09 ` Michael S. Tsirkin
2014-11-27 20:09 ` [PATCH v6 19/46] KVM: s390 allow virtio_ccw status writes to fail Michael S. Tsirkin
2014-11-27 20:09 ` [PATCH v6 20/46] KVM: s390: enable virtio-ccw revision 1 Michael S. Tsirkin
7 siblings, 0 replies; 17+ messages in thread
From: Michael S. Tsirkin @ 2014-11-27 20:09 UTC (permalink / raw)
To: linux-kernel
Cc: David Miller, cornelia.huck, rusty, nab, pbonzini, thuth, dahi,
Christian Borntraeger, linux390, Martin Schwidefsky,
Heiko Carstens, linux-s390
From: Cornelia Huck <cornelia.huck@de.ibm.com>
The CCW_CMD_SET_VQ command has a different format for revision 1+
devices, allowing to specify a more complex virtqueue layout. For
now, we stay however with the old layout and simply use the new
command format for virtio-1 devices.
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
drivers/s390/kvm/virtio_ccw.c | 54 +++++++++++++++++++++++++++++++++----------
1 file changed, 42 insertions(+), 12 deletions(-)
diff --git a/drivers/s390/kvm/virtio_ccw.c b/drivers/s390/kvm/virtio_ccw.c
index 193e8f1..ad06e11 100644
--- a/drivers/s390/kvm/virtio_ccw.c
+++ b/drivers/s390/kvm/virtio_ccw.c
@@ -68,13 +68,22 @@ struct virtio_ccw_device {
void *airq_info;
};
-struct vq_info_block {
+struct vq_info_block_legacy {
__u64 queue;
__u32 align;
__u16 index;
__u16 num;
} __packed;
+struct vq_info_block {
+ __u64 desc;
+ __u32 res0;
+ __u16 index;
+ __u16 num;
+ __u64 avail;
+ __u64 used;
+} __packed;
+
struct virtio_feature_desc {
__u32 features;
__u8 index;
@@ -100,7 +109,10 @@ struct virtio_ccw_vq_info {
struct virtqueue *vq;
int num;
void *queue;
- struct vq_info_block *info_block;
+ union {
+ struct vq_info_block s;
+ struct vq_info_block_legacy l;
+ } *info_block;
int bit_nr;
struct list_head node;
long cookie;
@@ -411,13 +423,22 @@ static void virtio_ccw_del_vq(struct virtqueue *vq, struct ccw1 *ccw)
spin_unlock_irqrestore(&vcdev->lock, flags);
/* Release from host. */
- info->info_block->queue = 0;
- info->info_block->align = 0;
- info->info_block->index = index;
- info->info_block->num = 0;
+ if (vcdev->revision == 0) {
+ info->info_block->l.queue = 0;
+ info->info_block->l.align = 0;
+ info->info_block->l.index = index;
+ info->info_block->l.num = 0;
+ ccw->count = sizeof(info->info_block->l);
+ } else {
+ info->info_block->s.desc = 0;
+ info->info_block->s.index = index;
+ info->info_block->s.num = 0;
+ info->info_block->s.avail = 0;
+ info->info_block->s.used = 0;
+ ccw->count = sizeof(info->info_block->s);
+ }
ccw->cmd_code = CCW_CMD_SET_VQ;
ccw->flags = 0;
- ccw->count = sizeof(*info->info_block);
ccw->cda = (__u32)(unsigned long)(info->info_block);
ret = ccw_io_helper(vcdev, ccw,
VIRTIO_CCW_DOING_SET_VQ | index);
@@ -500,13 +521,22 @@ static struct virtqueue *virtio_ccw_setup_vq(struct virtio_device *vdev,
}
/* Register it with the host. */
- info->info_block->queue = (__u64)info->queue;
- info->info_block->align = KVM_VIRTIO_CCW_RING_ALIGN;
- info->info_block->index = i;
- info->info_block->num = info->num;
+ if (vcdev->revision == 0) {
+ info->info_block->l.queue = (__u64)info->queue;
+ info->info_block->l.align = KVM_VIRTIO_CCW_RING_ALIGN;
+ info->info_block->l.index = i;
+ info->info_block->l.num = info->num;
+ ccw->count = sizeof(info->info_block->l);
+ } else {
+ info->info_block->s.desc = (__u64)info->queue;
+ info->info_block->s.index = i;
+ info->info_block->s.num = info->num;
+ info->info_block->s.avail = (__u64)virtqueue_get_avail(vq);
+ info->info_block->s.used = (__u64)virtqueue_get_used(vq);
+ ccw->count = sizeof(info->info_block->s);
+ }
ccw->cmd_code = CCW_CMD_SET_VQ;
ccw->flags = 0;
- ccw->count = sizeof(*info->info_block);
ccw->cda = (__u32)(unsigned long)(info->info_block);
err = ccw_io_helper(vcdev, ccw, VIRTIO_CCW_DOING_SET_VQ | i);
if (err) {
--
MST
^ permalink raw reply related [flat|nested] 17+ messages in thread* [PATCH v6 19/46] KVM: s390 allow virtio_ccw status writes to fail
[not found] <1417118789-18231-1-git-send-email-mst@redhat.com>
` (5 preceding siblings ...)
2014-11-27 20:09 ` [PATCH v6 18/46] KVM: s390: virtio-ccw revision 1 SET_VQ Michael S. Tsirkin
@ 2014-11-27 20:09 ` Michael S. Tsirkin
2014-11-27 20:09 ` [PATCH v6 20/46] KVM: s390: enable virtio-ccw revision 1 Michael S. Tsirkin
7 siblings, 0 replies; 17+ messages in thread
From: Michael S. Tsirkin @ 2014-11-27 20:09 UTC (permalink / raw)
To: linux-kernel
Cc: David Miller, cornelia.huck, rusty, nab, pbonzini, thuth, dahi,
Christian Borntraeger, linux390, Martin Schwidefsky,
Heiko Carstens, linux-s390
Gracefully handle failure to write device status.
We really should handle other errors as well, but this one is needed for
virtio 1.0 compliance.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
---
drivers/s390/kvm/virtio_ccw.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/s390/kvm/virtio_ccw.c b/drivers/s390/kvm/virtio_ccw.c
index ad06e11..79f6737 100644
--- a/drivers/s390/kvm/virtio_ccw.c
+++ b/drivers/s390/kvm/virtio_ccw.c
@@ -862,7 +862,9 @@ static u8 virtio_ccw_get_status(struct virtio_device *vdev)
static void virtio_ccw_set_status(struct virtio_device *vdev, u8 status)
{
struct virtio_ccw_device *vcdev = to_vc_device(vdev);
+ u8 old_status = *vcdev->status;
struct ccw1 *ccw;
+ int ret;
ccw = kzalloc(sizeof(*ccw), GFP_DMA | GFP_KERNEL);
if (!ccw)
@@ -874,7 +876,10 @@ static void virtio_ccw_set_status(struct virtio_device *vdev, u8 status)
ccw->flags = 0;
ccw->count = sizeof(status);
ccw->cda = (__u32)(unsigned long)vcdev->status;
- ccw_io_helper(vcdev, ccw, VIRTIO_CCW_DOING_WRITE_STATUS);
+ ret = ccw_io_helper(vcdev, ccw, VIRTIO_CCW_DOING_WRITE_STATUS);
+ /* Write failed? We assume status is unchanged. */
+ if (ret)
+ *vcdev->status = old_status;
kfree(ccw);
}
--
MST
^ permalink raw reply related [flat|nested] 17+ messages in thread* [PATCH v6 20/46] KVM: s390: enable virtio-ccw revision 1
[not found] <1417118789-18231-1-git-send-email-mst@redhat.com>
` (6 preceding siblings ...)
2014-11-27 20:09 ` [PATCH v6 19/46] KVM: s390 allow virtio_ccw status writes to fail Michael S. Tsirkin
@ 2014-11-27 20:09 ` Michael S. Tsirkin
2014-11-28 10:09 ` Cornelia Huck
7 siblings, 1 reply; 17+ messages in thread
From: Michael S. Tsirkin @ 2014-11-27 20:09 UTC (permalink / raw)
To: linux-kernel
Cc: David Miller, cornelia.huck, rusty, nab, pbonzini, thuth, dahi,
Christian Borntraeger, linux390, Martin Schwidefsky,
Heiko Carstens, linux-s390
From: Cornelia Huck <cornelia.huck@de.ibm.com>
Now that virtio-ccw has everything needed to support virtio 1.0 in
place, try to enable it if the host supports it.
MST: enable virtio 1.0 feature bit
Reviewed-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
drivers/s390/kvm/virtio_ccw.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/s390/kvm/virtio_ccw.c b/drivers/s390/kvm/virtio_ccw.c
index 79f6737..8ec68dd 100644
--- a/drivers/s390/kvm/virtio_ccw.c
+++ b/drivers/s390/kvm/virtio_ccw.c
@@ -103,7 +103,7 @@ struct virtio_rev_info {
};
/* the highest virtio-ccw revision we support */
-#define VIRTIO_CCW_REV_MAX 0
+#define VIRTIO_CCW_REV_MAX 1
struct virtio_ccw_vq_info {
struct virtqueue *vq;
--
MST
^ permalink raw reply related [flat|nested] 17+ messages in thread* Re: [PATCH v6 20/46] KVM: s390: enable virtio-ccw revision 1
2014-11-27 20:09 ` [PATCH v6 20/46] KVM: s390: enable virtio-ccw revision 1 Michael S. Tsirkin
@ 2014-11-28 10:09 ` Cornelia Huck
2014-11-29 17:31 ` Michael S. Tsirkin
0 siblings, 1 reply; 17+ messages in thread
From: Cornelia Huck @ 2014-11-28 10:09 UTC (permalink / raw)
To: Michael S. Tsirkin
Cc: linux-kernel, David Miller, rusty, nab, pbonzini, thuth, dahi,
Christian Borntraeger, linux390, Martin Schwidefsky,
Heiko Carstens, linux-s390
On Thu, 27 Nov 2014 22:09:30 +0200
"Michael S. Tsirkin" <mst@redhat.com> wrote:
> From: Cornelia Huck <cornelia.huck@de.ibm.com>
>
> Now that virtio-ccw has everything needed to support virtio 1.0 in
> place, try to enable it if the host supports it.
>
> MST: enable virtio 1.0 feature bit
Stale comment?
>
> Reviewed-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---
> drivers/s390/kvm/virtio_ccw.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/s390/kvm/virtio_ccw.c b/drivers/s390/kvm/virtio_ccw.c
> index 79f6737..8ec68dd 100644
> --- a/drivers/s390/kvm/virtio_ccw.c
> +++ b/drivers/s390/kvm/virtio_ccw.c
> @@ -103,7 +103,7 @@ struct virtio_rev_info {
> };
>
> /* the highest virtio-ccw revision we support */
> -#define VIRTIO_CCW_REV_MAX 0
> +#define VIRTIO_CCW_REV_MAX 1
>
> struct virtio_ccw_vq_info {
> struct virtqueue *vq;
^ permalink raw reply [flat|nested] 17+ messages in thread* Re: [PATCH v6 20/46] KVM: s390: enable virtio-ccw revision 1
2014-11-28 10:09 ` Cornelia Huck
@ 2014-11-29 17:31 ` Michael S. Tsirkin
0 siblings, 0 replies; 17+ messages in thread
From: Michael S. Tsirkin @ 2014-11-29 17:31 UTC (permalink / raw)
To: Cornelia Huck
Cc: linux-kernel, David Miller, rusty, nab, pbonzini, thuth, dahi,
Christian Borntraeger, linux390, Martin Schwidefsky,
Heiko Carstens, linux-s390
On Fri, Nov 28, 2014 at 11:09:10AM +0100, Cornelia Huck wrote:
> On Thu, 27 Nov 2014 22:09:30 +0200
> "Michael S. Tsirkin" <mst@redhat.com> wrote:
>
> > From: Cornelia Huck <cornelia.huck@de.ibm.com>
> >
> > Now that virtio-ccw has everything needed to support virtio 1.0 in
> > place, try to enable it if the host supports it.
> >
> > MST: enable virtio 1.0 feature bit
>
> Stale comment?
Sure, thanks.
> >
> > Reviewed-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
> > Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
> > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> > ---
> > drivers/s390/kvm/virtio_ccw.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/s390/kvm/virtio_ccw.c b/drivers/s390/kvm/virtio_ccw.c
> > index 79f6737..8ec68dd 100644
> > --- a/drivers/s390/kvm/virtio_ccw.c
> > +++ b/drivers/s390/kvm/virtio_ccw.c
> > @@ -103,7 +103,7 @@ struct virtio_rev_info {
> > };
> >
> > /* the highest virtio-ccw revision we support */
> > -#define VIRTIO_CCW_REV_MAX 0
> > +#define VIRTIO_CCW_REV_MAX 1
> >
> > struct virtio_ccw_vq_info {
> > struct virtqueue *vq;
^ permalink raw reply [flat|nested] 17+ messages in thread