Skip to contentSkip to conversation

mmc: core: Apply trim broken quirk to R1J57L

PATCH In review Xiaolei Wang 4 participants 8 messages Jan 18, 2021 – Jan 27, 2021 MMC, SD and SDIO

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mmc: core: Apply trim broken quirk to R1J57L

R1J57L mmc chip hw capibility indicates that it supports trim function, but this function does not work properly, the SDIO bus does not respond, and the IO has been waiting so set quirks to skip trim

---
 drivers/mmc/core/quirks.h | 4 ++++
 1 file changed, 4 insertions(+)
drivers/mmc/core/quirks.h +4 -0
index d68e6e513a4f..63e02391c133 100644
@@ -89,6 +89,8 @@ static const struct mmc_fixup __maybe_unused mmc_blk_fixups[] = {
 		  MMC_QUIRK_SEC_ERASE_TRIM_BROKEN),
 	MMC_FIXUP("VZL00M", CID_MANFID_SAMSUNG, CID_OEMID_ANY, add_quirk_mmc,
 		  MMC_QUIRK_SEC_ERASE_TRIM_BROKEN),
+	MMC_FIXUP("R1J57L", CID_MANFID_MICRON, CID_OEMID_ANY, add_quirk_mmc,
+		  MMC_QUIRK_SEC_ERASE_TRIM_BROKEN),
 
 	/*
 	 *  On Some Kingston eMMCs, performing trim can result in
@@ -98,6 +100,8 @@ static const struct mmc_fixup __maybe_unused mmc_blk_fixups[] = {
 		  MMC_QUIRK_TRIM_BROKEN),
 	MMC_FIXUP("V10016", CID_MANFID_KINGSTON, CID_OEMID_ANY, add_quirk_mmc,
 		  MMC_QUIRK_TRIM_BROKEN),
+	MMC_FIXUP("R1J57L", CID_MANFID_MICRON, CID_OEMID_ANY, add_quirk_mmc,
+		  MMC_QUIRK_TRIM_BROKEN),
 
 	END_FIXUP
 };
Signature · 1 line
2.25.1
#1 lore raw
Quoted 4 lines · Xiaolei Wang

R1J57L mmc chip hw capibility indicates that it supports trim function, but this function does not work properly, the SDIO bus does not respond, and the IO has been waiting so set quirks to skip trim

Are you sure this is an eMMC problem and not a mmc host driver issue?

Can you elaborate more what happens?

Kind regards
Uffe

Quoted 31 lines
---
 drivers/mmc/core/quirks.h | 4 ++++
 1 file changed, 4 insertions(+)
drivers/mmc/core/quirks.h +4 -1
index d68e6e513a4f..63e02391c133 100644
@@ -89,6 +89,8 @@ static const struct mmc_fixup __maybe_unused mmc_blk_fixups[] = {
                  MMC_QUIRK_SEC_ERASE_TRIM_BROKEN),
        MMC_FIXUP("VZL00M", CID_MANFID_SAMSUNG, CID_OEMID_ANY, add_quirk_mmc,
                  MMC_QUIRK_SEC_ERASE_TRIM_BROKEN),
+       MMC_FIXUP("R1J57L", CID_MANFID_MICRON, CID_OEMID_ANY, add_quirk_mmc,
+                 MMC_QUIRK_SEC_ERASE_TRIM_BROKEN),
 
        /*
         *  On Some Kingston eMMCs, performing trim can result in
@@ -98,6 +100,8 @@ static const struct mmc_fixup __maybe_unused mmc_blk_fixups[] = {
                  MMC_QUIRK_TRIM_BROKEN),
        MMC_FIXUP("V10016", CID_MANFID_KINGSTON, CID_OEMID_ANY, add_quirk_mmc,
                  MMC_QUIRK_TRIM_BROKEN),
+       MMC_FIXUP("R1J57L", CID_MANFID_MICRON, CID_OEMID_ANY, add_quirk_mmc,
+                 MMC_QUIRK_TRIM_BROKEN),
 
        END_FIXUP
 };
--

2.25.1

#2 lore raw

Hi

Quoted 3 lines

Are you sure this is an eMMC problem and not a mmc host driver issue?

Can you elaborate more what happens?

When I use the mkfs.f2fs tool to format the eMMC file system on the imx8qxp board, because mkfs.f2fs will use secdiscard first, when entering mmc_blk_issue_secdiscard_rq erase, once the parameters are passed into MMC_SECURE_TRIM1_ARG, this function will take a long time to return . The program has not ended, has been in TASK_UNINTERRUPTIBLE state.

I compared the mkfs.ext4 tool to format the file system. Because it directly uses mmc_blk_issue_discard_rq, this is a normal formatting phenomenon.

mmc_blk_issue_secdiscard_rq and mmc_blk_issue_discard_rq are just different commands and parameters sent by the host as a bus.
I did not see the description of trim in the data sheet. Could the host driver cause this problem?

Note:
The host driver I use is sdhci-esdhc-imx.c

Thanks
Xiaolei

-----Original Message-----
From: Ulf Hansson <[email protected]>
Sent: Wednesday, January 20, 2021 9:41 PM
To: Wang, Xiaolei <[email protected]>
Cc: Pali Rohár <[email protected]>; Lee Jones <[email protected]>; [email protected]; Linux Kernel Mailing List <[email protected]>
Subject: Re: [PATCH] mmc: core: Apply trim broken quirk to R1J57L

[Please note this e-mail is from an EXTERNAL e-mail address]

Quoted 4 lines · Xiaolei Wang

R1J57L mmc chip hw capibility indicates that it supports trim function, but this function does not work properly, the SDIO bus does not respond, and the IO has been waiting so set quirks to skip trim

Are you sure this is an eMMC problem and not a mmc host driver issue?

Can you elaborate more what happens?

Kind regards
Uffe

Quoted 31 lines
---
 drivers/mmc/core/quirks.h | 4 ++++
 1 file changed, 4 insertions(+)
drivers/mmc/core/quirks.h +4 -2
index d68e6e513a4f..63e02391c133 100644
@@ -89,6 +89,8 @@ static const struct mmc_fixup __maybe_unused mmc_blk_fixups[] = {
                  MMC_QUIRK_SEC_ERASE_TRIM_BROKEN),
        MMC_FIXUP("VZL00M", CID_MANFID_SAMSUNG, CID_OEMID_ANY, add_quirk_mmc,
                  MMC_QUIRK_SEC_ERASE_TRIM_BROKEN),
+       MMC_FIXUP("R1J57L", CID_MANFID_MICRON, CID_OEMID_ANY, add_quirk_mmc,
+                 MMC_QUIRK_SEC_ERASE_TRIM_BROKEN),
 
        /*
         *  On Some Kingston eMMCs, performing trim can result in @@ 
-98,6 +100,8 @@ static const struct mmc_fixup __maybe_unused mmc_blk_fixups[] = {
                  MMC_QUIRK_TRIM_BROKEN),
        MMC_FIXUP("V10016", CID_MANFID_KINGSTON, CID_OEMID_ANY, add_quirk_mmc,
                  MMC_QUIRK_TRIM_BROKEN),
+       MMC_FIXUP("R1J57L", CID_MANFID_MICRON, CID_OEMID_ANY, add_quirk_mmc,
+                 MMC_QUIRK_TRIM_BROKEN),
 
        END_FIXUP
 };
--

2.25.1

#3 lore raw

+ Fabio, Haibo

Quoted 12 lines · Xiaolei

Hi

Quoted 3 lines

Are you sure this is an eMMC problem and not a mmc host driver issue?

Can you elaborate more what happens?

When I use the mkfs.f2fs tool to format the eMMC file system on the imx8qxp board, because mkfs.f2fs will use secdiscard first, when entering mmc_blk_issue_secdiscard_rq erase, once the parameters are passed into MMC_SECURE_TRIM1_ARG, this function will take a long time to return . The program has not ended, has been in TASK_UNINTERRUPTIBLE state.

Quoted 5 lines

I compared the mkfs.ext4 tool to format the file system. Because it directly uses mmc_blk_issue_discard_rq, this is a normal formatting phenomenon.

mmc_blk_issue_secdiscard_rq and mmc_blk_issue_discard_rq are just different commands and parameters sent by the host as a bus.
I did not see the description of trim in the data sheet. Could the host driver cause this problem?

Yes, it can - and we have had issues like these before. So before adding a card quirk, I think we need to make sure this isn't the case.

When using MMC_SECURE_TRIM1_ARG, it's very likely that the request takes longer to complete.

The mmc host is responsible for either dealing with busy detection with the help of its HW/controller - or if that can't be supported, the mmc core falls back to polling the card for busy with a CMD13.

See mmc_do_erase() in /drivers/mmc/core/core.c

Quoted 3 lines

Note:
The host driver I use is sdhci-esdhc-imx.c

Alright, I have looped in Fabio and Haibo that knows this driver, let's see if they can help.

Quoted 3 lines

Thanks
Xiaolei

Kind regards
Uffe

Quoted 54 lines

-----Original Message-----
From: Ulf Hansson <[email protected]>
Sent: Wednesday, January 20, 2021 9:41 PM
To: Wang, Xiaolei <[email protected]>
Cc: Pali Rohár <[email protected]>; Lee Jones <[email protected]>; [email protected]; Linux Kernel Mailing List <[email protected]>
Subject: Re: [PATCH] mmc: core: Apply trim broken quirk to R1J57L

[Please note this e-mail is from an EXTERNAL e-mail address]

Quoted 4 lines · Xiaolei Wang

R1J57L mmc chip hw capibility indicates that it supports trim function, but this function does not work properly, the SDIO bus does not respond, and the IO has been waiting so set quirks to skip trim

Are you sure this is an eMMC problem and not a mmc host driver issue?

Can you elaborate more what happens?

Kind regards
Uffe

Quoted 31 lines
---
 drivers/mmc/core/quirks.h | 4 ++++
 1 file changed, 4 insertions(+)
drivers/mmc/core/quirks.h +4 -2
index d68e6e513a4f..63e02391c133 100644
@@ -89,6 +89,8 @@ static const struct mmc_fixup __maybe_unused mmc_blk_fixups[] = {
                  MMC_QUIRK_SEC_ERASE_TRIM_BROKEN),
        MMC_FIXUP("VZL00M", CID_MANFID_SAMSUNG, CID_OEMID_ANY, add_quirk_mmc,
                  MMC_QUIRK_SEC_ERASE_TRIM_BROKEN),
+       MMC_FIXUP("R1J57L", CID_MANFID_MICRON, CID_OEMID_ANY, add_quirk_mmc,
+                 MMC_QUIRK_SEC_ERASE_TRIM_BROKEN),
 
        /*
         *  On Some Kingston eMMCs, performing trim can result in @@
-98,6 +100,8 @@ static const struct mmc_fixup __maybe_unused mmc_blk_fixups[] = {
                  MMC_QUIRK_TRIM_BROKEN),
        MMC_FIXUP("V10016", CID_MANFID_KINGSTON, CID_OEMID_ANY, add_quirk_mmc,
                  MMC_QUIRK_TRIM_BROKEN),
+       MMC_FIXUP("R1J57L", CID_MANFID_MICRON, CID_OEMID_ANY, add_quirk_mmc,
+                 MMC_QUIRK_TRIM_BROKEN),
 
        END_FIXUP
 };
--

2.25.1

#4 lore raw

Hi Haibo,

Could you please take a look?

Thanks

Quoted 102 lines · Ulf Hansson

+ Fabio, Haibo

Quoted 12 lines · Xiaolei

Hi

Quoted 3 lines

Are you sure this is an eMMC problem and not a mmc host driver issue?

Can you elaborate more what happens?

When I use the mkfs.f2fs tool to format the eMMC file system on the imx8qxp board, because mkfs.f2fs will use secdiscard first, when entering mmc_blk_issue_secdiscard_rq erase, once the parameters are passed into MMC_SECURE_TRIM1_ARG, this function will take a long time to return . The program has not ended, has been in TASK_UNINTERRUPTIBLE state.

Quoted 5 lines

I compared the mkfs.ext4 tool to format the file system. Because it directly uses mmc_blk_issue_discard_rq, this is a normal formatting phenomenon.

mmc_blk_issue_secdiscard_rq and mmc_blk_issue_discard_rq are just different commands and parameters sent by the host as a bus.
I did not see the description of trim in the data sheet. Could the host driver cause this problem?

Yes, it can - and we have had issues like these before. So before adding a card quirk, I think we need to make sure this isn't the case.

When using MMC_SECURE_TRIM1_ARG, it's very likely that the request takes longer to complete.

The mmc host is responsible for either dealing with busy detection with the help of its HW/controller - or if that can't be supported, the mmc core falls back to polling the card for busy with a CMD13.

See mmc_do_erase() in /drivers/mmc/core/core.c

Quoted 3 lines

Note:
The host driver I use is sdhci-esdhc-imx.c

Alright, I have looped in Fabio and Haibo that knows this driver, let's see if they can help.

Quoted 3 lines

Thanks
Xiaolei

Kind regards
Uffe

Quoted 54 lines

-----Original Message-----
From: Ulf Hansson <[email protected]>
Sent: Wednesday, January 20, 2021 9:41 PM
To: Wang, Xiaolei <[email protected]>
Cc: Pali Rohár <[email protected]>; Lee Jones <[email protected]>; [email protected]; Linux Kernel Mailing List <[email protected]>
Subject: Re: [PATCH] mmc: core: Apply trim broken quirk to R1J57L

[Please note this e-mail is from an EXTERNAL e-mail address]

Quoted 4 lines · Xiaolei Wang

R1J57L mmc chip hw capibility indicates that it supports trim function, but this function does not work properly, the SDIO bus does not respond, and the IO has been waiting so set quirks to skip trim

Are you sure this is an eMMC problem and not a mmc host driver issue?

Can you elaborate more what happens?

Kind regards
Uffe

Quoted 31 lines
---
 drivers/mmc/core/quirks.h | 4 ++++
 1 file changed, 4 insertions(+)
drivers/mmc/core/quirks.h +4 -2
index d68e6e513a4f..63e02391c133 100644
@@ -89,6 +89,8 @@ static const struct mmc_fixup __maybe_unused mmc_blk_fixups[] = {
                  MMC_QUIRK_SEC_ERASE_TRIM_BROKEN),
        MMC_FIXUP("VZL00M", CID_MANFID_SAMSUNG, CID_OEMID_ANY, add_quirk_mmc,
                  MMC_QUIRK_SEC_ERASE_TRIM_BROKEN),
+       MMC_FIXUP("R1J57L", CID_MANFID_MICRON, CID_OEMID_ANY, add_quirk_mmc,
+                 MMC_QUIRK_SEC_ERASE_TRIM_BROKEN),
 
        /*
         *  On Some Kingston eMMCs, performing trim can result in @@
-98,6 +100,8 @@ static const struct mmc_fixup __maybe_unused mmc_blk_fixups[] = {
                  MMC_QUIRK_TRIM_BROKEN),
        MMC_FIXUP("V10016", CID_MANFID_KINGSTON, CID_OEMID_ANY, add_quirk_mmc,
                  MMC_QUIRK_TRIM_BROKEN),
+       MMC_FIXUP("R1J57L", CID_MANFID_MICRON, CID_OEMID_ANY, add_quirk_mmc,
+                 MMC_QUIRK_TRIM_BROKEN),
 
        END_FIXUP
 };
--

2.25.1

#5 lore raw
Quoted 10 lines

-----Original Message-----
From: Fabio Estevam [mailto:[email protected]]
Sent: 2021年1月25日 18:47
To: Ulf Hansson <[email protected]>
Cc: Wang, Xiaolei <[email protected]>; Bough Chen <[email protected]>; Pali Rohár <[email protected]>; Lee Jones <[email protected]>; [email protected]; Linux Kernel Mailing List <[email protected]>
Subject: Re: [PATCH] mmc: core: Apply trim broken quirk to R1J57L

Quoted 3 lines

Hi Haibo,

Could you please take a look?

I will look into this issue this week.

Haibo Chen

Quoted 124 lines

Thanks

Quoted 4 lines · Ulf Hansson

+ Fabio, Haibo

On Thu, 21 Jan 2021 at 10:54, Wang, Xiaolei <[email protected]>

Quoted 10 lines · wrote:
Quoted 10 lines

Hi

Quoted 3 lines

Are you sure this is an eMMC problem and not a mmc host driver issue?

Can you elaborate more what happens?

When I use the mkfs.f2fs tool to format the eMMC file system on the imx8qxp board, because mkfs.f2fs will use secdiscard first, when entering mmc_blk_issue_secdiscard_rq erase, once the parameters are

passed into MMC_SECURE_TRIM1_ARG, this function will take a long time to return .

Quoted 4 lines
Quoted 4 lines

The program has not ended, has been in TASK_UNINTERRUPTIBLE state.

I compared the mkfs.ext4 tool to format the file system. Because it directly uses mmc_blk_issue_discard_rq, this is a normal formatting

phenomenon.

Quoted 2 lines
Quoted 2 lines

mmc_blk_issue_secdiscard_rq and mmc_blk_issue_discard_rq are just

different commands and parameters sent by the host as a bus.

Quoted 1 line
Quoted 1 line

I did not see the description of trim in the data sheet. Could the host

driver cause this problem?

Quoted 40 lines

Yes, it can - and we have had issues like these before. So before adding a card quirk, I think we need to make sure this isn't the case.

When using MMC_SECURE_TRIM1_ARG, it's very likely that the request takes longer to complete.

The mmc host is responsible for either dealing with busy detection with the help of its HW/controller - or if that can't be supported, the mmc core falls back to polling the card for busy with a CMD13.

See mmc_do_erase() in /drivers/mmc/core/core.c

Quoted 3 lines

Note:
The host driver I use is sdhci-esdhc-imx.c

Alright, I have looped in Fabio and Haibo that knows this driver, let's see if they can help.

Quoted 3 lines

Thanks
Xiaolei

Kind regards
Uffe

Quoted 13 lines

-----Original Message-----
From: Ulf Hansson <[email protected]>
Sent: Wednesday, January 20, 2021 9:41 PM
To: Wang, Xiaolei <[email protected]>
Cc: Pali Rohár <[email protected]>; Lee Jones <[email protected]>; [email protected]; Linux Kernel Mailing List <[email protected]>
Subject: Re: [PATCH] mmc: core: Apply trim broken quirk to R1J57L

[Please note this e-mail is from an EXTERNAL e-mail address]

On Mon, 18 Jan 2021 at 05:27, Xiaolei Wang <[email protected]>

Quoted 19 lines · wrote:
Quoted 19 lines
Quoted 5 lines

R1J57L mmc chip hw capibility indicates that it supports trim function, but this function does not work properly, the SDIO bus does not respond, and the IO has been waiting so set quirks to skip trim

Are you sure this is an eMMC problem and not a mmc host driver issue?

Can you elaborate more what happens?

Kind regards
Uffe

Quoted 6 lines
---
 drivers/mmc/core/quirks.h | 4 ++++
 1 file changed, 4 insertions(+)
Quoted 5 lines
Quoted 5 lines

drivers/mmc/core/quirks.h static const struct mmc_fixup __maybe_unused

Quoted 5 lines
drivers/mmc/core/quirks.h +0 -0
index d68e6e513a4f..63e02391c133 100644
@@ -89,6 +89,8 @@ static const struct mmc_fixup __maybe_unused

mmc_blk_fixups[] = {

Quoted 2 lines
Quoted 2 lines

drivers/mmc/core/quirks.h static const struct mmc_fixup __maybe_unused · line 90

Quoted 2 lines
drivers/mmc/core/quirks.h +0 -0
                  MMC_QUIRK_SEC_ERASE_TRIM_BROKEN),
        MMC_FIXUP("VZL00M", CID_MANFID_SAMSUNG,

CID_OEMID_ANY, add_quirk_mmc,

Quoted 2 lines
Quoted 2 lines

drivers/mmc/core/quirks.h static const struct mmc_fixup __maybe_unused · line 92

Quoted 2 lines
drivers/mmc/core/quirks.h +1 -0
                  MMC_QUIRK_SEC_ERASE_TRIM_BROKEN),
+       MMC_FIXUP("R1J57L", CID_MANFID_MICRON,

CID_OEMID_ANY, add_quirk_mmc,

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
drivers/mmc/core/quirks.h +1 -0
+                 MMC_QUIRK_SEC_ERASE_TRIM_BROKEN),
 
        /*
         *  On Some Kingston eMMCs, performing trim can result in

@@
-98,6 +100,8 @@ static const struct mmc_fixup __maybe_unused

mmc_blk_fixups[] = {

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
                  MMC_QUIRK_TRIM_BROKEN),
        MMC_FIXUP("V10016", CID_MANFID_KINGSTON,

CID_OEMID_ANY, add_quirk_mmc,

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

MMC_QUIRK_TRIM_BROKEN),
+ MMC_FIXUP("R1J57L", CID_MANFID_MICRON,

CID_OEMID_ANY, add_quirk_mmc,

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

+ MMC_QUIRK_TRIM_BROKEN),

END_FIXUP
};
--
2.25.1

#6 lore raw
In reply to Ulf Hansson
Quoted 47 lines

-----Original Message-----
From: Ulf Hansson [mailto:[email protected]]
Sent: 2021年1月21日 21:26
To: Wang, Xiaolei <[email protected]>; Fabio Estevam <[email protected]>; Bough Chen <[email protected]>
Cc: Pali Rohár <[email protected]>; Lee Jones <[email protected]>; [email protected]; Linux Kernel Mailing List <[email protected]>
Subject: Re: [PATCH] mmc: core: Apply trim broken quirk to R1J57L

+ Fabio, Haibo

Quoted 10 lines · Xiaolei

Hi

Quoted 3 lines

Are you sure this is an eMMC problem and not a mmc host driver issue?

Can you elaborate more what happens?

When I use the mkfs.f2fs tool to format the eMMC file system on the imx8qxp board, because mkfs.f2fs will use secdiscard first, when entering mmc_blk_issue_secdiscard_rq erase, once the parameters are

passed into MMC_SECURE_TRIM1_ARG, this function will take a long time to return .

Quoted 4 lines

The program has not ended, has been in TASK_UNINTERRUPTIBLE state.

I compared the mkfs.ext4 tool to format the file system. Because it directly uses mmc_blk_issue_discard_rq, this is a normal formatting

phenomenon.

Quoted 2 lines

mmc_blk_issue_secdiscard_rq and mmc_blk_issue_discard_rq are just

different commands and parameters sent by the host as a bus.

Quoted 1 line

I did not see the description of trim in the data sheet. Could the host driver

cause this problem?

Yes, it can - and we have had issues like these before. So before adding a card quirk, I think we need to make sure this isn't the case.

When using MMC_SECURE_TRIM1_ARG, it's very likely that the request takes longer to complete.

The mmc host is responsible for either dealing with busy detection with the help of its HW/controller - or if that can't be supported, the mmc core falls back to polling the card for busy with a CMD13.

Quoted 9 lines

See mmc_do_erase() in /drivers/mmc/core/core.c

Quoted 3 lines

Note:
The host driver I use is sdhci-esdhc-imx.c

Alright, I have looped in Fabio and Haibo that knows this driver, let's see if they can help.

Hi Ulf and Xiaolei,

I use the mkfs.f2fs tool format a partition on one Sandisk eMMC chip on imx8 platform, do not meet issue.
I add some log, confirm mkfs.f2fs call the mmc_blk_issue_secdiscard_rq(), and the arg is MMC_SECURE_TRIM1_ARG.
For the busy detection, imx usdhc has one register bit represent the dat0 signal level. So for your mmc device, it should be the mmc device trim feature problem.

Best Regards
Haibo

Quoted 72 lines
Quoted 3 lines

Thanks
Xiaolei

Kind regards
Uffe

Quoted 13 lines

-----Original Message-----
From: Ulf Hansson <[email protected]>
Sent: Wednesday, January 20, 2021 9:41 PM
To: Wang, Xiaolei <[email protected]>
Cc: Pali Rohár <[email protected]>; Lee Jones <[email protected]>; [email protected]; Linux Kernel Mailing List <[email protected]>
Subject: Re: [PATCH] mmc: core: Apply trim broken quirk to R1J57L

[Please note this e-mail is from an EXTERNAL e-mail address]

On Mon, 18 Jan 2021 at 05:27, Xiaolei Wang <[email protected]>

Quoted 19 lines · wrote:
Quoted 5 lines

R1J57L mmc chip hw capibility indicates that it supports trim function, but this function does not work properly, the SDIO bus does not respond, and the IO has been waiting so set quirks to skip trim

Are you sure this is an eMMC problem and not a mmc host driver issue?

Can you elaborate more what happens?

Kind regards
Uffe

Quoted 6 lines
---
 drivers/mmc/core/quirks.h | 4 ++++
 1 file changed, 4 insertions(+)
Quoted 5 lines

drivers/mmc/core/quirks.h static const struct mmc_fixup __maybe_unused

Quoted 5 lines
drivers/mmc/core/quirks.h +0 -0
index d68e6e513a4f..63e02391c133 100644
@@ -89,6 +89,8 @@ static const struct mmc_fixup __maybe_unused

mmc_blk_fixups[] = {

Quoted 2 lines

drivers/mmc/core/quirks.h static const struct mmc_fixup __maybe_unused · line 90

Quoted 2 lines
drivers/mmc/core/quirks.h +0 -0
                  MMC_QUIRK_SEC_ERASE_TRIM_BROKEN),
        MMC_FIXUP("VZL00M", CID_MANFID_SAMSUNG,

CID_OEMID_ANY, add_quirk_mmc,

Quoted 2 lines

drivers/mmc/core/quirks.h static const struct mmc_fixup __maybe_unused · line 92

Quoted 2 lines
drivers/mmc/core/quirks.h +1 -0
                  MMC_QUIRK_SEC_ERASE_TRIM_BROKEN),
+       MMC_FIXUP("R1J57L", CID_MANFID_MICRON,

CID_OEMID_ANY, add_quirk_mmc,

Quoted 4 lines

drivers/mmc/core/quirks.h static const struct mmc_fixup __maybe_unused mmc_blk_fixups[] = { · line 96

Quoted 4 lines
drivers/mmc/core/quirks.h +1 -0
+                 MMC_QUIRK_SEC_ERASE_TRIM_BROKEN),
 
        /*
         *  On Some Kingston eMMCs, performing trim can result in

@@

Quoted 1 line
Quoted 1 line

-98,6 +100,8 @@ static const struct mmc_fixup __maybe_unused

mmc_blk_fixups[] = {

Quoted 2 lines
Quoted 2 lines
                  MMC_QUIRK_TRIM_BROKEN),
        MMC_FIXUP("V10016", CID_MANFID_KINGSTON,

CID_OEMID_ANY, add_quirk_mmc,

Quoted 2 lines
Quoted 2 lines

MMC_QUIRK_TRIM_BROKEN),
+ MMC_FIXUP("R1J57L", CID_MANFID_MICRON,

CID_OEMID_ANY, add_quirk_mmc,

Quoted 7 lines
Quoted 7 lines

+ MMC_QUIRK_TRIM_BROKEN),

END_FIXUP
};
--
2.25.1

#7 lore raw

-----Original Message-----
From: Bough Chen <[email protected]>
Sent: Wednesday, January 27, 2021 3:36 PM
To: Ulf Hansson <[email protected]>; Wang, Xiaolei <[email protected]>; Fabio Estevam <[email protected]>
Cc: Pali Rohár <[email protected]>; Lee Jones <[email protected]>; [email protected]; Linux Kernel Mailing List <[email protected]>
Subject: RE: [PATCH] mmc: core: Apply trim broken quirk to R1J57L

[Please note this e-mail is from an EXTERNAL e-mail address]

Quoted 59 lines

-----Original Message-----
From: Ulf Hansson [mailto:[email protected]]
Sent: 2021年1月21日 21:26
To: Wang, Xiaolei <[email protected]>; Fabio Estevam <[email protected]>; Bough Chen <[email protected]>
Cc: Pali Rohár <[email protected]>; Lee Jones <[email protected]>; [email protected]; Linux Kernel Mailing List <[email protected]>
Subject: Re: [PATCH] mmc: core: Apply trim broken quirk to R1J57L

+ Fabio, Haibo

Quoted 10 lines · Xiaolei

Hi

Quoted 3 lines

Are you sure this is an eMMC problem and not a mmc host driver issue?

Can you elaborate more what happens?

When I use the mkfs.f2fs tool to format the eMMC file system on the imx8qxp board, because mkfs.f2fs will use secdiscard first, when entering mmc_blk_issue_secdiscard_rq erase, once the parameters are

passed into MMC_SECURE_TRIM1_ARG, this function will take a long time to return .

Quoted 4 lines

The program has not ended, has been in TASK_UNINTERRUPTIBLE state.

I compared the mkfs.ext4 tool to format the file system. Because it directly uses mmc_blk_issue_discard_rq, this is a normal formatting

phenomenon.

Quoted 2 lines

mmc_blk_issue_secdiscard_rq and mmc_blk_issue_discard_rq are just

different commands and parameters sent by the host as a bus.

Quoted 2 lines

I did not see the description of trim in the data sheet. Could the
host driver

cause this problem?

Yes, it can - and we have had issues like these before. So before adding a card quirk, I think we need to make sure this isn't the case.

When using MMC_SECURE_TRIM1_ARG, it's very likely that the request takes longer to complete.

The mmc host is responsible for either dealing with busy detection with the help of its HW/controller - or if that can't be supported, the mmc core falls back to polling the card for busy with a CMD13.

See mmc_do_erase() in /drivers/mmc/core/core.c

Quoted 3 lines

Note:
The host driver I use is sdhci-esdhc-imx.c

Alright, I have looped in Fabio and Haibo that knows this driver, let's see if they can help.

Quoted 5 lines

Hi Ulf and Xiaolei,

I use the mkfs.f2fs tool format a partition on one Sandisk eMMC chip on imx8 platform, do not meet issue.
I add some log, confirm mkfs.f2fs call the mmc_blk_issue_secdiscard_rq(), and the arg is MMC_SECURE_TRIM1_ARG.
For the busy detection, imx usdhc has one register bit represent the dat0 signal level. So for your mmc device, it should be the mmc device trim feature problem.

Hi UIf and haibo

I did the verification again and found that the kernel version I used before was v5.4. The latest kernel does not have this problem.
This patch is not accurate. I will confirm later whether it is caused by the missing patch of v5.4.

Thanks
Xiaolei

Quoted 75 lines

Best Regards
Haibo

Quoted 3 lines

Thanks
Xiaolei

Kind regards
Uffe

Quoted 14 lines

-----Original Message-----
From: Ulf Hansson <[email protected]>
Sent: Wednesday, January 20, 2021 9:41 PM
To: Wang, Xiaolei <[email protected]>
Cc: Pali Rohár <[email protected]>; Lee Jones <[email protected]>; [email protected]; Linux Kernel Mailing List <[email protected]>
Subject: Re: [PATCH] mmc: core: Apply trim broken quirk to R1J57L

[Please note this e-mail is from an EXTERNAL e-mail address]

On Mon, 18 Jan 2021 at 05:27, Xiaolei Wang
<[email protected]>

Quoted 19 lines · wrote:
Quoted 5 lines

R1J57L mmc chip hw capibility indicates that it supports trim function, but this function does not work properly, the SDIO bus does not respond, and the IO has been waiting so set quirks to skip trim

Are you sure this is an eMMC problem and not a mmc host driver issue?

Can you elaborate more what happens?

Kind regards
Uffe

Quoted 6 lines
---
 drivers/mmc/core/quirks.h | 4 ++++
 1 file changed, 4 insertions(+)
Quoted 5 lines

drivers/mmc/core/quirks.h static const struct mmc_fixup __maybe_unused

Quoted 5 lines
drivers/mmc/core/quirks.h +0 -0
index d68e6e513a4f..63e02391c133 100644
@@ -89,6 +89,8 @@ static const struct mmc_fixup __maybe_unused

mmc_blk_fixups[] = {

Quoted 2 lines

drivers/mmc/core/quirks.h static const struct mmc_fixup __maybe_unused · line 90

Quoted 2 lines
drivers/mmc/core/quirks.h +0 -0
                  MMC_QUIRK_SEC_ERASE_TRIM_BROKEN),
        MMC_FIXUP("VZL00M", CID_MANFID_SAMSUNG,

CID_OEMID_ANY, add_quirk_mmc,

Quoted 2 lines

drivers/mmc/core/quirks.h static const struct mmc_fixup __maybe_unused · line 92

Quoted 2 lines
drivers/mmc/core/quirks.h +1 -0
                  MMC_QUIRK_SEC_ERASE_TRIM_BROKEN),
+       MMC_FIXUP("R1J57L", CID_MANFID_MICRON,

CID_OEMID_ANY, add_quirk_mmc,

Quoted 4 lines

drivers/mmc/core/quirks.h static const struct mmc_fixup __maybe_unused mmc_blk_fixups[] = { · line 96

Quoted 4 lines
drivers/mmc/core/quirks.h +1 -0
+                 MMC_QUIRK_SEC_ERASE_TRIM_BROKEN),
 
        /*
         *  On Some Kingston eMMCs, performing trim can result in

@@

Quoted 1 line
Quoted 1 line

-98,6 +100,8 @@ static const struct mmc_fixup __maybe_unused

mmc_blk_fixups[] = {

Quoted 2 lines
Quoted 2 lines
                  MMC_QUIRK_TRIM_BROKEN),
        MMC_FIXUP("V10016", CID_MANFID_KINGSTON,

CID_OEMID_ANY, add_quirk_mmc,

Quoted 2 lines
Quoted 2 lines

MMC_QUIRK_TRIM_BROKEN),
+ MMC_FIXUP("R1J57L", CID_MANFID_MICRON,

CID_OEMID_ANY, add_quirk_mmc,

Quoted 7 lines
Quoted 7 lines

+ MMC_QUIRK_TRIM_BROKEN),

END_FIXUP
};
--
2.25.1