* [PATCH] mmc: block: prevent propagating R1_OUT_OF_RANGE for open-ending mode
@ 2017-08-07 1:32 Shawn Lin
2017-08-07 5:13 ` Shawn Guo
2017-08-07 20:51 ` Wolfram Sang
0 siblings, 2 replies; 4+ messages in thread
From: Shawn Lin @ 2017-08-07 1:32 UTC (permalink / raw)
To: Ulf Hansson; +Cc: linux-mmc, Shawn Guo, Wolfram Sang, Shawn Lin
We to some extent should tolerate R1_OUT_OF_RANGE for open-ending
mode as it is expected behaviour and most of the backup partition
tables should be located near some the last blocks which will always
make open-ending read exceed the capcity of cards.
Fixes: 9820a5b11101 ("mmc: core: for data errors, take response of stop cmd into account")
Fixes: a04e6bae9e6f (mmc: core: check also R1 response for stop commands)
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
---
drivers/mmc/core/block.c | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)
diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c
index 40f0d59..25343aa 100644
--- a/drivers/mmc/core/block.c
+++ b/drivers/mmc/core/block.c
@@ -1369,10 +1369,19 @@ static inline void mmc_apply_rel_rw(struct mmc_blk_request *brq,
R1_CC_ERROR | /* Card controller error */ \
R1_ERROR) /* General/unknown error */
-static bool mmc_blk_has_cmd_err(struct mmc_command *cmd)
+static bool mmc_blk_has_cmd_err(struct mmc_card *card, struct mmc_command *cmd)
{
- if (!cmd->error && cmd->resp[0] & CMD_ERRORS)
- cmd->error = -EIO;
+ struct mmc_blk_data *md = dev_get_drvdata(&card->dev);
+
+ if (!cmd->error && cmd->resp[0] & CMD_ERRORS) {
+ /*
+ * Prevent the OUT_OF_RANGE error for open-ending
+ * multiple block operations as it's normal behaviour.
+ */
+ if (!(!(md->flags & MMC_BLK_CMD23) &&
+ cmd->resp[0] & R1_OUT_OF_RANGE))
+ cmd->error = -EIO;
+ }
return cmd->error;
}
@@ -1398,8 +1407,8 @@ static enum mmc_blk_status mmc_blk_err_check(struct mmc_card *card,
* stop.error indicates a problem with the stop command. Data
* may have been transferred, or may still be transferring.
*/
- if (brq->sbc.error || brq->cmd.error || mmc_blk_has_cmd_err(&brq->stop) ||
- brq->data.error) {
+ if (brq->sbc.error || brq->cmd.error ||
+ mmc_blk_has_cmd_err(card, &brq->stop) || brq->data.error) {
switch (mmc_blk_cmd_recovery(card, req, brq, &ecc_err, &gen_err)) {
case ERR_RETRY:
return MMC_BLK_RETRY;
--
1.9.1
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] mmc: block: prevent propagating R1_OUT_OF_RANGE for open-ending mode
2017-08-07 1:32 [PATCH] mmc: block: prevent propagating R1_OUT_OF_RANGE for open-ending mode Shawn Lin
@ 2017-08-07 5:13 ` Shawn Guo
2017-08-07 20:51 ` Wolfram Sang
1 sibling, 0 replies; 4+ messages in thread
From: Shawn Guo @ 2017-08-07 5:13 UTC (permalink / raw)
To: Shawn Lin; +Cc: Ulf Hansson, linux-mmc, Wolfram Sang
On Mon, Aug 07, 2017 at 09:32:45AM +0800, Shawn Lin wrote:
> We to some extent should tolerate R1_OUT_OF_RANGE for open-ending
> mode as it is expected behaviour and most of the backup partition
> tables should be located near some the last blocks which will always
> make open-ending read exceed the capcity of cards.
>
> Fixes: 9820a5b11101 ("mmc: core: for data errors, take response of stop cmd into account")
> Fixes: a04e6bae9e6f (mmc: core: check also R1 response for stop commands)
> Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
Tested-by: Shawn Guo <shawnguo@kernel.org>
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] mmc: block: prevent propagating R1_OUT_OF_RANGE for open-ending mode
2017-08-07 1:32 [PATCH] mmc: block: prevent propagating R1_OUT_OF_RANGE for open-ending mode Shawn Lin
2017-08-07 5:13 ` Shawn Guo
@ 2017-08-07 20:51 ` Wolfram Sang
2017-08-07 23:46 ` Shawn Lin
1 sibling, 1 reply; 4+ messages in thread
From: Wolfram Sang @ 2017-08-07 20:51 UTC (permalink / raw)
To: Shawn Lin; +Cc: Ulf Hansson, linux-mmc, Shawn Guo, linux-renesas-soc
[-- Attachment #1: Type: text/plain, Size: 880 bytes --]
Hi Shawn,
On Mon, Aug 07, 2017 at 09:32:45AM +0800, Shawn Lin wrote:
> We to some extent should tolerate R1_OUT_OF_RANGE for open-ending
> mode as it is expected behaviour and most of the backup partition
> tables should be located near some the last blocks which will always
> make open-ending read exceed the capcity of cards.
>
> Fixes: 9820a5b11101 ("mmc: core: for data errors, take response of stop cmd into account")
> Fixes: a04e6bae9e6f (mmc: core: check also R1 response for stop commands)
> Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
Thanks a lot for debugging and working on this issue! I think the above
reason is correct, yet I wonder if we shouldn't implement it
differently: how about introducing a new #define called STOP_ERRORS
which does not include R1_OUT_OF_RANGE and use it instead of CMD_ERRORS?
Kind regards,
Wolfram
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] mmc: block: prevent propagating R1_OUT_OF_RANGE for open-ending mode
2017-08-07 20:51 ` Wolfram Sang
@ 2017-08-07 23:46 ` Shawn Lin
0 siblings, 0 replies; 4+ messages in thread
From: Shawn Lin @ 2017-08-07 23:46 UTC (permalink / raw)
To: Wolfram Sang
Cc: shawn.lin, Ulf Hansson, linux-mmc, Shawn Guo, linux-renesas-soc
Hi Wolfram,
On 2017/8/8 4:51, Wolfram Sang wrote:
> Hi Shawn,
>
> On Mon, Aug 07, 2017 at 09:32:45AM +0800, Shawn Lin wrote:
>> We to some extent should tolerate R1_OUT_OF_RANGE for open-ending
>> mode as it is expected behaviour and most of the backup partition
>> tables should be located near some the last blocks which will always
>> make open-ending read exceed the capcity of cards.
>>
>> Fixes: 9820a5b11101 ("mmc: core: for data errors, take response of stop cmd into account")
>> Fixes: a04e6bae9e6f (mmc: core: check also R1 response for stop commands)
>> Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
>
> Thanks a lot for debugging and working on this issue! I think the above
> reason is correct, yet I wonder if we shouldn't implement it
> differently: how about introducing a new #define called STOP_ERRORS
> which does not include R1_OUT_OF_RANGE and use it instead of CMD_ERRORS?
I'm fine with that as mmc_blk_has_cmd_err is now only used to check stop
command.
>
> Kind regards,
>
> Wolfram
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-08-07 23:46 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-07 1:32 [PATCH] mmc: block: prevent propagating R1_OUT_OF_RANGE for open-ending mode Shawn Lin
2017-08-07 5:13 ` Shawn Guo
2017-08-07 20:51 ` Wolfram Sang
2017-08-07 23:46 ` Shawn Lin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox