From patchwork Fri Aug 17 11:41:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergei Shtylyov X-Patchwork-Id: 10568675 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 64457139B for ; Fri, 17 Aug 2018 11:41:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4FDF82B2A0 for ; Fri, 17 Aug 2018 11:41:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 409372B29B; Fri, 17 Aug 2018 11:41:07 +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 DB4282B29A for ; Fri, 17 Aug 2018 11:41:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726623AbeHQOoN (ORCPT ); Fri, 17 Aug 2018 10:44:13 -0400 Received: from mail-lj1-f195.google.com ([209.85.208.195]:41475 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726544AbeHQOoN (ORCPT ); Fri, 17 Aug 2018 10:44:13 -0400 Received: by mail-lj1-f195.google.com with SMTP id y17-v6so6109779ljy.8 for ; Fri, 17 Aug 2018 04:41:04 -0700 (PDT) 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=5Pw5swjw5fh9QESOw4yFwcP2dm921pxNNUQHYHW4DH0=; b=ep53XlQAzN0EA4okUgVTFMzOdI4M6MLMWklR4eIMc69gwUuycJ8C6MZi+AcYW+piLs +Y4tK7XlIor6xpSGOyKy8sTY7JT0d773C01TcsVZ7fUZfEFrnkaY44Rmnd5DOQPD+quY sKvMrNI6sRac3WnB6NBIO/GfT7UjynG0/plr4k2qHPCAEqCjk9+sGXwAQm8YvFvQn459 Tknq03OH0jmLagd//aYS1fBPTL+y8lSLC7tCjwErVCAxSiqVA87gQSum0EiTT4MRRkyL uQKI8OFhEAaH2GFS+wzwiI8DKc7RrteWCvM1n9ez+qs9ZQEdvsUmNMRGaDWZ8QcBOJOY uv4w== 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=5Pw5swjw5fh9QESOw4yFwcP2dm921pxNNUQHYHW4DH0=; b=qOWn162a0zGdyb7dumVBKxNis7Bt1b44IqVsktAG0ljpQlqRPnOP54mp22ewwQ5Fsi MrEfYeyQNHR9ifLur167PNCJbhro33/901TrJrNkh4kEvN/91XblmP3ZMTKQLNhwn5DF oDZWlH6Q6cxrn9ozCJBgIZMkziVc6ba1UqGUnjBnaHoGSELpuP2MgrttTQdy575sCZYM lFs5YRJwzMmxxQBD2nW7sVfxC7VOTFGAF1u5nM728kSgxD9uZFeecHjWTo6KNUkdpf5l FwpySW4GCOTYqgKbF6zuOtbe4roJ2yyVc3SfYYpbRwTRcvxzi6HxDbidGhe5aRsqb3/5 poCw== X-Gm-Message-State: AOUpUlF1yuwoDcKzrd/nDhn/F3SZPpjKv9Eu+ylgy0IcEzlZtXI6UJQq I41Km8KMbTruNzCuRxCJ3Y/4Tw== X-Google-Smtp-Source: AA+uWPzT5sNNT9k7q/VnfH5RlYDZGvoXjEKLYhFbfOPs9dMLmpxbmDjDTsOfpwitkQAlcKKEbk9Brg== X-Received: by 2002:a2e:2d2:: with SMTP id y79-v6mr23277885lje.100.1534506063865; Fri, 17 Aug 2018 04:41:03 -0700 (PDT) Received: from wasted.cogentembedded.com ([31.173.83.119]) by smtp.gmail.com with ESMTPSA id f4-v6sm362715lfa.9.2018.08.17.04.41.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Aug 2018 04:41:02 -0700 (PDT) From: Sergei Shtylyov Subject: [PATCH] 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: Date: Fri, 17 Aug 2018 14:41:02 +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 a 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... Signed-off-by: Sergei Shtylyov --- The patch is against Ulf Hansson's 'mmc.git' repo's 'fixes' branch. 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 @@ -691,7 +691,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; @@ -699,7 +699,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; @@ -712,6 +712,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 ? true : false; } irqreturn_t tmio_mmc_irq(int irq, void *devid) @@ -730,9 +732,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);