public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86: Fix gfp flags for coherent DMA memory allocation
@ 2015-09-14  7:38 Junichi Nomura
  2015-09-15  9:36 ` Junichi Nomura
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Junichi Nomura @ 2015-09-14  7:38 UTC (permalink / raw)
  To: linux-kernel@vger.kernel.org, x86@kernel.org, tglx@linutronix.de,
	mingo@redhat.com, Christoph Hellwig, hpa@zytor.com

Commit 6894258eda2f reversed the order of gfp_flags adjustment in
dma_alloc_attrs() for x86 [arch/x86/kernel/pci-dma.c]
As a result, relevant flags set by dma_alloc_coherent_gfp_flags()
is just discarded and causes coherent DMA memory allocation failure
on some devices.

Fixes: 6894258eda2f ("dma-mapping: consolidate dma_{alloc,free}_{attrs,coherent}")
Signed-off-by: Jun'ichi Nomura <j-nomura@ce.jp.nec.com>

diff --git a/arch/x86/kernel/pci-dma.c b/arch/x86/kernel/pci-dma.c
index 84b8ef8..1b55de1 100644
--- a/arch/x86/kernel/pci-dma.c
+++ b/arch/x86/kernel/pci-dma.c
@@ -131,8 +131,8 @@ void dma_generic_free_coherent(struct device *dev, size_t size, void *vaddr,
 
 bool arch_dma_alloc_attrs(struct device **dev, gfp_t *gfp)
 {
-	*gfp = dma_alloc_coherent_gfp_flags(*dev, *gfp);
 	*gfp &= ~(__GFP_DMA | __GFP_HIGHMEM | __GFP_DMA32);
+	*gfp = dma_alloc_coherent_gfp_flags(*dev, *gfp);
 
 	if (!*dev)
 		*dev = &x86_dma_fallback_dev;

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

end of thread, other threads:[~2015-09-17 14:28 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-14  7:38 [PATCH] x86: Fix gfp flags for coherent DMA memory allocation Junichi Nomura
2015-09-15  9:36 ` Junichi Nomura
2015-09-16 21:47 ` Tony Luck
2015-09-17  0:04 ` Christoph Hellwig
2015-09-17 14:27 ` [tip:x86/urgent] x86/pci/dma: " tip-bot for Junichi Nomura

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox