diff options
author | Will Deacon <will@kernel.org> | 2019-10-10 15:20:03 +0100 |
---|---|---|
committer | Will Deacon <will@kernel.org> | 2019-10-25 11:52:19 +0100 |
commit | 207fb981dc220934d136d025579ffb19c420c474 (patch) | |
tree | 1b2b33459ebbb0ce423e30d6487323c59bcfec85 | |
parent | 51645dd54de52fac9ef6f80cd872a86e38010e07 (diff) | |
download | kvmtool-207fb981dc220934d136d025579ffb19c420c474.tar.gz |
virtio: Ensure virt_queue is always initialised
Failing to initialise the virt_queue via virtio_init_device_vq() leaves,
amongst other things, the endianness unspecified. On arm/arm64 this
results in virtio_guest_to_host_uxx() treating the queue as big-endian
and trying to translate bogus addresses:
Warning: unable to translate guest address 0x80b8249800000000 to host
Ensure the virt_queue is always initialised by the virtio device during
setup.
Cc: Marc Zyngier <maz@kernel.org>
Cc: Julien Thierry <julien.thierry.kdev@gmail.com>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Tested-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Will Deacon <will@kernel.org>
-rw-r--r-- | virtio/balloon.c | 1 | ||||
-rw-r--r-- | virtio/rng.c | 1 | ||||
-rw-r--r-- | virtio/scsi.c | 1 |
3 files changed, 3 insertions, 0 deletions
diff --git a/virtio/balloon.c b/virtio/balloon.c index 15a9a46e..0bd16703 100644 --- a/virtio/balloon.c +++ b/virtio/balloon.c @@ -212,6 +212,7 @@ static int init_vq(struct kvm *kvm, void *dev, u32 vq, u32 page_size, u32 align, thread_pool__init_job(&bdev->jobs[vq], kvm, virtio_bln_do_io, queue); vring_init(&queue->vring, VIRTIO_BLN_QUEUE_SIZE, p, align); + virtio_init_device_vq(&bdev->vdev, queue); return 0; } diff --git a/virtio/rng.c b/virtio/rng.c index 9dd757b7..78eaa64b 100644 --- a/virtio/rng.c +++ b/virtio/rng.c @@ -103,6 +103,7 @@ static int init_vq(struct kvm *kvm, void *dev, u32 vq, u32 page_size, u32 align, job = &rdev->jobs[vq]; vring_init(&queue->vring, VIRTIO_RNG_QUEUE_SIZE, p, align); + virtio_init_device_vq(&rdev->vdev, queue); *job = (struct rng_dev_job) { .vq = queue, diff --git a/virtio/scsi.c b/virtio/scsi.c index a72bb2a9..1ec78fe0 100644 --- a/virtio/scsi.c +++ b/virtio/scsi.c @@ -72,6 +72,7 @@ static int init_vq(struct kvm *kvm, void *dev, u32 vq, u32 page_size, u32 align, p = virtio_get_vq(kvm, queue->pfn, page_size); vring_init(&queue->vring, VIRTIO_SCSI_QUEUE_SIZE, p, align); + virtio_init_device_vq(&sdev->vdev, queue); if (sdev->vhost_fd == 0) return 0; |