[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 1/5] libqos/ahci: fix ahci_command_wait()
From: |
Niklas Cassel |
Subject: |
[PATCH 1/5] libqos/ahci: fix ahci_command_wait() |
Date: |
Thu, 8 Jun 2023 17:15:24 +0200 |
From: Niklas Cassel <niklas.cassel@wdc.com>
A command that has ERR_STAT set, does not get to clear PxCI.
See AHCI 1.3.1, section 5.3.8, states RegFIS:Entry and RegFIS:ClearCI,
and 5.3.16.5 ERR:FatalTaskfile.
Some tests, e.g. test_atapi_tray() call ahci_atapi_test_ready() with
ready == false, intentionally sending a command that will cause an error.
Thus, ahci_command_wait() cannot simply wait indefinitely for PxCI to be
cleared, it also has to take ERR_STAT into account.
Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
---
tests/qtest/libqos/ahci.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/tests/qtest/libqos/ahci.c b/tests/qtest/libqos/ahci.c
index f53f12aa99..c1d571e477 100644
--- a/tests/qtest/libqos/ahci.c
+++ b/tests/qtest/libqos/ahci.c
@@ -1207,9 +1207,10 @@ void ahci_command_wait(AHCIQState *ahci, AHCICommand
*cmd)
#define RSET(REG, MASK) (BITSET(ahci_px_rreg(ahci, cmd->port, (REG)), (MASK)))
- while (RSET(AHCI_PX_TFD, AHCI_PX_TFD_STS_BSY) ||
- RSET(AHCI_PX_CI, 1 << cmd->slot) ||
- (cmd->props->ncq && RSET(AHCI_PX_SACT, 1 << cmd->slot))) {
+ while (!RSET(AHCI_PX_TFD, AHCI_PX_TFD_STS_ERR) &&
+ (RSET(AHCI_PX_TFD, AHCI_PX_TFD_STS_BSY) ||
+ RSET(AHCI_PX_CI, 1 << cmd->slot) ||
+ (cmd->props->ncq && RSET(AHCI_PX_SACT, 1 << cmd->slot)))) {
usleep(50);
}
--
2.40.1
- [PATCH 0/5] improve ahci test suite, Niklas Cassel, 2023/06/08
- [PATCH 1/5] libqos/ahci: fix ahci_command_wait(),
Niklas Cassel <=
- [PATCH 2/5] libqos/ahci: fix ahci_port_check_nonbusy(), Niklas Cassel, 2023/06/08
- [PATCH 3/5] libqos/ahci: simplify ahci_port_check_error(), Niklas Cassel, 2023/06/08
- [PATCH 4/5] libqos/ahci: improve ahci_port_check_error(), Niklas Cassel, 2023/06/08
- [PATCH 5/5] libqos/ahci: perform mandatory error recovery on error, Niklas Cassel, 2023/06/08
- Re: [PATCH 0/5] improve ahci test suite, John Snow, 2023/06/08