From: Maxime Bizon <mbizon@freebox.fr>
To: Tejun Heo <htejun@gmail.com>
Cc: Robert Hancock <hancockrwd@gmail.com>,
Jeff Garzik <jgarzik@pobox.com>,
linux-ide <linux-ide@vger.kernel.org>,
stable@kernel.org
Subject: [PATCH v2] ahci: don't enable port irq before handler is registered
Date: Wed, 16 Mar 2011 14:58:32 +0100 [thread overview]
Message-ID: <1300283912.10827.66.camel@sakura.staff.proxad.net> (raw)
In-Reply-To: <20110316090453.GA31832@htj.dyndns.org>
From: Maxime Bizon <mbizon@freebox.fr>
The ahci_pmp_attach() & ahci_pmp_detach() unmask port irqs, but they
are also called during port initialization, before ahci host irq
handler is registered. On ce4100 platform, this sometimes triggers
"irq 4: nobody cared" message when loading driver.
Fixed this by not touching the register if the port is in frozen
state, and mark all uninitialized port as frozen.
Signed-off-by: Maxime Bizon <mbizon@freebox.fr>
Acked-by: Tejun Heo <tj@kernel.org>
Cc: stable@kernel.org
---
drivers/ata/libahci.c | 17 +++++++++++++++--
drivers/ata/libata-core.c | 2 +-
2 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c
index 26d4523..8498eb5 100644
--- a/drivers/ata/libahci.c
+++ b/drivers/ata/libahci.c
@@ -1897,7 +1897,17 @@ static void ahci_pmp_attach(struct ata_port *ap)
ahci_enable_fbs(ap);
pp->intr_mask |= PORT_IRQ_BAD_PMP;
- writel(pp->intr_mask, port_mmio + PORT_IRQ_MASK);
+
+ /*
+ * We must not change the port interrupt mask register if the
+ * port is marked frozen, the value in pp->intr_mask will be
+ * restored later when the port is thawed.
+ *
+ * Note that during initialization, the port is marked as
+ * frozen since the irq handler is not yet registered.
+ */
+ if (!(ap->pflags & ATA_PFLAG_FROZEN))
+ writel(pp->intr_mask, port_mmio + PORT_IRQ_MASK);
}
static void ahci_pmp_detach(struct ata_port *ap)
@@ -1913,7 +1923,10 @@ static void ahci_pmp_detach(struct ata_port *ap)
writel(cmd, port_mmio + PORT_CMD);
pp->intr_mask &= ~PORT_IRQ_BAD_PMP;
- writel(pp->intr_mask, port_mmio + PORT_IRQ_MASK);
+
+ /* see comment above in ahci_pmp_attach() */
+ if (!(ap->pflags & ATA_PFLAG_FROZEN))
+ writel(pp->intr_mask, port_mmio + PORT_IRQ_MASK);
}
int ahci_port_resume(struct ata_port *ap)
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index d4e52e2..02d5703 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -5480,7 +5480,7 @@ struct ata_port *ata_port_alloc(struct ata_host *host)
if (!ap)
return NULL;
- ap->pflags |= ATA_PFLAG_INITIALIZING;
+ ap->pflags |= ATA_PFLAG_INITIALIZING | ATA_PFLAG_FROZEN;
ap->lock = &host->lock;
ap->print_id = -1;
ap->host = host;
--
1.7.1
--
Maxime
prev parent reply other threads:[~2011-03-16 13:58 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-14 19:08 "irq 4: nobody cared" when loading ahci driver on ce4100 Maxime Bizon
2011-03-15 0:59 ` Robert Hancock
2011-03-15 4:20 ` Maxime Bizon
2011-03-15 7:19 ` Tejun Heo
2011-03-15 14:48 ` Maxime Bizon
2011-03-15 15:03 ` Maxime Bizon
2011-03-15 15:19 ` Tejun Heo
2011-03-15 17:03 ` Maxime Bizon
2011-03-15 21:22 ` [PATCH] ahci: don't enable port irq before handler is registered Maxime Bizon
2011-03-16 9:04 ` Tejun Heo
2011-03-16 9:05 ` Tejun Heo
2011-03-16 13:58 ` Maxime Bizon [this message]
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=1300283912.10827.66.camel@sakura.staff.proxad.net \
--to=mbizon@freebox.fr \
--cc=hancockrwd@gmail.com \
--cc=htejun@gmail.com \
--cc=jgarzik@pobox.com \
--cc=linux-ide@vger.kernel.org \
--cc=stable@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).