Skip to content

Commit 7b3a24c

Browse files
mbizonfreeboxjgarzik
authored andcommitted
ahci: don't enable port irq before handler is registered
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 <[email protected]> Acked-by: Tejun Heo <[email protected]> Cc: [email protected] Signed-off-by: Jeff Garzik <[email protected]>
1 parent ae01b24 commit 7b3a24c

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

drivers/ata/libahci.c

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1919,7 +1919,17 @@ static void ahci_pmp_attach(struct ata_port *ap)
19191919
ahci_enable_fbs(ap);
19201920

19211921
pp->intr_mask |= PORT_IRQ_BAD_PMP;
1922-
writel(pp->intr_mask, port_mmio + PORT_IRQ_MASK);
1922+
1923+
/*
1924+
* We must not change the port interrupt mask register if the
1925+
* port is marked frozen, the value in pp->intr_mask will be
1926+
* restored later when the port is thawed.
1927+
*
1928+
* Note that during initialization, the port is marked as
1929+
* frozen since the irq handler is not yet registered.
1930+
*/
1931+
if (!(ap->pflags & ATA_PFLAG_FROZEN))
1932+
writel(pp->intr_mask, port_mmio + PORT_IRQ_MASK);
19231933
}
19241934

19251935
static void ahci_pmp_detach(struct ata_port *ap)
@@ -1935,7 +1945,10 @@ static void ahci_pmp_detach(struct ata_port *ap)
19351945
writel(cmd, port_mmio + PORT_CMD);
19361946

19371947
pp->intr_mask &= ~PORT_IRQ_BAD_PMP;
1938-
writel(pp->intr_mask, port_mmio + PORT_IRQ_MASK);
1948+
1949+
/* see comment above in ahci_pmp_attach() */
1950+
if (!(ap->pflags & ATA_PFLAG_FROZEN))
1951+
writel(pp->intr_mask, port_mmio + PORT_IRQ_MASK);
19391952
}
19401953

19411954
int ahci_port_resume(struct ata_port *ap)

drivers/ata/libata-core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5480,7 +5480,7 @@ struct ata_port *ata_port_alloc(struct ata_host *host)
54805480
if (!ap)
54815481
return NULL;
54825482

5483-
ap->pflags |= ATA_PFLAG_INITIALIZING;
5483+
ap->pflags |= ATA_PFLAG_INITIALIZING | ATA_PFLAG_FROZEN;
54845484
ap->lock = &host->lock;
54855485
ap->print_id = -1;
54865486
ap->host = host;

0 commit comments

Comments
 (0)