From patchwork Sat Feb 9 19:13:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergei Shtylyov X-Patchwork-Id: 10804573 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 9673713A4 for ; Sat, 9 Feb 2019 19:13:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 83BB62854F for ; Sat, 9 Feb 2019 19:13:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 748302858B; Sat, 9 Feb 2019 19:13:51 +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 006322A6BF for ; Sat, 9 Feb 2019 19:13:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727232AbfBITNt (ORCPT ); Sat, 9 Feb 2019 14:13:49 -0500 Received: from mail-lf1-f67.google.com ([209.85.167.67]:35441 "EHLO mail-lf1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727013AbfBITNt (ORCPT ); Sat, 9 Feb 2019 14:13:49 -0500 Received: by mail-lf1-f67.google.com with SMTP id v7so646701lfd.2 for ; Sat, 09 Feb 2019 11:13:48 -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=Dn1Py15E4ID/MTSmA0G4F9SiBBW4lkQZx3R5s26WVNQ=; b=ChHlErHJCX5m9dgzz2KolPJJLMLitnxap8PBPNEWV30qvCnRwjzZHI3KAxA13Tnn3E IQBKgHjIeqjk8NcikytoZ6W4qHd1Lx6JT52yp7ewE2O4MQR+/SpVeJEpiBC8nBqb9eaE rThaVpvSXPsOY2VcKqcup3URFphoyWwfXqbzqMTp4QVN4eHhThe+TWWGgk9CeiRw8FMb DFA2prS4t1g+e8h/DtdneBlYKRonwZwTrYPC5rcTtOCPv3dgiezB3ZnM2Nj2SlvOAgyl odR/RrJkiHePuW7oR95Ge+YfBGWcFikAfKmMsH0mBoH9Ozd2hsqQ1J2QXb2Qocbu2zke wWpQ== 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=Dn1Py15E4ID/MTSmA0G4F9SiBBW4lkQZx3R5s26WVNQ=; b=goIoX8l3fu8KsAbJ+wYGNdq3lMmRnzWBeIrDXTzB6Nez3X8rBcUOia7kWKDWRzmzDQ etLuFotJN8b8Zofw5M+WowJiMQ5RhOWKZMcu/JXBnVCFDwDv23yePB+Ve1QO1kPjdw00 TX+6LI4xyAK815Zs85Z6egc9rj5M7uQFSM3srGaSxodgJlmUDSoIoDp+xv9QyvzjXEgk vcE4aVR3oL8gADO/LcOfgNDUi7yC/JC7IL7a55+r/ryI3sINQfwdLVRvQjVL9/+/+Gr1 aO2Vy4mR8n767AoxxDxfFHnle4N8Y6fnppE6wEf9poWindOqCz5CLiO5LsZ2tODlxCVM hkcw== X-Gm-Message-State: AHQUAubwo4trQiTf2kt9IzhtIhqxAW4NxpX04tMTMPLmMe1/Q2q8Fh/t b0oSNZp6otvBnOOC3jalAIdI7dEBQ0w= X-Google-Smtp-Source: AHgI3IYUY37xog/45HeFPzYLAvR3GUUQJnbJ4tvkr9z0qjTdbhkNORVDAYDmGMoQ9j7AyrRrHunUPw== X-Received: by 2002:ac2:41cf:: with SMTP id d15mr17125406lfi.14.1549739627726; Sat, 09 Feb 2019 11:13:47 -0800 (PST) Received: from wasted.cogentembedded.com ([31.173.84.183]) by smtp.gmail.com with ESMTPSA id q10-v6sm1151869ljj.3.2019.02.09.11.13.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 09 Feb 2019 11:13:47 -0800 (PST) From: Sergei Shtylyov Subject: [PATCH v2] 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: Sat, 9 Feb 2019 22:13:44 +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... Signed-off-by: Sergei Shtylyov --- The patch is against Ulf Hansson's 'mmc.git' repo's 'fixes' branch. We seem to have dropped the ball on the version 1... 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 ? true : false; } 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);