linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] powerpc: Only do dynamic DMA zone limits on platforms that need it
@ 2014-10-16  6:47 Michael Ellerman
  2014-10-16 21:39 ` Scott Wood
  0 siblings, 1 reply; 2+ messages in thread
From: Michael Ellerman @ 2014-10-16  6:47 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: scottwood, Anton Blanchard

Scott's patch 1c98025c6c95 "Dynamic DMA zone limits" changed
dma_direct_alloc_coherent() to start using dev->coherent_dma_mask.

That seems fair enough, but it exposes the fact that some of the drivers
we care about on IBM platforms aren't setting the coherent mask.

The proper fix is to have drivers set the coherent mask and also have
the platform code honor it.

For now, just restrict the dynamic DMA zone limits to the platforms that
need it.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
 arch/powerpc/kernel/dma.c | 8 ++++++++
 1 file changed, 8 insertions(+)

v2: Use FSL_SOC.

diff --git a/arch/powerpc/kernel/dma.c b/arch/powerpc/kernel/dma.c
index adac9dc54aee..484b2d4462c1 100644
--- a/arch/powerpc/kernel/dma.c
+++ b/arch/powerpc/kernel/dma.c
@@ -53,9 +53,16 @@ void *dma_direct_alloc_coherent(struct device *dev, size_t size,
 #else
 	struct page *page;
 	int node = dev_to_node(dev);
+#ifdef CONFIG_FSL_SOC
 	u64 pfn = get_pfn_limit(dev);
 	int zone;
 
+	/*
+	 * This code should be OK on other platforms, but we have drivers that
+	 * don't set coherent_dma_mask. As a workaround we just ifdef it. This
+	 * whole routine needs some serious cleanup.
+	 */
+
 	zone = dma_pfn_limit_to_zone(pfn);
 	if (zone < 0) {
 		dev_err(dev, "%s: No suitable zone for pfn %#llx\n",
@@ -73,6 +80,7 @@ void *dma_direct_alloc_coherent(struct device *dev, size_t size,
 		break;
 #endif
 	};
+#endif /* CONFIG_FSL_SOC */
 
 	/* ignore region specifiers */
 	flag  &= ~(__GFP_HIGHMEM);
-- 
1.9.1

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

* Re: [PATCH v2] powerpc: Only do dynamic DMA zone limits on platforms that need it
  2014-10-16  6:47 [PATCH v2] powerpc: Only do dynamic DMA zone limits on platforms that need it Michael Ellerman
@ 2014-10-16 21:39 ` Scott Wood
  0 siblings, 0 replies; 2+ messages in thread
From: Scott Wood @ 2014-10-16 21:39 UTC (permalink / raw)
  To: Michael Ellerman; +Cc: linuxppc-dev, Anton Blanchard

On Thu, 2014-10-16 at 17:47 +1100, Michael Ellerman wrote:
> Scott's patch 1c98025c6c95 "Dynamic DMA zone limits" changed
> dma_direct_alloc_coherent() to start using dev->coherent_dma_mask.
> 
> That seems fair enough, but it exposes the fact that some of the drivers
> we care about on IBM platforms aren't setting the coherent mask.
> 
> The proper fix is to have drivers set the coherent mask and also have
> the platform code honor it.
> 
> For now, just restrict the dynamic DMA zone limits to the platforms that
> need it.
> 
> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
> ---
>  arch/powerpc/kernel/dma.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> v2: Use FSL_SOC.

Acked-by: Scott Wood <scottwood@freescale.com>

-Scott

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

end of thread, other threads:[~2014-10-16 21:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-16  6:47 [PATCH v2] powerpc: Only do dynamic DMA zone limits on platforms that need it Michael Ellerman
2014-10-16 21:39 ` Scott Wood

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).