* [PATCH] [MMC 4.5] Fix for checking block numbers in disable emulation mode
@ 2012-06-29 6:32 Saugata Das
2012-06-29 10:12 ` Seungwon Jeon
0 siblings, 1 reply; 3+ messages in thread
From: Saugata Das @ 2012-06-29 6:32 UTC (permalink / raw)
To: linux-mmc; +Cc: patches, Saugata Das
From: Saugata Das <saugata.das@linaro.org>
In 512B disable emulation patch, a check is done to ensure that size
of the data is multiple of 4KB. However, the check is done with
brq->data.blocks, which is not initialized at the point of check.
This is now changed to blk_rq_sectors.
Signed-off-by: Saugata Das <saugata.das@linaro.org>
---
drivers/mmc/card/block.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
index d628c5d..ee8b3d6 100644
--- a/drivers/mmc/card/block.c
+++ b/drivers/mmc/card/block.c
@@ -1296,7 +1296,7 @@ static int mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *rqc)
* When 4KB native sector is enabled, only 8 blocks
* multiple read or write is allowed
*/
- if ((brq->data.blocks & 0x07) &&
+ if ((blk_rq_sectors(req) & 0x07) &&
(card->ext_csd.data_sector_size == 4096)) {
pr_err("%s: Transfer size is not 4KB sector size aligned\n",
req->rq_disk->disk_name);
--
1.7.4.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* RE: [PATCH] [MMC 4.5] Fix for checking block numbers in disable emulation mode
2012-06-29 6:32 [PATCH] [MMC 4.5] Fix for checking block numbers in disable emulation mode Saugata Das
@ 2012-06-29 10:12 ` Seungwon Jeon
2012-06-29 12:52 ` Saugata Das
0 siblings, 1 reply; 3+ messages in thread
From: Seungwon Jeon @ 2012-06-29 10:12 UTC (permalink / raw)
To: 'Saugata Das', linux-mmc; +Cc: patches, 'Saugata Das'
Hi Saugata,
Could you check the comment below?
Friday, June 29, 2012, Saugata Das <saugata.das@linaro.org> wrote:
> From: Saugata Das <saugata.das@linaro.org>
>
> In 512B disable emulation patch, a check is done to ensure that size
> of the data is multiple of 4KB. However, the check is done with
> brq->data.blocks, which is not initialized at the point of check.
> This is now changed to blk_rq_sectors.
>
> Signed-off-by: Saugata Das <saugata.das@linaro.org>
> ---
> drivers/mmc/card/block.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
> index d628c5d..ee8b3d6 100644
> --- a/drivers/mmc/card/block.c
> +++ b/drivers/mmc/card/block.c
> @@ -1296,7 +1296,7 @@ static int mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *rqc)
> * When 4KB native sector is enabled, only 8 blocks
> * multiple read or write is allowed
> */
> - if ((brq->data.blocks & 0x07) &&
> + if ((blk_rq_sectors(req) & 0x07) &&
> (card->ext_csd.data_sector_size == 4096)) {
> pr_err("%s: Transfer size is not 4KB sector size aligned\n",
> req->rq_disk->disk_name);
In current error handling, multiple block read can be retried using single block read
with disable_multi. Then 4KB alignment will be broken.
Also, there is some conditions to modify the number of blocks in mmc_blk_rw_rq_prep.
That means the alignment of blocks can be changed after mmc_blk_rw_rq_prep.
It needs to be considered.
And I have a question.
Spec mentioned that arguments for read commands (CMD17/18) shall always be aligned to 8(4KB)
in Native 4KB sector. In current implementation CMD17/18 is only used when data.blocks is 1.
If data.blocks is 8 in Native 4KB sector, then CMD17/18 should be taken instead of CMD24/25?
Thanks,
Seungwon Jeon
> --
> 1.7.4.3
>
> --
> 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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] [MMC 4.5] Fix for checking block numbers in disable emulation mode
2012-06-29 10:12 ` Seungwon Jeon
@ 2012-06-29 12:52 ` Saugata Das
0 siblings, 0 replies; 3+ messages in thread
From: Saugata Das @ 2012-06-29 12:52 UTC (permalink / raw)
To: Seungwon Jeon; +Cc: Saugata Das, linux-mmc, patches
On 29 June 2012 15:42, Seungwon Jeon <tgih.jun@samsung.com> wrote:
> Hi Saugata,
>
> Could you check the comment below?
>
> Friday, June 29, 2012, Saugata Das <saugata.das@linaro.org> wrote:
>> From: Saugata Das <saugata.das@linaro.org>
>>
>> In 512B disable emulation patch, a check is done to ensure that size
>> of the data is multiple of 4KB. However, the check is done with
>> brq->data.blocks, which is not initialized at the point of check.
>> This is now changed to blk_rq_sectors.
>>
>> Signed-off-by: Saugata Das <saugata.das@linaro.org>
>> ---
>> drivers/mmc/card/block.c | 2 +-
>> 1 files changed, 1 insertions(+), 1 deletions(-)
>>
>> diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
>> index d628c5d..ee8b3d6 100644
>> --- a/drivers/mmc/card/block.c
>> +++ b/drivers/mmc/card/block.c
>> @@ -1296,7 +1296,7 @@ static int mmc_blk_issue_rw_rq(struct mmc_queue *mq, struct request *rqc)
>> * When 4KB native sector is enabled, only 8 blocks
>> * multiple read or write is allowed
>> */
>> - if ((brq->data.blocks & 0x07) &&
>> + if ((blk_rq_sectors(req) & 0x07) &&
>> (card->ext_csd.data_sector_size == 4096)) {
>> pr_err("%s: Transfer size is not 4KB sector size aligned\n",
>> req->rq_disk->disk_name);
>
> In current error handling, multiple block read can be retried using single block read
> with disable_multi. Then 4KB alignment will be broken.
True. I shall change to something like,
if (disable_multi)
- brq->data.blocks = 1;
+ brq->data.blocks =
+ (card->ext_csd.data_sector_size == 4096) ?
+ 8 : 1;
> Also, there is some conditions to modify the number of blocks in mmc_blk_rw_rq_prep.
> That means the alignment of blocks can be changed after mmc_blk_rw_rq_prep.
> It needs to be considered.
I think you are referring to possibilities where host is not able to
transfer in multiple of 4KB (MMC_CAP2_NO_MULTI_READ is enabled or
host->max_blk_count is not multiple of 8). I shall add a check in
mmc_read_ext_csd.
- if (ext_csd[EXT_CSD_DATA_SECTOR_SIZE] == 1)
+ if (ext_csd[EXT_CSD_DATA_SECTOR_SIZE] == 1) {
+ if ((card->host->caps2 & MMC_CAP2_NO_MULTI_READ) ||
+ (card->host->max_blk_count & 0x07)) {
+ err = -EINVAL;
+ goto out;
+ }
>
> And I have a question.
> Spec mentioned that arguments for read commands (CMD17/18) shall always be aligned to 8(4KB)
> in Native 4KB sector. In current implementation CMD17/18 is only used when data.blocks is 1.
> If data.blocks is 8 in Native 4KB sector, then CMD17/18 should be taken instead of CMD24/25?
In native sector mode, only CMD18 and CMD25 will be used for read and write.
>
> Thanks,
> Seungwon Jeon
>> --
>> 1.7.4.3
>>
>> --
>> 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
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-06-29 12:52 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-29 6:32 [PATCH] [MMC 4.5] Fix for checking block numbers in disable emulation mode Saugata Das
2012-06-29 10:12 ` Seungwon Jeon
2012-06-29 12:52 ` Saugata Das
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.