diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2009-01-28 07:53:16 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-01-29 08:39:28 -0500 |
commit | 97d9800de9df9c6e71b00c0a26239c7d7f6a46c4 (patch) | |
tree | bc90316e890bdc84989f1706abccdac43c3feab5 /arch/ia64/kernel/pci-swiotlb.c | |
parent | fb4467274de0c93e15c4a4fd3249d62454ba57dc (diff) |
IA64: fix swiotlb alloc_coherent for non DMA_64BIT_MASK devices
Before the dma ops unification, IA64 always uses GFP_DMA for
dma_alloc_coherent like:
#define dma_alloc_coherent(dev, size, handle, gfp) \
platform_dma_alloc_coherent(dev, size, handle, (gfp) | GFP_DMA)
This GFP_DMA enforcement doesn't make sense for IOMMUs since they can
do address translation to give addresses that devices can access
to. The IOMMU drivers ignore the zone flag. However, this is still
necessary for swiotlb since it can't do address translation.
We don't always need to use GFP_DMA for swiotlb. We need GFP_DMA for
devices incapable of 64bit DMA.
This patch is sorta updated version of:
http://marc.info/?l=linux-kernel&m=122638215612705&w=2
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/ia64/kernel/pci-swiotlb.c')
-rw-r--r-- | arch/ia64/kernel/pci-swiotlb.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/arch/ia64/kernel/pci-swiotlb.c b/arch/ia64/kernel/pci-swiotlb.c index 717ad4f1c708..573f02c39a00 100644 --- a/arch/ia64/kernel/pci-swiotlb.c +++ b/arch/ia64/kernel/pci-swiotlb.c | |||
@@ -13,8 +13,16 @@ | |||
13 | int swiotlb __read_mostly; | 13 | int swiotlb __read_mostly; |
14 | EXPORT_SYMBOL(swiotlb); | 14 | EXPORT_SYMBOL(swiotlb); |
15 | 15 | ||
16 | static void *ia64_swiotlb_alloc_coherent(struct device *dev, size_t size, | ||
17 | dma_addr_t *dma_handle, gfp_t gfp) | ||
18 | { | ||
19 | if (dev->coherent_dma_mask != DMA_64BIT_MASK) | ||
20 | gfp |= GFP_DMA; | ||
21 | return swiotlb_alloc_coherent(dev, size, dma_handle, gfp); | ||
22 | } | ||
23 | |||
16 | struct dma_map_ops swiotlb_dma_ops = { | 24 | struct dma_map_ops swiotlb_dma_ops = { |
17 | .alloc_coherent = swiotlb_alloc_coherent, | 25 | .alloc_coherent = ia64_swiotlb_alloc_coherent, |
18 | .free_coherent = swiotlb_free_coherent, | 26 | .free_coherent = swiotlb_free_coherent, |
19 | .map_page = swiotlb_map_page, | 27 | .map_page = swiotlb_map_page, |
20 | .unmap_page = swiotlb_unmap_page, | 28 | .unmap_page = swiotlb_unmap_page, |