Lines Matching full:cpu

20 #include <linux/cpu.h>
35 #include <asm/cpu.h>
87 static void ipi_setup(int cpu);
109 static int secondary_biglittle_prepare(unsigned int cpu) in secondary_biglittle_prepare() argument
111 if (!cpu_vtable[cpu]) in secondary_biglittle_prepare()
112 cpu_vtable[cpu] = kzalloc(sizeof(*cpu_vtable[cpu]), GFP_KERNEL); in secondary_biglittle_prepare()
114 return cpu_vtable[cpu] ? 0 : -ENOMEM; in secondary_biglittle_prepare()
122 static int secondary_biglittle_prepare(unsigned int cpu) in secondary_biglittle_prepare() argument
132 int __cpu_up(unsigned int cpu, struct task_struct *idle) in __cpu_up() argument
139 ret = secondary_biglittle_prepare(cpu); in __cpu_up()
159 * Now bring the CPU into our world. in __cpu_up()
161 ret = smp_ops.smp_boot_secondary(cpu, idle); in __cpu_up()
164 * CPU was successfully started, wait for it in __cpu_up()
170 if (!cpu_online(cpu)) { in __cpu_up()
171 pr_crit("CPU%u: failed to come online\n", cpu); in __cpu_up()
175 pr_err("CPU%u: failed to boot: %d\n", cpu, ret); in __cpu_up()
206 static int platform_cpu_kill(unsigned int cpu) in platform_cpu_kill() argument
209 return smp_ops.cpu_kill(cpu); in platform_cpu_kill()
213 static int platform_cpu_disable(unsigned int cpu) in platform_cpu_disable() argument
216 return smp_ops.cpu_disable(cpu); in platform_cpu_disable()
221 int platform_can_hotplug_cpu(unsigned int cpu) in platform_can_hotplug_cpu() argument
228 return smp_ops.cpu_can_disable(cpu); in platform_can_hotplug_cpu()
235 return cpu != 0; in platform_can_hotplug_cpu()
238 static void ipi_teardown(int cpu) in ipi_teardown() argument
254 unsigned int cpu = smp_processor_id(); in __cpu_disable() local
257 ret = platform_cpu_disable(cpu); in __cpu_disable()
262 remove_cpu_topology(cpu); in __cpu_disable()
266 * Take this CPU offline. Once we clear this, we can't return, in __cpu_disable()
267 * and we must not schedule until we're ready to give up the cpu. in __cpu_disable()
269 set_cpu_online(cpu, false); in __cpu_disable()
270 ipi_teardown(cpu); in __cpu_disable()
273 * OK - migrate IRQs away from this CPU in __cpu_disable()
278 * Flush user cache and TLB mappings, and then remove this CPU in __cpu_disable()
291 * called on the thread which is asking for a CPU to be shutdown -
294 void __cpu_die(unsigned int cpu) in __cpu_die() argument
296 if (!cpu_wait_death(cpu, 5)) { in __cpu_die()
297 pr_err("CPU%u: cpu didn't die\n", cpu); in __cpu_die()
300 pr_debug("CPU%u: shutdown\n", cpu); in __cpu_die()
302 clear_tasks_mm_cpumask(cpu); in __cpu_die()
305 * and/or cutting of clocks to the dying CPU. Optionally, this may in __cpu_die()
306 * be done by the CPU which is dying in preference to supporting in __cpu_die()
308 * the requesting CPU and the dying CPU actually losing power. in __cpu_die()
310 if (!platform_cpu_kill(cpu)) in __cpu_die()
311 pr_err("CPU%u: unable to kill\n", cpu); in __cpu_die()
315 * Called from the idle thread for the CPU which has been shutdown.
319 * of the other hotplug-cpu capable cores, so presumably coming
324 unsigned int cpu = smp_processor_id(); in arch_cpu_idle_dead() local
331 * Flush the data out of the L1 cache for this CPU. This must be in arch_cpu_idle_dead()
334 * *this* CPU and power down its cache. in arch_cpu_idle_dead()
339 * Tell __cpu_die() that this CPU is now safe to dispose of. Once in arch_cpu_idle_dead()
341 * from this CPU and its cache by platform_cpu_kill(). in arch_cpu_idle_dead()
347 * written out. This covers the case where _this_ CPU is doing the in arch_cpu_idle_dead()
349 * CPU waiting for this one. in arch_cpu_idle_dead()
354 * The actual CPU shutdown procedure is at least platform (if not in arch_cpu_idle_dead()
355 * CPU) specific. This may remove power, or it may simply spin. in arch_cpu_idle_dead()
359 * power down the CPU. These platforms are the _only_ reason we in arch_cpu_idle_dead()
363 * power off the CPU. in arch_cpu_idle_dead()
366 smp_ops.cpu_die(cpu); in arch_cpu_idle_dead()
368 pr_warn("CPU%u: smp_ops.cpu_die() returned, trying to resuscitate\n", in arch_cpu_idle_dead()
369 cpu); in arch_cpu_idle_dead()
373 * cpu initialisation. There's some initialisation which needs in arch_cpu_idle_dead()
374 * to be repeated to undo the effects of taking the CPU offline. in arch_cpu_idle_dead()
400 * This is the secondary CPU boot entry. We're using this CPUs
406 unsigned int cpu; in secondary_start_kernel() local
423 cpu = smp_processor_id(); in secondary_start_kernel()
426 cpumask_set_cpu(cpu, mm_cpumask(mm)); in secondary_start_kernel()
433 pr_debug("CPU%u: Booted secondary processor\n", cpu); in secondary_start_kernel()
442 smp_ops.smp_secondary_init(cpu); in secondary_start_kernel()
444 notify_cpu_starting(cpu); in secondary_start_kernel()
446 ipi_setup(cpu); in secondary_start_kernel()
450 smp_store_cpu_info(cpu); in secondary_start_kernel()
453 * OK, now it's safe to let the boot CPU continue. Wait for in secondary_start_kernel()
454 * the CPU migration code to notice that the CPU is online in secondary_start_kernel()
457 set_cpu_online(cpu, true); in secondary_start_kernel()
475 int cpu; in smp_cpus_done() local
478 for_each_online_cpu(cpu) in smp_cpus_done()
479 bogosum += per_cpu(cpu_data, cpu).loops_per_jiffy; in smp_cpus_done()
518 * Initialise the SCU if there are more than one CPU in smp_prepare_cpus()
528 S(IPI_WAKEUP, "CPU wakeup interrupts"),
532 S(IPI_CPU_STOP, "CPU stop interrupts"),
541 unsigned int cpu, i; in show_ipi_list() local
552 for_each_online_cpu(cpu) in show_ipi_list()
553 seq_printf(p, "%10u ", kstat_irqs_cpu(irq, cpu)); in show_ipi_list()
569 void arch_send_call_function_single_ipi(int cpu) in arch_send_call_function_single_ipi() argument
571 smp_cross_call(cpumask_of(cpu), IPI_CALL_FUNC); in arch_send_call_function_single_ipi()
594 static void ipi_cpu_stop(unsigned int cpu) in ipi_cpu_stop() argument
598 pr_crit("CPU%u: stopping\n", cpu); in ipi_cpu_stop()
603 set_cpu_online(cpu, false); in ipi_cpu_stop()
616 int register_ipi_completion(struct completion *completion, int cpu) in register_ipi_completion() argument
618 per_cpu(cpu_completion, cpu) = completion; in register_ipi_completion()
622 static void ipi_complete(unsigned int cpu) in ipi_complete() argument
624 complete(per_cpu(cpu_completion, cpu)); in ipi_complete()
637 unsigned int cpu = smp_processor_id(); in do_handle_IPI() local
661 ipi_cpu_stop(cpu); in do_handle_IPI()
671 ipi_complete(cpu); in do_handle_IPI()
681 pr_crit("CPU%u: Unknown IPI message 0x%x\n", in do_handle_IPI()
682 cpu, ipinr); in do_handle_IPI()
714 static void ipi_setup(int cpu) in ipi_setup() argument
745 /* Setup the boot CPU immediately */ in set_smp_ipi_range()
749 void smp_send_reschedule(int cpu) in smp_send_reschedule() argument
751 smp_cross_call(cpumask_of(cpu), IPI_RESCHEDULE); in smp_send_reschedule()
774 * and CPU 1 calls panic_smp_self_stop() before crash_smp_send_stop()
781 pr_debug("CPU %u will stop doing anything useful since another CPU has paniced\n", in panic_smp_self_stop()
808 int cpu, first = cpumask_first(cpus); in cpufreq_callback() local
815 for_each_cpu(cpu, cpus) { in cpufreq_callback()
816 per_cpu(l_p_j_ref, cpu) = in cpufreq_callback()
817 per_cpu(cpu_data, cpu).loops_per_jiffy; in cpufreq_callback()
818 per_cpu(l_p_j_ref_freq, cpu) = freq->old; in cpufreq_callback()
835 for_each_cpu(cpu, cpus) in cpufreq_callback()
836 per_cpu(cpu_data, cpu).loops_per_jiffy = lpj; in cpufreq_callback()