Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp5416565rwi; Mon, 17 Oct 2022 21:31:11 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5LdcromZZM0Ls9g6gXpeXcGovWK+IrRJ8leLLTVCmJtnNDsd8bDN9kBAWligIJvkHQMtce X-Received: by 2002:a05:6402:3896:b0:45c:93c3:3569 with SMTP id fd22-20020a056402389600b0045c93c33569mr891944edb.37.1666067470978; Mon, 17 Oct 2022 21:31:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666067470; cv=none; d=google.com; s=arc-20160816; b=rNZ+9smw4jAPeDk2CDHmYQOMOPHFL1U/16forzrfW4Fox9ogzw6yGP8MM0LTevxMVU lmqH7eAk1ciGd0i9Oz8EOKKqXsITr5TjzkSxhOqR/eNOz24ej2LH7cfa1yzZX5vomIZh Be/1ScR9Xw48S/L702WSpMnu0/wSvkYg/n14ZwTkJCnqvmjTWUKdo1/pc4O9t27DeDu0 0Bs9/Nv/TY5LWJrqOwHckUQRtP0CTDtVfTMY5Q3YGF/lM6CocYABeSAkX/Hh6z5UJJDT 9hPLY9xqHMWHQuwR3zYVk7RQHTWIOf7STI17SZ6KZ8qrinZa5+QIo9S58gpG2a03tXa0 QX+w== 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=8bYbVaurNHZoKZuiVprhZUwyKptjwry92NaACiNGGbI=; b=pQ/1iCUz8qxcRYCuApfDyw4OymkbLuP8j2qGXkkPCZWWNMuConIzngm1iSx6hrmBYg 4E2QK3U01uQLNzf9vpNWBD4mGLBl3SIIjy/qN2Uc0Zlbckc3VfIwh37bLNYmSBpIg1WK fIJZhC/diQczOpsr0pPAMzzsvdeAQOLTYcsOY15Bw+IPA/r6eEOIOErgrPGUoYsHRc0d La8N91VVUe9bfhIzeLpEVhbDjOqyBrJcg+QWnieh9ocWzKu0BuTdMHSDCopqgh+SpbaI rOC/3IOvOFA+HMFB5MIzEnkhhrSkIZmi5zjzsd5p5hYLlUyJVzNOn699kidbtgMWduTl 6Nhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=biCG5g3P; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 18-20020a508e52000000b00458239a54basi10364893edx.192.2022.10.17.21.30.45; Mon, 17 Oct 2022 21:31:10 -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=biCG5g3P; 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 S230093AbiJRD6G (ORCPT + 99 others); Mon, 17 Oct 2022 23:58:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53866 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229934AbiJRD5r (ORCPT ); Mon, 17 Oct 2022 23:57:47 -0400 Received: from mail-pj1-x1032.google.com (mail-pj1-x1032.google.com [IPv6:2607:f8b0:4864:20::1032]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 547DD87FB1 for ; Mon, 17 Oct 2022 20:57:45 -0700 (PDT) Received: by mail-pj1-x1032.google.com with SMTP id q10-20020a17090a304a00b0020b1d5f6975so12869690pjl.0 for ; Mon, 17 Oct 2022 20:57:45 -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=8bYbVaurNHZoKZuiVprhZUwyKptjwry92NaACiNGGbI=; b=biCG5g3PRhSpx+svQLWgmgvOwtH++XWGKTkyE9UWOj6vpD7L1xDgNgA2bS7D6s5lzt 6VCdakl25O4uQtiTkhYdpW2bJKszFrfsV48BRcAimQ2GDDRoq2nZg6E61fEGNtTw7cer IxKQK4PEAs9gKnrrzgPwkjW4YE6M2eNLHRR+c= 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=8bYbVaurNHZoKZuiVprhZUwyKptjwry92NaACiNGGbI=; b=V5qlh05x2UfHkVEynXTHDsLoySvD5XeDJaY89IxYharoDS6BKjdQG/GRy2lRwQ3nYf yiRClukxeL1GoJi0WGhV2ZmzklJOfBvEimXogF5XiHkMBzpW0V2E5Q/CRYYgSJoEPQ/v 3Km72uLfZVXCTiGxSElxQGLjj6OY+5awBpeSkOSSWP/MoltD971B1k45iwzoQrHvDnwK 9xjxR0SGwcwCVSpcm8MHii5wMkEecPY/WyIJv8QepIl5BosXSprveA5XzQ9y16o03eNV yPRrfDLGZLx63/+mqcuNJea1G2vg54hiLExbaVyKjkYVTFNIU9Cd508urfYDeDEtzeG8 kPrQ== X-Gm-Message-State: ACrzQf38zFjev1/rqPbawJdY21Az55mSs4xTwX4Mw4gUCmpTxmbxxzr7 q7TnVucpUmt6hmOClAYfEs0w/g== X-Received: by 2002:a17:90b:3892:b0:20d:4bb5:91fe with SMTP id mu18-20020a17090b389200b0020d4bb591femr1296941pjb.31.1666065464699; Mon, 17 Oct 2022 20:57:44 -0700 (PDT) Received: from localhost ([2620:15c:9d:2:2ac3:f4e2:e908:c393]) by smtp.gmail.com with UTF8SMTPSA id k6-20020aa79986000000b0056186e8b29esm8229358pfh.96.2022.10.17.20.57.42 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 17 Oct 2022 20:57:44 -0700 (PDT) From: Brian Norris To: Ulf Hansson Cc: Shawn Lin , Adrian Hunter , Shawn Guo , Fabio Estevam , Faiz Abbas , NXP Linux Team , Haibo Chen , Al Cooper , linux-mmc@vger.kernel.org, Pengutronix Kernel Team , linux-kernel@vger.kernel.org, Florian Fainelli , Sascha Hauer , Thierry Reding , Michal Simek , Jonathan Hunter , Sowjanya Komatineni , linux-arm-kernel@lists.infradead.org, Broadcom internal kernel review list , Brian Norris Subject: [PATCH 3/5] mms: sdhci-esdhc-imx: Fix SDHCI_RESET_ALL for CQHCI Date: Mon, 17 Oct 2022 20:57:22 -0700 Message-Id: <20221017205610.3.I7d01f9ad11bacdc9213dee61b7918982aea39115@changeid> X-Mailer: git-send-email 2.38.0.413.g74048e4d9e-goog In-Reply-To: <20221018035724.2061127-1-briannorris@chromium.org> References: <20221018035724.2061127-1-briannorris@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.4 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 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: X-Mailing-List: linux-kernel@vger.kernel.org [[ NOTE: this is completely untested by the author, but included solely because, as noted in commit df57d73276b8 ("mmc: sdhci-pci: Fix SDHCI_RESET_ALL for CQHCI for Intel GLK-based controllers"), "other drivers using CQHCI might benefit from a similar change, if they also have CQHCI reset by SDHCI_RESET_ALL." We've now seen the same bug on at least MSM, Arasan, and Intel hardware. ]] 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 this may occur in some suspend or error recovery scenarios. Fixes: bb6e358169bf ("mmc: sdhci-esdhc-imx: add CMDQ support") Signed-off-by: Brian Norris --- drivers/mmc/host/sdhci-esdhc-imx.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c index 55981b0f0b10..222c83929e20 100644 --- a/drivers/mmc/host/sdhci-esdhc-imx.c +++ b/drivers/mmc/host/sdhci-esdhc-imx.c @@ -1288,6 +1288,13 @@ static void esdhc_set_uhs_signaling(struct sdhci_host *host, unsigned timing) static void esdhc_reset(struct sdhci_host *host, u8 mask) { + struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); + struct pltfm_imx_data *imx_data = sdhci_pltfm_priv(pltfm_host); + + if ((host->mmc->caps2 & MMC_CAP2_CQE) && (mask & SDHCI_RESET_ALL) && + imx_data->socdata->flags & ESDHC_FLAG_CQHCI) + cqhci_deactivate(host->mmc); + sdhci_reset(host, mask); sdhci_writel(host, host->ier, SDHCI_INT_ENABLE); -- 2.38.0.413.g74048e4d9e-goog