9ae3a8
From 26631da9bba6bcf000b4a87715cb3e8364afc373 Mon Sep 17 00:00:00 2001
9ae3a8
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
9ae3a8
Date: Tue, 10 Feb 2015 11:45:35 +0100
9ae3a8
Subject: [PATCH 09/16] Restore atapi_dma flag across migration
9ae3a8
9ae3a8
Message-id: <1423568736-19538-2-git-send-email-dgilbert@redhat.com>
9ae3a8
Patchwork-id: 63778
9ae3a8
O-Subject: [RHEL-7.2 qemu-kvm PATCH 1/2] Restore atapi_dma flag across migration
9ae3a8
Bugzilla: 892258
9ae3a8
RH-Acked-by: Juan Quintela <quintela@redhat.com>
9ae3a8
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
9ae3a8
RH-Acked-by: John Snow <jsnow@redhat.com>
9ae3a8
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
9ae3a8
9ae3a8
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
9ae3a8
9ae3a8
If a migration happens just after the guest has kicked
9ae3a8
off an ATAPI command and kicked off DMA, we lose the atapi_dma
9ae3a8
flag, and the destination tries to complete the command as PIO
9ae3a8
rather than DMA.  This upsets Linux; modern libata based kernels
9ae3a8
stumble and recover OK, older kernels end up passing bad data
9ae3a8
to userspace.
9ae3a8
9ae3a8
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
9ae3a8
Reviewed-by: John Snow <jsnow@redhat.com>
9ae3a8
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
9ae3a8
(cherry picked from commit 819fa276311ce328a8e38ad9306c1093961b3f4b)
9ae3a8
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
9ae3a8
---
9ae3a8
 hw/ide/core.c | 1 +
9ae3a8
 1 file changed, 1 insertion(+)
9ae3a8
9ae3a8
diff --git a/hw/ide/core.c b/hw/ide/core.c
9ae3a8
index 24a1708..9a22425 100644
9ae3a8
--- a/hw/ide/core.c
9ae3a8
+++ b/hw/ide/core.c
9ae3a8
@@ -2283,6 +2283,7 @@ static int ide_drive_pio_post_load(void *opaque, int version_id)
9ae3a8
     s->end_transfer_func = transfer_end_table[s->end_transfer_fn_idx];
9ae3a8
     s->data_ptr = s->io_buffer + s->cur_io_buffer_offset;
9ae3a8
     s->data_end = s->data_ptr + s->cur_io_buffer_len;
9ae3a8
+    s->atapi_dma = s->feature & 1; /* as per cmd_packet */
9ae3a8
 
9ae3a8
     return 0;
9ae3a8
 }
9ae3a8
-- 
9ae3a8
1.8.3.1
9ae3a8