Re: [PATCH 1/3] virtio: find_vqs/del_vqs virtio operations

Christian Borntraeger
2009-05-12T08:55:59Z

Am Tuesday 12 May 2009 00:19:32 schrieb Michael S. Tsirkin:
> This replaces find_vq/del_vq with find_vqs/del_vqs virtio operations,
> and updates all drivers. This is needed for MSI support, because MSI
> needs to know the total number of vectors upfront.
[...]
> diff --git a/drivers/s390/kvm/kvm_virtio.c b/drivers/s390/kvm/kvm_virtio.c

This file contains several copy/paste breakages and needs at least the
patch below to compile.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>

---
drivers/s390/kvm/kvm_virtio.c | 28 +++++++---------------------
1 file changed, 7 insertions(+), 21 deletions(-)

Index: kvm/drivers/s390/kvm/kvm_virtio.c
===================================================================
--- kvm.orig/drivers/s390/kvm/kvm_virtio.c
+++ kvm/drivers/s390/kvm/kvm_virtio.c
@@ -237,23 +237,23 @@ static void kvm_del_vqs(struct virtio_de
int i;
if (!kdev->vqs)
return;
- for (i = 0; i < ldev->nvqs; ++i)
+ for (i = 0; i < kdev->nvqs; ++i)
kvm_del_vq(kdev->vqs[i]);
- kfree(ldev->vqs);
- ldev->vqs = NULL;
- ldev->nvqs = 0;
+ kfree(kdev->vqs);
+ kdev->vqs = NULL;
+ kdev->nvqs = 0;
}

static int kvm_find_vqs(struct virtio_device *vdev, unsigned nvqs,
- struct virtqueue *vqs[]
- void (*callbacks)[](struct virtqueue *))
+ struct virtqueue *vqs[],
+ virtqueue_callback *callbacks[])
{
struct kvm_device *kdev = to_kvmdev(vdev);
int i;

/* We must have this many virtqueues. */
if (nvqs > kdev->desc->num_vq)
- return ERR_PTR(-ENOENT);
+ return -ENOENT;

kdev->vqs = kmalloc(GFP_KERNEL, nvqs * sizeof *kdev->vqs);
if (!kdev->vqs)
@@ -272,20 +272,6 @@ error:
return PTR_ERR(vqs[i]);
}

-static void kvm_del_vqs(struct virtio_device *vdev)
-{
- struct lguest_device *ldev = to_lgdev(vdev);
- int i;
-
- if (!ldev->vqs)
- return;
- for (i = 0; i < ldev->nvqs; ++i)
- lg_del_vq(ldev->vqs[i]);
- kfree(ldev->vqs);
- ldev->vqs = NULL;
- ldev->nvqs = 0;
-}
-
/*
* The config ops structure as defined by virtio config
*/