diff mbox

mmc: block: disable the reliable write If the card does not support CMD23

Message ID 1439537446-7713-1-git-send-email-sdliyong@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Yong Li Aug. 14, 2015, 7:30 a.m. UTC
From: Yong Li <sdliyong@gmail.com>

Signed-off-by: Yong Li <sdliyong@gmail.com>
---
 drivers/mmc/card/block.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Shawn Lin Aug. 14, 2015, 8:13 a.m. UTC | #1
? 2015/8/14 15:30, sdliyong@gmail.com ??:
> From: Yong Li <sdliyong@gmail.com>
>
> Signed-off-by: Yong Li <sdliyong@gmail.com>
> ---
>   drivers/mmc/card/block.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
> index 452782b..d9e3c45 100644
> --- a/drivers/mmc/card/block.c
> +++ b/drivers/mmc/card/block.c
> @@ -1366,7 +1366,8 @@ static void mmc_blk_rw_rq_prep(struct mmc_queue_req *mqrq,
>   	bool do_rel_wr = ((req->cmd_flags & REQ_FUA) ||
>   			  (req->cmd_flags & REQ_META)) &&
>   		(rq_data_dir(req) == WRITE) &&
> -		(md->flags & MMC_BLK_REL_WR);
> +		(md->flags & MMC_BLK_REL_WR) &&
> +		!(card->quirks & MMC_QUIRK_BLK_NO_CMD23);

Hi Yong,

pls check that code below.

MMC_BLK_REL_WR will not be enabled if we know this card CANNOT support 
CMD23 form SCR. AND? "card->quirks & MMC_QUIRK_BLK_NO_CMD23" would be 
checked here as well. So I think your code is unnecessary.

if ((md->flags & MMC_BLK_CMD23) && mmc_op_multi(brq->cmd.opcode) &&
	    (do_rel_wr || !(card->quirks & MMC_QUIRK_BLK_NO_CMD23) ||
	     do_data_tag)) {
		brq->sbc.opcode = MMC_SET_BLOCK_COUNT;
		brq->sbc.arg = brq->data.blocks |
			(do_rel_wr ? (1 << 31) : 0) |
			(do_data_tag ? (1 << 29) : 0);
		brq->sbc.flags =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in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Shawn Lin Aug. 17, 2015, 6:48 a.m. UTC | #3
On 2015/8/15 20:14, LIYONG wrote:
> Thanks Shawn. Please help to check the below in the mmc_blk_rw_rq_prep:
> 	if (do_rel_wr)
> 		mmc_apply_rel_rw(brq, card, req);
>
> I think we need to set the do_rel_wr to false( at the beginning of this function) if the card does not support the CMD23. The above code is executed before the "if ((md->flags & MMC_BLK_CMD23)" code.
>

ok, it makes sense.:)

> Thanks,
> Yong Li
> ----------------------------------------
>> Subject: Re: [PATCH] mmc: block: disable the reliable write If the card does not support CMD23
>> To: sdliyong@gmail.com; chris@printf.net; ulf.hansson@linaro.org; linux-mmc@vger.kernel.org; linux-kernel@vger.kernel.org
>> CC: shawn.lin@rock-chips.com
>> From: shawn.lin@rock-chips.com
>> Date: Fri, 14 Aug 2015 16:13:02 +0800
>>
>> ? 2015/8/14 15:30, sdliyong@gmail.com ??:
>>> From: Yong Li <sdliyong@gmail.com>
>>>
>>> Signed-off-by: Yong Li <sdliyong@gmail.com>
>>> ---
>>> drivers/mmc/card/block.c | 3 ++-
>>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
>>> index 452782b..d9e3c45 100644
>>> --- a/drivers/mmc/card/block.c
>>> +++ b/drivers/mmc/card/block.c
>>> @@ -1366,7 +1366,8 @@ static void mmc_blk_rw_rq_prep(struct mmc_queue_req *mqrq,
>>> bool do_rel_wr = ((req->cmd_flags & REQ_FUA) ||
>>> (req->cmd_flags & REQ_META)) &&
>>> (rq_data_dir(req) == WRITE) &&
>>> - (md->flags & MMC_BLK_REL_WR);
>>> + (md->flags & MMC_BLK_REL_WR) &&
>>> + !(card->quirks & MMC_QUIRK_BLK_NO_CMD23);
>>
>> Hi Yong,
>>
>> pls check that code below.
>>
>> MMC_BLK_REL_WR will not be enabled if we know this card CANNOT support
>> CMD23 form SCR. AND? "card->quirks & MMC_QUIRK_BLK_NO_CMD23" would be
>> checked here as well. So I think your code is unnecessary.
>>
>> if ((md->flags & MMC_BLK_CMD23) && mmc_op_multi(brq->cmd.opcode) &&
>> (do_rel_wr || !(card->quirks & MMC_QUIRK_BLK_NO_CMD23) ||
>> do_data_tag)) {
>> brq->sbc.opcode = MMC_SET_BLOCK_COUNT;
>> brq->sbc.arg = brq->data.blocks |
>> (do_rel_wr ? (1 << 31) : 0) |
>> (do_data_tag ? (1 << 29) : 0);
>> brq->sbc.flags = MMC_RSP_R1 | MMC_CMD_AC;
>> brq->mrq.sbc = &brq->sbc;
>> }
>>
>> Thanks.
>> Shawn
>>
>>>
>>> memset(brq, 0, sizeof(struct mmc_blk_request));
>>> brq->mrq.cmd = &brq->cmd;
>>>
>>
>>
>> --
>> Shawn Lin
>>
>   		 	   		  N?????r??y???b?X???v?^?)?{.n?+????{??g"??^n?r???z???h????&???G???h?(????j"???m?????z?????f???h???~?mml==
>
Ulf Hansson Aug. 25, 2015, 12:06 p.m. UTC | #4
On 14 August 2015 at 09:30,  <sdliyong@gmail.com> wrote:
> From: Yong Li <sdliyong@gmail.com>
>
> Signed-off-by: Yong Li <sdliyong@gmail.com>
> ---
>  drivers/mmc/card/block.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
> index 452782b..d9e3c45 100644
> --- a/drivers/mmc/card/block.c
> +++ b/drivers/mmc/card/block.c
> @@ -1366,7 +1366,8 @@ static void mmc_blk_rw_rq_prep(struct mmc_queue_req *mqrq,
>         bool do_rel_wr = ((req->cmd_flags & REQ_FUA) ||
>                           (req->cmd_flags & REQ_META)) &&
>                 (rq_data_dir(req) == WRITE) &&
> -               (md->flags & MMC_BLK_REL_WR);
> +               (md->flags & MMC_BLK_REL_WR) &&
> +               !(card->quirks & MMC_QUIRK_BLK_NO_CMD23);

Further down in mmc_blk_rw_rq_prep() we check for
MMC_QUIRK_BLK_NO_CMD23. That check becomes redundant after this
change, please remove that check as a part of this patch as well.

>
>         memset(brq, 0, sizeof(struct mmc_blk_request));
>         brq->mrq.cmd = &brq->cmd;
> --
> 2.1.0
>

Kind regards
Uffe
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Yong Li Aug. 26, 2015, 6:15 a.m. UTC | #5
Hi Uffe,

The bool variable do_rel_wr is used on line 1408 and line 1436:
if (brq->data.blocks> 1 || do_rel_wr) {
		/* SPI multiblock writes terminate using a special
		 * token, not a STOP_TRANSMISSION request.
		 */

	if (do_rel_wr)
		mmc_apply_rel_rw(brq, card, req);

If a card does not support CMD23, I think we need to set the do_rel_wr to false at the beginning of this mmc_blk_rw_rq_prep function

Thanks,
Yong Li
----------------------------------------
> Date: Tue, 25 Aug 2015 14:06:43 +0200
> Subject: Re: [PATCH] mmc: block: disable the reliable write If the card does not support CMD23
> From: ulf.hansson@linaro.org
> To: sdliyong@gmail.com
> CC: chris@printf.net; linux-mmc@vger.kernel.org; linux-kernel@vger.kernel.org
>
> On 14 August 2015 at 09:30, <sdliyong@gmail.com> wrote:
>> From: Yong Li <sdliyong@gmail.com>
>>
>> Signed-off-by: Yong Li <sdliyong@gmail.com>
>> ---
>> drivers/mmc/card/block.c | 3 ++-
>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
>> index 452782b..d9e3c45 100644
>> --- a/drivers/mmc/card/block.c
>> +++ b/drivers/mmc/card/block.c
>> @@ -1366,7 +1366,8 @@ static void mmc_blk_rw_rq_prep(struct mmc_queue_req *mqrq,
>> bool do_rel_wr = ((req->cmd_flags & REQ_FUA) ||
>> (req->cmd_flags & REQ_META)) &&
>> (rq_data_dir(req) == WRITE) &&
>> - (md->flags & MMC_BLK_REL_WR);
>> + (md->flags & MMC_BLK_REL_WR) &&
>> + !(card->quirks & MMC_QUIRK_BLK_NO_CMD23);
>
> Further down in mmc_blk_rw_rq_prep() we check for
> MMC_QUIRK_BLK_NO_CMD23. That check becomes redundant after this
> change, please remove that check as a part of this patch as well.
>
>>
>> memset(brq, 0, sizeof(struct mmc_blk_request));
>> brq->mrq.cmd = &brq->cmd;
>> --
>> 2.1.0
>>
>
> Kind regards
> Uffe
 		 	   		  --
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Shawn Lin Aug. 26, 2015, 7:20 a.m. UTC | #6
On 2015/8/26 14:15, LIYONG wrote:
> Hi Uffe,
>
> The bool variable do_rel_wr is used on line 1408 and line 1436:
> if (brq->data.blocks> 1 || do_rel_wr) {
> 		/* SPI multiblock writes terminate using a special
> 		 * token, not a STOP_TRANSMISSION request.
> 		 */
>
> 	if (do_rel_wr)
> 		mmc_apply_rel_rw(brq, card, req);
>
> If a card does not support CMD23, I think we need to set the do_rel_wr to false at the beginning of this mmc_blk_rw_rq_prep function

Hi Yong,

You miss the point, Ulf means you should remove
"(do_rel_wr || !(card->quirks & MMC_QUIRK_BLK_NO_CMD23)" as well.

No need to check card->quirks & MMC_QUIRK_BLK_NO_CMD23 twice, you have 
did it while checking do_rel_wr, right?

bool do_rel_wr = ((req->cmd_flags & REQ_FUA) ||
(req->cmd_flags & REQ_META)) &&
(rq_data_dir(req) == WRITE) &&
- (md->flags & MMC_BLK_REL_WR);
+ (md->flags & MMC_BLK_REL_WR) &&
+ !(card->quirks & MMC_QUIRK_BLK_NO_CMD23);

>
> Thanks,
> Yong Li
> ----------------------------------------
>> Date: Tue, 25 Aug 2015 14:06:43 +0200
>> Subject: Re: [PATCH] mmc: block: disable the reliable write If the card does not support CMD23
>> From: ulf.hansson@linaro.org
>> To: sdliyong@gmail.com
>> CC: chris@printf.net; linux-mmc@vger.kernel.org; linux-kernel@vger.kernel.org
>>
>> On 14 August 2015 at 09:30, <sdliyong@gmail.com> wrote:
>>> From: Yong Li <sdliyong@gmail.com>
>>>
>>> Signed-off-by: Yong Li <sdliyong@gmail.com>
>>> ---
>>> drivers/mmc/card/block.c | 3 ++-
>>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
>>> index 452782b..d9e3c45 100644
>>> --- a/drivers/mmc/card/block.c
>>> +++ b/drivers/mmc/card/block.c
>>> @@ -1366,7 +1366,8 @@ static void mmc_blk_rw_rq_prep(struct mmc_queue_req *mqrq,
>>> bool do_rel_wr = ((req->cmd_flags & REQ_FUA) ||
>>> (req->cmd_flags & REQ_META)) &&
>>> (rq_data_dir(req) == WRITE) &&
>>> - (md->flags & MMC_BLK_REL_WR);
>>> + (md->flags & MMC_BLK_REL_WR) &&
>>> + !(card->quirks & MMC_QUIRK_BLK_NO_CMD23);
>>
>> Further down in mmc_blk_rw_rq_prep() we check for
>> MMC_QUIRK_BLK_NO_CMD23. That check becomes redundant after this
>> change, please remove that check as a part of this patch as well.
>>
>>>
>>> memset(brq, 0, sizeof(struct mmc_blk_request));
>>> brq->mrq.cmd = &brq->cmd;
>>> --
>>> 2.1.0
>>>
>>
>> Kind regards
>> Uffe
>   		 	   		  --
> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
>
>
Yong Li Aug. 26, 2015, 12:38 p.m. UTC | #7
Thanks Shawn. I got your point. You mean we can remove the || !(card->quirks & MMC_QUIRK_BLK_NO_CMD23) at line 1468.

But considering this case: The do_rel_wr = false and the card does support CMD23.
do_rel_wr = false; 
!(card->quirks & MMC_QUIRK_BLK_NO_CMD23) = true;

At line 1468, do_rel_wr || !(card->quirks & MMC_QUIRK_BLK_NO_CMD23) should be true;

If re remove the || !(card->quirks & MMC_QUIRK_BLK_NO_CMD23), it will be false

It seems that we cannot modify the line 1468?

Thanks,
Yong Li
----------------------------------------
> Subject: Re: [PATCH] mmc: block: disable the reliable write If the card does not support CMD23
> To: sdliyong@gmail.com; ulf.hansson@linaro.org
> CC: shawn.lin@rock-chips.com; chris@printf.net; linux-mmc@vger.kernel.org; linux-kernel@vger.kernel.org
> From: shawn.lin@rock-chips.com
> Date: Wed, 26 Aug 2015 15:20:11 +0800
>
> On 2015/8/26 14:15, LIYONG wrote:
>> Hi Uffe,
>>
>> The bool variable do_rel_wr is used on line 1408 and line 1436:
>> if (brq->data.blocks> 1 || do_rel_wr) {
>> /* SPI multiblock writes terminate using a special
>> * token, not a STOP_TRANSMISSION request.
>> */
>>
>> if (do_rel_wr)
>> mmc_apply_rel_rw(brq, card, req);
>>
>> If a card does not support CMD23, I think we need to set the do_rel_wr to false at the beginning of this mmc_blk_rw_rq_prep function
>
> Hi Yong,
>
> You miss the point, Ulf means you should remove
> "(do_rel_wr || !(card->quirks & MMC_QUIRK_BLK_NO_CMD23)" as well.
>
> No need to check card->quirks & MMC_QUIRK_BLK_NO_CMD23 twice, you have
> did it while checking do_rel_wr, right?
>
> bool do_rel_wr = ((req->cmd_flags & REQ_FUA) ||
> (req->cmd_flags & REQ_META)) &&
> (rq_data_dir(req) == WRITE) &&
> - (md->flags & MMC_BLK_REL_WR);
> + (md->flags & MMC_BLK_REL_WR) &&
> + !(card->quirks & MMC_QUIRK_BLK_NO_CMD23);
>
>>
>> Thanks,
>> Yong Li
>> ----------------------------------------
>>> Date: Tue, 25 Aug 2015 14:06:43 +0200
>>> Subject: Re: [PATCH] mmc: block: disable the reliable write If the card does not support CMD23
>>> From: ulf.hansson@linaro.org
>>> To: sdliyong@gmail.com
>>> CC: chris@printf.net; linux-mmc@vger.kernel.org; linux-kernel@vger.kernel.org
>>>
>>> On 14 August 2015 at 09:30, <sdliyong@gmail.com> wrote:
>>>> From: Yong Li <sdliyong@gmail.com>
>>>>
>>>> Signed-off-by: Yong Li <sdliyong@gmail.com>
>>>> ---
>>>> drivers/mmc/card/block.c | 3 ++-
>>>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>>>
>>>> diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
>>>> index 452782b..d9e3c45 100644
>>>> --- a/drivers/mmc/card/block.c
>>>> +++ b/drivers/mmc/card/block.c
>>>> @@ -1366,7 +1366,8 @@ static void mmc_blk_rw_rq_prep(struct mmc_queue_req *mqrq,
>>>> bool do_rel_wr = ((req->cmd_flags & REQ_FUA) ||
>>>> (req->cmd_flags & REQ_META)) &&
>>>> (rq_data_dir(req) == WRITE) &&
>>>> - (md->flags & MMC_BLK_REL_WR);
>>>> + (md->flags & MMC_BLK_REL_WR) &&
>>>> + !(card->quirks & MMC_QUIRK_BLK_NO_CMD23);
>>>
>>> Further down in mmc_blk_rw_rq_prep() we check for
>>> MMC_QUIRK_BLK_NO_CMD23. That check becomes redundant after this
>>> change, please remove that check as a part of this patch as well.
>>>
>>>>
>>>> memset(brq, 0, sizeof(struct mmc_blk_request));
>>>> brq->mrq.cmd = &brq->cmd;
>>>> --
>>>> 2.1.0
>>>>
>>>
>>> Kind regards
>>> Uffe
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>>
>>
>>
>
>
> --
> Best Regards
> Shawn Lin
>
 		 	   		  --
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Ulf Hansson Aug. 27, 2015, 1:22 p.m. UTC | #8
On 25 August 2015 at 14:06, Ulf Hansson <ulf.hansson@linaro.org> wrote:
> On 14 August 2015 at 09:30,  <sdliyong@gmail.com> wrote:
>> From: Yong Li <sdliyong@gmail.com>
>>
>> Signed-off-by: Yong Li <sdliyong@gmail.com>
>> ---
>>  drivers/mmc/card/block.c | 3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
>> index 452782b..d9e3c45 100644
>> --- a/drivers/mmc/card/block.c
>> +++ b/drivers/mmc/card/block.c
>> @@ -1366,7 +1366,8 @@ static void mmc_blk_rw_rq_prep(struct mmc_queue_req *mqrq,
>>         bool do_rel_wr = ((req->cmd_flags & REQ_FUA) ||
>>                           (req->cmd_flags & REQ_META)) &&
>>                 (rq_data_dir(req) == WRITE) &&
>> -               (md->flags & MMC_BLK_REL_WR);
>> +               (md->flags & MMC_BLK_REL_WR) &&
>> +               !(card->quirks & MMC_QUIRK_BLK_NO_CMD23);
>
> Further down in mmc_blk_rw_rq_prep() we check for
> MMC_QUIRK_BLK_NO_CMD23. That check becomes redundant after this
> change, please remove that check as a part of this patch as well.
>
>>
>>         memset(brq, 0, sizeof(struct mmc_blk_request));
>>         brq->mrq.cmd = &brq->cmd;
>> --
>> 2.1.0
>>
>

Please ignore my previous answer. MMC_QUIRK_BLK_NO_CMD23 is intended
to indicate to the mmc block layer whether using CMD23 for regular
block IO request could have a performance impact for some cards. If
that's the case we don't use it - except when using reliable write!

So this patch is just plain wrong.

Kind regards
Uffe
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Yong Li Aug. 28, 2015, 12:38 a.m. UTC | #9
Hi Uffe,

Since Reliable Write depends on the CMD23. I think we need to disable Reliable Write if the card does not support CMD23(due to performance impact issue), so I add this patch.

Do you think we still need to enable Reliable Write even if the card does not support CMD23?

Thanks,
Yong Li
----------------------------------------
> Date: Thu, 27 Aug 2015 15:22:44 +0200
> Subject: Re: [PATCH] mmc: block: disable the reliable write If the card does not support CMD23
> From: ulf.hansson@linaro.org
> To: sdliyong@gmail.com
> CC: chris@printf.net; linux-mmc@vger.kernel.org; linux-kernel@vger.kernel.org
>
> On 25 August 2015 at 14:06, Ulf Hansson <ulf.hansson@linaro.org> wrote:
>> On 14 August 2015 at 09:30, <sdliyong@gmail.com> wrote:
>>> From: Yong Li <sdliyong@gmail.com>
>>>
>>> Signed-off-by: Yong Li <sdliyong@gmail.com>
>>> ---
>>> drivers/mmc/card/block.c | 3 ++-
>>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
>>> index 452782b..d9e3c45 100644
>>> --- a/drivers/mmc/card/block.c
>>> +++ b/drivers/mmc/card/block.c
>>> @@ -1366,7 +1366,8 @@ static void mmc_blk_rw_rq_prep(struct mmc_queue_req *mqrq,
>>> bool do_rel_wr = ((req->cmd_flags & REQ_FUA) ||
>>> (req->cmd_flags & REQ_META)) &&
>>> (rq_data_dir(req) == WRITE) &&
>>> - (md->flags & MMC_BLK_REL_WR);
>>> + (md->flags & MMC_BLK_REL_WR) &&
>>> + !(card->quirks & MMC_QUIRK_BLK_NO_CMD23);
>>
>> Further down in mmc_blk_rw_rq_prep() we check for
>> MMC_QUIRK_BLK_NO_CMD23. That check becomes redundant after this
>> change, please remove that check as a part of this patch as well.
>>
>>>
>>> memset(brq, 0, sizeof(struct mmc_blk_request));
>>> brq->mrq.cmd = &brq->cmd;
>>> --
>>> 2.1.0
>>>
>>
>
> Please ignore my previous answer. MMC_QUIRK_BLK_NO_CMD23 is intended
> to indicate to the mmc block layer whether using CMD23 for regular
> block IO request could have a performance impact for some cards. If
> that's the case we don't use it - except when using reliable write!
>
> So this patch is just plain wrong.
>
> Kind regards
> Uffe
 		 	   		  --
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Ulf Hansson Aug. 28, 2015, 8:08 a.m. UTC | #10
- Chris and LKML,

On 28 August 2015 at 02:38, LIYONG <sdliyong@gmail.com> wrote:
> Hi Uffe,
>
> Since Reliable Write depends on the CMD23. I think we need to disable Reliable Write if the card does not support CMD23(due to performance impact issue), so I add this patch.
>
> Do you think we still need to enable Reliable Write even if the card does not support CMD23?

MMC_QUIRK_BLK_NO_CMD23 does *not* tell us whether the card support
CMD23. Instead it tells us that the card may suffer a bit from
performance point of view while using the "CMD23 way" to send
requests.

Now, as reliable write needs to be sent in the "CMD23-way", then
that's what we need to do - no matter of MMC_QUIRK_BLK_NO_CMD23.

[...]

Kind regards
Uffe
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
index 452782b..d9e3c45 100644
--- a/drivers/mmc/card/block.c
+++ b/drivers/mmc/card/block.c
@@ -1366,7 +1366,8 @@  static void mmc_blk_rw_rq_prep(struct mmc_queue_req *mqrq,
 	bool do_rel_wr = ((req->cmd_flags & REQ_FUA) ||
 			  (req->cmd_flags & REQ_META)) &&
 		(rq_data_dir(req) == WRITE) &&
-		(md->flags & MMC_BLK_REL_WR);
+		(md->flags & MMC_BLK_REL_WR) &&
+		!(card->quirks & MMC_QUIRK_BLK_NO_CMD23);
 
 	memset(brq, 0, sizeof(struct mmc_blk_request));
 	brq->mrq.cmd = &brq->cmd;