From patchwork Wed Oct 26 19:42:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Norris X-Patchwork-Id: 11414 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp453642wru; Wed, 26 Oct 2022 12:45:22 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7QfVh5G5cmApHLBHcUGbFPzhIDzMU6bSWCPu43jJVQ2U7RstWiEzICFnE4FU+20j/u880+ X-Received: by 2002:a63:7e4d:0:b0:43c:8ce9:2a9f with SMTP id o13-20020a637e4d000000b0043c8ce92a9fmr38084428pgn.528.1666813522517; Wed, 26 Oct 2022 12:45:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666813522; cv=none; d=google.com; s=arc-20160816; b=ZQaBtMlKh0AywIFXEY4VpPofe4MCannN79hGrpWWCvNnkZcey3HbFDnrQFyf9qWHDT t9v8jiqL9bo2fd6aZNukySZ4xV539FF9Qp4S1DBUhvLn7ASpIEWk2U27crC6ucpSckxc DJIO8HMBSGvqWirB5vab6AlNrbxyU+MxVaULvZ6/hc5H2PWGj67sxxOAdATy74g8MX1K +VwYAqj2t8DxBNef9RNmG8fz1WDgIof0UaC8v1WMK+1mKmXl5BiPD2i10nBPt4ciZRos vzEvAyKJmhhyF51oWTgok4VbeTba+HqCfjR+Pe8E+78euW/HeC+imhzfiZXT4dPGR/1v OI+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=OP/jpiXLlD32ihmuaQEisQ+o2cyp9ywlsHpK/BoVXYw=; b=rbaAiqasjn4XCYoWqqtO++3noWlAiSHgkZT19dxjM072JEFqczbJerY5NP4zaS4Jgz P8erTW60KV9Ir4jSTHB8ZrKF5qccNnCHbVr8qGZ2iO3TPs+kNr1V3HIe8FuhzFvHvM0T O07Db7ZE9ccupRQGfBx1aX2wAXoVrH+V0a3nnXFnVQfyXfxN5ob+IA/ngvjOKMZiFI0u KSLSOL+MjfraKU4TcGPK6j+dE9uCNg2qbbemkhWbgzDrm/TYU7q2pZEoWw5gXSW4izhg HV7SV0ZGo8cIFLq45SmnLOBeo7n8eQBVZi/GuCpbRhO+WfNPP36Ys1lS9hQuLS/7IlYV RWNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=jIbj4VPf; 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 k17-20020a170902f29100b00180680b8f1bsi6381391plc.264.2022.10.26.12.44.58; Wed, 26 Oct 2022 12:45:22 -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=jIbj4VPf; 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 S234321AbiJZTne (ORCPT + 99 others); Wed, 26 Oct 2022 15:43:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39634 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235051AbiJZTms (ORCPT ); Wed, 26 Oct 2022 15:42:48 -0400 Received: from mail-pl1-x62a.google.com (mail-pl1-x62a.google.com [IPv6:2607:f8b0:4864:20::62a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A3514FBCCF for ; Wed, 26 Oct 2022 12:42:34 -0700 (PDT) Received: by mail-pl1-x62a.google.com with SMTP id f23so15202195plr.6 for ; Wed, 26 Oct 2022 12:42:34 -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=OP/jpiXLlD32ihmuaQEisQ+o2cyp9ywlsHpK/BoVXYw=; b=jIbj4VPfhvDYQIKBdqCPB7rCCl8cb8N0uMtORU/8idM1msip0PJNFW8t1Tsq6UghFQ 1NVt00V8DqN9+0rdST/hMLOLcAixEjGcC4+0AJtX6OPzOYc7mVA+cH/cYq9oKQY+vYPR Cr8pF7qUMSS4oL2KezQ3wAEovOTMTkvDVNa2s= 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=OP/jpiXLlD32ihmuaQEisQ+o2cyp9ywlsHpK/BoVXYw=; b=wyrcEbart3vRjnwA+yJSzkaApp8pwaTlianEmki3GDfmNUTjCt9ZMrUoYcqFwcRSSd MguVh9jQdIFq4BAT2zhK8Ga9GSNtNYlu9WWDB7K7R2ggViPHv0WVEsDAxoCOx7P57SRZ z+/Fj/+ERGsPxmWStXCGG+inDDRNBvweCJ6oumrCxePV5Ur40RpJyW8GuZH7JDzY74eB isp+25tolUwqg6WH1V6jzs3TY6k5Y9WD2HkoHfsbTjLOJrjidP10+vTtnl7DizsPcoQ/ f1LwcvhxWcivOPfM5zj4zrfZvmmRvsbo3a0tV6IMxtPRoIpc/1HH+oq8lcsGLn8P9vVQ NsKA== X-Gm-Message-State: ACrzQf05N8DDcxMb50l5f6AwCq4JaIzrcqAmYs90i864mMR0BtQsyaIB PL4NrOT/oNomXzJbsXgdlWYHcg== X-Received: by 2002:a17:902:b18d:b0:186:9bb5:a92 with SMTP id s13-20020a170902b18d00b001869bb50a92mr20552157plr.11.1666813354356; Wed, 26 Oct 2022 12:42:34 -0700 (PDT) Received: from localhost ([2620:15c:9d:2:c9e3:74f3:6b2b:135]) by smtp.gmail.com with UTF8SMTPSA id e21-20020a635015000000b004582e25a595sm3151642pgb.41.2022.10.26.12.42.32 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 26 Oct 2022 12:42:33 -0700 (PDT) From: Brian Norris To: Ulf Hansson Cc: Shawn Guo , linux-mmc@vger.kernel.org, Adrian Hunter , Shawn Lin , Michal Simek , Sascha Hauer , Bjorn Andersson , Thierry Reding , linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Broadcom internal kernel review list , Jonathan Hunter , Andy Gross , Pengutronix Kernel Team , linux-kernel@vger.kernel.org, Konrad Dybcio , Al Cooper , Fabio Estevam , Florian Fainelli , NXP Linux Team , Haibo Chen , Sowjanya Komatineni , Brian Norris Subject: [PATCH v4 3/7] mmc: sdhci-brcmstb: Fix SDHCI_RESET_ALL for CQHCI Date: Wed, 26 Oct 2022 12:42:05 -0700 Message-Id: <20221026124150.v4.3.I6a715feab6d01f760455865e968ecf0d85036018@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 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747780656418490044?= X-GMAIL-MSGID: =?utf-8?q?1747780656418490044?= [[ 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. I only patch the bcm7216 variant even though others potentially *could* provide the 'supports-cqe' property (and thus enable CQHCI), because d46ba2d17f90 ("mmc: sdhci-brcmstb: Add support for Command Queuing (CQE)") and some Broadcom folks confirm that only the 7216 variant actually supports it. This patch depends on (and should not compile without) the patch entitled "mmc: cqhci: Provide helper for resetting both SDHCI and CQHCI". 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 v4: - Improve commit notes - Add Adrian's Ack - Add Florian's Reviewed-by 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)