Commit 3576d385 authored by Matthew Dobson's avatar Matthew Dobson Committed by Linus Torvalds

[PATCH] Replace 'numnodes' with 'node_online_map' - i386

Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent b9462e80
...@@ -309,8 +309,8 @@ static void __init MP_translation_info (struct mpc_config_translation *m) ...@@ -309,8 +309,8 @@ static void __init MP_translation_info (struct mpc_config_translation *m)
printk(KERN_ERR "MAX_MPC_ENTRY exceeded!\n"); printk(KERN_ERR "MAX_MPC_ENTRY exceeded!\n");
else else
translation_table[mpc_record] = m; /* stash this for later */ translation_table[mpc_record] = m; /* stash this for later */
if (m->trans_quad+1 > numnodes) if (m->trans_quad < MAX_NUMNODES && !node_online(m->trans_quad))
numnodes = m->trans_quad+1; node_set_online(m->trans_quad);
} }
/* /*
......
...@@ -40,8 +40,7 @@ extern long node_start_pfn[], node_end_pfn[]; ...@@ -40,8 +40,7 @@ extern long node_start_pfn[], node_end_pfn[];
* Function: smp_dump_qct() * Function: smp_dump_qct()
* *
* Description: gets memory layout from the quad config table. This * Description: gets memory layout from the quad config table. This
* function also increments numnodes with the number of nodes (quads) * function also updates node_online_map with the nodes (quads) present.
* present.
*/ */
static void __init smp_dump_qct(void) static void __init smp_dump_qct(void)
{ {
...@@ -50,11 +49,10 @@ static void __init smp_dump_qct(void) ...@@ -50,11 +49,10 @@ static void __init smp_dump_qct(void)
struct sys_cfg_data *scd = struct sys_cfg_data *scd =
(struct sys_cfg_data *)__va(SYS_CFG_DATA_PRIV_ADDR); (struct sys_cfg_data *)__va(SYS_CFG_DATA_PRIV_ADDR);
numnodes = 0; nodes_clear(node_online_map);
for(node = 0; node < MAX_NUMNODES; node++) { for_each_node(node) {
if(scd->quads_present31_0 & (1 << node)) { if (scd->quads_present31_0 & (1 << node)) {
node_set_online(node); node_set_online(node);
numnodes++;
eq = &scd->eq[node]; eq = &scd->eq[node];
/* Convert to pages */ /* Convert to pages */
node_start_pfn[node] = MB_TO_PAGES( node_start_pfn[node] = MB_TO_PAGES(
......
...@@ -232,18 +232,22 @@ static int __init acpi20_parse_srat(struct acpi_table_srat *sratp) ...@@ -232,18 +232,22 @@ static int __init acpi20_parse_srat(struct acpi_table_srat *sratp)
* a set of sequential node IDs starting at zero. (ACPI doesn't seem * a set of sequential node IDs starting at zero. (ACPI doesn't seem
* to specify the range of _PXM values.) * to specify the range of _PXM values.)
*/ */
numnodes = 0; /* init total nodes in system */ /*
* MCD - we no longer HAVE to number nodes sequentially. PXM domain
* numbers could go as high as 256, and MAX_NUMNODES for i386 is typically
* 32, so we will continue numbering them in this manner until MAX_NUMNODES
* approaches MAX_PXM_DOMAINS for i386.
*/
nodes_clear(node_online_map);
for (i = 0; i < MAX_PXM_DOMAINS; i++) { for (i = 0; i < MAX_PXM_DOMAINS; i++) {
if (BMAP_TEST(pxm_bitmap, i)) { if (BMAP_TEST(pxm_bitmap, i)) {
pxm_to_nid_map[i] = numnodes; nid = num_online_nodes();
nid_to_pxm_map[numnodes] = i; pxm_to_nid_map[i] = nid;
node_set_online(numnodes); nid_to_pxm_map[nid] = i;
++numnodes; node_set_online(nid);
} }
} }
BUG_ON(num_online_nodes() == 0);
if (numnodes == 0)
BUG();
/* set cnode id in memory chunk structure */ /* set cnode id in memory chunk structure */
for (i = 0; i < num_memory_chunks; i++) for (i = 0; i < num_memory_chunks; i++)
...@@ -254,7 +258,7 @@ static int __init acpi20_parse_srat(struct acpi_table_srat *sratp) ...@@ -254,7 +258,7 @@ static int __init acpi20_parse_srat(struct acpi_table_srat *sratp)
printk("%02X ", pxm_bitmap[i]); printk("%02X ", pxm_bitmap[i]);
} }
printk("\n"); printk("\n");
printk("Number of logical nodes in system = %d\n", numnodes); printk("Number of logical nodes in system = %d\n", num_online_nodes());
printk("Number of memory chunks in system = %d\n", num_memory_chunks); printk("Number of memory chunks in system = %d\n", num_memory_chunks);
for (j = 0; j < num_memory_chunks; j++){ for (j = 0; j < num_memory_chunks; j++){
...@@ -265,7 +269,7 @@ static int __init acpi20_parse_srat(struct acpi_table_srat *sratp) ...@@ -265,7 +269,7 @@ static int __init acpi20_parse_srat(struct acpi_table_srat *sratp)
} }
/*calculate node_start_pfn/node_end_pfn arrays*/ /*calculate node_start_pfn/node_end_pfn arrays*/
for (nid = 0; nid < numnodes; nid++) { for_each_online_node(nid) {
int been_here_before = 0; int been_here_before = 0;
for (j = 0; j < num_memory_chunks; j++){ for (j = 0; j < num_memory_chunks; j++){
...@@ -397,7 +401,7 @@ static void __init get_zholes_init(void) ...@@ -397,7 +401,7 @@ static void __init get_zholes_init(void)
int first; int first;
unsigned long end = 0; unsigned long end = 0;
for (nid = 0; nid < numnodes; nid++) { for_each_online_node(nid) {
first = 1; first = 1;
for (c = 0; c < num_memory_chunks; c++){ for (c = 0; c < num_memory_chunks; c++){
if (node_memory_chunk[c].nid == nid) { if (node_memory_chunk[c].nid == nid) {
...@@ -425,8 +429,8 @@ unsigned long * __init get_zholes_size(int nid) ...@@ -425,8 +429,8 @@ unsigned long * __init get_zholes_size(int nid)
zholes_size_init++; zholes_size_init++;
get_zholes_init(); get_zholes_init();
} }
if((nid >= numnodes) | (nid >= MAX_NUMNODES)) if (nid >= MAX_NUMNODES || !node_online(nid))
printk("%s: nid = %d is invalid. numnodes = %d", printk("%s: nid = %d is invalid/offline. num_online_nodes = %d",
__FUNCTION__, nid, numnodes); __FUNCTION__, nid, num_online_nodes());
return &zholes_size[nid * MAX_NR_ZONES]; return &zholes_size[nid * MAX_NR_ZONES];
} }
...@@ -41,7 +41,7 @@ bootmem_data_t node0_bdata; ...@@ -41,7 +41,7 @@ bootmem_data_t node0_bdata;
* numa interface - we expect the numa architecture specfic code to have * numa interface - we expect the numa architecture specfic code to have
* populated the following initialisation. * populated the following initialisation.
* *
* 1) numnodes - the total number of nodes configured in the system * 1) node_online_map - the map of all nodes configured (online) in the system
* 2) physnode_map - the mapping between a pfn and owning node * 2) physnode_map - the mapping between a pfn and owning node
* 3) node_start_pfn - the starting page frame number for a node * 3) node_start_pfn - the starting page frame number for a node
* 3) node_end_pfn - the ending page fram number for a node * 3) node_end_pfn - the ending page fram number for a node
...@@ -97,8 +97,8 @@ int __init get_memcfg_numa_flat(void) ...@@ -97,8 +97,8 @@ int __init get_memcfg_numa_flat(void)
node_end_pfn[0] = max_pfn; node_end_pfn[0] = max_pfn;
/* Indicate there is one node available. */ /* Indicate there is one node available. */
nodes_clear(node_online_map);
node_set_online(0); node_set_online(0);
numnodes = 1;
return 1; return 1;
} }
...@@ -183,7 +183,9 @@ void __init remap_numa_kva(void) ...@@ -183,7 +183,9 @@ void __init remap_numa_kva(void)
unsigned long pfn; unsigned long pfn;
int node; int node;
for (node = 1; node < numnodes; ++node) { for_each_online_node(node) {
if (node == 0)
continue;
for (pfn=0; pfn < node_remap_size[node]; pfn += PTRS_PER_PTE) { for (pfn=0; pfn < node_remap_size[node]; pfn += PTRS_PER_PTE) {
vaddr = node_remap_start_vaddr[node]+(pfn<<PAGE_SHIFT); vaddr = node_remap_start_vaddr[node]+(pfn<<PAGE_SHIFT);
set_pmd_pfn((ulong) vaddr, set_pmd_pfn((ulong) vaddr,
...@@ -198,7 +200,9 @@ static unsigned long calculate_numa_remap_pages(void) ...@@ -198,7 +200,9 @@ static unsigned long calculate_numa_remap_pages(void)
int nid; int nid;
unsigned long size, reserve_pages = 0; unsigned long size, reserve_pages = 0;
for (nid = 1; nid < numnodes; nid++) { for_each_online_node(nid) {
if (nid == 0)
continue;
/* calculate the size of the mem_map needed in bytes */ /* calculate the size of the mem_map needed in bytes */
size = (node_end_pfn[nid] - node_start_pfn[nid] + 1) size = (node_end_pfn[nid] - node_start_pfn[nid] + 1)
* sizeof(struct page) + sizeof(pg_data_t); * sizeof(struct page) + sizeof(pg_data_t);
...@@ -248,7 +252,7 @@ unsigned long __init setup_memory(void) ...@@ -248,7 +252,7 @@ unsigned long __init setup_memory(void)
get_memcfg_numa(); get_memcfg_numa();
/* Fill in the physnode_map */ /* Fill in the physnode_map */
for (nid = 0; nid < numnodes; nid++) { for_each_online_node(nid) {
printk("Node: %d, start_pfn: %ld, end_pfn: %ld\n", printk("Node: %d, start_pfn: %ld, end_pfn: %ld\n",
nid, node_start_pfn[nid], node_end_pfn[nid]); nid, node_start_pfn[nid], node_end_pfn[nid]);
printk(" Setting physnode_map array to node %d for pfns:\n ", printk(" Setting physnode_map array to node %d for pfns:\n ",
...@@ -285,7 +289,7 @@ unsigned long __init setup_memory(void) ...@@ -285,7 +289,7 @@ unsigned long __init setup_memory(void)
printk("Low memory ends at vaddr %08lx\n", printk("Low memory ends at vaddr %08lx\n",
(ulong) pfn_to_kaddr(max_low_pfn)); (ulong) pfn_to_kaddr(max_low_pfn));
for (nid = 0; nid < numnodes; nid++) { for_each_online_node(nid) {
node_remap_start_vaddr[nid] = pfn_to_kaddr( node_remap_start_vaddr[nid] = pfn_to_kaddr(
(highstart_pfn + reserve_pages) - node_remap_offset[nid]); (highstart_pfn + reserve_pages) - node_remap_offset[nid]);
allocate_pgdat(nid); allocate_pgdat(nid);
...@@ -297,7 +301,7 @@ unsigned long __init setup_memory(void) ...@@ -297,7 +301,7 @@ unsigned long __init setup_memory(void)
printk("High memory starts at vaddr %08lx\n", printk("High memory starts at vaddr %08lx\n",
(ulong) pfn_to_kaddr(highstart_pfn)); (ulong) pfn_to_kaddr(highstart_pfn));
vmalloc_earlyreserve = reserve_pages * PAGE_SIZE; vmalloc_earlyreserve = reserve_pages * PAGE_SIZE;
for (nid = 0; nid < numnodes; nid++) for_each_online_node(nid)
find_max_pfn_node(nid); find_max_pfn_node(nid);
NODE_DATA(0)->bdata = &node0_bdata; NODE_DATA(0)->bdata = &node0_bdata;
...@@ -375,14 +379,16 @@ void __init zone_sizes_init(void) ...@@ -375,14 +379,16 @@ void __init zone_sizes_init(void)
* Clobber node 0's links and NULL out pgdat_list before starting. * Clobber node 0's links and NULL out pgdat_list before starting.
*/ */
pgdat_list = NULL; pgdat_list = NULL;
for (nid = numnodes - 1; nid >= 0; nid--) { for (nid = MAX_NUMNODES - 1; nid >= 0; nid--) {
if (!node_online(nid))
continue;
if (nid) if (nid)
memset(NODE_DATA(nid), 0, sizeof(pg_data_t)); memset(NODE_DATA(nid), 0, sizeof(pg_data_t));
NODE_DATA(nid)->pgdat_next = pgdat_list; NODE_DATA(nid)->pgdat_next = pgdat_list;
pgdat_list = NODE_DATA(nid); pgdat_list = NODE_DATA(nid);
} }
for (nid = 0; nid < numnodes; nid++) { for_each_online_node(nid) {
unsigned long zones_size[MAX_NR_ZONES] = {0, 0, 0}; unsigned long zones_size[MAX_NR_ZONES] = {0, 0, 0};
unsigned long *zholes_size; unsigned long *zholes_size;
unsigned int max_dma; unsigned int max_dma;
......
...@@ -112,14 +112,15 @@ static int __init pci_numa_init(void) ...@@ -112,14 +112,15 @@ static int __init pci_numa_init(void)
return 0; return 0;
pci_root_bus = pcibios_scan_root(0); pci_root_bus = pcibios_scan_root(0);
if (numnodes > 1) { if (num_online_nodes() > 1)
for (quad = 1; quad < numnodes; ++quad) { for_each_online_node(quad) {
if (quad == 0)
continue;
printk("Scanning PCI bus %d for quad %d\n", printk("Scanning PCI bus %d for quad %d\n",
QUADLOCAL2BUS(quad,0), quad); QUADLOCAL2BUS(quad,0), quad);
pci_scan_bus(QUADLOCAL2BUS(quad,0), pci_scan_bus(QUADLOCAL2BUS(quad,0),
&pci_root_ops, NULL); &pci_root_ops, NULL);
} }
}
return 0; return 0;
} }
......
...@@ -112,13 +112,15 @@ static inline int mpc_apic_id(struct mpc_config_processor *m, ...@@ -112,13 +112,15 @@ static inline int mpc_apic_id(struct mpc_config_processor *m,
static inline void setup_portio_remap(void) static inline void setup_portio_remap(void)
{ {
if (numnodes <= 1) int num_quads = num_online_nodes();
if (num_quads <= 1)
return; return;
printk("Remapping cross-quad port I/O for %d quads\n", numnodes); printk("Remapping cross-quad port I/O for %d quads\n", num_quads);
xquad_portio = ioremap (XQUAD_PORTIO_BASE, numnodes*XQUAD_PORTIO_QUAD); xquad_portio = ioremap(XQUAD_PORTIO_BASE, num_quads*XQUAD_PORTIO_QUAD);
printk("xquad_portio vaddr 0x%08lx, len %08lx\n", printk("xquad_portio vaddr 0x%08lx, len %08lx\n",
(u_long) xquad_portio, (u_long) numnodes*XQUAD_PORTIO_QUAD); (u_long) xquad_portio, (u_long) num_quads*XQUAD_PORTIO_QUAD);
} }
static inline int check_phys_apicid_present(int boot_cpu_physical_apicid) static inline int check_phys_apicid_present(int boot_cpu_physical_apicid)
......
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