]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
virtio: Don't use PAGE_SIZE for vring alignment in virtio_pci.
authorRusty Russell <rusty@rustcorp.com.au>
Tue, 30 Dec 2008 15:25:57 +0000 (09:25 -0600)
committerRusty Russell <rusty@rustcorp.com.au>
Mon, 29 Dec 2008 22:55:58 +0000 (09:25 +1030)
That doesn't work for non-4k guests which are now appearing.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
drivers/virtio/virtio_pci.c
include/linux/virtio_pci.h

index c2cd69ba0a8cd79e611abc1544a621797c410ab6..f28643f3a4e808b575f803329520a2d5bbc12402 100644 (file)
@@ -237,7 +237,7 @@ static struct virtqueue *vp_find_vq(struct virtio_device *vdev, unsigned index,
        info->queue_index = index;
        info->num = num;
 
-       size = PAGE_ALIGN(vring_size(num, PAGE_SIZE));
+       size = PAGE_ALIGN(vring_size(num, VIRTIO_PCI_VRING_ALIGN));
        info->queue = alloc_pages_exact(size, GFP_KERNEL|__GFP_ZERO);
        if (info->queue == NULL) {
                err = -ENOMEM;
@@ -290,7 +290,7 @@ static void vp_del_vq(struct virtqueue *vq)
        iowrite16(info->queue_index, vp_dev->ioaddr + VIRTIO_PCI_QUEUE_SEL);
        iowrite32(0, vp_dev->ioaddr + VIRTIO_PCI_QUEUE_PFN);
 
-       size = PAGE_ALIGN(vring_size(info->num, PAGE_SIZE));
+       size = PAGE_ALIGN(vring_size(info->num, VIRTIO_PCI_VRING_ALIGN));
        free_pages_exact(info->queue, size);
        kfree(info);
 }
index e13d7ebcf576bef6fd04f773f63a24b006b275ce..cd0fd5d181a6f259e8e24f7fb12f107cd35a4515 100644 (file)
@@ -57,4 +57,8 @@
 /* How many bits to shift physical queue address written to QUEUE_PFN.
  * 12 is historical, and due to x86 page size. */
 #define VIRTIO_PCI_QUEUE_ADDR_SHIFT    12
+
+/* The alignment to use between consumer and producer parts of vring.
+ * x86 pagesize again. */
+#define VIRTIO_PCI_VRING_ALIGN         4096
 #endif