[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 13/14] ide: Clear error_status after restarting flus
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PATCH 13/14] ide: Clear error_status after restarting flush |
Date: |
Wed, 15 Jun 2011 16:03:12 +0200 |
Clearing the error status flag was missing for restarting flushes. Now that the
error status is separate from the BM status register, we can simply set it to 0
after restarting the request. This ensures that we never forget to clear a bit.
Signed-off-by: Kevin Wolf <address@hidden>
---
hw/ide/pci.c | 18 +++++++++++-------
1 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/hw/ide/pci.c b/hw/ide/pci.c
index c940375..9f3050a 100644
--- a/hw/ide/pci.c
+++ b/hw/ide/pci.c
@@ -189,6 +189,7 @@ static void bmdma_restart_bh(void *opaque)
BMDMAState *bm = opaque;
IDEBus *bus = bm->bus;
int is_read;
+ int error_status;
qemu_bh_delete(bm->bh);
bm->bh = NULL;
@@ -199,22 +200,25 @@ static void bmdma_restart_bh(void *opaque)
is_read = !!(bus->error_status & BM_STATUS_RETRY_READ);
- if (bus->error_status & BM_STATUS_DMA_RETRY) {
- if (bus->error_status & BM_STATUS_RETRY_TRIM) {
- bus->error_status &= ~BM_STATUS_RETRY_TRIM;
+ /* The error status must be cleared before resubmitting the request: The
+ * request may fail again, and this case can only be distinguished if the
+ * called function can set a new error status. */
+ error_status = bus->error_status;
+ bus->error_status = 0;
+
+ if (error_status & BM_STATUS_DMA_RETRY) {
+ if (error_status & BM_STATUS_RETRY_TRIM) {
bmdma_restart_dma(bm, IDE_DMA_TRIM);
} else {
- bus->error_status &= ~(BM_STATUS_DMA_RETRY | BM_STATUS_RETRY_READ);
bmdma_restart_dma(bm, is_read ? IDE_DMA_READ : IDE_DMA_WRITE);
}
- } else if (bus->error_status & BM_STATUS_PIO_RETRY) {
- bus->error_status &= ~(BM_STATUS_PIO_RETRY | BM_STATUS_RETRY_READ);
+ } else if (error_status & BM_STATUS_PIO_RETRY) {
if (is_read) {
ide_sector_read(bmdma_active_if(bm));
} else {
ide_sector_write(bmdma_active_if(bm));
}
- } else if (bus->error_status & BM_STATUS_RETRY_FLUSH) {
+ } else if (error_status & BM_STATUS_RETRY_FLUSH) {
ide_flush_cache(bmdma_active_if(bm));
}
}
--
1.7.5.2
- [Qemu-devel] [PATCH 01/14] block/rbd: Remove unused local variable, (continued)
- [Qemu-devel] [PATCH 01/14] block/rbd: Remove unused local variable, Kevin Wolf, 2011/06/15
- [Qemu-devel] [PATCH 04/14] vdi: Avoid direct AIO callback, Kevin Wolf, 2011/06/15
- [Qemu-devel] [PATCH 02/14] qcow2: Avoid direct AIO callback, Kevin Wolf, 2011/06/15
- [Qemu-devel] [PATCH 06/14] qcow2: Fix in-flight list after qcow2_cache_put failure, Kevin Wolf, 2011/06/15
- [Qemu-devel] [PATCH 05/14] Replaced tabs with spaces in block.h and block_int.h, Kevin Wolf, 2011/06/15
- [Qemu-devel] [PATCH 07/14] ide: Split error status from status register, Kevin Wolf, 2011/06/15
- [Qemu-devel] [PATCH 08/14] ide: Fix ide_drive_pio_state_needed(), Kevin Wolf, 2011/06/15
- [Qemu-devel] [PATCH 09/14] ide: Add forgotten VMSTATE_END_OF_LIST in subsection, Kevin Wolf, 2011/06/15
- [Qemu-devel] [PATCH 10/14] make dma_bdrv_io available to drivers, Kevin Wolf, 2011/06/15
- [Qemu-devel] [PATCH 11/14] ide: allow other dma comands than read and write, Kevin Wolf, 2011/06/15
- [Qemu-devel] [PATCH 13/14] ide: Clear error_status after restarting flush,
Kevin Wolf <=
- [Qemu-devel] [PATCH 03/14] qcow: Avoid direct AIO callback, Kevin Wolf, 2011/06/15
- [Qemu-devel] [PATCH 14/14] Allow nested qemu_bh_poll() after BH deletion, Kevin Wolf, 2011/06/15
- [Qemu-devel] [PATCH 12/14] ide: add TRIM support, Kevin Wolf, 2011/06/15
- Re: [Qemu-devel] [PULL 00/14] Block patches, Anthony Liguori, 2011/06/15