[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 2/2] [ide] Check that asynchronous (DMA) submission
From: |
Ian Jackson |
Subject: |
[Qemu-devel] [PATCH 2/2] [ide] Check that asynchronous (DMA) submission succeeds |
Date: |
Mon, 01 Sep 2008 16:22:32 -0000 |
If it does not, abort the command immediately rather than dropping
it on the floor.
Signed-off-by: Ian Jackson <address@hidden>
Signed-off-by: Ian Jackson <address@hidden>
---
hw/ide.c | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/hw/ide.c b/hw/ide.c
index cddc0d5..fd3a055 100644
--- a/hw/ide.c
+++ b/hw/ide.c
@@ -737,6 +737,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)
{
@@ -954,6 +961,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)
@@ -1065,6 +1073,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)
--
1.4.4.4