All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] dmaengine: Add Kconfig of DMA data align for DMA Test driver
@ 2009-03-12  6:30 Nobuhiro Iwamatsu
  2009-03-16 22:02 ` Dan Williams
  0 siblings, 1 reply; 3+ messages in thread
From: Nobuhiro Iwamatsu @ 2009-03-12  6:30 UTC (permalink / raw)
  To: linux-kernel; +Cc: Haavard Skinnemoen, maciej.sosnowski, dan.j.williams

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 <iwamatsu.nobuhiro@renesas.com>
Cc: Haavard Skinnemoen <hskinnemoen@atmel.com>
Cc: Maciej Sosnowski <maciej.sosnowski@intel.com>
Cc: Dan Williams <dan.j.williams@intel.com>
---
 drivers/dma/Kconfig   |    8 ++++++++
 drivers/dma/dmatest.c |    7 +++++++
 2 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig
index 48ea59e..7f9e1ec 100644
--- a/drivers/dma/Kconfig
+++ b/drivers/dma/Kconfig
@@ -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
diff --git a/drivers/dma/dmatest.c b/drivers/dma/dmatest.c
index 732fa1e..e7f273c 100644
--- a/drivers/dma/dmatest.c
+++ b/drivers/dma/dmatest.c
@@ -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);
-- 
1.6.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] dmaengine: Add Kconfig of DMA data align for DMA Test  driver
  2009-03-12  6:30 [PATCH] dmaengine: Add Kconfig of DMA data align for DMA Test driver Nobuhiro Iwamatsu
@ 2009-03-16 22:02 ` Dan Williams
  2009-03-18 12:09   ` Sosnowski, Maciej
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Williams @ 2009-03-16 22:02 UTC (permalink / raw)
  To: Nobuhiro Iwamatsu; +Cc: linux-kernel, Haavard Skinnemoen, maciej.sosnowski

On Wed, Mar 11, 2009 at 11:30 PM, Nobuhiro Iwamatsu
<iwamatsu.nobuhiro@renesas.com> wrote:
> 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 <iwamatsu.nobuhiro@renesas.com>
> Cc: Haavard Skinnemoen <hskinnemoen@atmel.com>
> Cc: Maciej Sosnowski <maciej.sosnowski@intel.com>
> Cc: Dan Williams <dan.j.williams@intel.com>
> ---

This should just be a module parameter, and it needs error handling
for the alignment > transfer length case.

Thanks,
Dan

^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [PATCH] dmaengine: Add Kconfig of DMA data align for DMA Test driver
  2009-03-16 22:02 ` Dan Williams
@ 2009-03-18 12:09   ` Sosnowski, Maciej
  0 siblings, 0 replies; 3+ messages in thread
From: Sosnowski, Maciej @ 2009-03-18 12:09 UTC (permalink / raw)
  To: Williams, Dan J, Nobuhiro Iwamatsu; +Cc: linux-kernel, Haavard Skinnemoen

Dan Williams wrote:
> On Wed, Mar 11, 2009 at 11:30 PM, Nobuhiro Iwamatsu
> <iwamatsu.nobuhiro@renesas.com> wrote:
>> 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 <iwamatsu.nobuhiro@renesas.com>
>> Cc: Haavard Skinnemoen <hskinnemoen@atmel.com>
>> Cc: Maciej Sosnowski <maciej.sosnowski@intel.com>
>> Cc: Dan Williams <dan.j.williams@intel.com>
>> ---
> 
> 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-03-18 12:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-12  6:30 [PATCH] dmaengine: Add Kconfig of DMA data align for DMA Test driver Nobuhiro Iwamatsu
2009-03-16 22:02 ` Dan Williams
2009-03-18 12:09   ` Sosnowski, Maciej

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.