From patchwork Wed Nov 1 07:38:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adrian Hunter X-Patchwork-Id: 160460 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:abcd:0:b0:403:3b70:6f57 with SMTP id f13csp244483vqx; Wed, 1 Nov 2023 00:40:05 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEJ4VwmbM6HJknxI2HFfkhPc+hTQ4fU8XZ91tAG/iOVX7O0yeMWgysxcIgri8xQpsJCY+/v X-Received: by 2002:a05:6358:5e16:b0:169:7e97:6fd with SMTP id q22-20020a0563585e1600b001697e9706fdmr5979748rwn.5.1698824404769; Wed, 01 Nov 2023 00:40:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698824404; cv=none; d=google.com; s=arc-20160816; b=JhKfwXqtm1PzARl0gFgAbwmQmuPINUVjyP3MgZZ1K87sEIukcUtemP04JRTbajbpsx z6FIbni720wIhkvuS5noBy/P77/MYK4XXw26EfeHX5dbjKjT+TIR7Cr/e1OlUlBYGem/ Rkc9X2S4sFD5o7tgVM/9OFc7Wr2djNIfoyVsdi6qUT0zV0Xr0ne5AezIIT4jOzQ3ugQE 3DsCdyEDytESmhVSozSoNdhtK+QMvzQKWFGKuQBaYpdAZ6gu3Yk7K4l5s7w8SQG7bXhN 1ZLFs74EmkYtZ4aXSGKmx6sy2jd7y63plenrX5xYoaOqer2by8dx+OzqhjirbhLM1NWB 6nNw== 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=B/ymYvz68TmAYsy3osQThBsQqGybcLhrtzuZ248faME=; b=ryymRPr9RQVFRD+pzA0lXOlK6RV24dORoVsC1k3LaFJOxxkQhBq6Z8ln6QRqHdSQWg aRiLt/RA1rX7p7tulAeObXBqnXZyWzIo8sAkJhx1Ho0VzIfB8q14XRfAyEcMw3Hg3LlC egZ6NlgOHHRZAyYAE0ianj2VVQCzagPqPyaAhhfnrr8vuxsUXXuXtslHw4jrj3x9xCm/ ldGQqCbIMZL2LXglJESTM3c0vwdy9HXMTd4tqFGI/XZqMM04/F4/ZpHcYADVOGbK+z/D VAW4j663m6R9ul8Lg4gpoKk1L8TWHWyT2eNc+XyjOQ2vO0agBmE+w0a12Jc2N5kPeOyZ 2gdg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=MGWbMVRO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 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 pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id c194-20020a6335cb000000b005b7ce261d0dsi2451134pga.402.2023.11.01.00.40.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Nov 2023 00:40:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=MGWbMVRO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 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 pete.vger.email (Postfix) with ESMTP id B21ED80BC82F; Wed, 1 Nov 2023 00:39:59 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231896AbjKAHj1 (ORCPT + 35 others); Wed, 1 Nov 2023 03:39:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50596 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231630AbjKAHjR (ORCPT ); Wed, 1 Nov 2023 03:39:17 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 36CAD10A; Wed, 1 Nov 2023 00:39:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1698824349; x=1730360349; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=OV8RDN4Bd1h5BCWBvIEygF8kScSzkr9HTkdiwgabNdQ=; b=MGWbMVROvCPDxaUTNeEs+0wnNKXWI2Vy9lmow5DFZeNW+h7nlsa4A1ZP iyPCv4mKyw3Qtk2qKKgeRdiAzZgD9Cx7h6mW8F1nUDjn5TxFlellSNVNN M9FWHWAHp3jFbnKJSXIVZ/1JgFROWYZQJ8jvN9ygh750g2fpkgctchoxi TKO7/saiOMILCSaMLoQSyqrMTiKoWiG2N/3kqMi5RdD8/Xenv+QMfdNVM HmR5fBQo4qquZsGlebuVTk0E32fX09JKJeOd+YM0dM5mlm9kQRENykIRF 91q2q5Fy5QuZutYeVV5GmPd3MqZpqoxOaIrgTbrXc0+SdmgFnsjOQjGR6 Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10880"; a="9982762" X-IronPort-AV: E=Sophos;i="6.03,267,1694761200"; d="scan'208";a="9982762" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Nov 2023 00:39:09 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10880"; a="934357556" X-IronPort-AV: E=Sophos;i="6.03,267,1694761200"; d="scan'208";a="934357556" Received: from ahunter6-mobl1.ger.corp.intel.com (HELO ahunter-VirtualBox.home\044ger.corp.intel.com) ([10.252.34.17]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Nov 2023 00:39:01 -0700 From: Adrian Hunter To: Ulf Hansson , =?utf-8?q?Kornel_Dul=C4=99ba?= , Radoslaw Biernacki , Gwendal Grignou , Ritesh Harjani , Asutosh Das Cc: Chaotian Jing , Aswath Govindraju , Bhavya Kapoor , Kamal Dasu , Al Cooper , Haibo Chen , Bhupesh Sharma , Shaik Sajida Bhanu , Sai Krishna Potthuri , Swati Agarwal , Victor Shih , Ben Chuang , Thierry Reding , Aniruddha Tvs Rao , Chun-Hung Wu , linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 4/5] mmc: block: Retry commands in CQE error recovery Date: Wed, 1 Nov 2023 09:38:26 +0200 Message-Id: <20231101073827.4772-5-adrian.hunter@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231101073827.4772-1-adrian.hunter@intel.com> References: <20231101073827.4772-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=-1.3 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email 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 (pete.vger.email [0.0.0.0]); Wed, 01 Nov 2023 00:39:59 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781346498995229874 X-GMAIL-MSGID: 1781346498995229874 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 --- 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;