Commit 5604e090cba05e9ef881b5ff9ce09c6a2a1a476b

Authored by balrog
1 parent e162cfb0

Check that asynchronous (DMA) submission succeeds (Ian Jackson).

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

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5369 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 10 additions and 0 deletions
hw/ide.c
... ... @@ -738,6 +738,14 @@ static inline void ide_abort_command(IDEState *s)
738 738 s->error = ABRT_ERR;
739 739 }
740 740  
  741 +static inline void ide_dma_submit_check(IDEState *s,
  742 + BlockDriverCompletionFunc *dma_cb, BMDMAState *bm)
  743 +{
  744 + if (bm->aiocb)
  745 + return;
  746 + dma_cb(bm, -1);
  747 +}
  748 +
741 749 static inline void ide_set_irq(IDEState *s)
742 750 {
743 751 BMDMAState *bm = s->bmdma;
... ... @@ -954,6 +962,7 @@ static void ide_read_dma_cb(void *opaque, int ret)
954 962 #endif
955 963 bm->aiocb = bdrv_aio_read(s->bs, sector_num, s->io_buffer, n,
956 964 ide_read_dma_cb, bm);
  965 + ide_dma_submit_check(s, ide_read_dma_cb, bm);
957 966 }
958 967  
959 968 static void ide_sector_read_dma(IDEState *s)
... ... @@ -1065,6 +1074,7 @@ static void ide_write_dma_cb(void *opaque, int ret)
1065 1074 #endif
1066 1075 bm->aiocb = bdrv_aio_write(s->bs, sector_num, s->io_buffer, n,
1067 1076 ide_write_dma_cb, bm);
  1077 + ide_dma_submit_check(s, ide_write_dma_cb, bm);
1068 1078 }
1069 1079  
1070 1080 static void ide_sector_write_dma(IDEState *s)
... ...