Skip to contentSkip to conversation

mmc: meson-gx: fix irq ack

PATCH In review Jerome Brunet 4 participants 4 messages May 23, 2019 – May 28, 2019

Subsystems (2)
lore
Share & tools
lore

Jerome Brunet

author reviewer
#0 lore raw

PATCH 1/1 mmc: meson-gx: fix irq ack

While cleaning the ISR of the meson-gx and acking only raised irqs, the ack of the irq was moved at the very last stage of the function.

This was stable during the initial tests but it triggered issues with hs200, under specific loads (like booting android). Acking the irqs after calling the mmc_request_done() causes the problem.

Moving the ack back to the original place solves the issue. Since the irq is edge triggered, it does not hurt to ack irq even earlier, so let's do it early in the ISR.

Fixes 9c5fdb07a28d ("mmc: meson-gx: ack only raised irq")
---
 drivers/mmc/host/meson-gx-mmc.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/mmc/host/meson-gx-mmc.c +3 -3
index 6ef465304052..cb3f6811d69a 100644
@@ -873,6 +873,9 @@ static irqreturn_t meson_mmc_irq(int irq, void *dev_id)
 	if (WARN_ON(!host) || WARN_ON(!host->cmd))
 		return IRQ_NONE;
 
+	/* ack all raised interrupts */
+	writel(status, host->regs + SD_EMMC_STATUS);
+
 	cmd = host->cmd;
 	data = cmd->data;
 	cmd->error = 0;
@@ -919,9 +922,6 @@ static irqreturn_t meson_mmc_irq(int irq, void *dev_id)
 	if (ret == IRQ_HANDLED)
 		meson_mmc_request_done(host->mmc, cmd->mrq);
 
-	/* ack all raised interrupts */
-	writel(status, host->regs + SD_EMMC_STATUS);
-
 	return ret;
 }
 
Signature · 1 line
2.20.1
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Jerome Brunet

While cleaning the ISR of the meson-gx and acking only raised irqs, the ack of the irq was moved at the very last stage of the function.

This was stable during the initial tests but it triggered issues with hs200, under specific loads (like booting android). Acking the irqs after calling the mmc_request_done() causes the problem.

Quoted 8 lines

Moving the ack back to the original place solves the issue. Since the irq is edge triggered, it does not hurt to ack irq even earlier, so let's do it early in the ISR.

Fixes 9c5fdb07a28d ("mmc: meson-gx: ack only raised irq")

And to be clear, this fix should go into v5.2-rc.

My Tested-by is already above, but just for the benefit of the archives... tested this on mainline, and also on a v4.19 backport with Android and it fixes issues see there.

Kevin

Tested-by on v1 1/1
#2 lore raw
In reply to Jerome Brunet
Quoted 35 lines · Jerome Brunet

While cleaning the ISR of the meson-gx and acking only raised irqs, the ack of the irq was moved at the very last stage of the function.

This was stable during the initial tests but it triggered issues with hs200, under specific loads (like booting android). Acking the irqs after calling the mmc_request_done() causes the problem.

Moving the ack back to the original place solves the issue. Since the irq is edge triggered, it does not hurt to ack irq even earlier, so let's do it early in the ISR.

Fixes 9c5fdb07a28d ("mmc: meson-gx: ack only raised irq")
---
  drivers/mmc/host/meson-gx-mmc.c | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)
drivers/mmc/host/meson-gx-mmc.c +3 -0
index 6ef465304052..cb3f6811d69a 100644
@@ -873,6 +873,9 @@ static irqreturn_t meson_mmc_irq(int irq, void *dev_id)
  	if (WARN_ON(!host) || WARN_ON(!host->cmd))
  		return IRQ_NONE;
 
+	/* ack all raised interrupts */
+	writel(status, host->regs + SD_EMMC_STATUS);
+
  	cmd = host->cmd;
  	data = cmd->data;
  	cmd->error = 0;

drivers/mmc/host/meson-gx-mmc.c static irqreturn_t meson_mmc_irq(int irq, void *dev_id) · line 927

Quoted 9 lines
drivers/mmc/host/meson-gx-mmc.c +0 -3
@@ -919,9 +922,6 @@ static irqreturn_t meson_mmc_irq(int irq, void *dev_id)
  	if (ret == IRQ_HANDLED)
  		meson_mmc_request_done(host->mmc, cmd->mrq);
 
-	/* ack all raised interrupts */
-	writel(status, host->regs + SD_EMMC_STATUS);
-
  	return ret;
  }
 

This patch resolves issues I was having with hung tasks waiting for emmc & sd cards on the odroid N2.

#3 lore raw
In reply to Jerome Brunet
Quoted 8 lines · Jerome Brunet

While cleaning the ISR of the meson-gx and acking only raised irqs, the ack of the irq was moved at the very last stage of the function.

This was stable during the initial tests but it triggered issues with hs200, under specific loads (like booting android). Acking the irqs after calling the mmc_request_done() causes the problem.

Quoted 8 lines

Moving the ack back to the original place solves the issue. Since the irq is edge triggered, it does not hurt to ack irq even earlier, so let's do it early in the ISR.

Fixes 9c5fdb07a28d ("mmc: meson-gx: ack only raised irq")

Applied for fixes, thanks!

Kind regards
Uffe

Quoted 31 lines
---
 drivers/mmc/host/meson-gx-mmc.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/mmc/host/meson-gx-mmc.c +3 -4
index 6ef465304052..cb3f6811d69a 100644
@@ -873,6 +873,9 @@ static irqreturn_t meson_mmc_irq(int irq, void *dev_id)
        if (WARN_ON(!host) || WARN_ON(!host->cmd))
                return IRQ_NONE;
 
+       /* ack all raised interrupts */
+       writel(status, host->regs + SD_EMMC_STATUS);
+
        cmd = host->cmd;
        data = cmd->data;
        cmd->error = 0;
@@ -919,9 +922,6 @@ static irqreturn_t meson_mmc_irq(int irq, void *dev_id)
        if (ret == IRQ_HANDLED)
                meson_mmc_request_done(host->mmc, cmd->mrq);
 
-       /* ack all raised interrupts */
-       writel(status, host->regs + SD_EMMC_STATUS);
-
        return ret;
 }
 
--

2.20.1