diff options
Diffstat (limited to 'arch/mips/kernel')
| -rw-r--r-- | arch/mips/kernel/process.c | 13 | ||||
| -rw-r--r-- | arch/mips/kernel/smp-up.c | 16 | ||||
| -rw-r--r-- | arch/mips/kernel/smp.c | 17 | ||||
| -rw-r--r-- | arch/mips/kernel/topology.c | 5 |
4 files changed, 45 insertions, 6 deletions
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-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 58f4679bbd43..bc7d9b05e2f4 100644 --- a/arch/mips/kernel/smp.c +++ b/arch/mips/kernel/smp.c | |||
| @@ -45,7 +45,7 @@ | |||
| 45 | #include <asm/mipsmtregs.h> | 45 | #include <asm/mipsmtregs.h> |
| 46 | #endif /* CONFIG_MIPS_MT_SMTC */ | 46 | #endif /* CONFIG_MIPS_MT_SMTC */ |
| 47 | 47 | ||
| 48 | static volatile cpumask_t cpu_callin_map; /* Bitmask of started secondaries */ | 48 | volatile cpumask_t cpu_callin_map; /* Bitmask of started secondaries */ |
| 49 | int __cpu_number_map[NR_CPUS]; /* Map physical to logical */ | 49 | int __cpu_number_map[NR_CPUS]; /* Map physical to logical */ |
| 50 | int __cpu_logical_map[NR_CPUS]; /* Map logical to physical */ | 50 | int __cpu_logical_map[NR_CPUS]; /* Map logical to physical */ |
| 51 | 51 | ||
| @@ -201,6 +201,8 @@ void __devinit smp_prepare_boot_cpu(void) | |||
| 201 | * 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 |
| 202 | * physical, not logical. | 202 | * physical, not logical. |
| 203 | */ | 203 | */ |
| 204 | static struct task_struct *cpu_idle_thread[NR_CPUS]; | ||
| 205 | |||
| 204 | int __cpuinit __cpu_up(unsigned int cpu) | 206 | int __cpuinit __cpu_up(unsigned int cpu) |
| 205 | { | 207 | { |
| 206 | struct task_struct *idle; | 208 | struct task_struct *idle; |
| @@ -210,9 +212,16 @@ int __cpuinit __cpu_up(unsigned int cpu) | |||
| 210 | * The following code is purely to make sure | 212 | * The following code is purely to make sure |
| 211 | * Linux can schedule processes on this slave. | 213 | * Linux can schedule processes on this slave. |
| 212 | */ | 214 | */ |
| 213 | idle = fork_idle(cpu); | 215 | if (!cpu_idle_thread[cpu]) { |
| 214 | if (IS_ERR(idle)) | 216 | idle = fork_idle(cpu); |
| 215 | 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 | } | ||
| 216 | 225 | ||
| 217 | mp_ops->boot_secondary(cpu, idle); | 226 | mp_ops->boot_secondary(cpu, idle); |
| 218 | 227 | ||
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); |
