From patchwork Tue Mar 10 15:33:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 184355 Delivered-To: patches@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp848393ile; Tue, 10 Mar 2020 08:33:50 -0700 (PDT) X-Received: by 2002:ac2:5473:: with SMTP id e19mr9822220lfn.24.1583854430365; Tue, 10 Mar 2020 08:33:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1583854430; cv=none; d=google.com; s=arc-20160816; b=PNnCCmNNCFStNzgnrWCIltlDxL84OpQs8gnx8eC5UMyloEdUuB1z/E2sFZAx3VBrA5 onzGmm4GDwSzLm2CJdB7GVV8JjVbU/W9wuAc0MrytYV6p21QUUy4K5eJHXz81WhkuxwM 5VCgIf4d74MOdsu0Gw3I96X4Lss2EwDbl4sOccyfRokYum5CFIAp33hEdcNh6g6Mp1Q1 jKml4/sGdyJpOLDpbRrwUb30IJwJomD87b60HaAFh7NZ/i3AIRKujiNel7+rHQLWJXy5 LhJy1QYouEO1dFFLdyC1NJsKH4Sg7nUFnBzBT0QPFdQXcU9eEi/zRXE6LLnFM7SCeFYC iXew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=GFF5Nn+0MYGNKIt8ggfC3I2q2J2gXyLFnHV/fd1EhtU=; b=hSzMfBpHM7sohEPtDNIirgRnx/koBvvDKGUPVCjG/nYkrwsF/xAigDDXcB3ie0gkpD 78xlY19vAogtpld/SFHy3mNbrp1xDJKtjFdmQlqa+ZSRM3OrRYxOo6AU6S7/u4s5jCy1 LDSnE8iIC0wk0EeLhzjNIFjGRmvna3WRM2CLam94BnwIV5w561iRkveOZ4mIO05sAvcL 1U8Be0/iaWq+K1SJu+0R6/2/OAKksd4T0ejwJhfGBGgcDo3qXhyLmz0g3DXuXF2XVzRC quhCL1Ed8zjyNYYcLND088zy8cK2HmoEZSMI9VKbsY9AR4lXsNtyz5N5PfIVk4105BGb N60w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="j/MqCVvH"; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id q2sor4461704lfa.14.2020.03.10.08.33.50 for (Google Transport Security); Tue, 10 Mar 2020 08:33:50 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="j/MqCVvH"; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=GFF5Nn+0MYGNKIt8ggfC3I2q2J2gXyLFnHV/fd1EhtU=; b=j/MqCVvH17KM8gW1kqrm22z+IZnEON6jMprpfTXFef3hwZzBL/5WAe/3AdQmRut44P uE9EZfoKSXp6bNBoCpNmkPmzcOzDyAAMLwwXnkXYhltJXzDirX1mUsEAGe5XfUsdFPMc MEsDi86NBxIuRq5anIInjaWiBP/7hw2xNqWSBLrFlkj71pjeqd8YhbKJXNU+QEtHLEA4 eVhearQSqCxRkE92r1r5r5rtFaElLAfNHzr4mHC5dhwnzxSoxJaNfPCfq+LbVA4uyz9C UIzG7htevwJ6oZTs52ZmtrT/4c2NbklYogsaUxD987R9bYOpGG1RDGWqNcPNkcfWQxtE aFxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=GFF5Nn+0MYGNKIt8ggfC3I2q2J2gXyLFnHV/fd1EhtU=; b=MSZ/QSBmxLo0bEZ1O4gvnrUQzOYpYCrYHViJqmGxqfmvioEfPSB1ldA7zzz7JxR+Mr gFIhyqEZyhyfpLwAoYVmY/8oLadDlQEGoFf32ZNELFB1pQ9lD9dIdZipkku6ka99dIvq moiwIX25wOHxm/DOTyYzxsqZ6iRt0UhXq/R98MtNui7A44SdwFxQPhUOVWFFOsqRgTRA G+73zDBHoq6EYmWFVJTYmi3VR/lSW0xmZfkIl1OgMERgwMqBZwnIW/lU2K7kQJ7kT6xT hjIjVn4CZHoGeMYTyS4vxYvl4PEl+KMAg2rONyiM2zl9WMZk6TcBoO4GHaNKqdn2avqM GKAQ== X-Gm-Message-State: ANhLgQ3dQJYSPtUb7hZn59tMEsYgyotavAVTV09sxrfmJ8uHGNnMm2GO 65bbdWAjqvoqJ99GsizFIdzEOFJ/ X-Google-Smtp-Source: ADFU+vtmiH30+Gm0I+Xbs8uD729V2mXSp7zVFQvsuP5yXIuBa5z2yMtZD6BoHHuDJ5/la1sxw6jVOA== X-Received: by 2002:a2e:b1c2:: with SMTP id e2mr4080968lja.288.1583854429815; Tue, 10 Mar 2020 08:33:49 -0700 (PDT) Return-Path: Received: from localhost.localdomain (h-158-174-22-210.NA.cust.bahnhof.se. [158.174.22.210]) by smtp.gmail.com with ESMTPSA id c22sm17283776lfi.41.2020.03.10.08.33.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Mar 2020 08:33:49 -0700 (PDT) From: Ulf Hansson To: linux-mmc@vger.kernel.org, Ulf Hansson Cc: Adrian Hunter , Wolfram Sang , Ludovic Barre , Baolin Wang , Linus Walleij , Chaotian Jing , Shawn Lin , mirq-linux@rere.qmqm.pl, Bitan Biswas , Peter Geis , Sowjanya Komatineni , Faiz Abbas , Anders Roxell , Naresh Kamboju , Jon Hunter , stable@vger.kernel.org Subject: [PATCH 2/4] mmc: core: Respect MMC_CAP_NEED_RSP_BUSY for erase/trim/discard Date: Tue, 10 Mar 2020 16:33:38 +0100 Message-Id: <20200310153340.5593-3-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200310153340.5593-1-ulf.hansson@linaro.org> References: <20200310153340.5593-1-ulf.hansson@linaro.org> MIME-Version: 1.0 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: Signed-off-by: Ulf Hansson --- drivers/mmc/core/core.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) -- 2.20.1 diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index aa54d359dab7..a971c4bcc442 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 {