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

Rusty Russell
2008-11-12T12:23:07Z

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

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
---
arch/s390/include/asm/kvm_virtio.h | 3 +++
drivers/s390/kvm/kvm_virtio.c | 9 ++++++---
2 files changed, 9 insertions(+), 3 deletions(-)

diff -r 5c9c0cc58458 arch/s390/include/asm/kvm_virtio.h
--- a/arch/s390/include/asm/kvm_virtio.h Wed Nov 12 22:05:59 2008 +1030
+++ b/arch/s390/include/asm/kvm_virtio.h Wed Nov 12 22:10:29 2008 +1030
@@ -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
diff -r 5c9c0cc58458 drivers/s390/kvm/kvm_virtio.c
--- a/drivers/s390/kvm/kvm_virtio.c Wed Nov 12 22:05:59 2008 +1030
+++ b/drivers/s390/kvm/kvm_virtio.c Wed Nov 12 22:10:29 2008 +1030
@@ -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));
}

/*