[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 07/16] ahci: kick NCQ queue
From: |
John Snow |
Subject: |
[Qemu-devel] [PATCH 07/16] ahci: kick NCQ queue |
Date: |
Mon, 22 Jun 2015 20:21:06 -0400 |
Upon a VM state change, retry the halted NCQ commands.
Signed-off-by: John Snow <address@hidden>
---
hw/ide/ahci.c | 18 ++++++++++++++++++
hw/ide/core.c | 7 +++++++
hw/ide/internal.h | 1 +
3 files changed, 26 insertions(+)
diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c
index a838317..6233059 100644
--- a/hw/ide/ahci.c
+++ b/hw/ide/ahci.c
@@ -1332,6 +1332,23 @@ static void ahci_restart_dma(IDEDMA *dma)
}
/**
+ * IDE/PIO restarts are handled by the core layer, but NCQ commands
+ * need an extra kick from the AHCI HBA.
+ */
+static void ahci_restart(IDEDMA *dma)
+{
+ AHCIDevice *ad = DO_UPCAST(AHCIDevice, dma, dma);
+ int i;
+
+ for (i = 0; i < AHCI_MAX_CMDS; i++) {
+ NCQTransferState *ncq_tfs = &ad->ncq_tfs[i];
+ if (ncq_tfs->halt) {
+ execute_ncq_command(ncq_tfs);
+ }
+ }
+}
+
+/**
* Called in DMA R/W chains to read the PRDT, utilizing ahci_populate_sglist.
* Not currently invoked by PIO R/W chains,
* which invoke ahci_populate_sglist via ahci_start_transfer.
@@ -1419,6 +1436,7 @@ static void ahci_irq_set(void *opaque, int n, int level)
static const IDEDMAOps ahci_dma_ops = {
.start_dma = ahci_start_dma,
+ .restart = ahci_restart,
.restart_dma = ahci_restart_dma,
.start_transfer = ahci_start_transfer,
.prepare_buf = ahci_dma_prepare_buf,
diff --git a/hw/ide/core.c b/hw/ide/core.c
index 6eefb30..8c271cc 100644
--- a/hw/ide/core.c
+++ b/hw/ide/core.c
@@ -2372,6 +2372,13 @@ static void ide_restart_bh(void *opaque)
* called function can set a new error status. */
bus->error_status = 0;
+ /* The HBA has generically asked to be kicked on retry */
+ if (error_status & IDE_RETRY_HBA) {
+ if (s->bus->dma->ops->restart) {
+ s->bus->dma->ops->restart(s->bus->dma);
+ }
+ }
+
if (error_status & IDE_RETRY_DMA) {
if (error_status & IDE_RETRY_TRIM) {
ide_restart_dma(s, IDE_DMA_TRIM);
diff --git a/hw/ide/internal.h b/hw/ide/internal.h
index 5abee19..adb968c 100644
--- a/hw/ide/internal.h
+++ b/hw/ide/internal.h
@@ -436,6 +436,7 @@ struct IDEDMAOps {
DMAInt32Func *prepare_buf;
DMAu32Func *commit_buf;
DMAIntFunc *rw_buf;
+ DMAVoidFunc *restart;
DMAVoidFunc *restart_dma;
DMAStopFunc *set_inactive;
DMAVoidFunc *cmd_done;
--
2.1.0
- [Qemu-devel] [PATCH 04/16] ahci: refactor process_ncq_command, (continued)
- [Qemu-devel] [PATCH 04/16] ahci: refactor process_ncq_command, John Snow, 2015/06/22
- [Qemu-devel] [PATCH 05/16] ahci: factor ncq_finish out of ncq_cb, John Snow, 2015/06/22
- [Qemu-devel] [PATCH 06/16] ahci: record ncq failures, John Snow, 2015/06/22
- Re: [Qemu-devel] [PATCH 06/16] ahci: record ncq failures, Stefan Hajnoczi, 2015/06/26
- Re: [Qemu-devel] [PATCH 06/16] ahci: record ncq failures, John Snow, 2015/06/26
- Re: [Qemu-devel] [Qemu-block] [PATCH 06/16] ahci: record ncq failures, Stefan Hajnoczi, 2015/06/29
- Re: [Qemu-devel] [Qemu-block] [PATCH 06/16] ahci: record ncq failures, Stefan Hajnoczi, 2015/06/29
- Re: [Qemu-devel] [Qemu-block] [PATCH 06/16] ahci: record ncq failures, John Snow, 2015/06/29
- Re: [Qemu-devel] [Qemu-block] [PATCH 06/16] ahci: record ncq failures, John Snow, 2015/06/29
- Re: [Qemu-devel] [Qemu-block] [PATCH 06/16] ahci: record ncq failures, Stefan Hajnoczi, 2015/06/30
[Qemu-devel] [PATCH 07/16] ahci: kick NCQ queue,
John Snow <=
[Qemu-devel] [PATCH 08/16] ahci: correct types in NCQTransferState, John Snow, 2015/06/22
[Qemu-devel] [PATCH 09/16] ahci: correct ncq sector count, John Snow, 2015/06/22
[Qemu-devel] [PATCH 10/16] qtest/ahci: halted NCQ test, John Snow, 2015/06/22
[Qemu-devel] [PATCH 01/16] ide: add limit to .prepare_buf(), John Snow, 2015/06/22
[Qemu-devel] [PATCH 13/16] ahci: add get_cmd_header helper, John Snow, 2015/06/22