Skip to contentSkip to conversation

virtio: Don't use PAGE_SIZE in virtio_pci.c

PATCH New Rusty Russell 1 participant 1 message Nov 12, 2008

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/7 virtio: Don't use PAGE_SIZE in virtio_pci.c

The virtio PCI devices don't depend on the guest page size. This matters now PowerPC virtio is gaining ground (they like 64k pages).

---
 drivers/virtio/virtio_pci.c |    2 +-
 include/linux/virtio_pci.h  |    4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)
drivers/virtio/virtio_pci.c +1 -1
diff -r 8014f9c51f4e drivers/virtio/virtio_pci.c
@@ -244,7 +244,7 @@
 	}
 
 	/* activate the queue */
-	iowrite32(virt_to_phys(info->queue) >> PAGE_SHIFT,
+	iowrite32(virt_to_phys(info->queue) >> VIRTIO_PCI_QUEUE_ADDR_SHIFT,
 		  vp_dev->ioaddr + VIRTIO_PCI_QUEUE_PFN);
 
 	/* create the vring */
include/linux/virtio_pci.h +4 -0
diff -r 8014f9c51f4e include/linux/virtio_pci.h
@@ -53,4 +53,8 @@
 
 /* Virtio ABI version, this must match exactly */
 #define VIRTIO_PCI_ABI_VERSION		0
+
+/* 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
 #endif