From patchwork Fri Nov 3 08:47:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adrian Hunter X-Patchwork-Id: 161198 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:8f47:0:b0:403:3b70:6f57 with SMTP id j7csp884188vqu; Fri, 3 Nov 2023 01:48:48 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEMEGea9Kmk0t6zstfn6xpANaj4WwU2twVvHc8rf6gh0waU/noz6Uf4NruIs3hYM0F6JcZt X-Received: by 2002:a05:6a00:190b:b0:6c3:69b9:44db with SMTP id y11-20020a056a00190b00b006c369b944dbmr1621554pfi.22.1699001327822; Fri, 03 Nov 2023 01:48:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1699001327; cv=none; d=google.com; s=arc-20160816; b=SywTsWMzsrfq2xNfqze1Npar0lQZF3z8jb0jU0Pw1JQ9ALRFMc3WcAgTDmud5fRpH2 E2bEG5ZGshMAgWuWdRQHfRfzOoR3iMRwB1AwJ+RV4+pSxIVZI0N6GN+gwIA6P+W+gxTa 4s/9M8DodnVkyTDAeDDGdGZs6q8B3f0TdEwW8IliDrR8y54+A33abmssU/cbkHkiNRsR O0efIdT4HWbQnM0ZcJRyBZAHKnQ68f6H0E7e3aRwoyeXOUeVs29pSO4g7Upy+f1v+ZjF ky63npfJod1Hz9heF+ZioDs5SqGK0KWZCDXiF9suEQEZ2wEB6yuERGKD6EW+PhyIUo6X ELxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:organization :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=BTKYkLTvs/mbKW2eEVWXGznLCcf8HQLLSg1ZPbBOAj8=; fh=aIvDo0DPc47ZdKemLI3k3NodRhLAZ2m+5rlxdvTm1gA=; b=hr16eaav12aLsEg4m7ChjCjAPVoNMDoXOaDZ9f7hQLogg5AY66l7T6KjxLF7dihX5C KmRS+QiR5rFBocW+1PVKgGcKiJR5/UKPNepQCq3iv9r2VKRFma+uxcmLliBNSpv7XfC1 cKljS61PlDs3OKhFeqdiCH/aYpqBas9V5szMgQTccLY+wMjb87GKDdUTO1MeLCDSu4Um EWZxUCzoFHDX9y5QOlMrubupwNmL6PFUcSrcu1EqxtovBC7jWmUuPYjcBQ4560dWnHbA ogA9h2UsGXvu5TLYIPybKSQe0H9DUouquCvfmrVeP5ZO/N8ruIm8OPI9ayQnszu4FVLj mm7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="XlnPH/nD"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id g12-20020a056a000b8c00b006be25b58596si1168091pfj.77.2023.11.03.01.48.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Nov 2023 01:48:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="XlnPH/nD"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id DFE2F83792F5; Fri, 3 Nov 2023 01:48:46 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345458AbjKCIsp (ORCPT + 36 others); Fri, 3 Nov 2023 04:48:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42654 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235601AbjKCIsl (ORCPT ); Fri, 3 Nov 2023 04:48:41 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 21285D50; Fri, 3 Nov 2023 01:48:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1699001311; x=1730537311; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=OV8RDN4Bd1h5BCWBvIEygF8kScSzkr9HTkdiwgabNdQ=; b=XlnPH/nDTf/57/Y//gWwmw8gGwYDhUoO2SCsp3/zUXCNxiqhyDhCl9Qi 12OS/RnYc8sIjh3SueKOyLsEyT+EFvDZDvDCKj509QRUcz8Az/AIoB1qW FGtLhbIaMi55bXLxO7wFMvD5GOuERP5N4NeZsUIcDPYeFuQ6W6Ew2293u pUK4w5XYr1e11C2CHPpT3B+5/VFFTS1kr5pjP0YIZEv9xcs00yC+oVaq7 syLoXXYikAAET/BpiPcugQFsn9WTqVPvG9Kzk6EI6pmQjqaYUqguPWHkL ee/Q3hUL6VzeBwJCbemZY6gRT24fea2a+SnBR/e/4fnM3y8aeq+PeJ68r A==; X-IronPort-AV: E=McAfee;i="6600,9927,10882"; a="391774580" X-IronPort-AV: E=Sophos;i="6.03,273,1694761200"; d="scan'208";a="391774580" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Nov 2023 01:48:30 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10882"; a="796556610" X-IronPort-AV: E=Sophos;i="6.03,273,1694761200"; d="scan'208";a="796556610" Received: from ahunter6-mobl1.ger.corp.intel.com (HELO ahunter-VirtualBox.home\044ger.corp.intel.com) ([10.252.51.133]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Nov 2023 01:48:25 -0700 From: Adrian Hunter To: Ulf Hansson , =?utf-8?q?Kornel_Dul=C4=99ba?= , Radoslaw Biernacki , Gwendal Grignou , Asutosh Das Cc: Chaotian Jing , Bhavya Kapoor , Kamal Dasu , Al Cooper , Haibo Chen , Shaik Sajida Bhanu , Sai Krishna Potthuri , Victor Shih , Ben Chuang , Thierry Reding , Aniruddha Tvs Rao , Chun-Hung Wu , linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH V2 4/6] mmc: block: Retry commands in CQE error recovery Date: Fri, 3 Nov 2023 10:47:18 +0200 Message-Id: <20231103084720.6886-5-adrian.hunter@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231103084720.6886-1-adrian.hunter@intel.com> References: <20231103084720.6886-1-adrian.hunter@intel.com> MIME-Version: 1.0 Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki 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_BLOCKED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE 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-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Fri, 03 Nov 2023 01:48:46 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781532016485793810 X-GMAIL-MSGID: 1781532016485793810 It is important that MMC_CMDQ_TASK_MGMT command to discard the queue is successful because otherwise a subsequent reset might fail to flush the cache first. Retry it and the previous STOP command. Fixes: 72a5af554df8 ("mmc: core: Add support for handling CQE requests") Cc: stable@vger.kernel.org Signed-off-by: Adrian Hunter Reviewed-by: Avri Altman --- drivers/mmc/core/core.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index befde2bd26d3..a8c17b4cd737 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -551,7 +551,7 @@ int mmc_cqe_recovery(struct mmc_host *host) cmd.flags = MMC_RSP_R1B | MMC_CMD_AC; cmd.flags &= ~MMC_RSP_CRC; /* Ignore CRC */ cmd.busy_timeout = MMC_CQE_RECOVERY_TIMEOUT; - mmc_wait_for_cmd(host, &cmd, 0); + mmc_wait_for_cmd(host, &cmd, MMC_CMD_RETRIES); mmc_poll_for_busy(host->card, MMC_CQE_RECOVERY_TIMEOUT, true, MMC_BUSY_IO); @@ -561,10 +561,13 @@ int mmc_cqe_recovery(struct mmc_host *host) cmd.flags = MMC_RSP_R1B | MMC_CMD_AC; cmd.flags &= ~MMC_RSP_CRC; /* Ignore CRC */ cmd.busy_timeout = MMC_CQE_RECOVERY_TIMEOUT; - err = mmc_wait_for_cmd(host, &cmd, 0); + err = mmc_wait_for_cmd(host, &cmd, MMC_CMD_RETRIES); host->cqe_ops->cqe_recovery_finish(host); + if (err) + err = mmc_wait_for_cmd(host, &cmd, MMC_CMD_RETRIES); + mmc_retune_release(host); return err;