* [PATCH] mmc: mmc_test: align max_seg_size
@ 2011-11-14 11:04 Per Forlin
2011-11-17 3:56 ` Sujit Reddy Thumma
2011-12-01 17:43 ` Chris Ball
0 siblings, 2 replies; 5+ messages in thread
From: Per Forlin @ 2011-11-14 11:04 UTC (permalink / raw)
To: linux-mmc, ulf.hansson, Linus Walleij; +Cc: Chris Ball, Per Forlin
If max_seg_size is unaligned, mmc_test_map_sg() may create sg element
sizes that are not aligned with 512 byte. Fix, align max_seg_size at
mmc_test_area_init().
Signed-off-by: Per Forlin <per.forlin@stericsson.com>
---
drivers/mmc/card/mmc_test.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/drivers/mmc/card/mmc_test.c b/drivers/mmc/card/mmc_test.c
index b038c4a..5848998 100644
--- a/drivers/mmc/card/mmc_test.c
+++ b/drivers/mmc/card/mmc_test.c
@@ -1581,6 +1581,7 @@ static int mmc_test_area_init(struct mmc_test_card *test, int erase, int fill)
t->max_segs = test->card->host->max_segs;
t->max_seg_sz = test->card->host->max_seg_size;
+ t->max_seg_sz -= t->max_seg_sz % 512;
t->max_tfr = t->max_sz;
if (t->max_tfr >> 9 > test->card->host->max_blk_count)
--
1.6.3.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] mmc: mmc_test: align max_seg_size
2011-11-14 11:04 [PATCH] mmc: mmc_test: align max_seg_size Per Forlin
@ 2011-11-17 3:56 ` Sujit Reddy Thumma
2011-11-18 9:25 ` Per Förlin
2011-12-01 17:43 ` Chris Ball
1 sibling, 1 reply; 5+ messages in thread
From: Sujit Reddy Thumma @ 2011-11-17 3:56 UTC (permalink / raw)
To: Per Forlin; +Cc: linux-mmc, ulf.hansson, Linus Walleij, Chris Ball
On 11/14/2011 4:34 PM, Per Forlin wrote:
> If max_seg_size is unaligned, mmc_test_map_sg() may create sg element
> sizes that are not aligned with 512 byte. Fix, align max_seg_size at
> mmc_test_area_init().
>
> Signed-off-by: Per Forlin<per.forlin@stericsson.com>
> ---
> drivers/mmc/card/mmc_test.c | 1 +
> 1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/mmc/card/mmc_test.c b/drivers/mmc/card/mmc_test.c
> index b038c4a..5848998 100644
> --- a/drivers/mmc/card/mmc_test.c
> +++ b/drivers/mmc/card/mmc_test.c
> @@ -1581,6 +1581,7 @@ static int mmc_test_area_init(struct mmc_test_card *test, int erase, int fill)
>
> t->max_segs = test->card->host->max_segs;
> t->max_seg_sz = test->card->host->max_seg_size;
> + t->max_seg_sz -= t->max_seg_sz % 512;
Shouldn't we align this to host->max_blk_size supported by controller? I
guess there are some extended capacity cards which claim to support
4096bytes as block size. I am not sure if any card/controller supports
this mode yet.
>
> t->max_tfr = t->max_sz;
> if (t->max_tfr>> 9> test->card->host->max_blk_count)
--
Thanks,
Sujit
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] mmc: mmc_test: align max_seg_size
2011-11-17 3:56 ` Sujit Reddy Thumma
@ 2011-11-18 9:25 ` Per Förlin
0 siblings, 0 replies; 5+ messages in thread
From: Per Förlin @ 2011-11-18 9:25 UTC (permalink / raw)
To: Sujit Reddy Thumma
Cc: linux-mmc@vger.kernel.org, Ulf HANSSON, Linus Walleij, Chris Ball
On 11/17/2011 04:56 AM, Sujit Reddy Thumma wrote:
> On 11/14/2011 4:34 PM, Per Forlin wrote:
>> If max_seg_size is unaligned, mmc_test_map_sg() may create sg element
>> sizes that are not aligned with 512 byte. Fix, align max_seg_size at
>> mmc_test_area_init().
>>
>> Signed-off-by: Per Forlin<per.forlin@stericsson.com>
>> ---
>> drivers/mmc/card/mmc_test.c | 1 +
>> 1 files changed, 1 insertions(+), 0 deletions(-)
>>
>> diff --git a/drivers/mmc/card/mmc_test.c b/drivers/mmc/card/mmc_test.c
>> index b038c4a..5848998 100644
>> --- a/drivers/mmc/card/mmc_test.c
>> +++ b/drivers/mmc/card/mmc_test.c
>> @@ -1581,6 +1581,7 @@ static int mmc_test_area_init(struct mmc_test_card *test, int erase, int fill)
>>
>> t->max_segs = test->card->host->max_segs;
>> t->max_seg_sz = test->card->host->max_seg_size;
>> + t->max_seg_sz -= t->max_seg_sz % 512;
>
> Shouldn't we align this to host->max_blk_size supported by controller?
It's up to each test case to set the test transfer size. It's not necessary to align max_size but it wouldn't make any harm either. All tests use a multiple of 512 blocks, but this may be changed of course in the future to support large blocks.
The max_seg_sz must be aligned otherwise the host driver may get sg-elements that are hard to handle, aligned to 1 byte in the worst case. The test case don't control how the transfer is sg-mapped.
/Per
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] mmc: mmc_test: align max_seg_size
2011-11-14 11:04 [PATCH] mmc: mmc_test: align max_seg_size Per Forlin
2011-11-17 3:56 ` Sujit Reddy Thumma
@ 2011-12-01 17:43 ` Chris Ball
2011-12-02 11:23 ` Sujit Reddy Thumma
1 sibling, 1 reply; 5+ messages in thread
From: Chris Ball @ 2011-12-01 17:43 UTC (permalink / raw)
To: Per Forlin; +Cc: linux-mmc, ulf.hansson, Linus Walleij, Sujit Reddy Thumma
Hi,
On Mon, Nov 14 2011, Per Forlin wrote:
> If max_seg_size is unaligned, mmc_test_map_sg() may create sg element
> sizes that are not aligned with 512 byte. Fix, align max_seg_size at
> mmc_test_area_init().
>
> Signed-off-by: Per Forlin <per.forlin@stericsson.com>
> ---
> drivers/mmc/card/mmc_test.c | 1 +
> 1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/mmc/card/mmc_test.c b/drivers/mmc/card/mmc_test.c
> index b038c4a..5848998 100644
> --- a/drivers/mmc/card/mmc_test.c
> +++ b/drivers/mmc/card/mmc_test.c
> @@ -1581,6 +1581,7 @@ static int mmc_test_area_init(struct mmc_test_card *test, int erase, int fill)
>
> t->max_segs = test->card->host->max_segs;
> t->max_seg_sz = test->card->host->max_seg_size;
> + t->max_seg_sz -= t->max_seg_sz % 512;
>
> t->max_tfr = t->max_sz;
> if (t->max_tfr >> 9 > test->card->host->max_blk_count)
Thanks, pushed to mmc-next for 3.2. (Sujit, please let us know if you
still have worries about aligning to host->max_blk_size.)
- Chris.
--
Chris Ball <cjb@laptop.org> <http://printf.net/>
One Laptop Per Child
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] mmc: mmc_test: align max_seg_size
2011-12-01 17:43 ` Chris Ball
@ 2011-12-02 11:23 ` Sujit Reddy Thumma
0 siblings, 0 replies; 5+ messages in thread
From: Sujit Reddy Thumma @ 2011-12-02 11:23 UTC (permalink / raw)
To: Chris Ball
Cc: Per Forlin, linux-mmc, ulf.hansson, Linus Walleij,
Sujit Reddy Thumma
> Hi,
>
> On Mon, Nov 14 2011, Per Forlin wrote:
>> If max_seg_size is unaligned, mmc_test_map_sg() may create sg element
>> sizes that are not aligned with 512 byte. Fix, align max_seg_size at
>> mmc_test_area_init().
>>
>> Signed-off-by: Per Forlin <per.forlin@stericsson.com>
>> ---
>> drivers/mmc/card/mmc_test.c | 1 +
>> 1 files changed, 1 insertions(+), 0 deletions(-)
>>
>> diff --git a/drivers/mmc/card/mmc_test.c b/drivers/mmc/card/mmc_test.c
>> index b038c4a..5848998 100644
>> --- a/drivers/mmc/card/mmc_test.c
>> +++ b/drivers/mmc/card/mmc_test.c
>> @@ -1581,6 +1581,7 @@ static int mmc_test_area_init(struct mmc_test_card
>> *test, int erase, int fill)
>>
>> t->max_segs = test->card->host->max_segs;
>> t->max_seg_sz = test->card->host->max_seg_size;
>> + t->max_seg_sz -= t->max_seg_sz % 512;
>>
>> t->max_tfr = t->max_sz;
>> if (t->max_tfr >> 9 > test->card->host->max_blk_count)
>
> Thanks, pushed to mmc-next for 3.2. (Sujit, please let us know if you
> still have worries about aligning to host->max_blk_size.)
No issues. The change looks good.
--
Thanks,
Sujit
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-12-02 11:23 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-14 11:04 [PATCH] mmc: mmc_test: align max_seg_size Per Forlin
2011-11-17 3:56 ` Sujit Reddy Thumma
2011-11-18 9:25 ` Per Förlin
2011-12-01 17:43 ` Chris Ball
2011-12-02 11:23 ` Sujit Reddy Thumma
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).