[PATCH] sata_sil: update device hotplug handling, take #2

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



SIEN on some 3112 controllers doesn't mask SATA IRQ properly.  IRQ
stays asserted even after SIEN is masked and IRQ is acked.  Also, even
while frozen, any SATA PHY event including hardreset raises SATA IRQ.
Clearing SError seems to be the only way to deassert SATA IRQ.

This patch makes sil_host_intr() clear SError on SATA IRQs and ignore
SATA IRQs reported while frozen so that hardreset doesn't trigger
hotplug event (which ends up hardresetting again).

In such cases, the port still gets re-frozen to minimize the danger of
screaming interrupts.  This results in one nil EH repeat on
controllers with broken SIEN but other than that does no harm.

Signed-off-by: Tejun Heo <htejun@xxxxxxxxx>

---

Here's the revised version.  The PCMCIA 3112 controller simply cannot
mask SATA IRQs w/ SIEN.  I've tested it w/ discrete 3112 and 3114
cards and the PCMCIA one.  All work fine with this patch applied.

 drivers/scsi/sata_sil.c |   20 +++++++++++++++++++-
 1 files changed, 19 insertions(+), 1 deletions(-)

590d11f6b5303ea1b695e255d69eb7008e298913
diff --git a/drivers/scsi/sata_sil.c b/drivers/scsi/sata_sil.c
index a7e99a1..ec30a5c 100644
--- a/drivers/scsi/sata_sil.c
+++ b/drivers/scsi/sata_sil.c
@@ -344,7 +344,25 @@ static void sil_host_intr(struct ata_por
 	u8 status;
 
 	if (unlikely(bmdma2 & SIL_DMA_SATA_IRQ)) {
-		ata_ehi_hotplugged(&ap->eh_info);
+		u32 serror;
+
+		/* SIEN doesn't mask SATA IRQs on some 3112s.  Those
+		 * controllers continue to assert IRQ as long as
+		 * SError bits are pending.  Clear SError immediately.
+		 */
+		serror = sil_scr_read(ap, SCR_ERROR);
+		sil_scr_write(ap, SCR_ERROR, serror);
+
+		/* Trigger hotplug and accumulate SError only if the
+		 * port isn't already frozen.  Otherwise, PHY events
+		 * during hardreset makes controllers with broken SIEN
+		 * repeat probing needlessly.
+		 */
+		if (!(ap->flags & ATA_FLAG_FROZEN)) {
+			ata_ehi_hotplugged(&ap->eh_info);
+			ap->eh_info.serror |= serror;
+		}
+
 		goto freeze;
 	}
 
-- 
1.3.2

-
: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Filesystems]     [Linux SCSI]     [Linux RAID]     [Git]     [Kernel Newbies]     [Linux Newbie]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Samba]     [Device Mapper]

  Powered by Linux