diff options
author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
commit | 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch) | |
tree | 0bba044c4ce775e45a88a51686b5d9f90697ea9d /arch/ia64/kernel/topology.c |
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.
Let it rip!
Diffstat (limited to 'arch/ia64/kernel/topology.c')
-rw-r--r-- | arch/ia64/kernel/topology.c | 92 |
1 files changed, 92 insertions, 0 deletions
diff --git a/arch/ia64/kernel/topology.c b/arch/ia64/kernel/topology.c new file mode 100644 index 000000000000..f1aafd4c05f9 --- /dev/null +++ b/arch/ia64/kernel/topology.c | |||
@@ -0,0 +1,92 @@ | |||
1 | /* | ||
2 | * This file is subject to the terms and conditions of the GNU General Public | ||
3 | * License. See the file "COPYING" in the main directory of this archive | ||
4 | * for more details. | ||
5 | * | ||
6 | * This file contains NUMA specific variables and functions which can | ||
7 | * be split away from DISCONTIGMEM and are used on NUMA machines with | ||
8 | * contiguous memory. | ||
9 | * 2002/08/07 Erich Focht <efocht@ess.nec.de> | ||
10 | * Populate cpu entries in sysfs for non-numa systems as well | ||
11 | * Intel Corporation - Ashok Raj | ||
12 | */ | ||
13 | |||
14 | #include <linux/config.h> | ||
15 | #include <linux/cpu.h> | ||
16 | #include <linux/kernel.h> | ||
17 | #include <linux/mm.h> | ||
18 | #include <linux/node.h> | ||
19 | #include <linux/init.h> | ||
20 | #include <linux/bootmem.h> | ||
21 | #include <linux/nodemask.h> | ||
22 | #include <asm/mmzone.h> | ||
23 | #include <asm/numa.h> | ||
24 | #include <asm/cpu.h> | ||
25 | |||
26 | #ifdef CONFIG_NUMA | ||
27 | static struct node *sysfs_nodes; | ||
28 | #endif | ||
29 | static struct ia64_cpu *sysfs_cpus; | ||
30 | |||
31 | int arch_register_cpu(int num) | ||
32 | { | ||
33 | struct node *parent = NULL; | ||
34 | |||
35 | #ifdef CONFIG_NUMA | ||
36 | parent = &sysfs_nodes[cpu_to_node(num)]; | ||
37 | #endif /* CONFIG_NUMA */ | ||
38 | |||
39 | return register_cpu(&sysfs_cpus[num].cpu, num, parent); | ||
40 | } | ||
41 | |||
42 | #ifdef CONFIG_HOTPLUG_CPU | ||
43 | |||
44 | void arch_unregister_cpu(int num) | ||
45 | { | ||
46 | struct node *parent = NULL; | ||
47 | |||
48 | #ifdef CONFIG_NUMA | ||
49 | int node = cpu_to_node(num); | ||
50 | parent = &sysfs_nodes[node]; | ||
51 | #endif /* CONFIG_NUMA */ | ||
52 | |||
53 | return unregister_cpu(&sysfs_cpus[num].cpu, parent); | ||
54 | } | ||
55 | EXPORT_SYMBOL(arch_register_cpu); | ||
56 | EXPORT_SYMBOL(arch_unregister_cpu); | ||
57 | #endif /*CONFIG_HOTPLUG_CPU*/ | ||
58 | |||
59 | |||
60 | static int __init topology_init(void) | ||
61 | { | ||
62 | int i, err = 0; | ||
63 | |||
64 | #ifdef CONFIG_NUMA | ||
65 | sysfs_nodes = kmalloc(sizeof(struct node) * MAX_NUMNODES, GFP_KERNEL); | ||
66 | if (!sysfs_nodes) { | ||
67 | err = -ENOMEM; | ||
68 | goto out; | ||
69 | } | ||
70 | memset(sysfs_nodes, 0, sizeof(struct node) * MAX_NUMNODES); | ||
71 | |||
72 | /* MCD - Do we want to register all ONLINE nodes, or all POSSIBLE nodes? */ | ||
73 | for_each_online_node(i) | ||
74 | if ((err = register_node(&sysfs_nodes[i], i, 0))) | ||
75 | goto out; | ||
76 | #endif | ||
77 | |||
78 | sysfs_cpus = kmalloc(sizeof(struct ia64_cpu) * NR_CPUS, GFP_KERNEL); | ||
79 | if (!sysfs_cpus) { | ||
80 | err = -ENOMEM; | ||
81 | goto out; | ||
82 | } | ||
83 | memset(sysfs_cpus, 0, sizeof(struct ia64_cpu) * NR_CPUS); | ||
84 | |||
85 | for_each_present_cpu(i) | ||
86 | if((err = arch_register_cpu(i))) | ||
87 | goto out; | ||
88 | out: | ||
89 | return err; | ||
90 | } | ||
91 | |||
92 | __initcall(topology_init); | ||