Skip to contentSkip to conversation

mmc: rpmb: add quirk MMC_QUIRK_BROKEN_RPMB_RETUNE

PATCH Superseded Jorge Ramirez-Ortiz 3 participants 6 messages Nov 29, 2023 1 message not in the archive MMC, SD and SDIO

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mmc: rpmb: add quirk MMC_QUIRK_BROKEN_RPMB_RETUNE

On the eMMC SanDisk iNAND 7250 configured with HS200, requesting a re-tune before switching to the RPMB partition would randomly cause subsequent RPMB requests to fail with EILSEQ:
* data error -84, tigggered in __mmc_blk_ioctl_cmd()

This commit skips the retune when switching to RPMB. Tested over several days with per minute RPMB reads.

---
 drivers/mmc/core/block.c  | 6 +++++-
 drivers/mmc/core/card.h   | 7 +++++++
 drivers/mmc/core/quirks.h | 7 +++++++
 include/linux/mmc/card.h  | 1 +
 4 files changed, 20 insertions(+), 1 deletion(-)
drivers/mmc/core/block.c +5 -1
index 152dfe593c43..9b7ba6562a3b 100644
@@ -860,6 +860,11 @@ static int mmc_blk_part_switch_pre(struct mmc_card *card,
 				return ret;
 		}
 		mmc_retune_pause(card->host);
+
+		/* Do not force retune before RPMB switch */
+		if (mmc_can_retune(card->host) &&
+		    mmc_card_broken_rpmb_retune(card))
+			card->host->need_retune = 0;
 	}
 
 	return ret;
@@ -3143,4 +3148,3 @@ module_exit(mmc_blk_exit);
 
 MODULE_LICENSE("GPL");
 MODULE_DESCRIPTION("Multimedia Card (MMC) block device driver");
-
drivers/mmc/core/card.h +7 -0
index b7754a1b8d97..1e1555a15de9 100644
@@ -85,6 +85,7 @@ struct mmc_fixup {
 #define CID_MANFID_MICRON       0x13
 #define CID_MANFID_SAMSUNG      0x15
 #define CID_MANFID_APACER       0x27
+#define CID_MANFID_SANDISK2     0x45
 #define CID_MANFID_KINGSTON     0x70
 #define CID_MANFID_HYNIX	0x90
 #define CID_MANFID_KINGSTON_SD	0x9F
@@ -284,4 +285,10 @@ static inline int mmc_card_broken_cache_flush(const struct mmc_card *c)
 {
 	return c->quirks & MMC_QUIRK_BROKEN_CACHE_FLUSH;
 }
+
+static inline int mmc_card_broken_rpmb_retune(const struct mmc_card *c)
+{
+	return c->quirks & MMC_QUIRK_BROKEN_RPMB_RETUNE;
+}
+
 #endif
drivers/mmc/core/quirks.h +7 -0
index cca71867bc4a..35dfc8437d29 100644
@@ -130,6 +130,13 @@ static const struct mmc_fixup __maybe_unused mmc_blk_fixups[] = {
 	MMC_FIXUP(CID_NAME_ANY, CID_MANFID_SANDISK_SD, 0x5344, add_quirk_sd,
 		  MMC_QUIRK_BROKEN_SD_DISCARD),
 
+	/*
+	 * SanDisk iNAND 7250 DDG4064, this quirk shall disable the retune
+	 * operation enforced by default when switching to RPMB.
+	 */
+	MMC_FIXUP("DG4064", CIF_MANFID_SANDISK2, 0x100, add_quirk_mmc,
+		  MMC_QUIRK_BROKEN_RPMB_RETUNE),
+
 	END_FIXUP
 };
 
include/linux/mmc/card.h +1 -0
index 7b12eebc5586..bd6986189e8b 100644
@@ -296,6 +296,7 @@ struct mmc_card {
 #define MMC_QUIRK_BROKEN_SD_DISCARD	(1<<14)	/* Disable broken SD discard support */
 #define MMC_QUIRK_BROKEN_SD_CACHE	(1<<15)	/* Disable broken SD cache support */
 #define MMC_QUIRK_BROKEN_CACHE_FLUSH	(1<<16)	/* Don't flush cache until the write has occurred */
+#define MMC_QUIRK_BROKEN_RPMB_RETUNE	(1<<17) /* Don't force a retune before switching to RPMB */
 
 	bool			written_flag;	/* Indicates eMMC has been written since power on */
 	bool			reenable_cmdq;	/* Re-enable Command Queue */

--
2.34.1

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw
Quoted 26 lines · Christian Loehle
Quoted 25 lines · Jorge Ramirez-Ortiz

On the eMMC SanDisk iNAND 7250 configured with HS200, requesting a re-tune before switching to the RPMB partition would randomly cause subsequent RPMB requests to fail with EILSEQ:
* data error -84, tigggered in __mmc_blk_ioctl_cmd()

This commit skips the retune when switching to RPMB. Tested over several days with per minute RPMB reads.

---
 drivers/mmc/core/block.c  | 6 +++++-
 drivers/mmc/core/card.h   | 7 +++++++
 drivers/mmc/core/quirks.h | 7 +++++++
 include/linux/mmc/card.h  | 1 +
 4 files changed, 20 insertions(+), 1 deletion(-)
drivers/mmc/core/block.c +1 -0
index 152dfe593c43..9b7ba6562a3b 100644
@@ -860,6 +860,11 @@ static int mmc_blk_part_switch_pre(struct mmc_card *card,
 				return ret;
 		}
 		mmc_retune_pause(card->host);
+
Quoted 8 lines

drivers/mmc/core/block.c static int mmc_blk_part_switch_pre(struct mmc_card *card, · line 868

Quoted 5 lines
drivers/mmc/core/block.c +4 -0
+		/* Do not force retune before RPMB switch */
+		if (mmc_can_retune(card->host) &&
+		    mmc_card_broken_rpmb_retune(card))
+			card->host->need_retune = 0;
 	}

Is this just an issue for rpmb switches or did you try other non-rpmb partition switches, too?

I only tried the reported failure case (ie, RPMB switch).This failure case came from a product verification team so I believe all the other scenarios should be functional - other than RPMB accesses (these tests started a few months ago), no other issues have been reported from eMMC validation in the last couple of years.

Is there some additional check/test you would like to see done? if so, please could you let me know how to trigger them?

Quoted 1 line

And only HS200 or that's just what you tested with?

Yes that is just the product configuration; so the only one I tested.

The host controller is sdhci-of-arasan for xlnx,zynqmp-8.9a. I inspected the driver history and auto-tuning was extended to support ZynqMP (DLL reset) some years ago so I believe tuning itself should be fine.

I am referring to commit 8d2e334377dbe645415fbe031711324bc2281907 "mmc:
sdhci-of-arasan: Add support for DLL reset for ZynqMP platforms "

Quoted 5 lines
Quoted 5 lines
drivers/mmc/core/block.c +0 -0
 	return ret;
@@ -3143,4 +3148,3 @@ module_exit(mmc_blk_exit);
 
Quoted 11 lines

drivers/mmc/core/card.h struct mmc_fixup { · line 87

Quoted 11 lines
drivers/mmc/core/block.c +0 -1
 MODULE_LICENSE("GPL");
 MODULE_DESCRIPTION("Multimedia Card (MMC) block device driver");
-
drivers/mmc/core/card.h +0 -0
index b7754a1b8d97..1e1555a15de9 100644
@@ -85,6 +85,7 @@ struct mmc_fixup {
 #define CID_MANFID_MICRON       0x13
 #define CID_MANFID_SAMSUNG      0x15
 #define CID_MANFID_APACER       0x27

I had to add another ID for SanDisk - maybe 0x45 is for Industrial controllers? do you know?

Quoted 49 lines
Quoted 48 lines
drivers/mmc/core/card.h +1 -0
+#define CID_MANFID_SANDISK2     0x45
 
 #define CID_MANFID_KINGSTON     0x70
 #define CID_MANFID_HYNIX	0x90

#define CID_MANFID_KINGSTON_SD 0x9F

drivers/mmc/core/card.h +6 -0
@@ -284,4 +285,10 @@ static inline int mmc_card_broken_cache_flush(const struct mmc_card *c)
 {
 	return c->quirks & MMC_QUIRK_BROKEN_CACHE_FLUSH;
 }
+
+static inline int mmc_card_broken_rpmb_retune(const struct mmc_card *c)
+{
+	return c->quirks & MMC_QUIRK_BROKEN_RPMB_RETUNE;
+}
+
 #endif
drivers/mmc/core/quirks.h +7 -0
index cca71867bc4a..35dfc8437d29 100644
@@ -130,6 +130,13 @@ static const struct mmc_fixup __maybe_unused mmc_blk_fixups[] = {
 	MMC_FIXUP(CID_NAME_ANY, CID_MANFID_SANDISK_SD, 0x5344, add_quirk_sd,
 		  MMC_QUIRK_BROKEN_SD_DISCARD),
 
+	/*
+	 * SanDisk iNAND 7250 DDG4064, this quirk shall disable the retune
+	 * operation enforced by default when switching to RPMB.
+	 */
+	MMC_FIXUP("DG4064", CIF_MANFID_SANDISK2, 0x100, add_quirk_mmc,
+		  MMC_QUIRK_BROKEN_RPMB_RETUNE),
+
 	END_FIXUP
 };
 
include/linux/mmc/card.h +1 -1
index 7b12eebc5586..bd6986189e8b 100644
@@ -296,6 +296,7 @@ struct mmc_card {
 #define MMC_QUIRK_BROKEN_SD_DISCARD	(1<<14)	/* Disable broken SD discard support */
 #define MMC_QUIRK_BROKEN_SD_CACHE	(1<<15)	/* Disable broken SD cache support */
 #define MMC_QUIRK_BROKEN_CACHE_FLUSH	(1<<16)	/* Don't flush cache until the write has occurred */
+#define MMC_QUIRK_BROKEN_RPMB_RETUNE	(1<<17) /* Don't force a retune before switching to RPMB */
 
 	bool			written_flag;	/* Indicates eMMC has been written since power on */
 	bool			reenable_cmdq;	/* Re-enable Command Queue */
--

2.34.1

#3 lore raw
Quoted 36 lines · Foundries
Quoted 26 lines · Christian Loehle
Quoted 25 lines · Jorge Ramirez-Ortiz

On the eMMC SanDisk iNAND 7250 configured with HS200, requesting a re-tune before switching to the RPMB partition would randomly cause subsequent RPMB requests to fail with EILSEQ:
* data error -84, tigggered in __mmc_blk_ioctl_cmd()

This commit skips the retune when switching to RPMB. Tested over several days with per minute RPMB reads.

---
 drivers/mmc/core/block.c  | 6 +++++-
 drivers/mmc/core/card.h   | 7 +++++++
 drivers/mmc/core/quirks.h | 7 +++++++
 include/linux/mmc/card.h  | 1 +
 4 files changed, 20 insertions(+), 1 deletion(-)
drivers/mmc/core/block.c +1 -0
index 152dfe593c43..9b7ba6562a3b 100644
@@ -860,6 +860,11 @@ static int mmc_blk_part_switch_pre(struct mmc_card *card,
 				return ret;
 		}
 		mmc_retune_pause(card->host);
+
Quoted 8 lines

drivers/mmc/core/block.c static int mmc_blk_part_switch_pre(struct mmc_card *card, · line 868

Quoted 5 lines
drivers/mmc/core/block.c +4 -0
+		/* Do not force retune before RPMB switch */
+		if (mmc_can_retune(card->host) &&
+		    mmc_card_broken_rpmb_retune(card))
+			card->host->need_retune = 0;
 	}

Is this just an issue for rpmb switches or did you try other non-rpmb partition switches, too?

Quoted 8 lines

I only tried the reported failure case (ie, RPMB switch).This failure case came from a product verification team so I believe all the other scenarios should be functional - other than RPMB accesses (these tests started a few months ago), no other issues have been reported from eMMC validation in the last couple of years.

Is there some additional check/test you would like to see done? if so, please could you let me know how to trigger them?

That's fine with me, probably just a very interesting bug then.

Quoted 17 lines
Quoted 2 lines

And only HS200 or that's just what you tested with?

Yes that is just the product configuration; so the only one I tested.

The host controller is sdhci-of-arasan for xlnx,zynqmp-8.9a. I inspected the driver history and auto-tuning was extended to support ZynqMP (DLL reset) some years ago so I believe tuning itself should be fine.

I am referring to commit 8d2e334377dbe645415fbe031711324bc2281907 "mmc:
sdhci-of-arasan: Add support for DLL reset for ZynqMP platforms "

Quoted 5 lines
Quoted 5 lines
drivers/mmc/core/block.c +0 -0
 	return ret;
@@ -3143,4 +3148,3 @@ module_exit(mmc_blk_exit);
 
Quoted 14 lines
Quoted 11 lines

drivers/mmc/core/card.h struct mmc_fixup { · line 87

Quoted 11 lines
drivers/mmc/core/block.c +0 -1
 MODULE_LICENSE("GPL");
 MODULE_DESCRIPTION("Multimedia Card (MMC) block device driver");
-
drivers/mmc/core/card.h +0 -0
index b7754a1b8d97..1e1555a15de9 100644
@@ -85,6 +85,7 @@ struct mmc_fixup {
 #define CID_MANFID_MICRON       0x13
 #define CID_MANFID_SAMSUNG      0x15
 #define CID_MANFID_APACER       0x27

I had to add another ID for SanDisk - maybe 0x45 is for Industrial controllers? do you know?

I don't have access to JEDEC internal docs anymore, but since Avri probably wants to ACK this potential bug anyway, he should confirm.

#4 lore raw
In reply to Jorge Ramirez-Ortiz
kernel test robot noticed the following build warnings:

Hi Jorge,

kernel test robot noticed the following build warnings:

[auto build test WARNING on linus/master]
[also build test WARNING on v6.7-rc3 next-20231129]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Jorge-Ramirez-Ortiz/mmc-rpmb-add-quirk-MMC_QUIRK_BROKEN_RPMB_RETUNE/20231129-181517
base:   linus/master
patch link:    https://lore.kernel.org/r/20231129094350.2605322-1-jorge%40foundries.io
patch subject: [PATCH] mmc: rpmb: add quirk MMC_QUIRK_BROKEN_RPMB_RETUNE
config: arm-defconfig (https://download.01.org/0day-ci/archive/20231129/[email protected]/config)
compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project.git f28c006a5895fc0e329fe15fead81e37457cb1d1)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231129/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

In file included from drivers/mmc/core/mmc.c:27:
drivers/mmc/core/quirks.h:137:22: error: use of undeclared identifier 'CIF_MANFID_SANDISK2'

           MMC_FIXUP("DG4064", CIF_MANFID_SANDISK2, 0x100, add_quirk_mmc,
                               ^
>> drivers/mmc/core/mmc.c:115:22: warning: shift count >= width of type [-Wshift-count-overflow]
                   card->cid.serial        = UNSTUFF_BITS(resp, 16, 32);
                                             ^~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/mmc/core/mmc.c:57:39: note: expanded from macro 'UNSTUFF_BITS'
                   const u32 __mask = (__size < 32 ? 1 << __size : 0) - 1; \
                                                       ^  ~~~~~~

1 warning and 1 error generated.

vim +115 drivers/mmc/core/mmc.c

7ea239d9e6d699 Pierre Ossman      2006-12-31   53  
7ea239d9e6d699 Pierre Ossman      2006-12-31   54  #define UNSTUFF_BITS(resp,start,size)					\
7ea239d9e6d699 Pierre Ossman      2006-12-31   55  	({								\
7ea239d9e6d699 Pierre Ossman      2006-12-31   56  		const int __size = size;				\
7ea239d9e6d699 Pierre Ossman      2006-12-31   57  		const u32 __mask = (__size < 32 ? 1 << __size : 0) - 1;	\
7ea239d9e6d699 Pierre Ossman      2006-12-31   58  		const int __off = 3 - ((start) / 32);			\
7ea239d9e6d699 Pierre Ossman      2006-12-31   59  		const int __shft = (start) & 31;			\
7ea239d9e6d699 Pierre Ossman      2006-12-31   60  		u32 __res;						\
7ea239d9e6d699 Pierre Ossman      2006-12-31   61  									\
7ea239d9e6d699 Pierre Ossman      2006-12-31   62  		__res = resp[__off] >> __shft;				\
7ea239d9e6d699 Pierre Ossman      2006-12-31   63  		if (__size + __shft > 32)				\
7ea239d9e6d699 Pierre Ossman      2006-12-31   64  			__res |= resp[__off-1] << ((32 - __shft) % 32);	\
7ea239d9e6d699 Pierre Ossman      2006-12-31   65  		__res & __mask;						\
7ea239d9e6d699 Pierre Ossman      2006-12-31   66  	})
7ea239d9e6d699 Pierre Ossman      2006-12-31   67  
7ea239d9e6d699 Pierre Ossman      2006-12-31   68  /*
7ea239d9e6d699 Pierre Ossman      2006-12-31   69   * Given the decoded CSD structure, decode the raw CID to our CID structure.
7ea239d9e6d699 Pierre Ossman      2006-12-31   70   */
bd766312618d2e Pierre Ossman      2007-05-01   71  static int mmc_decode_cid(struct mmc_card *card)
7ea239d9e6d699 Pierre Ossman      2006-12-31   72  {
7ea239d9e6d699 Pierre Ossman      2006-12-31   73  	u32 *resp = card->raw_cid;
7ea239d9e6d699 Pierre Ossman      2006-12-31   74  
ac9d25557dcc9f Linus Walleij      2022-04-25   75  	/*
ac9d25557dcc9f Linus Walleij      2022-04-25   76  	 * Add the raw card ID (cid) data to the entropy pool. It doesn't
ac9d25557dcc9f Linus Walleij      2022-04-25   77  	 * matter that not all of it is unique, it's just bonus entropy.
ac9d25557dcc9f Linus Walleij      2022-04-25   78  	 */
ac9d25557dcc9f Linus Walleij      2022-04-25   79  	add_device_randomness(&card->raw_cid, sizeof(card->raw_cid));
ac9d25557dcc9f Linus Walleij      2022-04-25   80  
7ea239d9e6d699 Pierre Ossman      2006-12-31   81  	/*
7ea239d9e6d699 Pierre Ossman      2006-12-31   82  	 * The selection of the format here is based upon published
7ea239d9e6d699 Pierre Ossman      2006-12-31   83  	 * specs from sandisk and from what people have reported.
7ea239d9e6d699 Pierre Ossman      2006-12-31   84  	 */
7ea239d9e6d699 Pierre Ossman      2006-12-31   85  	switch (card->csd.mmca_vsn) {
7ea239d9e6d699 Pierre Ossman      2006-12-31   86  	case 0: /* MMC v1.0 - v1.2 */
7ea239d9e6d699 Pierre Ossman      2006-12-31   87  	case 1: /* MMC v1.4 */
7ea239d9e6d699 Pierre Ossman      2006-12-31   88  		card->cid.manfid	= UNSTUFF_BITS(resp, 104, 24);
7ea239d9e6d699 Pierre Ossman      2006-12-31   89  		card->cid.prod_name[0]	= UNSTUFF_BITS(resp, 96, 8);
7ea239d9e6d699 Pierre Ossman      2006-12-31   90  		card->cid.prod_name[1]	= UNSTUFF_BITS(resp, 88, 8);
7ea239d9e6d699 Pierre Ossman      2006-12-31   91  		card->cid.prod_name[2]	= UNSTUFF_BITS(resp, 80, 8);
7ea239d9e6d699 Pierre Ossman      2006-12-31   92  		card->cid.prod_name[3]	= UNSTUFF_BITS(resp, 72, 8);
7ea239d9e6d699 Pierre Ossman      2006-12-31   93  		card->cid.prod_name[4]	= UNSTUFF_BITS(resp, 64, 8);
7ea239d9e6d699 Pierre Ossman      2006-12-31   94  		card->cid.prod_name[5]	= UNSTUFF_BITS(resp, 56, 8);
7ea239d9e6d699 Pierre Ossman      2006-12-31   95  		card->cid.prod_name[6]	= UNSTUFF_BITS(resp, 48, 8);
7ea239d9e6d699 Pierre Ossman      2006-12-31   96  		card->cid.hwrev		= UNSTUFF_BITS(resp, 44, 4);
7ea239d9e6d699 Pierre Ossman      2006-12-31   97  		card->cid.fwrev		= UNSTUFF_BITS(resp, 40, 4);
7ea239d9e6d699 Pierre Ossman      2006-12-31   98  		card->cid.serial	= UNSTUFF_BITS(resp, 16, 24);
7ea239d9e6d699 Pierre Ossman      2006-12-31   99  		card->cid.month		= UNSTUFF_BITS(resp, 12, 4);
7ea239d9e6d699 Pierre Ossman      2006-12-31  100  		card->cid.year		= UNSTUFF_BITS(resp, 8, 4) + 1997;
7ea239d9e6d699 Pierre Ossman      2006-12-31  101  		break;
7ea239d9e6d699 Pierre Ossman      2006-12-31  102  
7ea239d9e6d699 Pierre Ossman      2006-12-31  103  	case 2: /* MMC v2.0 - v2.2 */
7ea239d9e6d699 Pierre Ossman      2006-12-31  104  	case 3: /* MMC v3.1 - v3.3 */
7ea239d9e6d699 Pierre Ossman      2006-12-31  105  	case 4: /* MMC v4 */
7ea239d9e6d699 Pierre Ossman      2006-12-31  106  		card->cid.manfid	= UNSTUFF_BITS(resp, 120, 8);
421b605edb1ce6 Dominique Martinet 2023-11-03  107  		card->cid.oemid		= UNSTUFF_BITS(resp, 104, 16);
7ea239d9e6d699 Pierre Ossman      2006-12-31  108  		card->cid.prod_name[0]	= UNSTUFF_BITS(resp, 96, 8);
7ea239d9e6d699 Pierre Ossman      2006-12-31  109  		card->cid.prod_name[1]	= UNSTUFF_BITS(resp, 88, 8);
7ea239d9e6d699 Pierre Ossman      2006-12-31  110  		card->cid.prod_name[2]	= UNSTUFF_BITS(resp, 80, 8);
7ea239d9e6d699 Pierre Ossman      2006-12-31  111  		card->cid.prod_name[3]	= UNSTUFF_BITS(resp, 72, 8);
7ea239d9e6d699 Pierre Ossman      2006-12-31  112  		card->cid.prod_name[4]	= UNSTUFF_BITS(resp, 64, 8);
7ea239d9e6d699 Pierre Ossman      2006-12-31  113  		card->cid.prod_name[5]	= UNSTUFF_BITS(resp, 56, 8);
51e7e8b632d8e5 Bernie Thompson    2013-02-27  114  		card->cid.prv		= UNSTUFF_BITS(resp, 48, 8);
7ea239d9e6d699 Pierre Ossman      2006-12-31 @115  		card->cid.serial	= UNSTUFF_BITS(resp, 16, 32);
7ea239d9e6d699 Pierre Ossman      2006-12-31  116  		card->cid.month		= UNSTUFF_BITS(resp, 12, 4);
7ea239d9e6d699 Pierre Ossman      2006-12-31  117  		card->cid.year		= UNSTUFF_BITS(resp, 8, 4) + 1997;
7ea239d9e6d699 Pierre Ossman      2006-12-31  118  		break;
7ea239d9e6d699 Pierre Ossman      2006-12-31  119  
7ea239d9e6d699 Pierre Ossman      2006-12-31  120  	default:
a3c76eb9d4a1e6 Girish K S         2011-10-11  121  		pr_err("%s: card has unknown MMCA version %d\n",
7ea239d9e6d699 Pierre Ossman      2006-12-31  122  			mmc_hostname(card->host), card->csd.mmca_vsn);
bd766312618d2e Pierre Ossman      2007-05-01  123  		return -EINVAL;
7ea239d9e6d699 Pierre Ossman      2006-12-31  124  	}
bd766312618d2e Pierre Ossman      2007-05-01  125  
bd766312618d2e Pierre Ossman      2007-05-01  126  	return 0;
7ea239d9e6d699 Pierre Ossman      2006-12-31  127  }
7ea239d9e6d699 Pierre Ossman      2006-12-31  128  
Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
#5 lore raw
In reply to Jorge Ramirez-Ortiz
kernel test robot noticed the following build errors:

Hi Jorge,

kernel test robot noticed the following build errors:

[auto build test ERROR on linus/master]
[also build test ERROR on v6.7-rc3 next-20231129]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Jorge-Ramirez-Ortiz/mmc-rpmb-add-quirk-MMC_QUIRK_BROKEN_RPMB_RETUNE/20231129-181517
base:   linus/master
patch link:    https://lore.kernel.org/r/20231129094350.2605322-1-jorge%40foundries.io
patch subject: [PATCH] mmc: rpmb: add quirk MMC_QUIRK_BROKEN_RPMB_RETUNE
config: x86_64-rhel-8.3-bpf (https://download.01.org/0day-ci/archive/20231129/[email protected]/config)
compiler: clang version 16.0.4 (https://github.com/llvm/llvm-project.git ae42196bc493ffe877a7e3dff8be32035dea4d07)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231129/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

In file included from drivers/mmc/core/mmc.c:27:

>> drivers/mmc/core/quirks.h:137:22: error: use of undeclared identifier 'CIF_MANFID_SANDISK2'
           MMC_FIXUP("DG4064", CIF_MANFID_SANDISK2, 0x100, add_quirk_mmc,
                               ^
   drivers/mmc/core/mmc.c:115:22: warning: shift count >= width of type [-Wshift-count-overflow]
                   card->cid.serial        = UNSTUFF_BITS(resp, 16, 32);
                                             ^~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/mmc/core/mmc.c:57:39: note: expanded from macro 'UNSTUFF_BITS'
                   const u32 __mask = (__size < 32 ? 1 << __size : 0) - 1; \
                                                       ^  ~~~~~~
   1 warning and 1 error generated.
--
   In file included from drivers/mmc/core/sdio.c:23:
>> drivers/mmc/core/quirks.h:137:22: error: use of undeclared identifier 'CIF_MANFID_SANDISK2'
           MMC_FIXUP("DG4064", CIF_MANFID_SANDISK2, 0x100, add_quirk_mmc,
                               ^

1 error generated.

vim +/CIF_MANFID_SANDISK2 +137 drivers/mmc/core/quirks.h

    17	
    18	static const struct mmc_fixup __maybe_unused mmc_blk_fixups[] = {
    19	#define INAND_CMD38_ARG_EXT_CSD  113
    20	#define INAND_CMD38_ARG_ERASE    0x00
    21	#define INAND_CMD38_ARG_TRIM     0x01
    22	#define INAND_CMD38_ARG_SECERASE 0x80
    23	#define INAND_CMD38_ARG_SECTRIM1 0x81
    24	#define INAND_CMD38_ARG_SECTRIM2 0x88
    25		/* CMD38 argument is passed through EXT_CSD[113] */
    26		MMC_FIXUP("SEM02G", CID_MANFID_SANDISK, 0x100, add_quirk,
    27			  MMC_QUIRK_INAND_CMD38),
    28		MMC_FIXUP("SEM04G", CID_MANFID_SANDISK, 0x100, add_quirk,
    29			  MMC_QUIRK_INAND_CMD38),
    30		MMC_FIXUP("SEM08G", CID_MANFID_SANDISK, 0x100, add_quirk,
    31			  MMC_QUIRK_INAND_CMD38),
    32		MMC_FIXUP("SEM16G", CID_MANFID_SANDISK, 0x100, add_quirk,
    33			  MMC_QUIRK_INAND_CMD38),
    34		MMC_FIXUP("SEM32G", CID_MANFID_SANDISK, 0x100, add_quirk,
    35			  MMC_QUIRK_INAND_CMD38),
    36	
    37		/*
    38		 * Some MMC cards experience performance degradation with CMD23
    39		 * instead of CMD12-bounded multiblock transfers. For now we'll
    40		 * black list what's bad...
    41		 * - Certain Toshiba cards.
    42		 *
    43		 * N.B. This doesn't affect SD cards.
    44		 */
    45		MMC_FIXUP("SDMB-32", CID_MANFID_SANDISK, CID_OEMID_ANY, add_quirk_mmc,
    46			  MMC_QUIRK_BLK_NO_CMD23),
    47		MMC_FIXUP("SDM032", CID_MANFID_SANDISK, CID_OEMID_ANY, add_quirk_mmc,
    48			  MMC_QUIRK_BLK_NO_CMD23),
    49		MMC_FIXUP("MMC08G", CID_MANFID_TOSHIBA, CID_OEMID_ANY, add_quirk_mmc,
    50			  MMC_QUIRK_BLK_NO_CMD23),
    51		MMC_FIXUP("MMC16G", CID_MANFID_TOSHIBA, CID_OEMID_ANY, add_quirk_mmc,
    52			  MMC_QUIRK_BLK_NO_CMD23),
    53		MMC_FIXUP("MMC32G", CID_MANFID_TOSHIBA, CID_OEMID_ANY, add_quirk_mmc,
    54			  MMC_QUIRK_BLK_NO_CMD23),
    55	
    56		/*
    57		 * Kingston Canvas Go! Plus microSD cards never finish SD cache flush.
    58		 * This has so far only been observed on cards from 11/2019, while new
    59		 * cards from 2023/05 do not exhibit this behavior.
    60		 */
    61		_FIXUP_EXT("SD64G", CID_MANFID_KINGSTON_SD, 0x5449, 2019, 11,
    62			   0, -1ull, SDIO_ANY_ID, SDIO_ANY_ID, add_quirk_sd,
    63			   MMC_QUIRK_BROKEN_SD_CACHE, EXT_CSD_REV_ANY),
    64	
    65		/*
    66		 * Some SD cards lockup while using CMD23 multiblock transfers.
    67		 */
    68		MMC_FIXUP("AF SD", CID_MANFID_ATP, CID_OEMID_ANY, add_quirk_sd,
    69			  MMC_QUIRK_BLK_NO_CMD23),
    70		MMC_FIXUP("APUSD", CID_MANFID_APACER, 0x5048, add_quirk_sd,
    71			  MMC_QUIRK_BLK_NO_CMD23),
    72	
    73		/*
    74		 * Some MMC cards need longer data read timeout than indicated in CSD.
    75		 */
    76		MMC_FIXUP(CID_NAME_ANY, CID_MANFID_MICRON, 0x200, add_quirk_mmc,
    77			  MMC_QUIRK_LONG_READ_TIME),
    78		MMC_FIXUP("008GE0", CID_MANFID_TOSHIBA, CID_OEMID_ANY, add_quirk_mmc,
    79			  MMC_QUIRK_LONG_READ_TIME),
    80	
    81		/*
    82		 * On these Samsung MoviNAND parts, performing secure erase or
    83		 * secure trim can result in unrecoverable corruption due to a
    84		 * firmware bug.
    85		 */
    86		MMC_FIXUP("M8G2FA", CID_MANFID_SAMSUNG, CID_OEMID_ANY, add_quirk_mmc,
    87			  MMC_QUIRK_SEC_ERASE_TRIM_BROKEN),
    88		MMC_FIXUP("MAG4FA", CID_MANFID_SAMSUNG, CID_OEMID_ANY, add_quirk_mmc,
    89			  MMC_QUIRK_SEC_ERASE_TRIM_BROKEN),
    90		MMC_FIXUP("MBG8FA", CID_MANFID_SAMSUNG, CID_OEMID_ANY, add_quirk_mmc,
    91			  MMC_QUIRK_SEC_ERASE_TRIM_BROKEN),
    92		MMC_FIXUP("MCGAFA", CID_MANFID_SAMSUNG, CID_OEMID_ANY, add_quirk_mmc,
    93			  MMC_QUIRK_SEC_ERASE_TRIM_BROKEN),
    94		MMC_FIXUP("VAL00M", CID_MANFID_SAMSUNG, CID_OEMID_ANY, add_quirk_mmc,
    95			  MMC_QUIRK_SEC_ERASE_TRIM_BROKEN),
    96		MMC_FIXUP("VYL00M", CID_MANFID_SAMSUNG, CID_OEMID_ANY, add_quirk_mmc,
    97			  MMC_QUIRK_SEC_ERASE_TRIM_BROKEN),
    98		MMC_FIXUP("KYL00M", CID_MANFID_SAMSUNG, CID_OEMID_ANY, add_quirk_mmc,
    99			  MMC_QUIRK_SEC_ERASE_TRIM_BROKEN),
   100		MMC_FIXUP("VZL00M", CID_MANFID_SAMSUNG, CID_OEMID_ANY, add_quirk_mmc,
   101			  MMC_QUIRK_SEC_ERASE_TRIM_BROKEN),
   102	
   103		/*
   104		 *  On Some Kingston eMMCs, performing trim can result in
   105		 *  unrecoverable data conrruption occasionally due to a firmware bug.
   106		 */
   107		MMC_FIXUP("V10008", CID_MANFID_KINGSTON, CID_OEMID_ANY, add_quirk_mmc,
   108			  MMC_QUIRK_TRIM_BROKEN),
   109		MMC_FIXUP("V10016", CID_MANFID_KINGSTON, CID_OEMID_ANY, add_quirk_mmc,
   110			  MMC_QUIRK_TRIM_BROKEN),
   111	
   112		/*
   113		 * Micron MTFC4GACAJCN-1M supports TRIM but does not appear to support
   114		 * WRITE_ZEROES offloading. It also supports caching, but the cache can
   115		 * only be flushed after a write has occurred.
   116		 */
   117		MMC_FIXUP("Q2J54A", CID_MANFID_MICRON, 0x014e, add_quirk_mmc,
   118			  MMC_QUIRK_TRIM_BROKEN | MMC_QUIRK_BROKEN_CACHE_FLUSH),
   119	
   120		/*
   121		 * Kingston EMMC04G-M627 advertises TRIM but it does not seems to
   122		 * support being used to offload WRITE_ZEROES.
   123		 */
   124		MMC_FIXUP("M62704", CID_MANFID_KINGSTON, 0x0100, add_quirk_mmc,
   125			  MMC_QUIRK_TRIM_BROKEN),
   126	
   127		/*
   128		 * Some SD cards reports discard support while they don't
   129		 */
   130		MMC_FIXUP(CID_NAME_ANY, CID_MANFID_SANDISK_SD, 0x5344, add_quirk_sd,
   131			  MMC_QUIRK_BROKEN_SD_DISCARD),
   132	
   133		/*
   134		 * SanDisk iNAND 7250 DDG4064, this quirk shall disable the retune
   135		 * operation enforced by default when switching to RPMB.
   136		 */
 > 137		MMC_FIXUP("DG4064", CIF_MANFID_SANDISK2, 0x100, add_quirk_mmc,

138 MMC_QUIRK_BROKEN_RPMB_RETUNE),
139
140 END_FIXUP
141 };
142

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
#6 lore raw
In reply to Jorge Ramirez-Ortiz
kernel test robot noticed the following build errors:

Hi Jorge,

kernel test robot noticed the following build errors:

[auto build test ERROR on linus/master]
[also build test ERROR on v6.7-rc3 next-20231129]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Jorge-Ramirez-Ortiz/mmc-rpmb-add-quirk-MMC_QUIRK_BROKEN_RPMB_RETUNE/20231129-181517
base:   linus/master
patch link:    https://lore.kernel.org/r/20231129094350.2605322-1-jorge%40foundries.io
patch subject: [PATCH] mmc: rpmb: add quirk MMC_QUIRK_BROKEN_RPMB_RETUNE
config: x86_64-buildonly-randconfig-002-20231129 (https://download.01.org/0day-ci/archive/20231129/[email protected]/config)
compiler: gcc-11 (Debian 11.3.0-12) 11.3.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231129/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

In file included from drivers/mmc/core/sdio.c:20:

>> drivers/mmc/core/quirks.h:137:29: error: 'CIF_MANFID_SANDISK2' undeclared here (not in a function); did you mean 'CID_MANFID_SANDISK2'?
     137 |         MMC_FIXUP("DG4064", CIF_MANFID_SANDISK2, 0x100, add_quirk_mmc,
         |                             ^~~~~~~~~~~~~~~~~~~
   drivers/mmc/core/card.h:102:28: note: in definition of macro '_FIXUP_EXT'
     102 |                 .manfid = (_manfid),                    \
         |                            ^~~~~~~
   drivers/mmc/core/card.h:123:9: note: in expansion of macro 'MMC_FIXUP_REV'
     123 |         MMC_FIXUP_REV(_name, _manfid, _oemid, 0, -1ull, _fixup, _data,  \
         |         ^~~~~~~~~~~~~
   drivers/mmc/core/quirks.h:137:9: note: in expansion of macro 'MMC_FIXUP'
     137 |         MMC_FIXUP("DG4064", CIF_MANFID_SANDISK2, 0x100, add_quirk_mmc,
         |         ^~~~~~~~~

vim +137 drivers/mmc/core/quirks.h

    17	
    18	static const struct mmc_fixup __maybe_unused mmc_blk_fixups[] = {
    19	#define INAND_CMD38_ARG_EXT_CSD  113
    20	#define INAND_CMD38_ARG_ERASE    0x00
    21	#define INAND_CMD38_ARG_TRIM     0x01
    22	#define INAND_CMD38_ARG_SECERASE 0x80
    23	#define INAND_CMD38_ARG_SECTRIM1 0x81
    24	#define INAND_CMD38_ARG_SECTRIM2 0x88
    25		/* CMD38 argument is passed through EXT_CSD[113] */
    26		MMC_FIXUP("SEM02G", CID_MANFID_SANDISK, 0x100, add_quirk,
    27			  MMC_QUIRK_INAND_CMD38),
    28		MMC_FIXUP("SEM04G", CID_MANFID_SANDISK, 0x100, add_quirk,
    29			  MMC_QUIRK_INAND_CMD38),
    30		MMC_FIXUP("SEM08G", CID_MANFID_SANDISK, 0x100, add_quirk,
    31			  MMC_QUIRK_INAND_CMD38),
    32		MMC_FIXUP("SEM16G", CID_MANFID_SANDISK, 0x100, add_quirk,
    33			  MMC_QUIRK_INAND_CMD38),
    34		MMC_FIXUP("SEM32G", CID_MANFID_SANDISK, 0x100, add_quirk,
    35			  MMC_QUIRK_INAND_CMD38),
    36	
    37		/*
    38		 * Some MMC cards experience performance degradation with CMD23
    39		 * instead of CMD12-bounded multiblock transfers. For now we'll
    40		 * black list what's bad...
    41		 * - Certain Toshiba cards.
    42		 *
    43		 * N.B. This doesn't affect SD cards.
    44		 */
    45		MMC_FIXUP("SDMB-32", CID_MANFID_SANDISK, CID_OEMID_ANY, add_quirk_mmc,
    46			  MMC_QUIRK_BLK_NO_CMD23),
    47		MMC_FIXUP("SDM032", CID_MANFID_SANDISK, CID_OEMID_ANY, add_quirk_mmc,
    48			  MMC_QUIRK_BLK_NO_CMD23),
    49		MMC_FIXUP("MMC08G", CID_MANFID_TOSHIBA, CID_OEMID_ANY, add_quirk_mmc,
    50			  MMC_QUIRK_BLK_NO_CMD23),
    51		MMC_FIXUP("MMC16G", CID_MANFID_TOSHIBA, CID_OEMID_ANY, add_quirk_mmc,
    52			  MMC_QUIRK_BLK_NO_CMD23),
    53		MMC_FIXUP("MMC32G", CID_MANFID_TOSHIBA, CID_OEMID_ANY, add_quirk_mmc,
    54			  MMC_QUIRK_BLK_NO_CMD23),
    55	
    56		/*
    57		 * Kingston Canvas Go! Plus microSD cards never finish SD cache flush.
    58		 * This has so far only been observed on cards from 11/2019, while new
    59		 * cards from 2023/05 do not exhibit this behavior.
    60		 */
    61		_FIXUP_EXT("SD64G", CID_MANFID_KINGSTON_SD, 0x5449, 2019, 11,
    62			   0, -1ull, SDIO_ANY_ID, SDIO_ANY_ID, add_quirk_sd,
    63			   MMC_QUIRK_BROKEN_SD_CACHE, EXT_CSD_REV_ANY),
    64	
    65		/*
    66		 * Some SD cards lockup while using CMD23 multiblock transfers.
    67		 */
    68		MMC_FIXUP("AF SD", CID_MANFID_ATP, CID_OEMID_ANY, add_quirk_sd,
    69			  MMC_QUIRK_BLK_NO_CMD23),
    70		MMC_FIXUP("APUSD", CID_MANFID_APACER, 0x5048, add_quirk_sd,
    71			  MMC_QUIRK_BLK_NO_CMD23),
    72	
    73		/*
    74		 * Some MMC cards need longer data read timeout than indicated in CSD.
    75		 */
    76		MMC_FIXUP(CID_NAME_ANY, CID_MANFID_MICRON, 0x200, add_quirk_mmc,
    77			  MMC_QUIRK_LONG_READ_TIME),
    78		MMC_FIXUP("008GE0", CID_MANFID_TOSHIBA, CID_OEMID_ANY, add_quirk_mmc,
    79			  MMC_QUIRK_LONG_READ_TIME),
    80	
    81		/*
    82		 * On these Samsung MoviNAND parts, performing secure erase or
    83		 * secure trim can result in unrecoverable corruption due to a
    84		 * firmware bug.
    85		 */
    86		MMC_FIXUP("M8G2FA", CID_MANFID_SAMSUNG, CID_OEMID_ANY, add_quirk_mmc,
    87			  MMC_QUIRK_SEC_ERASE_TRIM_BROKEN),
    88		MMC_FIXUP("MAG4FA", CID_MANFID_SAMSUNG, CID_OEMID_ANY, add_quirk_mmc,
    89			  MMC_QUIRK_SEC_ERASE_TRIM_BROKEN),
    90		MMC_FIXUP("MBG8FA", CID_MANFID_SAMSUNG, CID_OEMID_ANY, add_quirk_mmc,
    91			  MMC_QUIRK_SEC_ERASE_TRIM_BROKEN),
    92		MMC_FIXUP("MCGAFA", CID_MANFID_SAMSUNG, CID_OEMID_ANY, add_quirk_mmc,
    93			  MMC_QUIRK_SEC_ERASE_TRIM_BROKEN),
    94		MMC_FIXUP("VAL00M", CID_MANFID_SAMSUNG, CID_OEMID_ANY, add_quirk_mmc,
    95			  MMC_QUIRK_SEC_ERASE_TRIM_BROKEN),
    96		MMC_FIXUP("VYL00M", CID_MANFID_SAMSUNG, CID_OEMID_ANY, add_quirk_mmc,
    97			  MMC_QUIRK_SEC_ERASE_TRIM_BROKEN),
    98		MMC_FIXUP("KYL00M", CID_MANFID_SAMSUNG, CID_OEMID_ANY, add_quirk_mmc,
    99			  MMC_QUIRK_SEC_ERASE_TRIM_BROKEN),
   100		MMC_FIXUP("VZL00M", CID_MANFID_SAMSUNG, CID_OEMID_ANY, add_quirk_mmc,
   101			  MMC_QUIRK_SEC_ERASE_TRIM_BROKEN),
   102	
   103		/*
   104		 *  On Some Kingston eMMCs, performing trim can result in
   105		 *  unrecoverable data conrruption occasionally due to a firmware bug.
   106		 */
   107		MMC_FIXUP("V10008", CID_MANFID_KINGSTON, CID_OEMID_ANY, add_quirk_mmc,
   108			  MMC_QUIRK_TRIM_BROKEN),
   109		MMC_FIXUP("V10016", CID_MANFID_KINGSTON, CID_OEMID_ANY, add_quirk_mmc,
   110			  MMC_QUIRK_TRIM_BROKEN),
   111	
   112		/*
   113		 * Micron MTFC4GACAJCN-1M supports TRIM but does not appear to support
   114		 * WRITE_ZEROES offloading. It also supports caching, but the cache can
   115		 * only be flushed after a write has occurred.
   116		 */
   117		MMC_FIXUP("Q2J54A", CID_MANFID_MICRON, 0x014e, add_quirk_mmc,
   118			  MMC_QUIRK_TRIM_BROKEN | MMC_QUIRK_BROKEN_CACHE_FLUSH),
   119	
   120		/*
   121		 * Kingston EMMC04G-M627 advertises TRIM but it does not seems to
   122		 * support being used to offload WRITE_ZEROES.
   123		 */
   124		MMC_FIXUP("M62704", CID_MANFID_KINGSTON, 0x0100, add_quirk_mmc,
   125			  MMC_QUIRK_TRIM_BROKEN),
   126	
   127		/*
   128		 * Some SD cards reports discard support while they don't
   129		 */
   130		MMC_FIXUP(CID_NAME_ANY, CID_MANFID_SANDISK_SD, 0x5344, add_quirk_sd,
   131			  MMC_QUIRK_BROKEN_SD_DISCARD),
   132	
   133		/*
   134		 * SanDisk iNAND 7250 DDG4064, this quirk shall disable the retune
   135		 * operation enforced by default when switching to RPMB.
   136		 */
 > 137		MMC_FIXUP("DG4064", CIF_MANFID_SANDISK2, 0x100, add_quirk_mmc,

138 MMC_QUIRK_BROKEN_RPMB_RETUNE),
139
140 END_FIXUP
141 };
142

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki