Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

virtio: use KVM_S390_VIRTIO_RING_ALIGN instead of relying on pagesize

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

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>

+10 -3
+4
arch/s390/include/asm/kvm_virtio.h
··· 50 50 #define KVM_S390_VIRTIO_RESET 1 51 51 #define KVM_S390_VIRTIO_SET_STATUS 2 52 52 53 + /* The alignment to use between consumer and producer parts of vring. 54 + * This is pagesize for historical reasons. */ 55 + #define KVM_S390_VIRTIO_RING_ALIGN 4096 56 + 53 57 #ifdef __KERNEL__ 54 58 /* early virtio console setup */ 55 59 #ifdef CONFIG_S390_GUEST
+6 -3
drivers/s390/kvm/kvm_virtio.c
··· 188 188 config = kvm_vq_config(kdev->desc)+index; 189 189 190 190 err = vmem_add_mapping(config->address, 191 - vring_size(config->num, PAGE_SIZE)); 191 + vring_size(config->num, 192 + KVM_S390_VIRTIO_RING_ALIGN)); 192 193 if (err) 193 194 goto out; 194 195 ··· 210 209 return vq; 211 210 unmap: 212 211 vmem_remove_mapping(config->address, 213 - vring_size(config->num, PAGE_SIZE)); 212 + vring_size(config->num, 213 + KVM_S390_VIRTIO_RING_ALIGN)); 214 214 out: 215 215 return ERR_PTR(err); 216 216 } ··· 222 220 223 221 vring_del_virtqueue(vq); 224 222 vmem_remove_mapping(config->address, 225 - vring_size(config->num, PAGE_SIZE)); 223 + vring_size(config->num, 224 + KVM_S390_VIRTIO_RING_ALIGN)); 226 225 } 227 226 228 227 /*