Skip to contentSkip to conversation

[5369] Check that asynchronous (DMA) submission succeeds (Ian Jackson).

Qemu-devel Andrzej Zaborowski 1 participant 1 message Oct 1, 2008

lore
Share & tools
lore
#0 lore raw

Revision: 5369

          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5369
Author:   balrog
Date:     2008-10-01 01:43:16 +0000 (Wed, 01 Oct 2008)

Log Message:
-----------
Check that asynchronous (DMA) submission succeeds (Ian Jackson).

If it does not, abort the command immediately rather than dropping it on the floor.

Modified Paths:
--------------
trunk/hw/ide.c

Modified: trunk/hw/ide.c
===================================================================

hw/ide.c +10 -0
@@ -738,6 +738,14 @@
     s->error = ABRT_ERR;
 }
 
+static inline void ide_dma_submit_check(IDEState *s,
+          BlockDriverCompletionFunc *dma_cb, BMDMAState *bm)
+{
+    if (bm->aiocb)
+	return;
+    dma_cb(bm, -1);
+}
+
 static inline void ide_set_irq(IDEState *s)
 {
     BMDMAState *bm = s->bmdma;
@@ -954,6 +962,7 @@
 #endif
     bm->aiocb = bdrv_aio_read(s->bs, sector_num, s->io_buffer, n,
                               ide_read_dma_cb, bm);
+    ide_dma_submit_check(s, ide_read_dma_cb, bm);
 }
 
 static void ide_sector_read_dma(IDEState *s)
@@ -1065,6 +1074,7 @@
 #endif
     bm->aiocb = bdrv_aio_write(s->bs, sector_num, s->io_buffer, n,
                                ide_write_dma_cb, bm);
+    ide_dma_submit_check(s, ide_write_dma_cb, bm);
 }
 
 static void ide_sector_write_dma(IDEState *s)