Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp2803053pxb; Tue, 24 Aug 2021 07:59:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwOox5JipRNLEdVzZLMQS/b60SscPPJkk+C5078QMBsor9R6/6j0hsqn0WWWnCt7BmiWfw3 X-Received: by 2002:a02:644:: with SMTP id 65mr1498566jav.84.1629817175228; Tue, 24 Aug 2021 07:59:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629817175; cv=none; d=google.com; s=arc-20160816; b=zxxgix2EybjfV1Yh66fOoHI22ax5JQp4l93GGF6ihBsVjXAWrhwbtsoGViKZ6WCpc1 jhmtm0rQvzZw2owydJrrl4jDVpmREljo9Q0k2VPmKcBGRcwObuGRTGsubQi0Dj5TiMD2 XdacsTbSRnLy0MQSW1iI0D4xyktLHi3nJP6B7xJ+zwp1V6Avg4eIAPbPu5HkOToA9yQU 2MIntV6tD32kngpeEk99bs3tn6CEs/ldfbaBaYl0cpeTHRyzgv4PS+aUakucf0lsrYAA buLeTcQj9RhzkXmbyLE3K/PxAReiJuvdgE5s1SaCpv0gbr6WMEQYM9jp5VfL1QMULTZo TNPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=z7T239jsLbsayF4aZWEjWJeLPMK9E8+LYFTW4JTLP0s=; b=ym/IzAZECQU0Ky5r0/Q/0h72rrfwK1TnGXftCXEVI8QZ4QUNthjJyozNoAPhvdUaS/ heGGz2d2gl2o7esf1ScivWy316WvBr/uhl0OskJjx5FCjFmXs9aybGn5QTjk3EFSBvqp RPlXC4+7y9X7amAxGbJio+rpuDtXa/tzKhweNTQ8oSBmaBblMwotgUC9PIzm91lKMZE9 2g2E02/lV+S0mt6WI9snxvMmKwW6xlC3wn0xPeuclpykf3GDxWZyX69J0JOLggaogkMy 4q1RzJTSisFr1N9Ad16JnatGtfbDH8wSVXkhqcO6mbKNUvZmGSRDobhxiq+jXOp66bM/ 2pWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ti+oB3vB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 13si19478623ilt.16.2021.08.24.07.59.23; Tue, 24 Aug 2021 07:59:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ti+oB3vB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238120AbhHXO6X (ORCPT + 99 others); Tue, 24 Aug 2021 10:58:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56290 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238115AbhHXO6V (ORCPT ); Tue, 24 Aug 2021 10:58:21 -0400 Received: from mail-lj1-x233.google.com (mail-lj1-x233.google.com [IPv6:2a00:1450:4864:20::233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 380CBC061757 for ; Tue, 24 Aug 2021 07:57:37 -0700 (PDT) Received: by mail-lj1-x233.google.com with SMTP id i28so38170755ljm.7 for ; Tue, 24 Aug 2021 07:57:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=z7T239jsLbsayF4aZWEjWJeLPMK9E8+LYFTW4JTLP0s=; b=ti+oB3vBOMMyqJa5uq/Hn58qVzWC8LgeR80juypKZJGX90tRhWFfEz+1y/aG8kAnXY 7prtD6JiMEg3zy8ryNOBCE2r0EdM/PN757z8eqKKtlt377TSbSOxvWe76eqmrzU/sx/J sO3p3xoM/vzqiH+cnifvIvDpZl0E7Q4+kvc4oMf+QTfDPHa7ga0UbCHERdRylr5BPjVF gjHv33kVgKi3YEbZmywENx8um2oNstnU8rYh+lAaKVoiopo/4AvJ/3x8yA2bygAjLYoj pdfYGDL4WF4HOUhOpFkEVxdK0nS1G1fb7YL7GRfknZWX7U7wIEDy2MkhoLFBYWplqXai r6dg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=z7T239jsLbsayF4aZWEjWJeLPMK9E8+LYFTW4JTLP0s=; b=P6g1vFYOk8J2C0Zg7Oq+iVKwk/omuKuvNS72SU7BnbLpSg2kJ1boj8r2uJw5Rx1OEK zP8srXOu42kmdURJMCMAggTAuOIqEc5IpEpSMWMk1tZb2q4NBKtryNk7IbleNJ/9+R7o GwBL/FwXCA/zYUoOAnaOKjBOuqLKwiVT97EJo66c51WAZ7pIFcf90jUt1pDXKcw4mb17 B65G32SC7mn6WjZQ1ThnSK0Eru4ROQgYb+LgzA9wdoWtCqYw1NYkn8iwCgk+gtvW64sy 0etdATAzqbiIV06UeHWOmCOwN18SMdIEwMpbX8aOCTfbXWpNuO9464QGraq16qThhZ+U 6Dug== X-Gm-Message-State: AOAM532dSiv0AcjBn4kYqjG5ntxM6iTTOwnGcvz8y47lZ5iBeZ9sPZF1 DBrggRc9IFobKnFxYi71SSmDMqXuvrxNQbrAXjEtFg== X-Received: by 2002:a05:651c:83:: with SMTP id 3mr32649938ljq.341.1629817055638; Tue, 24 Aug 2021 07:57:35 -0700 (PDT) MIME-Version: 1.0 References: <20210817224208.153652-1-huobean@gmail.com> <20210817224208.153652-2-huobean@gmail.com> In-Reply-To: <20210817224208.153652-2-huobean@gmail.com> From: Ulf Hansson Date: Tue, 24 Aug 2021 16:56:58 +0200 Message-ID: Subject: Re: [PATCH v1 1/2] mmc: core: Issue HPI in case the BKOPS timed out To: Bean Huo Cc: Adrian Hunter , linux-mmc , Linux Kernel Mailing List , Bean Huo Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 18 Aug 2021 at 00:42, Bean Huo wrote: > > From: Bean Huo > > If the BKOPS timed out, the card is probably still busy in the > R1_STATE_PRG. Rather than let application in the userland continue > to wait, let's try to abort it with a HPI command to get back into > R1_STATE_TRAN. > > Signed-off-by: Bean Huo Applied for next, thanks! I took the liberty of updating the commit message a bit to clarify. Kind regards Uffe > --- > drivers/mmc/core/mmc_ops.c | 11 +++++++++-- > 1 file changed, 9 insertions(+), 2 deletions(-) > > diff --git a/drivers/mmc/core/mmc_ops.c b/drivers/mmc/core/mmc_ops.c > index 90d213a2203f..0c54858e89c0 100644 > --- a/drivers/mmc/core/mmc_ops.c > +++ b/drivers/mmc/core/mmc_ops.c > @@ -959,8 +959,15 @@ void mmc_run_bkops(struct mmc_card *card) > */ > err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL, > EXT_CSD_BKOPS_START, 1, MMC_BKOPS_TIMEOUT_MS); > - if (err) > - pr_warn("%s: Error %d starting bkops\n", > + /* > + * If the BKOPS timed out, the card is probably still busy in the > + * R1_STATE_PRG. Rather than continue to wait, let's try to abort > + * it with a HPI command to get back into R1_STATE_TRAN. > + */ > + if (err == -ETIMEDOUT && !mmc_interrupt_hpi(card)) > + pr_warn("%s: BKOPS aborted\n", mmc_hostname(card->host)); > + else if (err) > + pr_warn("%s: Error %d running bkops\n", > mmc_hostname(card->host), err); > > mmc_retune_release(card->host); > -- > 2.25.1 >