Commit ecb581fd authored by Ivan Kokshaysky's avatar Ivan Kokshaysky Committed by Richard Henderson

[PATCH] alpha numa iommu

From Jeff.Wiedemeier@hp.com:

On NUMA alpha systems, attempt to allocate scatter-gather
tables local to IO processor.  If that doesn't work, then
allocate anywhere in the system.
parent ada49be0
......@@ -155,6 +155,10 @@ extern u8 common_swizzle(struct pci_dev *, u8 *);
extern struct pci_controller *alloc_pci_controller(void);
extern struct resource *alloc_resource(void);
extern struct pci_iommu_arena *iommu_arena_new_node(int,
struct pci_controller *,
dma_addr_t, unsigned long,
unsigned long);
extern struct pci_iommu_arena *iommu_arena_new(struct pci_controller *,
dma_addr_t, unsigned long,
unsigned long);
......
......@@ -58,8 +58,8 @@ size_for_memory(unsigned long max)
}
struct pci_iommu_arena *
iommu_arena_new(struct pci_controller *hose, dma_addr_t base,
unsigned long window_size, unsigned long align)
iommu_arena_new_node(int nid, struct pci_controller *hose, dma_addr_t base,
unsigned long window_size, unsigned long align)
{
unsigned long mem_size;
struct pci_iommu_arena *arena;
......@@ -73,9 +73,36 @@ iommu_arena_new(struct pci_controller *hose, dma_addr_t base,
if (align < mem_size)
align = mem_size;
#ifdef CONFIG_DISCONTIGMEM
if (!NODE_DATA(nid) ||
(NULL == (arena = alloc_bootmem_node(NODE_DATA(nid),
sizeof(*arena))))) {
printk("%s: couldn't allocate arena from node %d\n"
" falling back to system-wide allocation\n",
__FUNCTION__, nid);
arena = alloc_bootmem(sizeof(*arena));
}
if (!NODE_DATA(nid) ||
(NULL == (arena->ptes = __alloc_bootmem_node(NODE_DATA(nid),
mem_size,
align,
0)))) {
printk("%s: couldn't allocate arena ptes from node %d\n"
" falling back to system-wide allocation\n",
__FUNCTION__, nid);
arena->ptes = __alloc_bootmem(mem_size, align, 0);
}
#else /* CONFIG_DISCONTIGMEM */
arena = alloc_bootmem(sizeof(*arena));
arena->ptes = __alloc_bootmem(mem_size, align, 0);
#endif /* CONFIG_DISCONTIGMEM */
spin_lock_init(&arena->lock);
arena->hose = hose;
arena->dma_base = base;
......@@ -89,6 +116,13 @@ iommu_arena_new(struct pci_controller *hose, dma_addr_t base,
return arena;
}
struct pci_iommu_arena *
iommu_arena_new(struct pci_controller *hose, dma_addr_t base,
unsigned long window_size, unsigned long align)
{
return iommu_arena_new_node(0, hose, base, window_size, align);
}
/* Must be called with the arena lock held */
static long
iommu_arena_find_pages(struct pci_iommu_arena *arena, long n, long mask)
......
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