diff options
Diffstat (limited to 'arch/mips')
50 files changed, 489 insertions, 23 deletions
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index b29f0280d712..8c4be1f301cf 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig | |||
@@ -601,6 +601,7 @@ config CAVIUM_OCTEON_SIMULATOR | |||
601 | select SYS_SUPPORTS_64BIT_KERNEL | 601 | select SYS_SUPPORTS_64BIT_KERNEL |
602 | select SYS_SUPPORTS_BIG_ENDIAN | 602 | select SYS_SUPPORTS_BIG_ENDIAN |
603 | select SYS_SUPPORTS_HIGHMEM | 603 | select SYS_SUPPORTS_HIGHMEM |
604 | select SYS_SUPPORTS_HOTPLUG_CPU | ||
604 | select SYS_HAS_CPU_CAVIUM_OCTEON | 605 | select SYS_HAS_CPU_CAVIUM_OCTEON |
605 | help | 606 | help |
606 | The Octeon simulator is software performance model of the Cavium | 607 | The Octeon simulator is software performance model of the Cavium |
@@ -615,6 +616,7 @@ config CAVIUM_OCTEON_REFERENCE_BOARD | |||
615 | select SYS_SUPPORTS_64BIT_KERNEL | 616 | select SYS_SUPPORTS_64BIT_KERNEL |
616 | select SYS_SUPPORTS_BIG_ENDIAN | 617 | select SYS_SUPPORTS_BIG_ENDIAN |
617 | select SYS_SUPPORTS_HIGHMEM | 618 | select SYS_SUPPORTS_HIGHMEM |
619 | select SYS_SUPPORTS_HOTPLUG_CPU | ||
618 | select SYS_HAS_EARLY_PRINTK | 620 | select SYS_HAS_EARLY_PRINTK |
619 | select SYS_HAS_CPU_CAVIUM_OCTEON | 621 | select SYS_HAS_CPU_CAVIUM_OCTEON |
620 | select SWAP_IO_SPACE | 622 | select SWAP_IO_SPACE |
@@ -784,8 +786,17 @@ config SYS_HAS_EARLY_PRINTK | |||
784 | bool | 786 | bool |
785 | 787 | ||
786 | config HOTPLUG_CPU | 788 | config HOTPLUG_CPU |
789 | bool "Support for hot-pluggable CPUs" | ||
790 | depends on SMP && HOTPLUG && SYS_SUPPORTS_HOTPLUG_CPU | ||
791 | help | ||
792 | Say Y here to allow turning CPUs off and on. CPUs can be | ||
793 | controlled through /sys/devices/system/cpu. | ||
794 | (Note: power management support will enable this option | ||
795 | automatically on SMP systems. ) | ||
796 | Say N if you want to disable CPU hotplug. | ||
797 | |||
798 | config SYS_SUPPORTS_HOTPLUG_CPU | ||
787 | bool | 799 | bool |
788 | default n | ||
789 | 800 | ||
790 | config I8259 | 801 | config I8259 |
791 | bool | 802 | bool |
@@ -2136,11 +2147,11 @@ menu "Power management options" | |||
2136 | 2147 | ||
2137 | config ARCH_HIBERNATION_POSSIBLE | 2148 | config ARCH_HIBERNATION_POSSIBLE |
2138 | def_bool y | 2149 | def_bool y |
2139 | depends on !SMP | 2150 | depends on SYS_SUPPORTS_HOTPLUG_CPU |
2140 | 2151 | ||
2141 | config ARCH_SUSPEND_POSSIBLE | 2152 | config ARCH_SUSPEND_POSSIBLE |
2142 | def_bool y | 2153 | def_bool y |
2143 | depends on !SMP | 2154 | depends on SYS_SUPPORTS_HOTPLUG_CPU |
2144 | 2155 | ||
2145 | source "kernel/power/Kconfig" | 2156 | source "kernel/power/Kconfig" |
2146 | 2157 | ||
diff --git a/arch/mips/cavium-octeon/octeon-irq.c b/arch/mips/cavium-octeon/octeon-irq.c index 8dfa009e0070..384f1842bfb1 100644 --- a/arch/mips/cavium-octeon/octeon-irq.c +++ b/arch/mips/cavium-octeon/octeon-irq.c | |||
@@ -7,7 +7,7 @@ | |||
7 | */ | 7 | */ |
8 | #include <linux/irq.h> | 8 | #include <linux/irq.h> |
9 | #include <linux/interrupt.h> | 9 | #include <linux/interrupt.h> |
10 | #include <linux/hardirq.h> | 10 | #include <linux/smp.h> |
11 | 11 | ||
12 | #include <asm/octeon/octeon.h> | 12 | #include <asm/octeon/octeon.h> |
13 | #include <asm/octeon/cvmx-pexp-defs.h> | 13 | #include <asm/octeon/cvmx-pexp-defs.h> |
@@ -501,3 +501,62 @@ asmlinkage void plat_irq_dispatch(void) | |||
501 | } | 501 | } |
502 | } | 502 | } |
503 | } | 503 | } |
504 | |||
505 | #ifdef CONFIG_HOTPLUG_CPU | ||
506 | static int is_irq_enabled_on_cpu(unsigned int irq, unsigned int cpu) | ||
507 | { | ||
508 | unsigned int isset; | ||
509 | #ifdef CONFIG_SMP | ||
510 | int coreid = cpu_logical_map(cpu); | ||
511 | #else | ||
512 | int coreid = cvmx_get_core_num(); | ||
513 | #endif | ||
514 | int bit = (irq < OCTEON_IRQ_WDOG0) ? | ||
515 | irq - OCTEON_IRQ_WORKQ0 : irq - OCTEON_IRQ_WDOG0; | ||
516 | if (irq < 64) { | ||
517 | isset = (cvmx_read_csr(CVMX_CIU_INTX_EN0(coreid * 2)) & | ||
518 | (1ull << bit)) >> bit; | ||
519 | } else { | ||
520 | isset = (cvmx_read_csr(CVMX_CIU_INTX_EN1(coreid * 2 + 1)) & | ||
521 | (1ull << bit)) >> bit; | ||
522 | } | ||
523 | return isset; | ||
524 | } | ||
525 | |||
526 | void fixup_irqs(void) | ||
527 | { | ||
528 | int irq; | ||
529 | |||
530 | for (irq = OCTEON_IRQ_SW0; irq <= OCTEON_IRQ_TIMER; irq++) | ||
531 | octeon_irq_core_disable_local(irq); | ||
532 | |||
533 | for (irq = OCTEON_IRQ_WORKQ0; irq <= OCTEON_IRQ_GPIO15; irq++) { | ||
534 | if (is_irq_enabled_on_cpu(irq, smp_processor_id())) { | ||
535 | /* ciu irq migrates to next cpu */ | ||
536 | octeon_irq_chip_ciu0.disable(irq); | ||
537 | octeon_irq_ciu0_set_affinity(irq, &cpu_online_map); | ||
538 | } | ||
539 | } | ||
540 | |||
541 | #if 0 | ||
542 | for (irq = OCTEON_IRQ_MBOX0; irq <= OCTEON_IRQ_MBOX1; irq++) | ||
543 | octeon_irq_mailbox_mask(irq); | ||
544 | #endif | ||
545 | for (irq = OCTEON_IRQ_UART0; irq <= OCTEON_IRQ_BOOTDMA; irq++) { | ||
546 | if (is_irq_enabled_on_cpu(irq, smp_processor_id())) { | ||
547 | /* ciu irq migrates to next cpu */ | ||
548 | octeon_irq_chip_ciu0.disable(irq); | ||
549 | octeon_irq_ciu0_set_affinity(irq, &cpu_online_map); | ||
550 | } | ||
551 | } | ||
552 | |||
553 | for (irq = OCTEON_IRQ_UART2; irq <= OCTEON_IRQ_RESERVED135; irq++) { | ||
554 | if (is_irq_enabled_on_cpu(irq, smp_processor_id())) { | ||
555 | /* ciu irq migrates to next cpu */ | ||
556 | octeon_irq_chip_ciu1.disable(irq); | ||
557 | octeon_irq_ciu1_set_affinity(irq, &cpu_online_map); | ||
558 | } | ||
559 | } | ||
560 | } | ||
561 | |||
562 | #endif /* CONFIG_HOTPLUG_CPU */ | ||
diff --git a/arch/mips/cavium-octeon/octeon_boot.h b/arch/mips/cavium-octeon/octeon_boot.h new file mode 100644 index 000000000000..0f7f84accf9a --- /dev/null +++ b/arch/mips/cavium-octeon/octeon_boot.h | |||
@@ -0,0 +1,70 @@ | |||
1 | /* | ||
2 | * (C) Copyright 2004, 2005 Cavium Networks | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or | ||
5 | * modify it under the terms of the GNU General Public License as | ||
6 | * published by the Free Software Foundation; either version 2 of | ||
7 | * the License, or (at your option) any later version. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License | ||
15 | * along with this program; if not, write to the Free Software | ||
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, | ||
17 | * MA 02111-1307 USA | ||
18 | */ | ||
19 | |||
20 | #ifndef __OCTEON_BOOT_H__ | ||
21 | #define __OCTEON_BOOT_H__ | ||
22 | |||
23 | #include <linux/types.h> | ||
24 | |||
25 | struct boot_init_vector { | ||
26 | uint32_t stack_addr; | ||
27 | uint32_t code_addr; | ||
28 | uint32_t app_start_func_addr; | ||
29 | uint32_t k0_val; | ||
30 | uint32_t flags; | ||
31 | uint32_t boot_info_addr; | ||
32 | uint32_t pad; | ||
33 | uint32_t pad2; | ||
34 | }; | ||
35 | |||
36 | /* similar to bootloader's linux_app_boot_info but without global data */ | ||
37 | struct linux_app_boot_info { | ||
38 | uint32_t labi_signature; | ||
39 | uint32_t start_core0_addr; | ||
40 | uint32_t avail_coremask; | ||
41 | uint32_t pci_console_active; | ||
42 | uint32_t icache_prefetch_disable; | ||
43 | uint32_t InitTLBStart_addr; | ||
44 | uint32_t start_app_addr; | ||
45 | uint32_t cur_exception_base; | ||
46 | uint32_t no_mark_private_data; | ||
47 | uint32_t compact_flash_common_base_addr; | ||
48 | uint32_t compact_flash_attribute_base_addr; | ||
49 | uint32_t led_display_base_addr; | ||
50 | }; | ||
51 | |||
52 | /* If not to copy a lot of bootloader's structures | ||
53 | here is only offset of requested member */ | ||
54 | #define AVAIL_COREMASK_OFFSET_IN_LINUX_APP_BOOT_BLOCK 0x765c | ||
55 | |||
56 | /* hardcoded in bootloader */ | ||
57 | #define LABI_ADDR_IN_BOOTLOADER 0x700 | ||
58 | |||
59 | #define LINUX_APP_BOOT_BLOCK_NAME "linux-app-boot" | ||
60 | |||
61 | #define LABI_SIGNATURE 0xAABBCCDD | ||
62 | |||
63 | /* from uboot-headers/octeon_mem_map.h */ | ||
64 | #define EXCEPTION_BASE_INCR (4 * 1024) | ||
65 | /* Increment size for exception base addresses (4k minimum) */ | ||
66 | #define EXCEPTION_BASE_BASE 0 | ||
67 | #define BOOTLOADER_PRIV_DATA_BASE (EXCEPTION_BASE_BASE + 0x800) | ||
68 | #define BOOTLOADER_BOOT_VECTOR (BOOTLOADER_PRIV_DATA_BASE) | ||
69 | |||
70 | #endif /* __OCTEON_BOOT_H__ */ | ||
diff --git a/arch/mips/cavium-octeon/setup.c b/arch/mips/cavium-octeon/setup.c index 5f4e49ba4713..da559249cc2f 100644 --- a/arch/mips/cavium-octeon/setup.c +++ b/arch/mips/cavium-octeon/setup.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/io.h> | 13 | #include <linux/io.h> |
14 | #include <linux/irq.h> | 14 | #include <linux/irq.h> |
15 | #include <linux/serial.h> | 15 | #include <linux/serial.h> |
16 | #include <linux/smp.h> | ||
16 | #include <linux/types.h> | 17 | #include <linux/types.h> |
17 | #include <linux/string.h> /* for memset */ | 18 | #include <linux/string.h> /* for memset */ |
18 | #include <linux/tty.h> | 19 | #include <linux/tty.h> |
diff --git a/arch/mips/cavium-octeon/smp.c b/arch/mips/cavium-octeon/smp.c index 24e0ad63980a..0b891a9c6253 100644 --- a/arch/mips/cavium-octeon/smp.c +++ b/arch/mips/cavium-octeon/smp.c | |||
@@ -5,6 +5,7 @@ | |||
5 | * | 5 | * |
6 | * Copyright (C) 2004-2008 Cavium Networks | 6 | * Copyright (C) 2004-2008 Cavium Networks |
7 | */ | 7 | */ |
8 | #include <linux/cpu.h> | ||
8 | #include <linux/init.h> | 9 | #include <linux/init.h> |
9 | #include <linux/delay.h> | 10 | #include <linux/delay.h> |
10 | #include <linux/smp.h> | 11 | #include <linux/smp.h> |
@@ -19,10 +20,16 @@ | |||
19 | 20 | ||
20 | #include <asm/octeon/octeon.h> | 21 | #include <asm/octeon/octeon.h> |
21 | 22 | ||
23 | #include "octeon_boot.h" | ||
24 | |||
22 | volatile unsigned long octeon_processor_boot = 0xff; | 25 | volatile unsigned long octeon_processor_boot = 0xff; |
23 | volatile unsigned long octeon_processor_sp; | 26 | volatile unsigned long octeon_processor_sp; |
24 | volatile unsigned long octeon_processor_gp; | 27 | volatile unsigned long octeon_processor_gp; |
25 | 28 | ||
29 | #ifdef CONFIG_HOTPLUG_CPU | ||
30 | static unsigned int InitTLBStart_addr; | ||
31 | #endif | ||
32 | |||
26 | static irqreturn_t mailbox_interrupt(int irq, void *dev_id) | 33 | static irqreturn_t mailbox_interrupt(int irq, void *dev_id) |
27 | { | 34 | { |
28 | const int coreid = cvmx_get_core_num(); | 35 | const int coreid = cvmx_get_core_num(); |
@@ -67,8 +74,28 @@ static inline void octeon_send_ipi_mask(cpumask_t mask, unsigned int action) | |||
67 | } | 74 | } |
68 | 75 | ||
69 | /** | 76 | /** |
70 | * Detect available CPUs, populate phys_cpu_present_map | 77 | * Detect available CPUs, populate cpu_possible_map |
71 | */ | 78 | */ |
79 | static void octeon_smp_hotplug_setup(void) | ||
80 | { | ||
81 | #ifdef CONFIG_HOTPLUG_CPU | ||
82 | uint32_t labi_signature; | ||
83 | |||
84 | labi_signature = | ||
85 | cvmx_read64_uint32(CVMX_ADD_SEG(CVMX_MIPS_SPACE_XKPHYS, | ||
86 | LABI_ADDR_IN_BOOTLOADER + | ||
87 | offsetof(struct linux_app_boot_info, | ||
88 | labi_signature))); | ||
89 | if (labi_signature != LABI_SIGNATURE) | ||
90 | pr_err("The bootloader version on this board is incorrect\n"); | ||
91 | InitTLBStart_addr = | ||
92 | cvmx_read64_uint32(CVMX_ADD_SEG(CVMX_MIPS_SPACE_XKPHYS, | ||
93 | LABI_ADDR_IN_BOOTLOADER + | ||
94 | offsetof(struct linux_app_boot_info, | ||
95 | InitTLBStart_addr))); | ||
96 | #endif | ||
97 | } | ||
98 | |||
72 | static void octeon_smp_setup(void) | 99 | static void octeon_smp_setup(void) |
73 | { | 100 | { |
74 | const int coreid = cvmx_get_core_num(); | 101 | const int coreid = cvmx_get_core_num(); |
@@ -91,6 +118,9 @@ static void octeon_smp_setup(void) | |||
91 | cpus++; | 118 | cpus++; |
92 | } | 119 | } |
93 | } | 120 | } |
121 | cpu_present_map = cpu_possible_map; | ||
122 | |||
123 | octeon_smp_hotplug_setup(); | ||
94 | } | 124 | } |
95 | 125 | ||
96 | /** | 126 | /** |
@@ -128,6 +158,17 @@ static void octeon_init_secondary(void) | |||
128 | const int coreid = cvmx_get_core_num(); | 158 | const int coreid = cvmx_get_core_num(); |
129 | union cvmx_ciu_intx_sum0 interrupt_enable; | 159 | union cvmx_ciu_intx_sum0 interrupt_enable; |
130 | 160 | ||
161 | #ifdef CONFIG_HOTPLUG_CPU | ||
162 | unsigned int cur_exception_base; | ||
163 | |||
164 | cur_exception_base = cvmx_read64_uint32( | ||
165 | CVMX_ADD_SEG(CVMX_MIPS_SPACE_XKPHYS, | ||
166 | LABI_ADDR_IN_BOOTLOADER + | ||
167 | offsetof(struct linux_app_boot_info, | ||
168 | cur_exception_base))); | ||
169 | /* cur_exception_base is incremented in bootloader after setting */ | ||
170 | write_c0_ebase((unsigned int)(cur_exception_base - EXCEPTION_BASE_INCR)); | ||
171 | #endif | ||
131 | octeon_check_cpu_bist(); | 172 | octeon_check_cpu_bist(); |
132 | octeon_init_cvmcount(); | 173 | octeon_init_cvmcount(); |
133 | /* | 174 | /* |
@@ -199,6 +240,193 @@ static void octeon_cpus_done(void) | |||
199 | #endif | 240 | #endif |
200 | } | 241 | } |
201 | 242 | ||
243 | #ifdef CONFIG_HOTPLUG_CPU | ||
244 | |||
245 | /* State of each CPU. */ | ||
246 | DEFINE_PER_CPU(int, cpu_state); | ||
247 | |||
248 | extern void fixup_irqs(void); | ||
249 | |||
250 | static DEFINE_SPINLOCK(smp_reserve_lock); | ||
251 | |||
252 | static int octeon_cpu_disable(void) | ||
253 | { | ||
254 | unsigned int cpu = smp_processor_id(); | ||
255 | |||
256 | if (cpu == 0) | ||
257 | return -EBUSY; | ||
258 | |||
259 | spin_lock(&smp_reserve_lock); | ||
260 | |||
261 | cpu_clear(cpu, cpu_online_map); | ||
262 | cpu_clear(cpu, cpu_callin_map); | ||
263 | local_irq_disable(); | ||
264 | fixup_irqs(); | ||
265 | local_irq_enable(); | ||
266 | |||
267 | flush_cache_all(); | ||
268 | local_flush_tlb_all(); | ||
269 | |||
270 | spin_unlock(&smp_reserve_lock); | ||
271 | |||
272 | return 0; | ||
273 | } | ||
274 | |||
275 | static void octeon_cpu_die(unsigned int cpu) | ||
276 | { | ||
277 | int coreid = cpu_logical_map(cpu); | ||
278 | uint32_t avail_coremask; | ||
279 | struct cvmx_bootmem_named_block_desc *block_desc; | ||
280 | |||
281 | #ifdef CONFIG_CAVIUM_OCTEON_WATCHDOG | ||
282 | /* Disable the watchdog */ | ||
283 | cvmx_ciu_wdogx_t ciu_wdog; | ||
284 | ciu_wdog.u64 = cvmx_read_csr(CVMX_CIU_WDOGX(cpu)); | ||
285 | ciu_wdog.s.mode = 0; | ||
286 | cvmx_write_csr(CVMX_CIU_WDOGX(cpu), ciu_wdog.u64); | ||
287 | #endif | ||
288 | |||
289 | while (per_cpu(cpu_state, cpu) != CPU_DEAD) | ||
290 | cpu_relax(); | ||
291 | |||
292 | /* | ||
293 | * This is a bit complicated strategics of getting/settig available | ||
294 | * cores mask, copied from bootloader | ||
295 | */ | ||
296 | /* LINUX_APP_BOOT_BLOCK is initialized in bootoct binary */ | ||
297 | block_desc = cvmx_bootmem_find_named_block(LINUX_APP_BOOT_BLOCK_NAME); | ||
298 | |||
299 | if (!block_desc) { | ||
300 | avail_coremask = | ||
301 | cvmx_read64_uint32(CVMX_ADD_SEG(CVMX_MIPS_SPACE_XKPHYS, | ||
302 | LABI_ADDR_IN_BOOTLOADER + | ||
303 | offsetof | ||
304 | (struct linux_app_boot_info, | ||
305 | avail_coremask))); | ||
306 | } else { /* alternative, already initialized */ | ||
307 | avail_coremask = | ||
308 | cvmx_read64_uint32(CVMX_ADD_SEG(CVMX_MIPS_SPACE_XKPHYS, | ||
309 | block_desc->base_addr + | ||
310 | AVAIL_COREMASK_OFFSET_IN_LINUX_APP_BOOT_BLOCK)); | ||
311 | } | ||
312 | |||
313 | avail_coremask |= 1 << coreid; | ||
314 | |||
315 | /* Setting avail_coremask for bootoct binary */ | ||
316 | if (!block_desc) { | ||
317 | cvmx_write64_uint32(CVMX_ADD_SEG(CVMX_MIPS_SPACE_XKPHYS, | ||
318 | LABI_ADDR_IN_BOOTLOADER + | ||
319 | offsetof(struct linux_app_boot_info, | ||
320 | avail_coremask)), | ||
321 | avail_coremask); | ||
322 | } else { | ||
323 | cvmx_write64_uint32(CVMX_ADD_SEG(CVMX_MIPS_SPACE_XKPHYS, | ||
324 | block_desc->base_addr + | ||
325 | AVAIL_COREMASK_OFFSET_IN_LINUX_APP_BOOT_BLOCK), | ||
326 | avail_coremask); | ||
327 | } | ||
328 | |||
329 | pr_info("Reset core %d. Available Coremask = %x \n", coreid, | ||
330 | avail_coremask); | ||
331 | cvmx_write_csr(CVMX_CIU_PP_RST, 1 << coreid); | ||
332 | cvmx_write_csr(CVMX_CIU_PP_RST, 0); | ||
333 | } | ||
334 | |||
335 | void play_dead(void) | ||
336 | { | ||
337 | int coreid = cvmx_get_core_num(); | ||
338 | |||
339 | idle_task_exit(); | ||
340 | octeon_processor_boot = 0xff; | ||
341 | per_cpu(cpu_state, coreid) = CPU_DEAD; | ||
342 | |||
343 | while (1) /* core will be reset here */ | ||
344 | ; | ||
345 | } | ||
346 | |||
347 | extern void kernel_entry(unsigned long arg1, ...); | ||
348 | |||
349 | static void start_after_reset(void) | ||
350 | { | ||
351 | kernel_entry(0, 0, 0); /* set a2 = 0 for secondary core */ | ||
352 | } | ||
353 | |||
354 | int octeon_update_boot_vector(unsigned int cpu) | ||
355 | { | ||
356 | |||
357 | int coreid = cpu_logical_map(cpu); | ||
358 | unsigned int avail_coremask; | ||
359 | struct cvmx_bootmem_named_block_desc *block_desc; | ||
360 | struct boot_init_vector *boot_vect = | ||
361 | (struct boot_init_vector *) cvmx_phys_to_ptr(0x0 + | ||
362 | BOOTLOADER_BOOT_VECTOR); | ||
363 | |||
364 | block_desc = cvmx_bootmem_find_named_block(LINUX_APP_BOOT_BLOCK_NAME); | ||
365 | |||
366 | if (!block_desc) { | ||
367 | avail_coremask = | ||
368 | cvmx_read64_uint32(CVMX_ADD_SEG(CVMX_MIPS_SPACE_XKPHYS, | ||
369 | LABI_ADDR_IN_BOOTLOADER + | ||
370 | offsetof(struct linux_app_boot_info, | ||
371 | avail_coremask))); | ||
372 | } else { /* alternative, already initialized */ | ||
373 | avail_coremask = | ||
374 | cvmx_read64_uint32(CVMX_ADD_SEG(CVMX_MIPS_SPACE_XKPHYS, | ||
375 | block_desc->base_addr + | ||
376 | AVAIL_COREMASK_OFFSET_IN_LINUX_APP_BOOT_BLOCK)); | ||
377 | } | ||
378 | |||
379 | if (!(avail_coremask & (1 << coreid))) { | ||
380 | /* core not available, assume, that catched by simple-executive */ | ||
381 | cvmx_write_csr(CVMX_CIU_PP_RST, 1 << coreid); | ||
382 | cvmx_write_csr(CVMX_CIU_PP_RST, 0); | ||
383 | } | ||
384 | |||
385 | boot_vect[coreid].app_start_func_addr = | ||
386 | (uint32_t) (unsigned long) start_after_reset; | ||
387 | boot_vect[coreid].code_addr = InitTLBStart_addr; | ||
388 | |||
389 | CVMX_SYNC; | ||
390 | |||
391 | cvmx_write_csr(CVMX_CIU_NMI, (1 << coreid) & avail_coremask); | ||
392 | |||
393 | return 0; | ||
394 | } | ||
395 | |||
396 | static int __cpuinit octeon_cpu_callback(struct notifier_block *nfb, | ||
397 | unsigned long action, void *hcpu) | ||
398 | { | ||
399 | unsigned int cpu = (unsigned long)hcpu; | ||
400 | |||
401 | switch (action) { | ||
402 | case CPU_UP_PREPARE: | ||
403 | octeon_update_boot_vector(cpu); | ||
404 | break; | ||
405 | case CPU_ONLINE: | ||
406 | pr_info("Cpu %d online\n", cpu); | ||
407 | break; | ||
408 | case CPU_DEAD: | ||
409 | break; | ||
410 | } | ||
411 | |||
412 | return NOTIFY_OK; | ||
413 | } | ||
414 | |||
415 | static struct notifier_block __cpuinitdata octeon_cpu_notifier = { | ||
416 | .notifier_call = octeon_cpu_callback, | ||
417 | }; | ||
418 | |||
419 | static int __cpuinit register_cavium_notifier(void) | ||
420 | { | ||
421 | register_hotcpu_notifier(&octeon_cpu_notifier); | ||
422 | |||
423 | return 0; | ||
424 | } | ||
425 | |||
426 | late_initcall(register_cavium_notifier); | ||
427 | |||
428 | #endif /* CONFIG_HOTPLUG_CPU */ | ||
429 | |||
202 | struct plat_smp_ops octeon_smp_ops = { | 430 | struct plat_smp_ops octeon_smp_ops = { |
203 | .send_ipi_single = octeon_send_ipi_single, | 431 | .send_ipi_single = octeon_send_ipi_single, |
204 | .send_ipi_mask = octeon_send_ipi_mask, | 432 | .send_ipi_mask = octeon_send_ipi_mask, |
@@ -208,4 +436,8 @@ struct plat_smp_ops octeon_smp_ops = { | |||
208 | .boot_secondary = octeon_boot_secondary, | 436 | .boot_secondary = octeon_boot_secondary, |
209 | .smp_setup = octeon_smp_setup, | 437 | .smp_setup = octeon_smp_setup, |
210 | .prepare_cpus = octeon_prepare_cpus, | 438 | .prepare_cpus = octeon_prepare_cpus, |
439 | #ifdef CONFIG_HOTPLUG_CPU | ||
440 | .cpu_disable = octeon_cpu_disable, | ||
441 | .cpu_die = octeon_cpu_die, | ||
442 | #endif | ||
211 | }; | 443 | }; |
diff --git a/arch/mips/include/asm/bug.h b/arch/mips/include/asm/bug.h index 08ea46863fe5..6cf29c26e873 100644 --- a/arch/mips/include/asm/bug.h +++ b/arch/mips/include/asm/bug.h | |||
@@ -1,6 +1,7 @@ | |||
1 | #ifndef __ASM_BUG_H | 1 | #ifndef __ASM_BUG_H |
2 | #define __ASM_BUG_H | 2 | #define __ASM_BUG_H |
3 | 3 | ||
4 | #include <linux/compiler.h> | ||
4 | #include <asm/sgidefs.h> | 5 | #include <asm/sgidefs.h> |
5 | 6 | ||
6 | #ifdef CONFIG_BUG | 7 | #ifdef CONFIG_BUG |
diff --git a/arch/mips/include/asm/bugs.h b/arch/mips/include/asm/bugs.h index 9dc10df32078..b160a706795d 100644 --- a/arch/mips/include/asm/bugs.h +++ b/arch/mips/include/asm/bugs.h | |||
@@ -11,6 +11,7 @@ | |||
11 | 11 | ||
12 | #include <linux/bug.h> | 12 | #include <linux/bug.h> |
13 | #include <linux/delay.h> | 13 | #include <linux/delay.h> |
14 | #include <linux/smp.h> | ||
14 | 15 | ||
15 | #include <asm/cpu.h> | 16 | #include <asm/cpu.h> |
16 | #include <asm/cpu-info.h> | 17 | #include <asm/cpu-info.h> |
diff --git a/arch/mips/include/asm/irq.h b/arch/mips/include/asm/irq.h index 4f1eed107b08..09b08d05ff72 100644 --- a/arch/mips/include/asm/irq.h +++ b/arch/mips/include/asm/irq.h | |||
@@ -10,6 +10,7 @@ | |||
10 | #define _ASM_IRQ_H | 10 | #define _ASM_IRQ_H |
11 | 11 | ||
12 | #include <linux/linkage.h> | 12 | #include <linux/linkage.h> |
13 | #include <linux/smp.h> | ||
13 | 14 | ||
14 | #include <asm/mipsmtregs.h> | 15 | #include <asm/mipsmtregs.h> |
15 | 16 | ||
diff --git a/arch/mips/include/asm/mmu_context.h b/arch/mips/include/asm/mmu_context.h index d7f3eb03ad12..d3bea88d8744 100644 --- a/arch/mips/include/asm/mmu_context.h +++ b/arch/mips/include/asm/mmu_context.h | |||
@@ -13,6 +13,7 @@ | |||
13 | 13 | ||
14 | #include <linux/errno.h> | 14 | #include <linux/errno.h> |
15 | #include <linux/sched.h> | 15 | #include <linux/sched.h> |
16 | #include <linux/smp.h> | ||
16 | #include <linux/slab.h> | 17 | #include <linux/slab.h> |
17 | #include <asm/cacheflush.h> | 18 | #include <asm/cacheflush.h> |
18 | #include <asm/tlbflush.h> | 19 | #include <asm/tlbflush.h> |
diff --git a/arch/mips/include/asm/smp-ops.h b/arch/mips/include/asm/smp-ops.h index 64ffc0290b84..fd545547b8aa 100644 --- a/arch/mips/include/asm/smp-ops.h +++ b/arch/mips/include/asm/smp-ops.h | |||
@@ -26,6 +26,10 @@ struct plat_smp_ops { | |||
26 | void (*boot_secondary)(int cpu, struct task_struct *idle); | 26 | void (*boot_secondary)(int cpu, struct task_struct *idle); |
27 | void (*smp_setup)(void); | 27 | void (*smp_setup)(void); |
28 | void (*prepare_cpus)(unsigned int max_cpus); | 28 | void (*prepare_cpus)(unsigned int max_cpus); |
29 | #ifdef CONFIG_HOTPLUG_CPU | ||
30 | int (*cpu_disable)(void); | ||
31 | void (*cpu_die)(unsigned int cpu); | ||
32 | #endif | ||
29 | }; | 33 | }; |
30 | 34 | ||
31 | extern void register_smp_ops(struct plat_smp_ops *ops); | 35 | extern void register_smp_ops(struct plat_smp_ops *ops); |
diff --git a/arch/mips/include/asm/smp.h b/arch/mips/include/asm/smp.h index 40e5ef1d4d26..aaa2d4ab26dc 100644 --- a/arch/mips/include/asm/smp.h +++ b/arch/mips/include/asm/smp.h | |||
@@ -13,6 +13,7 @@ | |||
13 | 13 | ||
14 | #include <linux/bitops.h> | 14 | #include <linux/bitops.h> |
15 | #include <linux/linkage.h> | 15 | #include <linux/linkage.h> |
16 | #include <linux/smp.h> | ||
16 | #include <linux/threads.h> | 17 | #include <linux/threads.h> |
17 | #include <linux/cpumask.h> | 18 | #include <linux/cpumask.h> |
18 | 19 | ||
@@ -40,6 +41,7 @@ extern int __cpu_logical_map[NR_CPUS]; | |||
40 | /* Octeon - Tell another core to flush its icache */ | 41 | /* Octeon - Tell another core to flush its icache */ |
41 | #define SMP_ICACHE_FLUSH 0x4 | 42 | #define SMP_ICACHE_FLUSH 0x4 |
42 | 43 | ||
44 | extern volatile cpumask_t cpu_callin_map; | ||
43 | 45 | ||
44 | extern void asmlinkage smp_bootstrap(void); | 46 | extern void asmlinkage smp_bootstrap(void); |
45 | 47 | ||
@@ -55,6 +57,24 @@ static inline void smp_send_reschedule(int cpu) | |||
55 | mp_ops->send_ipi_single(cpu, SMP_RESCHEDULE_YOURSELF); | 57 | mp_ops->send_ipi_single(cpu, SMP_RESCHEDULE_YOURSELF); |
56 | } | 58 | } |
57 | 59 | ||
60 | #ifdef CONFIG_HOTPLUG_CPU | ||
61 | static inline int __cpu_disable(void) | ||
62 | { | ||
63 | extern struct plat_smp_ops *mp_ops; /* private */ | ||
64 | |||
65 | return mp_ops->cpu_disable(); | ||
66 | } | ||
67 | |||
68 | static inline void __cpu_die(unsigned int cpu) | ||
69 | { | ||
70 | extern struct plat_smp_ops *mp_ops; /* private */ | ||
71 | |||
72 | mp_ops->cpu_die(cpu); | ||
73 | } | ||
74 | |||
75 | extern void play_dead(void); | ||
76 | #endif | ||
77 | |||
58 | extern asmlinkage void smp_call_function_interrupt(void); | 78 | extern asmlinkage void smp_call_function_interrupt(void); |
59 | 79 | ||
60 | extern void arch_send_call_function_single_ipi(int cpu); | 80 | extern void arch_send_call_function_single_ipi(int cpu); |
diff --git a/arch/mips/include/asm/sn/addrs.h b/arch/mips/include/asm/sn/addrs.h index 3a56d90abfa6..2367b56dcdef 100644 --- a/arch/mips/include/asm/sn/addrs.h +++ b/arch/mips/include/asm/sn/addrs.h | |||
@@ -11,6 +11,7 @@ | |||
11 | 11 | ||
12 | 12 | ||
13 | #ifndef __ASSEMBLY__ | 13 | #ifndef __ASSEMBLY__ |
14 | #include <linux/smp.h> | ||
14 | #include <linux/types.h> | 15 | #include <linux/types.h> |
15 | #endif /* !__ASSEMBLY__ */ | 16 | #endif /* !__ASSEMBLY__ */ |
16 | 17 | ||
diff --git a/arch/mips/jazz/irq.c b/arch/mips/jazz/irq.c index d9b6a5b5399d..7fd170d007e7 100644 --- a/arch/mips/jazz/irq.c +++ b/arch/mips/jazz/irq.c | |||
@@ -10,6 +10,7 @@ | |||
10 | #include <linux/init.h> | 10 | #include <linux/init.h> |
11 | #include <linux/interrupt.h> | 11 | #include <linux/interrupt.h> |
12 | #include <linux/kernel.h> | 12 | #include <linux/kernel.h> |
13 | #include <linux/smp.h> | ||
13 | #include <linux/spinlock.h> | 14 | #include <linux/spinlock.h> |
14 | 15 | ||
15 | #include <asm/irq_cpu.h> | 16 | #include <asm/irq_cpu.h> |
diff --git a/arch/mips/kernel/cevt-bcm1480.c b/arch/mips/kernel/cevt-bcm1480.c index a5182a207696..e02f79b1eb51 100644 --- a/arch/mips/kernel/cevt-bcm1480.c +++ b/arch/mips/kernel/cevt-bcm1480.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/clockchips.h> | 18 | #include <linux/clockchips.h> |
19 | #include <linux/interrupt.h> | 19 | #include <linux/interrupt.h> |
20 | #include <linux/percpu.h> | 20 | #include <linux/percpu.h> |
21 | #include <linux/smp.h> | ||
21 | 22 | ||
22 | #include <asm/addrspace.h> | 23 | #include <asm/addrspace.h> |
23 | #include <asm/io.h> | 24 | #include <asm/io.h> |
diff --git a/arch/mips/kernel/cevt-r4k.c b/arch/mips/kernel/cevt-r4k.c index 0015e442572b..2652362ce047 100644 --- a/arch/mips/kernel/cevt-r4k.c +++ b/arch/mips/kernel/cevt-r4k.c | |||
@@ -9,6 +9,7 @@ | |||
9 | #include <linux/clockchips.h> | 9 | #include <linux/clockchips.h> |
10 | #include <linux/interrupt.h> | 10 | #include <linux/interrupt.h> |
11 | #include <linux/percpu.h> | 11 | #include <linux/percpu.h> |
12 | #include <linux/smp.h> | ||
12 | 13 | ||
13 | #include <asm/smtc_ipi.h> | 14 | #include <asm/smtc_ipi.h> |
14 | #include <asm/time.h> | 15 | #include <asm/time.h> |
diff --git a/arch/mips/kernel/cevt-sb1250.c b/arch/mips/kernel/cevt-sb1250.c index 340f53e5c6b1..ac5903d1b20e 100644 --- a/arch/mips/kernel/cevt-sb1250.c +++ b/arch/mips/kernel/cevt-sb1250.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/clockchips.h> | 18 | #include <linux/clockchips.h> |
19 | #include <linux/interrupt.h> | 19 | #include <linux/interrupt.h> |
20 | #include <linux/percpu.h> | 20 | #include <linux/percpu.h> |
21 | #include <linux/smp.h> | ||
21 | 22 | ||
22 | #include <asm/addrspace.h> | 23 | #include <asm/addrspace.h> |
23 | #include <asm/io.h> | 24 | #include <asm/io.h> |
diff --git a/arch/mips/kernel/cevt-smtc.c b/arch/mips/kernel/cevt-smtc.c index df6f5bc60572..98bd7de75778 100644 --- a/arch/mips/kernel/cevt-smtc.c +++ b/arch/mips/kernel/cevt-smtc.c | |||
@@ -10,6 +10,7 @@ | |||
10 | #include <linux/clockchips.h> | 10 | #include <linux/clockchips.h> |
11 | #include <linux/interrupt.h> | 11 | #include <linux/interrupt.h> |
12 | #include <linux/percpu.h> | 12 | #include <linux/percpu.h> |
13 | #include <linux/smp.h> | ||
13 | 14 | ||
14 | #include <asm/smtc_ipi.h> | 15 | #include <asm/smtc_ipi.h> |
15 | #include <asm/time.h> | 16 | #include <asm/time.h> |
diff --git a/arch/mips/kernel/cpu-probe.c b/arch/mips/kernel/cpu-probe.c index b13b8eb30596..1abe9905c9c1 100644 --- a/arch/mips/kernel/cpu-probe.c +++ b/arch/mips/kernel/cpu-probe.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/init.h> | 14 | #include <linux/init.h> |
15 | #include <linux/kernel.h> | 15 | #include <linux/kernel.h> |
16 | #include <linux/ptrace.h> | 16 | #include <linux/ptrace.h> |
17 | #include <linux/smp.h> | ||
17 | #include <linux/stddef.h> | 18 | #include <linux/stddef.h> |
18 | 19 | ||
19 | #include <asm/bugs.h> | 20 | #include <asm/bugs.h> |
diff --git a/arch/mips/kernel/i8253.c b/arch/mips/kernel/i8253.c index ed20e7fe65e3..f7d8d5d0ddbf 100644 --- a/arch/mips/kernel/i8253.c +++ b/arch/mips/kernel/i8253.c | |||
@@ -7,6 +7,7 @@ | |||
7 | #include <linux/interrupt.h> | 7 | #include <linux/interrupt.h> |
8 | #include <linux/jiffies.h> | 8 | #include <linux/jiffies.h> |
9 | #include <linux/module.h> | 9 | #include <linux/module.h> |
10 | #include <linux/smp.h> | ||
10 | #include <linux/spinlock.h> | 11 | #include <linux/spinlock.h> |
11 | 12 | ||
12 | #include <asm/delay.h> | 13 | #include <asm/delay.h> |
diff --git a/arch/mips/kernel/irq-gic.c b/arch/mips/kernel/irq-gic.c index 3f43c2e3aa5a..39000f103f2c 100644 --- a/arch/mips/kernel/irq-gic.c +++ b/arch/mips/kernel/irq-gic.c | |||
@@ -2,6 +2,7 @@ | |||
2 | 2 | ||
3 | #include <linux/bitmap.h> | 3 | #include <linux/bitmap.h> |
4 | #include <linux/init.h> | 4 | #include <linux/init.h> |
5 | #include <linux/smp.h> | ||
5 | 6 | ||
6 | #include <asm/io.h> | 7 | #include <asm/io.h> |
7 | #include <asm/gic.h> | 8 | #include <asm/gic.h> |
diff --git a/arch/mips/kernel/kgdb.c b/arch/mips/kernel/kgdb.c index 6e152c80cd4a..50c9bb880667 100644 --- a/arch/mips/kernel/kgdb.c +++ b/arch/mips/kernel/kgdb.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/kgdb.h> | 26 | #include <linux/kgdb.h> |
27 | #include <linux/kdebug.h> | 27 | #include <linux/kdebug.h> |
28 | #include <linux/sched.h> | 28 | #include <linux/sched.h> |
29 | #include <linux/smp.h> | ||
29 | #include <asm/inst.h> | 30 | #include <asm/inst.h> |
30 | #include <asm/fpu.h> | 31 | #include <asm/fpu.h> |
31 | #include <asm/cacheflush.h> | 32 | #include <asm/cacheflush.h> |
diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c index 1eaaa450e20c..c09d681b7181 100644 --- a/arch/mips/kernel/process.c +++ b/arch/mips/kernel/process.c | |||
@@ -50,10 +50,15 @@ | |||
50 | */ | 50 | */ |
51 | void __noreturn cpu_idle(void) | 51 | void __noreturn cpu_idle(void) |
52 | { | 52 | { |
53 | int cpu; | ||
54 | |||
55 | /* CPU is going idle. */ | ||
56 | cpu = smp_processor_id(); | ||
57 | |||
53 | /* endless idle loop with no priority at all */ | 58 | /* endless idle loop with no priority at all */ |
54 | while (1) { | 59 | while (1) { |
55 | tick_nohz_stop_sched_tick(1); | 60 | tick_nohz_stop_sched_tick(1); |
56 | while (!need_resched()) { | 61 | while (!need_resched() && cpu_online(cpu)) { |
57 | #ifdef CONFIG_MIPS_MT_SMTC | 62 | #ifdef CONFIG_MIPS_MT_SMTC |
58 | extern void smtc_idle_loop_hook(void); | 63 | extern void smtc_idle_loop_hook(void); |
59 | 64 | ||
@@ -62,6 +67,12 @@ void __noreturn cpu_idle(void) | |||
62 | if (cpu_wait) | 67 | if (cpu_wait) |
63 | (*cpu_wait)(); | 68 | (*cpu_wait)(); |
64 | } | 69 | } |
70 | #ifdef CONFIG_HOTPLUG_CPU | ||
71 | if (!cpu_online(cpu) && !cpu_isset(cpu, cpu_callin_map) && | ||
72 | (system_state == SYSTEM_RUNNING || | ||
73 | system_state == SYSTEM_BOOTING)) | ||
74 | play_dead(); | ||
75 | #endif | ||
65 | tick_nohz_restart_sched_tick(); | 76 | tick_nohz_restart_sched_tick(); |
66 | preempt_enable_no_resched(); | 77 | preempt_enable_no_resched(); |
67 | schedule(); | 78 | schedule(); |
diff --git a/arch/mips/kernel/smp-cmp.c b/arch/mips/kernel/smp-cmp.c index f27beca4b26d..653be061b9ec 100644 --- a/arch/mips/kernel/smp-cmp.c +++ b/arch/mips/kernel/smp-cmp.c | |||
@@ -20,6 +20,7 @@ | |||
20 | 20 | ||
21 | #include <linux/kernel.h> | 21 | #include <linux/kernel.h> |
22 | #include <linux/sched.h> | 22 | #include <linux/sched.h> |
23 | #include <linux/smp.h> | ||
23 | #include <linux/cpumask.h> | 24 | #include <linux/cpumask.h> |
24 | #include <linux/interrupt.h> | 25 | #include <linux/interrupt.h> |
25 | #include <linux/compiler.h> | 26 | #include <linux/compiler.h> |
diff --git a/arch/mips/kernel/smp-up.c b/arch/mips/kernel/smp-up.c index 878e3733bbb2..2508d55d68fd 100644 --- a/arch/mips/kernel/smp-up.c +++ b/arch/mips/kernel/smp-up.c | |||
@@ -55,6 +55,18 @@ static void __init up_prepare_cpus(unsigned int max_cpus) | |||
55 | { | 55 | { |
56 | } | 56 | } |
57 | 57 | ||
58 | #ifdef CONFIG_HOTPLUG_CPU | ||
59 | static int up_cpu_disable(void) | ||
60 | { | ||
61 | return -ENOSYS; | ||
62 | } | ||
63 | |||
64 | static void up_cpu_die(unsigned int cpu) | ||
65 | { | ||
66 | BUG(); | ||
67 | } | ||
68 | #endif | ||
69 | |||
58 | struct plat_smp_ops up_smp_ops = { | 70 | struct plat_smp_ops up_smp_ops = { |
59 | .send_ipi_single = up_send_ipi_single, | 71 | .send_ipi_single = up_send_ipi_single, |
60 | .send_ipi_mask = up_send_ipi_mask, | 72 | .send_ipi_mask = up_send_ipi_mask, |
@@ -64,4 +76,8 @@ struct plat_smp_ops up_smp_ops = { | |||
64 | .boot_secondary = up_boot_secondary, | 76 | .boot_secondary = up_boot_secondary, |
65 | .smp_setup = up_smp_setup, | 77 | .smp_setup = up_smp_setup, |
66 | .prepare_cpus = up_prepare_cpus, | 78 | .prepare_cpus = up_prepare_cpus, |
79 | #ifdef CONFIG_HOTPLUG_CPU | ||
80 | .cpu_disable = up_cpu_disable, | ||
81 | .cpu_die = up_cpu_die, | ||
82 | #endif | ||
67 | }; | 83 | }; |
diff --git a/arch/mips/kernel/smp.c b/arch/mips/kernel/smp.c index c937506a03aa..bc7d9b05e2f4 100644 --- a/arch/mips/kernel/smp.c +++ b/arch/mips/kernel/smp.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/delay.h> | 22 | #include <linux/delay.h> |
23 | #include <linux/init.h> | 23 | #include <linux/init.h> |
24 | #include <linux/interrupt.h> | 24 | #include <linux/interrupt.h> |
25 | #include <linux/smp.h> | ||
25 | #include <linux/spinlock.h> | 26 | #include <linux/spinlock.h> |
26 | #include <linux/threads.h> | 27 | #include <linux/threads.h> |
27 | #include <linux/module.h> | 28 | #include <linux/module.h> |
@@ -44,7 +45,7 @@ | |||
44 | #include <asm/mipsmtregs.h> | 45 | #include <asm/mipsmtregs.h> |
45 | #endif /* CONFIG_MIPS_MT_SMTC */ | 46 | #endif /* CONFIG_MIPS_MT_SMTC */ |
46 | 47 | ||
47 | static volatile cpumask_t cpu_callin_map; /* Bitmask of started secondaries */ | 48 | volatile cpumask_t cpu_callin_map; /* Bitmask of started secondaries */ |
48 | int __cpu_number_map[NR_CPUS]; /* Map physical to logical */ | 49 | int __cpu_number_map[NR_CPUS]; /* Map physical to logical */ |
49 | int __cpu_logical_map[NR_CPUS]; /* Map logical to physical */ | 50 | int __cpu_logical_map[NR_CPUS]; /* Map logical to physical */ |
50 | 51 | ||
@@ -200,6 +201,8 @@ void __devinit smp_prepare_boot_cpu(void) | |||
200 | * and keep control until "cpu_online(cpu)" is set. Note: cpu is | 201 | * and keep control until "cpu_online(cpu)" is set. Note: cpu is |
201 | * physical, not logical. | 202 | * physical, not logical. |
202 | */ | 203 | */ |
204 | static struct task_struct *cpu_idle_thread[NR_CPUS]; | ||
205 | |||
203 | int __cpuinit __cpu_up(unsigned int cpu) | 206 | int __cpuinit __cpu_up(unsigned int cpu) |
204 | { | 207 | { |
205 | struct task_struct *idle; | 208 | struct task_struct *idle; |
@@ -209,9 +212,16 @@ int __cpuinit __cpu_up(unsigned int cpu) | |||
209 | * The following code is purely to make sure | 212 | * The following code is purely to make sure |
210 | * Linux can schedule processes on this slave. | 213 | * Linux can schedule processes on this slave. |
211 | */ | 214 | */ |
212 | idle = fork_idle(cpu); | 215 | if (!cpu_idle_thread[cpu]) { |
213 | if (IS_ERR(idle)) | 216 | idle = fork_idle(cpu); |
214 | panic(KERN_ERR "Fork failed for CPU %d", cpu); | 217 | cpu_idle_thread[cpu] = idle; |
218 | |||
219 | if (IS_ERR(idle)) | ||
220 | panic(KERN_ERR "Fork failed for CPU %d", cpu); | ||
221 | } else { | ||
222 | idle = cpu_idle_thread[cpu]; | ||
223 | init_idle(idle, cpu); | ||
224 | } | ||
215 | 225 | ||
216 | mp_ops->boot_secondary(cpu, idle); | 226 | mp_ops->boot_secondary(cpu, idle); |
217 | 227 | ||
diff --git a/arch/mips/kernel/smtc.c b/arch/mips/kernel/smtc.c index 37d51cd124e9..8a0626cbb108 100644 --- a/arch/mips/kernel/smtc.c +++ b/arch/mips/kernel/smtc.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <linux/clockchips.h> | 20 | #include <linux/clockchips.h> |
21 | #include <linux/kernel.h> | 21 | #include <linux/kernel.h> |
22 | #include <linux/sched.h> | 22 | #include <linux/sched.h> |
23 | #include <linux/smp.h> | ||
23 | #include <linux/cpumask.h> | 24 | #include <linux/cpumask.h> |
24 | #include <linux/interrupt.h> | 25 | #include <linux/interrupt.h> |
25 | #include <linux/kernel_stat.h> | 26 | #include <linux/kernel_stat.h> |
diff --git a/arch/mips/kernel/topology.c b/arch/mips/kernel/topology.c index 660e44ed44d7..cf3eb61fad12 100644 --- a/arch/mips/kernel/topology.c +++ b/arch/mips/kernel/topology.c | |||
@@ -17,7 +17,10 @@ static int __init topology_init(void) | |||
17 | #endif /* CONFIG_NUMA */ | 17 | #endif /* CONFIG_NUMA */ |
18 | 18 | ||
19 | for_each_present_cpu(i) { | 19 | for_each_present_cpu(i) { |
20 | ret = register_cpu(&per_cpu(cpu_devices, i), i); | 20 | struct cpu *c = &per_cpu(cpu_devices, i); |
21 | |||
22 | c->hotpluggable = 1; | ||
23 | ret = register_cpu(c, i); | ||
21 | if (ret) | 24 | if (ret) |
22 | printk(KERN_WARNING "topology_init: register_cpu %d " | 25 | printk(KERN_WARNING "topology_init: register_cpu %d " |
23 | "failed (%d)\n", i, ret); | 26 | "failed (%d)\n", i, ret); |
diff --git a/arch/mips/mipssim/sim_time.c b/arch/mips/mipssim/sim_time.c index 881ecbc1fa23..0cea932f1241 100644 --- a/arch/mips/mipssim/sim_time.c +++ b/arch/mips/mipssim/sim_time.c | |||
@@ -91,6 +91,7 @@ unsigned __cpuinit get_c0_compare_int(void) | |||
91 | mips_cpu_timer_irq = MSC01E_INT_BASE + MSC01E_INT_CPUCTR; | 91 | mips_cpu_timer_irq = MSC01E_INT_BASE + MSC01E_INT_CPUCTR; |
92 | } else { | 92 | } else { |
93 | #endif | 93 | #endif |
94 | { | ||
94 | if (cpu_has_vint) | 95 | if (cpu_has_vint) |
95 | set_vi_handler(cp0_compare_irq, mips_timer_dispatch); | 96 | set_vi_handler(cp0_compare_irq, mips_timer_dispatch); |
96 | mips_cpu_timer_irq = MIPS_CPU_IRQ_BASE + cp0_compare_irq; | 97 | mips_cpu_timer_irq = MIPS_CPU_IRQ_BASE + cp0_compare_irq; |
diff --git a/arch/mips/mm/c-octeon.c b/arch/mips/mm/c-octeon.c index 44d01a0a8490..b165cdcb2818 100644 --- a/arch/mips/mm/c-octeon.c +++ b/arch/mips/mm/c-octeon.c | |||
@@ -8,6 +8,7 @@ | |||
8 | #include <linux/init.h> | 8 | #include <linux/init.h> |
9 | #include <linux/kernel.h> | 9 | #include <linux/kernel.h> |
10 | #include <linux/sched.h> | 10 | #include <linux/sched.h> |
11 | #include <linux/smp.h> | ||
11 | #include <linux/mm.h> | 12 | #include <linux/mm.h> |
12 | #include <linux/bitops.h> | 13 | #include <linux/bitops.h> |
13 | #include <linux/cpu.h> | 14 | #include <linux/cpu.h> |
diff --git a/arch/mips/mm/c-r3k.c b/arch/mips/mm/c-r3k.c index 5500c20c79ae..54e5f7b9f440 100644 --- a/arch/mips/mm/c-r3k.c +++ b/arch/mips/mm/c-r3k.c | |||
@@ -12,6 +12,7 @@ | |||
12 | #include <linux/init.h> | 12 | #include <linux/init.h> |
13 | #include <linux/kernel.h> | 13 | #include <linux/kernel.h> |
14 | #include <linux/sched.h> | 14 | #include <linux/sched.h> |
15 | #include <linux/smp.h> | ||
15 | #include <linux/mm.h> | 16 | #include <linux/mm.h> |
16 | 17 | ||
17 | #include <asm/page.h> | 18 | #include <asm/page.h> |
diff --git a/arch/mips/mm/c-r4k.c b/arch/mips/mm/c-r4k.c index 71fe4cb778cd..6721ee2b1e8b 100644 --- a/arch/mips/mm/c-r4k.c +++ b/arch/mips/mm/c-r4k.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/kernel.h> | 13 | #include <linux/kernel.h> |
14 | #include <linux/linkage.h> | 14 | #include <linux/linkage.h> |
15 | #include <linux/sched.h> | 15 | #include <linux/sched.h> |
16 | #include <linux/smp.h> | ||
16 | #include <linux/mm.h> | 17 | #include <linux/mm.h> |
17 | #include <linux/module.h> | 18 | #include <linux/module.h> |
18 | #include <linux/bitops.h> | 19 | #include <linux/bitops.h> |
diff --git a/arch/mips/mm/c-tx39.c b/arch/mips/mm/c-tx39.c index f7c8f9ce39c1..6515b4418714 100644 --- a/arch/mips/mm/c-tx39.c +++ b/arch/mips/mm/c-tx39.c | |||
@@ -11,6 +11,7 @@ | |||
11 | #include <linux/init.h> | 11 | #include <linux/init.h> |
12 | #include <linux/kernel.h> | 12 | #include <linux/kernel.h> |
13 | #include <linux/sched.h> | 13 | #include <linux/sched.h> |
14 | #include <linux/smp.h> | ||
14 | #include <linux/mm.h> | 15 | #include <linux/mm.h> |
15 | 16 | ||
16 | #include <asm/cacheops.h> | 17 | #include <asm/cacheops.h> |
diff --git a/arch/mips/mm/highmem.c b/arch/mips/mm/highmem.c index 2b1309b2580a..e274fda329f4 100644 --- a/arch/mips/mm/highmem.c +++ b/arch/mips/mm/highmem.c | |||
@@ -1,5 +1,6 @@ | |||
1 | #include <linux/module.h> | 1 | #include <linux/module.h> |
2 | #include <linux/highmem.h> | 2 | #include <linux/highmem.h> |
3 | #include <linux/smp.h> | ||
3 | #include <asm/fixmap.h> | 4 | #include <asm/fixmap.h> |
4 | #include <asm/tlbflush.h> | 5 | #include <asm/tlbflush.h> |
5 | 6 | ||
diff --git a/arch/mips/mm/init.c b/arch/mips/mm/init.c index c5511294a9ee..0e820508ff23 100644 --- a/arch/mips/mm/init.c +++ b/arch/mips/mm/init.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/module.h> | 13 | #include <linux/module.h> |
14 | #include <linux/signal.h> | 14 | #include <linux/signal.h> |
15 | #include <linux/sched.h> | 15 | #include <linux/sched.h> |
16 | #include <linux/smp.h> | ||
16 | #include <linux/kernel.h> | 17 | #include <linux/kernel.h> |
17 | #include <linux/errno.h> | 18 | #include <linux/errno.h> |
18 | #include <linux/string.h> | 19 | #include <linux/string.h> |
diff --git a/arch/mips/mm/page.c b/arch/mips/mm/page.c index 48060c635acd..f5c73754d664 100644 --- a/arch/mips/mm/page.c +++ b/arch/mips/mm/page.c | |||
@@ -10,6 +10,7 @@ | |||
10 | #include <linux/init.h> | 10 | #include <linux/init.h> |
11 | #include <linux/kernel.h> | 11 | #include <linux/kernel.h> |
12 | #include <linux/sched.h> | 12 | #include <linux/sched.h> |
13 | #include <linux/smp.h> | ||
13 | #include <linux/mm.h> | 14 | #include <linux/mm.h> |
14 | #include <linux/module.h> | 15 | #include <linux/module.h> |
15 | #include <linux/proc_fs.h> | 16 | #include <linux/proc_fs.h> |
diff --git a/arch/mips/mm/tlb-r3k.c b/arch/mips/mm/tlb-r3k.c index 1c0048a6f5cf..0f5ab236ab69 100644 --- a/arch/mips/mm/tlb-r3k.c +++ b/arch/mips/mm/tlb-r3k.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/init.h> | 13 | #include <linux/init.h> |
14 | #include <linux/kernel.h> | 14 | #include <linux/kernel.h> |
15 | #include <linux/sched.h> | 15 | #include <linux/sched.h> |
16 | #include <linux/smp.h> | ||
16 | #include <linux/mm.h> | 17 | #include <linux/mm.h> |
17 | 18 | ||
18 | #include <asm/page.h> | 19 | #include <asm/page.h> |
diff --git a/arch/mips/mm/tlb-r4k.c b/arch/mips/mm/tlb-r4k.c index f60fe513eb60..cee502caf398 100644 --- a/arch/mips/mm/tlb-r4k.c +++ b/arch/mips/mm/tlb-r4k.c | |||
@@ -10,6 +10,7 @@ | |||
10 | */ | 10 | */ |
11 | #include <linux/init.h> | 11 | #include <linux/init.h> |
12 | #include <linux/sched.h> | 12 | #include <linux/sched.h> |
13 | #include <linux/smp.h> | ||
13 | #include <linux/mm.h> | 14 | #include <linux/mm.h> |
14 | #include <linux/hugetlb.h> | 15 | #include <linux/hugetlb.h> |
15 | 16 | ||
diff --git a/arch/mips/mm/tlb-r8k.c b/arch/mips/mm/tlb-r8k.c index 4ec95cc2df2f..2b82f23df1a1 100644 --- a/arch/mips/mm/tlb-r8k.c +++ b/arch/mips/mm/tlb-r8k.c | |||
@@ -10,6 +10,7 @@ | |||
10 | */ | 10 | */ |
11 | #include <linux/init.h> | 11 | #include <linux/init.h> |
12 | #include <linux/sched.h> | 12 | #include <linux/sched.h> |
13 | #include <linux/smp.h> | ||
13 | #include <linux/mm.h> | 14 | #include <linux/mm.h> |
14 | 15 | ||
15 | #include <asm/cpu.h> | 16 | #include <asm/cpu.h> |
diff --git a/arch/mips/mm/tlbex.c b/arch/mips/mm/tlbex.c index 8f606ead826e..9a17bf8395df 100644 --- a/arch/mips/mm/tlbex.c +++ b/arch/mips/mm/tlbex.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/bug.h> | 23 | #include <linux/bug.h> |
24 | #include <linux/kernel.h> | 24 | #include <linux/kernel.h> |
25 | #include <linux/types.h> | 25 | #include <linux/types.h> |
26 | #include <linux/smp.h> | ||
26 | #include <linux/string.h> | 27 | #include <linux/string.h> |
27 | #include <linux/init.h> | 28 | #include <linux/init.h> |
28 | 29 | ||
diff --git a/arch/mips/mti-malta/malta-int.c b/arch/mips/mti-malta/malta-int.c index ea176113fea9..b4eaf137e4a7 100644 --- a/arch/mips/mti-malta/malta-int.c +++ b/arch/mips/mti-malta/malta-int.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/init.h> | 24 | #include <linux/init.h> |
25 | #include <linux/irq.h> | 25 | #include <linux/irq.h> |
26 | #include <linux/sched.h> | 26 | #include <linux/sched.h> |
27 | #include <linux/smp.h> | ||
27 | #include <linux/slab.h> | 28 | #include <linux/slab.h> |
28 | #include <linux/interrupt.h> | 29 | #include <linux/interrupt.h> |
29 | #include <linux/io.h> | 30 | #include <linux/io.h> |
diff --git a/arch/mips/pci/pci-ip27.c b/arch/mips/pci/pci-ip27.c index dda6f2058665..a0e726eb039a 100644 --- a/arch/mips/pci/pci-ip27.c +++ b/arch/mips/pci/pci-ip27.c | |||
@@ -10,6 +10,7 @@ | |||
10 | #include <linux/init.h> | 10 | #include <linux/init.h> |
11 | #include <linux/kernel.h> | 11 | #include <linux/kernel.h> |
12 | #include <linux/pci.h> | 12 | #include <linux/pci.h> |
13 | #include <linux/smp.h> | ||
13 | #include <asm/sn/arch.h> | 14 | #include <asm/sn/arch.h> |
14 | #include <asm/pci/bridge.h> | 15 | #include <asm/pci/bridge.h> |
15 | #include <asm/paccess.h> | 16 | #include <asm/paccess.h> |
diff --git a/arch/mips/pmc-sierra/yosemite/smp.c b/arch/mips/pmc-sierra/yosemite/smp.c index f78c29b68d77..8ace27716232 100644 --- a/arch/mips/pmc-sierra/yosemite/smp.c +++ b/arch/mips/pmc-sierra/yosemite/smp.c | |||
@@ -1,5 +1,6 @@ | |||
1 | #include <linux/linkage.h> | 1 | #include <linux/linkage.h> |
2 | #include <linux/sched.h> | 2 | #include <linux/sched.h> |
3 | #include <linux/smp.h> | ||
3 | 4 | ||
4 | #include <asm/pmon.h> | 5 | #include <asm/pmon.h> |
5 | #include <asm/titan_dep.h> | 6 | #include <asm/titan_dep.h> |
diff --git a/arch/mips/power/hibernate.S b/arch/mips/power/hibernate.S index 486bd3fd01a1..4b8174b382d7 100644 --- a/arch/mips/power/hibernate.S +++ b/arch/mips/power/hibernate.S | |||
@@ -43,15 +43,6 @@ LEAF(swsusp_arch_resume) | |||
43 | bne t1, t3, 1b | 43 | bne t1, t3, 1b |
44 | PTR_L t0, PBE_NEXT(t0) | 44 | PTR_L t0, PBE_NEXT(t0) |
45 | bnez t0, 0b | 45 | bnez t0, 0b |
46 | /* flush caches to make sure context is in memory */ | ||
47 | PTR_L t0, __flush_cache_all | ||
48 | jalr t0 | ||
49 | /* flush tlb entries */ | ||
50 | #ifdef CONFIG_SMP | ||
51 | jal flush_tlb_all | ||
52 | #else | ||
53 | jal local_flush_tlb_all | ||
54 | #endif | ||
55 | PTR_LA t0, saved_regs | 46 | PTR_LA t0, saved_regs |
56 | PTR_L ra, PT_R31(t0) | 47 | PTR_L ra, PT_R31(t0) |
57 | PTR_L sp, PT_R29(t0) | 48 | PTR_L sp, PT_R29(t0) |
diff --git a/arch/mips/sgi-ip27/ip27-init.c b/arch/mips/sgi-ip27/ip27-init.c index 4a500e8cd3cc..51d3a4f2d7e1 100644 --- a/arch/mips/sgi-ip27/ip27-init.c +++ b/arch/mips/sgi-ip27/ip27-init.c | |||
@@ -9,6 +9,7 @@ | |||
9 | #include <linux/kernel.h> | 9 | #include <linux/kernel.h> |
10 | #include <linux/init.h> | 10 | #include <linux/init.h> |
11 | #include <linux/sched.h> | 11 | #include <linux/sched.h> |
12 | #include <linux/smp.h> | ||
12 | #include <linux/mm.h> | 13 | #include <linux/mm.h> |
13 | #include <linux/module.h> | 14 | #include <linux/module.h> |
14 | #include <linux/cpumask.h> | 15 | #include <linux/cpumask.h> |
diff --git a/arch/mips/sgi-ip27/ip27-irq.c b/arch/mips/sgi-ip27/ip27-irq.c index 1bb692a3b319..c1c8e40d65d6 100644 --- a/arch/mips/sgi-ip27/ip27-irq.c +++ b/arch/mips/sgi-ip27/ip27-irq.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/ioport.h> | 18 | #include <linux/ioport.h> |
19 | #include <linux/timex.h> | 19 | #include <linux/timex.h> |
20 | #include <linux/slab.h> | 20 | #include <linux/slab.h> |
21 | #include <linux/smp.h> | ||
21 | #include <linux/random.h> | 22 | #include <linux/random.h> |
22 | #include <linux/kernel.h> | 23 | #include <linux/kernel.h> |
23 | #include <linux/kernel_stat.h> | 24 | #include <linux/kernel_stat.h> |
diff --git a/arch/mips/sgi-ip27/ip27-timer.c b/arch/mips/sgi-ip27/ip27-timer.c index f10a7cd64f7e..6d0e59ffba2e 100644 --- a/arch/mips/sgi-ip27/ip27-timer.c +++ b/arch/mips/sgi-ip27/ip27-timer.c | |||
@@ -10,6 +10,7 @@ | |||
10 | #include <linux/interrupt.h> | 10 | #include <linux/interrupt.h> |
11 | #include <linux/kernel_stat.h> | 11 | #include <linux/kernel_stat.h> |
12 | #include <linux/param.h> | 12 | #include <linux/param.h> |
13 | #include <linux/smp.h> | ||
13 | #include <linux/time.h> | 14 | #include <linux/time.h> |
14 | #include <linux/timex.h> | 15 | #include <linux/timex.h> |
15 | #include <linux/mm.h> | 16 | #include <linux/mm.h> |
diff --git a/arch/mips/sgi-ip27/ip27-xtalk.c b/arch/mips/sgi-ip27/ip27-xtalk.c index 6ae64e8dfc40..5e871e75a8d9 100644 --- a/arch/mips/sgi-ip27/ip27-xtalk.c +++ b/arch/mips/sgi-ip27/ip27-xtalk.c | |||
@@ -9,6 +9,7 @@ | |||
9 | 9 | ||
10 | #include <linux/init.h> | 10 | #include <linux/init.h> |
11 | #include <linux/kernel.h> | 11 | #include <linux/kernel.h> |
12 | #include <linux/smp.h> | ||
12 | #include <asm/sn/types.h> | 13 | #include <asm/sn/types.h> |
13 | #include <asm/sn/klconfig.h> | 14 | #include <asm/sn/klconfig.h> |
14 | #include <asm/sn/hub.h> | 15 | #include <asm/sn/hub.h> |
diff --git a/arch/mips/sibyte/bcm1480/irq.c b/arch/mips/sibyte/bcm1480/irq.c index 690de06bde90..ba59839a021e 100644 --- a/arch/mips/sibyte/bcm1480/irq.c +++ b/arch/mips/sibyte/bcm1480/irq.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/init.h> | 19 | #include <linux/init.h> |
20 | #include <linux/linkage.h> | 20 | #include <linux/linkage.h> |
21 | #include <linux/interrupt.h> | 21 | #include <linux/interrupt.h> |
22 | #include <linux/smp.h> | ||
22 | #include <linux/spinlock.h> | 23 | #include <linux/spinlock.h> |
23 | #include <linux/mm.h> | 24 | #include <linux/mm.h> |
24 | #include <linux/slab.h> | 25 | #include <linux/slab.h> |
diff --git a/arch/mips/sibyte/common/cfe_console.c b/arch/mips/sibyte/common/cfe_console.c index 81e3d54376e9..1ad2da103fe9 100644 --- a/arch/mips/sibyte/common/cfe_console.c +++ b/arch/mips/sibyte/common/cfe_console.c | |||
@@ -51,12 +51,13 @@ static int cfe_console_setup(struct console *cons, char *str) | |||
51 | setleds("u0cn"); | 51 | setleds("u0cn"); |
52 | } else if (!strcmp(consdev, "uart1")) { | 52 | } else if (!strcmp(consdev, "uart1")) { |
53 | setleds("u1cn"); | 53 | setleds("u1cn"); |
54 | } else | ||
54 | #endif | 55 | #endif |
55 | #ifdef CONFIG_VGA_CONSOLE | 56 | #ifdef CONFIG_VGA_CONSOLE |
56 | } else if (!strcmp(consdev, "pcconsole0")) { | 57 | if (!strcmp(consdev, "pcconsole0")) { |
57 | setleds("pccn"); | 58 | setleds("pccn"); |
58 | #endif | ||
59 | } else | 59 | } else |
60 | #endif | ||
60 | return -ENODEV; | 61 | return -ENODEV; |
61 | } | 62 | } |
62 | return 0; | 63 | return 0; |
diff --git a/arch/mips/sni/time.c b/arch/mips/sni/time.c index 69f5f88711cc..0d9ec1a5c24a 100644 --- a/arch/mips/sni/time.c +++ b/arch/mips/sni/time.c | |||
@@ -1,5 +1,6 @@ | |||
1 | #include <linux/types.h> | 1 | #include <linux/types.h> |
2 | #include <linux/interrupt.h> | 2 | #include <linux/interrupt.h> |
3 | #include <linux/smp.h> | ||
3 | #include <linux/time.h> | 4 | #include <linux/time.h> |
4 | #include <linux/clockchips.h> | 5 | #include <linux/clockchips.h> |
5 | 6 | ||