qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCHv2] macio: handle non-block ATAPI DMA transfers the same as block DMA transfers
@ 2015-08-01 16:54 Mark Cave-Ayland
  2015-08-01 18:33 ` Aurelien Jarno
  0 siblings, 1 reply; 10+ messages in thread
From: Mark Cave-Ayland @ 2015-08-01 16:54 UTC (permalink / raw)
  To: aurelien, jsnow, agraf, qemu-devel

The existing code incorrectly changes the dma_active flag when a non-block
transfer has completed leading to a hang on newer versions of Linux because the
IDE and DMA engines deadlock waiting for each other.

Instead copy the buffer directly to RAM, set the remaining transfer size to 0 and
then invoke the ATAPI callback manually once again to correctly finish the
transfer in an identical manner to a block transfer.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---

v2: add missing goto

 hw/ide/macio.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/hw/ide/macio.c b/hw/ide/macio.c
index a55a479..bd245e9 100644
--- a/hw/ide/macio.c
+++ b/hw/ide/macio.c
@@ -247,8 +247,12 @@ static void pmac_ide_atapi_transfer_cb(void *opaque, int ret)
         /* Non-block ATAPI transfer - just copy to RAM */
         s->io_buffer_size = MIN(s->io_buffer_size, io->len);
         cpu_physical_memory_write(io->addr, s->io_buffer, s->io_buffer_size);
-        ide_atapi_cmd_ok(s);
-        m->dma_active = false;
+
+        /* Invoke callback as we would at the end of a standard block
+           transfer */
+        s->io_buffer_size = 0;
+        io->len = 0;
+        pmac_ide_atapi_transfer_cb(io, 0);
         goto done;
     }
 
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2015-08-24 18:43 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-01 16:54 [Qemu-devel] [PATCHv2] macio: handle non-block ATAPI DMA transfers the same as block DMA transfers Mark Cave-Ayland
2015-08-01 18:33 ` Aurelien Jarno
2015-08-01 18:54   ` Mark Cave-Ayland
2015-08-03 17:01     ` John Snow
2015-08-13 22:03   ` Mark Cave-Ayland
2015-08-13 22:59     ` John Snow
2015-08-17 20:39     ` Aurelien Jarno
2015-08-21 19:04     ` John Snow
2015-08-22  1:11       ` Mark Cave-Ayland
2015-08-24 18:43         ` John Snow

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).