Message ID | 20221026124150.v4.2.I29f6a2189e84e35ad89c1833793dca9e36c64297@changeid |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp453443wru; Wed, 26 Oct 2022 12:44:51 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7LJmUXu2GSFd3TKakmxQmr+79XLX8E9Fxag7OxQh2HtNk4JLNa3dGwlpBRmcG38pgqG74D X-Received: by 2002:a17:90b:4a4c:b0:213:622f:62fa with SMTP id lb12-20020a17090b4a4c00b00213622f62famr2832901pjb.137.1666813490766; Wed, 26 Oct 2022 12:44:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666813490; cv=none; d=google.com; s=arc-20160816; b=snq81rhs5mZry6vqcdrUL6zAmkLloAsL/bYD+s5Cu71jUCiE54CRyJaqVTbNwfu5o1 cKbrHFLItgIyA+YRwqCfikT0/J+6QB+155t/HcIg8Wohohj4XsjNv0fGIRq3zx4MGeWa qCOot8vQJnpk+F1s5M4HZHGde5Rkx1kyBMxNMn9JmHbKwOzFO1el7TCS/jC0Mu0oSWBA GKgo7ESqoISQ0n5bUAVGTbwnNBrU5l99oT0uiepC7OWW538JyqcyTDUL8ESZo+IDxleM EkYC5/tvEux7Y05K+pAv4bMcqLMgxciXYkLzElM8jvSI7OJWPYTaiAdoBohrHZ9er2TK iYnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=LFkN1+K+3c6IFRt45FwrvvUQl9YtYqgay0mkP7wZUzI=; b=iw/RNruAPk2z0PE0eEY+S4x/dbbbVOz0NaGIrOAUk3/pw/mNFHG4JCjpXHiOc0WB8F Mm+IEl23iQqMUhb8/GRwdyi7NpdYRbEU6BOaBL58lO+EgBekePyb5JnlYaMNa7nIHvbZ RNnxljAdZZreGG82ej1h9SmjpmF2CMSljTQqR2ndRzJBbIx9nUxJnjMLTI9b4n0AZvSe KEN8ns474wfgoUO48o2D1C3bwcw7fz8esE+Xm9RWALdwt9beqiS4xBrdei649Xf9Gsvt Fs/M9wpWFlmf2u3NftJaXqvJOkA2ZRyHxA1FAFYaBsy6WB3OvIN294VFq5ApmmedkACH 7NIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="Ptd/qvcQ"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 7-20020a17090a0f8700b0020d3fa4d1edsi3239902pjz.64.2022.10.26.12.44.37; Wed, 26 Oct 2022 12:44:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="Ptd/qvcQ"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234524AbiJZTnF (ORCPT <rfc822;pwkd43@gmail.com> + 99 others); Wed, 26 Oct 2022 15:43:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40104 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235109AbiJZTmp (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 26 Oct 2022 15:42:45 -0400 Received: from mail-pg1-x52d.google.com (mail-pg1-x52d.google.com [IPv6:2607:f8b0:4864:20::52d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1B92FE6F60 for <linux-kernel@vger.kernel.org>; Wed, 26 Oct 2022 12:42:32 -0700 (PDT) Received: by mail-pg1-x52d.google.com with SMTP id f9so11548759pgj.2 for <linux-kernel@vger.kernel.org>; Wed, 26 Oct 2022 12:42:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=LFkN1+K+3c6IFRt45FwrvvUQl9YtYqgay0mkP7wZUzI=; b=Ptd/qvcQFlVNozF95zAXwMzpsas/LwI5wHV3oflUnbitKOiLaHryheLfF3YTU7W17v DouX+oik7tskpRZKEOv/6c+nv6ly+84fq1yReybvquZ46D9b16eI1rp5TR8B0iTslP9D aJcizkMujXHwIpHkD76cUTfDfKViObgVbX9cY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=LFkN1+K+3c6IFRt45FwrvvUQl9YtYqgay0mkP7wZUzI=; b=nv/nZiODZLVgCG4o+WTBhbck4JIfI/98GUfgg8xI5iVo2EVLGV6wmN8gGbwK2OfXf4 V5JtlVOJCv04fPQUZ6lp7asgByDTarvrzuUmZBgElHYfWaSL7yD3Uwhnu1v0ul38EUgP yKD+ah5gxdWPYw22zKCyEOLTcKlpYXp4K3+R460xis2Mo/MZzToZw0C7KREMGWkzUzkX 9Uk4P8cKhpE66YDEjZaI1Hax29vMkemFBXGwxiCHB6k0I8g300ovsJcl1cjxlYWYta1B ySYdBf+mmrsjYOXsnSj2jQEFXZXptb/xUUZc6aok7U7ugxnoDRI9kkVbU7qfGwNLdnzd 3NNw== X-Gm-Message-State: ACrzQf35YXxIqz6sADhMfoUruPC12pjGntz3CJiAjdFkabfI/PFJW5KK JtF7WVg/EIgIJa55vAJx4eNV9g== X-Received: by 2002:a63:4461:0:b0:43c:dbdb:90c4 with SMTP id t33-20020a634461000000b0043cdbdb90c4mr37440184pgk.340.1666813351660; Wed, 26 Oct 2022 12:42:31 -0700 (PDT) Received: from localhost ([2620:15c:9d:2:c9e3:74f3:6b2b:135]) by smtp.gmail.com with UTF8SMTPSA id y20-20020a170902b49400b00179e1f08634sm3219719plr.222.2022.10.26.12.42.29 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 26 Oct 2022 12:42:31 -0700 (PDT) From: Brian Norris <briannorris@chromium.org> To: Ulf Hansson <ulf.hansson@linaro.org> Cc: Shawn Guo <shawnguo@kernel.org>, linux-mmc@vger.kernel.org, Adrian Hunter <adrian.hunter@intel.com>, Shawn Lin <shawn.lin@rock-chips.com>, Michal Simek <michal.simek@xilinx.com>, Sascha Hauer <s.hauer@pengutronix.de>, Bjorn Andersson <andersson@kernel.org>, Thierry Reding <thierry.reding@gmail.com>, linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com>, Jonathan Hunter <jonathanh@nvidia.com>, Andy Gross <agross@kernel.org>, Pengutronix Kernel Team <kernel@pengutronix.de>, linux-kernel@vger.kernel.org, Konrad Dybcio <konrad.dybcio@somainline.org>, Al Cooper <alcooperx@gmail.com>, Fabio Estevam <festevam@gmail.com>, Florian Fainelli <f.fainelli@gmail.com>, NXP Linux Team <linux-imx@nxp.com>, Haibo Chen <haibo.chen@nxp.com>, Sowjanya Komatineni <skomatineni@nvidia.com>, Brian Norris <briannorris@chromium.org>, stable@vger.kernel.org, Guenter Roeck <linux@roeck-us.net> Subject: [PATCH v4 2/7] mmc: sdhci-of-arasan: Fix SDHCI_RESET_ALL for CQHCI Date: Wed, 26 Oct 2022 12:42:04 -0700 Message-Id: <20221026124150.v4.2.I29f6a2189e84e35ad89c1833793dca9e36c64297@changeid> X-Mailer: git-send-email 2.38.0.135.g90850a2211-goog In-Reply-To: <20221026194209.3758834-1-briannorris@chromium.org> References: <20221026194209.3758834-1-briannorris@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747780622860010888?= X-GMAIL-MSGID: =?utf-8?q?1747780622860010888?= |
Series |
mmc: sdhci controllers: Fix SDHCI_RESET_ALL for CQHCI
|
|
Commit Message
Brian Norris
Oct. 26, 2022, 7:42 p.m. UTC
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. Do this via the new sdhci_and_cqhci_reset() helper. This patch depends on (and should not compile without) the patch entitled "mmc: cqhci: Provide helper for resetting both SDHCI and CQHCI". Fixes: 84362d79f436 ("mmc: sdhci-of-arasan: Add CQHCI support for arasan,sdhci-5.1") Cc: <stable@vger.kernel.org> Signed-off-by: Brian Norris <briannorris@chromium.org> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Adrian Hunter <adrian.hunter@intel.com> --- Changes in v4: - Improve for-stable cherry-picking notes - Add Adrian's Ack Changes in v3: - Refactor to a "SDHCI and CQHCI" helper -- sdhci_and_cqhci_reset() 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, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/mmc/host/sdhci-of-arasan.c b/drivers/mmc/host/sdhci-of-arasan.c index 3997cad1f793..cfb891430174 100644 --- a/drivers/mmc/host/sdhci-of-arasan.c +++ b/drivers/mmc/host/sdhci-of-arasan.c @@ -25,6 +25,7 @@ #include <linux/firmware/xlnx-zynqmp.h> #include "cqhci.h" +#include "sdhci-cqhci.h" #include "sdhci-pltfm.h" #define SDHCI_ARASAN_VENDOR_REGISTER 0x78 @@ -366,7 +367,7 @@ 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); - sdhci_reset(host, mask); + sdhci_and_cqhci_reset(host, mask); if (sdhci_arasan->quirks & SDHCI_ARASAN_QUIRK_FORCE_CDTEST) { ctrl = sdhci_readb(host, SDHCI_HOST_CONTROL);