aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel/setup_64.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2010-08-31 03:45:21 -0400
committerIngo Molnar <mingo@elte.hu>2010-08-31 03:45:46 -0400
commitdaab7fc734a53fdeaf844b7c03053118ad1769da (patch)
tree575deb3cdcc6dda562acaed6f7c29bc81ae01cf2 /arch/powerpc/kernel/setup_64.c
parent774ea0bcb27f57b6fd521b3b6c43237782fed4b9 (diff)
parent2bfc96a127bc1cc94d26bfaa40159966064f9c8c (diff)
Merge commit 'v2.6.36-rc3' into x86/memblock
Conflicts: arch/x86/kernel/trampoline.c mm/memblock.c Merge reason: Resolve the conflicts, update to latest upstream. Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/powerpc/kernel/setup_64.c')
-rw-r--r--arch/powerpc/kernel/setup_64.c82
1 files changed, 43 insertions, 39 deletions
diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c
index 4360944b60f0..2a178b0ebcdf 100644
--- a/arch/powerpc/kernel/setup_64.c
+++ b/arch/powerpc/kernel/setup_64.c
@@ -95,7 +95,7 @@ int ucache_bsize;
95 95
96#ifdef CONFIG_SMP 96#ifdef CONFIG_SMP
97 97
98static int smt_enabled_cmdline; 98static char *smt_enabled_cmdline;
99 99
100/* Look for ibm,smt-enabled OF option */ 100/* Look for ibm,smt-enabled OF option */
101static void check_smt_enabled(void) 101static void check_smt_enabled(void)
@@ -103,37 +103,46 @@ static void check_smt_enabled(void)
103 struct device_node *dn; 103 struct device_node *dn;
104 const char *smt_option; 104 const char *smt_option;
105 105
106 /* Allow the command line to overrule the OF option */ 106 /* Default to enabling all threads */
107 if (smt_enabled_cmdline) 107 smt_enabled_at_boot = threads_per_core;
108 return;
109
110 dn = of_find_node_by_path("/options");
111
112 if (dn) {
113 smt_option = of_get_property(dn, "ibm,smt-enabled", NULL);
114 108
115 if (smt_option) { 109 /* Allow the command line to overrule the OF option */
116 if (!strcmp(smt_option, "on")) 110 if (smt_enabled_cmdline) {
117 smt_enabled_at_boot = 1; 111 if (!strcmp(smt_enabled_cmdline, "on"))
118 else if (!strcmp(smt_option, "off")) 112 smt_enabled_at_boot = threads_per_core;
119 smt_enabled_at_boot = 0; 113 else if (!strcmp(smt_enabled_cmdline, "off"))
120 } 114 smt_enabled_at_boot = 0;
121 } 115 else {
116 long smt;
117 int rc;
118
119 rc = strict_strtol(smt_enabled_cmdline, 10, &smt);
120 if (!rc)
121 smt_enabled_at_boot =
122 min(threads_per_core, (int)smt);
123 }
124 } else {
125 dn = of_find_node_by_path("/options");
126 if (dn) {
127 smt_option = of_get_property(dn, "ibm,smt-enabled",
128 NULL);
129
130 if (smt_option) {
131 if (!strcmp(smt_option, "on"))
132 smt_enabled_at_boot = threads_per_core;
133 else if (!strcmp(smt_option, "off"))
134 smt_enabled_at_boot = 0;
135 }
136
137 of_node_put(dn);
138 }
139 }
122} 140}
123 141
124/* Look for smt-enabled= cmdline option */ 142/* Look for smt-enabled= cmdline option */
125static int __init early_smt_enabled(char *p) 143static int __init early_smt_enabled(char *p)
126{ 144{
127 smt_enabled_cmdline = 1; 145 smt_enabled_cmdline = p;
128
129 if (!p)
130 return 0;
131
132 if (!strcmp(p, "on") || !strcmp(p, "1"))
133 smt_enabled_at_boot = 1;
134 else if (!strcmp(p, "off") || !strcmp(p, "0"))
135 smt_enabled_at_boot = 0;
136
137 return 0; 146 return 0;
138} 147}
139early_param("smt-enabled", early_smt_enabled); 148early_param("smt-enabled", early_smt_enabled);
@@ -142,16 +151,6 @@ early_param("smt-enabled", early_smt_enabled);
142#define check_smt_enabled() 151#define check_smt_enabled()
143#endif /* CONFIG_SMP */ 152#endif /* CONFIG_SMP */
144 153
145/* Put the paca pointer into r13 and SPRG_PACA */
146static void __init setup_paca(struct paca_struct *new_paca)
147{
148 local_paca = new_paca;
149 mtspr(SPRN_SPRG_PACA, local_paca);
150#ifdef CONFIG_PPC_BOOK3E
151 mtspr(SPRN_SPRG_TLB_EXFRAME, local_paca->extlb);
152#endif
153}
154
155/* 154/*
156 * Early initialization entry point. This is called by head.S 155 * Early initialization entry point. This is called by head.S
157 * with MMU translation disabled. We rely on the "feature" of 156 * with MMU translation disabled. We rely on the "feature" of
@@ -390,8 +389,8 @@ void __init setup_system(void)
390 */ 389 */
391 xmon_setup(); 390 xmon_setup();
392 391
393 check_smt_enabled();
394 smp_setup_cpu_maps(); 392 smp_setup_cpu_maps();
393 check_smt_enabled();
395 394
396#ifdef CONFIG_SMP 395#ifdef CONFIG_SMP
397 /* Release secondary cpus out of their spinloops at 0x60 now that 396 /* Release secondary cpus out of their spinloops at 0x60 now that
@@ -600,6 +599,9 @@ static int pcpu_cpu_distance(unsigned int from, unsigned int to)
600 return REMOTE_DISTANCE; 599 return REMOTE_DISTANCE;
601} 600}
602 601
602unsigned long __per_cpu_offset[NR_CPUS] __read_mostly;
603EXPORT_SYMBOL(__per_cpu_offset);
604
603void __init setup_per_cpu_areas(void) 605void __init setup_per_cpu_areas(void)
604{ 606{
605 const size_t dyn_size = PERCPU_MODULE_RESERVE + PERCPU_DYNAMIC_RESERVE; 607 const size_t dyn_size = PERCPU_MODULE_RESERVE + PERCPU_DYNAMIC_RESERVE;
@@ -624,8 +626,10 @@ void __init setup_per_cpu_areas(void)
624 panic("cannot initialize percpu area (err=%d)", rc); 626 panic("cannot initialize percpu area (err=%d)", rc);
625 627
626 delta = (unsigned long)pcpu_base_addr - (unsigned long)__per_cpu_start; 628 delta = (unsigned long)pcpu_base_addr - (unsigned long)__per_cpu_start;
627 for_each_possible_cpu(cpu) 629 for_each_possible_cpu(cpu) {
628 paca[cpu].data_offset = delta + pcpu_unit_offsets[cpu]; 630 __per_cpu_offset[cpu] = delta + pcpu_unit_offsets[cpu];
631 paca[cpu].data_offset = __per_cpu_offset[cpu];
632 }
629} 633}
630#endif 634#endif
631 635