yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
05bba0
From c732ec0ec457f0cb003b3b1db56c0bd96432baac Mon Sep 17 00:00:00 2001
05bba0
From: Stefan Hajnoczi <stefanha@redhat.com>
05bba0
Date: Mon, 3 Aug 2015 16:51:19 +0200
05bba0
Subject: [PATCH 05/13] virtio-scsi: use virtqueue_map_sg() when loading
05bba0
 requests
05bba0
05bba0
Message-id: <1438620680-24121-2-git-send-email-stefanha@redhat.com>
05bba0
Patchwork-id: 67255
05bba0
O-Subject: [RHEL-7.2 qemu-kvm PATCH 1/2] virtio-scsi: use virtqueue_map_sg() when loading requests
05bba0
Bugzilla: 1249718
05bba0
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
05bba0
RH-Acked-by: Fam Zheng <famz@redhat.com>
05bba0
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
05bba0
05bba0
The VirtQueueElement struct is serialized during migration but the
05bba0
in_sg[]/out_sg[] iovec arrays are not usable on the destination host
05bba0
because the pointers are meaningless.
05bba0
05bba0
Use virtqueue_map_sg() to refresh in_sg[]/out_sg[] to valid pointers
05bba0
based on in_addr[]/out_addr[] hwaddrs.
05bba0
05bba0
Cc: Paolo Bonzini <pbonzini@redhat.com>
05bba0
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
05bba0
Message-Id: <1438262173-11546-2-git-send-email-stefanha@redhat.com>
05bba0
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
05bba0
(cherry picked from commit 1cc933453bf2baae1feb7c8e757bdfd0ef639002)
05bba0
05bba0
Conficts:
05bba0
 * Context conflict because upstream has error handling code for
05bba0
   virtio_scsi_parse_req().
05bba0
05bba0
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
05bba0
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
05bba0
---
05bba0
 hw/scsi/virtio-scsi.c | 6 ++++++
05bba0
 1 file changed, 6 insertions(+)
05bba0
05bba0
diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c
05bba0
index cda8f8a..8232fc9 100644
05bba0
--- a/hw/scsi/virtio-scsi.c
05bba0
+++ b/hw/scsi/virtio-scsi.c
05bba0
@@ -154,6 +154,12 @@ static void *virtio_scsi_load_request(QEMUFile *f, SCSIRequest *sreq)
05bba0
 #endif
05bba0
     assert(req->elem.in_num <= ARRAY_SIZE(req->elem.in_sg));
05bba0
     assert(req->elem.out_num <= ARRAY_SIZE(req->elem.out_sg));
05bba0
+
05bba0
+    virtqueue_map_sg(req->elem.in_sg, req->elem.in_addr,
05bba0
+                     req->elem.in_num, 1);
05bba0
+    virtqueue_map_sg(req->elem.out_sg, req->elem.out_addr,
05bba0
+                     req->elem.out_num, 0);
05bba0
+
05bba0
     virtio_scsi_parse_req(s, vs->cmd_vqs[n], req);
05bba0
 
05bba0
     scsi_req_ref(sreq);
05bba0
-- 
05bba0
1.8.3.1
05bba0