qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 1/2] Restore atapi_dma flag across migration


From: John Snow
Subject: Re: [Qemu-devel] [PATCH 1/2] Restore atapi_dma flag across migration
Date: Wed, 10 Dec 2014 00:04:59 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0



On 12/09/2014 01:15 PM, Dr. David Alan Gilbert (git) wrote:
From: "Dr. David Alan Gilbert" <address@hidden>

If a migration happens just after the guest has kicked
off an ATAPI command and kicked off DMA, we lose the atapi_dma
flag, and the destination tries to complete the command as PIO
rather than DMA.  This upsets Linux; modern libata based kernels
stumble and recover OK, older kernels end up passing bad data
to userspace.

Signed-off-by: Dr. David Alan Gilbert <address@hidden>
---
  hw/ide/core.c | 1 +
  1 file changed, 1 insertion(+)

diff --git a/hw/ide/core.c b/hw/ide/core.c
index d4af5e2..ac3f015 100644
--- a/hw/ide/core.c
+++ b/hw/ide/core.c
@@ -2417,6 +2417,7 @@ static int ide_drive_pio_post_load(void *opaque, int 
version_id)
      s->end_transfer_func = transfer_end_table[s->end_transfer_fn_idx];
      s->data_ptr = s->io_buffer + s->cur_io_buffer_offset;
      s->data_end = s->data_ptr + s->cur_io_buffer_len;
+    s->atapi_dma = s->feature & 1; /* as per cmd_packet */

      return 0;
  }


This looks fine to me; though perhaps a more comprehensive fix might prevent us needing this at all. As the code exists today, it's definitely an error to lose this value, as you've noticed.

Reviewed-by: John Snow <address@hidden>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]