[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Stable-8.1.1 27/34] hw/ide/ahci: fix ahci_write_fis_sdb()
From: |
Michael Tokarev |
Subject: |
[Stable-8.1.1 27/34] hw/ide/ahci: fix ahci_write_fis_sdb() |
Date: |
Sat, 9 Sep 2023 13:27:20 +0300 |
From: Niklas Cassel <niklas.cassel@wdc.com>
When there is an error, we need to raise a TFES error irq, see AHCI 1.3.1,
5.3.13.1 SDB:Entry.
If ERR_STAT is set, we jump to state ERR:FatalTaskfile, which will raise
a TFES IRQ unconditionally, regardless if the I bit is set in the FIS or
not.
Thus, we should never raise a normal IRQ after having sent an error IRQ.
It is valid to signal successfully completed commands as finished in the
same SDB FIS that generates the error IRQ. The important thing is that
commands that did not complete successfully (e.g. commands that were
aborted, do not get the finished bit set).
Before this commit, there was never a TFES IRQ raised on NCQ error.
Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-id: 20230609140844.202795-8-nks@flawful.org
Signed-off-by: John Snow <jsnow@redhat.com>
(cherry picked from commit 7e85cb0db4c693b4e084a00e66fe73a22ed1688a)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c
index 12aaadc554..ef6c9fc378 100644
--- a/hw/ide/ahci.c
+++ b/hw/ide/ahci.c
@@ -806,8 +806,14 @@ static void ahci_write_fis_sdb(AHCIState *s,
NCQTransferState *ncq_tfs)
pr->scr_act &= ~ad->finished;
ad->finished = 0;
- /* Trigger IRQ if interrupt bit is set (which currently, it always is) */
- if (sdb_fis->flags & 0x40) {
+ /*
+ * TFES IRQ is always raised if ERR_STAT is set, regardless of I bit.
+ * If ERR_STAT is not set, trigger SDBS IRQ if interrupt bit is set
+ * (which currently, it always is).
+ */
+ if (sdb_fis->status & ERR_STAT) {
+ ahci_trigger_irq(s, ad, AHCI_PORT_IRQ_BIT_TFES);
+ } else if (sdb_fis->flags & 0x40) {
ahci_trigger_irq(s, ad, AHCI_PORT_IRQ_BIT_SDBS);
}
}
--
2.39.2
- [Stable-8.1.1 18/34] ppc/vof: Fix missed fields in VOF cleanup, (continued)
- [Stable-8.1.1 18/34] ppc/vof: Fix missed fields in VOF cleanup, Michael Tokarev, 2023/09/09
- [Stable-8.1.1 19/34] hw/ppc/e500: fix broken snapshot replay, Michael Tokarev, 2023/09/09
- [Stable-8.1.1 20/34] target/ppc: Flush inputs to zero with NJ in ppc_store_vscr, Michael Tokarev, 2023/09/09
- [Stable-8.1.1 22/34] hw/ide/core: set ERR_STAT in unsupported command completion, Michael Tokarev, 2023/09/09
- [Stable-8.1.1 21/34] target/ppc: Fix LQ, STQ register-pair order for big-endian, Michael Tokarev, 2023/09/09
- [Stable-8.1.1 23/34] hw/ide/ahci: write D2H FIS when processing NCQ command, Michael Tokarev, 2023/09/09
- [Stable-8.1.1 24/34] hw/ide/ahci: simplify and document PxCI handling, Michael Tokarev, 2023/09/09
- [Stable-8.1.1 26/34] hw/ide/ahci: PxCI should not get cleared when ERR_STAT is set, Michael Tokarev, 2023/09/09
- [Stable-8.1.1 25/34] hw/ide/ahci: PxSACT and PxCI is cleared when PxCMD.ST is cleared, Michael Tokarev, 2023/09/09
- [Stable-8.1.1 28/34] hw/ide/ahci: fix broken SError handling, Michael Tokarev, 2023/09/09
- [Stable-8.1.1 27/34] hw/ide/ahci: fix ahci_write_fis_sdb(),
Michael Tokarev <=
- [Stable-8.1.1 29/34] hw/i2c/aspeed: Fix Tx count and Rx size error in buffer pool mode, Michael Tokarev, 2023/09/09
- [Stable-8.1.1 30/34] hw/i2c/aspeed: Fix TXBUF transmission start position error, Michael Tokarev, 2023/09/09
- [Stable-8.1.1 31/34] qemu-options.hx: Rephrase the descriptions of the -hd* and -cdrom options, Michael Tokarev, 2023/09/09
- [Stable-8.1.1 32/34] docs tests: Fix use of migrate_set_parameter, Michael Tokarev, 2023/09/09
- [Stable-8.1.1 33/34] hw/net/vmxnet3: Fix guest-triggerable assert(), Michael Tokarev, 2023/09/09
- [Stable-8.1.1 34/34] qxl: don't assert() if device isn't yet initialized, Michael Tokarev, 2023/09/09