public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: David Moore <dcm@MIT.EDU>
To: Stefan Richter <stefanr@s5r6.in-berlin.de>
Cc: linux1394-devel@lists.sourceforge.net, linux-scsi@vger.kernel.org
Subject: Re: [PATCH] ieee1394: sbp2: enforce 32bit DMA mapping
Date: Sun, 04 Feb 2007 11:06:37 -0500	[thread overview]
Message-ID: <1170605197.26464.16.camel@PISCES.MIT.EDU> (raw)
In-Reply-To: <tkrat.61995f33104845d9@s5r6.in-berlin.de>

Yes, I think you should use GFP_DMA32 instead of GFP_DMA.  GFP_DMA
refers to just the first 16MB of memory.

I'd like to make a similar change in ieee1394/dma.c.  Right now, it
allocates large DMA regions with vmalloc().  One reason why that is bad
is because it often returns physical addresses larger than 32-bits,
causing the hardware to use bounce buffers (and is thus slow, and also
happened to expose a bug in swiotlb).

-David

On Sun, 2007-02-04 at 13:05 +0100, Stefan Richter wrote:
> In order to use OHCI physical DMA, all s/g elements, s/g tables, ORBs,
> and response buffers have to reside within the first 4 GB of the
> FireWire controller's physical address space.  Set the correct mask for
> DMA mappings.
> 
> Also ensure that the memory allocated for command ORBs and s/g tables is
> suitable for DMA.
> 
> Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
> ---
> Should I use GFP_DMA32 instead of GFP_DMA?
> 
> 
>  drivers/ieee1394/sbp2.c |    7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> Index: linux-2.6.20-rc5/drivers/ieee1394/sbp2.c
> ===================================================================
> --- linux-2.6.20-rc5.orig/drivers/ieee1394/sbp2.c
> +++ linux-2.6.20-rc5/drivers/ieee1394/sbp2.c
> @@ -477,7 +477,7 @@ static int sbp2util_create_command_orb_p
>  
>  	spin_lock_irqsave(&lu->cmd_orb_lock, flags);
>  	for (i = 0; i < orbs; i++) {
> -		cmd = kzalloc(sizeof(*cmd), GFP_ATOMIC);
> +		cmd = kzalloc(sizeof(*cmd), GFP_ATOMIC | GFP_DMA);
>  		if (!cmd) {
>  			spin_unlock_irqrestore(&lu->cmd_orb_lock, flags);
>  			return -ENOMEM;
> @@ -757,6 +757,11 @@ static struct sbp2_lu *sbp2_alloc_device
>  			SBP2_ERR("failed to register lower 4GB address range");
>  			goto failed_alloc;
>  		}
> +#else
> +		if (dma_set_mask(hi->host->device.parent, DMA_32BIT_MASK)) {
> +			SBP2_ERR("failed to set 4GB DMA mask");
> +			goto failed_alloc;
> +		}
>  #endif
>  	}
>  
> 
> 


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

  reply	other threads:[~2007-02-04 16:06 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-14 18:45 [PATCH] ieee1394: sbp2: lower block queue alignment requirement Stefan Richter
2007-01-14 19:19 ` James Bottomley
2007-01-14 20:14   ` Stefan Richter
2007-01-15 19:39     ` Kristian Høgsberg
2007-01-15 19:50       ` Mike Christie
2007-01-15 20:02       ` Stefan Richter
2007-01-15 21:24         ` James Bottomley
2007-01-25 21:35   ` Stefan Richter
2007-02-04 12:04     ` [PATCH] ieee1394: sbp2: remove unnecessary alignments of struct members Stefan Richter
2007-02-04 12:05       ` [PATCH] ieee1394: sbp2: enforce 32bit DMA mapping Stefan Richter
2007-02-04 16:06         ` David Moore [this message]
2007-02-04 19:25           ` Stefan Richter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1170605197.26464.16.camel@PISCES.MIT.EDU \
    --to=dcm@mit.edu \
    --cc=linux-scsi@vger.kernel.org \
    --cc=linux1394-devel@lists.sourceforge.net \
    --cc=stefanr@s5r6.in-berlin.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox