Skip to contentSkip to conversation

dw_dmac: mark dwc_dump_lli inline

PATCH In review Andy Shevchenko 5 participants 12 messages Jul 13, 2012 – Jul 16, 2012 dmaengine

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 dw_dmac: mark dwc_dump_lli inline

---
 drivers/dma/dw_dmac.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/dma/dw_dmac.c +1 -1
index 9151511..db56ef4 100644
@@ -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",
Signature · 1 line
1.7.10.4
#1 lore raw

PATCH 2/3 dw_dmac: use 'u32' for LLI structure members, not dma_addr_t

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.

---
 drivers/dma/dw_dmac.c      |    7 ++-----
 drivers/dma/dw_dmac_regs.h |    6 +++---
 2 files changed, 5 insertions(+), 8 deletions(-)
drivers/dma/dw_dmac.c +2 -5
index db56ef4..3d061c6 100644
@@ -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)
drivers/dma/dw_dmac_regs.h +3 -3
index e248481..50830be 100644
@@ -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;
Signature · 1 line
1.7.10.4
Acked-by on v1 2/3
#2 lore raw

Re: [PATCH 2/3] dw_dmac: use 'u32' for LLI structure members, not dma_addr_t

Quoted 34 lines · 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.

---
 drivers/dma/dw_dmac.c      |    7 ++-----
 drivers/dma/dw_dmac_regs.h |    6 +++---
 2 files changed, 5 insertions(+), 8 deletions(-)
drivers/dma/dw_dmac.c +2 -5
index db56ef4..3d061c6 100644
@@ -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)
drivers/dma/dw_dmac_regs.h +0 -0
index e248481..50830be 100644
@@ -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 {

drivers/dma/dw_dmac_regs.h static inline struct dw_dma *to_dw_dma(struct dma_device *ddev) · line 227

Quoted 10 lines
drivers/dma/dw_dmac_regs.h +3 -3
        /* 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;
#3 lore raw

PATCH 3/3 dw_dmac: set default alignment

In reply to 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.

---
 drivers/dma/dw_dmac.c |    6 ++++++
 1 file changed, 6 insertions(+)
drivers/dma/dw_dmac.c +6 -0
index 3d061c6..2a19ab6 100644
@@ -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",
Signature · 1 line
1.7.10.4
#4 lore raw

Re: [PATCH 3/3] dw_dmac: set default alignment

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

Quoted 14 lines · 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.

---
 drivers/dma/dw_dmac.c |    6 ++++++
 1 file changed, 6 insertions(+)
drivers/dma/dw_dmac.c +0 -0
index 3d061c6..2a19ab6 100644

drivers/dma/dw_dmac.c static int __devinit dw_probe(struct platform_device *pdev) · line 1492

Quoted 8 lines
drivers/dma/dw_dmac.c +5 -0
@@ -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

#5 lore raw

Re: [PATCH 3/3] dw_dmac: set default alignment

Quoted 2 lines · viresh kumar

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.

Quoted 12 lines
Quoted 12 lines

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.

drivers/dma/dw_dmac.c +0 -0
index 3d061c6..2a19ab6 100644
@@ -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;
 
Quoted 9 lines

drivers/dma/dw_dmac.c static int __devinit dw_probe(struct platform_device *pdev) · line 1492

Quoted 5 lines
drivers/dma/dw_dmac.c +5 -0
+       /* 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).

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#6 lore raw

Re: [PATCH 3/3] dw_dmac: set default alignment

Quoted 7 lines · Andy Shevchenko
Quoted 3 lines
Quoted 3 lines

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.

#7 lore raw

Re: [PATCH 3/3] dw_dmac: set default alignment

Quoted 2 lines · viresh kumar

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.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#8 lore raw

Re: [PATCH 3/3] dw_dmac: set default alignment

Quoted 5 lines · Andy Shevchenko
Quoted 2 lines · viresh kumar

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.

#9 lore raw

Re: [PATCH 3/3] dw_dmac: set default alignment

Quoted 1 line · viresh kumar

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

It seems this patch is redundant.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
Acked-by on v1 1/3
#10 lore raw
In reply to Andy Shevchenko
Quoted 10 lines · Andy Shevchenko
---
 drivers/dma/dw_dmac.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/dma/dw_dmac.c +0 -0
index 9151511..db56ef4 100644

drivers/dma/dw_dmac.c static void dwc_scan_descriptors(struct dw_dma *dw, struct dw_dma_chan *dwc) · line 419

Quoted 8 lines
drivers/dma/dw_dmac.c +1 -1
@@ -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",