diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2008-12-30 10:26:02 -0500 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2008-12-29 17:56:03 -0500 |
commit | db40598863e8cbbd11053ad3c8bae89000f603f9 (patch) | |
tree | 47c61f5d8c3f031ef7f45f108e70d3785112037c | |
parent | 2966af73e70dee461c256b5eb877b2ff757f8c82 (diff) |
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>
-rw-r--r-- | arch/s390/include/asm/kvm_virtio.h | 4 | ||||
-rw-r--r-- | drivers/s390/kvm/kvm_virtio.c | 9 |
2 files changed, 10 insertions, 3 deletions
diff --git a/arch/s390/include/asm/kvm_virtio.h b/arch/s390/include/asm/kvm_virtio.h index c13568b9351c..0503936f101f 100644 --- a/arch/s390/include/asm/kvm_virtio.h +++ b/arch/s390/include/asm/kvm_virtio.h | |||
@@ -50,6 +50,10 @@ struct kvm_vqconfig { | |||
50 | #define KVM_S390_VIRTIO_RESET 1 | 50 | #define KVM_S390_VIRTIO_RESET 1 |
51 | #define KVM_S390_VIRTIO_SET_STATUS 2 | 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 | #ifdef __KERNEL__ | 57 | #ifdef __KERNEL__ |
54 | /* early virtio console setup */ | 58 | /* early virtio console setup */ |
55 | #ifdef CONFIG_S390_GUEST | 59 | #ifdef CONFIG_S390_GUEST |
diff --git a/drivers/s390/kvm/kvm_virtio.c b/drivers/s390/kvm/kvm_virtio.c index 3d442444c618..f5a2dbe75575 100644 --- a/drivers/s390/kvm/kvm_virtio.c +++ b/drivers/s390/kvm/kvm_virtio.c | |||
@@ -188,7 +188,8 @@ static struct virtqueue *kvm_find_vq(struct virtio_device *vdev, | |||
188 | config = kvm_vq_config(kdev->desc)+index; | 188 | config = kvm_vq_config(kdev->desc)+index; |
189 | 189 | ||
190 | err = vmem_add_mapping(config->address, | 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 | if (err) | 193 | if (err) |
193 | goto out; | 194 | goto out; |
194 | 195 | ||
@@ -209,7 +210,8 @@ static struct virtqueue *kvm_find_vq(struct virtio_device *vdev, | |||
209 | return vq; | 210 | return vq; |
210 | unmap: | 211 | unmap: |
211 | vmem_remove_mapping(config->address, | 212 | vmem_remove_mapping(config->address, |
212 | vring_size(config->num, PAGE_SIZE)); | 213 | vring_size(config->num, |
214 | KVM_S390_VIRTIO_RING_ALIGN)); | ||
213 | out: | 215 | out: |
214 | return ERR_PTR(err); | 216 | return ERR_PTR(err); |
215 | } | 217 | } |
@@ -220,7 +222,8 @@ static void kvm_del_vq(struct virtqueue *vq) | |||
220 | 222 | ||
221 | vring_del_virtqueue(vq); | 223 | vring_del_virtqueue(vq); |
222 | vmem_remove_mapping(config->address, | 224 | vmem_remove_mapping(config->address, |
223 | vring_size(config->num, PAGE_SIZE)); | 225 | vring_size(config->num, |
226 | KVM_S390_VIRTIO_RING_ALIGN)); | ||
224 | } | 227 | } |
225 | 228 | ||
226 | /* | 229 | /* |