From patchwork Wed Nov 1 07:38:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adrian Hunter X-Patchwork-Id: 160459 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:abcd:0:b0:403:3b70:6f57 with SMTP id f13csp244230vqx; Wed, 1 Nov 2023 00:39:20 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH2vWftl6D1ukxrPZsbvgOnuL46tGc6XCObgsICSBMsDejcKD2ZPSFp0TW05nduuLbxFTgX X-Received: by 2002:a25:69cd:0:b0:da1:137a:315b with SMTP id e196-20020a2569cd000000b00da1137a315bmr13254823ybc.17.1698824359881; Wed, 01 Nov 2023 00:39:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698824359; cv=none; d=google.com; s=arc-20160816; b=nGdc7dlwnjUWph2TSq4gWt/YpFReZR55Wm4Oepo6MnW6zbn4aNLCe9gF30BVamYYw4 IlBpnFZy+Vf7Gcy1kQZgtDXPIB+oeLUKGz1vu6GIJ6KbO2vxP3o/FETxEBzTZWPDjjSs Ojdht+mOhvhOBZ2aDxsNC+YoIH6j8ph5LxO6uugdah54CevxMAI4JtI+l0osOR34BYkU 5iBFuAUKYdYec/uFaqXEsYnPX2fWDbiOGbqeR6cwjAkJTYMUF+wy7O++OtmcFdpPUMel NRzbEqT7HT+0aNTLKd/lwHjD0jgfg/wwNJxQzrwfRDX5WvCfUFKs7Z/nQm2H9biNL+wA WAOA== 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=0ujTn+DR9HZ4nFmpW/WRmU1wpFxEf+lLTPzALBDZpxc=; fh=B/ymYvz68TmAYsy3osQThBsQqGybcLhrtzuZ248faME=; b=YPweBVeL+s7j2txuX0rF1YUPYyPtaADo1497ElbpX6NQU7EUaVnz4HzZ4yr/E+ytVx s9Oj7NkLe2WMiUQTQxSuCc/0UgarUEUMyt/DQsWoQm3NllGYhX8jWQ8UhhCNOQPZBFIg aPyyBDgqy5ivbiQmmMYQHaNQwyIpa5NjvZ3eM36EpWoDflGo1+ubB4ww8JveK4/WtWaD uB6efX/lEd0XouWP7IoJpa9fiaV1J3RQRGkEA23L8XXN0eG9t6ruv4NaB+/iuWfIhuXc lVDXmHkSpchnmmk49onUYyh21GmXv1S37mZXtPup7WyucdWKJt23BjbZ635XFz+ldXcl 2POQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Fk5NDugE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id m1-20020a632601000000b0057942bfab4dsi2461953pgm.395.2023.11.01.00.39.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Nov 2023 00:39:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Fk5NDugE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 1DF38802BE7C; Wed, 1 Nov 2023 00:39:19 -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 S231502AbjKAHjN (ORCPT + 35 others); Wed, 1 Nov 2023 03:39:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33850 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231546AbjKAHjJ (ORCPT ); Wed, 1 Nov 2023 03:39:09 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 626CAF1; Wed, 1 Nov 2023 00:39:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1698824342; x=1730360342; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=mP6Mo3+Nw1x4znWMjlIBYHth0os2JHcW2xe8+eVSNhY=; b=Fk5NDugEh7G6OXgsIM3eKpBOmbFfYY7AhcLFHr9YxliH8ioVKFrZ331X p7srR8DmUbbRV4DI+hMsSSFED0kpiS6Ijj3d16F5B+TIzRomU7Fm/8GwE 7unuV3OqyXeZBKcGnPWEzT6sn0cRbzY2ovMYUCQEbIaEgCUDMmej9f3aq EZ80E/16tOb8oPzXKzYb6F+6soKTCeLubJzXZeB0Q+QeZshJ7vkuN3eFM /WdU1szGU4Ms3eRckC7XMd1IhLkzQzUa4kMcOKUOIw+s8i6AfXH8ofY1+ noXORxBV2hurFm7CAiaDac+OIj1BULp8QsmnYEvWSktUcx/6b09Fiw1Q6 A==; X-IronPort-AV: E=McAfee;i="6600,9927,10880"; a="9982709" X-IronPort-AV: E=Sophos;i="6.03,267,1694761200"; d="scan'208";a="9982709" 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:02 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10880"; a="934357542" X-IronPort-AV: E=Sophos;i="6.03,267,1694761200"; d="scan'208";a="934357542" 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:38:55 -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 3/5] mmc: block: Be sure to wait while busy in CQE error recovery Date: Wed, 1 Nov 2023 09:38:25 +0200 Message-Id: <20231101073827.4772-4-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=-2.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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]); Wed, 01 Nov 2023 00:39:19 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781346451880319177 X-GMAIL-MSGID: 1781346451880319177 STOP command does not guarantee to wait while busy, but subsequent command MMC_CMDQ_TASK_MGMT to discard the queue will fail if the card is busy, so be sure to wait by employing mmc_poll_for_busy(). 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 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index 3d3e0ca52614..befde2bd26d3 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -553,6 +553,8 @@ int mmc_cqe_recovery(struct mmc_host *host) cmd.busy_timeout = MMC_CQE_RECOVERY_TIMEOUT; mmc_wait_for_cmd(host, &cmd, 0); + mmc_poll_for_busy(host->card, MMC_CQE_RECOVERY_TIMEOUT, true, MMC_BUSY_IO); + memset(&cmd, 0, sizeof(cmd)); cmd.opcode = MMC_CMDQ_TASK_MGMT; cmd.arg = 1; /* Discard entire queue */