* [PATCH v2] of: Set the DMA mask to 64 bits when dma_addr_t is 64-bits
@ 2013-04-26 18:06 Laura Abbott
[not found] ` <1366999565-19498-1-git-send-email-lauraa-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
0 siblings, 1 reply; 3+ messages in thread
From: Laura Abbott @ 2013-04-26 18:06 UTC (permalink / raw)
To: linux-arm-kernel, devicetree-discuss, Catalin Marinas,
Rob Herring
Cc: Laura Abbott
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
dev->dev.bus = &platform_bus_type;
dev->dev.platform_data = platform_data;
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation
^ permalink raw reply related [flat|nested] 3+ messages in thread[parent not found: <1366999565-19498-1-git-send-email-lauraa-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>]
* Re: [PATCH v2] of: Set the DMA mask to 64 bits when dma_addr_t is 64-bits [not found] ` <1366999565-19498-1-git-send-email-lauraa-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org> @ 2013-04-26 20:03 ` Rob Herring [not found] ` <517ADDA9.7020701-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 0 siblings, 1 reply; 3+ messages in thread From: Rob Herring @ 2013-04-26 20:03 UTC (permalink / raw) To: Laura Abbott Cc: Catalin Marinas, devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r 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 ^ permalink raw reply [flat|nested] 3+ messages in thread
[parent not found: <517ADDA9.7020701-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>]
* Re: [PATCH v2] of: Set the DMA mask to 64 bits when dma_addr_t is 64-bits [not found] ` <517ADDA9.7020701-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> @ 2013-04-26 20:14 ` Laura Abbott 0 siblings, 0 replies; 3+ messages in thread From: Laura Abbott @ 2013-04-26 20:14 UTC (permalink / raw) To: Rob Herring Cc: Catalin Marinas, devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r On 4/26/2013 1:03 PM, Rob Herring wrote: > 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. > Sounds good. > Rob > Thanks, Laura -- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-04-26 20:14 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-26 18:06 [PATCH v2] of: Set the DMA mask to 64 bits when dma_addr_t is 64-bits Laura Abbott
[not found] ` <1366999565-19498-1-git-send-email-lauraa-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2013-04-26 20:03 ` Rob Herring
[not found] ` <517ADDA9.7020701-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-04-26 20:14 ` Laura Abbott
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).