Skip to contentSkip to conversation

allocate GART/IOMMU aperture from any node

PATCH New Mark Langsdorf 1 participant 1 message Apr 3, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 allocate GART/IOMMU aperture from any node

Linux always tries to allocate the GART/IOMMU aperture from the boot node memory. However, it is legal to boot with no memory attached to the boot node, in which case the system crashes with invalid memory assignments. Generalize the memory allocation to support any node in the system with memory.

arch/x86_64/kernel/aperture.c renamed from arch/x86_64/kernel/aperture.c.old +2 -3
@@ -51,7 +51,6 @@ static void __init insert_aperture_resou
 
 static u32 __init allocate_aperture(void)
 {
-	pg_data_t *nd0 = NODE_DATA(0);
 	u32 aper_size;
 	void *p;
 
@@ -65,12 +64,12 @@ static u32 __init allocate_aperture(void
 	 * Unfortunately we cannot move it up because that would make the
 	 * IOMMU useless.
 	 */
-	p = __alloc_bootmem_node(nd0, aper_size, aper_size, 0);
+	p = __alloc_bootmem(aper_size, aper_size, 0);
 	if (!p || __pa(p)+aper_size > 0xffffffff) {
 		printk("Cannot allocate aperture memory hole (%p,%uK)\n",
 		       p, aper_size>>10);
 		if (p)
-			free_bootmem_node(nd0, __pa(p), aper_size);
+			free_bootmem(__pa(p), aper_size);
 		return 0;
 	}
 	printk("Mapping aperture over %d KB of RAM @ %lx\n",