diff -Nuar rc1aa1/arch/alpha/kernel/alpha_ksyms.c numa-mm/arch/alpha/kernel/alpha_ksyms.c --- rc1aa1/arch/alpha/kernel/alpha_ksyms.c Mon Dec 17 08:07:44 2001 +++ numa-mm/arch/alpha/kernel/alpha_ksyms.c Tue Dec 18 16:44:40 2001 @@ -230,6 +230,13 @@ EXPORT_SYMBOL(cpu_present_mask); #endif /* CONFIG_SMP */ +/* + * NUMA specific symbols + */ +#ifdef CONFIG_DISCONTIGMEM +EXPORT_SYMBOL(plat_node_data); +#endif /* CONFIG_DISCONTIGMEM */ + EXPORT_SYMBOL(rtc_lock); /* diff -Nuar rc1aa1/arch/alpha/kernel/core_wildfire.c numa-mm/arch/alpha/kernel/core_wildfire.c --- rc1aa1/arch/alpha/kernel/core_wildfire.c Fri Mar 2 14:12:07 2001 +++ numa-mm/arch/alpha/kernel/core_wildfire.c Tue Dec 18 16:44:40 2001 @@ -475,6 +475,33 @@ write_dword: wildfire_write_config_dword }; + +/* + * NUMA Support + */ +int wildfire_pa_to_nid(unsigned long pa) +{ + return pa >> 36; +} + +int wildfire_cpuid_to_nid(int cpuid) +{ + /* assume 4 CPUs per node */ + return cpuid >> 2; +} + +unsigned long wildfire_node_mem_start(int nid) +{ + /* 64GB per node */ + return (unsigned long)nid * (64UL * 1024 * 1024 * 1024); +} + +unsigned long wildfire_node_mem_size(int nid) +{ + /* 64GB per node */ + return 64UL * 1024 * 1024 * 1024; +} + #if DEBUG_DUMP_REGS static void __init diff -Nuar rc1aa1/arch/alpha/kernel/proto.h numa-mm/arch/alpha/kernel/proto.h --- rc1aa1/arch/alpha/kernel/proto.h Wed Nov 14 11:18:06 2001 +++ numa-mm/arch/alpha/kernel/proto.h Tue Dec 18 16:44:40 2001 @@ -81,6 +81,10 @@ extern void wildfire_kill_arch(int); extern void wildfire_machine_check(u64, u64, struct pt_regs *); extern void wildfire_pci_tbi(struct pci_controller *, dma_addr_t, dma_addr_t); +extern int wildfire_pa_to_nid(unsigned long); +extern int wildfire_cpuid_to_nid(int); +extern unsigned long wildfire_node_mem_start(int); +extern unsigned long wildfire_node_mem_size(int); /* setup.c */ extern unsigned long srm_hae; diff -Nuar rc1aa1/arch/alpha/kernel/sys_wildfire.c numa-mm/arch/alpha/kernel/sys_wildfire.c --- rc1aa1/arch/alpha/kernel/sys_wildfire.c Fri Mar 2 14:12:07 2001 +++ numa-mm/arch/alpha/kernel/sys_wildfire.c Tue Dec 18 16:44:40 2001 @@ -352,5 +352,10 @@ kill_arch: wildfire_kill_arch, pci_map_irq: wildfire_map_irq, pci_swizzle: common_swizzle, + + pa_to_nid: wildfire_pa_to_nid, + cpuid_to_nid: wildfire_cpuid_to_nid, + node_mem_start: wildfire_node_mem_start, + node_mem_size: wildfire_node_mem_size, }; ALIAS_MV(wildfire) diff -Nuar rc1aa1/arch/alpha/mm/numa.c numa-mm/arch/alpha/mm/numa.c --- rc1aa1/arch/alpha/mm/numa.c Sun Aug 12 13:38:48 2001 +++ numa-mm/arch/alpha/mm/numa.c Tue Dec 18 16:44:40 2001 @@ -69,8 +69,8 @@ int show_init = 0; /* Find the bounds of current node */ - node_pfn_start = (nid * NODE_MAX_MEM_SIZE) >> PAGE_SHIFT; - node_pfn_end = node_pfn_start + (NODE_MAX_MEM_SIZE >> PAGE_SHIFT); + node_pfn_start = (NODE_MEM_START(nid)) >> PAGE_SHIFT; + node_pfn_end = node_pfn_start + (NODE_MEM_SIZE(nid) >> PAGE_SHIFT); /* Find free clusters, and init and free the bootmem accordingly. */ memdesc = (struct memdesc_struct *) diff -Nuar rc1aa1/include/asm-alpha/machvec.h numa-mm/include/asm-alpha/machvec.h --- rc1aa1/include/asm-alpha/machvec.h Fri Nov 9 16:45:35 2001 +++ numa-mm/include/asm-alpha/machvec.h Tue Dec 18 16:44:40 2001 @@ -92,6 +92,12 @@ const char *vector_name; + /* NUMA information */ + int (*pa_to_nid)(unsigned long); + int (*cpuid_to_nid)(int); + unsigned long (*node_mem_start)(int); + unsigned long (*node_mem_size)(int); + /* System specific parameters. */ union { struct { diff -Nuar rc1aa1/include/asm-alpha/max_numnodes.h numa-mm/include/asm-alpha/max_numnodes.h --- rc1aa1/include/asm-alpha/max_numnodes.h Mon Dec 17 08:07:46 2001 +++ numa-mm/include/asm-alpha/max_numnodes.h Tue Dec 18 16:45:03 2001 @@ -3,11 +3,15 @@ #include -#ifdef CONFIG_ALPHA_WILDFIRE -#include -#define MAX_NUMNODES WILDFIRE_MAX_QBB +#include + +#ifdef CONFIG_ALPHA_GENERIC +# define MAX_NUMNODES 8 /* wildfire */ +#elif defined(CONFIG_ALPHA_WILDFIRE) +# include +# define MAX_NUMNODES WILDFIRE_MAX_QBB #else -#define MAX_NUMNODES 1 +# define MAX_NUMNODES 1 #endif #endif diff -Nuar rc1aa1/include/asm-alpha/mmzone.h numa-mm/include/asm-alpha/mmzone.h --- rc1aa1/include/asm-alpha/mmzone.h Mon Dec 17 08:07:46 2001 +++ numa-mm/include/asm-alpha/mmzone.h Tue Dec 18 16:44:40 2001 @@ -9,6 +9,7 @@ #ifdef CONFIG_NUMA_SCHED #include #endif +#include #ifdef NOTYET #include #include @@ -34,13 +35,18 @@ extern plat_pg_data_t *plat_node_data[]; -#ifdef CONFIG_ALPHA_WILDFIRE -# define ALPHA_PA_TO_NID(pa) ((pa) >> 36) /* 16 nodes max due 43bit kseg */ -#define NODE_MAX_MEM_SIZE (64L * 1024L * 1024L * 1024L) /* 64 GB */ -#else -# define ALPHA_PA_TO_NID(pa) (0) -#define NODE_MAX_MEM_SIZE (~0UL) -#endif +#define ALPHA_PA_TO_NID(pa) \ + (alpha_mv.pa_to_nid \ + ? alpha_mv.pa_to_nid(pa) \ + : (0)) +#define NODE_MEM_START(nid) \ + (alpha_mv.node_mem_start \ + ? alpha_mv.node_mem_start(nid) \ + : (0UL)) +#define NODE_MEM_SIZE(nid) \ + (alpha_mv.node_mem_size \ + ? alpha_mv.node_mem_size(nid) \ + : ((nid) ? (0UL) : (~0UL))) #define PHYSADDR_TO_NID(pa) ALPHA_PA_TO_NID(pa) #define PLAT_NODE_DATA(n) (plat_node_data[(n)]) @@ -108,12 +114,8 @@ #define NODE_SCHEDULE_DATA(nid) (&((PLAT_NODE_DATA(nid))->schedule_data)) #endif -#ifdef CONFIG_ALPHA_WILDFIRE -/* With wildfire assume 4 CPUs per node */ -#define cputonode(cpu) ((cpu) >> 2) -#else -#define cputonode(cpu) 0 -#endif /* CONFIG_ALPHA_WILDFIRE */ +#define cputonode(cpu) \ + (alpha_mv.cpuid_to_nid ? alpha_mv.cpuid_to_nid(cpu) : 0) #define numa_node_id() cputonode(smp_processor_id()) #endif /* CONFIG_NUMA */