Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5f226c6b authored by Tejun Heo's avatar Tejun Heo Committed by Jeff Garzik
Browse files

ahci: fix notification handling



Asynchronous notification on ICH9 didn't work because it didn't write
AN FIS into the RX area - it only updates SNotification.  Also,
snooping SDB_FIS RX area is racy against further SDB FIS receptions.
Let sata_async_notification() determine using SNTF if it's available
and snoop RX area iff SNTF isn't available

Signed-off-by: default avatarTejun Heo <htejun@gmail.com>
Cc: Kristen Carlson Accardi <kristen.c.accardi@intel.com>
Signed-off-by: default avatarJeff Garzik <jeff@garzik.org>
parent 1c954a4d
Loading
Loading
Loading
Loading
+21 −9
Original line number Original line Diff line number Diff line
@@ -1420,6 +1420,7 @@ static void ahci_port_intr(struct ata_port *ap)
	void __iomem *port_mmio = ap->ioaddr.cmd_addr;
	void __iomem *port_mmio = ap->ioaddr.cmd_addr;
	struct ata_eh_info *ehi = &ap->link.eh_info;
	struct ata_eh_info *ehi = &ap->link.eh_info;
	struct ahci_port_priv *pp = ap->private_data;
	struct ahci_port_priv *pp = ap->private_data;
	struct ahci_host_priv *hpriv = ap->host->private_data;
	u32 status, qc_active;
	u32 status, qc_active;
	int rc, known_irq = 0;
	int rc, known_irq = 0;


@@ -1432,11 +1433,21 @@ static void ahci_port_intr(struct ata_port *ap)
	}
	}


	if (status & PORT_IRQ_SDB_FIS) {
	if (status & PORT_IRQ_SDB_FIS) {
		/* If the 'N' bit in word 0 of the FIS is set, we just
		/* If SNotification is available, leave notification
		 * received asynchronous notification.  Tell libata
		 * handling to sata_async_notification().  If not,
		 * about it.  Note that as the SDB FIS itself is
		 * emulate it by snooping SDB FIS RX area.
		 * accessible, SNotification can be emulated by the
		 *
		 * driver but don't bother for the time being.
		 * Snooping FIS RX area is probably cheaper than
		 * poking SNotification but some constrollers which
		 * implement SNotification, ICH9 for example, don't
		 * store AN SDB FIS into receive area.
		 */
		if (hpriv->cap & HOST_CAP_SNTF)
			sata_async_notification(ap);
		else {
			/* If the 'N' bit in word 0 of the FIS is set,
			 * we just received asynchronous notification.
			 * Tell libata about it.
			 */
			 */
			const __le32 *f = pp->rx_fis + RX_FIS_SDB;
			const __le32 *f = pp->rx_fis + RX_FIS_SDB;
			u32 f0 = le32_to_cpu(f[0]);
			u32 f0 = le32_to_cpu(f[0]);
@@ -1444,6 +1455,7 @@ static void ahci_port_intr(struct ata_port *ap)
			if (f0 & (1 << 15))
			if (f0 & (1 << 15))
				sata_async_notification(ap);
				sata_async_notification(ap);
		}
		}
	}


	/* pp->active_link is valid iff any command is in flight */
	/* pp->active_link is valid iff any command is in flight */
	if (ap->qc_active && pp->active_link->sactive)
	if (ap->qc_active && pp->active_link->sactive)