linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mmc: add quirk to disable eMMC cache for Micron eMMC v5.0 cards
@ 2021-04-08 17:59 Scott Branden
  2021-04-12  7:44 ` Ulf Hansson
  2021-04-14  9:05 ` Bean Huo
  0 siblings, 2 replies; 6+ messages in thread
From: Scott Branden @ 2021-04-08 17:59 UTC (permalink / raw)
  To: BCM Kernel Feedback, Ulf Hansson, linux-mmc
  Cc: linux-kernel, Vladimir Olovyannikov, Scott Branden

From: Vladimir Olovyannikov <vladimir.olovyannikov@broadcom.com>

In certain rare combination of operations, Micron eMMC v5.0 cards
may experience data errors if internal cache is enabled.
This may lead to eMMC related data errors.
Introduce a quirk to disable cache on these eMMC cards.

Signed-off-by: Vladimir Olovyannikov <vladimir.olovyannikov@broadcom.com>
Signed-off-by: Scott Branden <scott.branden@broadcom.com>
---
 drivers/mmc/core/card.h   | 5 +++++
 drivers/mmc/core/mmc.c    | 4 ++--
 drivers/mmc/core/quirks.h | 8 ++++++++
 include/linux/mmc/card.h  | 1 +
 4 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/core/card.h b/drivers/mmc/core/card.h
index 7bd392d55cfa..22cea63ac359 100644
--- a/drivers/mmc/core/card.h
+++ b/drivers/mmc/core/card.h
@@ -222,4 +222,9 @@ static inline int mmc_card_broken_hpi(const struct mmc_card *c)
 	return c->quirks & MMC_QUIRK_BROKEN_HPI;
 }
 
+static inline int mmc_card_broken_cache(const struct mmc_card *c)
+{
+	return c->quirks & MMC_QUIRK_BROKEN_CACHE;
+}
+
 #endif
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index 8741271d3971..cd83b7f0e59c 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -1820,12 +1820,12 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,
 	 * sudden power failure tests. Let's extend the timeout to a minimum of
 	 * DEFAULT_CACHE_EN_TIMEOUT_MS and do it for all cards.
 	 */
-	if (card->ext_csd.cache_size > 0) {
+	if (!mmc_card_broken_cache(card) && card->ext_csd.cache_size > 0) {
 		unsigned int timeout_ms = MIN_CACHE_EN_TIMEOUT_MS;
 
 		timeout_ms = max(card->ext_csd.generic_cmd6_time, timeout_ms);
 		err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
-				EXT_CSD_CACHE_CTRL, 1, timeout_ms);
+				 EXT_CSD_CACHE_CTRL, 1, timeout_ms);
 		if (err && err != -EBADMSG)
 			goto free_card;
 
diff --git a/drivers/mmc/core/quirks.h b/drivers/mmc/core/quirks.h
index d68e6e513a4f..23972d87c82a 100644
--- a/drivers/mmc/core/quirks.h
+++ b/drivers/mmc/core/quirks.h
@@ -116,6 +116,14 @@ static const struct mmc_fixup __maybe_unused mmc_ext_csd_fixups[] = {
 	MMC_FIXUP_EXT_CSD_REV(CID_NAME_ANY, CID_MANFID_NUMONYX,
 			      0x014e, add_quirk, MMC_QUIRK_BROKEN_HPI, 6),
 
+	/*
+	 * In certain rare combination of operations, Micron eMMC v5.0 cards
+	 * may experience data errors if internal cache is enabled.
+	 * Disabling cache for these cards eliminates the issue.
+	 */
+	MMC_FIXUP_EXT_CSD_REV(CID_NAME_ANY, CID_MANFID_MICRON,
+			      0x014e, add_quirk, MMC_QUIRK_BROKEN_CACHE, 7),
+
 	END_FIXUP
 };
 
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h
index f9ad35dd6012..22f256a4e54e 100644
--- a/include/linux/mmc/card.h
+++ b/include/linux/mmc/card.h
@@ -270,6 +270,7 @@ struct mmc_card {
 #define MMC_QUIRK_BROKEN_IRQ_POLLING	(1<<11)	/* Polling SDIO_CCCR_INTx could create a fake interrupt */
 #define MMC_QUIRK_TRIM_BROKEN	(1<<12)		/* Skip trim */
 #define MMC_QUIRK_BROKEN_HPI	(1<<13)		/* Disable broken HPI support */
+#define MMC_QUIRK_BROKEN_CACHE	(1<<14)		/* Disable broken cache */
 
 	bool			reenable_cmdq;	/* Re-enable Command Queue */
 
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] mmc: add quirk to disable eMMC cache for Micron eMMC v5.0 cards
  2021-04-08 17:59 [PATCH] mmc: add quirk to disable eMMC cache for Micron eMMC v5.0 cards Scott Branden
@ 2021-04-12  7:44 ` Ulf Hansson
  2021-04-13 15:44   ` Scott Branden
  2021-04-14  9:05 ` Bean Huo
  1 sibling, 1 reply; 6+ messages in thread
From: Ulf Hansson @ 2021-04-12  7:44 UTC (permalink / raw)
  To: Scott Branden, Bean Huo (beanhuo), Luca Porzio (lporzio)
  Cc: BCM Kernel Feedback, linux-mmc, Linux Kernel Mailing List,
	Vladimir Olovyannikov

+ Bean Huo, Luca Porzio

On Thu, 8 Apr 2021 at 19:59, Scott Branden <scott.branden@broadcom.com> wrote:
>
> From: Vladimir Olovyannikov <vladimir.olovyannikov@broadcom.com>
>
> In certain rare combination of operations, Micron eMMC v5.0 cards
> may experience data errors if internal cache is enabled.
> This may lead to eMMC related data errors.
> Introduce a quirk to disable cache on these eMMC cards.

Can you please elaborate on this, what combinations of operations are
you referring to - and what kind of data errors?

I have also looped in some of the Micron guys, to let them chim in.

>
> Signed-off-by: Vladimir Olovyannikov <vladimir.olovyannikov@broadcom.com>
> Signed-off-by: Scott Branden <scott.branden@broadcom.com>

Kind regards
Uffe

> ---
>  drivers/mmc/core/card.h   | 5 +++++
>  drivers/mmc/core/mmc.c    | 4 ++--
>  drivers/mmc/core/quirks.h | 8 ++++++++
>  include/linux/mmc/card.h  | 1 +
>  4 files changed, 16 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mmc/core/card.h b/drivers/mmc/core/card.h
> index 7bd392d55cfa..22cea63ac359 100644
> --- a/drivers/mmc/core/card.h
> +++ b/drivers/mmc/core/card.h
> @@ -222,4 +222,9 @@ static inline int mmc_card_broken_hpi(const struct mmc_card *c)
>         return c->quirks & MMC_QUIRK_BROKEN_HPI;
>  }
>
> +static inline int mmc_card_broken_cache(const struct mmc_card *c)
> +{
> +       return c->quirks & MMC_QUIRK_BROKEN_CACHE;
> +}
> +
>  #endif
> diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
> index 8741271d3971..cd83b7f0e59c 100644
> --- a/drivers/mmc/core/mmc.c
> +++ b/drivers/mmc/core/mmc.c
> @@ -1820,12 +1820,12 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,
>          * sudden power failure tests. Let's extend the timeout to a minimum of
>          * DEFAULT_CACHE_EN_TIMEOUT_MS and do it for all cards.
>          */
> -       if (card->ext_csd.cache_size > 0) {
> +       if (!mmc_card_broken_cache(card) && card->ext_csd.cache_size > 0) {
>                 unsigned int timeout_ms = MIN_CACHE_EN_TIMEOUT_MS;
>
>                 timeout_ms = max(card->ext_csd.generic_cmd6_time, timeout_ms);
>                 err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
> -                               EXT_CSD_CACHE_CTRL, 1, timeout_ms);
> +                                EXT_CSD_CACHE_CTRL, 1, timeout_ms);
>                 if (err && err != -EBADMSG)
>                         goto free_card;
>
> diff --git a/drivers/mmc/core/quirks.h b/drivers/mmc/core/quirks.h
> index d68e6e513a4f..23972d87c82a 100644
> --- a/drivers/mmc/core/quirks.h
> +++ b/drivers/mmc/core/quirks.h
> @@ -116,6 +116,14 @@ static const struct mmc_fixup __maybe_unused mmc_ext_csd_fixups[] = {
>         MMC_FIXUP_EXT_CSD_REV(CID_NAME_ANY, CID_MANFID_NUMONYX,
>                               0x014e, add_quirk, MMC_QUIRK_BROKEN_HPI, 6),
>
> +       /*
> +        * In certain rare combination of operations, Micron eMMC v5.0 cards
> +        * may experience data errors if internal cache is enabled.
> +        * Disabling cache for these cards eliminates the issue.
> +        */
> +       MMC_FIXUP_EXT_CSD_REV(CID_NAME_ANY, CID_MANFID_MICRON,
> +                             0x014e, add_quirk, MMC_QUIRK_BROKEN_CACHE, 7),
> +
>         END_FIXUP
>  };
>
> diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h
> index f9ad35dd6012..22f256a4e54e 100644
> --- a/include/linux/mmc/card.h
> +++ b/include/linux/mmc/card.h
> @@ -270,6 +270,7 @@ struct mmc_card {
>  #define MMC_QUIRK_BROKEN_IRQ_POLLING   (1<<11) /* Polling SDIO_CCCR_INTx could create a fake interrupt */
>  #define MMC_QUIRK_TRIM_BROKEN  (1<<12)         /* Skip trim */
>  #define MMC_QUIRK_BROKEN_HPI   (1<<13)         /* Disable broken HPI support */
> +#define MMC_QUIRK_BROKEN_CACHE (1<<14)         /* Disable broken cache */
>
>         bool                    reenable_cmdq;  /* Re-enable Command Queue */
>
> --
> 2.17.1
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] mmc: add quirk to disable eMMC cache for Micron eMMC v5.0 cards
  2021-04-12  7:44 ` Ulf Hansson
@ 2021-04-13 15:44   ` Scott Branden
  2021-04-13 15:46     ` Scott Branden
  0 siblings, 1 reply; 6+ messages in thread
From: Scott Branden @ 2021-04-13 15:44 UTC (permalink / raw)
  To: Ulf Hansson, Bean Huo (beanhuo), Luca Porzio (lporzio), tedirks
  Cc: BCM Kernel Feedback, linux-mmc, Linux Kernel Mailing List,
	Vladimir Olovyannikov

[-- Attachment #1: Type: text/plain, Size: 4130 bytes --]

+Travis Dirkes,

Could you provide more details on the Micron data error.

On 2021-04-12 12:44 a.m., Ulf Hansson wrote:
> + Bean Huo, Luca Porzio
> 
> On Thu, 8 Apr 2021 at 19:59, Scott Branden <scott.branden@broadcom.com> wrote:
>>
>> From: Vladimir Olovyannikov <vladimir.olovyannikov@broadcom.com>
>>
>> In certain rare combination of operations, Micron eMMC v5.0 cards
>> may experience data errors if internal cache is enabled.
>> This may lead to eMMC related data errors.
>> Introduce a quirk to disable cache on these eMMC cards.
> 
> Can you please elaborate on this, what combinations of operations are
> you referring to - and what kind of data errors?
> 
> I have also looped in some of the Micron guys, to let them chim in.
> 
>>
>> Signed-off-by: Vladimir Olovyannikov <vladimir.olovyannikov@broadcom.com>
>> Signed-off-by: Scott Branden <scott.branden@broadcom.com>
> 
> Kind regards
> Uffe
> 
>> ---
>>  drivers/mmc/core/card.h   | 5 +++++
>>  drivers/mmc/core/mmc.c    | 4 ++--
>>  drivers/mmc/core/quirks.h | 8 ++++++++
>>  include/linux/mmc/card.h  | 1 +
>>  4 files changed, 16 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/mmc/core/card.h b/drivers/mmc/core/card.h
>> index 7bd392d55cfa..22cea63ac359 100644
>> --- a/drivers/mmc/core/card.h
>> +++ b/drivers/mmc/core/card.h
>> @@ -222,4 +222,9 @@ static inline int mmc_card_broken_hpi(const struct mmc_card *c)
>>         return c->quirks & MMC_QUIRK_BROKEN_HPI;
>>  }
>>
>> +static inline int mmc_card_broken_cache(const struct mmc_card *c)
>> +{
>> +       return c->quirks & MMC_QUIRK_BROKEN_CACHE;
>> +}
>> +
>>  #endif
>> diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
>> index 8741271d3971..cd83b7f0e59c 100644
>> --- a/drivers/mmc/core/mmc.c
>> +++ b/drivers/mmc/core/mmc.c
>> @@ -1820,12 +1820,12 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,
>>          * sudden power failure tests. Let's extend the timeout to a minimum of
>>          * DEFAULT_CACHE_EN_TIMEOUT_MS and do it for all cards.
>>          */
>> -       if (card->ext_csd.cache_size > 0) {
>> +       if (!mmc_card_broken_cache(card) && card->ext_csd.cache_size > 0) {
>>                 unsigned int timeout_ms = MIN_CACHE_EN_TIMEOUT_MS;
>>
>>                 timeout_ms = max(card->ext_csd.generic_cmd6_time, timeout_ms);
>>                 err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
>> -                               EXT_CSD_CACHE_CTRL, 1, timeout_ms);
>> +                                EXT_CSD_CACHE_CTRL, 1, timeout_ms);
>>                 if (err && err != -EBADMSG)
>>                         goto free_card;
>>
>> diff --git a/drivers/mmc/core/quirks.h b/drivers/mmc/core/quirks.h
>> index d68e6e513a4f..23972d87c82a 100644
>> --- a/drivers/mmc/core/quirks.h
>> +++ b/drivers/mmc/core/quirks.h
>> @@ -116,6 +116,14 @@ static const struct mmc_fixup __maybe_unused mmc_ext_csd_fixups[] = {
>>         MMC_FIXUP_EXT_CSD_REV(CID_NAME_ANY, CID_MANFID_NUMONYX,
>>                               0x014e, add_quirk, MMC_QUIRK_BROKEN_HPI, 6),
>>
>> +       /*
>> +        * In certain rare combination of operations, Micron eMMC v5.0 cards
>> +        * may experience data errors if internal cache is enabled.
>> +        * Disabling cache for these cards eliminates the issue.
>> +        */
>> +       MMC_FIXUP_EXT_CSD_REV(CID_NAME_ANY, CID_MANFID_MICRON,
>> +                             0x014e, add_quirk, MMC_QUIRK_BROKEN_CACHE, 7),
>> +
>>         END_FIXUP
>>  };
>>
>> diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h
>> index f9ad35dd6012..22f256a4e54e 100644
>> --- a/include/linux/mmc/card.h
>> +++ b/include/linux/mmc/card.h
>> @@ -270,6 +270,7 @@ struct mmc_card {
>>  #define MMC_QUIRK_BROKEN_IRQ_POLLING   (1<<11) /* Polling SDIO_CCCR_INTx could create a fake interrupt */
>>  #define MMC_QUIRK_TRIM_BROKEN  (1<<12)         /* Skip trim */
>>  #define MMC_QUIRK_BROKEN_HPI   (1<<13)         /* Disable broken HPI support */
>> +#define MMC_QUIRK_BROKEN_CACHE (1<<14)         /* Disable broken cache */
>>
>>         bool                    reenable_cmdq;  /* Re-enable Command Queue */
>>
>> --
>> 2.17.1
>>


[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4212 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] mmc: add quirk to disable eMMC cache for Micron eMMC v5.0 cards
  2021-04-13 15:44   ` Scott Branden
@ 2021-04-13 15:46     ` Scott Branden
  2021-04-13 16:51       ` Avri Altman
  0 siblings, 1 reply; 6+ messages in thread
From: Scott Branden @ 2021-04-13 15:46 UTC (permalink / raw)
  To: Ulf Hansson, Bean Huo (beanhuo), Luca Porzio (lporzio), tedirkes
  Cc: BCM Kernel Feedback, linux-mmc, Linux Kernel Mailing List,
	Vladimir Olovyannikov

[-- Attachment #1: Type: text/plain, Size: 4252 bytes --]

+Travis Dirkes (with corrected email),
 
 Could you provide more details on the Micron data error.
 
> On 2021-04-12 12:44 a.m., Ulf Hansson wrote:
>> + Bean Huo, Luca Porzio
>>
>> On Thu, 8 Apr 2021 at 19:59, Scott Branden <scott.branden@broadcom.com> wrote:
>>>
>>> From: Vladimir Olovyannikov <vladimir.olovyannikov@broadcom.com>
>>>
>>> In certain rare combination of operations, Micron eMMC v5.0 cards
>>> may experience data errors if internal cache is enabled.
>>> This may lead to eMMC related data errors.
>>> Introduce a quirk to disable cache on these eMMC cards.
>>
>> Can you please elaborate on this, what combinations of operations are
>> you referring to - and what kind of data errors?
>>
>> I have also looped in some of the Micron guys, to let them chim in.
>>
>>>
>>> Signed-off-by: Vladimir Olovyannikov <vladimir.olovyannikov@broadcom.com>
>>> Signed-off-by: Scott Branden <scott.branden@broadcom.com>
>>
>> Kind regards
>> Uffe
>>
>>> ---
>>>  drivers/mmc/core/card.h   | 5 +++++
>>>  drivers/mmc/core/mmc.c    | 4 ++--
>>>  drivers/mmc/core/quirks.h | 8 ++++++++
>>>  include/linux/mmc/card.h  | 1 +
>>>  4 files changed, 16 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/drivers/mmc/core/card.h b/drivers/mmc/core/card.h
>>> index 7bd392d55cfa..22cea63ac359 100644
>>> --- a/drivers/mmc/core/card.h
>>> +++ b/drivers/mmc/core/card.h
>>> @@ -222,4 +222,9 @@ static inline int mmc_card_broken_hpi(const struct mmc_card *c)
>>>         return c->quirks & MMC_QUIRK_BROKEN_HPI;
>>>  }
>>>
>>> +static inline int mmc_card_broken_cache(const struct mmc_card *c)
>>> +{
>>> +       return c->quirks & MMC_QUIRK_BROKEN_CACHE;
>>> +}
>>> +
>>>  #endif
>>> diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
>>> index 8741271d3971..cd83b7f0e59c 100644
>>> --- a/drivers/mmc/core/mmc.c
>>> +++ b/drivers/mmc/core/mmc.c
>>> @@ -1820,12 +1820,12 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,
>>>          * sudden power failure tests. Let's extend the timeout to a minimum of
>>>          * DEFAULT_CACHE_EN_TIMEOUT_MS and do it for all cards.
>>>          */
>>> -       if (card->ext_csd.cache_size > 0) {
>>> +       if (!mmc_card_broken_cache(card) && card->ext_csd.cache_size > 0) {
>>>                 unsigned int timeout_ms = MIN_CACHE_EN_TIMEOUT_MS;
>>>
>>>                 timeout_ms = max(card->ext_csd.generic_cmd6_time, timeout_ms);
>>>                 err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
>>> -                               EXT_CSD_CACHE_CTRL, 1, timeout_ms);
>>> +                                EXT_CSD_CACHE_CTRL, 1, timeout_ms);
>>>                 if (err && err != -EBADMSG)
>>>                         goto free_card;
>>>
>>> diff --git a/drivers/mmc/core/quirks.h b/drivers/mmc/core/quirks.h
>>> index d68e6e513a4f..23972d87c82a 100644
>>> --- a/drivers/mmc/core/quirks.h
>>> +++ b/drivers/mmc/core/quirks.h
>>> @@ -116,6 +116,14 @@ static const struct mmc_fixup __maybe_unused mmc_ext_csd_fixups[] = {
>>>         MMC_FIXUP_EXT_CSD_REV(CID_NAME_ANY, CID_MANFID_NUMONYX,
>>>                               0x014e, add_quirk, MMC_QUIRK_BROKEN_HPI, 6),
>>>
>>> +       /*
>>> +        * In certain rare combination of operations, Micron eMMC v5.0 cards
>>> +        * may experience data errors if internal cache is enabled.
>>> +        * Disabling cache for these cards eliminates the issue.
>>> +        */
>>> +       MMC_FIXUP_EXT_CSD_REV(CID_NAME_ANY, CID_MANFID_MICRON,
>>> +                             0x014e, add_quirk, MMC_QUIRK_BROKEN_CACHE, 7),
>>> +
>>>         END_FIXUP
>>>  };
>>>
>>> diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h
>>> index f9ad35dd6012..22f256a4e54e 100644
>>> --- a/include/linux/mmc/card.h
>>> +++ b/include/linux/mmc/card.h
>>> @@ -270,6 +270,7 @@ struct mmc_card {
>>>  #define MMC_QUIRK_BROKEN_IRQ_POLLING   (1<<11) /* Polling SDIO_CCCR_INTx could create a fake interrupt */
>>>  #define MMC_QUIRK_TRIM_BROKEN  (1<<12)         /* Skip trim */
>>>  #define MMC_QUIRK_BROKEN_HPI   (1<<13)         /* Disable broken HPI support */
>>> +#define MMC_QUIRK_BROKEN_CACHE (1<<14)         /* Disable broken cache */
>>>
>>>         bool                    reenable_cmdq;  /* Re-enable Command Queue */
>>>
>>> --
>>> 2.17.1
>>>
> 


[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4212 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [PATCH] mmc: add quirk to disable eMMC cache for Micron eMMC v5.0 cards
  2021-04-13 15:46     ` Scott Branden
@ 2021-04-13 16:51       ` Avri Altman
  0 siblings, 0 replies; 6+ messages in thread
From: Avri Altman @ 2021-04-13 16:51 UTC (permalink / raw)
  To: Scott Branden, Ulf Hansson, Bean Huo (beanhuo),
	Luca Porzio (lporzio),
	tedirkes
  Cc: BCM Kernel Feedback, linux-mmc, Linux Kernel Mailing List,
	Vladimir Olovyannikov

Scott hi,
Can you take a look at https://lore.kernel.org/lkml/20210322133645.4901-1-avri.altman@wdc.com/
Is there a chance that it will work for you as well?

Thanks,
Avri

> -----Original Message-----
> From: Scott Branden <scott.branden@broadcom.com>
> Sent: Tuesday, 13 April 2021 18:46
> To: Ulf Hansson <ulf.hansson@linaro.org>; Bean Huo (beanhuo)
> <beanhuo@micron.com>; Luca Porzio (lporzio) <lporzio@micron.com>;
> tedirkes@micron.com
> Cc: BCM Kernel Feedback <bcm-kernel-feedback-list@broadcom.com>; linux-
> mmc <linux-mmc@vger.kernel.org>; Linux Kernel Mailing List <linux-
> kernel@vger.kernel.org>; Vladimir Olovyannikov
> <vladimir.olovyannikov@broadcom.com>
> Subject: Re: [PATCH] mmc: add quirk to disable eMMC cache for Micron eMMC
> v5.0 cards
> 
> +Travis Dirkes (with corrected email),
> 
>  Could you provide more details on the Micron data error.
> 
> > On 2021-04-12 12:44 a.m., Ulf Hansson wrote:
> >> + Bean Huo, Luca Porzio
> >>
> >> On Thu, 8 Apr 2021 at 19:59, Scott Branden
> <scott.branden@broadcom.com> wrote:
> >>>
> >>> From: Vladimir Olovyannikov <vladimir.olovyannikov@broadcom.com>
> >>>
> >>> In certain rare combination of operations, Micron eMMC v5.0 cards
> >>> may experience data errors if internal cache is enabled.
> >>> This may lead to eMMC related data errors.
> >>> Introduce a quirk to disable cache on these eMMC cards.
> >>
> >> Can you please elaborate on this, what combinations of operations are
> >> you referring to - and what kind of data errors?
> >>
> >> I have also looped in some of the Micron guys, to let them chim in.
> >>
> >>>
> >>> Signed-off-by: Vladimir Olovyannikov
> <vladimir.olovyannikov@broadcom.com>
> >>> Signed-off-by: Scott Branden <scott.branden@broadcom.com>
> >>
> >> Kind regards
> >> Uffe
> >>
> >>> ---
> >>>  drivers/mmc/core/card.h   | 5 +++++
> >>>  drivers/mmc/core/mmc.c    | 4 ++--
> >>>  drivers/mmc/core/quirks.h | 8 ++++++++
> >>>  include/linux/mmc/card.h  | 1 +
> >>>  4 files changed, 16 insertions(+), 2 deletions(-)
> >>>
> >>> diff --git a/drivers/mmc/core/card.h b/drivers/mmc/core/card.h
> >>> index 7bd392d55cfa..22cea63ac359 100644
> >>> --- a/drivers/mmc/core/card.h
> >>> +++ b/drivers/mmc/core/card.h
> >>> @@ -222,4 +222,9 @@ static inline int mmc_card_broken_hpi(const
> struct mmc_card *c)
> >>>         return c->quirks & MMC_QUIRK_BROKEN_HPI;
> >>>  }
> >>>
> >>> +static inline int mmc_card_broken_cache(const struct mmc_card *c)
> >>> +{
> >>> +       return c->quirks & MMC_QUIRK_BROKEN_CACHE;
> >>> +}
> >>> +
> >>>  #endif
> >>> diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
> >>> index 8741271d3971..cd83b7f0e59c 100644
> >>> --- a/drivers/mmc/core/mmc.c
> >>> +++ b/drivers/mmc/core/mmc.c
> >>> @@ -1820,12 +1820,12 @@ static int mmc_init_card(struct mmc_host
> *host, u32 ocr,
> >>>          * sudden power failure tests. Let's extend the timeout to a minimum of
> >>>          * DEFAULT_CACHE_EN_TIMEOUT_MS and do it for all cards.
> >>>          */
> >>> -       if (card->ext_csd.cache_size > 0) {
> >>> +       if (!mmc_card_broken_cache(card) && card->ext_csd.cache_size > 0)
> {
> >>>                 unsigned int timeout_ms = MIN_CACHE_EN_TIMEOUT_MS;
> >>>
> >>>                 timeout_ms = max(card->ext_csd.generic_cmd6_time,
> timeout_ms);
> >>>                 err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
> >>> -                               EXT_CSD_CACHE_CTRL, 1, timeout_ms);
> >>> +                                EXT_CSD_CACHE_CTRL, 1, timeout_ms);
> >>>                 if (err && err != -EBADMSG)
> >>>                         goto free_card;
> >>>
> >>> diff --git a/drivers/mmc/core/quirks.h b/drivers/mmc/core/quirks.h
> >>> index d68e6e513a4f..23972d87c82a 100644
> >>> --- a/drivers/mmc/core/quirks.h
> >>> +++ b/drivers/mmc/core/quirks.h
> >>> @@ -116,6 +116,14 @@ static const struct mmc_fixup __maybe_unused
> mmc_ext_csd_fixups[] = {
> >>>         MMC_FIXUP_EXT_CSD_REV(CID_NAME_ANY,
> CID_MANFID_NUMONYX,
> >>>                               0x014e, add_quirk, MMC_QUIRK_BROKEN_HPI, 6),
> >>>
> >>> +       /*
> >>> +        * In certain rare combination of operations, Micron eMMC v5.0 cards
> >>> +        * may experience data errors if internal cache is enabled.
> >>> +        * Disabling cache for these cards eliminates the issue.
> >>> +        */
> >>> +       MMC_FIXUP_EXT_CSD_REV(CID_NAME_ANY,
> CID_MANFID_MICRON,
> >>> +                             0x014e, add_quirk, MMC_QUIRK_BROKEN_CACHE, 7),
> >>> +
> >>>         END_FIXUP
> >>>  };
> >>>
> >>> diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h
> >>> index f9ad35dd6012..22f256a4e54e 100644
> >>> --- a/include/linux/mmc/card.h
> >>> +++ b/include/linux/mmc/card.h
> >>> @@ -270,6 +270,7 @@ struct mmc_card {
> >>>  #define MMC_QUIRK_BROKEN_IRQ_POLLING   (1<<11) /* Polling
> SDIO_CCCR_INTx could create a fake interrupt */
> >>>  #define MMC_QUIRK_TRIM_BROKEN  (1<<12)         /* Skip trim */
> >>>  #define MMC_QUIRK_BROKEN_HPI   (1<<13)         /* Disable broken HPI
> support */
> >>> +#define MMC_QUIRK_BROKEN_CACHE (1<<14)         /* Disable broken
> cache */
> >>>
> >>>         bool                    reenable_cmdq;  /* Re-enable Command Queue */
> >>>
> >>> --
> >>> 2.17.1
> >>>
> >


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] mmc: add quirk to disable eMMC cache for Micron eMMC v5.0 cards
  2021-04-08 17:59 [PATCH] mmc: add quirk to disable eMMC cache for Micron eMMC v5.0 cards Scott Branden
  2021-04-12  7:44 ` Ulf Hansson
@ 2021-04-14  9:05 ` Bean Huo
  1 sibling, 0 replies; 6+ messages in thread
From: Bean Huo @ 2021-04-14  9:05 UTC (permalink / raw)
  To: Scott Branden, BCM Kernel Feedback, Ulf Hansson, linux-mmc, Bean Huo
  Cc: linux-kernel, Vladimir Olovyannikov

On Thu, 2021-04-08 at 10:59 -0700, Scott Branden wrote:
> From: Vladimir Olovyannikov <vladimir.olovyannikov@broadcom.com>
> 
> 
> 
> In certain rare combination of operations, Micron eMMC v5.0 cards
> 
> may experience data errors if internal cache is enabled.
> 
> This may lead to eMMC related data errors.
> 
> Introduce a quirk to disable cache on these eMMC cards.

Hi, Scott
Give me some time, let check and confirm this interanlly.

thanks,
Bean


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-04-14  9:05 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-08 17:59 [PATCH] mmc: add quirk to disable eMMC cache for Micron eMMC v5.0 cards Scott Branden
2021-04-12  7:44 ` Ulf Hansson
2021-04-13 15:44   ` Scott Branden
2021-04-13 15:46     ` Scott Branden
2021-04-13 16:51       ` Avri Altman
2021-04-14  9:05 ` Bean Huo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).