From patchwork Sun Mar 17 18:11:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergei Shtylyov X-Patchwork-Id: 10856495 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 127D4139A for ; Sun, 17 Mar 2019 18:11:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E3EBA292AD for ; Sun, 17 Mar 2019 18:11:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D7B7F292B2; Sun, 17 Mar 2019 18:11:36 +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=ham 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 5F31E292AD for ; Sun, 17 Mar 2019 18:11:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726446AbfCQSLf (ORCPT ); Sun, 17 Mar 2019 14:11:35 -0400 Received: from mail-lf1-f67.google.com ([209.85.167.67]:36448 "EHLO mail-lf1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726639AbfCQSLf (ORCPT ); Sun, 17 Mar 2019 14:11:35 -0400 Received: by mail-lf1-f67.google.com with SMTP id d18so10123273lfn.3 for ; Sun, 17 Mar 2019 11:11:34 -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=0afd8Io97Ei0NYCpCWazGPGfGrpqfnivNjoIICTsO+Q=; b=ndtAYHfmv9wTlkkoHtGIPC5kyuRk3drz92J4rycQYqoXIxGQP1qfwJvMsZfh0G0dEc RaQy453/y7GaVOb9wkv0aw1YNMb8I8YSmcA+2ExJHWavTUXqAt+JgFPw26n97QPAXtJd WCR1M9g46QErB7Sfo0K4r5HqLhRZhIlSwAF19HVZ56lE/RUtBnYINHhIUxuwPFKNiYK6 TXSPhRnbuekche13Ulqgz3CCaThZ40IvLQzd/E8YtbD8wxi3OkIVm9Bj+zmD2pliXvQl N0qqNq0dZfMeIFdLI8TkAWPE+fQ1ZROhOR0fFBjrUG0mJ9ukmtxhfLHDh2q7u6OSu8Dv qEjg== 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=0afd8Io97Ei0NYCpCWazGPGfGrpqfnivNjoIICTsO+Q=; b=NduL5zt9piw4bVZ/fgthEh4uLSjifN3PNaI21MDrhaCCsbLli0KYoLkTTmdSCZk5df oHEpI7qRUMllSw6Tr6jonmbw5KXmCdA30X5Su5VdgYRYJ5bvtHKH2kx67Pr4U0NKYgJR GOAaBjS9TCrrJ/vK7OH5mtOWdrMprbag5qpmSYO18ZeXl8n/CpvkVW/ig+L4aIkY30r8 SEIpNQ7yIPlRmzBqxlf11g6km583WoNst39FPYzVEp6VeJwV4g6gAociOHeC6WHuuMQN YDjeLMwa7h6EicovKLKz/AxEelaVSo3OxYpEhw/k9KSfqrxy/mDvpKo338hWsnjMc/5N 5ogg== X-Gm-Message-State: APjAAAXDS76vdWfgkb2TOnmHr6Z78K35wKVuhb0zwtweVTevn6mpNmyl 0U10yw92oQ3O0QW42WjxV/4m0g== X-Google-Smtp-Source: APXvYqzZHisMT63N9+SlRm7zSqcXjRWObFsggURWFWIAVQ7Smw+vZKjv7fPc/KQugSl8fLukDcF0xA== X-Received: by 2002:ac2:5325:: with SMTP id f5mr7591893lfh.77.1552846293742; Sun, 17 Mar 2019 11:11:33 -0700 (PDT) Received: from wasted.cogentembedded.com ([31.173.85.82]) by smtp.gmail.com with ESMTPSA id h5sm1561345lfc.24.2019.03.17.11.11.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 17 Mar 2019 11:11:32 -0700 (PDT) From: Sergei Shtylyov Subject: [PATCH v4.9.y] mmc: tmio_mmc_core: don't claim spurious interrupts To: linux-mmc@vger.kernel.org, Ulf Hansson , Wolfram Sang , GregKH Cc: linux-renesas-soc@vger.kernel.org, stable@vger.kernel.org Organization: Cogent Embedded Message-ID: Date: Sun, 17 Mar 2019 21:11:31 +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 Commit 5c27ff5db1491a947264d6d4e4cbe43ae6535bae upstream. 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 --- The patch is against the 'linux-4.9.y' branch of the -stable repo. drivers/mmc/host/tmio_mmc_pio.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) Index: linux-stable/drivers/mmc/host/tmio_mmc_pio.c =================================================================== --- linux-stable.orig/drivers/mmc/host/tmio_mmc_pio.c +++ linux-stable/drivers/mmc/host/tmio_mmc_pio.c @@ -675,7 +675,7 @@ static bool __tmio_mmc_sdcard_irq(struct return false; } -static void tmio_mmc_sdio_irq(int irq, void *devid) +static bool tmio_mmc_sdio_irq(int irq, void *devid) { struct tmio_mmc_host *host = devid; struct mmc_host *mmc = host->mmc; @@ -684,7 +684,7 @@ static void tmio_mmc_sdio_irq(int irq, v 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->sdcard_irq_mask; @@ -697,6 +697,8 @@ static void tmio_mmc_sdio_irq(int irq, v 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) @@ -718,9 +720,10 @@ irqreturn_t tmio_mmc_irq(int irq, void * if (__tmio_mmc_sdcard_irq(host, ireg, status)) return IRQ_HANDLED; - tmio_mmc_sdio_irq(irq, devid); + if (tmio_mmc_sdio_irq(irq, devid)) + return IRQ_HANDLED; - return IRQ_HANDLED; + return IRQ_NONE; } EXPORT_SYMBOL(tmio_mmc_irq);