Subject: [HACK] cell: fake NUMA properties This is a hack to make it possible to test NUMA behaviour on Cell Blades without the proper device tree data. We simply try to add all required properties to the tree if they are not already there. This patch is highly nonportably and generally just a bad idea. Don't even think about using it on production systems ;-). Signed-off-by: Arnd Bergmann Index: linus-2.6/arch/powerpc/platforms/cell/setup.c =================================================================== --- linus-2.6.orig/arch/powerpc/platforms/cell/setup.c +++ linus-2.6/arch/powerpc/platforms/cell/setup.c @@ -138,6 +138,65 @@ static void __init cell_setup_arch(void) mmio_nvram_init(); } +static void __init cell_fake_numa(void) +{ + struct device_node *p; + static u32 node0[5] = { 4, 0, 0, 0, 0 }; + static u32 node1[5] = { 4, 0, 0, 1, 1 }; + static u32 doms[5] = { 4, 1, 1, 2, 2 }; + static u32 refs[2] = { 2, 3 }; + static char ass[] = "ibm,associativity"; + static struct property cpu0_ass = { ass, sizeof(node0), (void *)node0 }; + static struct property cpu1_ass = { ass, sizeof(node1), (void *)node1 }; + static struct property mem0_ass = { ass, sizeof(node0), (void *)node0 }; + static struct property mem1_ass = { ass, sizeof(node1), (void *)node1 }; + static struct property refs_prop = { + "ibm,associativity-reference-points", + sizeof(refs), + (void *)refs + }; + static struct property doms_prop = { + "ibm,max-associativity-domains", + sizeof(doms), + (void *)doms + }; + + p = of_find_node_by_path("/rtas"); + if (p) { + /* check if the properties are there already */ + if (of_find_property(p, + "ibm,associativity-reference-points", + NULL)) + return; + + prom_add_property(p, &refs_prop); + prom_add_property(p, &doms_prop); + } + + printk(KERN_WARNING "WARNING: faking NUMA device tree " + "information. Don't do that\n"); + p = of_find_node_by_path("/memory@0"); + if (p) + prom_add_property(p, &mem0_ass); + + /* memory can be either at 10000000 or 20000000 */ + p = of_find_node_by_path("/memory@10000000"); + if (p) + prom_add_property(p, &mem1_ass); + + p = of_find_node_by_path("/memory@20000000"); + if (p) + prom_add_property(p, &mem1_ass); + + p = of_find_node_by_path("/cpus/PowerPC\,BE@0"); + if (p) + prom_add_property(p, &cpu0_ass); + + p = of_find_node_by_path("/cpus/PowerPC\,BE@1"); + if (p) + prom_add_property(p, &cpu1_ass); +} + /* * Early initialization. Relocation is on but do not reference unbolted pages */ @@ -151,6 +210,8 @@ static void __init cell_init_early(void) ppc64_interrupt_controller = IC_CELL_PIC; + cell_fake_numa(); + DBG(" <- cell_init_early()\n"); }