All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] mmc: mmc_test: use erase_arg for mmc_erase command
@ 2021-02-09 14:52 yann.gautier
  2021-02-12 12:20 ` Ulf Hansson
  0 siblings, 1 reply; 2+ messages in thread
From: yann.gautier @ 2021-02-09 14:52 UTC (permalink / raw)
  To: ulf.hansson
  Cc: linux, linus.walleij, ludovic.barre, adrian.hunter, marex,
	linux-mmc, linux-kernel, yann.gautier

From: Yann Gautier <yann.gautier@foss.st.com>

Since [1], the erase argument for mmc_erase() function is saved in
erase_arg field of card structure. It is preferable to use it instead of
hard-coded MMC_SECURE_ERASE_ARG, which from eMMC 4.51 spec is not
recommended:
"6.6.16 Secure Erase
NOTE Secure Erase is included for backwards compatibility. New system
level implementations (based on v4.51 devices and beyond) should use
Erase combined with Sanitize instead of secure erase."

On STM32MP157C-EV1 board, embedding a THGBMDG5D1LBAIL eMMC, using
MMC_ERASE command with MMC_SECURE_ERASE_ARG may stuck the STM32 SDMMC IP,
if test 37 or test 38 are launched just after a write test, e.g. test 36.
Using the default MMC_ERASE argument from framework with erase_arg,
which default in our case to MMC_DISCARD_ARG does no more trig the
issue.

 [1] commit 01904ff77676 ("mmc: core: Calculate the discard arg only once")

Signed-off-by: Yann Gautier <yann.gautier@foss.st.com>
---

Changes in v2:
- Drop patch 1 from the previous series
- Update comment

 drivers/mmc/core/mmc_test.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mmc/core/mmc_test.c b/drivers/mmc/core/mmc_test.c
index 39a478874ca3..63524551a13a 100644
--- a/drivers/mmc/core/mmc_test.c
+++ b/drivers/mmc/core/mmc_test.c
@@ -2110,7 +2110,7 @@ static int mmc_test_rw_multiple(struct mmc_test_card *test,
 	if (mmc_can_erase(test->card) &&
 	    tdata->prepare & MMC_TEST_PREP_ERASE) {
 		ret = mmc_erase(test->card, dev_addr,
-				size / 512, MMC_SECURE_ERASE_ARG);
+				size / 512, test->card->erase_arg);
 		if (ret)
 			ret = mmc_erase(test->card, dev_addr,
 					size / 512, MMC_ERASE_ARG);
-- 
2.17.1


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

* Re: [PATCH v2] mmc: mmc_test: use erase_arg for mmc_erase command
  2021-02-09 14:52 [PATCH v2] mmc: mmc_test: use erase_arg for mmc_erase command yann.gautier
@ 2021-02-12 12:20 ` Ulf Hansson
  0 siblings, 0 replies; 2+ messages in thread
From: Ulf Hansson @ 2021-02-12 12:20 UTC (permalink / raw)
  To: Yann Gautier
  Cc: Russell King, Linus Walleij, ludovic.barre, Adrian Hunter,
	Marek Vašut, linux-mmc, Linux Kernel Mailing List

On Tue, 9 Feb 2021 at 15:52, <yann.gautier@foss.st.com> wrote:
>
> From: Yann Gautier <yann.gautier@foss.st.com>
>
> Since [1], the erase argument for mmc_erase() function is saved in
> erase_arg field of card structure. It is preferable to use it instead of
> hard-coded MMC_SECURE_ERASE_ARG, which from eMMC 4.51 spec is not
> recommended:
> "6.6.16 Secure Erase
> NOTE Secure Erase is included for backwards compatibility. New system
> level implementations (based on v4.51 devices and beyond) should use
> Erase combined with Sanitize instead of secure erase."
>
> On STM32MP157C-EV1 board, embedding a THGBMDG5D1LBAIL eMMC, using
> MMC_ERASE command with MMC_SECURE_ERASE_ARG may stuck the STM32 SDMMC IP,
> if test 37 or test 38 are launched just after a write test, e.g. test 36.
> Using the default MMC_ERASE argument from framework with erase_arg,
> which default in our case to MMC_DISCARD_ARG does no more trig the
> issue.
>
>  [1] commit 01904ff77676 ("mmc: core: Calculate the discard arg only once")
>
> Signed-off-by: Yann Gautier <yann.gautier@foss.st.com>

Applied for next, and by adding Adrian's ack from the previous version, thanks!

Kind regards
Uffe


> ---
>
> Changes in v2:
> - Drop patch 1 from the previous series
> - Update comment
>
>  drivers/mmc/core/mmc_test.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/core/mmc_test.c b/drivers/mmc/core/mmc_test.c
> index 39a478874ca3..63524551a13a 100644
> --- a/drivers/mmc/core/mmc_test.c
> +++ b/drivers/mmc/core/mmc_test.c
> @@ -2110,7 +2110,7 @@ static int mmc_test_rw_multiple(struct mmc_test_card *test,
>         if (mmc_can_erase(test->card) &&
>             tdata->prepare & MMC_TEST_PREP_ERASE) {
>                 ret = mmc_erase(test->card, dev_addr,
> -                               size / 512, MMC_SECURE_ERASE_ARG);
> +                               size / 512, test->card->erase_arg);
>                 if (ret)
>                         ret = mmc_erase(test->card, dev_addr,
>                                         size / 512, MMC_ERASE_ARG);
> --
> 2.17.1
>

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

end of thread, other threads:[~2021-02-12 12:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-09 14:52 [PATCH v2] mmc: mmc_test: use erase_arg for mmc_erase command yann.gautier
2021-02-12 12:20 ` Ulf Hansson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.