From patchwork Tue Oct 18 03:57:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Norris X-Patchwork-Id: 3922 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp1765206wrs; Mon, 17 Oct 2022 21:06:00 -0700 (PDT) X-Google-Smtp-Source: AMsMyM51jIicJSZ76181JIbGHad3RjCFaQeIKIjmtwapc45XekoQ/Bu20aEwwwyRNnN31pL8kO7x X-Received: by 2002:a63:91c2:0:b0:460:609c:e60f with SMTP id l185-20020a6391c2000000b00460609ce60fmr987956pge.447.1666065959850; Mon, 17 Oct 2022 21:05:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666065959; cv=none; d=google.com; s=arc-20160816; b=wNENRhfgjr96fnB0UzIVnIyabkOfVDoJj96pkIuLhl3T7JHR8IlydI3g7PzUzXVGNw Zqhl42zSYNDguy3AYUmjbWMlTjWT7wc6p5JR87FWfO46SXsSrsQDpIcK0vXRHlpktKmN 7BG+2tPpu5Z2AWWgP8itWoLjDyaVS93/+qkRzGFr+8LOx8dVJ9fmP1a8WIEAVIEQl/Hv OLMJRZzUb8N1CBWLhWkrg2Rds93pgleXb1CMAmzVImB1wUosTxCciiKkrkSXCmjN0sOv MUwxsFrcS3dCP4Tz4g9q+d1C0JYpNY+VM6b5zgTzImO6T8ZE+H8U4caW+C3ZQivdltsl JTOA== 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=9p3m7T6e0mIj8rcCXtywVHD8sGWIzKCyjF4TP7KLyZQ=; b=0gvROL7V7Ob2hIJlElWjg+0vIhTHu45LNKTGXS5CVpNVr0OIA78uVCYmPhRcYEt+KY yBQizZ7eI5SgkZKDSD1avCDedMhf1aoIM3sD3+fWPk+rT38vV5jFpNWb3tJBE/ET8q/l n/xhWp3y96i07e9SqcpBtDF1GDQCcx5Gd07owtIwIQKemeKyHXMzaaTkaZEjogwXtdMP XncjSaYuYUhYFTTbFX8PnmqEpHxdxd1q5l0N+1Pv/D4CeRv6Ob1s8iVXL7RVh9UvpaZN TmUNTULqsiyJJTHd974rtZCg4ZfSdzLGpEdjuy14VAWbTVEOHEUh8vqwLpCWvbeTp3cN moEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=F4EZTL9t; 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 27-20020a630e5b000000b00439e032490csi14127764pgo.350.2022.10.17.21.05.47; Mon, 17 Oct 2022 21:05:59 -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=F4EZTL9t; 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 S230149AbiJRD6c (ORCPT + 99 others); Mon, 17 Oct 2022 23:58:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53954 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230112AbiJRD6Y (ORCPT ); Mon, 17 Oct 2022 23:58:24 -0400 Received: from mail-pl1-x62f.google.com (mail-pl1-x62f.google.com [IPv6:2607:f8b0:4864:20::62f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D1DCD87FBE for ; Mon, 17 Oct 2022 20:57:51 -0700 (PDT) Received: by mail-pl1-x62f.google.com with SMTP id h2so5299665plb.2 for ; Mon, 17 Oct 2022 20:57:51 -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=9p3m7T6e0mIj8rcCXtywVHD8sGWIzKCyjF4TP7KLyZQ=; b=F4EZTL9tVgb/GVZL3Pq3dG+YSUlqemGjgd1HKl8uW7Zv3ivDiffA8tbC7/7dWruKax 2LCuvRHAppGUX8X6oBUrN2c9Rq3xqt9/4nqMIWNlL+g8QUFp5AYvLHJji2VTBRoAUEDs 1E5N2J25qZgWy/Rxdk6krea1cWV1M/bcTxVsw= 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=9p3m7T6e0mIj8rcCXtywVHD8sGWIzKCyjF4TP7KLyZQ=; b=2XhVWquw7enCcjsKLqJ6a7pnuOGL5bx05ymQjLW8HCspS27cWeJvawu62rfZ7UGIgE ixUW1VGILe/wcVnTJkfetPeFb+GKYtfY47Zu07WhtlOKmN0+3JxXnFKiAXNemF6GiXcf 8SfEqBLpVUEbhqcCYphkUVQB65BTIpdMQ2eL2JrkeLj5v0GzVlSZjBVN/QW+Y8uVuCIV OlCBcHp8y48QnRzWkboHCdHSG2aNlku+a6LyfPS1V3S1IlnIEcZeZpc5e32KXqA6Q5eb ZAui0m4q6Sx4vZKvlHZJbBy3nVFaAad8hilcK6VJLQB2BEno8xzHR49pKuSguKMHlmVT AN0w== X-Gm-Message-State: ACrzQf1KVFqvPAez18XhtjEyGuge8Y8E/80aO7waZ8LvOgtx6kZRHD82 Z5u82dBb8IXg12FdOv7p+L7tgQ== X-Received: by 2002:a17:90b:384f:b0:20d:4761:3394 with SMTP id nl15-20020a17090b384f00b0020d47613394mr1319039pjb.144.1666065470226; Mon, 17 Oct 2022 20:57:50 -0700 (PDT) Received: from localhost ([2620:15c:9d:2:2ac3:f4e2:e908:c393]) by smtp.gmail.com with UTF8SMTPSA id q23-20020a635c17000000b0043a0de69c94sm6805583pgb.14.2022.10.17.20.57.48 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 17 Oct 2022 20:57:49 -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 5/5] mmc: sdhci_am654: Fix SDHCI_RESET_ALL for CQHCI Date: Mon, 17 Oct 2022 20:57:24 -0700 Message-Id: <20221017205610.5.I35ca9d6220ba48304438b992a76647ca8e5b126f@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 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=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?1746996779660213428?= X-GMAIL-MSGID: =?utf-8?q?1746996779660213428?= [[ 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: f545702b74f9 ("mmc: sdhci_am654: Add Support for Command Queuing Engine to J721E") Signed-off-by: Brian Norris --- drivers/mmc/host/sdhci_am654.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/mmc/host/sdhci_am654.c b/drivers/mmc/host/sdhci_am654.c index 8f1023480e12..187a21086791 100644 --- a/drivers/mmc/host/sdhci_am654.c +++ b/drivers/mmc/host/sdhci_am654.c @@ -378,6 +378,9 @@ static void sdhci_am654_reset(struct sdhci_host *host, u8 mask) struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); struct sdhci_am654_data *sdhci_am654 = sdhci_pltfm_priv(pltfm_host); + if ((host->mmc->caps2 & MMC_CAP2_CQE) && (mask & SDHCI_RESET_ALL)) + cqhci_deactivate(host->mmc); + sdhci_reset(host, mask); if (sdhci_am654->quirks & SDHCI_AM654_QUIRK_FORCE_CDTEST) {