From a71754e5b03fd3b8b8c6d3bc2a39f75bead729de Mon Sep 17 00:00:00 2001 From: "Dr. David Alan Gilbert" Date: Tue, 9 Dec 2014 18:15:09 +0000 Subject: atapi migration: Throw recoverable error to avoid recovery (With the previous atapi_dma flag recovery) If migration happens between the ATAPI command being written and the bmdma being started, the DMA is dropped. Eventually the guest times out and recovers, but that can take many seconds. (This is rare, on a pingpong reading the CD continuously I hit this about ~1/30-1/50 migrates) I don't think we've got enough state to be able to recover safely at this point, so I throw a 'medium error, no seek complete' that I'm assuming guests will try and recover from an apparently dirty CD. OK, it's a hack, the real solution is probably to push a lot of ATAPI state into the migration stream, but this is a fix that works with no stream changes. Tested only on Linux (both RHEL5 (pre-libata) and RHEL7). Signed-off-by: Dr. David Alan Gilbert Reviewed-by: John Snow Signed-off-by: Kevin Wolf --- hw/ide/pci.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'hw/ide/pci.c') diff --git a/hw/ide/pci.c b/hw/ide/pci.c index bee5ad3..e3f2054 100644 --- a/hw/ide/pci.c +++ b/hw/ide/pci.c @@ -235,6 +235,17 @@ static void bmdma_restart_bh(void *opaque) } } else if (error_status & IDE_RETRY_FLUSH) { ide_flush_cache(bmdma_active_if(bm)); + } else { + IDEState *s = bmdma_active_if(bm); + + /* + * We've not got any bits to tell us about ATAPI - but + * we do have the end_transfer_func that tells us what + * we're trying to do. + */ + if (s->end_transfer_func == ide_atapi_cmd) { + ide_atapi_dma_restart(s); + } } } -- cgit v1.1