From patchwork Wed Oct 19 21:54:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Norris X-Patchwork-Id: 5863 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp554920wrs; Wed, 19 Oct 2022 15:04:02 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6OeNPXNqZQHou0sRgB2T4IySvAL+ncEuBZMQWeO2fP9fPw06AFjE1tgL3Jqz+WwqtlS/2r X-Received: by 2002:a63:2b41:0:b0:46e:9364:eb07 with SMTP id r62-20020a632b41000000b0046e9364eb07mr885659pgr.46.1666217041812; Wed, 19 Oct 2022 15:04:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666217041; cv=none; d=google.com; s=arc-20160816; b=1CTIszk7iPKq8cmOMKwGD2yFezj+/0ljQUutT2eiZtl0bM2ZyaUm+lkInJ4L5o/nR/ F15aH9qvTMqRUnkQvVe8ivGh7/zhFRhaP/TDHfvEOFdlK1QreOysh+OYiCYRSFpY6hYM 2P71J1QMyC1EPh3ljfNAp4Ne5V79ghWkE7cz8JFkOV+PjNQJb7+HNDtTPW7vsmlJTWkv 1YQd/mK9m+mF3OynRWmE18nrGrvGzA2hLSkGgIt2aGs9UkZEROswAoNPwBCuPnq6JXPj K9phAXKPIGrq61yeFn+Cg0JZv+4yyI1SUh9QucNkTkfXIfpPTh6OifLCDq0pp2P20t8N QdWQ== 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=0aSPJogmlylX7KM1RJ0D1MDbzbxw24/coSip2lgP3l8=; b=mErmjYA2PiGUKk9UUU6xMnzJtQWgg3YZQ7ggm9+n9fbafosOOid/XWmP56T+qdP7WZ A8k1FY5Z0FgSoUvaFRK6us4cFbZP+I79NZXmsXNLA7Q6wZo/u4KAXxjC0l13UbXcRDK0 eFAGUCND8FyTU3kHgF9mvvRn40vhiiotgMDgLAHqX0V2HGyVfhrjCUU3e8mlM8c9yNni uvh9qDKBbOjFrnlYvw3EHohYfBLquuFUFH3h+yZSP1WQy+NGXjVDVcQ5VmP0O2ls3Hzt +UIJlWOqJnaxuFS3tbe9oGLfR1FaXhwdLeKb6l/8jP+LcDrtRmUZKw5fnx/SBuJLNQC1 iTvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=FfeJSmTD; 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 n18-20020a170902e55200b0016d9c8479b5si22308532plf.344.2022.10.19.15.03.25; Wed, 19 Oct 2022 15:04:01 -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=FfeJSmTD; 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 S231373AbiJSVzY (ORCPT + 99 others); Wed, 19 Oct 2022 17:55:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52520 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231299AbiJSVzP (ORCPT ); Wed, 19 Oct 2022 17:55:15 -0400 Received: from mail-pl1-x636.google.com (mail-pl1-x636.google.com [IPv6:2607:f8b0:4864:20::636]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 31C4037FA0 for ; Wed, 19 Oct 2022 14:55:07 -0700 (PDT) Received: by mail-pl1-x636.google.com with SMTP id 10so18576454pli.0 for ; Wed, 19 Oct 2022 14:55:07 -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=0aSPJogmlylX7KM1RJ0D1MDbzbxw24/coSip2lgP3l8=; b=FfeJSmTDi68H718jGTkL3Qo1tO+F4L+j54/kcb1cwGvPvCRoxWbXgrlkIzP8z1mliR GZ3uqYlcUUjHj9i+2kUHXcKMhvofvcwCX0imm1RPyUM1cBAIEklypYsyDLGlghvh/Th5 ePYBz8C0cLy280KU4RVy6tzul8GnmJ1Y48fYA= 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=0aSPJogmlylX7KM1RJ0D1MDbzbxw24/coSip2lgP3l8=; b=bwIuI7iuN+g1T5lvQfRQBU9iTwD27Y0N35jm+Ge+RQ8LbJxknq8BXGiBXlu7l0mjjD HIeXfxzAph6tL9q2WDUrKLWKtyty0ZvmYiiAnSpr+s5JsXDRC4iGe8ijhFr8MqZdRIwV ZJw3l5zsZS+fqZln1DVJPwQtwOlYD99b5BRXZqTi9fJDrVB1sKbccwZWmGqS76Un4ik5 16n+bA5bMYIl9JoftBBablMnUr9dGG2WdY7NPM/+IaOrn7zSpf627L+ywwyXAuwg5v+s hPw/agQwuBx69F95EoblNnZz+B3u0wFPXmCeQ9PoAaWRlyDiUAvfeWdXc3cHKoFWL6as 7cfg== X-Gm-Message-State: ACrzQf2dh8mLrbv51TIDB1FB3rxw4ykOLbGkVEWeZ412ZYOKlKzJ4eqA LRumdVigTP5M1xunsL+QWLXCQw== X-Received: by 2002:a17:902:9048:b0:17f:93a5:4638 with SMTP id w8-20020a170902904800b0017f93a54638mr10696224plz.108.1666216506540; Wed, 19 Oct 2022 14:55:06 -0700 (PDT) Received: from localhost ([2620:15c:9d:2:57b7:1f0e:44d1:f252]) by smtp.gmail.com with UTF8SMTPSA id s13-20020aa78bcd000000b00543a098a6ffsm11792418pfd.212.2022.10.19.14.55.04 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 19 Oct 2022 14:55:06 -0700 (PDT) From: Brian Norris To: 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 , Brian Norris Subject: [PATCH v2 3/7] mmc: sdhci-brcmstb: Fix SDHCI_RESET_ALL for CQHCI Date: Wed, 19 Oct 2022 14:54:36 -0700 Message-Id: <20221019145246.v2.3.I6a715feab6d01f760455865e968ecf0d85036018@changeid> X-Mailer: git-send-email 2.38.0.413.g74048e4d9e-goog In-Reply-To: <20221019215440.277643-1-briannorris@chromium.org> References: <20221019215440.277643-1-briannorris@chromium.org> MIME-Version: 1.0 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747155200599686105?= X-GMAIL-MSGID: =?utf-8?q?1747155200599686105?= [[ 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: d46ba2d17f90 ("mmc: sdhci-brcmstb: Add support for Command Queuing (CQE)") Signed-off-by: Brian Norris --- 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, 3 insertions(+) diff --git a/drivers/mmc/host/sdhci-brcmstb.c b/drivers/mmc/host/sdhci-brcmstb.c index aff36a933ebe..d479ca39c987 100644 --- a/drivers/mmc/host/sdhci-brcmstb.c +++ b/drivers/mmc/host/sdhci-brcmstb.c @@ -55,6 +55,9 @@ 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); + if ((host->mmc->caps2 & MMC_CAP2_CQE) && (mask & SDHCI_RESET_ALL)) + cqhci_deactivate(host->mmc); + sdhci_reset(host, mask); /* Reset will clear this, so re-enable it */