Linux MultiMedia Card development
 help / color / mirror / Atom feed
From: Marek Vasut <marex@denx.de>
To: linux-mmc@vger.kernel.org
Cc: "Marek Vasut" <marex@denx.de>,
	"Christian Löhle" <CLoehle@hyperstone.com>,
	"Adrian Hunter" <adrian.hunter@intel.com>,
	"Avri Altman" <avri.altman@wdc.com>,
	"Jens Axboe" <axboe@kernel.dk>,
	"Michael Wu" <michael@allwinnertech.com>,
	"Ming Lei" <ming.lei@redhat.com>,
	"Seunghui Lee" <sh043.lee@samsung.com>,
	"Ulf Hansson" <ulf.hansson@linaro.org>
Subject: [PATCH] [RFC] Revert "mmc: core: Fixup support for writeback-cache for eMMC and SD"
Date: Wed, 31 May 2023 02:27:40 +0200	[thread overview]
Message-ID: <20230531002740.1235620-1-marex@denx.de> (raw)

This reverts commit 08ebf903af57cda6d773f3dd1671b64f73b432b8.

On STM32MP153C DHCOR DRC Compact with microSD card
Kingston Canvas Go! Plus MicroSDXC I 64 GiB U3/V30/A2 SDCG3/64GB
it is no longer possible to mount ext4 filesystem.

Git bisect points to this commit which is being reverted here. A bit of
investigation shows that for non-working microSD cards
  cache_enabled=TRUE fua_enabled=false
For working microSD card (Kingston Canvas React Plus, MicroSDXC II
64 GiB U3/V90/A1 SDCR2/64GB)
  cache_enabled=FALSE fua_enabled=false

It seems enabling the cache for SD cards causes the issue. Before the
reverted commit, the cache was not reported enabled for SD cards. I am
not sure whether such blunt revert is the correct solution however, any
ideas ?

Signed-off-by: Marek Vasut <marex@denx.de>
---
Cc: "Christian Löhle" <CLoehle@hyperstone.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Avri Altman <avri.altman@wdc.com>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Marek Vasut <marex@denx.de>
Cc: Michael Wu <michael@allwinnertech.com>
Cc: Ming Lei <ming.lei@redhat.com>
Cc: Seunghui Lee <sh043.lee@samsung.com>
Cc: Ulf Hansson <ulf.hansson@linaro.org>
Cc: linux-mmc@vger.kernel.org
---
 drivers/mmc/core/block.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c
index db6d8a0999100..72aa47af11d37 100644
--- a/drivers/mmc/core/block.c
+++ b/drivers/mmc/core/block.c
@@ -2413,8 +2413,6 @@ static struct mmc_blk_data *mmc_blk_alloc_req(struct mmc_card *card,
 	struct mmc_blk_data *md;
 	int devidx, ret;
 	char cap_str[10];
-	bool cache_enabled = false;
-	bool fua_enabled = false;
 
 	devidx = ida_simple_get(&mmc_blk_ida, 0, max_devices, GFP_KERNEL);
 	if (devidx < 0) {
@@ -2494,17 +2492,13 @@ static struct mmc_blk_data *mmc_blk_alloc_req(struct mmc_card *card,
 			md->flags |= MMC_BLK_CMD23;
 	}
 
-	if (md->flags & MMC_BLK_CMD23 &&
+	if (mmc_card_mmc(card) &&
+	    md->flags & MMC_BLK_CMD23 &&
 	    ((card->ext_csd.rel_param & EXT_CSD_WR_REL_PARAM_EN) ||
 	     card->ext_csd.rel_sectors)) {
 		md->flags |= MMC_BLK_REL_WR;
-		fua_enabled = true;
-		cache_enabled = true;
+		blk_queue_write_cache(md->queue.queue, true, true);
 	}
-	if (mmc_cache_enabled(card->host))
-		cache_enabled  = true;
-
-	blk_queue_write_cache(md->queue.queue, cache_enabled, fua_enabled);
 
 	string_get_size((u64)size, 512, STRING_UNITS_2,
 			cap_str, sizeof(cap_str));
-- 
2.39.2


             reply	other threads:[~2023-05-31  0:28 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-31  0:27 Marek Vasut [this message]
2023-05-31  5:46 ` [PATCH] [RFC] Revert "mmc: core: Fixup support for writeback-cache for eMMC and SD" Adrian Hunter
2023-05-31 11:34   ` Marek Vasut
2023-05-31 13:08     ` Christian Loehle
2023-05-31 21:33       ` Marek Vasut
2023-05-31 13:13     ` Adrian Hunter
2023-05-31 21:31       ` Marek Vasut
2023-06-01  6:20         ` Adrian Hunter
2023-06-02 21:46           ` Marek Vasut
2023-06-04 16:30             ` Adrian Hunter
2023-06-07 20:43               ` Marek Vasut
2023-06-12  4:59                 ` Adrian Hunter
2023-06-12  8:59                   ` Marek Vasut
2023-06-12  9:29                     ` Adrian Hunter
2023-06-15 15:14                     ` Ulf Hansson
2023-06-15 15:32                       ` Marek Vasut
2023-06-15 15:35                       ` Adrian Hunter
2023-06-15 15:36                         ` Marek Vasut
2023-06-16 10:02                           ` Ulf Hansson
2023-06-16 10:24                             ` Marek Vasut
2023-06-16 10:33                               ` Ulf Hansson
2023-06-20  1:44                                 ` Marek Vasut
2023-06-16 10:20                       ` Marek Vasut
2023-05-31  6:01 ` Avri Altman
2023-05-31 11:34   ` Marek Vasut

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230531002740.1235620-1-marex@denx.de \
    --to=marex@denx.de \
    --cc=CLoehle@hyperstone.com \
    --cc=adrian.hunter@intel.com \
    --cc=avri.altman@wdc.com \
    --cc=axboe@kernel.dk \
    --cc=linux-mmc@vger.kernel.org \
    --cc=michael@allwinnertech.com \
    --cc=ming.lei@redhat.com \
    --cc=sh043.lee@samsung.com \
    --cc=ulf.hansson@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox