Skip to content

Commit

Permalink
x86/pci/dma: Fix gfp flags for coherent DMA memory allocation
Browse files Browse the repository at this point in the history
Commit 6894258 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() are just
discarded and cause coherent DMA memory allocation failure on some
devices.

Fixes: 6894258 ("dma-mapping: consolidate dma_{alloc,free}_{attrs,coherent}")
Signed-off-by: Jun'ichi Nomura <j-nomura@ce.jp.nec.com>
Tested-by: Tony Luck <tony.luck@intel.com>
Acked-by: Christoph Hellwig <hch@lst.de>
Link: http://lkml.kernel.org/r/20150914073834.GA13077@xzibit.linux.bs1.fc.nec.co.jp
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
  • Loading branch information
Junichi Nomura authored and Thomas Gleixner committed Sep 17, 2015
1 parent 6ff33f3 commit 590f078
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion arch/x86/kernel/pci-dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 590f078

Please sign in to comment.