[Patch:002/004]Unify pxm_to_node id ver.3. (for ia64)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is to use generic pxm_to_node() function instead of
old pxm_to_nid_map for ia64. And change old CONFIG_IA_NR_NODES
to common one.

Signed-off-by: Yasunori Goto <y-goto@xxxxxxxxxxxxxx>

 arch/ia64/Kconfig               |    9 ++-------
 arch/ia64/hp/common/sba_iommu.c |    2 +-
 arch/ia64/kernel/acpi.c         |   24 ++++++++----------------
 arch/ia64/pci/pci.c             |    2 +-
 arch/ia64/sn/kernel/setup.c     |    4 ++--
 include/asm-ia64/acpi.h         |   11 -----------
 include/asm-ia64/numnodes.h     |    6 +++---
 7 files changed, 17 insertions(+), 41 deletions(-)

Index: pxm_ver3/arch/ia64/kernel/acpi.c
===================================================================
--- pxm_ver3.orig/arch/ia64/kernel/acpi.c	2006-03-28 14:24:40.091383224 +0900
+++ pxm_ver3/arch/ia64/kernel/acpi.c	2006-03-28 14:25:34.960523177 +0900
@@ -415,9 +415,6 @@ static int __initdata srat_num_cpus;	/* 
 static u32 __devinitdata pxm_flag[PXM_FLAG_LEN];
 #define pxm_bit_set(bit)	(set_bit(bit,(void *)pxm_flag))
 #define pxm_bit_test(bit)	(test_bit(bit,(void *)pxm_flag))
-/* maps to convert between proximity domain and logical node ID */
-int __devinitdata pxm_to_nid_map[MAX_PXM_DOMAINS];
-int __initdata nid_to_pxm_map[MAX_NUMNODES];
 static struct acpi_table_slit __initdata *slit_table;
 
 static int get_processor_proximity_domain(struct acpi_table_processor_affinity *pa)
@@ -533,22 +530,17 @@ void __init acpi_numa_arch_fixup(void)
 	 * MCD - This can probably be dropped now.  No need for pxm ID to node ID
 	 * mapping with sparse node numbering iff MAX_PXM_DOMAINS <= MAX_NUMNODES.
 	 */
-	/* calculate total number of nodes in system from PXM bitmap */
-	memset(pxm_to_nid_map, -1, sizeof(pxm_to_nid_map));
-	memset(nid_to_pxm_map, -1, sizeof(nid_to_pxm_map));
 	nodes_clear(node_online_map);
 	for (i = 0; i < MAX_PXM_DOMAINS; i++) {
 		if (pxm_bit_test(i)) {
-			int nid = num_online_nodes();
-			pxm_to_nid_map[i] = nid;
-			nid_to_pxm_map[nid] = i;
+			int nid = acpi_map_pxm_to_node(i);
 			node_set_online(nid);
 		}
 	}
 
 	/* set logical node id in memory chunk structure */
 	for (i = 0; i < num_node_memblks; i++)
-		node_memblk[i].nid = pxm_to_nid_map[node_memblk[i].nid];
+		node_memblk[i].nid = pxm_to_node(node_memblk[i].nid);
 
 	/* assign memory bank numbers for each chunk on each node */
 	for_each_online_node(i) {
@@ -562,7 +554,7 @@ void __init acpi_numa_arch_fixup(void)
 
 	/* set logical node id in cpu structure */
 	for (i = 0; i < srat_num_cpus; i++)
-		node_cpuid[i].nid = pxm_to_nid_map[node_cpuid[i].nid];
+		node_cpuid[i].nid = pxm_to_node(node_cpuid[i].nid);
 
 	printk(KERN_INFO "Number of logical nodes in system = %d\n",
 	       num_online_nodes());
@@ -575,11 +567,11 @@ void __init acpi_numa_arch_fixup(void)
 	for (i = 0; i < slit_table->localities; i++) {
 		if (!pxm_bit_test(i))
 			continue;
-		node_from = pxm_to_nid_map[i];
+		node_from = pxm_to_node(i);
 		for (j = 0; j < slit_table->localities; j++) {
 			if (!pxm_bit_test(j))
 				continue;
-			node_to = pxm_to_nid_map[j];
+			node_to = pxm_to_node(j);
 			node_distance(node_from, node_to) =
 			    slit_table->entry[i * slit_table->localities + j];
 		}
@@ -785,9 +777,9 @@ int acpi_map_cpu2node(acpi_handle handle
 
 	/*
 	 * Assuming that the container driver would have set the proximity
-	 * domain and would have initialized pxm_to_nid_map[pxm_id] && pxm_flag
+	 * domain and would have initialized pxm_to_node(pxm_id) && pxm_flag
 	 */
-	node_cpuid[cpu].nid = (pxm_id < 0) ? 0 : pxm_to_nid_map[pxm_id];
+	node_cpuid[cpu].nid = (pxm_id < 0) ? 0 : pxm_to_node(pxm_id);
 
 	node_cpuid[cpu].phys_id = physid;
 #endif
@@ -966,7 +958,7 @@ acpi_map_iosapic(acpi_handle handle, u32
 	if (pxm < 0)
 		return AE_OK;
 
-	node = pxm_to_nid_map[pxm];
+	node = pxm_to_node(pxm);
 
 	if (node >= MAX_NUMNODES || !node_online(node) ||
 	    cpus_empty(node_to_cpumask(node)))
Index: pxm_ver3/arch/ia64/pci/pci.c
===================================================================
--- pxm_ver3.orig/arch/ia64/pci/pci.c	2006-03-28 14:24:40.091383224 +0900
+++ pxm_ver3/arch/ia64/pci/pci.c	2006-03-28 14:25:34.961499739 +0900
@@ -353,7 +353,7 @@ pci_acpi_scan_root(struct acpi_device *d
 	pxm = acpi_get_pxm(controller->acpi_handle);
 #ifdef CONFIG_NUMA
 	if (pxm >= 0)
-		controller->node = pxm_to_nid_map[pxm];
+		controller->node = pxm_to_node(pxm);
 #endif
 
 	acpi_walk_resources(device->handle, METHOD_NAME__CRS, count_window,
Index: pxm_ver3/arch/ia64/hp/common/sba_iommu.c
===================================================================
--- pxm_ver3.orig/arch/ia64/hp/common/sba_iommu.c	2006-03-28 14:24:40.092359787 +0900
+++ pxm_ver3/arch/ia64/hp/common/sba_iommu.c	2006-03-28 14:25:34.962476302 +0900
@@ -1958,7 +1958,7 @@ sba_map_ioc_to_node(struct ioc *ioc, acp
 	if (pxm < 0)
 		return;
 
-	node = pxm_to_nid_map[pxm];
+	node = pxm_to_node(pxm);
 
 	if (node >= MAX_NUMNODES || !node_online(node))
 		return;
Index: pxm_ver3/arch/ia64/sn/kernel/setup.c
===================================================================
--- pxm_ver3.orig/arch/ia64/sn/kernel/setup.c	2006-03-28 14:24:40.092359787 +0900
+++ pxm_ver3/arch/ia64/sn/kernel/setup.c	2006-03-28 14:25:34.963452864 +0900
@@ -139,7 +139,7 @@ static int __init pxm_to_nasid(int pxm)
 	int i;
 	int nid;
 
-	nid = pxm_to_nid_map[pxm];
+	nid = pxm_to_node(pxm);
 	for (i = 0; i < num_node_memblks; i++) {
 		if (node_memblk[i].nid == nid) {
 			return NASID_GET(node_memblk[i].start_paddr);
@@ -704,7 +704,7 @@ void __init build_cnode_tables(void)
 	 * cnode == node for all C & M bricks.
 	 */
 	for_each_online_node(node) {
-		nasid = pxm_to_nasid(nid_to_pxm_map[node]);
+		nasid = pxm_to_nasid(node_to_pxm(node));
 		sn_cnodeid_to_nasid[node] = nasid;
 		physical_node_map[nasid] = node;
 	}
Index: pxm_ver3/include/asm-ia64/acpi.h
===================================================================
--- pxm_ver3.orig/include/asm-ia64/acpi.h	2006-03-28 14:24:40.092359787 +0900
+++ pxm_ver3/include/asm-ia64/acpi.h	2006-03-28 14:25:34.963452864 +0900
@@ -109,17 +109,6 @@ extern unsigned int get_cpei_target_cpu(
 extern void prefill_possible_map(void);
 extern int additional_cpus;
 
-#ifdef CONFIG_ACPI_NUMA
-/* Proximity bitmap length; _PXM is at most 255 (8 bit)*/
-#ifdef CONFIG_IA64_NR_NODES
-#define MAX_PXM_DOMAINS CONFIG_IA64_NR_NODES
-#else
-#define MAX_PXM_DOMAINS (256)
-#endif
-extern int __devinitdata pxm_to_nid_map[MAX_PXM_DOMAINS];
-extern int __initdata nid_to_pxm_map[MAX_NUMNODES];
-#endif
-
 extern u16 ia64_acpiid_to_sapicid[];
 
 /*
Index: pxm_ver3/arch/ia64/Kconfig
===================================================================
--- pxm_ver3.orig/arch/ia64/Kconfig	2006-03-28 14:27:36.475170126 +0900
+++ pxm_ver3/arch/ia64/Kconfig	2006-03-28 14:32:05.280830896 +0900
@@ -260,14 +260,9 @@ config NR_CPUS
 	  than 64 will cause the use of a CPU mask array, causing a small
 	  performance hit.
 
-config IA64_NR_NODES
-	int "Maximum number of NODEs (256-1024)" if (IA64_SGI_SN2 || IA64_GENERIC)
-	range 256 1024
+config NR_NODES_CHANGABLE
+	def_bool y
 	depends on IA64_SGI_SN2 || IA64_GENERIC
-	default "256"
-	help
-	  This option specifies the maximum number of nodes in your SSI system.
-	  If in doubt, use the default.
 
 config HOTPLUG_CPU
 	bool "Support for hot-pluggable CPUs (EXPERIMENTAL)"
Index: pxm_ver3/include/asm-ia64/numnodes.h
===================================================================
--- pxm_ver3.orig/include/asm-ia64/numnodes.h	2006-03-28 14:27:36.475170126 +0900
+++ pxm_ver3/include/asm-ia64/numnodes.h	2006-03-28 14:33:03.073798938 +0900
@@ -8,11 +8,11 @@
 /* Max 32 Nodes */
 #  define NODES_SHIFT	5
 #elif defined(CONFIG_IA64_SGI_SN2) || defined(CONFIG_IA64_GENERIC)
-#  if CONFIG_IA64_NR_NODES == 256
+#  if CONFIG_NR_NODES == 256
 #    define NODES_SHIFT	8
-#  elif CONFIG_IA64_NR_NODES <= 512
+#  elif CONFIG_NR_NODES <= 512
 #    define NODES_SHIFT    9
-#  elif CONFIG_IA64_NR_NODES <= 1024
+#  elif CONFIG_NR_NODES <= 1024
 #    define NODES_SHIFT    10
 #  endif
 #endif

-- 
Yasunori Goto 


-
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux