From 48b3509407f54cd14e4db1316ef4660c478efda0 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Tue, 30 Dec 2008 09:25:57 -0600 Subject: [PATCH] --- yaml --- r: 123975 b: refs/heads/master c: 498af14783935af487d17dbee4ac451783cbc2b7 h: refs/heads/master i: 123973: d5692cc94fbf79acd6499f3fa44808f8bd9331f5 123971: bc4b40615832828c020287ee8339194678bc9030 123967: 87234615bc40154f8a134fe23d36f5fe7c96390d v: v3 --- [refs] | 2 +- trunk/drivers/virtio/virtio_pci.c | 4 ++-- trunk/include/linux/virtio_pci.h | 4 ++++ 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/[refs] b/[refs] index fe45501fdfd6..d3bc1f75bb6f 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 5f0d1d7f2286c8a02dab69f5f0bd51681fab161e +refs/heads/master: 498af14783935af487d17dbee4ac451783cbc2b7 diff --git a/trunk/drivers/virtio/virtio_pci.c b/trunk/drivers/virtio/virtio_pci.c index c2cd69ba0a8c..f28643f3a4e8 100644 --- a/trunk/drivers/virtio/virtio_pci.c +++ b/trunk/drivers/virtio/virtio_pci.c @@ -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); } diff --git a/trunk/include/linux/virtio_pci.h b/trunk/include/linux/virtio_pci.h index e13d7ebcf576..cd0fd5d181a6 100644 --- a/trunk/include/linux/virtio_pci.h +++ b/trunk/include/linux/virtio_pci.h @@ -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