From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 284DAC4332F for ; Wed, 19 Oct 2022 22:01:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:From:References:Cc:To:Subject: MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=uZgpsyPOTBSGCNsy6TgHiBUrn3dH4C8Z2MD9s/ljgf0=; b=hTGEFWIQA3CoR9 aOslkdhsOeTYQ4EYHLxwcXGsMevr4GAMCUByWp+9BXZTg5/UkSUJguBRHGpaMCKXvbSiCgnvCuHM1 vsuhnifJiYZoFuxHCsg2327T3Nt38tZjs6xjZr/VezMIJV9/Q2dWwA3p+Zr7w5IJln2cGnUuaa8KK Men3cHEIQxIz52vGWCLXWwH7AyZYKBE8A7tSmPWAtNN+cKcMuiQ7/PrsmEtOG6O9VqhNE3okIqn2O UbJZaTjhDKNa9EkFruurG1c6tzsHWnHbceA4e0apa7ClDU8CpF0Q/6YelXVqpNj95XU1CsAjR43Xi NQ7o3RefEWAmFuaw0Xew==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1olH6Q-005OmJ-5x; Wed, 19 Oct 2022 21:59:54 +0000 Received: from mail-qk1-x72e.google.com ([2607:f8b0:4864:20::72e]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1olH6J-005Ojg-GQ for linux-arm-kernel@lists.infradead.org; Wed, 19 Oct 2022 21:59:51 +0000 Received: by mail-qk1-x72e.google.com with SMTP id a5so11671305qkl.6 for ; Wed, 19 Oct 2022 14:59:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=S9HkPFgZD/C2W2q2J74fWT1vMIg6k3iAnDkNlkeaCaI=; b=d0/Jg79vTpn0Od8mLqQ1vDbdKv5Uq65BUw4uyVcnj01ko3ChA7seFgaLFijzP2eAYS vvYlvSMlFs3sC210alNTmYCU2y9CrATSQmsW6i04t9Z4J1hxfECsEQJdAQBR2DOA80Hx BeeZiK0ciO5lyIBBxkB4vKxdBwhyYpvE6nfcpwkZyeaRH9EGsZpk4WbzhYV29QB7ZlOL 2POFDDz+blYRx4V5kqshhg2Cx3hFgDxx7j1UDYAFFFPLVJfrKFxKtGMKIyHDnCP7JnUg OHX+iwQtx8qFiyvjK9VdlFJoKmGLMKWlqtl38/i3JDXuBA7LU187DGLaXWAkl1HxRbEN ulcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=S9HkPFgZD/C2W2q2J74fWT1vMIg6k3iAnDkNlkeaCaI=; b=wlanbIzQQ/KVva9vZMNJ0MYxaCCZFPfrxJAoQtIWbZb14fNjn8a79w8xGDnvTEHF6m PnjZe/MR+B/5w08pMKpd6towtM5E+kWK9Jw1SoUDkTs/SXnZ0ICzrBq/kszBRr/Yqbdk EhGrjy2zg/eMn6mffy0t5/FQdh8ZrLrufOeenAz/inzNTUOIjZP1n/WdvGirdhONv79t 2AyWhWmdZdaP+gNkdpNvplqwxRBTEUFVyybrc63FTPzaeUw72RXFLYQW4B8Ydw2CbEni 0nreEi5mV5jXbsg5S0Oq9lLnKfk1atUPBfCWh6hy7L5yLGS9z7ObSzJv5EcOhBBkk4Qd Dp/Q== X-Gm-Message-State: ACrzQf3zuLlXF7THVpBTmRx8nM7qdnhBXZyacJMBtzu/c9nf02i6kZaT OBm+fuADE0MFcZttAxPJAMU= X-Google-Smtp-Source: AMsMyM4jByfHrPBUyeIqq0Qdns+pbJVRQWlZYTS7DpZ3AEO71aKNRFhor87zBQBcuFuYvQdFACRdvA== X-Received: by 2002:a37:4454:0:b0:6e7:9bd0:bf53 with SMTP id r81-20020a374454000000b006e79bd0bf53mr7260058qka.616.1666216785297; Wed, 19 Oct 2022 14:59:45 -0700 (PDT) Received: from [10.67.48.245] ([192.19.223.252]) by smtp.googlemail.com with ESMTPSA id t14-20020a05620a450e00b006ce580c2663sm5896681qkp.35.2022.10.19.14.59.40 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 19 Oct 2022 14:59:44 -0700 (PDT) Message-ID: <14efb3e6-96cf-f42e-16aa-c45001ec632e@gmail.com> Date: Wed, 19 Oct 2022 14:59:39 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.2 Subject: Re: [PATCH v2 2/7] mmc: sdhci-of-arasan: Fix SDHCI_RESET_ALL for CQHCI Content-Language: en-US To: Brian Norris , Ulf Hansson Cc: Shawn Lin , Shawn Guo , Fabio Estevam , Haibo Chen , Broadcom internal kernel review list , NXP Linux Team , Pengutronix Kernel Team , Florian Fainelli , Michal Simek , Faiz Abbas , linux-mmc@vger.kernel.org, Jonathan Hunter , Al Cooper , linux-arm-kernel@lists.infradead.org, Sowjanya Komatineni , linux-kernel@vger.kernel.org, Thierry Reding , Adrian Hunter , Sascha Hauer , stable@vger.kernel.org References: <20221019215440.277643-1-briannorris@chromium.org> <20221019145246.v2.2.I29f6a2189e84e35ad89c1833793dca9e36c64297@changeid> From: Florian Fainelli In-Reply-To: <20221019145246.v2.2.I29f6a2189e84e35ad89c1833793dca9e36c64297@changeid> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221019_145947_600776_25664D6F X-CRM114-Status: GOOD ( 26.77 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 10/19/22 14:54, Brian Norris wrote: > SDHCI_RESET_ALL resets will reset the hardware CQE state, but we aren't > tracking that properly in software. When out of sync, we may trigger > various timeouts. > > It's not typical to perform resets while CQE is enabled, but one > particular case I hit commonly enough: mmc_suspend() -> mmc_power_off(). > Typically we will eventually deactivate CQE (cqhci_suspend() -> > cqhci_deactivate()), but that's not guaranteed -- in particular, if > we perform a partial (e.g., interrupted) system suspend. > > The same bug was already found and fixed for two other drivers, in v5.7 > and v5.9: > > 5cf583f1fb9c mmc: sdhci-msm: Deactivate CQE during SDHC reset > df57d73276b8 mmc: sdhci-pci: Fix SDHCI_RESET_ALL for CQHCI for Intel GLK-based controllers > > The latter is especially prescient, saying "other drivers using CQHCI > might benefit from a similar change, if they also have CQHCI reset by > SDHCI_RESET_ALL." > > So like these other patches, deactivate CQHCI when resetting the > controller. > > Fixes: 84362d79f436 ("mmc: sdhci-of-arasan: Add CQHCI support for arasan,sdhci-5.1") > Cc: > Signed-off-by: Brian Norris > --- > > Changes in v2: > - Rely on cqhci_deactivate() to safely handle (ignore) > not-yet-initialized CQE support > > drivers/mmc/host/sdhci-of-arasan.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/mmc/host/sdhci-of-arasan.c b/drivers/mmc/host/sdhci-of-arasan.c > index 3997cad1f793..b30f0d6baf5b 100644 > --- a/drivers/mmc/host/sdhci-of-arasan.c > +++ b/drivers/mmc/host/sdhci-of-arasan.c > @@ -366,6 +366,9 @@ static void sdhci_arasan_reset(struct sdhci_host *host, u8 mask) > struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); > struct sdhci_arasan_data *sdhci_arasan = sdhci_pltfm_priv(pltfm_host); > > + if ((host->mmc->caps2 & MMC_CAP2_CQE) && (mask & SDHCI_RESET_ALL)) > + cqhci_deactivate(host->mmc); > + > sdhci_reset(host, mask); Cannot this be absorbed by sdhci_reset() that all of these drivers appear to be utilizing since you have access to the host and the mask to make that decision? -- Florian _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel