From a25e6b307459d087d3a1756f1313817750a9f57b Mon Sep 17 00:00:00 2001 From: Xiao Wang Date: Mon, 10 Jul 2017 04:07:57 +0200 Subject: [PATCH 1/2] virtio-scsi: finalize IOMMU support RH-Author: Xiao Wang Message-id: <1499659677-16258-1-git-send-email-jasowang@redhat.com> Patchwork-id: 75711 O-Subject: [RHEL7.4.z qemu-kvm-rhev PATCH] virtio-scsi: finalize IOMMU support Bugzilla: 1471076 RH-Acked-by: Paolo Bonzini RH-Acked-by: Fam Zheng RH-Acked-by: Peter Xu Bugzilla: 1467883 Test status: Tested by my self with the seabios patch for virtio-scsi Brew build: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=13623048 After converting to use DMA api for virtio devices, we should use dma_as instead of address_space_memory. Otherwise it won't work if IOMMU is enabled. Fixes: commit 8607f5c3072c ("virtio: convert to use DMA api") Cc: qemu-stable@nongnu.org Signed-off-by: Jason Wang Message-Id: <1499170866-9068-1-git-send-email-jasowang@redhat.com> Signed-off-by: Paolo Bonzini (cherry picked from commit 025bdeab3c163aee9604a60b2332a5fcbcc00f8d) Signed-off-by: Miroslav Rezanina --- hw/scsi/virtio-scsi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c index 4edf449..bfbe8f5 100644 --- a/hw/scsi/virtio-scsi.c +++ b/hw/scsi/virtio-scsi.c @@ -43,12 +43,13 @@ static inline SCSIDevice *virtio_scsi_device_find(VirtIOSCSI *s, uint8_t *lun) void virtio_scsi_init_req(VirtIOSCSI *s, VirtQueue *vq, VirtIOSCSIReq *req) { + VirtIODevice *vdev = VIRTIO_DEVICE(s); const size_t zero_skip = offsetof(VirtIOSCSIReq, resp_iov) + sizeof(req->resp_iov); req->vq = vq; req->dev = s; - qemu_sglist_init(&req->qsgl, DEVICE(s), 8, &address_space_memory); + qemu_sglist_init(&req->qsgl, DEVICE(s), 8, vdev->dma_as); qemu_iovec_init(&req->resp_iov, 1); memset((uint8_t *)req + zero_skip, 0, sizeof(*req) - zero_skip); } -- 1.8.3.1