diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2007-03-02 15:42:04 -0500 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2008-01-29 05:14:57 -0500 |
commit | 0ab7aefc4d43a6dee26c891b41ef9c7a67d2379b (patch) | |
tree | 4a627b7079979ad43b08cef297b2a6eb78d0a78e /arch/mips/kernel/smp.c | |
parent | 92b1e6a64a8d9d5ed3ec8797eed8b36e2164a410 (diff) |
[MIPS] MT: Scheduler support for SMT
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/kernel/smp.c')
-rw-r--r-- | arch/mips/kernel/smp.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/arch/mips/kernel/smp.c b/arch/mips/kernel/smp.c index 63989e9df4f9..335be9bcf0dc 100644 --- a/arch/mips/kernel/smp.c +++ b/arch/mips/kernel/smp.c | |||
@@ -56,6 +56,34 @@ EXPORT_SYMBOL(cpu_online_map); | |||
56 | extern void __init calibrate_delay(void); | 56 | extern void __init calibrate_delay(void); |
57 | extern void cpu_idle(void); | 57 | extern void cpu_idle(void); |
58 | 58 | ||
59 | /* Number of TCs (or siblings in Intel speak) per CPU core */ | ||
60 | int smp_num_siblings = 1; | ||
61 | EXPORT_SYMBOL(smp_num_siblings); | ||
62 | |||
63 | /* representing the TCs (or siblings in Intel speak) of each logical CPU */ | ||
64 | cpumask_t cpu_sibling_map[NR_CPUS] __read_mostly; | ||
65 | EXPORT_SYMBOL(cpu_sibling_map); | ||
66 | |||
67 | /* representing cpus for which sibling maps can be computed */ | ||
68 | static cpumask_t cpu_sibling_setup_map; | ||
69 | |||
70 | static inline void set_cpu_sibling_map(int cpu) | ||
71 | { | ||
72 | int i; | ||
73 | |||
74 | cpu_set(cpu, cpu_sibling_setup_map); | ||
75 | |||
76 | if (smp_num_siblings > 1) { | ||
77 | for_each_cpu_mask(i, cpu_sibling_setup_map) { | ||
78 | if (cpu_data[cpu].core == cpu_data[i].core) { | ||
79 | cpu_set(i, cpu_sibling_map[cpu]); | ||
80 | cpu_set(cpu, cpu_sibling_map[i]); | ||
81 | } | ||
82 | } | ||
83 | } else | ||
84 | cpu_set(cpu, cpu_sibling_map[cpu]); | ||
85 | } | ||
86 | |||
59 | /* | 87 | /* |
60 | * First C code run on the secondary CPUs after being started up by | 88 | * First C code run on the secondary CPUs after being started up by |
61 | * the master. | 89 | * the master. |
@@ -85,6 +113,7 @@ asmlinkage __cpuinit void start_secondary(void) | |||
85 | cpu_data[cpu].udelay_val = loops_per_jiffy; | 113 | cpu_data[cpu].udelay_val = loops_per_jiffy; |
86 | 114 | ||
87 | prom_smp_finish(); | 115 | prom_smp_finish(); |
116 | set_cpu_sibling_map(cpu); | ||
88 | 117 | ||
89 | cpu_set(cpu, cpu_callin_map); | 118 | cpu_set(cpu, cpu_callin_map); |
90 | 119 | ||
@@ -258,6 +287,7 @@ void __init smp_prepare_cpus(unsigned int max_cpus) | |||
258 | init_new_context(current, &init_mm); | 287 | init_new_context(current, &init_mm); |
259 | current_thread_info()->cpu = 0; | 288 | current_thread_info()->cpu = 0; |
260 | plat_prepare_cpus(max_cpus); | 289 | plat_prepare_cpus(max_cpus); |
290 | set_cpu_sibling_map(0); | ||
261 | #ifndef CONFIG_HOTPLUG_CPU | 291 | #ifndef CONFIG_HOTPLUG_CPU |
262 | cpu_present_map = cpu_possible_map; | 292 | cpu_present_map = cpu_possible_map; |
263 | #endif | 293 | #endif |