All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] dw_dmac: mark dwc_dump_lli inline
@ 2012-07-13  8:09 Andy Shevchenko
  2012-07-13  8:09 ` [PATCH 2/3] dw_dmac: use 'u32' for LLI structure members, not dma_addr_t Andy Shevchenko
                   ` (3 more replies)
  0 siblings, 4 replies; 12+ messages in thread
From: Andy Shevchenko @ 2012-07-13  8:09 UTC (permalink / raw)
  To: Viresh Kumar, linux-kernel, Vinod Koul, Dan Williams; +Cc: Andy Shevchenko

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/dma/dw_dmac.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/dma/dw_dmac.c b/drivers/dma/dw_dmac.c
index 9151511..db56ef4 100644
--- a/drivers/dma/dw_dmac.c
+++ b/drivers/dma/dw_dmac.c
@@ -413,7 +413,7 @@ static void dwc_scan_descriptors(struct dw_dma *dw, struct dw_dma_chan *dwc)
 	spin_unlock_irqrestore(&dwc->lock, flags);
 }
 
-static void dwc_dump_lli(struct dw_dma_chan *dwc, struct dw_lli *lli)
+static inline void dwc_dump_lli(struct dw_dma_chan *dwc, struct dw_lli *lli)
 {
 	dev_printk(KERN_CRIT, chan2dev(&dwc->chan),
 			"  desc: s0x%llx d0x%llx l0x%llx c0x%x:%x\n",
-- 
1.7.10.4


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

* [PATCH 2/3] dw_dmac: use 'u32' for LLI structure members, not dma_addr_t
  2012-07-13  8:09 [PATCH 1/3] dw_dmac: mark dwc_dump_lli inline Andy Shevchenko
@ 2012-07-13  8:09 ` Andy Shevchenko
  2012-07-13  8:27   ` viresh kumar
  2012-07-13  8:09 ` [PATCH 3/3] dw_dmac: set default alignment Andy Shevchenko
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 12+ messages in thread
From: Andy Shevchenko @ 2012-07-13  8:09 UTC (permalink / raw)
  To: Viresh Kumar, linux-kernel, Vinod Koul, Dan Williams; +Cc: Andy Shevchenko

Use 'u32' for the LLI structure members, which are defined by hardware to be
32-bit. dma_addr_t is much more vague about its actual size.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/dma/dw_dmac.c      |    7 ++-----
 drivers/dma/dw_dmac_regs.h |    6 +++---
 2 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/drivers/dma/dw_dmac.c b/drivers/dma/dw_dmac.c
index db56ef4..3d061c6 100644
--- a/drivers/dma/dw_dmac.c
+++ b/drivers/dma/dw_dmac.c
@@ -416,11 +416,8 @@ static void dwc_scan_descriptors(struct dw_dma *dw, struct dw_dma_chan *dwc)
 static inline void dwc_dump_lli(struct dw_dma_chan *dwc, struct dw_lli *lli)
 {
 	dev_printk(KERN_CRIT, chan2dev(&dwc->chan),
-			"  desc: s0x%llx d0x%llx l0x%llx c0x%x:%x\n",
-			(unsigned long long)lli->sar,
-			(unsigned long long)lli->dar,
-			(unsigned long long)lli->llp,
-			lli->ctlhi, lli->ctllo);
+			"  desc: s0x%x d0x%x l0x%x c0x%x:%x\n",
+			lli->sar, lli->dar, lli->llp, lli->ctlhi, lli->ctllo);
 }
 
 static void dwc_handle_error(struct dw_dma *dw, struct dw_dma_chan *dwc)
diff --git a/drivers/dma/dw_dmac_regs.h b/drivers/dma/dw_dmac_regs.h
index e248481..50830be 100644
--- a/drivers/dma/dw_dmac_regs.h
+++ b/drivers/dma/dw_dmac_regs.h
@@ -219,9 +219,9 @@ static inline struct dw_dma *to_dw_dma(struct dma_device *ddev)
 /* LLI == Linked List Item; a.k.a. DMA block descriptor */
 struct dw_lli {
 	/* values that are not changed by hardware */
-	dma_addr_t	sar;
-	dma_addr_t	dar;
-	dma_addr_t	llp;		/* chain to next lli */
+	u32		sar;
+	u32		dar;
+	u32		llp;		/* chain to next lli */
 	u32		ctllo;
 	/* values that may get written back: */
 	u32		ctlhi;
-- 
1.7.10.4


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

* [PATCH 3/3] dw_dmac: set default alignment
  2012-07-13  8:09 [PATCH 1/3] dw_dmac: mark dwc_dump_lli inline Andy Shevchenko
  2012-07-13  8:09 ` [PATCH 2/3] dw_dmac: use 'u32' for LLI structure members, not dma_addr_t Andy Shevchenko
@ 2012-07-13  8:09 ` Andy Shevchenko
  2012-07-13  8:26   ` viresh kumar
  2012-07-13  8:27 ` [PATCH 1/3] dw_dmac: mark dwc_dump_lli inline viresh kumar
  2012-07-16  6:34 ` Vinod Koul
  3 siblings, 1 reply; 12+ messages in thread
From: Andy Shevchenko @ 2012-07-13  8:09 UTC (permalink / raw)
  To: Viresh Kumar, linux-kernel, Vinod Koul, Dan Williams; +Cc: Andy Shevchenko

The default values are filled to support at least mem-to-mem tests provided by
dmatest module. It makes sense to choose the 4 bytes (2 least significant bits)
alignment by the default.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/dma/dw_dmac.c |    6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/dma/dw_dmac.c b/drivers/dma/dw_dmac.c
index 3d061c6..2a19ab6 100644
--- a/drivers/dma/dw_dmac.c
+++ b/drivers/dma/dw_dmac.c
@@ -1485,6 +1485,12 @@ static int __devinit dw_probe(struct platform_device *pdev)
 	dw->dma.device_tx_status = dwc_tx_status;
 	dw->dma.device_issue_pending = dwc_issue_pending;
 
+	/* Set default alignment */
+	dw->dma.copy_align = 2;
+	dw->dma.xor_align = 2;
+	dw->dma.pq_align = 2;
+	dw->dma.fill_align = 2;
+
 	dma_writel(dw, CFG, DW_CFG_DMA_EN);
 
 	printk(KERN_INFO "%s: DesignWare DMA Controller, %d channels\n",
-- 
1.7.10.4


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

* Re: [PATCH 3/3] dw_dmac: set default alignment
  2012-07-13  8:09 ` [PATCH 3/3] dw_dmac: set default alignment Andy Shevchenko
@ 2012-07-13  8:26   ` viresh kumar
  2012-07-13  8:45     ` Andy Shevchenko
  0 siblings, 1 reply; 12+ messages in thread
From: viresh kumar @ 2012-07-13  8:26 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: linux-kernel, Vinod Koul, Dan Williams, spear-devel

It would be nice to keep spear-devel in cc, as this is the second
platform that uses this driver.

On Fri, Jul 13, 2012 at 9:09 AM, Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
> The default values are filled to support at least mem-to-mem tests provided by
> dmatest module. It makes sense to choose the 4 bytes (2 least significant bits)
> alignment by the default.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  drivers/dma/dw_dmac.c |    6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/drivers/dma/dw_dmac.c b/drivers/dma/dw_dmac.c
> index 3d061c6..2a19ab6 100644
> --- a/drivers/dma/dw_dmac.c
> +++ b/drivers/dma/dw_dmac.c
> @@ -1485,6 +1485,12 @@ static int __devinit dw_probe(struct platform_device *pdev)
>         dw->dma.device_tx_status = dwc_tx_status;
>         dw->dma.device_issue_pending = dwc_issue_pending;
>
> +       /* Set default alignment */
> +       dw->dma.copy_align = 2;
> +       dw->dma.xor_align = 2;
> +       dw->dma.pq_align = 2;
> +       dw->dma.fill_align = 2;

To understand it more, what does this mean? We will not support
transfers with unaligned
addresses/length to word size?

--
viresh

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

* Re: [PATCH 1/3] dw_dmac: mark dwc_dump_lli inline
  2012-07-13  8:09 [PATCH 1/3] dw_dmac: mark dwc_dump_lli inline Andy Shevchenko
  2012-07-13  8:09 ` [PATCH 2/3] dw_dmac: use 'u32' for LLI structure members, not dma_addr_t Andy Shevchenko
  2012-07-13  8:09 ` [PATCH 3/3] dw_dmac: set default alignment Andy Shevchenko
@ 2012-07-13  8:27 ` viresh kumar
  2012-07-16  6:34 ` Vinod Koul
  3 siblings, 0 replies; 12+ messages in thread
From: viresh kumar @ 2012-07-13  8:27 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: linux-kernel, Vinod Koul, Dan Williams

On Fri, Jul 13, 2012 at 9:09 AM, Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  drivers/dma/dw_dmac.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/dma/dw_dmac.c b/drivers/dma/dw_dmac.c
> index 9151511..db56ef4 100644
> --- a/drivers/dma/dw_dmac.c
> +++ b/drivers/dma/dw_dmac.c
> @@ -413,7 +413,7 @@ static void dwc_scan_descriptors(struct dw_dma *dw, struct dw_dma_chan *dwc)
>         spin_unlock_irqrestore(&dwc->lock, flags);
>  }
>
> -static void dwc_dump_lli(struct dw_dma_chan *dwc, struct dw_lli *lli)
> +static inline void dwc_dump_lli(struct dw_dma_chan *dwc, struct dw_lli *lli)
>  {
>         dev_printk(KERN_CRIT, chan2dev(&dwc->chan),
>                         "  desc: s0x%llx d0x%llx l0x%llx c0x%x:%x\n",

Acked-by: Viresh Kumar <viresh.kumar@linaro.org>

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

* Re: [PATCH 2/3] dw_dmac: use 'u32' for LLI structure members, not dma_addr_t
  2012-07-13  8:09 ` [PATCH 2/3] dw_dmac: use 'u32' for LLI structure members, not dma_addr_t Andy Shevchenko
@ 2012-07-13  8:27   ` viresh kumar
  0 siblings, 0 replies; 12+ messages in thread
From: viresh kumar @ 2012-07-13  8:27 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: linux-kernel, Vinod Koul, Dan Williams, spear-devel

On Fri, Jul 13, 2012 at 9:09 AM, Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
> Use 'u32' for the LLI structure members, which are defined by hardware to be
> 32-bit. dma_addr_t is much more vague about its actual size.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  drivers/dma/dw_dmac.c      |    7 ++-----
>  drivers/dma/dw_dmac_regs.h |    6 +++---
>  2 files changed, 5 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/dma/dw_dmac.c b/drivers/dma/dw_dmac.c
> index db56ef4..3d061c6 100644
> --- a/drivers/dma/dw_dmac.c
> +++ b/drivers/dma/dw_dmac.c
> @@ -416,11 +416,8 @@ static void dwc_scan_descriptors(struct dw_dma *dw, struct dw_dma_chan *dwc)
>  static inline void dwc_dump_lli(struct dw_dma_chan *dwc, struct dw_lli *lli)
>  {
>         dev_printk(KERN_CRIT, chan2dev(&dwc->chan),
> -                       "  desc: s0x%llx d0x%llx l0x%llx c0x%x:%x\n",
> -                       (unsigned long long)lli->sar,
> -                       (unsigned long long)lli->dar,
> -                       (unsigned long long)lli->llp,
> -                       lli->ctlhi, lli->ctllo);
> +                       "  desc: s0x%x d0x%x l0x%x c0x%x:%x\n",
> +                       lli->sar, lli->dar, lli->llp, lli->ctlhi, lli->ctllo);
>  }
>
>  static void dwc_handle_error(struct dw_dma *dw, struct dw_dma_chan *dwc)
> diff --git a/drivers/dma/dw_dmac_regs.h b/drivers/dma/dw_dmac_regs.h
> index e248481..50830be 100644
> --- a/drivers/dma/dw_dmac_regs.h
> +++ b/drivers/dma/dw_dmac_regs.h
> @@ -219,9 +219,9 @@ static inline struct dw_dma *to_dw_dma(struct dma_device *ddev)
>  /* LLI == Linked List Item; a.k.a. DMA block descriptor */
>  struct dw_lli {
>         /* values that are not changed by hardware */
> -       dma_addr_t      sar;
> -       dma_addr_t      dar;
> -       dma_addr_t      llp;            /* chain to next lli */
> +       u32             sar;
> +       u32             dar;
> +       u32             llp;            /* chain to next lli */
>         u32             ctllo;
>         /* values that may get written back: */
>         u32             ctlhi;

Acked-by: Viresh Kumar <viresh.kumar@linaro.org>

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

* Re: [PATCH 3/3] dw_dmac: set default alignment
  2012-07-13  8:26   ` viresh kumar
@ 2012-07-13  8:45     ` Andy Shevchenko
  2012-07-13  8:56       ` viresh kumar
  0 siblings, 1 reply; 12+ messages in thread
From: Andy Shevchenko @ 2012-07-13  8:45 UTC (permalink / raw)
  To: viresh kumar
  Cc: Andy Shevchenko, linux-kernel, Vinod Koul, Dan Williams, spear-devel

On Fri, Jul 13, 2012 at 11:26 AM, viresh kumar <viresh.kumar@linaro.org> wrote:
> It would be nice to keep spear-devel in cc, as this is the second
> platform that uses this driver.
I used to get the list of recipients via get_maintainer script. Will
try to not forget about that address in the future.

>> The default values are filled to support at least mem-to-mem tests provided by
>> dmatest module. It makes sense to choose the 4 bytes (2 least significant bits)
>> alignment by the default.

>> diff --git a/drivers/dma/dw_dmac.c b/drivers/dma/dw_dmac.c
>> index 3d061c6..2a19ab6 100644
>> --- a/drivers/dma/dw_dmac.c
>> +++ b/drivers/dma/dw_dmac.c
>> @@ -1485,6 +1485,12 @@ static int __devinit dw_probe(struct platform_device *pdev)
>>         dw->dma.device_tx_status = dwc_tx_status;
>>         dw->dma.device_issue_pending = dwc_issue_pending;
>>
>> +       /* Set default alignment */
>> +       dw->dma.copy_align = 2;
>> +       dw->dma.xor_align = 2;
>> +       dw->dma.pq_align = 2;
>> +       dw->dma.fill_align = 2;
>
> To understand it more, what does this mean? We will not support
> transfers with unaligned
> addresses/length to word size?
The dmatest module uses those constants to get source, destination
addresses and length of the test data aligned. On the other hand we
can't use unaligned address in LLI because of the hardware restriction
(2 bits are used for choosing AHB master).


-- 
With Best Regards,
Andy Shevchenko

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

* Re: [PATCH 3/3] dw_dmac: set default alignment
  2012-07-13  8:45     ` Andy Shevchenko
@ 2012-07-13  8:56       ` viresh kumar
  2012-07-13 10:04         ` Andy Shevchenko
  0 siblings, 1 reply; 12+ messages in thread
From: viresh kumar @ 2012-07-13  8:56 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: viresh kumar, Andy Shevchenko, linux-kernel, Vinod Koul,
	Dan Williams, spear-devel

On 13/07/12 09:45, Andy Shevchenko wrote:
>> > To understand it more, what does this mean? We will not support
>> > transfers with unaligned
>> > addresses/length to word size?
> The dmatest module uses those constants to get source, destination
> addresses and length of the test data aligned. On the other hand we
> can't use unaligned address in LLI because of the hardware restriction
> (2 bits are used for choosing AHB master).

To be clear, we can't use unaligned address of an LLI struct, but src/dest
address inside LLI can be unaligned.

I wanted to ask, will normal memcpy for anybody will work with unaligned addresses
with this patch? I believe they will.

--
Viresh



-- IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium.  Thank you.


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

* Re: [PATCH 3/3] dw_dmac: set default alignment
  2012-07-13  8:56       ` viresh kumar
@ 2012-07-13 10:04         ` Andy Shevchenko
  2012-07-13 10:30           ` viresh kumar
  0 siblings, 1 reply; 12+ messages in thread
From: Andy Shevchenko @ 2012-07-13 10:04 UTC (permalink / raw)
  To: viresh kumar
  Cc: viresh kumar, Andy Shevchenko, linux-kernel, Vinod Koul,
	Dan Williams, spear-devel

On Fri, Jul 13, 2012 at 11:56 AM, viresh kumar <viresh.kumar2@arm.com> wrote:
> I wanted to ask, will normal memcpy for anybody will work with unaligned addresses
> with this patch? I believe they will.
Hmm... I just rechecked and it seems it works without this patch. I
didn't remember why this patch still in my pool.

-- 
With Best Regards,
Andy Shevchenko

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

* Re: [PATCH 3/3] dw_dmac: set default alignment
  2012-07-13 10:04         ` Andy Shevchenko
@ 2012-07-13 10:30           ` viresh kumar
  2012-07-13 10:34             ` Andy Shevchenko
  0 siblings, 1 reply; 12+ messages in thread
From: viresh kumar @ 2012-07-13 10:30 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: viresh kumar, Andy Shevchenko, linux-kernel, Vinod Koul,
	Dan Williams, spear-devel

On 13/07/12 11:04, Andy Shevchenko wrote:
> On Fri, Jul 13, 2012 at 11:56 AM, viresh kumar <viresh.kumar2@arm.com> wrote:
>> I wanted to ask, will normal memcpy for anybody will work with unaligned addresses
>> with this patch? I believe they will.
> Hmm... I just rechecked and it seems it works without this patch. I
> didn't remember why this patch still in my pool.

Sorry, got confused now. What works without this patch? And what doesn't work without it?

--
Viresh

-- IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium.  Thank you.


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

* Re: [PATCH 3/3] dw_dmac: set default alignment
  2012-07-13 10:30           ` viresh kumar
@ 2012-07-13 10:34             ` Andy Shevchenko
  0 siblings, 0 replies; 12+ messages in thread
From: Andy Shevchenko @ 2012-07-13 10:34 UTC (permalink / raw)
  To: viresh kumar
  Cc: viresh kumar, Andy Shevchenko, linux-kernel, Vinod Koul,
	Dan Williams, spear-devel

On Fri, Jul 13, 2012 at 1:30 PM, viresh kumar <viresh.kumar2@arm.com> wrote:
> Sorry, got confused now. What works without this patch? And what doesn't work without it?
It seems this patch is redundant.

-- 
With Best Regards,
Andy Shevchenko

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

* Re: [PATCH 1/3] dw_dmac: mark dwc_dump_lli inline
  2012-07-13  8:09 [PATCH 1/3] dw_dmac: mark dwc_dump_lli inline Andy Shevchenko
                   ` (2 preceding siblings ...)
  2012-07-13  8:27 ` [PATCH 1/3] dw_dmac: mark dwc_dump_lli inline viresh kumar
@ 2012-07-16  6:34 ` Vinod Koul
  3 siblings, 0 replies; 12+ messages in thread
From: Vinod Koul @ 2012-07-16  6:34 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: Viresh Kumar, linux-kernel, Dan Williams

On Fri, 2012-07-13 at 11:09 +0300, Andy Shevchenko wrote:

Applied 1 & 2 only, Thanks

-- 
~Vinod


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

end of thread, other threads:[~2012-07-16  6:34 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-13  8:09 [PATCH 1/3] dw_dmac: mark dwc_dump_lli inline Andy Shevchenko
2012-07-13  8:09 ` [PATCH 2/3] dw_dmac: use 'u32' for LLI structure members, not dma_addr_t Andy Shevchenko
2012-07-13  8:27   ` viresh kumar
2012-07-13  8:09 ` [PATCH 3/3] dw_dmac: set default alignment Andy Shevchenko
2012-07-13  8:26   ` viresh kumar
2012-07-13  8:45     ` Andy Shevchenko
2012-07-13  8:56       ` viresh kumar
2012-07-13 10:04         ` Andy Shevchenko
2012-07-13 10:30           ` viresh kumar
2012-07-13 10:34             ` Andy Shevchenko
2012-07-13  8:27 ` [PATCH 1/3] dw_dmac: mark dwc_dump_lli inline viresh kumar
2012-07-16  6:34 ` Vinod Koul

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.