* [PATCH] mmc: sdhci: add spin lock for sdhci_set_default_irqs in sdhci_init
@ 2020-04-15 9:00 haibo.chen
2020-04-15 9:55 ` Adrian Hunter
2020-04-17 11:29 ` Ulf Hansson
0 siblings, 2 replies; 3+ messages in thread
From: haibo.chen @ 2020-04-15 9:00 UTC (permalink / raw)
To: adrian.hunter, ulf.hansson; +Cc: linux-mmc, linux-imx
From: Haibo Chen <haibo.chen@nxp.com>
When use one SDIO wifi which enable the runtime PM feature on i.MX6SX,
we meet system hang. This hang happened during the usdhc runtime resume,
in sdhci_init(), when call the sdhci_set_default_irqs. One interrupt
(SDHCI_INT_CARD_INT) triggered just after the host->ier update and before
the write of register SDHCI_SIGNAL_ENABLE. So in sdhci_irq, it will skip
the call of sdio_signal_irq() because current host->ier do not set the
SDHCI_INT_CARD_INT. So this SDIO wifi interrupt always keep triggered,
let the system stuck in irq handle, can't response any other thread.
This patch add spin lock for the sdhci_set_default_irqs to fix this issue.
Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
---
drivers/mmc/host/sdhci.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 3f716466fcfd..79b6324a500c 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -317,6 +317,7 @@ static void sdhci_config_dma(struct sdhci_host *host)
static void sdhci_init(struct sdhci_host *host, int soft)
{
struct mmc_host *mmc = host->mmc;
+ unsigned long flags;
if (soft)
sdhci_do_reset(host, SDHCI_RESET_CMD | SDHCI_RESET_DATA);
@@ -326,7 +327,9 @@ static void sdhci_init(struct sdhci_host *host, int soft)
if (host->v4_mode)
sdhci_do_enable_v4_mode(host);
+ spin_lock_irqsave(&host->lock, flags);
sdhci_set_default_irqs(host);
+ spin_unlock_irqrestore(&host->lock, flags);
host->cqe_on = false;
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] mmc: sdhci: add spin lock for sdhci_set_default_irqs in sdhci_init
2020-04-15 9:00 [PATCH] mmc: sdhci: add spin lock for sdhci_set_default_irqs in sdhci_init haibo.chen
@ 2020-04-15 9:55 ` Adrian Hunter
2020-04-17 11:29 ` Ulf Hansson
1 sibling, 0 replies; 3+ messages in thread
From: Adrian Hunter @ 2020-04-15 9:55 UTC (permalink / raw)
To: haibo.chen, ulf.hansson; +Cc: linux-mmc, linux-imx
On 15/04/20 12:00 pm, haibo.chen@nxp.com wrote:
> From: Haibo Chen <haibo.chen@nxp.com>
>
> When use one SDIO wifi which enable the runtime PM feature on i.MX6SX,
> we meet system hang. This hang happened during the usdhc runtime resume,
> in sdhci_init(), when call the sdhci_set_default_irqs. One interrupt
> (SDHCI_INT_CARD_INT) triggered just after the host->ier update and before
> the write of register SDHCI_SIGNAL_ENABLE. So in sdhci_irq, it will skip
> the call of sdio_signal_irq() because current host->ier do not set the
> SDHCI_INT_CARD_INT. So this SDIO wifi interrupt always keep triggered,
> let the system stuck in irq handle, can't response any other thread.
>
> This patch add spin lock for the sdhci_set_default_irqs to fix this issue.
>
> Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
> ---
> drivers/mmc/host/sdhci.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> index 3f716466fcfd..79b6324a500c 100644
> --- a/drivers/mmc/host/sdhci.c
> +++ b/drivers/mmc/host/sdhci.c
> @@ -317,6 +317,7 @@ static void sdhci_config_dma(struct sdhci_host *host)
> static void sdhci_init(struct sdhci_host *host, int soft)
> {
> struct mmc_host *mmc = host->mmc;
> + unsigned long flags;
>
> if (soft)
> sdhci_do_reset(host, SDHCI_RESET_CMD | SDHCI_RESET_DATA);
> @@ -326,7 +327,9 @@ static void sdhci_init(struct sdhci_host *host, int soft)
> if (host->v4_mode)
> sdhci_do_enable_v4_mode(host);
>
> + spin_lock_irqsave(&host->lock, flags);
> sdhci_set_default_irqs(host);
> + spin_unlock_irqrestore(&host->lock, flags);
>
> host->cqe_on = false;
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] mmc: sdhci: add spin lock for sdhci_set_default_irqs in sdhci_init
2020-04-15 9:00 [PATCH] mmc: sdhci: add spin lock for sdhci_set_default_irqs in sdhci_init haibo.chen
2020-04-15 9:55 ` Adrian Hunter
@ 2020-04-17 11:29 ` Ulf Hansson
1 sibling, 0 replies; 3+ messages in thread
From: Ulf Hansson @ 2020-04-17 11:29 UTC (permalink / raw)
To: Haibo Chen; +Cc: Adrian Hunter, linux-mmc, dl-linux-imx
On Wed, 15 Apr 2020 at 11:09, <haibo.chen@nxp.com> wrote:
>
> From: Haibo Chen <haibo.chen@nxp.com>
>
> When use one SDIO wifi which enable the runtime PM feature on i.MX6SX,
> we meet system hang. This hang happened during the usdhc runtime resume,
> in sdhci_init(), when call the sdhci_set_default_irqs. One interrupt
> (SDHCI_INT_CARD_INT) triggered just after the host->ier update and before
> the write of register SDHCI_SIGNAL_ENABLE. So in sdhci_irq, it will skip
> the call of sdio_signal_irq() because current host->ier do not set the
> SDHCI_INT_CARD_INT. So this SDIO wifi interrupt always keep triggered,
> let the system stuck in irq handle, can't response any other thread.
>
> This patch add spin lock for the sdhci_set_default_irqs to fix this issue.
>
> Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
Applied for next, thanks!
Kind regards
Uffe
> ---
> drivers/mmc/host/sdhci.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> index 3f716466fcfd..79b6324a500c 100644
> --- a/drivers/mmc/host/sdhci.c
> +++ b/drivers/mmc/host/sdhci.c
> @@ -317,6 +317,7 @@ static void sdhci_config_dma(struct sdhci_host *host)
> static void sdhci_init(struct sdhci_host *host, int soft)
> {
> struct mmc_host *mmc = host->mmc;
> + unsigned long flags;
>
> if (soft)
> sdhci_do_reset(host, SDHCI_RESET_CMD | SDHCI_RESET_DATA);
> @@ -326,7 +327,9 @@ static void sdhci_init(struct sdhci_host *host, int soft)
> if (host->v4_mode)
> sdhci_do_enable_v4_mode(host);
>
> + spin_lock_irqsave(&host->lock, flags);
> sdhci_set_default_irqs(host);
> + spin_unlock_irqrestore(&host->lock, flags);
>
> host->cqe_on = false;
>
> --
> 2.17.1
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-04-17 11:29 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-15 9:00 [PATCH] mmc: sdhci: add spin lock for sdhci_set_default_irqs in sdhci_init haibo.chen
2020-04-15 9:55 ` Adrian Hunter
2020-04-17 11:29 ` Ulf Hansson
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.