From patchwork Mon Feb 18 17:45:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergei Shtylyov X-Patchwork-Id: 10818535 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D39D01390 for ; Mon, 18 Feb 2019 17:45:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C2DF62B407 for ; Mon, 18 Feb 2019 17:45:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B79D02B67F; Mon, 18 Feb 2019 17:45:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 896E82B520 for ; Mon, 18 Feb 2019 17:45:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388369AbfBRRpo (ORCPT ); Mon, 18 Feb 2019 12:45:44 -0500 Received: from mail-lj1-f193.google.com ([209.85.208.193]:37964 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731296AbfBRRpn (ORCPT ); Mon, 18 Feb 2019 12:45:43 -0500 Received: by mail-lj1-f193.google.com with SMTP id j19so14304199ljg.5 for ; Mon, 18 Feb 2019 09:45:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cogentembedded-com.20150623.gappssmtp.com; s=20150623; h=from:subject:to:cc:organization:message-id:date:user-agent :mime-version:content-language:content-transfer-encoding; bh=S4C6cRn66bK/gnGHM8DZYRk2tLrQu1yj/oRkR/po+C8=; b=yaT4xELyku+eBmBWCeXszmkUWFwgu0eSr/fUEHNz0yql453O4D7TfMWUeelsnjcf6i pNK8vi8c7pZ6igdfBG9FhLrP+VbAy8rIKv37eSa/b/6o1trc54C6gqO1Ryi0hvC4EjNZ ezAOLY1rnVgYUnDDkJsXkDUnkLRaQ2AxHaeBv1sqABPtgxrxAILPXG7CyPJ6cXnuILRM aKuEG/v0rsUQYcVJWAM8T3sA7U2zJKsgk0WrS3mgvZX5tZiT4chxePRZ33k2MxC/6Upp aUZh4POMzNqbhwJotufmB654ycC/6J+VQ1O0SU/+opKSdT99ndKwrrjXuoGj8GAzYhCo L/7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:subject:to:cc:organization:message-id:date :user-agent:mime-version:content-language:content-transfer-encoding; bh=S4C6cRn66bK/gnGHM8DZYRk2tLrQu1yj/oRkR/po+C8=; b=AsyH6r2aFwPsgSFRM9KCaChaX8hhEVVcYLEcqOUd7bHsOeLh5jzCsgF8YJhVUwDC48 wbGhecHEexZHVvePmERnxJXXwTkWKmzvqivf0WgI05tNYA2viTlef0SCcGXiT6KGufAT xZY8IrYl3No6b9y4RzXDBIR7onr6ql8423Nr1eZprcmXZRlsNDAwvPOoHLgsYfh7k3Uv WsAogN180pvFdtGeGCsWixsnooAxYornNEqjP2/6Ue1PSKbi3Orwuc/VlesUKLRDNBqa 5kIK45YO4FiQ2Bh4aLGZ1UFI/HzxgdpNQwF0eGQKeZv5NwUXJ3Cn2Tv1FSu7plixnabz 9zcg== X-Gm-Message-State: AHQUAubB/o6ADsR9Wp1eZScRYtckbWnxGuDynuUxf2Z/MhpL5lEsD+N2 ujLdxxQCXANATMjJ3+OY7DmmPg== X-Google-Smtp-Source: AHgI3IaMO6PgKnS+oVfC7BgoJVrNjEMHssgPeRe+N7WPwD3UhkTgEnS2dV7LDp16FnsdHuS1Uf2/0g== X-Received: by 2002:a2e:9618:: with SMTP id v24-v6mr14951841ljh.110.1550511941908; Mon, 18 Feb 2019 09:45:41 -0800 (PST) Received: from wasted.cogentembedded.com ([31.173.81.29]) by smtp.gmail.com with ESMTPSA id r10-v6sm3563624ljj.71.2019.02.18.09.45.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 Feb 2019 09:45:41 -0800 (PST) From: Sergei Shtylyov Subject: [PATCH v3] mmc: tmio_mmc_core: don't claim spurious interrupts To: linux-mmc@vger.kernel.org, Ulf Hansson , Wolfram Sang Cc: linux-renesas-soc@vger.kernel.org Organization: Cogent Embedded Message-ID: <7e293159-0ae3-82fb-2723-04e91d652906@cogentembedded.com> Date: Mon, 18 Feb 2019 20:45:40 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 Content-Language: en-MW Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP I have encountered an interrupt storm during the eMMC chip probing (and the chip finally didn't get detected). It turned out that U-Boot left the DMAC interrupts enabled while the Linux driver didn't use those. The SDHI driver's interrupt handler somehow assumes that, even if an SDIO interrupt didn't happen, it should return IRQ_HANDLED. I think that if none of the enabled interrupts happened and got handled, we should return IRQ_NONE -- that way the kernel IRQ code recoginizes a spurious interrupt and masks it off pretty quickly... Fixes: 7729c7a232a9 ("mmc: tmio: Provide separate interrupt handlers") Signed-off-by: Sergei Shtylyov Reviewed-by: Wolfram Sang Tested-by: Wolfram Sang Reviewed-by: Simon Horman --- The patch is against Ulf Hansson's 'mmc.git' repo's 'fixes' branch. Changes in version 3: - simplified the final *return* statement in __tmio_mmc_sdio_irq(); - added the "Fixes:" tag; - cleaned up the whitespace in the patch description. Changes in version 2: - refreshed the patch; - fixed an article and whitespace in the patch description. drivers/mmc/host/tmio_mmc_core.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) Index: mmc/drivers/mmc/host/tmio_mmc_core.c =================================================================== --- mmc.orig/drivers/mmc/host/tmio_mmc_core.c +++ mmc/drivers/mmc/host/tmio_mmc_core.c @@ -629,7 +629,7 @@ static bool __tmio_mmc_sdcard_irq(struct return false; } -static void __tmio_mmc_sdio_irq(struct tmio_mmc_host *host) +static bool __tmio_mmc_sdio_irq(struct tmio_mmc_host *host) { struct mmc_host *mmc = host->mmc; struct tmio_mmc_data *pdata = host->pdata; @@ -637,7 +637,7 @@ static void __tmio_mmc_sdio_irq(struct t unsigned int sdio_status; if (!(pdata->flags & TMIO_MMC_SDIO_IRQ)) - return; + return false; status = sd_ctrl_read16(host, CTL_SDIO_STATUS); ireg = status & TMIO_SDIO_MASK_ALL & ~host->sdio_irq_mask; @@ -650,6 +650,8 @@ static void __tmio_mmc_sdio_irq(struct t if (mmc->caps & MMC_CAP_SDIO_IRQ && ireg & TMIO_SDIO_STAT_IOIRQ) mmc_signal_sdio_irq(mmc); + + return ireg; } irqreturn_t tmio_mmc_irq(int irq, void *devid) @@ -668,9 +670,10 @@ irqreturn_t tmio_mmc_irq(int irq, void * if (__tmio_mmc_sdcard_irq(host, ireg, status)) return IRQ_HANDLED; - __tmio_mmc_sdio_irq(host); + if (__tmio_mmc_sdio_irq(host)) + return IRQ_HANDLED; - return IRQ_HANDLED; + return IRQ_NONE; } EXPORT_SYMBOL_GPL(tmio_mmc_irq);