diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2006-11-11 01:25:16 -0500 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2006-12-04 04:38:59 -0500 |
commit | c80d9133e99de1af607314107910a2a1645efb17 (patch) | |
tree | 9243a3ce3feba1379857150548d3975918ac0640 /arch/powerpc/kernel/dma_64.c | |
parent | 92b20c40dcca2d441f367da57e7665cce15c492a (diff) |
[POWERPC] Make direct DMA use node local allocations
This patch makes dma_alloc_coherent() use node local allocation when
using the direct DMA ops. The node is obtained from the new device
extension. If no such extension is present, the current node is used.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/kernel/dma_64.c')
-rw-r--r-- | arch/powerpc/kernel/dma_64.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/arch/powerpc/kernel/dma_64.c b/arch/powerpc/kernel/dma_64.c index 1d1dc76606ac..7b0e754383cf 100644 --- a/arch/powerpc/kernel/dma_64.c +++ b/arch/powerpc/kernel/dma_64.c | |||
@@ -120,14 +120,18 @@ unsigned long dma_direct_offset; | |||
120 | static void *dma_direct_alloc_coherent(struct device *dev, size_t size, | 120 | static void *dma_direct_alloc_coherent(struct device *dev, size_t size, |
121 | dma_addr_t *dma_handle, gfp_t flag) | 121 | dma_addr_t *dma_handle, gfp_t flag) |
122 | { | 122 | { |
123 | struct page *page; | ||
123 | void *ret; | 124 | void *ret; |
125 | int node = dev->archdata.numa_node; | ||
124 | 126 | ||
125 | /* TODO: Maybe use the numa node here too ? */ | 127 | /* TODO: Maybe use the numa node here too ? */ |
126 | ret = (void *)__get_free_pages(flag, get_order(size)); | 128 | page = alloc_pages_node(node, flag, get_order(size)); |
127 | if (ret != NULL) { | 129 | if (page == NULL) |
128 | memset(ret, 0, size); | 130 | return NULL; |
129 | *dma_handle = virt_to_abs(ret) | dma_direct_offset; | 131 | ret = page_address(page); |
130 | } | 132 | memset(ret, 0, size); |
133 | *dma_handle = virt_to_abs(ret) | dma_direct_offset; | ||
134 | |||
131 | return ret; | 135 | return ret; |
132 | } | 136 | } |
133 | 137 | ||