Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp3283830ybb; Tue, 31 Mar 2020 02:04:17 -0700 (PDT) X-Google-Smtp-Source: ADFU+vsBcAu+Y+S0Am7yPIhO8+bh71Rlt0w3j3OLqpI5PtY382jerV/KY8KfDSuB0zpD6qsLEl+m X-Received: by 2002:a9d:d0f:: with SMTP id 15mr12650908oti.161.1585645456888; Tue, 31 Mar 2020 02:04:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585645456; cv=none; d=google.com; s=arc-20160816; b=0y2sf0XTs2Kzy8ANyQeZK6hA69Ddp9FO60QU6fGPBVcFLEAvi1mUxf31sK1FIJJp4y jCGMA/Gkix9spKZ7LKHixGNmoDYTqBmREaP76xirgfR/tLy7/EmWBqptwCVYcjzSRAKo r/bK5VVRUCjXrS4DQ95GEMc6h17Dgy7xCr4tMXEIMn4bk4TXxN0WiTrJBZGlrPdxi8Fo KXTCPzGByK3ApeOkcAEcOeM53W3ILSw+3+Q6SJ9Wwumi0wTK4RTz2c7mpiM2LFDRI67e yLav3accpx4FDMoMcOzYLaqsIPTBk7niSWRk2TI5JRcgn9a6AxVBvTrtDwEZh8bvLrjG hJqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=a2PyrWxLLekKyZCRQaSqnnVaqu74QdNA9b2Vis4bLyo=; b=wvTDCrZ0GtXruGnQg+ZD7avjJNZNSJoDq/wWy+L6Q+L6RKOzXSO6deAOEJ2uKf8N3l 4/bzhpLGHMfTza/LI3ygX0kIutbZHb1TmXRx44i1MLd1Ojl5MWy/4WUl6Rzsdya8/M46 9OHv9doZvnqEOxH9mfvHtcZEPlrlZkfzkk+d4Zh01Q1TyAjV1frHg46O+waKFCW8ljgy xgCybKK4Tz/Sfj8lX2jsdT2ylgms3OGmwuqham+a8eGHqnImKyB0P+iwUMoOqq238OeU 9/ADZMQZGWFo2WBkaToBACgN/tfcogQaf0NZ3/ipZiANwaMMt15w/y3ZLBPOCoDVpUWi ZG8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=R1y64ag5; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t140si7003079oif.99.2020.03.31.02.04.04; Tue, 31 Mar 2020 02:04:16 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=R1y64ag5; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730665AbgCaJCJ (ORCPT + 99 others); Tue, 31 Mar 2020 05:02:09 -0400 Received: from mail.kernel.org ([198.145.29.99]:41606 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730400AbgCaJCI (ORCPT ); Tue, 31 Mar 2020 05:02:08 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 45AA1214DB; Tue, 31 Mar 2020 09:02:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1585645327; bh=pedXLTfJpQVGrJP7cjM0hvFmyCL6sf5H6VR6PRA7Ru4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=R1y64ag5Z8R5SdgOe3Q/Sr4We1yrosBNCrw75/DwmUdT77o7gK6WRjzWQaEv8jCFY oAtdbjz19Gfjwb9S0ykwi/n5razKDUp8UckuOrW3xC2o4n9+MwgVEiaXCoUAyKQ8Mp ccGp9QLgHzqHxfdD5eqJ7o5m/9EJTr/nMyAm2M5E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sowjanya Komatineni , Anders Roxell , Faiz Abbas , Peter Geis , Ulf Hansson , Sasha Levin Subject: [PATCH 5.5 002/170] mmc: core: Respect MMC_CAP_NEED_RSP_BUSY for erase/trim/discard Date: Tue, 31 Mar 2020 10:56:56 +0200 Message-Id: <20200331085424.318600914@linuxfoundation.org> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200331085423.990189598@linuxfoundation.org> References: <20200331085423.990189598@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ulf Hansson [ Upstream commit 43cc64e5221cc6741252b64bc4531dd1eefb733d ] The busy timeout that is computed for each erase/trim/discard operation, can become quite long and may thus exceed the host->max_busy_timeout. If that becomes the case, mmc_do_erase() converts from using an R1B response to an R1 response, as to prevent the host from doing HW busy detection. However, it has turned out that some hosts requires an R1B response no matter what, so let's respect that via checking MMC_CAP_NEED_RSP_BUSY. Note that, if the R1B gets enforced, the host becomes fully responsible of managing the needed busy timeout, in one way or the other. Suggested-by: Sowjanya Komatineni Cc: Tested-by: Anders Roxell Tested-by: Sowjanya Komatineni Tested-by: Faiz Abbas Tested-By: Peter Geis Signed-off-by: Ulf Hansson Signed-off-by: Sasha Levin --- drivers/mmc/core/core.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index abf8f5eb0a1c8..26644b7ec13e3 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -1732,8 +1732,11 @@ static int mmc_do_erase(struct mmc_card *card, unsigned int from, * the erase operation does not exceed the max_busy_timeout, we should * use R1B response. Or we need to prevent the host from doing hw busy * detection, which is done by converting to a R1 response instead. + * Note, some hosts requires R1B, which also means they are on their own + * when it comes to deal with the busy timeout. */ - if (card->host->max_busy_timeout && + if (!(card->host->caps & MMC_CAP_NEED_RSP_BUSY) && + card->host->max_busy_timeout && busy_timeout > card->host->max_busy_timeout) { cmd.flags = MMC_RSP_SPI_R1 | MMC_RSP_R1 | MMC_CMD_AC; } else { -- 2.20.1