MIPS: dma-default: Fix 32-bit fall back to GFP_DMA
authorJames Hogan <james.hogan@imgtec.com>
Fri, 27 Mar 2015 08:33:43 +0000 (08:33 +0000)
committerSasha Levin <sasha.levin@oracle.com>
Wed, 28 Oct 2015 02:14:10 +0000 (22:14 -0400)
commitab4c92c41d879aef3c54359cc6e1c95b80242fde
tree417e607eeb03ec6fca48e51c2d410f1166bbcd8d
parentd3e32326c31c915dc6cd86f015deed2708e5d1bb
MIPS: dma-default: Fix 32-bit fall back to GFP_DMA

[ Upstream commit 53960059d56ecef67d4ddd546731623641a3d2d1 ]

If there is a DMA zone (usually 24bit = 16MB I believe), but no DMA32
zone, as is the case for some 32-bit kernels, then massage_gfp_flags()
will cause DMA memory allocated for devices with a 32..63-bit
coherent_dma_mask to fall back to using __GFP_DMA, even though there may
only be 32-bits of physical address available anyway.

Correct that case to compare against a mask the size of phys_addr_t
instead of always using a 64-bit mask.

Signed-off-by: James Hogan <james.hogan@imgtec.com>
Fixes: a2e715a86c6d ("MIPS: DMA: Fix computation of DMA flags from device's coherent_dma_mask.")
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: linux-mips@linux-mips.org
Cc: <stable@vger.kernel.org> # 2.6.36+
Patchwork: https://patchwork.linux-mips.org/patch/9610/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
arch/mips/mm/dma-default.c