public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mmc: rpmb: do not force a retune before RPMB switch
@ 2023-12-04 15:01 Jorge Ramirez-Ortiz
  2023-12-04 16:22 ` Avri Altman
                   ` (3 more replies)
  0 siblings, 4 replies; 34+ messages in thread
From: Jorge Ramirez-Ortiz @ 2023-12-04 15:01 UTC (permalink / raw)
  To: jorge, adrian.hunter, Avri.Altman, ulf.hansson, christian.loehle
  Cc: jinpu.wang, axboe, beanhuo, yibin.ding, victor.shih, asuk4.q,
	hkallweit1, yangyingliang, yebin10, linux-mmc, linux-kernel

Requesting a retune before switching to the RPMB partition has been
observed to cause CRC errors on the RPMB reads (-EILSEQ).

Since RPMB reads can not be retried, the clients would be directly
affected by the errors.

This commit disables the request prior to RPMB switching while allowing
the pause interface to still request a retune before the pause for other
use cases.

This was verified with the sdhci-of-arasan driver (ZynqMP) configured
for HS200 using two separate eMMC cards (DG4064 and 064GB2). In both
cases, the error was easy to reproduce triggering every few tenths of
reads.

Signed-off-by: Jorge Ramirez-Ortiz <jorge@foundries.io>
---
 drivers/mmc/core/block.c | 2 +-
 drivers/mmc/core/host.c  | 7 ++++---
 drivers/mmc/core/host.h  | 2 +-
 3 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c
index f9a5cffa64b1..1d69078ad9b2 100644
--- a/drivers/mmc/core/block.c
+++ b/drivers/mmc/core/block.c
@@ -859,7 +859,7 @@ static int mmc_blk_part_switch_pre(struct mmc_card *card,
 			if (ret)
 				return ret;
 		}
-		mmc_retune_pause(card->host);
+		mmc_retune_pause(card->host, false);
 	}
 
 	return ret;
diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c
index 096093f7be00..a9b95aaa2235 100644
--- a/drivers/mmc/core/host.c
+++ b/drivers/mmc/core/host.c
@@ -119,13 +119,14 @@ void mmc_retune_enable(struct mmc_host *host)
 
 /*
  * Pause re-tuning for a small set of operations.  The pause begins after the
- * next command and after first doing re-tuning.
+ * next command and, if retune is set, after first doing re-tuning.
  */
-void mmc_retune_pause(struct mmc_host *host)
+void mmc_retune_pause(struct mmc_host *host, bool retune)
 {
 	if (!host->retune_paused) {
 		host->retune_paused = 1;
-		mmc_retune_needed(host);
+		if (retune)
+			mmc_retune_needed(host);
 		mmc_retune_hold(host);
 	}
 }
diff --git a/drivers/mmc/core/host.h b/drivers/mmc/core/host.h
index 48c4952512a5..321776b52270 100644
--- a/drivers/mmc/core/host.h
+++ b/drivers/mmc/core/host.h
@@ -18,7 +18,7 @@ void mmc_retune_disable(struct mmc_host *host);
 void mmc_retune_hold(struct mmc_host *host);
 void mmc_retune_release(struct mmc_host *host);
 int mmc_retune(struct mmc_host *host);
-void mmc_retune_pause(struct mmc_host *host);
+void mmc_retune_pause(struct mmc_host *host, bool retune);
 void mmc_retune_unpause(struct mmc_host *host);
 
 static inline void mmc_retune_clear(struct mmc_host *host)
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 34+ messages in thread
* [PATCH] mmc: rpmb: do not force a retune before RPMB switch
@ 2023-12-04 17:22 Jorge Ramirez-Ortiz
  2023-12-04 17:52 ` Christian Loehle
  2023-12-11 16:17 ` Adrian Hunter
  0 siblings, 2 replies; 34+ messages in thread
From: Jorge Ramirez-Ortiz @ 2023-12-04 17:22 UTC (permalink / raw)
  To: jorge, Avri.Altman, adrian.hunter, ulf.hansson, christian.loehle
  Cc: linux-kernel, linux-mmc

Requesting a retune before switching to the RPMB partition has been
observed to cause CRC errors on the RPMB reads (-EILSEQ).

Since RPMB reads can not be retried, the clients would be directly
affected by the errors.

This commit disables the request prior to RPMB switching while allowing
the pause interface to still request a retune before the pause for other
use cases.

This was verified with the sdhci-of-arasan driver (ZynqMP) configured
for HS200 using two separate eMMC cards (DG4064 and 064GB2). In both
cases, the error was easy to reproduce triggering every few tenths of
reads.

Signed-off-by: Jorge Ramirez-Ortiz <jorge@foundries.io>
Acked-by: Avri Altman <avri.altman@wdc.com>

---
 drivers/mmc/core/block.c | 2 +-
 drivers/mmc/core/host.c  | 7 ++++---
 drivers/mmc/core/host.h  | 2 +-
 3 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c
index f9a5cffa64b1..1d69078ad9b2 100644
--- a/drivers/mmc/core/block.c
+++ b/drivers/mmc/core/block.c
@@ -859,7 +859,7 @@ static int mmc_blk_part_switch_pre(struct mmc_card *card,
 			if (ret)
 				return ret;
 		}
-		mmc_retune_pause(card->host);
+		mmc_retune_pause(card->host, false);
 	}

 	return ret;
diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c
index 096093f7be00..a9b95aaa2235 100644
--- a/drivers/mmc/core/host.c
+++ b/drivers/mmc/core/host.c
@@ -119,13 +119,14 @@ void mmc_retune_enable(struct mmc_host *host)

 /*
  * Pause re-tuning for a small set of operations.  The pause begins after the
- * next command and after first doing re-tuning.
+ * next command and, if retune is set, after first doing re-tuning.
  */
-void mmc_retune_pause(struct mmc_host *host)
+void mmc_retune_pause(struct mmc_host *host, bool retune)
 {
 	if (!host->retune_paused) {
 		host->retune_paused = 1;
-		mmc_retune_needed(host);
+		if (retune)
+			mmc_retune_needed(host);
 		mmc_retune_hold(host);
 	}
 }
diff --git a/drivers/mmc/core/host.h b/drivers/mmc/core/host.h
index 48c4952512a5..321776b52270 100644
--- a/drivers/mmc/core/host.h
+++ b/drivers/mmc/core/host.h
@@ -18,7 +18,7 @@ void mmc_retune_disable(struct mmc_host *host);
 void mmc_retune_hold(struct mmc_host *host);
 void mmc_retune_release(struct mmc_host *host);
 int mmc_retune(struct mmc_host *host);
-void mmc_retune_pause(struct mmc_host *host);
+void mmc_retune_pause(struct mmc_host *host, bool retune);
 void mmc_retune_unpause(struct mmc_host *host);

 static inline void mmc_retune_clear(struct mmc_host *host)
--
2.34.1

^ permalink raw reply related	[flat|nested] 34+ messages in thread
* [PATCH] mmc: rpmb: do not force a retune before RPMB switch
@ 2023-12-11 16:55 Jorge Ramirez-Ortiz
  2024-01-03  8:08 ` Adrian Hunter
  2024-01-03 10:35 ` Ulf Hansson
  0 siblings, 2 replies; 34+ messages in thread
From: Jorge Ramirez-Ortiz @ 2023-12-11 16:55 UTC (permalink / raw)
  To: jorge, adrian.hunter, Avri.Altman, ulf.hansson, christian.loehle,
	ricardo
  Cc: linux-kernel, linux-mmc

Requesting a retune before switching to the RPMB partition has been
observed to cause CRC errors on the RPMB reads (-EILSEQ).

Since RPMB reads can not be retried, the clients would be directly
affected by the errors.

This commit disables the retune request prior to switching to the RPMB
partition: mmc_retune_pause() no longer triggers a retune before the
pause period begins.

This was verified with the sdhci-of-arasan driver (ZynqMP) configured
for HS200 using two separate eMMC cards (DG4064 and 064GB2). In both
cases, the error was easy to reproduce triggering every few tenths of
reads.

Signed-off-by: Jorge Ramirez-Ortiz <jorge@foundries.io>
Acked-by: Avri Altman <avri.altman@wdc.com>
---
 v2:
    mmc_retune_pause() no longer can trigger a retune.
    Keeping Avri Altman Acked-by since they are functionally equivalent.
 v1:
    modify mmc_retune_pause to optionally trigger a retune.

 drivers/mmc/core/host.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c
index 096093f7be00..ed44920e92df 100644
--- a/drivers/mmc/core/host.c
+++ b/drivers/mmc/core/host.c
@@ -119,13 +119,12 @@ void mmc_retune_enable(struct mmc_host *host)

 /*
  * Pause re-tuning for a small set of operations.  The pause begins after the
- * next command and after first doing re-tuning.
+ * next command.
  */
 void mmc_retune_pause(struct mmc_host *host)
 {
 	if (!host->retune_paused) {
 		host->retune_paused = 1;
-		mmc_retune_needed(host);
 		mmc_retune_hold(host);
 	}
 }
--
2.34.1

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

end of thread, other threads:[~2024-01-05 13:01 UTC | newest]

Thread overview: 34+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-04 15:01 [PATCH] mmc: rpmb: do not force a retune before RPMB switch Jorge Ramirez-Ortiz
2023-12-04 16:22 ` Avri Altman
2023-12-04 17:58 ` Avri Altman
2023-12-04 18:14   ` Jorge Ramirez-Ortiz, Foundries
2023-12-05 16:10     ` Jorge Ramirez-Ortiz, Foundries
2023-12-05 20:12 ` Adrian Hunter
2023-12-05 20:14   ` Adrian Hunter
2023-12-06  7:02   ` Avri Altman
2023-12-06 10:00     ` Jorge Ramirez-Ortiz, Foundries
2023-12-11  8:00       ` Jorge Ramirez-Ortiz, Foundries
2023-12-11 10:25         ` Adrian Hunter
2023-12-11 11:06           ` Jorge Ramirez-Ortiz, Foundries
2023-12-11 11:32             ` Adrian Hunter
2023-12-11 15:05               ` Jorge Ramirez-Ortiz, Foundries
2023-12-14  9:15                 ` Adrian Hunter
2023-12-14 11:16                   ` Jorge Ramirez-Ortiz, Foundries
2024-01-02 10:41         ` Jorge Ramirez-Ortiz, Foundries
2024-01-02 19:01           ` Adrian Hunter
2024-01-02 22:01             ` Jorge Ramirez-Ortiz, Foundries
2024-01-03  8:03               ` Adrian Hunter
2024-01-03  9:20                 ` Jorge Ramirez-Ortiz, Foundries
2024-01-04 18:34                   ` Adrian Hunter
2024-01-05  8:49                     ` Jorge Ramirez-Ortiz, Foundries
2024-01-05 13:00                       ` Michal Simek
2023-12-11  8:03     ` Adrian Hunter
2024-01-02 19:02 ` Adrian Hunter
2024-01-03  8:08   ` Adrian Hunter
  -- strict thread matches above, loose matches on Subject: below --
2023-12-04 17:22 Jorge Ramirez-Ortiz
2023-12-04 17:52 ` Christian Loehle
2023-12-04 18:10   ` Jorge Ramirez-Ortiz, Foundries
2023-12-11 16:17 ` Adrian Hunter
2023-12-11 16:55 Jorge Ramirez-Ortiz
2024-01-03  8:08 ` Adrian Hunter
2024-01-03 10:35 ` Ulf Hansson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox