• Szuying Chen's avatar
    ata: libahci: clear pending interrupt status · 737dd811
    Szuying Chen authored
    When a CRC error occurs, the HBA asserts an interrupt to indicate an
    interface fatal error (PxIS.IFS). The ISR clears PxIE and PxIS, then
    does error recovery. If the adapter receives another SDB FIS
    with an error (PxIS.TFES) from the device before the start of the EH
    recovery process, the interrupt signaling the new SDB cannot be
    serviced as PxIE was cleared already. This in turn results in the HBA
    inability to issue any command during the error recovery process after
    setting PxCMD.ST to 1 because PxIS.TFES is still set.
    
    According to AHCI 1.3.1 specifications section 6.2.2, fatal errors
    notified by setting PxIS.HBFS, PxIS.HBDS, PxIS.IFS or PxIS.TFES will
    cause the HBA to enter the ERR:Fatal state. In this state, the HBA
    shall not issue any new commands.
    
    To avoid this situation, introduce the function
    ahci_port_clear_pending_irq() to clear pending interrupts before
    executing a COMRESET. This follows the AHCI 1.3.1 - section 6.2.2.2
    specification.
    Signed-off-by: default avatarSzuying Chen <Chloe_Chen@asmedia.com.tw>
    Fixes: e0bfd149 ("[PATCH] ahci: stop engine during hard reset")
    Cc: stable@vger.kernel.org
    Reviewed-by: default avatarNiklas Cassel <niklas.cassel@wdc.com>
    Signed-off-by: default avatarDamien Le Moal <dlemoal@kernel.org>
    737dd811
libahci.c 72 KB