From: Ian Jackson Date: Fri, 1 Aug 2008 15:56:13 +0000 (+0100) Subject: [ide] Check that asynchronous (DMA) submission succeeds X-Git-Tag: xen-3.3.0-rc3~4^2 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=refs%2Fheads%2Fqemu;p=qemu-xen-3.3-testing.git [ide] Check that asynchronous (DMA) submission succeeds If it does not, abort the command immediately rather than dropping it on the floor. Signed-off-by: Ian Jackson --- diff --git a/hw/ide.c b/hw/ide.c index f70ea30a..68c6f859 100644 --- a/hw/ide.c +++ b/hw/ide.c @@ -723,6 +723,13 @@ static inline void ide_abort_command(IDEState *s) s->status = READY_STAT | ERR_STAT; 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) { @@ -947,6 +954,7 @@ static void ide_read_dma_cb(void *opaque, int ret) #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) @@ -1077,6 +1085,7 @@ static void ide_write_dma_cb(void *opaque, int ret) #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)