smp.c (98a79d6a50181ca1ecf7400eda01d5dc1bc0dbf0) smp.c (13a9801eb669d567ab2c8f8db5e50557fef5f636)
1/*
2 * SMP support for ppc.
3 *
4 * Written by Cort Dougan (cort@cs.nmt.edu) borrowing a great
5 * deal of code from the sparc and intel versions.
6 *
7 * Copyright (C) 1999 Cort Dougan <cort@cs.nmt.edu>
8 *

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

52
53#ifdef DEBUG
54#include <asm/udbg.h>
55#define DBG(fmt...) udbg_printf(fmt)
56#else
57#define DBG(fmt...)
58#endif
59
1/*
2 * SMP support for ppc.
3 *
4 * Written by Cort Dougan (cort@cs.nmt.edu) borrowing a great
5 * deal of code from the sparc and intel versions.
6 *
7 * Copyright (C) 1999 Cort Dougan <cort@cs.nmt.edu>
8 *

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

52
53#ifdef DEBUG
54#include <asm/udbg.h>
55#define DBG(fmt...) udbg_printf(fmt)
56#else
57#define DBG(fmt...)
58#endif
59
60int smp_hw_index[NR_CPUS];
61struct thread_info *secondary_ti;
62
60struct thread_info *secondary_ti;
61
62cpumask_t cpu_possible_map = CPU_MASK_NONE;
63cpumask_t cpu_online_map = CPU_MASK_NONE;
63DEFINE_PER_CPU(cpumask_t, cpu_sibling_map) = CPU_MASK_NONE;
64DEFINE_PER_CPU(cpumask_t, cpu_core_map) = CPU_MASK_NONE;
65
64DEFINE_PER_CPU(cpumask_t, cpu_sibling_map) = CPU_MASK_NONE;
65DEFINE_PER_CPU(cpumask_t, cpu_core_map) = CPU_MASK_NONE;
66
67EXPORT_SYMBOL(cpu_online_map);
68EXPORT_SYMBOL(cpu_possible_map);
66EXPORT_PER_CPU_SYMBOL(cpu_sibling_map);
67EXPORT_PER_CPU_SYMBOL(cpu_core_map);
68
69/* SMP operations for this machine */
70struct smp_ops_t *smp_ops;
71
72static volatile unsigned int cpu_callin_map[NR_CPUS];
73

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

114 /* FALLTHROUGH */
115 default:
116 printk("SMP %d: smp_message_recv(): unknown msg %d\n",
117 smp_processor_id(), msg);
118 break;
119 }
120}
121
69EXPORT_PER_CPU_SYMBOL(cpu_sibling_map);
70EXPORT_PER_CPU_SYMBOL(cpu_core_map);
71
72/* SMP operations for this machine */
73struct smp_ops_t *smp_ops;
74
75static volatile unsigned int cpu_callin_map[NR_CPUS];
76

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

117 /* FALLTHROUGH */
118 default:
119 printk("SMP %d: smp_message_recv(): unknown msg %d\n",
120 smp_processor_id(), msg);
121 break;
122 }
123}
124
125static irqreturn_t call_function_action(int irq, void *data)
126{
127 generic_smp_call_function_interrupt();
128 return IRQ_HANDLED;
129}
130
131static irqreturn_t reschedule_action(int irq, void *data)
132{
133 /* we just need the return path side effect of checking need_resched */
134 return IRQ_HANDLED;
135}
136
137static irqreturn_t call_function_single_action(int irq, void *data)
138{
139 generic_smp_call_function_single_interrupt();
140 return IRQ_HANDLED;
141}
142
143static irqreturn_t debug_ipi_action(int irq, void *data)
144{
145 smp_message_recv(PPC_MSG_DEBUGGER_BREAK);
146 return IRQ_HANDLED;
147}
148
149static irq_handler_t smp_ipi_action[] = {
150 [PPC_MSG_CALL_FUNCTION] = call_function_action,
151 [PPC_MSG_RESCHEDULE] = reschedule_action,
152 [PPC_MSG_CALL_FUNC_SINGLE] = call_function_single_action,
153 [PPC_MSG_DEBUGGER_BREAK] = debug_ipi_action,
154};
155
156const char *smp_ipi_name[] = {
157 [PPC_MSG_CALL_FUNCTION] = "ipi call function",
158 [PPC_MSG_RESCHEDULE] = "ipi reschedule",
159 [PPC_MSG_CALL_FUNC_SINGLE] = "ipi call function single",
160 [PPC_MSG_DEBUGGER_BREAK] = "ipi debugger",
161};
162
163/* optional function to request ipi, for controllers with >= 4 ipis */
164int smp_request_message_ipi(int virq, int msg)
165{
166 int err;
167
168 if (msg < 0 || msg > PPC_MSG_DEBUGGER_BREAK) {
169 return -EINVAL;
170 }
171#if !defined(CONFIG_DEBUGGER) && !defined(CONFIG_KEXEC)
172 if (msg == PPC_MSG_DEBUGGER_BREAK) {
173 return 1;
174 }
175#endif
176 err = request_irq(virq, smp_ipi_action[msg], IRQF_DISABLED|IRQF_PERCPU,
177 smp_ipi_name[msg], 0);
178 WARN(err < 0, "unable to request_irq %d for %s (rc %d)\n",
179 virq, smp_ipi_name[msg], err);
180
181 return err;
182}
183
122void smp_send_reschedule(int cpu)
123{
124 if (likely(smp_ops))
125 smp_ops->message_pass(cpu, PPC_MSG_RESCHEDULE);
126}
127
128void arch_send_call_function_single_ipi(int cpu)
129{

--- 431 unchanged lines hidden ---
184void smp_send_reschedule(int cpu)
185{
186 if (likely(smp_ops))
187 smp_ops->message_pass(cpu, PPC_MSG_RESCHEDULE);
188}
189
190void arch_send_call_function_single_ipi(int cpu)
191{

--- 431 unchanged lines hidden ---