From patchwork Mon Oct 24 17:54:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Norris X-Patchwork-Id: 9989 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp615446wru; Mon, 24 Oct 2022 12:26:23 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6dQhJ0tsb/pPZDftuNlaOwHFGqPvDNOhdUNUNt0yEwtGXnwsAyrSr+WslvtAjtePp0u1xz X-Received: by 2002:a17:907:2be9:b0:7a1:11a9:1334 with SMTP id gv41-20020a1709072be900b007a111a91334mr957056ejc.131.1666639583501; Mon, 24 Oct 2022 12:26:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666639583; cv=none; d=google.com; s=arc-20160816; b=O7AXvCYcW22yTHeTZSn5Ro2tRHgIMsDqXnaVr5YnBfjFB5x7tnFoZ5q5rG17nxfF1h TSpr2ex2AfcNrUIt1zJQkJISNNWT0vZ9o0bfqutHKWC3S3yk7lur4ZDq/udHn1/rdKuW b5zk6xC2Fs/56ldf3Uo1F9vQGZ5MrJfqAlUHo5puV+eHlzvlzw14PwgqDE0eqZvta4iE xmwkQ2gPFwUZRns3cWMv6mVwQDAcEmPWbgWpU7R/y8vsCM6Czd8rHE8xYHluODXTivkU c5+4dky1J9R618hZrJzlIUgu9WF5JTeJNfNA2wulGV+ZI0eAKw4UqWMjR9WG9AAaT+dQ LyPA== 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=PlyFLurvfH7029w8iwxQ1Sku/pg4fNXCW6GH7YT3X1o=; b=lYwVGjDzcM+qhKh5IiD4DcdYq4D/Cc7rwy3GaEil38KbzxVLw5Tx4xn9VgSpjOqu+6 SCRY+H2DtZaJy+ydr7X4tTkmISBJujN1z+v1ZPeuZQts0QzNtzgIZ/KTnUBKpAvb3mjM iFLl7isr3fCK4JC6dfGdUvG22CwNHO8GC99ufDhiwRXdK+az+ZAqsLhzMfnPI1XAfx2R F5UrsSdjM0rxRtup50DeYjKvWHJ43O+su+/ATj6lEIo2ju80hnQJh93uLqLRJBp33WFq WApxvPM8eaHR+woI7FtymDVvt6gG3q6tedL9/Zcph9yOpafNHNCWanSKFvM2Cq+rCSRE UR9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=oFFypgAm; 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 c13-20020a0564021f8d00b004597fa7ee6csi578412edc.108.2022.10.24.12.25.56; Mon, 24 Oct 2022 12:26:23 -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=oFFypgAm; 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 S233033AbiJXTX5 (ORCPT + 99 others); Mon, 24 Oct 2022 15:23:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45890 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232246AbiJXTWC (ORCPT ); Mon, 24 Oct 2022 15:22:02 -0400 Received: from mail-pg1-x530.google.com (mail-pg1-x530.google.com [IPv6:2607:f8b0:4864:20::530]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8D0D83AE66 for ; Mon, 24 Oct 2022 10:57:22 -0700 (PDT) Received: by mail-pg1-x530.google.com with SMTP id s196so9308434pgs.3 for ; Mon, 24 Oct 2022 10:57:22 -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=PlyFLurvfH7029w8iwxQ1Sku/pg4fNXCW6GH7YT3X1o=; b=oFFypgAmtRSfdYpG2g2vzrpENnpBptPReooSwNKcKMviZOjIzHdqvDt9dal43yElrs pjMh+aBByGRMnMNHeptY6IphflqbfVd2BqYoYNmd7AMSahsxsSPrM47jqwMcKMV4XVBi tKrPXznD/J4GqIn/JRB0IhdbNpRPvrVOg2Pqc= 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=PlyFLurvfH7029w8iwxQ1Sku/pg4fNXCW6GH7YT3X1o=; b=1mjsmbcB5bIEVz0M5zy3aAZZrsn/sjCm70MyJbNBFwcZNJegYmh9wac8uD0ncp1wlF 2lDe5tZ+nTkGKO0p9t9NZDnX83hwJzqVk5gO6hW9PU6hH8BAtYGPQ4hGLTiqLb1UwRlB v5HJWpN686gqWVRadFBG2FQmzKRjtgu9KElpek1I8fLWff4LbjMcAiMgXIMb+96LpGOk rAul+8JW4d7ioyyBUtPCglf8xNu7wesmdtYJlpiKpIRh8jbuVeD9kkP1Bh9L0ufg0Fpf Y8L3Dl0SlusvkXEe5vaKZyoGAwly3M2rYnc7rwfy7fGY6iReqgOdLEfMzBwSh7GlCnlT WN4w== X-Gm-Message-State: ACrzQf0MHvWm8JhXRIXuAlOo5KILskyQnpFqFkVqhPxES0lqT95w6grN FzNtvROVhBEgYjN3UWB50SfGOQ== X-Received: by 2002:a63:f755:0:b0:44b:e438:ef2f with SMTP id f21-20020a63f755000000b0044be438ef2fmr30101590pgk.314.1666634180688; Mon, 24 Oct 2022 10:56:20 -0700 (PDT) Received: from localhost ([2620:15c:9d:2:808b:e2f6:edcf:ccb0]) by smtp.gmail.com with UTF8SMTPSA id w20-20020a170902ca1400b001714e7608fdsm26385pld.256.2022.10.24.10.56.18 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 24 Oct 2022 10:56:20 -0700 (PDT) From: Brian Norris To: Ulf Hansson Cc: Shawn Lin , linux-mmc@vger.kernel.org, Al Cooper , Bjorn Andersson , Sowjanya Komatineni , Broadcom internal kernel review list , Sascha Hauer , Konrad Dybcio , Florian Fainelli , NXP Linux Team , Thierry Reding , Fabio Estevam , Michal Simek , linux-kernel@vger.kernel.org, Shawn Guo , Adrian Hunter , Pengutronix Kernel Team , linux-arm-msm@vger.kernel.org, Haibo Chen , Andy Gross , linux-arm-kernel@lists.infradead.org, Faiz Abbas , Jonathan Hunter , Brian Norris Subject: [PATCH v3 3/7] mmc: sdhci-brcmstb: Fix SDHCI_RESET_ALL for CQHCI Date: Mon, 24 Oct 2022 10:54:57 -0700 Message-Id: <20221024105229.v3.3.I6a715feab6d01f760455865e968ecf0d85036018@changeid> X-Mailer: git-send-email 2.38.0.135.g90850a2211-goog In-Reply-To: <20221024175501.2265400-1-briannorris@chromium.org> References: <20221024175501.2265400-1-briannorris@chromium.org> MIME-Version: 1.0 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 autolearn=unavailable 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747598267697447593?= X-GMAIL-MSGID: =?utf-8?q?1747598267697447593?= [[ 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. Include this fix by way of the new sdhci_and_cqhci_reset() helper. Fixes: d46ba2d17f90 ("mmc: sdhci-brcmstb: Add support for Command Queuing (CQE)") Signed-off-by: Brian Norris Reviewed-by: Florian Fainelli Acked-by: Adrian Hunter --- Changes in v3: - Use new SDHCI+CQHCI helper Changes in v2: - Rely on cqhci_deactivate() to handle NULL cqe_private, instead of moving around CQE capability flags drivers/mmc/host/sdhci-brcmstb.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/host/sdhci-brcmstb.c b/drivers/mmc/host/sdhci-brcmstb.c index aff36a933ebe..55d8bd232695 100644 --- a/drivers/mmc/host/sdhci-brcmstb.c +++ b/drivers/mmc/host/sdhci-brcmstb.c @@ -12,6 +12,7 @@ #include #include +#include "sdhci-cqhci.h" #include "sdhci-pltfm.h" #include "cqhci.h" @@ -55,7 +56,7 @@ static void brcmstb_reset(struct sdhci_host *host, u8 mask) struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); struct sdhci_brcmstb_priv *priv = sdhci_pltfm_priv(pltfm_host); - sdhci_reset(host, mask); + sdhci_and_cqhci_reset(host, mask); /* Reset will clear this, so re-enable it */ if (priv->flags & BRCMSTB_PRIV_FLAGS_GATE_CLOCK)