From patchwork Wed Oct 19 21:54:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Norris X-Patchwork-Id: 5859 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp554738wrs; Wed, 19 Oct 2022 15:03:40 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7EAw8ekTGGDHzPSxsot/+B9F5usJMb3Am70RNtxxeaGIWxRGaD09gxKLfmgt8XE3f+Fb9H X-Received: by 2002:a17:90b:1b47:b0:20d:cdf2:c02e with SMTP id nv7-20020a17090b1b4700b0020dcdf2c02emr12166472pjb.233.1666217020014; Wed, 19 Oct 2022 15:03:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666217020; cv=none; d=google.com; s=arc-20160816; b=AJHPQZrBo/XG/lamgspp4ypTmHAndtXQT0dYosFvXPB7bGCqu65XbCNq4/0aV+BeYj 4z0pNnNxsIzEaV7escOAp6KXxuKCOLICPa031r2uSX0rChJOWJ+ppRjtZh8J2UB3RaG+ j6LDnGbMg3mZqAP7Lih5WC8nzo9uAZY5sZ6ruwxHkXip7bRXgxyJMtsNtvZu3J9fLzYA DCcYBYbC2iHhMz2qzFLynC37PJGnVJYcP15q2nrh3unGKQAZun3Ki95vjIf+LdKkTXK6 rc0uhdScEMXU35JlK4ob3m+rTgx76Oa5PiB5fy5RD5bsjsrLb2sm0ZGVQJ+P+aZjDCbY 5p0w== 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=mdWjXp1yQqqnWhAF+f3RrVqI4HKKxf+i6fXlj1bwLGc=; b=VTlktAB4aoKW08OlHCam+j5xqWqU7ROoHk18/11PQs30XBFvvR8LXzHNkO96QU/k7e 6smXttSQZfHB3NJJC5NilCt4mRDrdWHn+WY/psh4VRwadeFPK+Uugv0dpJL0g9KdfBfw zgWrYaptGl/OY/J1OF7jWjOj3HmFnuMKarVtAiWSHkT/AJAWI4LvNkNdGgLxtPiGWPSJ S9n22MEoaNmsaQx8qKag3ZNC11jbtrKEjqNDWz6BUEuSZzs5og1oLjeCTww+Ni/DhH/H OE/EBVwfmks9HjA5FIbWZCC6wr++ZEdmrrczeHbkwJd5GLBLtbq5UIbhAC9yhOqilToG /n9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=dsorLnZ6; 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 8-20020a631948000000b00462ed110adbsi21163545pgz.316.2022.10.19.15.03.01; Wed, 19 Oct 2022 15:03:39 -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=dsorLnZ6; 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 S230506AbiJSVzj (ORCPT + 99 others); Wed, 19 Oct 2022 17:55:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54018 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231435AbiJSVzT (ORCPT ); Wed, 19 Oct 2022 17:55:19 -0400 Received: from mail-pg1-x52f.google.com (mail-pg1-x52f.google.com [IPv6:2607:f8b0:4864:20::52f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3E32E162508 for ; Wed, 19 Oct 2022 14:55:16 -0700 (PDT) Received: by mail-pg1-x52f.google.com with SMTP id l6so17476432pgu.7 for ; Wed, 19 Oct 2022 14:55:15 -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=mdWjXp1yQqqnWhAF+f3RrVqI4HKKxf+i6fXlj1bwLGc=; b=dsorLnZ6g7l46LRyLdlp2vDy2D5bxCKpUlzS+ILZbL2KnQEvI9+bHKJsmLlMd5z939 vFlptL1Scv3wg1kkesMKClNuMREJqrHJ2b1uLX9NPxSkw4qQzeJLAYCuENPkiEgsu5qq +DWF967Wz8uWOX1fu5humVdZ0fo80sExLbdRI= 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=mdWjXp1yQqqnWhAF+f3RrVqI4HKKxf+i6fXlj1bwLGc=; b=5n4+EbqzN2tQNNfZEOqmA32XSC0XTs7YuhDQHAo2O3RiPpNVRLb9py4AtJJM0HuzDp tTGWxt7A4rRNee30GLc0oF8ELdHkWpswQCVCHT/z3Olmv0mPiXRceYobfefyunhrxP0w i7PjKynqKZHDhzqqw88IGeFgn5rz2zPM6815LDz64Cr5KXUrnYOzaV8bIz5Yp6Ynh0Ku 4xHI7RiRChN/qLUJ5Rb4ygXI75NwNiE4Shi/T+nBfqT7z7hoUbfGQfSm4pPEKcKeA/Js Nk+BQrjYjcaImoR4rTcqoegJuPqqJgeZ6dGBzFt8dmQ8jR0FCcu96AgjHacbHNQ+eyHZ tTnw== X-Gm-Message-State: ACrzQf3Wu3Z2lTeLo7LMP10VL2Zm1qHI5wYghfVGg8pbwS0RoCZFeA1P Gk8DziavpDDNkyHxoSB4czGJzg== X-Received: by 2002:a05:6a00:408c:b0:565:fc2c:8c71 with SMTP id bw12-20020a056a00408c00b00565fc2c8c71mr10838457pfb.82.1666216514655; Wed, 19 Oct 2022 14:55:14 -0700 (PDT) Received: from localhost ([2620:15c:9d:2:57b7:1f0e:44d1:f252]) by smtp.gmail.com with UTF8SMTPSA id c4-20020a633504000000b0043be67b6304sm10453631pga.0.2022.10.19.14.55.13 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 19 Oct 2022 14:55:14 -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 6/7] mmc: sdhci_am654: Fix SDHCI_RESET_ALL for CQHCI Date: Wed, 19 Oct 2022 14:54:39 -0700 Message-Id: <20221019145246.v2.6.I35ca9d6220ba48304438b992a76647ca8e5b126f@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=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?1747155178251754889?= X-GMAIL-MSGID: =?utf-8?q?1747155178251754889?= [[ 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 --- (no changes since v1) 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) {