diff mbox series

[2/2] mmc: mmc_test: use erase_arg for mmc_erase command

Message ID 20210204120547.15381-3-yann.gautier@foss.st.com (mailing list archive)
State New, archived
Headers show
Series mmc: mmci/mmc_test: update mmc_erase management | expand

Commit Message

Yann Gautier Feb. 4, 2021, 12:05 p.m. UTC
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."

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

Signed-off-by: Yann Gautier <yann.gautier@foss.st.com>
---
 drivers/mmc/core/mmc_test.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Adrian Hunter Feb. 5, 2021, 6:33 a.m. UTC | #1
On 4/02/21 2:05 pm, 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."
> 
>  [1] commit 01904ff77676 ("mmc: core: Calculate the discard arg only once")
> 

Did you experience an issue because of this?  You could add that to the
commit message.

There does not seem to be a need for secure erase, so:

Acked-by: Adrian Hunter <adrian.hunter@intel.com>


> Signed-off-by: Yann Gautier <yann.gautier@foss.st.com>
> ---
>  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);
>
Yann Gautier Feb. 5, 2021, 9:05 a.m. UTC | #2
On 2/5/21 7:33 AM, Adrian Hunter wrote:
> On 4/02/21 2:05 pm, 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."
>>
>>   [1] commit 01904ff77676 ("mmc: core: Calculate the discard arg only once")
>>
> 
> Did you experience an issue because of this?  You could add that to the
> commit message.

Hi Adrian,

Thanks for the review!
Yes, I've seen an issue on STM32MP157C-EV1 board.
After a write test (e.g. test 36), the tests 37 or 38, using mmc_erase 
fail. With the erase argument used by default in the framework 
(MMC_DISCARD_ARG), I can no more see this.

I can send a new version of the series with comment update here, and a 
fixup on the first patch.


Regards,
Yann

> 
> There does not seem to be a need for secure erase, so:
> 
> Acked-by: Adrian Hunter <adrian.hunter@intel.com>
> 
> 
>> Signed-off-by: Yann Gautier <yann.gautier@foss.st.com>
>> ---
>>   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);
>>
>
diff mbox series

Patch

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);