diff options
author | Jeff Garzik <jgarzik@pobox.com> | 2005-09-08 05:43:49 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2005-09-08 05:43:49 -0400 |
commit | 1d6ae775d7a948c9575658eb41184fd2e506c0df (patch) | |
tree | 8128a28e89d82f13bb8e3a2160382240c66e2816 /arch/ia64/kernel | |
parent | 739cdbf1d8f0739b80035b80d69d871e33749b86 (diff) | |
parent | caf39e87cc1182f7dae84eefc43ca14d54c78ef9 (diff) |
Merge /spare/repo/linux-2.6/
Diffstat (limited to 'arch/ia64/kernel')
-rw-r--r-- | arch/ia64/kernel/Makefile | 3 | ||||
-rw-r--r-- | arch/ia64/kernel/cpufreq/Kconfig | 29 | ||||
-rw-r--r-- | arch/ia64/kernel/cpufreq/Makefile | 1 | ||||
-rw-r--r-- | arch/ia64/kernel/cpufreq/acpi-cpufreq.c | 499 | ||||
-rw-r--r-- | arch/ia64/kernel/domain.c | 396 | ||||
-rw-r--r-- | arch/ia64/kernel/irq.c | 39 | ||||
-rw-r--r-- | arch/ia64/kernel/jprobes.S | 1 | ||||
-rw-r--r-- | arch/ia64/kernel/kprobes.c | 124 | ||||
-rw-r--r-- | arch/ia64/kernel/sys_ia64.c | 2 | ||||
-rw-r--r-- | arch/ia64/kernel/traps.c | 5 | ||||
-rw-r--r-- | arch/ia64/kernel/uncached.c | 4 | ||||
-rw-r--r-- | arch/ia64/kernel/vmlinux.lds.S | 1 |
12 files changed, 637 insertions, 467 deletions
diff --git a/arch/ia64/kernel/Makefile b/arch/ia64/kernel/Makefile index e1fb68ddec26..307514f7a282 100644 --- a/arch/ia64/kernel/Makefile +++ b/arch/ia64/kernel/Makefile | |||
@@ -16,10 +16,11 @@ obj-$(CONFIG_IA64_HP_ZX1_SWIOTLB) += acpi-ext.o | |||
16 | obj-$(CONFIG_IA64_PALINFO) += palinfo.o | 16 | obj-$(CONFIG_IA64_PALINFO) += palinfo.o |
17 | obj-$(CONFIG_IOSAPIC) += iosapic.o | 17 | obj-$(CONFIG_IOSAPIC) += iosapic.o |
18 | obj-$(CONFIG_MODULES) += module.o | 18 | obj-$(CONFIG_MODULES) += module.o |
19 | obj-$(CONFIG_SMP) += smp.o smpboot.o domain.o | 19 | obj-$(CONFIG_SMP) += smp.o smpboot.o |
20 | obj-$(CONFIG_NUMA) += numa.o | 20 | obj-$(CONFIG_NUMA) += numa.o |
21 | obj-$(CONFIG_PERFMON) += perfmon_default_smpl.o | 21 | obj-$(CONFIG_PERFMON) += perfmon_default_smpl.o |
22 | obj-$(CONFIG_IA64_CYCLONE) += cyclone.o | 22 | obj-$(CONFIG_IA64_CYCLONE) += cyclone.o |
23 | obj-$(CONFIG_CPU_FREQ) += cpufreq/ | ||
23 | obj-$(CONFIG_IA64_MCA_RECOVERY) += mca_recovery.o | 24 | obj-$(CONFIG_IA64_MCA_RECOVERY) += mca_recovery.o |
24 | obj-$(CONFIG_KPROBES) += kprobes.o jprobes.o | 25 | obj-$(CONFIG_KPROBES) += kprobes.o jprobes.o |
25 | obj-$(CONFIG_IA64_UNCACHED_ALLOCATOR) += uncached.o | 26 | obj-$(CONFIG_IA64_UNCACHED_ALLOCATOR) += uncached.o |
diff --git a/arch/ia64/kernel/cpufreq/Kconfig b/arch/ia64/kernel/cpufreq/Kconfig new file mode 100644 index 000000000000..2d9d5279b981 --- /dev/null +++ b/arch/ia64/kernel/cpufreq/Kconfig | |||
@@ -0,0 +1,29 @@ | |||
1 | |||
2 | # | ||
3 | # CPU Frequency scaling | ||
4 | # | ||
5 | |||
6 | menu "CPU Frequency scaling" | ||
7 | |||
8 | source "drivers/cpufreq/Kconfig" | ||
9 | |||
10 | if CPU_FREQ | ||
11 | |||
12 | comment "CPUFreq processor drivers" | ||
13 | |||
14 | config IA64_ACPI_CPUFREQ | ||
15 | tristate "ACPI Processor P-States driver" | ||
16 | select CPU_FREQ_TABLE | ||
17 | depends on ACPI_PROCESSOR | ||
18 | help | ||
19 | This driver adds a CPUFreq driver which utilizes the ACPI | ||
20 | Processor Performance States. | ||
21 | |||
22 | For details, take a look at <file:Documentation/cpu-freq/>. | ||
23 | |||
24 | If in doubt, say N. | ||
25 | |||
26 | endif # CPU_FREQ | ||
27 | |||
28 | endmenu | ||
29 | |||
diff --git a/arch/ia64/kernel/cpufreq/Makefile b/arch/ia64/kernel/cpufreq/Makefile new file mode 100644 index 000000000000..f748d34c02f0 --- /dev/null +++ b/arch/ia64/kernel/cpufreq/Makefile | |||
@@ -0,0 +1 @@ | |||
obj-$(CONFIG_IA64_ACPI_CPUFREQ) += acpi-cpufreq.o | |||
diff --git a/arch/ia64/kernel/cpufreq/acpi-cpufreq.c b/arch/ia64/kernel/cpufreq/acpi-cpufreq.c new file mode 100644 index 000000000000..da4d5cf80a48 --- /dev/null +++ b/arch/ia64/kernel/cpufreq/acpi-cpufreq.c | |||
@@ -0,0 +1,499 @@ | |||
1 | /* | ||
2 | * arch/ia64/kernel/cpufreq/acpi-cpufreq.c | ||
3 | * This file provides the ACPI based P-state support. This | ||
4 | * module works with generic cpufreq infrastructure. Most of | ||
5 | * the code is based on i386 version | ||
6 | * (arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c) | ||
7 | * | ||
8 | * Copyright (C) 2005 Intel Corp | ||
9 | * Venkatesh Pallipadi <venkatesh.pallipadi@intel.com> | ||
10 | */ | ||
11 | |||
12 | #include <linux/config.h> | ||
13 | #include <linux/kernel.h> | ||
14 | #include <linux/module.h> | ||
15 | #include <linux/init.h> | ||
16 | #include <linux/cpufreq.h> | ||
17 | #include <linux/proc_fs.h> | ||
18 | #include <linux/seq_file.h> | ||
19 | #include <asm/io.h> | ||
20 | #include <asm/uaccess.h> | ||
21 | #include <asm/pal.h> | ||
22 | |||
23 | #include <linux/acpi.h> | ||
24 | #include <acpi/processor.h> | ||
25 | |||
26 | #define dprintk(msg...) cpufreq_debug_printk(CPUFREQ_DEBUG_DRIVER, "acpi-cpufreq", msg) | ||
27 | |||
28 | MODULE_AUTHOR("Venkatesh Pallipadi"); | ||
29 | MODULE_DESCRIPTION("ACPI Processor P-States Driver"); | ||
30 | MODULE_LICENSE("GPL"); | ||
31 | |||
32 | |||
33 | struct cpufreq_acpi_io { | ||
34 | struct acpi_processor_performance acpi_data; | ||
35 | struct cpufreq_frequency_table *freq_table; | ||
36 | unsigned int resume; | ||
37 | }; | ||
38 | |||
39 | static struct cpufreq_acpi_io *acpi_io_data[NR_CPUS]; | ||
40 | |||
41 | static struct cpufreq_driver acpi_cpufreq_driver; | ||
42 | |||
43 | |||
44 | static int | ||
45 | processor_set_pstate ( | ||
46 | u32 value) | ||
47 | { | ||
48 | s64 retval; | ||
49 | |||
50 | dprintk("processor_set_pstate\n"); | ||
51 | |||
52 | retval = ia64_pal_set_pstate((u64)value); | ||
53 | |||
54 | if (retval) { | ||
55 | dprintk("Failed to set freq to 0x%x, with error 0x%x\n", | ||
56 | value, retval); | ||
57 | return -ENODEV; | ||
58 | } | ||
59 | return (int)retval; | ||
60 | } | ||
61 | |||
62 | |||
63 | static int | ||
64 | processor_get_pstate ( | ||
65 | u32 *value) | ||
66 | { | ||
67 | u64 pstate_index = 0; | ||
68 | s64 retval; | ||
69 | |||
70 | dprintk("processor_get_pstate\n"); | ||
71 | |||
72 | retval = ia64_pal_get_pstate(&pstate_index); | ||
73 | *value = (u32) pstate_index; | ||
74 | |||
75 | if (retval) | ||
76 | dprintk("Failed to get current freq with " | ||
77 | "error 0x%x, idx 0x%x\n", retval, *value); | ||
78 | |||
79 | return (int)retval; | ||
80 | } | ||
81 | |||
82 | |||
83 | /* To be used only after data->acpi_data is initialized */ | ||
84 | static unsigned | ||
85 | extract_clock ( | ||
86 | struct cpufreq_acpi_io *data, | ||
87 | unsigned value, | ||
88 | unsigned int cpu) | ||
89 | { | ||
90 | unsigned long i; | ||
91 | |||
92 | dprintk("extract_clock\n"); | ||
93 | |||
94 | for (i = 0; i < data->acpi_data.state_count; i++) { | ||
95 | if (value >= data->acpi_data.states[i].control) | ||
96 | return data->acpi_data.states[i].core_frequency; | ||
97 | } | ||
98 | return data->acpi_data.states[i-1].core_frequency; | ||
99 | } | ||
100 | |||
101 | |||
102 | static unsigned int | ||
103 | processor_get_freq ( | ||
104 | struct cpufreq_acpi_io *data, | ||
105 | unsigned int cpu) | ||
106 | { | ||
107 | int ret = 0; | ||
108 | u32 value = 0; | ||
109 | cpumask_t saved_mask; | ||
110 | unsigned long clock_freq; | ||
111 | |||
112 | dprintk("processor_get_freq\n"); | ||
113 | |||
114 | saved_mask = current->cpus_allowed; | ||
115 | set_cpus_allowed(current, cpumask_of_cpu(cpu)); | ||
116 | if (smp_processor_id() != cpu) { | ||
117 | ret = -EAGAIN; | ||
118 | goto migrate_end; | ||
119 | } | ||
120 | |||
121 | /* | ||
122 | * processor_get_pstate gets the average frequency since the | ||
123 | * last get. So, do two PAL_get_freq()... | ||
124 | */ | ||
125 | ret = processor_get_pstate(&value); | ||
126 | ret = processor_get_pstate(&value); | ||
127 | |||
128 | if (ret) { | ||
129 | set_cpus_allowed(current, saved_mask); | ||
130 | printk(KERN_WARNING "get performance failed with error %d\n", | ||
131 | ret); | ||
132 | ret = -EAGAIN; | ||
133 | goto migrate_end; | ||
134 | } | ||
135 | clock_freq = extract_clock(data, value, cpu); | ||
136 | ret = (clock_freq*1000); | ||
137 | |||
138 | migrate_end: | ||
139 | set_cpus_allowed(current, saved_mask); | ||
140 | return ret; | ||
141 | } | ||
142 | |||
143 | |||
144 | static int | ||
145 | processor_set_freq ( | ||
146 | struct cpufreq_acpi_io *data, | ||
147 | unsigned int cpu, | ||
148 | int state) | ||
149 | { | ||
150 | int ret = 0; | ||
151 | u32 value = 0; | ||
152 | struct cpufreq_freqs cpufreq_freqs; | ||
153 | cpumask_t saved_mask; | ||
154 | int retval; | ||
155 | |||
156 | dprintk("processor_set_freq\n"); | ||
157 | |||
158 | saved_mask = current->cpus_allowed; | ||
159 | set_cpus_allowed(current, cpumask_of_cpu(cpu)); | ||
160 | if (smp_processor_id() != cpu) { | ||
161 | retval = -EAGAIN; | ||
162 | goto migrate_end; | ||
163 | } | ||
164 | |||
165 | if (state == data->acpi_data.state) { | ||
166 | if (unlikely(data->resume)) { | ||
167 | dprintk("Called after resume, resetting to P%d\n", state); | ||
168 | data->resume = 0; | ||
169 | } else { | ||
170 | dprintk("Already at target state (P%d)\n", state); | ||
171 | retval = 0; | ||
172 | goto migrate_end; | ||
173 | } | ||
174 | } | ||
175 | |||
176 | dprintk("Transitioning from P%d to P%d\n", | ||
177 | data->acpi_data.state, state); | ||
178 | |||
179 | /* cpufreq frequency struct */ | ||
180 | cpufreq_freqs.cpu = cpu; | ||
181 | cpufreq_freqs.old = data->freq_table[data->acpi_data.state].frequency; | ||
182 | cpufreq_freqs.new = data->freq_table[state].frequency; | ||
183 | |||
184 | /* notify cpufreq */ | ||
185 | cpufreq_notify_transition(&cpufreq_freqs, CPUFREQ_PRECHANGE); | ||
186 | |||
187 | /* | ||
188 | * First we write the target state's 'control' value to the | ||
189 | * control_register. | ||
190 | */ | ||
191 | |||
192 | value = (u32) data->acpi_data.states[state].control; | ||
193 | |||
194 | dprintk("Transitioning to state: 0x%08x\n", value); | ||
195 | |||
196 | ret = processor_set_pstate(value); | ||
197 | if (ret) { | ||
198 | unsigned int tmp = cpufreq_freqs.new; | ||
199 | cpufreq_notify_transition(&cpufreq_freqs, CPUFREQ_POSTCHANGE); | ||
200 | cpufreq_freqs.new = cpufreq_freqs.old; | ||
201 | cpufreq_freqs.old = tmp; | ||
202 | cpufreq_notify_transition(&cpufreq_freqs, CPUFREQ_PRECHANGE); | ||
203 | cpufreq_notify_transition(&cpufreq_freqs, CPUFREQ_POSTCHANGE); | ||
204 | printk(KERN_WARNING "Transition failed with error %d\n", ret); | ||
205 | retval = -ENODEV; | ||
206 | goto migrate_end; | ||
207 | } | ||
208 | |||
209 | cpufreq_notify_transition(&cpufreq_freqs, CPUFREQ_POSTCHANGE); | ||
210 | |||
211 | data->acpi_data.state = state; | ||
212 | |||
213 | retval = 0; | ||
214 | |||
215 | migrate_end: | ||
216 | set_cpus_allowed(current, saved_mask); | ||
217 | return (retval); | ||
218 | } | ||
219 | |||
220 | |||
221 | static unsigned int | ||
222 | acpi_cpufreq_get ( | ||
223 | unsigned int cpu) | ||
224 | { | ||
225 | struct cpufreq_acpi_io *data = acpi_io_data[cpu]; | ||
226 | |||
227 | dprintk("acpi_cpufreq_get\n"); | ||
228 | |||
229 | return processor_get_freq(data, cpu); | ||
230 | } | ||
231 | |||
232 | |||
233 | static int | ||
234 | acpi_cpufreq_target ( | ||
235 | struct cpufreq_policy *policy, | ||
236 | unsigned int target_freq, | ||
237 | unsigned int relation) | ||
238 | { | ||
239 | struct cpufreq_acpi_io *data = acpi_io_data[policy->cpu]; | ||
240 | unsigned int next_state = 0; | ||
241 | unsigned int result = 0; | ||
242 | |||
243 | dprintk("acpi_cpufreq_setpolicy\n"); | ||
244 | |||
245 | result = cpufreq_frequency_table_target(policy, | ||
246 | data->freq_table, target_freq, relation, &next_state); | ||
247 | if (result) | ||
248 | return (result); | ||
249 | |||
250 | result = processor_set_freq(data, policy->cpu, next_state); | ||
251 | |||
252 | return (result); | ||
253 | } | ||
254 | |||
255 | |||
256 | static int | ||
257 | acpi_cpufreq_verify ( | ||
258 | struct cpufreq_policy *policy) | ||
259 | { | ||
260 | unsigned int result = 0; | ||
261 | struct cpufreq_acpi_io *data = acpi_io_data[policy->cpu]; | ||
262 | |||
263 | dprintk("acpi_cpufreq_verify\n"); | ||
264 | |||
265 | result = cpufreq_frequency_table_verify(policy, | ||
266 | data->freq_table); | ||
267 | |||
268 | return (result); | ||
269 | } | ||
270 | |||
271 | |||
272 | /* | ||
273 | * processor_init_pdc - let BIOS know about the SMP capabilities | ||
274 | * of this driver | ||
275 | * @perf: processor-specific acpi_io_data struct | ||
276 | * @cpu: CPU being initialized | ||
277 | * | ||
278 | * To avoid issues with legacy OSes, some BIOSes require to be informed of | ||
279 | * the SMP capabilities of OS P-state driver. Here we set the bits in _PDC | ||
280 | * accordingly. Actual call to _PDC is done in driver/acpi/processor.c | ||
281 | */ | ||
282 | static void | ||
283 | processor_init_pdc ( | ||
284 | struct acpi_processor_performance *perf, | ||
285 | unsigned int cpu, | ||
286 | struct acpi_object_list *obj_list | ||
287 | ) | ||
288 | { | ||
289 | union acpi_object *obj; | ||
290 | u32 *buf; | ||
291 | |||
292 | dprintk("processor_init_pdc\n"); | ||
293 | |||
294 | perf->pdc = NULL; | ||
295 | /* Initialize pdc. It will be used later. */ | ||
296 | if (!obj_list) | ||
297 | return; | ||
298 | |||
299 | if (!(obj_list->count && obj_list->pointer)) | ||
300 | return; | ||
301 | |||
302 | obj = obj_list->pointer; | ||
303 | if ((obj->buffer.length == 12) && obj->buffer.pointer) { | ||
304 | buf = (u32 *)obj->buffer.pointer; | ||
305 | buf[0] = ACPI_PDC_REVISION_ID; | ||
306 | buf[1] = 1; | ||
307 | buf[2] = ACPI_PDC_EST_CAPABILITY_SMP; | ||
308 | perf->pdc = obj_list; | ||
309 | } | ||
310 | return; | ||
311 | } | ||
312 | |||
313 | |||
314 | static int | ||
315 | acpi_cpufreq_cpu_init ( | ||
316 | struct cpufreq_policy *policy) | ||
317 | { | ||
318 | unsigned int i; | ||
319 | unsigned int cpu = policy->cpu; | ||
320 | struct cpufreq_acpi_io *data; | ||
321 | unsigned int result = 0; | ||
322 | |||
323 | union acpi_object arg0 = {ACPI_TYPE_BUFFER}; | ||
324 | u32 arg0_buf[3]; | ||
325 | struct acpi_object_list arg_list = {1, &arg0}; | ||
326 | |||
327 | dprintk("acpi_cpufreq_cpu_init\n"); | ||
328 | /* setup arg_list for _PDC settings */ | ||
329 | arg0.buffer.length = 12; | ||
330 | arg0.buffer.pointer = (u8 *) arg0_buf; | ||
331 | |||
332 | data = kmalloc(sizeof(struct cpufreq_acpi_io), GFP_KERNEL); | ||
333 | if (!data) | ||
334 | return (-ENOMEM); | ||
335 | |||
336 | memset(data, 0, sizeof(struct cpufreq_acpi_io)); | ||
337 | |||
338 | acpi_io_data[cpu] = data; | ||
339 | |||
340 | processor_init_pdc(&data->acpi_data, cpu, &arg_list); | ||
341 | result = acpi_processor_register_performance(&data->acpi_data, cpu); | ||
342 | data->acpi_data.pdc = NULL; | ||
343 | |||
344 | if (result) | ||
345 | goto err_free; | ||
346 | |||
347 | /* capability check */ | ||
348 | if (data->acpi_data.state_count <= 1) { | ||
349 | dprintk("No P-States\n"); | ||
350 | result = -ENODEV; | ||
351 | goto err_unreg; | ||
352 | } | ||
353 | |||
354 | if ((data->acpi_data.control_register.space_id != | ||
355 | ACPI_ADR_SPACE_FIXED_HARDWARE) || | ||
356 | (data->acpi_data.status_register.space_id != | ||
357 | ACPI_ADR_SPACE_FIXED_HARDWARE)) { | ||
358 | dprintk("Unsupported address space [%d, %d]\n", | ||
359 | (u32) (data->acpi_data.control_register.space_id), | ||
360 | (u32) (data->acpi_data.status_register.space_id)); | ||
361 | result = -ENODEV; | ||
362 | goto err_unreg; | ||
363 | } | ||
364 | |||
365 | /* alloc freq_table */ | ||
366 | data->freq_table = kmalloc(sizeof(struct cpufreq_frequency_table) * | ||
367 | (data->acpi_data.state_count + 1), | ||
368 | GFP_KERNEL); | ||
369 | if (!data->freq_table) { | ||
370 | result = -ENOMEM; | ||
371 | goto err_unreg; | ||
372 | } | ||
373 | |||
374 | /* detect transition latency */ | ||
375 | policy->cpuinfo.transition_latency = 0; | ||
376 | for (i=0; i<data->acpi_data.state_count; i++) { | ||
377 | if ((data->acpi_data.states[i].transition_latency * 1000) > | ||
378 | policy->cpuinfo.transition_latency) { | ||
379 | policy->cpuinfo.transition_latency = | ||
380 | data->acpi_data.states[i].transition_latency * 1000; | ||
381 | } | ||
382 | } | ||
383 | policy->governor = CPUFREQ_DEFAULT_GOVERNOR; | ||
384 | |||
385 | policy->cur = processor_get_freq(data, policy->cpu); | ||
386 | |||
387 | /* table init */ | ||
388 | for (i = 0; i <= data->acpi_data.state_count; i++) | ||
389 | { | ||
390 | data->freq_table[i].index = i; | ||
391 | if (i < data->acpi_data.state_count) { | ||
392 | data->freq_table[i].frequency = | ||
393 | data->acpi_data.states[i].core_frequency * 1000; | ||
394 | } else { | ||
395 | data->freq_table[i].frequency = CPUFREQ_TABLE_END; | ||
396 | } | ||
397 | } | ||
398 | |||
399 | result = cpufreq_frequency_table_cpuinfo(policy, data->freq_table); | ||
400 | if (result) { | ||
401 | goto err_freqfree; | ||
402 | } | ||
403 | |||
404 | /* notify BIOS that we exist */ | ||
405 | acpi_processor_notify_smm(THIS_MODULE); | ||
406 | |||
407 | printk(KERN_INFO "acpi-cpufreq: CPU%u - ACPI performance management " | ||
408 | "activated.\n", cpu); | ||
409 | |||
410 | for (i = 0; i < data->acpi_data.state_count; i++) | ||
411 | dprintk(" %cP%d: %d MHz, %d mW, %d uS, %d uS, 0x%x 0x%x\n", | ||
412 | (i == data->acpi_data.state?'*':' '), i, | ||
413 | (u32) data->acpi_data.states[i].core_frequency, | ||
414 | (u32) data->acpi_data.states[i].power, | ||
415 | (u32) data->acpi_data.states[i].transition_latency, | ||
416 | (u32) data->acpi_data.states[i].bus_master_latency, | ||
417 | (u32) data->acpi_data.states[i].status, | ||
418 | (u32) data->acpi_data.states[i].control); | ||
419 | |||
420 | cpufreq_frequency_table_get_attr(data->freq_table, policy->cpu); | ||
421 | |||
422 | /* the first call to ->target() should result in us actually | ||
423 | * writing something to the appropriate registers. */ | ||
424 | data->resume = 1; | ||
425 | |||
426 | return (result); | ||
427 | |||
428 | err_freqfree: | ||
429 | kfree(data->freq_table); | ||
430 | err_unreg: | ||
431 | acpi_processor_unregister_performance(&data->acpi_data, cpu); | ||
432 | err_free: | ||
433 | kfree(data); | ||
434 | acpi_io_data[cpu] = NULL; | ||
435 | |||
436 | return (result); | ||
437 | } | ||
438 | |||
439 | |||
440 | static int | ||
441 | acpi_cpufreq_cpu_exit ( | ||
442 | struct cpufreq_policy *policy) | ||
443 | { | ||
444 | struct cpufreq_acpi_io *data = acpi_io_data[policy->cpu]; | ||
445 | |||
446 | dprintk("acpi_cpufreq_cpu_exit\n"); | ||
447 | |||
448 | if (data) { | ||
449 | cpufreq_frequency_table_put_attr(policy->cpu); | ||
450 | acpi_io_data[policy->cpu] = NULL; | ||
451 | acpi_processor_unregister_performance(&data->acpi_data, | ||
452 | policy->cpu); | ||
453 | kfree(data); | ||
454 | } | ||
455 | |||
456 | return (0); | ||
457 | } | ||
458 | |||
459 | |||
460 | static struct freq_attr* acpi_cpufreq_attr[] = { | ||
461 | &cpufreq_freq_attr_scaling_available_freqs, | ||
462 | NULL, | ||
463 | }; | ||
464 | |||
465 | |||
466 | static struct cpufreq_driver acpi_cpufreq_driver = { | ||
467 | .verify = acpi_cpufreq_verify, | ||
468 | .target = acpi_cpufreq_target, | ||
469 | .get = acpi_cpufreq_get, | ||
470 | .init = acpi_cpufreq_cpu_init, | ||
471 | .exit = acpi_cpufreq_cpu_exit, | ||
472 | .name = "acpi-cpufreq", | ||
473 | .owner = THIS_MODULE, | ||
474 | .attr = acpi_cpufreq_attr, | ||
475 | }; | ||
476 | |||
477 | |||
478 | static int __init | ||
479 | acpi_cpufreq_init (void) | ||
480 | { | ||
481 | dprintk("acpi_cpufreq_init\n"); | ||
482 | |||
483 | return cpufreq_register_driver(&acpi_cpufreq_driver); | ||
484 | } | ||
485 | |||
486 | |||
487 | static void __exit | ||
488 | acpi_cpufreq_exit (void) | ||
489 | { | ||
490 | dprintk("acpi_cpufreq_exit\n"); | ||
491 | |||
492 | cpufreq_unregister_driver(&acpi_cpufreq_driver); | ||
493 | return; | ||
494 | } | ||
495 | |||
496 | |||
497 | late_initcall(acpi_cpufreq_init); | ||
498 | module_exit(acpi_cpufreq_exit); | ||
499 | |||
diff --git a/arch/ia64/kernel/domain.c b/arch/ia64/kernel/domain.c deleted file mode 100644 index bbb8efe126b7..000000000000 --- a/arch/ia64/kernel/domain.c +++ /dev/null | |||
@@ -1,396 +0,0 @@ | |||
1 | /* | ||
2 | * arch/ia64/kernel/domain.c | ||
3 | * Architecture specific sched-domains builder. | ||
4 | * | ||
5 | * Copyright (C) 2004 Jesse Barnes | ||
6 | * Copyright (C) 2004 Silicon Graphics, Inc. | ||
7 | */ | ||
8 | |||
9 | #include <linux/sched.h> | ||
10 | #include <linux/percpu.h> | ||
11 | #include <linux/slab.h> | ||
12 | #include <linux/cpumask.h> | ||
13 | #include <linux/init.h> | ||
14 | #include <linux/topology.h> | ||
15 | #include <linux/nodemask.h> | ||
16 | |||
17 | #define SD_NODES_PER_DOMAIN 16 | ||
18 | |||
19 | #ifdef CONFIG_NUMA | ||
20 | /** | ||
21 | * find_next_best_node - find the next node to include in a sched_domain | ||
22 | * @node: node whose sched_domain we're building | ||
23 | * @used_nodes: nodes already in the sched_domain | ||
24 | * | ||
25 | * Find the next node to include in a given scheduling domain. Simply | ||
26 | * finds the closest node not already in the @used_nodes map. | ||
27 | * | ||
28 | * Should use nodemask_t. | ||
29 | */ | ||
30 | static int find_next_best_node(int node, unsigned long *used_nodes) | ||
31 | { | ||
32 | int i, n, val, min_val, best_node = 0; | ||
33 | |||
34 | min_val = INT_MAX; | ||
35 | |||
36 | for (i = 0; i < MAX_NUMNODES; i++) { | ||
37 | /* Start at @node */ | ||
38 | n = (node + i) % MAX_NUMNODES; | ||
39 | |||
40 | if (!nr_cpus_node(n)) | ||
41 | continue; | ||
42 | |||
43 | /* Skip already used nodes */ | ||
44 | if (test_bit(n, used_nodes)) | ||
45 | continue; | ||
46 | |||
47 | /* Simple min distance search */ | ||
48 | val = node_distance(node, n); | ||
49 | |||
50 | if (val < min_val) { | ||
51 | min_val = val; | ||
52 | best_node = n; | ||
53 | } | ||
54 | } | ||
55 | |||
56 | set_bit(best_node, used_nodes); | ||
57 | return best_node; | ||
58 | } | ||
59 | |||
60 | /** | ||
61 | * sched_domain_node_span - get a cpumask for a node's sched_domain | ||
62 | * @node: node whose cpumask we're constructing | ||
63 | * @size: number of nodes to include in this span | ||
64 | * | ||
65 | * Given a node, construct a good cpumask for its sched_domain to span. It | ||
66 | * should be one that prevents unnecessary balancing, but also spreads tasks | ||
67 | * out optimally. | ||
68 | */ | ||
69 | static cpumask_t sched_domain_node_span(int node) | ||
70 | { | ||
71 | int i; | ||
72 | cpumask_t span, nodemask; | ||
73 | DECLARE_BITMAP(used_nodes, MAX_NUMNODES); | ||
74 | |||
75 | cpus_clear(span); | ||
76 | bitmap_zero(used_nodes, MAX_NUMNODES); | ||
77 | |||
78 | nodemask = node_to_cpumask(node); | ||
79 | cpus_or(span, span, nodemask); | ||
80 | set_bit(node, used_nodes); | ||
81 | |||
82 | for (i = 1; i < SD_NODES_PER_DOMAIN; i++) { | ||
83 | int next_node = find_next_best_node(node, used_nodes); | ||
84 | nodemask = node_to_cpumask(next_node); | ||
85 | cpus_or(span, span, nodemask); | ||
86 | } | ||
87 | |||
88 | return span; | ||
89 | } | ||
90 | #endif | ||
91 | |||
92 | /* | ||
93 | * At the moment, CONFIG_SCHED_SMT is never defined, but leave it in so we | ||
94 | * can switch it on easily if needed. | ||
95 | */ | ||
96 | #ifdef CONFIG_SCHED_SMT | ||
97 | static DEFINE_PER_CPU(struct sched_domain, cpu_domains); | ||
98 | static struct sched_group sched_group_cpus[NR_CPUS]; | ||
99 | static int cpu_to_cpu_group(int cpu) | ||
100 | { | ||
101 | return cpu; | ||
102 | } | ||
103 | #endif | ||
104 | |||
105 | static DEFINE_PER_CPU(struct sched_domain, phys_domains); | ||
106 | static struct sched_group sched_group_phys[NR_CPUS]; | ||
107 | static int cpu_to_phys_group(int cpu) | ||
108 | { | ||
109 | #ifdef CONFIG_SCHED_SMT | ||
110 | return first_cpu(cpu_sibling_map[cpu]); | ||
111 | #else | ||
112 | return cpu; | ||
113 | #endif | ||
114 | } | ||
115 | |||
116 | #ifdef CONFIG_NUMA | ||
117 | /* | ||
118 | * The init_sched_build_groups can't handle what we want to do with node | ||
119 | * groups, so roll our own. Now each node has its own list of groups which | ||
120 | * gets dynamically allocated. | ||
121 | */ | ||
122 | static DEFINE_PER_CPU(struct sched_domain, node_domains); | ||
123 | static struct sched_group *sched_group_nodes[MAX_NUMNODES]; | ||
124 | |||
125 | static DEFINE_PER_CPU(struct sched_domain, allnodes_domains); | ||
126 | static struct sched_group sched_group_allnodes[MAX_NUMNODES]; | ||
127 | |||
128 | static int cpu_to_allnodes_group(int cpu) | ||
129 | { | ||
130 | return cpu_to_node(cpu); | ||
131 | } | ||
132 | #endif | ||
133 | |||
134 | /* | ||
135 | * Build sched domains for a given set of cpus and attach the sched domains | ||
136 | * to the individual cpus | ||
137 | */ | ||
138 | void build_sched_domains(const cpumask_t *cpu_map) | ||
139 | { | ||
140 | int i; | ||
141 | |||
142 | /* | ||
143 | * Set up domains for cpus specified by the cpu_map. | ||
144 | */ | ||
145 | for_each_cpu_mask(i, *cpu_map) { | ||
146 | int group; | ||
147 | struct sched_domain *sd = NULL, *p; | ||
148 | cpumask_t nodemask = node_to_cpumask(cpu_to_node(i)); | ||
149 | |||
150 | cpus_and(nodemask, nodemask, *cpu_map); | ||
151 | |||
152 | #ifdef CONFIG_NUMA | ||
153 | if (num_online_cpus() | ||
154 | > SD_NODES_PER_DOMAIN*cpus_weight(nodemask)) { | ||
155 | sd = &per_cpu(allnodes_domains, i); | ||
156 | *sd = SD_ALLNODES_INIT; | ||
157 | sd->span = *cpu_map; | ||
158 | group = cpu_to_allnodes_group(i); | ||
159 | sd->groups = &sched_group_allnodes[group]; | ||
160 | p = sd; | ||
161 | } else | ||
162 | p = NULL; | ||
163 | |||
164 | sd = &per_cpu(node_domains, i); | ||
165 | *sd = SD_NODE_INIT; | ||
166 | sd->span = sched_domain_node_span(cpu_to_node(i)); | ||
167 | sd->parent = p; | ||
168 | cpus_and(sd->span, sd->span, *cpu_map); | ||
169 | #endif | ||
170 | |||
171 | p = sd; | ||
172 | sd = &per_cpu(phys_domains, i); | ||
173 | group = cpu_to_phys_group(i); | ||
174 | *sd = SD_CPU_INIT; | ||
175 | sd->span = nodemask; | ||
176 | sd->parent = p; | ||
177 | sd->groups = &sched_group_phys[group]; | ||
178 | |||
179 | #ifdef CONFIG_SCHED_SMT | ||
180 | p = sd; | ||
181 | sd = &per_cpu(cpu_domains, i); | ||
182 | group = cpu_to_cpu_group(i); | ||
183 | *sd = SD_SIBLING_INIT; | ||
184 | sd->span = cpu_sibling_map[i]; | ||
185 | cpus_and(sd->span, sd->span, *cpu_map); | ||
186 | sd->parent = p; | ||
187 | sd->groups = &sched_group_cpus[group]; | ||
188 | #endif | ||
189 | } | ||
190 | |||
191 | #ifdef CONFIG_SCHED_SMT | ||
192 | /* Set up CPU (sibling) groups */ | ||
193 | for_each_cpu_mask(i, *cpu_map) { | ||
194 | cpumask_t this_sibling_map = cpu_sibling_map[i]; | ||
195 | cpus_and(this_sibling_map, this_sibling_map, *cpu_map); | ||
196 | if (i != first_cpu(this_sibling_map)) | ||
197 | continue; | ||
198 | |||
199 | init_sched_build_groups(sched_group_cpus, this_sibling_map, | ||
200 | &cpu_to_cpu_group); | ||
201 | } | ||
202 | #endif | ||
203 | |||
204 | /* Set up physical groups */ | ||
205 | for (i = 0; i < MAX_NUMNODES; i++) { | ||
206 | cpumask_t nodemask = node_to_cpumask(i); | ||
207 | |||
208 | cpus_and(nodemask, nodemask, *cpu_map); | ||
209 | if (cpus_empty(nodemask)) | ||
210 | continue; | ||
211 | |||
212 | init_sched_build_groups(sched_group_phys, nodemask, | ||
213 | &cpu_to_phys_group); | ||
214 | } | ||
215 | |||
216 | #ifdef CONFIG_NUMA | ||
217 | init_sched_build_groups(sched_group_allnodes, *cpu_map, | ||
218 | &cpu_to_allnodes_group); | ||
219 | |||
220 | for (i = 0; i < MAX_NUMNODES; i++) { | ||
221 | /* Set up node groups */ | ||
222 | struct sched_group *sg, *prev; | ||
223 | cpumask_t nodemask = node_to_cpumask(i); | ||
224 | cpumask_t domainspan; | ||
225 | cpumask_t covered = CPU_MASK_NONE; | ||
226 | int j; | ||
227 | |||
228 | cpus_and(nodemask, nodemask, *cpu_map); | ||
229 | if (cpus_empty(nodemask)) | ||
230 | continue; | ||
231 | |||
232 | domainspan = sched_domain_node_span(i); | ||
233 | cpus_and(domainspan, domainspan, *cpu_map); | ||
234 | |||
235 | sg = kmalloc(sizeof(struct sched_group), GFP_KERNEL); | ||
236 | sched_group_nodes[i] = sg; | ||
237 | for_each_cpu_mask(j, nodemask) { | ||
238 | struct sched_domain *sd; | ||
239 | sd = &per_cpu(node_domains, j); | ||
240 | sd->groups = sg; | ||
241 | if (sd->groups == NULL) { | ||
242 | /* Turn off balancing if we have no groups */ | ||
243 | sd->flags = 0; | ||
244 | } | ||
245 | } | ||
246 | if (!sg) { | ||
247 | printk(KERN_WARNING | ||
248 | "Can not alloc domain group for node %d\n", i); | ||
249 | continue; | ||
250 | } | ||
251 | sg->cpu_power = 0; | ||
252 | sg->cpumask = nodemask; | ||
253 | cpus_or(covered, covered, nodemask); | ||
254 | prev = sg; | ||
255 | |||
256 | for (j = 0; j < MAX_NUMNODES; j++) { | ||
257 | cpumask_t tmp, notcovered; | ||
258 | int n = (i + j) % MAX_NUMNODES; | ||
259 | |||
260 | cpus_complement(notcovered, covered); | ||
261 | cpus_and(tmp, notcovered, *cpu_map); | ||
262 | cpus_and(tmp, tmp, domainspan); | ||
263 | if (cpus_empty(tmp)) | ||
264 | break; | ||
265 | |||
266 | nodemask = node_to_cpumask(n); | ||
267 | cpus_and(tmp, tmp, nodemask); | ||
268 | if (cpus_empty(tmp)) | ||
269 | continue; | ||
270 | |||
271 | sg = kmalloc(sizeof(struct sched_group), GFP_KERNEL); | ||
272 | if (!sg) { | ||
273 | printk(KERN_WARNING | ||
274 | "Can not alloc domain group for node %d\n", j); | ||
275 | break; | ||
276 | } | ||
277 | sg->cpu_power = 0; | ||
278 | sg->cpumask = tmp; | ||
279 | cpus_or(covered, covered, tmp); | ||
280 | prev->next = sg; | ||
281 | prev = sg; | ||
282 | } | ||
283 | prev->next = sched_group_nodes[i]; | ||
284 | } | ||
285 | #endif | ||
286 | |||
287 | /* Calculate CPU power for physical packages and nodes */ | ||
288 | for_each_cpu_mask(i, *cpu_map) { | ||
289 | int power; | ||
290 | struct sched_domain *sd; | ||
291 | #ifdef CONFIG_SCHED_SMT | ||
292 | sd = &per_cpu(cpu_domains, i); | ||
293 | power = SCHED_LOAD_SCALE; | ||
294 | sd->groups->cpu_power = power; | ||
295 | #endif | ||
296 | |||
297 | sd = &per_cpu(phys_domains, i); | ||
298 | power = SCHED_LOAD_SCALE + SCHED_LOAD_SCALE * | ||
299 | (cpus_weight(sd->groups->cpumask)-1) / 10; | ||
300 | sd->groups->cpu_power = power; | ||
301 | |||
302 | #ifdef CONFIG_NUMA | ||
303 | sd = &per_cpu(allnodes_domains, i); | ||
304 | if (sd->groups) { | ||
305 | power = SCHED_LOAD_SCALE + SCHED_LOAD_SCALE * | ||
306 | (cpus_weight(sd->groups->cpumask)-1) / 10; | ||
307 | sd->groups->cpu_power = power; | ||
308 | } | ||
309 | #endif | ||
310 | } | ||
311 | |||
312 | #ifdef CONFIG_NUMA | ||
313 | for (i = 0; i < MAX_NUMNODES; i++) { | ||
314 | struct sched_group *sg = sched_group_nodes[i]; | ||
315 | int j; | ||
316 | |||
317 | if (sg == NULL) | ||
318 | continue; | ||
319 | next_sg: | ||
320 | for_each_cpu_mask(j, sg->cpumask) { | ||
321 | struct sched_domain *sd; | ||
322 | int power; | ||
323 | |||
324 | sd = &per_cpu(phys_domains, j); | ||
325 | if (j != first_cpu(sd->groups->cpumask)) { | ||
326 | /* | ||
327 | * Only add "power" once for each | ||
328 | * physical package. | ||
329 | */ | ||
330 | continue; | ||
331 | } | ||
332 | power = SCHED_LOAD_SCALE + SCHED_LOAD_SCALE * | ||
333 | (cpus_weight(sd->groups->cpumask)-1) / 10; | ||
334 | |||
335 | sg->cpu_power += power; | ||
336 | } | ||
337 | sg = sg->next; | ||
338 | if (sg != sched_group_nodes[i]) | ||
339 | goto next_sg; | ||
340 | } | ||
341 | #endif | ||
342 | |||
343 | /* Attach the domains */ | ||
344 | for_each_cpu_mask(i, *cpu_map) { | ||
345 | struct sched_domain *sd; | ||
346 | #ifdef CONFIG_SCHED_SMT | ||
347 | sd = &per_cpu(cpu_domains, i); | ||
348 | #else | ||
349 | sd = &per_cpu(phys_domains, i); | ||
350 | #endif | ||
351 | cpu_attach_domain(sd, i); | ||
352 | } | ||
353 | } | ||
354 | /* | ||
355 | * Set up scheduler domains and groups. Callers must hold the hotplug lock. | ||
356 | */ | ||
357 | void arch_init_sched_domains(const cpumask_t *cpu_map) | ||
358 | { | ||
359 | cpumask_t cpu_default_map; | ||
360 | |||
361 | /* | ||
362 | * Setup mask for cpus without special case scheduling requirements. | ||
363 | * For now this just excludes isolated cpus, but could be used to | ||
364 | * exclude other special cases in the future. | ||
365 | */ | ||
366 | cpus_andnot(cpu_default_map, *cpu_map, cpu_isolated_map); | ||
367 | |||
368 | build_sched_domains(&cpu_default_map); | ||
369 | } | ||
370 | |||
371 | void arch_destroy_sched_domains(const cpumask_t *cpu_map) | ||
372 | { | ||
373 | #ifdef CONFIG_NUMA | ||
374 | int i; | ||
375 | for (i = 0; i < MAX_NUMNODES; i++) { | ||
376 | cpumask_t nodemask = node_to_cpumask(i); | ||
377 | struct sched_group *oldsg, *sg = sched_group_nodes[i]; | ||
378 | |||
379 | cpus_and(nodemask, nodemask, *cpu_map); | ||
380 | if (cpus_empty(nodemask)) | ||
381 | continue; | ||
382 | |||
383 | if (sg == NULL) | ||
384 | continue; | ||
385 | sg = sg->next; | ||
386 | next_sg: | ||
387 | oldsg = sg; | ||
388 | sg = sg->next; | ||
389 | kfree(oldsg); | ||
390 | if (oldsg != sched_group_nodes[i]) | ||
391 | goto next_sg; | ||
392 | sched_group_nodes[i] = NULL; | ||
393 | } | ||
394 | #endif | ||
395 | } | ||
396 | |||
diff --git a/arch/ia64/kernel/irq.c b/arch/ia64/kernel/irq.c index 28f2aadc38d0..205d98028261 100644 --- a/arch/ia64/kernel/irq.c +++ b/arch/ia64/kernel/irq.c | |||
@@ -91,23 +91,8 @@ skip: | |||
91 | } | 91 | } |
92 | 92 | ||
93 | #ifdef CONFIG_SMP | 93 | #ifdef CONFIG_SMP |
94 | /* | ||
95 | * This is updated when the user sets irq affinity via /proc | ||
96 | */ | ||
97 | static cpumask_t __cacheline_aligned pending_irq_cpumask[NR_IRQS]; | ||
98 | static unsigned long pending_irq_redir[BITS_TO_LONGS(NR_IRQS)]; | ||
99 | |||
100 | static char irq_redir [NR_IRQS]; // = { [0 ... NR_IRQS-1] = 1 }; | 94 | static char irq_redir [NR_IRQS]; // = { [0 ... NR_IRQS-1] = 1 }; |
101 | 95 | ||
102 | /* | ||
103 | * Arch specific routine for deferred write to iosapic rte to reprogram | ||
104 | * intr destination. | ||
105 | */ | ||
106 | void proc_set_irq_affinity(unsigned int irq, cpumask_t mask_val) | ||
107 | { | ||
108 | pending_irq_cpumask[irq] = mask_val; | ||
109 | } | ||
110 | |||
111 | void set_irq_affinity_info (unsigned int irq, int hwid, int redir) | 96 | void set_irq_affinity_info (unsigned int irq, int hwid, int redir) |
112 | { | 97 | { |
113 | cpumask_t mask = CPU_MASK_NONE; | 98 | cpumask_t mask = CPU_MASK_NONE; |
@@ -116,32 +101,10 @@ void set_irq_affinity_info (unsigned int irq, int hwid, int redir) | |||
116 | 101 | ||
117 | if (irq < NR_IRQS) { | 102 | if (irq < NR_IRQS) { |
118 | irq_affinity[irq] = mask; | 103 | irq_affinity[irq] = mask; |
104 | set_irq_info(irq, mask); | ||
119 | irq_redir[irq] = (char) (redir & 0xff); | 105 | irq_redir[irq] = (char) (redir & 0xff); |
120 | } | 106 | } |
121 | } | 107 | } |
122 | |||
123 | |||
124 | void move_irq(int irq) | ||
125 | { | ||
126 | /* note - we hold desc->lock */ | ||
127 | cpumask_t tmp; | ||
128 | irq_desc_t *desc = irq_descp(irq); | ||
129 | int redir = test_bit(irq, pending_irq_redir); | ||
130 | |||
131 | if (unlikely(!desc->handler->set_affinity)) | ||
132 | return; | ||
133 | |||
134 | if (!cpus_empty(pending_irq_cpumask[irq])) { | ||
135 | cpus_and(tmp, pending_irq_cpumask[irq], cpu_online_map); | ||
136 | if (unlikely(!cpus_empty(tmp))) { | ||
137 | desc->handler->set_affinity(irq | (redir ? IA64_IRQ_REDIRECTED : 0), | ||
138 | pending_irq_cpumask[irq]); | ||
139 | } | ||
140 | cpus_clear(pending_irq_cpumask[irq]); | ||
141 | } | ||
142 | } | ||
143 | |||
144 | |||
145 | #endif /* CONFIG_SMP */ | 108 | #endif /* CONFIG_SMP */ |
146 | 109 | ||
147 | #ifdef CONFIG_HOTPLUG_CPU | 110 | #ifdef CONFIG_HOTPLUG_CPU |
diff --git a/arch/ia64/kernel/jprobes.S b/arch/ia64/kernel/jprobes.S index b7fa3ccd2b0f..2323377e3695 100644 --- a/arch/ia64/kernel/jprobes.S +++ b/arch/ia64/kernel/jprobes.S | |||
@@ -49,6 +49,7 @@ | |||
49 | /* | 49 | /* |
50 | * void jprobe_break(void) | 50 | * void jprobe_break(void) |
51 | */ | 51 | */ |
52 | .section .kprobes.text, "ax" | ||
52 | ENTRY(jprobe_break) | 53 | ENTRY(jprobe_break) |
53 | break.m 0x80300 | 54 | break.m 0x80300 |
54 | END(jprobe_break) | 55 | END(jprobe_break) |
diff --git a/arch/ia64/kernel/kprobes.c b/arch/ia64/kernel/kprobes.c index 884f5cd27d8a..471086b808a4 100644 --- a/arch/ia64/kernel/kprobes.c +++ b/arch/ia64/kernel/kprobes.c | |||
@@ -87,12 +87,25 @@ static enum instruction_type bundle_encoding[32][3] = { | |||
87 | * is IP relative instruction and update the kprobe | 87 | * is IP relative instruction and update the kprobe |
88 | * inst flag accordingly | 88 | * inst flag accordingly |
89 | */ | 89 | */ |
90 | static void update_kprobe_inst_flag(uint template, uint slot, uint major_opcode, | 90 | static void __kprobes update_kprobe_inst_flag(uint template, uint slot, |
91 | unsigned long kprobe_inst, struct kprobe *p) | 91 | uint major_opcode, |
92 | unsigned long kprobe_inst, | ||
93 | struct kprobe *p) | ||
92 | { | 94 | { |
93 | p->ainsn.inst_flag = 0; | 95 | p->ainsn.inst_flag = 0; |
94 | p->ainsn.target_br_reg = 0; | 96 | p->ainsn.target_br_reg = 0; |
95 | 97 | ||
98 | /* Check for Break instruction | ||
99 | * Bits 37:40 Major opcode to be zero | ||
100 | * Bits 27:32 X6 to be zero | ||
101 | * Bits 32:35 X3 to be zero | ||
102 | */ | ||
103 | if ((!major_opcode) && (!((kprobe_inst >> 27) & 0x1FF)) ) { | ||
104 | /* is a break instruction */ | ||
105 | p->ainsn.inst_flag |= INST_FLAG_BREAK_INST; | ||
106 | return; | ||
107 | } | ||
108 | |||
96 | if (bundle_encoding[template][slot] == B) { | 109 | if (bundle_encoding[template][slot] == B) { |
97 | switch (major_opcode) { | 110 | switch (major_opcode) { |
98 | case INDIRECT_CALL_OPCODE: | 111 | case INDIRECT_CALL_OPCODE: |
@@ -126,8 +139,10 @@ static void update_kprobe_inst_flag(uint template, uint slot, uint major_opcode | |||
126 | * Returns 0 if supported | 139 | * Returns 0 if supported |
127 | * Returns -EINVAL if unsupported | 140 | * Returns -EINVAL if unsupported |
128 | */ | 141 | */ |
129 | static int unsupported_inst(uint template, uint slot, uint major_opcode, | 142 | static int __kprobes unsupported_inst(uint template, uint slot, |
130 | unsigned long kprobe_inst, struct kprobe *p) | 143 | uint major_opcode, |
144 | unsigned long kprobe_inst, | ||
145 | struct kprobe *p) | ||
131 | { | 146 | { |
132 | unsigned long addr = (unsigned long)p->addr; | 147 | unsigned long addr = (unsigned long)p->addr; |
133 | 148 | ||
@@ -168,8 +183,9 @@ static int unsupported_inst(uint template, uint slot, uint major_opcode, | |||
168 | * on which we are inserting kprobe is cmp instruction | 183 | * on which we are inserting kprobe is cmp instruction |
169 | * with ctype as unc. | 184 | * with ctype as unc. |
170 | */ | 185 | */ |
171 | static uint is_cmp_ctype_unc_inst(uint template, uint slot, uint major_opcode, | 186 | static uint __kprobes is_cmp_ctype_unc_inst(uint template, uint slot, |
172 | unsigned long kprobe_inst) | 187 | uint major_opcode, |
188 | unsigned long kprobe_inst) | ||
173 | { | 189 | { |
174 | cmp_inst_t cmp_inst; | 190 | cmp_inst_t cmp_inst; |
175 | uint ctype_unc = 0; | 191 | uint ctype_unc = 0; |
@@ -201,8 +217,10 @@ out: | |||
201 | * In this function we override the bundle with | 217 | * In this function we override the bundle with |
202 | * the break instruction at the given slot. | 218 | * the break instruction at the given slot. |
203 | */ | 219 | */ |
204 | static void prepare_break_inst(uint template, uint slot, uint major_opcode, | 220 | static void __kprobes prepare_break_inst(uint template, uint slot, |
205 | unsigned long kprobe_inst, struct kprobe *p) | 221 | uint major_opcode, |
222 | unsigned long kprobe_inst, | ||
223 | struct kprobe *p) | ||
206 | { | 224 | { |
207 | unsigned long break_inst = BREAK_INST; | 225 | unsigned long break_inst = BREAK_INST; |
208 | bundle_t *bundle = &p->ainsn.insn.bundle; | 226 | bundle_t *bundle = &p->ainsn.insn.bundle; |
@@ -271,7 +289,8 @@ static inline int in_ivt_functions(unsigned long addr) | |||
271 | && addr < (unsigned long)__end_ivt_text); | 289 | && addr < (unsigned long)__end_ivt_text); |
272 | } | 290 | } |
273 | 291 | ||
274 | static int valid_kprobe_addr(int template, int slot, unsigned long addr) | 292 | static int __kprobes valid_kprobe_addr(int template, int slot, |
293 | unsigned long addr) | ||
275 | { | 294 | { |
276 | if ((slot > 2) || ((bundle_encoding[template][1] == L) && slot > 1)) { | 295 | if ((slot > 2) || ((bundle_encoding[template][1] == L) && slot > 1)) { |
277 | printk(KERN_WARNING "Attempting to insert unaligned kprobe " | 296 | printk(KERN_WARNING "Attempting to insert unaligned kprobe " |
@@ -323,7 +342,7 @@ static void kretprobe_trampoline(void) | |||
323 | * - cleanup by marking the instance as unused | 342 | * - cleanup by marking the instance as unused |
324 | * - long jump back to the original return address | 343 | * - long jump back to the original return address |
325 | */ | 344 | */ |
326 | int trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs) | 345 | int __kprobes trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs) |
327 | { | 346 | { |
328 | struct kretprobe_instance *ri = NULL; | 347 | struct kretprobe_instance *ri = NULL; |
329 | struct hlist_head *head; | 348 | struct hlist_head *head; |
@@ -381,7 +400,8 @@ int trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs) | |||
381 | return 1; | 400 | return 1; |
382 | } | 401 | } |
383 | 402 | ||
384 | void arch_prepare_kretprobe(struct kretprobe *rp, struct pt_regs *regs) | 403 | void __kprobes arch_prepare_kretprobe(struct kretprobe *rp, |
404 | struct pt_regs *regs) | ||
385 | { | 405 | { |
386 | struct kretprobe_instance *ri; | 406 | struct kretprobe_instance *ri; |
387 | 407 | ||
@@ -399,7 +419,7 @@ void arch_prepare_kretprobe(struct kretprobe *rp, struct pt_regs *regs) | |||
399 | } | 419 | } |
400 | } | 420 | } |
401 | 421 | ||
402 | int arch_prepare_kprobe(struct kprobe *p) | 422 | int __kprobes arch_prepare_kprobe(struct kprobe *p) |
403 | { | 423 | { |
404 | unsigned long addr = (unsigned long) p->addr; | 424 | unsigned long addr = (unsigned long) p->addr; |
405 | unsigned long *kprobe_addr = (unsigned long *)(addr & ~0xFULL); | 425 | unsigned long *kprobe_addr = (unsigned long *)(addr & ~0xFULL); |
@@ -430,7 +450,7 @@ int arch_prepare_kprobe(struct kprobe *p) | |||
430 | return 0; | 450 | return 0; |
431 | } | 451 | } |
432 | 452 | ||
433 | void arch_arm_kprobe(struct kprobe *p) | 453 | void __kprobes arch_arm_kprobe(struct kprobe *p) |
434 | { | 454 | { |
435 | unsigned long addr = (unsigned long)p->addr; | 455 | unsigned long addr = (unsigned long)p->addr; |
436 | unsigned long arm_addr = addr & ~0xFULL; | 456 | unsigned long arm_addr = addr & ~0xFULL; |
@@ -439,7 +459,7 @@ void arch_arm_kprobe(struct kprobe *p) | |||
439 | flush_icache_range(arm_addr, arm_addr + sizeof(bundle_t)); | 459 | flush_icache_range(arm_addr, arm_addr + sizeof(bundle_t)); |
440 | } | 460 | } |
441 | 461 | ||
442 | void arch_disarm_kprobe(struct kprobe *p) | 462 | void __kprobes arch_disarm_kprobe(struct kprobe *p) |
443 | { | 463 | { |
444 | unsigned long addr = (unsigned long)p->addr; | 464 | unsigned long addr = (unsigned long)p->addr; |
445 | unsigned long arm_addr = addr & ~0xFULL; | 465 | unsigned long arm_addr = addr & ~0xFULL; |
@@ -449,7 +469,7 @@ void arch_disarm_kprobe(struct kprobe *p) | |||
449 | flush_icache_range(arm_addr, arm_addr + sizeof(bundle_t)); | 469 | flush_icache_range(arm_addr, arm_addr + sizeof(bundle_t)); |
450 | } | 470 | } |
451 | 471 | ||
452 | void arch_remove_kprobe(struct kprobe *p) | 472 | void __kprobes arch_remove_kprobe(struct kprobe *p) |
453 | { | 473 | { |
454 | } | 474 | } |
455 | 475 | ||
@@ -461,7 +481,7 @@ void arch_remove_kprobe(struct kprobe *p) | |||
461 | * to original stack address, handle the case where we need to fixup the | 481 | * to original stack address, handle the case where we need to fixup the |
462 | * relative IP address and/or fixup branch register. | 482 | * relative IP address and/or fixup branch register. |
463 | */ | 483 | */ |
464 | static void resume_execution(struct kprobe *p, struct pt_regs *regs) | 484 | static void __kprobes resume_execution(struct kprobe *p, struct pt_regs *regs) |
465 | { | 485 | { |
466 | unsigned long bundle_addr = ((unsigned long) (&p->opcode.bundle)) & ~0xFULL; | 486 | unsigned long bundle_addr = ((unsigned long) (&p->opcode.bundle)) & ~0xFULL; |
467 | unsigned long resume_addr = (unsigned long)p->addr & ~0xFULL; | 487 | unsigned long resume_addr = (unsigned long)p->addr & ~0xFULL; |
@@ -528,13 +548,16 @@ turn_ss_off: | |||
528 | ia64_psr(regs)->ss = 0; | 548 | ia64_psr(regs)->ss = 0; |
529 | } | 549 | } |
530 | 550 | ||
531 | static void prepare_ss(struct kprobe *p, struct pt_regs *regs) | 551 | static void __kprobes prepare_ss(struct kprobe *p, struct pt_regs *regs) |
532 | { | 552 | { |
533 | unsigned long bundle_addr = (unsigned long) &p->opcode.bundle; | 553 | unsigned long bundle_addr = (unsigned long) &p->opcode.bundle; |
534 | unsigned long slot = (unsigned long)p->addr & 0xf; | 554 | unsigned long slot = (unsigned long)p->addr & 0xf; |
535 | 555 | ||
536 | /* Update instruction pointer (IIP) and slot number (IPSR.ri) */ | 556 | /* single step inline if break instruction */ |
537 | regs->cr_iip = bundle_addr & ~0xFULL; | 557 | if (p->ainsn.inst_flag == INST_FLAG_BREAK_INST) |
558 | regs->cr_iip = (unsigned long)p->addr & ~0xFULL; | ||
559 | else | ||
560 | regs->cr_iip = bundle_addr & ~0xFULL; | ||
538 | 561 | ||
539 | if (slot > 2) | 562 | if (slot > 2) |
540 | slot = 0; | 563 | slot = 0; |
@@ -545,7 +568,39 @@ static void prepare_ss(struct kprobe *p, struct pt_regs *regs) | |||
545 | ia64_psr(regs)->ss = 1; | 568 | ia64_psr(regs)->ss = 1; |
546 | } | 569 | } |
547 | 570 | ||
548 | static int pre_kprobes_handler(struct die_args *args) | 571 | static int __kprobes is_ia64_break_inst(struct pt_regs *regs) |
572 | { | ||
573 | unsigned int slot = ia64_psr(regs)->ri; | ||
574 | unsigned int template, major_opcode; | ||
575 | unsigned long kprobe_inst; | ||
576 | unsigned long *kprobe_addr = (unsigned long *)regs->cr_iip; | ||
577 | bundle_t bundle; | ||
578 | |||
579 | memcpy(&bundle, kprobe_addr, sizeof(bundle_t)); | ||
580 | template = bundle.quad0.template; | ||
581 | |||
582 | /* Move to slot 2, if bundle is MLX type and kprobe slot is 1 */ | ||
583 | if (slot == 1 && bundle_encoding[template][1] == L) | ||
584 | slot++; | ||
585 | |||
586 | /* Get Kprobe probe instruction at given slot*/ | ||
587 | get_kprobe_inst(&bundle, slot, &kprobe_inst, &major_opcode); | ||
588 | |||
589 | /* For break instruction, | ||
590 | * Bits 37:40 Major opcode to be zero | ||
591 | * Bits 27:32 X6 to be zero | ||
592 | * Bits 32:35 X3 to be zero | ||
593 | */ | ||
594 | if (major_opcode || ((kprobe_inst >> 27) & 0x1FF) ) { | ||
595 | /* Not a break instruction */ | ||
596 | return 0; | ||
597 | } | ||
598 | |||
599 | /* Is a break instruction */ | ||
600 | return 1; | ||
601 | } | ||
602 | |||
603 | static int __kprobes pre_kprobes_handler(struct die_args *args) | ||
549 | { | 604 | { |
550 | struct kprobe *p; | 605 | struct kprobe *p; |
551 | int ret = 0; | 606 | int ret = 0; |
@@ -558,7 +613,9 @@ static int pre_kprobes_handler(struct die_args *args) | |||
558 | if (kprobe_running()) { | 613 | if (kprobe_running()) { |
559 | p = get_kprobe(addr); | 614 | p = get_kprobe(addr); |
560 | if (p) { | 615 | if (p) { |
561 | if (kprobe_status == KPROBE_HIT_SS) { | 616 | if ( (kprobe_status == KPROBE_HIT_SS) && |
617 | (p->ainsn.inst_flag == INST_FLAG_BREAK_INST)) { | ||
618 | ia64_psr(regs)->ss = 0; | ||
562 | unlock_kprobes(); | 619 | unlock_kprobes(); |
563 | goto no_kprobe; | 620 | goto no_kprobe; |
564 | } | 621 | } |
@@ -592,6 +649,19 @@ static int pre_kprobes_handler(struct die_args *args) | |||
592 | p = get_kprobe(addr); | 649 | p = get_kprobe(addr); |
593 | if (!p) { | 650 | if (!p) { |
594 | unlock_kprobes(); | 651 | unlock_kprobes(); |
652 | if (!is_ia64_break_inst(regs)) { | ||
653 | /* | ||
654 | * The breakpoint instruction was removed right | ||
655 | * after we hit it. Another cpu has removed | ||
656 | * either a probepoint or a debugger breakpoint | ||
657 | * at this address. In either case, no further | ||
658 | * handling of this interrupt is appropriate. | ||
659 | */ | ||
660 | ret = 1; | ||
661 | |||
662 | } | ||
663 | |||
664 | /* Not one of our break, let kernel handle it */ | ||
595 | goto no_kprobe; | 665 | goto no_kprobe; |
596 | } | 666 | } |
597 | 667 | ||
@@ -616,7 +686,7 @@ no_kprobe: | |||
616 | return ret; | 686 | return ret; |
617 | } | 687 | } |
618 | 688 | ||
619 | static int post_kprobes_handler(struct pt_regs *regs) | 689 | static int __kprobes post_kprobes_handler(struct pt_regs *regs) |
620 | { | 690 | { |
621 | if (!kprobe_running()) | 691 | if (!kprobe_running()) |
622 | return 0; | 692 | return 0; |
@@ -641,7 +711,7 @@ out: | |||
641 | return 1; | 711 | return 1; |
642 | } | 712 | } |
643 | 713 | ||
644 | static int kprobes_fault_handler(struct pt_regs *regs, int trapnr) | 714 | static int __kprobes kprobes_fault_handler(struct pt_regs *regs, int trapnr) |
645 | { | 715 | { |
646 | if (!kprobe_running()) | 716 | if (!kprobe_running()) |
647 | return 0; | 717 | return 0; |
@@ -659,8 +729,8 @@ static int kprobes_fault_handler(struct pt_regs *regs, int trapnr) | |||
659 | return 0; | 729 | return 0; |
660 | } | 730 | } |
661 | 731 | ||
662 | int kprobe_exceptions_notify(struct notifier_block *self, unsigned long val, | 732 | int __kprobes kprobe_exceptions_notify(struct notifier_block *self, |
663 | void *data) | 733 | unsigned long val, void *data) |
664 | { | 734 | { |
665 | struct die_args *args = (struct die_args *)data; | 735 | struct die_args *args = (struct die_args *)data; |
666 | switch(val) { | 736 | switch(val) { |
@@ -681,7 +751,7 @@ int kprobe_exceptions_notify(struct notifier_block *self, unsigned long val, | |||
681 | return NOTIFY_DONE; | 751 | return NOTIFY_DONE; |
682 | } | 752 | } |
683 | 753 | ||
684 | int setjmp_pre_handler(struct kprobe *p, struct pt_regs *regs) | 754 | int __kprobes setjmp_pre_handler(struct kprobe *p, struct pt_regs *regs) |
685 | { | 755 | { |
686 | struct jprobe *jp = container_of(p, struct jprobe, kp); | 756 | struct jprobe *jp = container_of(p, struct jprobe, kp); |
687 | unsigned long addr = ((struct fnptr *)(jp->entry))->ip; | 757 | unsigned long addr = ((struct fnptr *)(jp->entry))->ip; |
@@ -703,7 +773,7 @@ int setjmp_pre_handler(struct kprobe *p, struct pt_regs *regs) | |||
703 | return 1; | 773 | return 1; |
704 | } | 774 | } |
705 | 775 | ||
706 | int longjmp_break_handler(struct kprobe *p, struct pt_regs *regs) | 776 | int __kprobes longjmp_break_handler(struct kprobe *p, struct pt_regs *regs) |
707 | { | 777 | { |
708 | *regs = jprobe_saved_regs; | 778 | *regs = jprobe_saved_regs; |
709 | return 1; | 779 | return 1; |
diff --git a/arch/ia64/kernel/sys_ia64.c b/arch/ia64/kernel/sys_ia64.c index 770fab37928e..f2dbcd1db0d4 100644 --- a/arch/ia64/kernel/sys_ia64.c +++ b/arch/ia64/kernel/sys_ia64.c | |||
@@ -35,7 +35,7 @@ arch_get_unmapped_area (struct file *filp, unsigned long addr, unsigned long len | |||
35 | return -ENOMEM; | 35 | return -ENOMEM; |
36 | 36 | ||
37 | #ifdef CONFIG_HUGETLB_PAGE | 37 | #ifdef CONFIG_HUGETLB_PAGE |
38 | if (REGION_NUMBER(addr) == REGION_HPAGE) | 38 | if (REGION_NUMBER(addr) == RGN_HPAGE) |
39 | addr = 0; | 39 | addr = 0; |
40 | #endif | 40 | #endif |
41 | if (!addr) | 41 | if (!addr) |
diff --git a/arch/ia64/kernel/traps.c b/arch/ia64/kernel/traps.c index 4440c8343fa4..f970359e7edf 100644 --- a/arch/ia64/kernel/traps.c +++ b/arch/ia64/kernel/traps.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/vt_kern.h> /* For unblank_screen() */ | 15 | #include <linux/vt_kern.h> /* For unblank_screen() */ |
16 | #include <linux/module.h> /* for EXPORT_SYMBOL */ | 16 | #include <linux/module.h> /* for EXPORT_SYMBOL */ |
17 | #include <linux/hardirq.h> | 17 | #include <linux/hardirq.h> |
18 | #include <linux/kprobes.h> | ||
18 | 19 | ||
19 | #include <asm/fpswa.h> | 20 | #include <asm/fpswa.h> |
20 | #include <asm/ia32.h> | 21 | #include <asm/ia32.h> |
@@ -122,7 +123,7 @@ die_if_kernel (char *str, struct pt_regs *regs, long err) | |||
122 | } | 123 | } |
123 | 124 | ||
124 | void | 125 | void |
125 | ia64_bad_break (unsigned long break_num, struct pt_regs *regs) | 126 | __kprobes ia64_bad_break (unsigned long break_num, struct pt_regs *regs) |
126 | { | 127 | { |
127 | siginfo_t siginfo; | 128 | siginfo_t siginfo; |
128 | int sig, code; | 129 | int sig, code; |
@@ -444,7 +445,7 @@ ia64_illegal_op_fault (unsigned long ec, long arg1, long arg2, long arg3, | |||
444 | return rv; | 445 | return rv; |
445 | } | 446 | } |
446 | 447 | ||
447 | void | 448 | void __kprobes |
448 | ia64_fault (unsigned long vector, unsigned long isr, unsigned long ifa, | 449 | ia64_fault (unsigned long vector, unsigned long isr, unsigned long ifa, |
449 | unsigned long iim, unsigned long itir, long arg5, long arg6, | 450 | unsigned long iim, unsigned long itir, long arg5, long arg6, |
450 | long arg7, struct pt_regs regs) | 451 | long arg7, struct pt_regs regs) |
diff --git a/arch/ia64/kernel/uncached.c b/arch/ia64/kernel/uncached.c index 490dfc9ab47f..4e9d06c48a8b 100644 --- a/arch/ia64/kernel/uncached.c +++ b/arch/ia64/kernel/uncached.c | |||
@@ -184,7 +184,7 @@ uncached_free_page(unsigned long maddr) | |||
184 | { | 184 | { |
185 | int node; | 185 | int node; |
186 | 186 | ||
187 | node = nasid_to_cnodeid(NASID_GET(maddr)); | 187 | node = paddr_to_nid(maddr - __IA64_UNCACHED_OFFSET); |
188 | 188 | ||
189 | dprintk(KERN_DEBUG "uncached_free_page(%lx) on node %i\n", maddr, node); | 189 | dprintk(KERN_DEBUG "uncached_free_page(%lx) on node %i\n", maddr, node); |
190 | 190 | ||
@@ -217,7 +217,7 @@ uncached_build_memmap(unsigned long start, unsigned long end, void *arg) | |||
217 | 217 | ||
218 | memset((char *)vstart, 0, length); | 218 | memset((char *)vstart, 0, length); |
219 | 219 | ||
220 | node = nasid_to_cnodeid(NASID_GET(start)); | 220 | node = paddr_to_nid(start); |
221 | 221 | ||
222 | for (; vstart < vend ; vstart += PAGE_SIZE) { | 222 | for (; vstart < vend ; vstart += PAGE_SIZE) { |
223 | dprintk(KERN_INFO "sticking %lx into the pool!\n", vstart); | 223 | dprintk(KERN_INFO "sticking %lx into the pool!\n", vstart); |
diff --git a/arch/ia64/kernel/vmlinux.lds.S b/arch/ia64/kernel/vmlinux.lds.S index a676e79e0681..30d8564e9603 100644 --- a/arch/ia64/kernel/vmlinux.lds.S +++ b/arch/ia64/kernel/vmlinux.lds.S | |||
@@ -48,6 +48,7 @@ SECTIONS | |||
48 | *(.text) | 48 | *(.text) |
49 | SCHED_TEXT | 49 | SCHED_TEXT |
50 | LOCK_TEXT | 50 | LOCK_TEXT |
51 | KPROBES_TEXT | ||
51 | *(.gnu.linkonce.t*) | 52 | *(.gnu.linkonce.t*) |
52 | } | 53 | } |
53 | .text2 : AT(ADDR(.text2) - LOAD_OFFSET) | 54 | .text2 : AT(ADDR(.text2) - LOAD_OFFSET) |