dmaengine: Add Kconfig of DMA data align for DMA Test driver
PATCH 1/1 dmaengine: Add Kconfig of DMA data align for DMA Test driver
Test drivers of DMA engine usually perform DMA transfer by 1 byte unit. This can set transfer size of DMA and aligns data for tests.
--- drivers/dma/Kconfig | 8 ++++++++ drivers/dma/dmatest.c | 7 +++++++ 2 files changed, 15 insertions(+), 0 deletions(-)
drivers/dma/Kconfig +8 -0
@@ -105,4 +105,12 @@ config DMATEST Simple DMA test client. Say N unless you're debugging a DMA Device driver. +config DMATEST_DATA_ALIGN + int "DMA Test data align size" + depends on DMATEST + default "1" + help + Test drivers of DMA engine usually perform DMA transfer by 1 byte unit. + This can set transfer size of DMA and aligns data for tests. + endif
drivers/dma/dmatest.c +7 -0
@@ -224,8 +224,15 @@ static int dmatest_func(void *data) total_tests++; len =dmatest_random () % test_buf_size +1 ; +#if CONFIG_DMATEST_DATA_ALIGN >1 + len -= (len %CONFIG_DMATEST_DATA_ALIGN ); +#endif src_off =dmatest_random () % (test_buf_size - len +1 ); dst_off =dmatest_random () % (test_buf_size - len +1 ); +#if CONFIG_DMATEST_DATA_ALIGN >1 + src_off -= (src_off %CONFIG_DMATEST_DATA_ALIGN ); + dst_off -= (dst_off %CONFIG_DMATEST_DATA_ALIGN ); +#endif dmatest_init_srcbuf (thread->srcbuf, src_off, len);dmatest_init_dstbuf (thread->dstbuf, dst_off, len);
Signature · 1 line
1.6.2
Quoted 8 lines · Nobuhiro Iwamatsu
Test drivers of DMA engine usually perform DMA transfer by 1 byte unit. This can set transfer size of DMA and aligns data for tests.
Signed-off-by Nobuhiro Iwamatsu <[email protected]>Cc Haavard Skinnemoen <[email protected]>Cc Maciej Sosnowski <[email protected]>Cc Dan Williams <[email protected]>---
This should just be a module parameter, and it needs error handling for the alignment > transfer length case.
Thanks,
Dan
Quoted 11 lines · Dan Williams
Quoted 8 lines · Nobuhiro Iwamatsu
Test drivers of DMA engine usually perform DMA transfer by 1 byte unit. This can set transfer size of DMA and aligns data for tests.
Signed-off-by Nobuhiro Iwamatsu <[email protected]>Cc Haavard Skinnemoen <[email protected]>Cc Maciej Sosnowski <[email protected]>Cc Dan Williams <[email protected]>---
Quoted 5 lines
This should just be a module parameter, and it needs error handling for the alignment > transfer length case.
Thanks,
Dan
I agree with Dan. Align size should be rather module parameter.
Regards,
Maciej