Commit c80d9133 authored by Benjamin Herrenschmidt's avatar Benjamin Herrenschmidt Committed by Paul Mackerras

[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: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
parent 92b20c40
...@@ -120,14 +120,18 @@ unsigned long dma_direct_offset; ...@@ -120,14 +120,18 @@ unsigned long dma_direct_offset;
static void *dma_direct_alloc_coherent(struct device *dev, size_t size, static void *dma_direct_alloc_coherent(struct device *dev, size_t size,
dma_addr_t *dma_handle, gfp_t flag) dma_addr_t *dma_handle, gfp_t flag)
{ {
struct page *page;
void *ret; void *ret;
int node = dev->archdata.numa_node;
/* TODO: Maybe use the numa node here too ? */ /* TODO: Maybe use the numa node here too ? */
ret = (void *)__get_free_pages(flag, get_order(size)); page = alloc_pages_node(node, flag, get_order(size));
if (ret != NULL) { if (page == NULL)
memset(ret, 0, size); return NULL;
*dma_handle = virt_to_abs(ret) | dma_direct_offset; ret = page_address(page);
} memset(ret, 0, size);
*dma_handle = virt_to_abs(ret) | dma_direct_offset;
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment