Skip to contentSkip to conversation

virtio: use KVM_S390_VIRTIO_RING_ALIGN instead of relying on pagesize

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

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

PATCH 5/7 virtio: use KVM_S390_VIRTIO_RING_ALIGN instead of relying on pagesize

This doesn't really matter, since s390 pagesize is 4k anyway.

---
 arch/s390/include/asm/kvm_virtio.h |    3 +++
 drivers/s390/kvm/kvm_virtio.c      |    9 ++++++---
 2 files changed, 9 insertions(+), 3 deletions(-)
arch/s390/include/asm/kvm_virtio.h +3 -0
diff -r 5c9c0cc58458 arch/s390/include/asm/kvm_virtio.h
@@ -50,6 +50,9 @@
 #define KVM_S390_VIRTIO_RESET		1
 #define KVM_S390_VIRTIO_SET_STATUS	2
 
+/* Overkill: we have the consumer and producer writing to separate pages. */
+#define KVM_S390_VIRTIO_RING_ALIGN	4096
+
 #ifdef __KERNEL__
 /* early virtio console setup */
 #ifdef CONFIG_S390_GUEST
drivers/s390/kvm/kvm_virtio.c +6 -3
diff -r 5c9c0cc58458 drivers/s390/kvm/kvm_virtio.c
@@ -188,7 +188,8 @@
 	config = kvm_vq_config(kdev->desc)+index;
 
 	err = vmem_add_mapping(config->address,
-			       vring_size(config->num, PAGE_SIZE));
+			       vring_size(config->num,
+					  KVM_S390_VIRTIO_RING_ALIGN));
 	if (err)
 		goto out;
 
@@ -209,7 +210,8 @@
 	return vq;
 unmap:
 	vmem_remove_mapping(config->address,
-			    vring_size(config->num, PAGE_SIZE));
+			    vring_size(config->num,
+				       KVM_S390_VIRTIO_RING_ALIGN));
 out:
 	return ERR_PTR(err);
 }
@@ -220,7 +222,8 @@
 
 	vring_del_virtqueue(vq);
 	vmem_remove_mapping(config->address,
-			    vring_size(config->num, PAGE_SIZE));
+			    vring_size(config->num,
+				       KVM_S390_VIRTIO_RING_ALIGN));
 }
 
 /*