smp.c (f26e8817b235d8764363bffcc9cbfc61867371f2) smp.c (b866cc2199d6a6cdcefe4acfe4cfca3ac3c6d38e)
1/*
2 * SMP support for pSeries machines.
3 *
4 * Dave Engebretsen, Peter Bergner, and
5 * Mike Corrigan {engebret|bergner|mikec}@us.ibm.com
6 *
7 * Plus various changes from other IBM teams...
8 *

--- 41 unchanged lines hidden (view full) ---

50
51
52/*
53 * The Primary thread of each non-boot processor was started from the OF client
54 * interface by prom_hold_cpus and is spinning on secondary_hold_spinloop.
55 */
56static cpumask_var_t of_spin_mask;
57
1/*
2 * SMP support for pSeries machines.
3 *
4 * Dave Engebretsen, Peter Bergner, and
5 * Mike Corrigan {engebret|bergner|mikec}@us.ibm.com
6 *
7 * Plus various changes from other IBM teams...
8 *

--- 41 unchanged lines hidden (view full) ---

50
51
52/*
53 * The Primary thread of each non-boot processor was started from the OF client
54 * interface by prom_hold_cpus and is spinning on secondary_hold_spinloop.
55 */
56static cpumask_var_t of_spin_mask;
57
58/*
59 * If we multiplex IPI mechanisms, store the appropriate XICS IPI mechanism here
60 */
61static void (*xics_cause_ipi)(int cpu, unsigned long data);
62
63/* Query where a cpu is now. Return codes #defined in plpar_wrappers.h */
64int smp_query_cpu_stopped(unsigned int pcpu)
65{
66 int cpu_status, status;
67 int qcss_tok = rtas_token("query-cpu-stopped-state");
68
69 if (qcss_tok == RTAS_UNKNOWN_SERVICE) {
70 printk_once(KERN_INFO

--- 67 unchanged lines hidden (view full) ---

138#endif
139 return 1;
140}
141
142static void smp_setup_cpu(int cpu)
143{
144 if (cpu != boot_cpuid)
145 xics_setup_cpu();
58/* Query where a cpu is now. Return codes #defined in plpar_wrappers.h */
59int smp_query_cpu_stopped(unsigned int pcpu)
60{
61 int cpu_status, status;
62 int qcss_tok = rtas_token("query-cpu-stopped-state");
63
64 if (qcss_tok == RTAS_UNKNOWN_SERVICE) {
65 printk_once(KERN_INFO

--- 67 unchanged lines hidden (view full) ---

133#endif
134 return 1;
135}
136
137static void smp_setup_cpu(int cpu)
138{
139 if (cpu != boot_cpuid)
140 xics_setup_cpu();
146 if (cpu_has_feature(CPU_FTR_DBELL))
147 doorbell_setup_this_cpu();
148
149 if (firmware_has_feature(FW_FEATURE_SPLPAR))
150 vpa_init(cpu);
151
152 cpumask_clear_cpu(cpu, of_spin_mask);
153#ifdef CONFIG_HOTPLUG_CPU
154 set_cpu_current_state(cpu, CPU_STATE_ONLINE);
155 set_default_offline_state(cpu);

--- 26 unchanged lines hidden (view full) ---

182 printk(KERN_ERR "Error: Prod to wake up processor %d "
183 "Ret= %ld\n", nr, rc);
184 }
185#endif
186
187 return 0;
188}
189
141
142 if (firmware_has_feature(FW_FEATURE_SPLPAR))
143 vpa_init(cpu);
144
145 cpumask_clear_cpu(cpu, of_spin_mask);
146#ifdef CONFIG_HOTPLUG_CPU
147 set_cpu_current_state(cpu, CPU_STATE_ONLINE);
148 set_default_offline_state(cpu);

--- 26 unchanged lines hidden (view full) ---

175 printk(KERN_ERR "Error: Prod to wake up processor %d "
176 "Ret= %ld\n", nr, rc);
177 }
178#endif
179
180 return 0;
181}
182
190/* Only used on systems that support multiple IPI mechanisms */
191static void pSeries_cause_ipi_mux(int cpu, unsigned long data)
183static void smp_pseries_cause_ipi(int cpu)
192{
184{
193 if (cpumask_test_cpu(cpu, cpu_sibling_mask(smp_processor_id())))
194 doorbell_cause_ipi(cpu, data);
195 else
196 xics_cause_ipi(cpu, data);
185 /* POWER9 should not use this handler */
186 if (doorbell_try_core_ipi(cpu))
187 return;
188
189 icp_ops->cause_ipi(cpu);
197}
198
199static __init void pSeries_smp_probe(void)
200{
201 xics_smp_probe();
202
190}
191
192static __init void pSeries_smp_probe(void)
193{
194 xics_smp_probe();
195
203 if (cpu_has_feature(CPU_FTR_DBELL)) {
204 xics_cause_ipi = smp_ops->cause_ipi;
205 smp_ops->cause_ipi = pSeries_cause_ipi_mux;
206 }
196 if (cpu_has_feature(CPU_FTR_DBELL))
197 smp_ops->cause_ipi = smp_pseries_cause_ipi;
198 else
199 smp_ops->cause_ipi = icp_ops->cause_ipi;
207}
208
209static struct smp_ops_t pseries_smp_ops = {
210 .message_pass = NULL, /* Use smp_muxed_ipi_message_pass */
211 .cause_ipi = NULL, /* Filled at runtime by pSeries_smp_probe() */
212 .probe = pSeries_smp_probe,
213 .kick_cpu = smp_pSeries_kick_cpu,
214 .setup_cpu = smp_setup_cpu,

--- 39 unchanged lines hidden ---
200}
201
202static struct smp_ops_t pseries_smp_ops = {
203 .message_pass = NULL, /* Use smp_muxed_ipi_message_pass */
204 .cause_ipi = NULL, /* Filled at runtime by pSeries_smp_probe() */
205 .probe = pSeries_smp_probe,
206 .kick_cpu = smp_pSeries_kick_cpu,
207 .setup_cpu = smp_setup_cpu,

--- 39 unchanged lines hidden ---