Received: by 2002:a25:d783:0:0:0:0:0 with SMTP id o125csp652173ybg; Thu, 19 Mar 2020 06:26:44 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvzFCbEZOuNr5/Io1eRycMfg0iP7dJqaaVaYCnfIUVkdYFXoBl3H+mxATC1fbHNaddhmBCT X-Received: by 2002:aca:1015:: with SMTP id 21mr2223219oiq.101.1584624404605; Thu, 19 Mar 2020 06:26:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584624404; cv=none; d=google.com; s=arc-20160816; b=WbsBqGi9kr7i3Z6JOgGmoTQqIdHbOCds9OORQ2lRG6+C7xsl3a3cRVzjpYeJMV/56n 9+mRT1rfu+OEbf6l0WBcOirOGyylcnNI2uPNirwtSDrRWxHGbHTFeI+fypHfzdBdYZlq 9PX3MrGKwDXgnQXlDZQKNUpdKcK/prqrCBvzqZ+T4VHR22tfGdi4stxS+B3FNew1U5WF ggFMqOIanXUFlxXCoEo8hRQUT0AZegKf6PVfFeY5B4/VWwi7KlJDNrc44Cb1xwd+4koW HeDfXDxBWmi1DKEOnskblSlU+u7WLUJc04QLo2LU93AeEF1Mm5eDvVV3ZseGOfvIk0PB tVDg== 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=SAh6cND3gYI0Znpdb8HHIOO8rQWx/I55rXHMuT6apuE/ONCE6OSlDbwLhpbgxRjrOh L7SC0007s1rXqpOBRfTjelOcvs0q22EmRZqLNsEY47EM2iHT4C3o6ZAwzjwkRafVHAOT ha8ZVghke8JA0idArtkAS+A43fUg/c5xwqUHNa8d8KTZJX0OZabPFTWt+zXshY8L0Uxq z8A4t8+UG2aGsacqZDvfScmI8spi41x3EyOHLCCguwS84cwKNx21ytbfFLcfqnZ87RAr 4VfSI5aXhnQe4myffAKEzj5segTFPD+OaFPi/7Gg6EnyKmcQqTjrONTWIsgeeaI8fhfw lqrA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=mFXmW0vr; 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 2si1011402ois.104.2020.03.19.06.26.32; Thu, 19 Mar 2020 06:26:44 -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=mFXmW0vr; 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 S1730576AbgCSN0J (ORCPT + 99 others); Thu, 19 Mar 2020 09:26:09 -0400 Received: from mail.kernel.org ([198.145.29.99]:53952 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730738AbgCSN0F (ORCPT ); Thu, 19 Mar 2020 09:26:05 -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 B1A4C20CC7; Thu, 19 Mar 2020 13:26:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1584624365; bh=pedXLTfJpQVGrJP7cjM0hvFmyCL6sf5H6VR6PRA7Ru4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mFXmW0vrkNQknJrum9j/+ZG88wQ8RErHW6y9V1Y8ddJzyj4eJIIr+aW53/r/xNapU lqxH7EcNvOlI8hG/LiGXZWL54xsPN423WmjZ2gPFcPq3Swoq84Vhf4J6iRM1z0eQRL 83RMssfWjosq/BormVF3LhEwJWTTvkDQZxuM3+Sc= 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 08/65] mmc: core: Respect MMC_CAP_NEED_RSP_BUSY for erase/trim/discard Date: Thu, 19 Mar 2020 14:03:50 +0100 Message-Id: <20200319123928.860588815@linuxfoundation.org> X-Mailer: git-send-email 2.25.2 In-Reply-To: <20200319123926.466988514@linuxfoundation.org> References: <20200319123926.466988514@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