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>
This commit is contained in:
parent
db40598863
commit
87c7d57c17
|
@ -259,8 +259,8 @@ static struct virtqueue *lg_find_vq(struct virtio_device *vdev,
|
||||||
|
|
||||||
/* OK, tell virtio_ring.c to set up a virtqueue now we know its size
|
/* OK, tell virtio_ring.c to set up a virtqueue now we know its size
|
||||||
* and we've got a pointer to its pages. */
|
* and we've got a pointer to its pages. */
|
||||||
vq = vring_new_virtqueue(lvq->config.num, vdev, lvq->pages,
|
vq = vring_new_virtqueue(lvq->config.num, LGUEST_VRING_ALIGN,
|
||||||
lg_notify, callback);
|
vdev, lvq->pages, lg_notify, callback);
|
||||||
if (!vq) {
|
if (!vq) {
|
||||||
err = -ENOMEM;
|
err = -ENOMEM;
|
||||||
goto unmap;
|
goto unmap;
|
||||||
|
|
|
@ -193,7 +193,8 @@ static struct virtqueue *kvm_find_vq(struct virtio_device *vdev,
|
||||||
if (err)
|
if (err)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
vq = vring_new_virtqueue(config->num, vdev, (void *) config->address,
|
vq = vring_new_virtqueue(config->num, KVM_S390_VIRTIO_RING_ALIGN,
|
||||||
|
vdev, (void *) config->address,
|
||||||
kvm_notify, callback);
|
kvm_notify, callback);
|
||||||
if (!vq) {
|
if (!vq) {
|
||||||
err = -ENOMEM;
|
err = -ENOMEM;
|
||||||
|
|
|
@ -249,8 +249,8 @@ static struct virtqueue *vp_find_vq(struct virtio_device *vdev, unsigned index,
|
||||||
vp_dev->ioaddr + VIRTIO_PCI_QUEUE_PFN);
|
vp_dev->ioaddr + VIRTIO_PCI_QUEUE_PFN);
|
||||||
|
|
||||||
/* create the vring */
|
/* create the vring */
|
||||||
vq = vring_new_virtqueue(info->num, vdev, info->queue,
|
vq = vring_new_virtqueue(info->num, VIRTIO_PCI_VRING_ALIGN,
|
||||||
vp_notify, callback);
|
vdev, info->queue, vp_notify, callback);
|
||||||
if (!vq) {
|
if (!vq) {
|
||||||
err = -ENOMEM;
|
err = -ENOMEM;
|
||||||
goto out_activate_queue;
|
goto out_activate_queue;
|
||||||
|
|
|
@ -274,6 +274,7 @@ static struct virtqueue_ops vring_vq_ops = {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct virtqueue *vring_new_virtqueue(unsigned int num,
|
struct virtqueue *vring_new_virtqueue(unsigned int num,
|
||||||
|
unsigned int vring_align,
|
||||||
struct virtio_device *vdev,
|
struct virtio_device *vdev,
|
||||||
void *pages,
|
void *pages,
|
||||||
void (*notify)(struct virtqueue *),
|
void (*notify)(struct virtqueue *),
|
||||||
|
@ -292,7 +293,7 @@ struct virtqueue *vring_new_virtqueue(unsigned int num,
|
||||||
if (!vq)
|
if (!vq)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
vring_init(&vq->vring, num, pages, PAGE_SIZE);
|
vring_init(&vq->vring, num, pages, vring_align);
|
||||||
vq->vq.callback = callback;
|
vq->vq.callback = callback;
|
||||||
vq->vq.vdev = vdev;
|
vq->vq.vdev = vdev;
|
||||||
vq->vq.vq_ops = &vring_vq_ops;
|
vq->vq.vq_ops = &vring_vq_ops;
|
||||||
|
|
|
@ -115,6 +115,7 @@ struct virtio_device;
|
||||||
struct virtqueue;
|
struct virtqueue;
|
||||||
|
|
||||||
struct virtqueue *vring_new_virtqueue(unsigned int num,
|
struct virtqueue *vring_new_virtqueue(unsigned int num,
|
||||||
|
unsigned int vring_align,
|
||||||
struct virtio_device *vdev,
|
struct virtio_device *vdev,
|
||||||
void *pages,
|
void *pages,
|
||||||
void (*notify)(struct virtqueue *vq),
|
void (*notify)(struct virtqueue *vq),
|
||||||
|
|
Loading…
Reference in a new issue