linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mark Lord <liml@rtr.ca>
To: Jeff Garzik <jgarzik@pobox.com>, Tejun Heo <htejun@gmail.com>,
	Alan Cox <alan@redhat.com>,
	IDE/ATA development list <linux-ide@vger.kernel.org>
Subject: [PATCH 3/4] libata sata_qstor workaround for spurious interrupts
Date: Wed, 07 Nov 2007 10:53:41 -0500	[thread overview]
Message-ID: <4731DF85.3000108@rtr.ca> (raw)
In-Reply-To: <4731DF06.3050202@rtr.ca>

sata_qstor workaround for spurious interrupts.

The qstor hardware generates spurious interrupts from time to time when switching
in and out of packet mode.  These eventually result in the IRQ being disabled,
which kills other devices sharing this IRQ with us.

This workaround isn't perfect, but it's about the best we can do for this hardware.
Spurious interrupts will still happen, but won't be logged as such,
and therefore won't cause the IRQ to be inadvertently disabled.

This belongs in 2.6.24.

Signed-off-by:  Mark Lord <mlord@pobox.com>
---

--- old/drivers/ata/sata_qstor.c	2007-11-07 09:12:32.000000000 -0500
+++ linux/drivers/ata/sata_qstor.c	2007-11-07 09:17:41.000000000 -0500
@@ -425,24 +425,27 @@
 		if (ap &&
 		    !(ap->flags & ATA_FLAG_DISABLED)) {
 			struct ata_queued_cmd *qc;
-			struct qs_port_priv *pp = ap->private_data;
-			if (!pp || pp->state != qs_state_mmio)
-				continue;
+			struct qs_port_priv *pp;
 			qc = ata_qc_from_tag(ap, ap->link.active_tag);
-			if (qc && (!(qc->tf.flags & ATA_TFLAG_POLLING))) {
-
-				/* check main status, clearing INTRQ */
-				u8 status = ata_check_status(ap);
-				if ((status & ATA_BUSY))
-					continue;
-				DPRINTK("ata%u: protocol %d (dev_stat 0x%X)\n",
-					ap->print_id, qc->tf.protocol, status);
-
-				/* complete taskfile transaction */
-				qc->err_mask |= ac_err_mask(status);
-				ata_qc_complete(qc);
+			if (!qc || !(qc->flags & ATA_QCFLAG_ACTIVE)) {
+				/*
+				 * The qstor hardware generates spurious
+				 * interrupts from time to time when switching
+				 * in and out of packet mode.
+				 * There's no obvious way to know if we're
+				 * here now due to that, so just ack the irq
+				 * and pretend we knew it was ours.. (ugh).
+				 * This does not affect packet mode.
+				 */
+				ata_check_status(ap);
 				handled = 1;
+				continue;
 			}
+			pp = ap->private_data;
+			if (!pp || pp->state != qs_state_mmio)
+				continue;
+			if (!(qc->tf.flags & ATA_TFLAG_POLLING))
+				handled |= ata_host_intr(ap, qc);
 		}
 	}
 	return handled;
@@ -452,12 +455,13 @@
 {
 	struct ata_host *host = dev_instance;
 	unsigned int handled = 0;
+	unsigned long flags;
 
 	VPRINTK("ENTER\n");
 
-	spin_lock(&host->lock);
+	spin_lock_irqsave(&host->lock, flags);
 	handled  = qs_intr_pkt(host) | qs_intr_mmio(host);
-	spin_unlock(&host->lock);
+	spin_unlock_irqrestore(&host->lock, flags);
 
 	VPRINTK("EXIT\n");
 

  parent reply	other threads:[~2007-11-07 15:53 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-07 15:51 [PATCH 1/4] libata sata_qstor fix oops on rmmod Mark Lord
2007-11-07 15:52 ` [PATCH 2/4] libata sata_qstor nuke idle state Mark Lord
2007-11-08 18:14   ` Jeff Garzik
2007-11-07 15:53 ` Mark Lord [this message]
2007-11-07 15:54 ` [PATCH 4/4] libata sata_qstor conversion to new error handling (EH) Mark Lord
2007-11-07 23:27   ` Jeff Garzik
2007-11-07 23:32     ` Mark Lord
2007-11-07 23:36       ` Mark Lord
2007-11-07 23:45         ` Jeff Garzik
2007-11-07 23:58           ` Mark Lord
2007-11-07 16:24 ` [PATCH 1/4] libata sata_qstor fix oops on rmmod Mark Lord
2007-11-08  2:30 ` Tejun Heo
2007-11-08 13:45 ` Mark Lord

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4731DF85.3000108@rtr.ca \
    --to=liml@rtr.ca \
    --cc=alan@redhat.com \
    --cc=htejun@gmail.com \
    --cc=jgarzik@pobox.com \
    --cc=linux-ide@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).