Skip to contentSkip to conversation

sparc32: dma_alloc_coherent must honour gfp flags

PATCH Applied Daniel Hellstrom 2 participants 3 messages Sep 10, 2014 – Sep 11, 2014 SPARC + UltraSPARC (sparc/sparc64)

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 sparc32: dma_alloc_coherent must honour gfp flags

dma_zalloc_coherent() calls dma_alloc_coherent(__GFP_ZERO) but the sparc32 implementations sbus_alloc_coherent() and pci32_alloc_coherent() doesn't take the gfp flags into account.

Tested on the SPARC32/LEON GRETH Ethernet driver which fails due to dma_alloc_coherent(__GFP_ZERO) returns non zeroed pages.

---
 arch/sparc/kernel/ioport.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
arch/sparc/kernel/ioport.c +3 -2
index 2096468..6cacf2d 100644
@@ -278,7 +278,8 @@ static void *sbus_alloc_coherent(struct device *dev, size_t len,
 	}
 
 	order = get_order(len_total);
-	if ((va = __get_free_pages(GFP_KERNEL|__GFP_COMP, order)) = 0)
+	va = __get_free_pages(gfp, order);
+	if (va = 0)
 		goto err_nopages;
 
 	if ((res = kzalloc(sizeof(struct resource), GFP_KERNEL)) = NULL)
@@ -443,7 +444,7 @@ static void *pci32_alloc_coherent(struct device *dev, size_t len,
 	}
 
 	order = get_order(len_total);
-	va = (void *) __get_free_pages(GFP_KERNEL, order);
+	va = (void *) __get_free_pages(gfp, order);
 	if (va = NULL) {
 		printk("pci_alloc_consistent: no %ld pages\n", len_total>>PAGE_SHIFT);
 		goto err_nopages;
Signature · 1 line
1.7.0.4
maintainer Applied
#1 lore raw

From: Daniel Hellstrom <[email protected]>
Date: Wed, 10 Sep 2014 14:17:52 +0200

Quoted 10 lines

dma_zalloc_coherent() calls dma_alloc_coherent(__GFP_ZERO) but the sparc32 implementations sbus_alloc_coherent() and pci32_alloc_coherent() doesn't take the gfp flags into account.

Tested on the SPARC32/LEON GRETH Ethernet driver which fails due to dma_alloc_coherent(__GFP_ZERO) returns non zeroed pages.

Applied, thanks Daniel.

#2 lore raw
In reply to Daniel Hellstrom
Quoted 8 lines · David Miller

From: Daniel Hellstrom<[email protected]>
Date: Wed, 10 Sep 2014 14:17:52 +0200

Quoted 5 lines

dma_zalloc_coherent() calls dma_alloc_coherent(__GFP_ZERO) but the sparc32 implementations sbus_alloc_coherent() and pci32_alloc_coherent() doesn't take the gfp flags into account.

Quoted 6 lines
Quoted 5 lines

Tested on the SPARC32/LEON GRETH Ethernet driver which fails due to dma_alloc_coherent(__GFP_ZERO) returns non zeroed pages.

Applied, thanks Daniel.

Thanks! I think this is subject for the stable branches.