Skip to content

Commit 7faa33d

Browse files
htejunJeff Garzik
authored andcommitted
ahci: start engine only during soft/hard resets
This is another attempt at fixing the same problem that 270dac3 (libata: ahci_start_engine compliant to AHCI spec) tried to solve. Unfortunately, 270dac3 created regressions for a lot more common controllers and got reverted. This specific AHCI IP block becomes a brick if the DMA engine is started while DRQ is set. It is not possible to avoid the condition completely but the most common occurrence is caused by spurious use of ahci_start_engine() from ahci_start_port() during init sequence. DMA engine is started after both soft and hard resets and ahci_start_port() is always followed by resets, so there is no reason to start DMA engine from ahci_start_port(). This patch removes ahci_start_engine() invocation from ahci_start_port(). This change makes failure path of ahci_port_suspend() leave engine stopped without following resets. This is resolved by replacing ahci_start_port() call with ata_port_freeze() which forces resets afterwards, which is the better behavior anyway. Signed-off-by: Tejun Heo <tj@kernel.org> Reported-by: Brian Norris <computersforpeace@gmail.com> Reported-by: Jian Peng <jipeng2005@gmail.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
1 parent 805a6af commit 7faa33d

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

drivers/ata/libahci.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -746,9 +746,6 @@ static void ahci_start_port(struct ata_port *ap)
746746
/* enable FIS reception */
747747
ahci_start_fis_rx(ap);
748748

749-
/* enable DMA */
750-
ahci_start_engine(ap);
751-
752749
/* turn on LEDs */
753750
if (ap->flags & ATA_FLAG_EM) {
754751
ata_for_each_link(link, ap, EDGE) {
@@ -2022,7 +2019,7 @@ static int ahci_port_suspend(struct ata_port *ap, pm_message_t mesg)
20222019
ahci_power_down(ap);
20232020
else {
20242021
ata_port_err(ap, "%s (%d)\n", emsg, rc);
2025-
ahci_start_port(ap);
2022+
ata_port_freeze(ap);
20262023
}
20272024

20282025
return rc;

0 commit comments

Comments
 (0)