From patchwork Wed Mar 16 13:58:32 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Bizon X-Patchwork-Id: 87260 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 4A140B701E for ; Thu, 17 Mar 2011 00:59:03 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753033Ab1CPN6t (ORCPT ); Wed, 16 Mar 2011 09:58:49 -0400 Received: from smtp4-g21.free.fr ([212.27.42.4]:54190 "EHLO smtp4-g21.free.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751748Ab1CPN6m (ORCPT ); Wed, 16 Mar 2011 09:58:42 -0400 Received: from bobafett.staff.proxad.net (unknown [213.228.1.121]) by smtp4-g21.free.fr (Postfix) with ESMTP id E9F424C8271; Wed, 16 Mar 2011 14:58:32 +0100 (CET) Received: from [172.18.3.156] (unknown [172.18.3.156]) by bobafett.staff.proxad.net (Postfix) with ESMTP id E0422180561; Wed, 16 Mar 2011 14:58:31 +0100 (CET) Subject: [PATCH v2] ahci: don't enable port irq before handler is registered From: Maxime Bizon Reply-To: mbizon@freebox.fr To: Tejun Heo Cc: Robert Hancock , Jeff Garzik , linux-ide , stable@kernel.org In-Reply-To: <20110316090453.GA31832@htj.dyndns.org> References: <1300129707.28545.34.camel@sakura.staff.proxad.net> <4D7EB9EB.8030807@gmail.com> <1300162840.2118.4.camel@kero> <20110315071937.GB8635@htj.dyndns.org> <1300200509.10827.27.camel@sakura.staff.proxad.net> <1300201422.10827.39.camel@sakura.staff.proxad.net> <20110315151931.GA17376@htj.dyndns.org> <1300224158.10827.52.camel@sakura.staff.proxad.net> <20110316090453.GA31832@htj.dyndns.org> Organization: Freebox Date: Wed, 16 Mar 2011 14:58:32 +0100 Message-ID: <1300283912.10827.66.camel@sakura.staff.proxad.net> Mime-Version: 1.0 X-Mailer: Evolution 2.28.1 Sender: linux-ide-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ide@vger.kernel.org From: Maxime Bizon 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 Acked-by: Tejun Heo 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;