aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2008-12-30 10:26:03 -0500
committerRusty Russell <rusty@rustcorp.com.au>2008-12-29 17:56:03 -0500
commit87c7d57c17ade5024d95b6ca0da249da49b0672a (patch)
tree2ffeaae5c2e5ed9a72efec6466678fb797c4cdfa
parentdb40598863e8cbbd11053ad3c8bae89000f603f9 (diff)
virtio: hand virtio ring alignment as argument to vring_new_virtqueue
This allows each virtio user to hand in the alignment appropriate to their virtio_ring structures. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
-rw-r--r--drivers/lguest/lguest_device.c4
-rw-r--r--drivers/s390/kvm/kvm_virtio.c3
-rw-r--r--drivers/virtio/virtio_pci.c4
-rw-r--r--drivers/virtio/virtio_ring.c3
-rw-r--r--include/linux/virtio_ring.h1
5 files changed, 9 insertions, 6 deletions
diff --git a/drivers/lguest/lguest_device.c b/drivers/lguest/lguest_device.c
index f062dc55c573..b02f6bcb64c4 100644
--- a/drivers/lguest/lguest_device.c
+++ b/drivers/lguest/lguest_device.c
@@ -259,8 +259,8 @@ static struct virtqueue *lg_find_vq(struct virtio_device *vdev,
259 259
260 /* OK, tell virtio_ring.c to set up a virtqueue now we know its size 260 /* OK, tell virtio_ring.c to set up a virtqueue now we know its size
261 * and we've got a pointer to its pages. */ 261 * and we've got a pointer to its pages. */
262 vq = vring_new_virtqueue(lvq->config.num, vdev, lvq->pages, 262 vq = vring_new_virtqueue(lvq->config.num, LGUEST_VRING_ALIGN,
263 lg_notify, callback); 263 vdev, lvq->pages, lg_notify, callback);
264 if (!vq) { 264 if (!vq) {
265 err = -ENOMEM; 265 err = -ENOMEM;
266 goto unmap; 266 goto unmap;
diff --git a/drivers/s390/kvm/kvm_virtio.c b/drivers/s390/kvm/kvm_virtio.c
index f5a2dbe75575..4e8354aa8576 100644
--- a/drivers/s390/kvm/kvm_virtio.c
+++ b/drivers/s390/kvm/kvm_virtio.c
@@ -193,7 +193,8 @@ static struct virtqueue *kvm_find_vq(struct virtio_device *vdev,
193 if (err) 193 if (err)
194 goto out; 194 goto out;
195 195
196 vq = vring_new_virtqueue(config->num, vdev, (void *) config->address, 196 vq = vring_new_virtqueue(config->num, KVM_S390_VIRTIO_RING_ALIGN,
197 vdev, (void *) config->address,
197 kvm_notify, callback); 198 kvm_notify, callback);
198 if (!vq) { 199 if (!vq) {
199 err = -ENOMEM; 200 err = -ENOMEM;
diff --git a/drivers/virtio/virtio_pci.c b/drivers/virtio/virtio_pci.c
index f28643f3a4e8..7462a51e820b 100644
--- a/drivers/virtio/virtio_pci.c
+++ b/drivers/virtio/virtio_pci.c
@@ -249,8 +249,8 @@ static struct virtqueue *vp_find_vq(struct virtio_device *vdev, unsigned index,
249 vp_dev->ioaddr + VIRTIO_PCI_QUEUE_PFN); 249 vp_dev->ioaddr + VIRTIO_PCI_QUEUE_PFN);
250 250
251 /* create the vring */ 251 /* create the vring */
252 vq = vring_new_virtqueue(info->num, vdev, info->queue, 252 vq = vring_new_virtqueue(info->num, VIRTIO_PCI_VRING_ALIGN,
253 vp_notify, callback); 253 vdev, info->queue, vp_notify, callback);
254 if (!vq) { 254 if (!vq) {
255 err = -ENOMEM; 255 err = -ENOMEM;
256 goto out_activate_queue; 256 goto out_activate_queue;
diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
index 6eb5303fed11..5777196bf6c9 100644
--- a/drivers/virtio/virtio_ring.c
+++ b/drivers/virtio/virtio_ring.c
@@ -274,6 +274,7 @@ static struct virtqueue_ops vring_vq_ops = {
274}; 274};
275 275
276struct virtqueue *vring_new_virtqueue(unsigned int num, 276struct virtqueue *vring_new_virtqueue(unsigned int num,
277 unsigned int vring_align,
277 struct virtio_device *vdev, 278 struct virtio_device *vdev,
278 void *pages, 279 void *pages,
279 void (*notify)(struct virtqueue *), 280 void (*notify)(struct virtqueue *),
@@ -292,7 +293,7 @@ struct virtqueue *vring_new_virtqueue(unsigned int num,
292 if (!vq) 293 if (!vq)
293 return NULL; 294 return NULL;
294 295
295 vring_init(&vq->vring, num, pages, PAGE_SIZE); 296 vring_init(&vq->vring, num, pages, vring_align);
296 vq->vq.callback = callback; 297 vq->vq.callback = callback;
297 vq->vq.vdev = vdev; 298 vq->vq.vdev = vdev;
298 vq->vq.vq_ops = &vring_vq_ops; 299 vq->vq.vq_ops = &vring_vq_ops;
diff --git a/include/linux/virtio_ring.h b/include/linux/virtio_ring.h
index 01bf3124e312..71e03722fb59 100644
--- a/include/linux/virtio_ring.h
+++ b/include/linux/virtio_ring.h
@@ -115,6 +115,7 @@ struct virtio_device;
115struct virtqueue; 115struct virtqueue;
116 116
117struct virtqueue *vring_new_virtqueue(unsigned int num, 117struct virtqueue *vring_new_virtqueue(unsigned int num,
118 unsigned int vring_align,
118 struct virtio_device *vdev, 119 struct virtio_device *vdev,
119 void *pages, 120 void *pages,
120 void (*notify)(struct virtqueue *vq), 121 void (*notify)(struct virtqueue *vq),