Commit 4bf841eb authored by Thomas Bogendoerfer's avatar Thomas Bogendoerfer Committed by Paul Burton

MIPS: SGI-IP27: get rid of compact node ids

Node ids don't need to be contiguous in Linux, so the concept to
use compact node ids to make them contiguous isn't needed at all.
This patchset therefore removes it.
Signed-off-by: default avatarThomas Bogendoerfer <tbogendoerfer@suse.de>
Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: James Hogan <jhogan@kernel.org>
Cc: linux-mips@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
parent 46a73e9e
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
#include <asm/sn/arch.h> #include <asm/sn/arch.h>
#include <asm/sn/hub.h> #include <asm/sn/hub.h>
#define pa_to_nid(addr) NASID_TO_COMPACT_NODEID(NASID_GET(addr)) #define pa_to_nid(addr) NASID_GET(addr)
struct hub_data { struct hub_data {
kern_vars_t kern_vars; kern_vars_t kern_vars;
......
...@@ -7,14 +7,13 @@ ...@@ -7,14 +7,13 @@
#include <asm/mmzone.h> #include <asm/mmzone.h>
struct cpuinfo_ip27 { struct cpuinfo_ip27 {
cnodeid_t p_nodeid; /* my node ID in compact-id-space */
nasid_t p_nasid; /* my node ID in numa-as-id-space */ nasid_t p_nasid; /* my node ID in numa-as-id-space */
unsigned char p_slice; /* Physical position on node board */ unsigned char p_slice; /* Physical position on node board */
}; };
extern struct cpuinfo_ip27 sn_cpu_info[NR_CPUS]; extern struct cpuinfo_ip27 sn_cpu_info[NR_CPUS];
#define cpu_to_node(cpu) (sn_cpu_info[(cpu)].p_nodeid) #define cpu_to_node(cpu) (cputonasid(cpu))
#define cpumask_of_node(node) ((node) == -1 ? \ #define cpumask_of_node(node) ((node) == -1 ? \
cpu_all_mask : \ cpu_all_mask : \
&hub_data(node)->h_cpus) &hub_data(node)->h_cpus)
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
#if defined(CONFIG_SGI_IP27) #if defined(CONFIG_SGI_IP27)
#define HUB_NIC_ADDR(_cpuid) \ #define HUB_NIC_ADDR(_cpuid) \
REMOTE_HUB_ADDR(COMPACT_TO_NASID_NODEID(cpu_to_node(_cpuid)), \ REMOTE_HUB_ADDR(cpu_to_node(_cpuid), \
MD_MLAN_CTL) MD_MLAN_CTL)
#endif #endif
......
...@@ -21,34 +21,11 @@ ...@@ -21,34 +21,11 @@
#define cputoslice(cpu) (sn_cpu_info[(cpu)].p_slice) #define cputoslice(cpu) (sn_cpu_info[(cpu)].p_slice)
#define INVALID_NASID (nasid_t)-1 #define INVALID_NASID (nasid_t)-1
#define INVALID_CNODEID (cnodeid_t)-1
#define INVALID_PNODEID (pnodeid_t)-1 #define INVALID_PNODEID (pnodeid_t)-1
#define INVALID_MODULE (moduleid_t)-1 #define INVALID_MODULE (moduleid_t)-1
#define INVALID_PARTID (partid_t)-1 #define INVALID_PARTID (partid_t)-1
extern nasid_t get_nasid(void); extern nasid_t get_nasid(void);
extern cnodeid_t get_cpu_cnode(cpuid_t);
extern int get_cpu_slice(cpuid_t); extern int get_cpu_slice(cpuid_t);
/*
* NO ONE should access these arrays directly. The only reason we refer to
* them here is to avoid the procedure call that would be required in the
* macros below. (Really want private data members here :-)
*/
extern cnodeid_t nasid_to_compact_node[MAX_NASIDS];
extern nasid_t compact_to_nasid_node[MAX_COMPACT_NODES];
/*
* These macros are used by various parts of the kernel to convert
* between the three different kinds of node numbering. At least some
* of them may change to procedure calls in the future, but the macros
* will continue to work. Don't use the arrays above directly.
*/
extern cnodeid_t cpuid_to_compact_node[MAXCPUS];
#define NASID_TO_COMPACT_NODEID(nnode) (nasid_to_compact_node[nnode])
#define COMPACT_TO_NASID_NODEID(cnode) (compact_to_nasid_node[cnode])
#define CPUID_TO_COMPACT_NODEID(cpu) (cpuid_to_compact_node[(cpu)])
#endif /* _ASM_SN_ARCH_H */ #endif /* _ASM_SN_ARCH_H */
...@@ -10,8 +10,8 @@ ...@@ -10,8 +10,8 @@
#include <asm/xtalk/xtalk.h> #include <asm/xtalk/xtalk.h>
/* ip27-hubio.c */ /* ip27-hubio.c */
extern unsigned long hub_pio_map(cnodeid_t cnode, xwidgetnum_t widget, extern unsigned long hub_pio_map(nasid_t nasid, xwidgetnum_t widget,
unsigned long xtalk_addr, size_t size); unsigned long xtalk_addr, size_t size);
extern void hub_pio_init(cnodeid_t cnode); extern void hub_pio_init(nasid_t nasid);
#endif /* __ASM_SN_HUB_H */ #endif /* __ASM_SN_HUB_H */
...@@ -37,10 +37,10 @@ ...@@ -37,10 +37,10 @@
#define MAPPED_KERN_RO_TO_PHYS(x) \ #define MAPPED_KERN_RO_TO_PHYS(x) \
((unsigned long)MAPPED_ADDR_RO_TO_PHYS(x) | \ ((unsigned long)MAPPED_ADDR_RO_TO_PHYS(x) | \
MAPPED_KERN_RO_PHYSBASE(get_compact_nodeid())) MAPPED_KERN_RO_PHYSBASE(get_nasid()))
#define MAPPED_KERN_RW_TO_PHYS(x) \ #define MAPPED_KERN_RW_TO_PHYS(x) \
((unsigned long)MAPPED_ADDR_RW_TO_PHYS(x) | \ ((unsigned long)MAPPED_ADDR_RW_TO_PHYS(x) | \
MAPPED_KERN_RW_PHYSBASE(get_compact_nodeid())) MAPPED_KERN_RW_PHYSBASE(get_nasid()))
#else /* CONFIG_MAPPED_KERNEL */ #else /* CONFIG_MAPPED_KERNEL */
......
...@@ -7,14 +7,13 @@ ...@@ -7,14 +7,13 @@
extern nasid_t master_nasid; extern nasid_t master_nasid;
extern void cpu_node_probe(void); extern void cpu_node_probe(void);
extern cnodeid_t get_compact_nodeid(void); extern void hub_rtc_init(nasid_t nasid);
extern void hub_rtc_init(cnodeid_t);
extern void cpu_time_init(void); extern void cpu_time_init(void);
extern void per_cpu_init(void); extern void per_cpu_init(void);
extern void install_cpu_nmi_handler(int slice); extern void install_cpu_nmi_handler(int slice);
extern void install_ipi(void); extern void install_ipi(void);
extern void setup_replication_mask(void); extern void setup_replication_mask(void);
extern void replicate_kernel_text(void); extern void replicate_kernel_text(void);
extern unsigned long node_getfirstfree(cnodeid_t); extern unsigned long node_getfirstfree(nasid_t nasid);
#endif /* __ASM_SN_SN_PRIVATE_H */ #endif /* __ASM_SN_SN_PRIVATE_H */
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
typedef unsigned long cpuid_t; typedef unsigned long cpuid_t;
typedef signed short nasid_t; /* node id in numa-as-id space */ typedef signed short nasid_t; /* node id in numa-as-id space */
typedef signed short cnodeid_t; /* node id in compact-id space */
typedef signed char partid_t; /* partition ID type */ typedef signed char partid_t; /* partition ID type */
typedef signed short moduleid_t; /* user-visible module number type */ typedef signed short moduleid_t; /* user-visible module number type */
......
...@@ -285,7 +285,7 @@ static int bridge_set_affinity(struct irq_data *d, const struct cpumask *mask, ...@@ -285,7 +285,7 @@ static int bridge_set_affinity(struct irq_data *d, const struct cpumask *mask,
ret = irq_chip_set_affinity_parent(d, mask, force); ret = irq_chip_set_affinity_parent(d, mask, force);
if (ret >= 0) { if (ret >= 0) {
cpu = cpumask_first_and(mask, cpu_online_mask); cpu = cpumask_first_and(mask, cpu_online_mask);
nasid = COMPACT_TO_NASID_NODEID(cpu_to_node(cpu)); nasid = cpu_to_node(cpu);
bridge_write(data->bc, b_int_addr[pin].addr, bridge_write(data->bc, b_int_addr[pin].addr,
(((data->bc->intr_addr >> 30) & 0x30000) | (((data->bc->intr_addr >> 30) & 0x30000) |
bit | (nasid << 8))); bit | (nasid << 8)));
......
...@@ -25,10 +25,9 @@ static int force_fire_and_forget = 1; ...@@ -25,10 +25,9 @@ static int force_fire_and_forget = 1;
* @size: size of the PIO mapping * @size: size of the PIO mapping
* *
**/ **/
unsigned long hub_pio_map(cnodeid_t cnode, xwidgetnum_t widget, unsigned long hub_pio_map(nasid_t nasid, xwidgetnum_t widget,
unsigned long xtalk_addr, size_t size) unsigned long xtalk_addr, size_t size)
{ {
nasid_t nasid = COMPACT_TO_NASID_NODEID(cnode);
unsigned i; unsigned i;
/* use small-window mapping if possible */ /* use small-window mapping if possible */
...@@ -44,7 +43,7 @@ unsigned long hub_pio_map(cnodeid_t cnode, xwidgetnum_t widget, ...@@ -44,7 +43,7 @@ unsigned long hub_pio_map(cnodeid_t cnode, xwidgetnum_t widget,
xtalk_addr &= ~(BWIN_SIZE-1); xtalk_addr &= ~(BWIN_SIZE-1);
for (i = 0; i < HUB_NUM_BIG_WINDOW; i++) { for (i = 0; i < HUB_NUM_BIG_WINDOW; i++) {
if (test_and_set_bit(i, hub_data(cnode)->h_bigwin_used)) if (test_and_set_bit(i, hub_data(nasid)->h_bigwin_used))
continue; continue;
/* /*
...@@ -171,13 +170,12 @@ static void hub_set_piomode(nasid_t nasid) ...@@ -171,13 +170,12 @@ static void hub_set_piomode(nasid_t nasid)
* *
* @hub: hubinfo structure for our hub * @hub: hubinfo structure for our hub
*/ */
void hub_pio_init(cnodeid_t cnode) void hub_pio_init(nasid_t nasid)
{ {
nasid_t nasid = COMPACT_TO_NASID_NODEID(cnode);
unsigned i; unsigned i;
/* initialize big window piomaps for this hub */ /* initialize big window piomaps for this hub */
bitmap_zero(hub_data(cnode)->h_bigwin_used, HUB_NUM_BIG_WINDOW); bitmap_zero(hub_data(nasid)->h_bigwin_used, HUB_NUM_BIG_WINDOW);
for (i = 0; i < HUB_NUM_BIG_WINDOW; i++) for (i = 0; i < HUB_NUM_BIG_WINDOW; i++)
IIO_ITTE_DISABLE(nasid, i); IIO_ITTE_DISABLE(nasid, i);
......
...@@ -41,25 +41,16 @@ ...@@ -41,25 +41,16 @@
static DECLARE_BITMAP(hub_init_mask, MAX_COMPACT_NODES); static DECLARE_BITMAP(hub_init_mask, MAX_COMPACT_NODES);
nasid_t master_nasid = INVALID_NASID; nasid_t master_nasid = INVALID_NASID;
cnodeid_t nasid_to_compact_node[MAX_NASIDS];
nasid_t compact_to_nasid_node[MAX_COMPACT_NODES];
cnodeid_t cpuid_to_compact_node[MAXCPUS];
EXPORT_SYMBOL(nasid_to_compact_node);
struct cpuinfo_ip27 sn_cpu_info[NR_CPUS]; struct cpuinfo_ip27 sn_cpu_info[NR_CPUS];
EXPORT_SYMBOL_GPL(sn_cpu_info); EXPORT_SYMBOL_GPL(sn_cpu_info);
extern void pcibr_setup(cnodeid_t); static void per_hub_init(nasid_t nasid)
static void per_hub_init(cnodeid_t cnode)
{ {
struct hub_data *hub = hub_data(cnode); struct hub_data *hub = hub_data(nasid);
nasid_t nasid = COMPACT_TO_NASID_NODEID(cnode);
cpumask_set_cpu(smp_processor_id(), &hub->h_cpus); cpumask_set_cpu(smp_processor_id(), &hub->h_cpus);
if (test_and_set_bit(cnode, hub_init_mask)) if (test_and_set_bit(nasid, hub_init_mask))
return; return;
/* /*
* Set CRB timeout at 5ms, (< PI timeout of 10ms) * Set CRB timeout at 5ms, (< PI timeout of 10ms)
...@@ -67,14 +58,14 @@ static void per_hub_init(cnodeid_t cnode) ...@@ -67,14 +58,14 @@ static void per_hub_init(cnodeid_t cnode)
REMOTE_HUB_S(nasid, IIO_ICTP, 0x800); REMOTE_HUB_S(nasid, IIO_ICTP, 0x800);
REMOTE_HUB_S(nasid, IIO_ICTO, 0xff); REMOTE_HUB_S(nasid, IIO_ICTO, 0xff);
hub_rtc_init(cnode); hub_rtc_init(nasid);
#ifdef CONFIG_REPLICATE_EXHANDLERS #ifdef CONFIG_REPLICATE_EXHANDLERS
/* /*
* If this is not a headless node initialization, * If this is not a headless node initialization,
* copy over the caliased exception handlers. * copy over the caliased exception handlers.
*/ */
if (get_compact_nodeid() == cnode) { if (get_nasid() == nasid) {
extern char except_vec2_generic, except_vec3_generic; extern char except_vec2_generic, except_vec3_generic;
extern void build_tlb_refill_handler(void); extern void build_tlb_refill_handler(void);
...@@ -92,15 +83,15 @@ void per_cpu_init(void) ...@@ -92,15 +83,15 @@ void per_cpu_init(void)
{ {
int cpu = smp_processor_id(); int cpu = smp_processor_id();
int slice = LOCAL_HUB_L(PI_CPU_NUM); int slice = LOCAL_HUB_L(PI_CPU_NUM);
cnodeid_t cnode = get_compact_nodeid(); nasid_t nasid = get_nasid();
struct hub_data *hub = hub_data(cnode); struct hub_data *hub = hub_data(nasid);
if (test_and_set_bit(slice, &hub->slice_map)) if (test_and_set_bit(slice, &hub->slice_map))
return; return;
clear_c0_status(ST0_IM); clear_c0_status(ST0_IM);
per_hub_init(cnode); per_hub_init(nasid);
cpu_time_init(); cpu_time_init();
install_ipi(); install_ipi();
...@@ -122,14 +113,6 @@ get_nasid(void) ...@@ -122,14 +113,6 @@ get_nasid(void)
>> NSRI_NODEID_SHFT); >> NSRI_NODEID_SHFT);
} }
/*
* Map the physical node id to a virtual node id (virtual node ids are contiguous).
*/
cnodeid_t get_compact_nodeid(void)
{
return NASID_TO_COMPACT_NODEID(get_nasid());
}
extern void ip27_reboot_setup(void); extern void ip27_reboot_setup(void);
void __init plat_mem_setup(void) void __init plat_mem_setup(void)
......
...@@ -73,7 +73,7 @@ static void setup_hub_mask(struct hub_irq_data *hd, const struct cpumask *mask) ...@@ -73,7 +73,7 @@ static void setup_hub_mask(struct hub_irq_data *hd, const struct cpumask *mask)
int cpu; int cpu;
cpu = cpumask_first_and(mask, cpu_online_mask); cpu = cpumask_first_and(mask, cpu_online_mask);
nasid = COMPACT_TO_NASID_NODEID(cpu_to_node(cpu)); nasid = cpu_to_node(cpu);
hd->cpu = cpu; hd->cpu = cpu;
if (!cputoslice(cpu)) { if (!cputoslice(cpu)) {
hd->irq_mask[0] = REMOTE_HUB_PTR(nasid, PI_INT_MASK0_A); hd->irq_mask[0] = REMOTE_HUB_PTR(nasid, PI_INT_MASK0_A);
...@@ -137,7 +137,7 @@ static int hub_domain_alloc(struct irq_domain *domain, unsigned int virq, ...@@ -137,7 +137,7 @@ static int hub_domain_alloc(struct irq_domain *domain, unsigned int virq,
handle_level_irq, NULL, NULL); handle_level_irq, NULL, NULL);
/* use CPU connected to nearest hub */ /* use CPU connected to nearest hub */
hub = hub_data(NASID_TO_COMPACT_NODEID(info->nasid)); hub = hub_data(info->nasid);
setup_hub_mask(hd, &hub->h_cpus); setup_hub_mask(hd, &hub->h_cpus);
/* Make sure it's not already pending when we connect it. */ /* Make sure it's not already pending when we connect it. */
......
...@@ -73,11 +73,6 @@ lboard_t *find_lboard_class(lboard_t *start, unsigned char brd_type) ...@@ -73,11 +73,6 @@ lboard_t *find_lboard_class(lboard_t *start, unsigned char brd_type)
return (lboard_t *)NULL; return (lboard_t *)NULL;
} }
cnodeid_t get_cpu_cnode(cpuid_t cpu)
{
return CPUID_TO_COMPACT_NODEID(cpu);
}
klcpu_t *nasid_slice_to_cpuinfo(nasid_t nasid, int slice) klcpu_t *nasid_slice_to_cpuinfo(nasid_t nasid, int slice)
{ {
lboard_t *brd; lboard_t *brd;
...@@ -102,19 +97,14 @@ klcpu_t *sn_get_cpuinfo(cpuid_t cpu) ...@@ -102,19 +97,14 @@ klcpu_t *sn_get_cpuinfo(cpuid_t cpu)
nasid_t nasid; nasid_t nasid;
int slice; int slice;
klcpu_t *acpu; klcpu_t *acpu;
gda_t *gdap = GDA;
cnodeid_t cnode;
if (!(cpu < MAXCPUS)) { if (!(cpu < MAXCPUS)) {
printk("sn_get_cpuinfo: illegal cpuid 0x%lx\n", cpu); printk("sn_get_cpuinfo: illegal cpuid 0x%lx\n", cpu);
return NULL; return NULL;
} }
cnode = get_cpu_cnode(cpu); nasid = cputonasid(cpu);
if (cnode == INVALID_CNODEID) if (nasid == INVALID_NASID)
return NULL;
if ((nasid = gdap->g_nasidtable[cnode]) == INVALID_NASID)
return NULL; return NULL;
for (slice = 0; slice < CPUS_PER_NODE; slice++) { for (slice = 0; slice < CPUS_PER_NODE; slice++) {
......
...@@ -38,13 +38,13 @@ void __init setup_replication_mask(void) ...@@ -38,13 +38,13 @@ void __init setup_replication_mask(void)
#error Kernel replication works with mapped kernel support. No calias support. #error Kernel replication works with mapped kernel support. No calias support.
#endif #endif
{ {
cnodeid_t cnode; nasid_t nasid;
for_each_online_node(cnode) { for_each_online_node(nasid) {
if (cnode == 0) if (nasid == 0)
continue; continue;
/* Advertise that we have a copy of the kernel */ /* Advertise that we have a copy of the kernel */
cpumask_set_cpu(cnode, &ktext_repmask); cpumask_set_cpu(nasid, &ktext_repmask);
} }
} }
#endif #endif
...@@ -85,7 +85,6 @@ static __init void copy_kernel(nasid_t dest_nasid) ...@@ -85,7 +85,6 @@ static __init void copy_kernel(nasid_t dest_nasid)
void __init replicate_kernel_text(void) void __init replicate_kernel_text(void)
{ {
cnodeid_t cnode;
nasid_t client_nasid; nasid_t client_nasid;
nasid_t server_nasid; nasid_t server_nasid;
...@@ -94,13 +93,12 @@ void __init replicate_kernel_text(void) ...@@ -94,13 +93,12 @@ void __init replicate_kernel_text(void)
/* Record where the master node should get its kernel text */ /* Record where the master node should get its kernel text */
set_ktext_source(master_nasid, master_nasid); set_ktext_source(master_nasid, master_nasid);
for_each_online_node(cnode) { for_each_online_node(client_nasid) {
if (cnode == 0) if (client_nasid == 0)
continue; continue;
client_nasid = COMPACT_TO_NASID_NODEID(cnode);
/* Check if this node should get a copy of the kernel */ /* Check if this node should get a copy of the kernel */
if (cpumask_test_cpu(cnode, &ktext_repmask)) { if (cpumask_test_cpu(client_nasid, &ktext_repmask)) {
server_nasid = client_nasid; server_nasid = client_nasid;
copy_kernel(server_nasid); copy_kernel(server_nasid);
} }
...@@ -115,17 +113,16 @@ void __init replicate_kernel_text(void) ...@@ -115,17 +113,16 @@ void __init replicate_kernel_text(void)
* data structures on the first couple of pages of the first slot of each * data structures on the first couple of pages of the first slot of each
* node. If this is the case, getfirstfree(node) > getslotstart(node, 0). * node. If this is the case, getfirstfree(node) > getslotstart(node, 0).
*/ */
unsigned long node_getfirstfree(cnodeid_t cnode) unsigned long node_getfirstfree(nasid_t nasid)
{ {
unsigned long loadbase = REP_BASE; unsigned long loadbase = REP_BASE;
nasid_t nasid = COMPACT_TO_NASID_NODEID(cnode);
unsigned long offset; unsigned long offset;
#ifdef CONFIG_MAPPED_KERNEL #ifdef CONFIG_MAPPED_KERNEL
loadbase += 16777216; loadbase += 16777216;
#endif #endif
offset = PAGE_ALIGN((unsigned long)(&_end)) - loadbase; offset = PAGE_ALIGN((unsigned long)(&_end)) - loadbase;
if ((cnode == 0) || (cpumask_test_cpu(cnode, &ktext_repmask))) if ((nasid == 0) || (cpumask_test_cpu(nasid, &ktext_repmask)))
return TO_NODE(nasid, offset) >> PAGE_SHIFT; return TO_NODE(nasid, offset) >> PAGE_SHIFT;
else else
return KDM_TO_PHYS(PAGE_ALIGN(SYMMON_STK_ADDR(nasid, 0))) >> PAGE_SHIFT; return KDM_TO_PHYS(PAGE_ALIGN(SYMMON_STK_ADDR(nasid, 0))) >> PAGE_SHIFT;
......
...@@ -44,23 +44,23 @@ static int is_fine_dirmode(void) ...@@ -44,23 +44,23 @@ static int is_fine_dirmode(void)
return ((LOCAL_HUB_L(NI_STATUS_REV_ID) & NSRI_REGIONSIZE_MASK) >> NSRI_REGIONSIZE_SHFT) & REGIONSIZE_FINE; return ((LOCAL_HUB_L(NI_STATUS_REV_ID) & NSRI_REGIONSIZE_MASK) >> NSRI_REGIONSIZE_SHFT) & REGIONSIZE_FINE;
} }
static u64 get_region(cnodeid_t cnode) static u64 get_region(nasid_t nasid)
{ {
if (fine_mode) if (fine_mode)
return COMPACT_TO_NASID_NODEID(cnode) >> NASID_TO_FINEREG_SHFT; return nasid >> NASID_TO_FINEREG_SHFT;
else else
return COMPACT_TO_NASID_NODEID(cnode) >> NASID_TO_COARSEREG_SHFT; return nasid >> NASID_TO_COARSEREG_SHFT;
} }
static u64 region_mask; static u64 region_mask;
static void gen_region_mask(u64 *region_mask) static void gen_region_mask(u64 *region_mask)
{ {
cnodeid_t cnode; nasid_t nasid;
(*region_mask) = 0; (*region_mask) = 0;
for_each_online_node(cnode) { for_each_online_node(nasid) {
(*region_mask) |= 1ULL << get_region(cnode); (*region_mask) |= 1ULL << get_region(nasid);
} }
} }
...@@ -111,16 +111,11 @@ static int __init compute_node_distance(nasid_t nasid_a, nasid_t nasid_b) ...@@ -111,16 +111,11 @@ static int __init compute_node_distance(nasid_t nasid_a, nasid_t nasid_b)
{ {
klrou_t *router, *router_a = NULL, *router_b = NULL; klrou_t *router, *router_a = NULL, *router_b = NULL;
lboard_t *brd, *dest_brd; lboard_t *brd, *dest_brd;
cnodeid_t cnode;
nasid_t nasid; nasid_t nasid;
int port; int port;
/* Figure out which routers nodes in question are connected to */ /* Figure out which routers nodes in question are connected to */
for_each_online_node(cnode) { for_each_online_node(nasid) {
nasid = COMPACT_TO_NASID_NODEID(cnode);
if (nasid == -1) continue;
brd = find_lboard_class((lboard_t *)KL_CONFIG_INFO(nasid), brd = find_lboard_class((lboard_t *)KL_CONFIG_INFO(nasid),
KLTYPE_ROUTER); KLTYPE_ROUTER);
...@@ -176,19 +171,16 @@ static int __init compute_node_distance(nasid_t nasid_a, nasid_t nasid_b) ...@@ -176,19 +171,16 @@ static int __init compute_node_distance(nasid_t nasid_a, nasid_t nasid_b)
static void __init init_topology_matrix(void) static void __init init_topology_matrix(void)
{ {
nasid_t nasid, nasid2; nasid_t row, col;
cnodeid_t row, col;
for (row = 0; row < MAX_COMPACT_NODES; row++) for (row = 0; row < MAX_COMPACT_NODES; row++)
for (col = 0; col < MAX_COMPACT_NODES; col++) for (col = 0; col < MAX_COMPACT_NODES; col++)
__node_distances[row][col] = -1; __node_distances[row][col] = -1;
for_each_online_node(row) { for_each_online_node(row) {
nasid = COMPACT_TO_NASID_NODEID(row);
for_each_online_node(col) { for_each_online_node(col) {
nasid2 = COMPACT_TO_NASID_NODEID(col);
__node_distances[row][col] = __node_distances[row][col] =
compute_node_distance(nasid, nasid2); compute_node_distance(row, col);
} }
} }
} }
...@@ -196,12 +188,11 @@ static void __init init_topology_matrix(void) ...@@ -196,12 +188,11 @@ static void __init init_topology_matrix(void)
static void __init dump_topology(void) static void __init dump_topology(void)
{ {
nasid_t nasid; nasid_t nasid;
cnodeid_t cnode;
lboard_t *brd, *dest_brd; lboard_t *brd, *dest_brd;
int port; int port;
int router_num = 0; int router_num = 0;
klrou_t *router; klrou_t *router;
cnodeid_t row, col; nasid_t row, col;
pr_info("************** Topology ********************\n"); pr_info("************** Topology ********************\n");
...@@ -216,11 +207,7 @@ static void __init dump_topology(void) ...@@ -216,11 +207,7 @@ static void __init dump_topology(void)
pr_cont("\n"); pr_cont("\n");
} }
for_each_online_node(cnode) { for_each_online_node(nasid) {
nasid = COMPACT_TO_NASID_NODEID(cnode);
if (nasid == -1) continue;
brd = find_lboard_class((lboard_t *)KL_CONFIG_INFO(nasid), brd = find_lboard_class((lboard_t *)KL_CONFIG_INFO(nasid),
KLTYPE_ROUTER); KLTYPE_ROUTER);
...@@ -254,21 +241,17 @@ static void __init dump_topology(void) ...@@ -254,21 +241,17 @@ static void __init dump_topology(void)
} }
} }
static unsigned long __init slot_getbasepfn(cnodeid_t cnode, int slot) static unsigned long __init slot_getbasepfn(nasid_t nasid, int slot)
{ {
nasid_t nasid = COMPACT_TO_NASID_NODEID(cnode);
return ((unsigned long)nasid << PFN_NASIDSHFT) | (slot << SLOT_PFNSHIFT); return ((unsigned long)nasid << PFN_NASIDSHFT) | (slot << SLOT_PFNSHIFT);
} }
static unsigned long __init slot_psize_compute(cnodeid_t node, int slot) static unsigned long __init slot_psize_compute(nasid_t nasid, int slot)
{ {
nasid_t nasid;
lboard_t *brd; lboard_t *brd;
klmembnk_t *banks; klmembnk_t *banks;
unsigned long size; unsigned long size;
nasid = COMPACT_TO_NASID_NODEID(node);
/* Find the node board */ /* Find the node board */
brd = find_lboard((lboard_t *)KL_CONFIG_INFO(nasid), KLTYPE_IP27); brd = find_lboard((lboard_t *)KL_CONFIG_INFO(nasid), KLTYPE_IP27);
if (!brd) if (!brd)
...@@ -298,7 +281,7 @@ static unsigned long __init slot_psize_compute(cnodeid_t node, int slot) ...@@ -298,7 +281,7 @@ static unsigned long __init slot_psize_compute(cnodeid_t node, int slot)
static void __init mlreset(void) static void __init mlreset(void)
{ {
int i; nasid_t nasid;
master_nasid = get_nasid(); master_nasid = get_nasid();
fine_mode = is_fine_dirmode(); fine_mode = is_fine_dirmode();
...@@ -321,11 +304,7 @@ static void __init mlreset(void) ...@@ -321,11 +304,7 @@ static void __init mlreset(void)
/* /*
* Set all nodes' calias sizes to 8k * Set all nodes' calias sizes to 8k
*/ */
for_each_online_node(i) { for_each_online_node(nasid) {
nasid_t nasid;
nasid = COMPACT_TO_NASID_NODEID(i);
/* /*
* Always have node 0 in the region mask, otherwise * Always have node 0 in the region mask, otherwise
* CALIAS accesses get exceptions since the hub * CALIAS accesses get exceptions since the hub
...@@ -354,7 +333,7 @@ static void __init szmem(void) ...@@ -354,7 +333,7 @@ static void __init szmem(void)
{ {
unsigned long slot_psize, slot0sz = 0, nodebytes; /* Hack to detect problem configs */ unsigned long slot_psize, slot0sz = 0, nodebytes; /* Hack to detect problem configs */
int slot; int slot;
cnodeid_t node; nasid_t node;
for_each_online_node(node) { for_each_online_node(node) {
nodebytes = 0; nodebytes = 0;
...@@ -384,7 +363,7 @@ static void __init szmem(void) ...@@ -384,7 +363,7 @@ static void __init szmem(void)
} }
} }
static void __init node_mem_init(cnodeid_t node) static void __init node_mem_init(nasid_t node)
{ {
unsigned long slot_firstpfn = slot_getbasepfn(node, 0); unsigned long slot_firstpfn = slot_getbasepfn(node, 0);
unsigned long slot_freepfn = node_getfirstfree(node); unsigned long slot_freepfn = node_getfirstfree(node);
...@@ -431,7 +410,7 @@ static struct node_data null_node = { ...@@ -431,7 +410,7 @@ static struct node_data null_node = {
*/ */
void __init prom_meminit(void) void __init prom_meminit(void)
{ {
cnodeid_t node; nasid_t node;
mlreset(); mlreset();
szmem(); szmem();
......
...@@ -17,8 +17,6 @@ ...@@ -17,8 +17,6 @@
#define NODE_NUM_CPUS(n) CPUS_PER_NODE #define NODE_NUM_CPUS(n) CPUS_PER_NODE
#endif #endif
#define CNODEID_NONE (cnodeid_t)-1
typedef unsigned long machreg_t; typedef unsigned long machreg_t;
static arch_spinlock_t nmi_lock = __ARCH_SPIN_LOCK_UNLOCKED; static arch_spinlock_t nmi_lock = __ARCH_SPIN_LOCK_UNLOCKED;
...@@ -152,16 +150,10 @@ void nmi_dump_hub_irq(nasid_t nasid, int slice) ...@@ -152,16 +150,10 @@ void nmi_dump_hub_irq(nasid_t nasid, int slice)
* Copy the cpu registers which have been saved in the IP27prom format * Copy the cpu registers which have been saved in the IP27prom format
* into the eframe format for the node under consideration. * into the eframe format for the node under consideration.
*/ */
void nmi_node_eframe_save(cnodeid_t cnode) void nmi_node_eframe_save(nasid_t nasid)
{ {
nasid_t nasid;
int slice; int slice;
/* Make sure that we have a valid node */
if (cnode == CNODEID_NONE)
return;
nasid = COMPACT_TO_NASID_NODEID(cnode);
if (nasid == INVALID_NASID) if (nasid == INVALID_NASID)
return; return;
...@@ -178,10 +170,10 @@ void nmi_node_eframe_save(cnodeid_t cnode) ...@@ -178,10 +170,10 @@ void nmi_node_eframe_save(cnodeid_t cnode)
void void
nmi_eframes_save(void) nmi_eframes_save(void)
{ {
cnodeid_t cnode; nasid_t nasid;
for_each_online_node(cnode) for_each_online_node(nasid)
nmi_node_eframe_save(cnode); nmi_node_eframe_save(nasid);
} }
void void
......
...@@ -45,8 +45,7 @@ static void ip27_machine_restart(char *command) ...@@ -45,8 +45,7 @@ static void ip27_machine_restart(char *command)
#endif #endif
#if 0 #if 0
for_each_online_node(i) for_each_online_node(i)
REMOTE_HUB_S(COMPACT_TO_NASID_NODEID(i), PROMOP_REG, REMOTE_HUB_S(i, PROMOP_REG, PROMOP_REBOOT);
PROMOP_REBOOT);
#else #else
LOCAL_HUB_S(NI_PORT_RESET, NPR_PORTRESET | NPR_LOCALRESET); LOCAL_HUB_S(NI_PORT_RESET, NPR_PORTRESET | NPR_LOCALRESET);
#endif #endif
...@@ -61,8 +60,7 @@ static void ip27_machine_halt(void) ...@@ -61,8 +60,7 @@ static void ip27_machine_halt(void)
smp_send_stop(); smp_send_stop();
#endif #endif
for_each_online_node(i) for_each_online_node(i)
REMOTE_HUB_S(COMPACT_TO_NASID_NODEID(i), PROMOP_REG, REMOTE_HUB_S(i, PROMOP_REG, PROMOP_RESTART);
PROMOP_RESTART);
LOCAL_HUB_S(NI_PORT_RESET, NPR_PORTRESET | NPR_LOCALRESET); LOCAL_HUB_S(NI_PORT_RESET, NPR_PORTRESET | NPR_LOCALRESET);
noreturn; noreturn;
} }
......
...@@ -31,34 +31,13 @@ ...@@ -31,34 +31,13 @@
* Takes as first input the PROM assigned cpu id, and the kernel * Takes as first input the PROM assigned cpu id, and the kernel
* assigned cpu id as the second. * assigned cpu id as the second.
*/ */
static void alloc_cpupda(cpuid_t cpu, int cpunum) static void alloc_cpupda(nasid_t nasid, cpuid_t cpu, int cpunum)
{ {
cnodeid_t node = get_cpu_cnode(cpu);
nasid_t nasid = COMPACT_TO_NASID_NODEID(node);
cputonasid(cpunum) = nasid; cputonasid(cpunum) = nasid;
sn_cpu_info[cpunum].p_nodeid = node;
cputoslice(cpunum) = get_cpu_slice(cpu); cputoslice(cpunum) = get_cpu_slice(cpu);
} }
static nasid_t get_actual_nasid(lboard_t *brd) static int do_cpumask(nasid_t nasid, int highest)
{
klhub_t *hub;
if (!brd)
return INVALID_NASID;
/* find out if we are a completely disabled brd. */
hub = (klhub_t *)find_first_component(brd, KLSTRUCT_HUB);
if (!hub)
return INVALID_NASID;
if (!(hub->hub_info.flags & KLINFO_ENABLE)) /* disabled node brd */
return hub->hub_info.physid;
else
return brd->brd_nasid;
}
static int do_cpumask(cnodeid_t cnode, nasid_t nasid, int highest)
{ {
static int tot_cpus_found = 0; static int tot_cpus_found = 0;
lboard_t *brd; lboard_t *brd;
...@@ -72,16 +51,13 @@ static int do_cpumask(cnodeid_t cnode, nasid_t nasid, int highest) ...@@ -72,16 +51,13 @@ static int do_cpumask(cnodeid_t cnode, nasid_t nasid, int highest)
acpu = (klcpu_t *)find_first_component(brd, KLSTRUCT_CPU); acpu = (klcpu_t *)find_first_component(brd, KLSTRUCT_CPU);
while (acpu) { while (acpu) {
cpuid = acpu->cpu_info.virtid; cpuid = acpu->cpu_info.virtid;
/* cnode is not valid for completely disabled brds */
if (get_actual_nasid(brd) == brd->brd_nasid)
cpuid_to_compact_node[cpuid] = cnode;
if (cpuid > highest)
highest = cpuid;
/* Only let it join in if it's marked enabled */ /* Only let it join in if it's marked enabled */
if ((acpu->cpu_info.flags & KLINFO_ENABLE) && if ((acpu->cpu_info.flags & KLINFO_ENABLE) &&
(tot_cpus_found != NR_CPUS)) { (tot_cpus_found != NR_CPUS)) {
if (cpuid > highest)
highest = cpuid;
set_cpu_possible(cpuid, true); set_cpu_possible(cpuid, true);
alloc_cpupda(cpuid, tot_cpus_found); alloc_cpupda(nasid, cpuid, tot_cpus_found);
cpus_found++; cpus_found++;
tot_cpus_found++; tot_cpus_found++;
} }
...@@ -103,16 +79,6 @@ void cpu_node_probe(void) ...@@ -103,16 +79,6 @@ void cpu_node_probe(void)
int i, highest = 0; int i, highest = 0;
gda_t *gdap = GDA; gda_t *gdap = GDA;
/*
* Initialize the arrays to invalid nodeid (-1)
*/
for (i = 0; i < MAX_COMPACT_NODES; i++)
compact_to_nasid_node[i] = INVALID_NASID;
for (i = 0; i < MAX_NASIDS; i++)
nasid_to_compact_node[i] = INVALID_CNODEID;
for (i = 0; i < MAXCPUS; i++)
cpuid_to_compact_node[i] = INVALID_CNODEID;
/* /*
* MCD - this whole "compact node" stuff can probably be dropped, * MCD - this whole "compact node" stuff can probably be dropped,
* as we can handle sparse numbering now * as we can handle sparse numbering now
...@@ -122,10 +88,8 @@ void cpu_node_probe(void) ...@@ -122,10 +88,8 @@ void cpu_node_probe(void)
nasid_t nasid = gdap->g_nasidtable[i]; nasid_t nasid = gdap->g_nasidtable[i];
if (nasid == INVALID_NASID) if (nasid == INVALID_NASID)
break; break;
compact_to_nasid_node[i] = nasid; node_set_online(nasid);
nasid_to_compact_node[nasid] = i; highest = do_cpumask(nasid, highest);
node_set_online(num_online_nodes());
highest = do_cpumask(i, nasid, highest);
} }
printk("Discovered %d cpus on %d nodes\n", highest + 1, num_online_nodes()); printk("Discovered %d cpus on %d nodes\n", highest + 1, num_online_nodes());
...@@ -162,11 +126,10 @@ static void ip27_send_ipi_single(int destid, unsigned int action) ...@@ -162,11 +126,10 @@ static void ip27_send_ipi_single(int destid, unsigned int action)
irq += cputoslice(destid); irq += cputoslice(destid);
/* /*
* Convert the compact hub number to the NASID to get the correct * Set the interrupt bit associated with the CPU we want to
* part of the address space. Then set the interrupt bit associated * send the interrupt to.
* with the CPU we want to send the interrupt to.
*/ */
REMOTE_HUB_SEND_INTR(COMPACT_TO_NASID_NODEID(cpu_to_node(destid)), irq); REMOTE_HUB_SEND_INTR(cpu_to_node(destid), irq);
} }
static void ip27_send_ipi_mask(const struct cpumask *mask, unsigned int action) static void ip27_send_ipi_mask(const struct cpumask *mask, unsigned int action)
...@@ -208,23 +171,20 @@ static int ip27_boot_secondary(int cpu, struct task_struct *idle) ...@@ -208,23 +171,20 @@ static int ip27_boot_secondary(int cpu, struct task_struct *idle)
static void __init ip27_smp_setup(void) static void __init ip27_smp_setup(void)
{ {
cnodeid_t cnode; nasid_t nasid;
for_each_online_node(cnode) { for_each_online_node(nasid) {
if (cnode == 0) if (nasid == 0)
continue; continue;
intr_clear_all(COMPACT_TO_NASID_NODEID(cnode)); intr_clear_all(nasid);
} }
replicate_kernel_text(); replicate_kernel_text();
/* /*
* Assumption to be fixed: we're always booted on logical / physical * PROM sets up system, that boot cpu is always first CPU on nasid 0
* processor 0. While we're always running on logical processor 0
* this still means this is physical processor zero; it might for
* example be disabled in the firmware.
*/ */
alloc_cpupda(0, 0); alloc_cpupda(0, 0, 0);
} }
static void __init ip27_prepare_cpus(unsigned int max_cpus) static void __init ip27_prepare_cpus(unsigned int max_cpus)
......
...@@ -170,7 +170,7 @@ void cpu_time_init(void) ...@@ -170,7 +170,7 @@ void cpu_time_init(void)
printk("CPU %d clock is %dMHz.\n", smp_processor_id(), cpu->cpu_speed); printk("CPU %d clock is %dMHz.\n", smp_processor_id(), cpu->cpu_speed);
} }
void hub_rtc_init(cnodeid_t cnode) void hub_rtc_init(nasid_t nasid)
{ {
/* /*
...@@ -178,7 +178,7 @@ void hub_rtc_init(cnodeid_t cnode) ...@@ -178,7 +178,7 @@ void hub_rtc_init(cnodeid_t cnode)
* If this is not the current node then it is a cpuless * If this is not the current node then it is a cpuless
* node and timeouts will not happen there. * node and timeouts will not happen there.
*/ */
if (get_compact_nodeid() == cnode) { if (get_nasid() == nasid) {
LOCAL_HUB_S(PI_RT_EN_A, 1); LOCAL_HUB_S(PI_RT_EN_A, 1);
LOCAL_HUB_S(PI_RT_EN_B, 1); LOCAL_HUB_S(PI_RT_EN_B, 1);
LOCAL_HUB_S(PI_PROF_EN_A, 0); LOCAL_HUB_S(PI_PROF_EN_A, 0);
......
...@@ -138,14 +138,12 @@ static int xbow_probe(nasid_t nasid) ...@@ -138,14 +138,12 @@ static int xbow_probe(nasid_t nasid)
return 0; return 0;
} }
static void xtalk_probe_node(cnodeid_t nid) static void xtalk_probe_node(nasid_t nasid)
{ {
volatile u64 hubreg; volatile u64 hubreg;
nasid_t nasid;
xwidget_part_num_t partnum; xwidget_part_num_t partnum;
widgetreg_t widget_id; widgetreg_t widget_id;
nasid = COMPACT_TO_NASID_NODEID(nid);
hubreg = REMOTE_HUB_L(nasid, IIO_LLP_CSR); hubreg = REMOTE_HUB_L(nasid, IIO_LLP_CSR);
/* check whether the link is up */ /* check whether the link is up */
...@@ -173,10 +171,10 @@ static void xtalk_probe_node(cnodeid_t nid) ...@@ -173,10 +171,10 @@ static void xtalk_probe_node(cnodeid_t nid)
static int __init xtalk_init(void) static int __init xtalk_init(void)
{ {
cnodeid_t cnode; nasid_t nasid;
for_each_online_node(cnode) for_each_online_node(nasid)
xtalk_probe_node(cnode); xtalk_probe_node(nasid);
return 0; return 0;
} }
......
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