Linux MIPS Architecture development
 help / color / mirror / Atom feed
* Alchemy DMA and GFP_DMA
@ 2007-08-16 11:05 Ralf Baechle
  2007-08-26 14:48 ` Sergei Shtylyov
  0 siblings, 1 reply; 4+ messages in thread
From: Ralf Baechle @ 2007-08-16 11:05 UTC (permalink / raw)
  To: linux-mips

arch/mips/au1000/common/dbdma.c uses GFP_DMA in two places and I think
both instances are uncessary.  Could some alchmist confirm that both are
unnecessary?

Thanks,

  Ralf

Signed-off-by: Ralf Baechle <ralf@linux-mips.org>

diff --git a/arch/mips/au1000/common/dbdma.c b/arch/mips/au1000/common/dbdma.c
index 626de44..708b83b 100644
--- a/arch/mips/au1000/common/dbdma.c
+++ b/arch/mips/au1000/common/dbdma.c
@@ -397,7 +397,7 @@ au1xxx_dbdma_ring_alloc(u32 chanid, int entries)
 	 * slabs of memory.
 	 */
 	desc_base = (u32)kmalloc(entries * sizeof(au1x_ddma_desc_t),
-			GFP_KERNEL|GFP_DMA);
+			GFP_KERNEL);
 	if (desc_base == 0)
 		return 0;
 
@@ -408,7 +408,7 @@ au1xxx_dbdma_ring_alloc(u32 chanid, int entries)
 		kfree((const void *)desc_base);
 		i = entries * sizeof(au1x_ddma_desc_t);
 		i += (sizeof(au1x_ddma_desc_t) - 1);
-		if ((desc_base = (u32)kmalloc(i, GFP_KERNEL|GFP_DMA)) == 0)
+		if ((desc_base = (u32)kmalloc(i, GFP_KERNEL)) == 0)
 			return 0;
 
 		desc_base = ALIGN_ADDR(desc_base, sizeof(au1x_ddma_desc_t));

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

* RE: Alchemy DMA and GFP_DMA
@ 2007-08-17 15:29 bo y
  0 siblings, 0 replies; 4+ messages in thread
From: bo y @ 2007-08-17 15:29 UTC (permalink / raw)
  To: linux-mips

>arch/mips/au1000/common/dbdma.c uses GFP_DMA in two places and I think
>both instances are uncessary.  Could some alchmist confirm that both are
>unnecessary?
>
>Thanks,
>
>  Ralf

I tested it without GFP_DMA on Au1550 board. It worked.

The more serious problem in dbdma.c is how DMA descriptor cmd1
register is used. In multiple places, it just do

-       dp->dscr_cmd1 = nbytes;

Au1550/1200 supports 0x3fffff bytes of buffer. So the following is
better I think.

+       if(nbytes > DSCR_CMD1_BC_MASK) {
+               return 0;
+       }
+       dp->dscr_cmd1 = (dp->dscr_cmd1 & ~DSCR_CMD1_BC_MASK) + nbytes;

Also, there is no way to do memory-to-PCI dma. I added a few lines in
au1xxx_dbdma_ring_alloc().

+         if(DSCR_CUSTOM2DEV_ID(destid) == DSCR_CMD0_PCI_WRITE) {
+                cmd1 |= 0x04000000;
+         }
+         if(DSCR_CUSTOM2DEV_ID(srcid) == DSCR_CMD0_PCI_WRITE) {
+                cmd1 |= 0x40000000;
+         }

Last, a few places like:

-       nbytes = dscr->dscr_cmd1;

+       nbytes = (DSCR_CMD1_BC_MASK & dscr->dscr_cmd1);


Thanks.

Bo

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

* Re: Alchemy DMA and GFP_DMA
  2007-08-16 11:05 Alchemy DMA and GFP_DMA Ralf Baechle
@ 2007-08-26 14:48 ` Sergei Shtylyov
  2007-08-26 15:36   ` Ralf Baechle
  0 siblings, 1 reply; 4+ messages in thread
From: Sergei Shtylyov @ 2007-08-26 14:48 UTC (permalink / raw)
  To: Ralf Baechle; +Cc: linux-mips

Hello.

Ralf Baechle wrote:

> arch/mips/au1000/common/dbdma.c uses GFP_DMA in two places and I think
> both instances are uncessary.  Could some alchmist confirm that both are
> unnecessary?

> Thanks,

>   Ralf

> Signed-off-by: Ralf Baechle <ralf@linux-mips.org>

> diff --git a/arch/mips/au1000/common/dbdma.c b/arch/mips/au1000/common/dbdma.c
> index 626de44..708b83b 100644
> --- a/arch/mips/au1000/common/dbdma.c
> +++ b/arch/mips/au1000/common/dbdma.c
> @@ -397,7 +397,7 @@ au1xxx_dbdma_ring_alloc(u32 chanid, int entries)
>  	 * slabs of memory.
>  	 */
>  	desc_base = (u32)kmalloc(entries * sizeof(au1x_ddma_desc_t),
> -			GFP_KERNEL|GFP_DMA);
> +			GFP_KERNEL);
>  	if (desc_base == 0)
>  		return 0;
>  
> @@ -408,7 +408,7 @@ au1xxx_dbdma_ring_alloc(u32 chanid, int entries)
>  		kfree((const void *)desc_base);
>  		i = entries * sizeof(au1x_ddma_desc_t);
>  		i += (sizeof(au1x_ddma_desc_t) - 1);
> -		if ((desc_base = (u32)kmalloc(i, GFP_KERNEL|GFP_DMA)) == 0)
> +		if ((desc_base = (u32)kmalloc(i, GFP_KERNEL)) == 0)
>  			return 0;
>  
>  		desc_base = ALIGN_ADDR(desc_base, sizeof(au1x_ddma_desc_t));

     Those are probably still necessary because the DBDMA descriptors itselves 
(not the data they address) must have 32-bit addresses.

WBR, Sergei

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

* Re: Alchemy DMA and GFP_DMA
  2007-08-26 14:48 ` Sergei Shtylyov
@ 2007-08-26 15:36   ` Ralf Baechle
  0 siblings, 0 replies; 4+ messages in thread
From: Ralf Baechle @ 2007-08-26 15:36 UTC (permalink / raw)
  To: Sergei Shtylyov; +Cc: linux-mips

On Sun, Aug 26, 2007 at 06:48:41PM +0400, Sergei Shtylyov wrote:

>     Those are probably still necessary because the DBDMA descriptors 
>     itselves (not the data they address) must have 32-bit addresses.

A normla GFP_KERNEL allocation will give you that.

  Ralf

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

end of thread, other threads:[~2007-08-26 15:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-16 11:05 Alchemy DMA and GFP_DMA Ralf Baechle
2007-08-26 14:48 ` Sergei Shtylyov
2007-08-26 15:36   ` Ralf Baechle
  -- strict thread matches above, loose matches on Subject: below --
2007-08-17 15:29 bo y

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox