All of lore.kernel.org
 help / color / mirror / Atom feed
From: robherring2@gmail.com (Rob Herring)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2] of: Set the DMA mask to 64 bits when dma_addr_t is 64-bits
Date: Fri, 26 Apr 2013 15:03:53 -0500	[thread overview]
Message-ID: <517ADDA9.7020701@gmail.com> (raw)
In-Reply-To: <1366999565-19498-1-git-send-email-lauraa@codeaurora.org>

On 04/26/2013 01:06 PM, Laura Abbott wrote:
> Currently, of_platform_device_create_pdata always sets the
> coherent DMA mask to 32 bits. On ARM systems without CONFIG_ZONE_DMA,
> arm_dma_limit gets set to ~0 or 0xFFFFFFFFFFFFFFFF on LPAE based
> systems. Since arm_dma_limit represents the smallest dma_mask
> on the system, the default of 32 bits prevents any dma_coherent
> allocation from succeeding unless clients manually set the
> dma mask first. Rather than make every client on an LPAE system set
> the mask, set the mask to a 64 bit value on systems with 64-bit
> dma addresses.
> 
> Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
> ---
>  drivers/of/platform.c |    4 ++++
>  1 files changed, 4 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/of/platform.c b/drivers/of/platform.c
> index 0970505..c669ab4 100644
> --- a/drivers/of/platform.c
> +++ b/drivers/of/platform.c
> @@ -214,7 +214,11 @@ struct platform_device *of_platform_device_create_pdata(
>  #if defined(CONFIG_MICROBLAZE)
>  	dev->archdata.dma_mask = 0xffffffffUL;
>  #endif
> +#ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT
> +	dev->dev.coherent_dma_mask = DMA_BIT_MASK(64);
> +#else
>  	dev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
> +#endif

How about "DMA_BIT_MASK(sizeof(dma_addr_t) * 8))" and avoid the ifdef.

Rob

WARNING: multiple messages have this Message-ID (diff)
From: Rob Herring <robherring2-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Laura Abbott <lauraa-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
Cc: Catalin Marinas <catalin.marinas-5wv7dgnIgG8@public.gmane.org>,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
Subject: Re: [PATCH v2] of: Set the DMA mask to 64 bits when dma_addr_t is 64-bits
Date: Fri, 26 Apr 2013 15:03:53 -0500	[thread overview]
Message-ID: <517ADDA9.7020701@gmail.com> (raw)
In-Reply-To: <1366999565-19498-1-git-send-email-lauraa-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>

On 04/26/2013 01:06 PM, Laura Abbott wrote:
> Currently, of_platform_device_create_pdata always sets the
> coherent DMA mask to 32 bits. On ARM systems without CONFIG_ZONE_DMA,
> arm_dma_limit gets set to ~0 or 0xFFFFFFFFFFFFFFFF on LPAE based
> systems. Since arm_dma_limit represents the smallest dma_mask
> on the system, the default of 32 bits prevents any dma_coherent
> allocation from succeeding unless clients manually set the
> dma mask first. Rather than make every client on an LPAE system set
> the mask, set the mask to a 64 bit value on systems with 64-bit
> dma addresses.
> 
> Signed-off-by: Laura Abbott <lauraa-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
> ---
>  drivers/of/platform.c |    4 ++++
>  1 files changed, 4 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/of/platform.c b/drivers/of/platform.c
> index 0970505..c669ab4 100644
> --- a/drivers/of/platform.c
> +++ b/drivers/of/platform.c
> @@ -214,7 +214,11 @@ struct platform_device *of_platform_device_create_pdata(
>  #if defined(CONFIG_MICROBLAZE)
>  	dev->archdata.dma_mask = 0xffffffffUL;
>  #endif
> +#ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT
> +	dev->dev.coherent_dma_mask = DMA_BIT_MASK(64);
> +#else
>  	dev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
> +#endif

How about "DMA_BIT_MASK(sizeof(dma_addr_t) * 8))" and avoid the ifdef.

Rob

  reply	other threads:[~2013-04-26 20:03 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-26 18:06 [PATCH v2] of: Set the DMA mask to 64 bits when dma_addr_t is 64-bits Laura Abbott
2013-04-26 18:06 ` Laura Abbott
2013-04-26 20:03 ` Rob Herring [this message]
2013-04-26 20:03   ` Rob Herring
2013-04-26 20:14   ` Laura Abbott
2013-04-26 20:14     ` Laura Abbott

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=517ADDA9.7020701@gmail.com \
    --to=robherring2@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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 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.