linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Michael Ellerman <michael@ellerman.id.au>
Cc: linuxppc-dev@ozlabs.org, Arnd Bergmann <arnd.bergmann@de.ibm.com>,
	cbe-oss-dev@ozlabs.org
Subject: Re: [PATCH 3/7] Use archdata.dma_data in dma_direct_ops and add the offset
Date: Mon, 21 Jan 2008 17:21:11 +1100	[thread overview]
Message-ID: <1200896471.7222.107.camel@pasglop> (raw)
In-Reply-To: <651e15968afb5bbd9eeafb0b66cd5b59eabcf8d9.1200894155.git.michael@ellerman.id.au>


On Mon, 2008-01-21 at 16:42 +1100, Michael Ellerman wrote:
> Now that all platforms using dma_direct_offset setup the archdata.dma_data
> correctly, we can change the dma_direct_ops to retrieve the offset from
> the dma_data, rather than directly from the global.
> 
> While we're here, change the way the offset is used - instead of or'ing it
> into the value, add it. This should have no effect on current implementations
> where the offset is far larger than memory, however in future we may want
> to use smaller offsets.
> 
> Signed-off-by: Michael Ellerman <michael@ellerman.id.au>

Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

> ---
>  arch/powerpc/kernel/dma_64.c |   11 ++++++++---
>  1 files changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/powerpc/kernel/dma_64.c b/arch/powerpc/kernel/dma_64.c
> index 14206e3..a2d076d 100644
> --- a/arch/powerpc/kernel/dma_64.c
> +++ b/arch/powerpc/kernel/dma_64.c
> @@ -117,6 +117,11 @@ EXPORT_SYMBOL(dma_iommu_ops);
>   */
>  unsigned long dma_direct_offset;
>  
> +static unsigned long get_dma_direct_offset(struct device *dev)
> +{
> +	return (unsigned long)dev->archdata.dma_data;
> +}
> +
>  static void *dma_direct_alloc_coherent(struct device *dev, size_t size,
>  				       dma_addr_t *dma_handle, gfp_t flag)
>  {
> @@ -130,7 +135,7 @@ static void *dma_direct_alloc_coherent(struct device *dev, size_t size,
>  		return NULL;
>  	ret = page_address(page);
>  	memset(ret, 0, size);
> -	*dma_handle = virt_to_abs(ret) | dma_direct_offset;
> +	*dma_handle = virt_to_abs(ret) + get_dma_direct_offset(dev);
>  
>  	return ret;
>  }
> @@ -145,7 +150,7 @@ static dma_addr_t dma_direct_map_single(struct device *dev, void *ptr,
>  					size_t size,
>  					enum dma_data_direction direction)
>  {
> -	return virt_to_abs(ptr) | dma_direct_offset;
> +	return virt_to_abs(ptr) + get_dma_direct_offset(dev);
>  }
>  
>  static void dma_direct_unmap_single(struct device *dev, dma_addr_t dma_addr,
> @@ -161,7 +166,7 @@ static int dma_direct_map_sg(struct device *dev, struct scatterlist *sgl,
>  	int i;
>  
>  	for_each_sg(sgl, sg, nents, i) {
> -		sg->dma_address = sg_phys(sg) | dma_direct_offset;
> +		sg->dma_address = sg_phys(sg) + get_dma_direct_offset(dev);
>  		sg->dma_length = sg->length;
>  	}
>  

  reply	other threads:[~2008-01-21  6:21 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-21  5:42 [PATCH 1/7] Set archdata.dma_data for direct DMA in cell_dma_dev_setup() Michael Ellerman
2008-01-21  5:42 ` [PATCH 2/7] Add celleb_dma_dev_setup() Michael Ellerman
2008-01-21  6:20   ` Benjamin Herrenschmidt
2008-01-21  5:42 ` [PATCH 3/7] Use archdata.dma_data in dma_direct_ops and add the offset Michael Ellerman
2008-01-21  6:21   ` Benjamin Herrenschmidt [this message]
2008-01-21  5:42 ` [PATCH 4/7] Have cell use its own dma_direct_offset variable Michael Ellerman
2008-01-21  6:21   ` Benjamin Herrenschmidt
2008-01-21  6:21   ` Benjamin Herrenschmidt
2008-01-21  5:42 ` [PATCH 5/7] Have celleb " Michael Ellerman
2008-01-21  6:21   ` Benjamin Herrenschmidt
2008-01-21  5:42 ` [PATCH 6/7] Remove the global dma_direct_offset Michael Ellerman
2008-01-21  6:21   ` Benjamin Herrenschmidt
2008-01-21  5:42 ` [PATCH 7/7] Remove bogus comment in dma_direct_alloc_coherent() Michael Ellerman
2008-01-21  6:22   ` Benjamin Herrenschmidt
2008-01-21  6:20 ` [PATCH 1/7] Set archdata.dma_data for direct DMA in cell_dma_dev_setup() Benjamin Herrenschmidt

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=1200896471.7222.107.camel@pasglop \
    --to=benh@kernel.crashing.org \
    --cc=arnd.bergmann@de.ibm.com \
    --cc=cbe-oss-dev@ozlabs.org \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=michael@ellerman.id.au \
    /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;
as well as URLs for NNTP newsgroup(s).