Skip to content

Commit e89dafb

Browse files
committed
powerpc: Only do dynamic DMA zone limits on platforms that need it
Scott's patch 1c98025 "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> Acked-by: Scott Wood <scottwood@freescale.com>
1 parent 86be175 commit e89dafb

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

‎arch/powerpc/kernel/dma.c‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,16 @@ void *dma_direct_alloc_coherent(struct device *dev, size_t size,
5353
#else
5454
struct page *page;
5555
int node = dev_to_node(dev);
56+
#ifdef CONFIG_FSL_SOC
5657
u64 pfn = get_pfn_limit(dev);
5758
int zone;
5859

60+
/*
61+
* This code should be OK on other platforms, but we have drivers that
62+
* don't set coherent_dma_mask. As a workaround we just ifdef it. This
63+
* whole routine needs some serious cleanup.
64+
*/
65+
5966
zone = dma_pfn_limit_to_zone(pfn);
6067
if (zone < 0) {
6168
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,
7380
break;
7481
#endif
7582
};
83+
#endif /* CONFIG_FSL_SOC */
7684

7785
/* ignore region specifiers */
7886
flag &= ~(__GFP_HIGHMEM);

0 commit comments

Comments
 (0)