From patchwork Fri Nov 3 08:47:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adrian Hunter X-Patchwork-Id: 161199 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:8f47:0:b0:403:3b70:6f57 with SMTP id j7csp884292vqu; Fri, 3 Nov 2023 01:49:08 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHfZkvHNdL7gBje1D45Wp7SCSpTed0RVXs6M6MzuUNyKa/vPaPIrFIK9/Nvijji1Qpbddhp X-Received: by 2002:a05:6a20:da97:b0:181:90eb:6b24 with SMTP id iy23-20020a056a20da9700b0018190eb6b24mr5594509pzb.22.1699001348498; Fri, 03 Nov 2023 01:49:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1699001348; cv=none; d=google.com; s=arc-20160816; b=uudigXn26YwWDW/TSa3wMT+8GCgaYGs9hn711Zn8rbWsvCU1NJt+oRrO0a4st7RABf cljqeyniXJBXCQctOQYQihbjmm72dG0qWduIJQq73CAMWOAgliPNlKX8t8JMf+q347LX lmohrf8n83GfV/8wZEQWmIjJ0FcZEM/wcKauh23mzlgkyr9Vtb6TdGrYY4Gy0sbhXCXL CfQK7ZLuDqdcKs303X1tGHXRxsRiopgGXvADK393d1wnFc0CIGa8TT5Y5iKWjIR6mCZ2 1EiZmGU8Qv7zEkN93yyzklqqUVIil9mJ/pKkklPp/O7L+VNij6t3Cg8uqaxs8yGP1Bn2 +3Lg== 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=aIvDo0DPc47ZdKemLI3k3NodRhLAZ2m+5rlxdvTm1gA=; b=zX7vvsUGCBQKKSX7uh26rQxzvk6vem9ZikhbGgyGPB/i39yq0Fkk9cFla8B5D805Eu kcNAG5Vddvzj6L84o2ZyfpAkBPAbq+wtu00XguSgVNG6T5cKevoWns3gSeh511Bp8PWO n8OP2GBzmQWdtjNhsaOTgNHynQVQrWrkYdFeVOqXhs/xhaEWmIWvS9cD8Ft8gjSUCdTx ywoa7jM06SjDIA4WHjebKUV9tzvMW/O2/euGUgvQfVnd8mNPvZHGDOqLw7H+i7CAtu35 KOc8NA/F6dG9Q9BRPATaxBxOPpOZGWl/M5YKoBko+M2TjgCVW4THlmFjhcrBZ8JMpAJa jVRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=fUibThXb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id x7-20020aa79187000000b006be31836ce4si1146265pfa.309.2023.11.03.01.49.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Nov 2023 01:49:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=fUibThXb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 agentk.vger.email (Postfix) with ESMTP id D618A81B5D22; Fri, 3 Nov 2023 01:48:59 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346089AbjKCIsf (ORCPT + 36 others); Fri, 3 Nov 2023 04:48:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44730 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345458AbjKCIsc (ORCPT ); Fri, 3 Nov 2023 04:48:32 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6AC4AD4C; Fri, 3 Nov 2023 01:48:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1699001306; x=1730537306; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=mP6Mo3+Nw1x4znWMjlIBYHth0os2JHcW2xe8+eVSNhY=; b=fUibThXbGmf0QqoFUB5cbQ5iuRSh+YG9qigwb0TOFsHLSOe4NuSiAAzM BFmrIDEZPOiolOW6IN9CBfIhMBTKIkRksxpVcx8HwDxNfqWRkFn2NoRst vjlv2TpgjoWbw1SI65bkIvQGD7XpXKkelXLGNgxyOx8WlWVzlkCt/A8Pe 3A/GCQkq2GJvhmnTxgLbQrh8/DPk/Cfb6DBvH4LwW4862BdZ/DVDLGXDE mBU4EHZZXQVrdAnG/istQBgazXHiBxAu1NtIw8M0EGxk91YTqqACONJAM AkGomgHyra78/arJDac2tE1eafOSx0FXAzgWLkAB+wkZpRtcyTK55HpV6 w==; X-IronPort-AV: E=McAfee;i="6600,9927,10882"; a="391774560" X-IronPort-AV: E=Sophos;i="6.03,273,1694761200"; d="scan'208";a="391774560" 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:25 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10882"; a="796556575" X-IronPort-AV: E=Sophos;i="6.03,273,1694761200"; d="scan'208";a="796556575" 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:20 -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 3/6] mmc: block: Be sure to wait while busy in CQE error recovery Date: Fri, 3 Nov 2023 10:47:17 +0200 Message-Id: <20231103084720.6886-4-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=-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 autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.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 (agentk.vger.email [0.0.0.0]); Fri, 03 Nov 2023 01:48:59 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781532038041641126 X-GMAIL-MSGID: 1781532038041641126 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 Reviewed-by: Christian Loehle --- 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 */