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()
160 * Now bring the CPU into our world. in __cpu_up()
162 ret = smp_ops.smp_boot_secondary(cpu, idle); in __cpu_up()
165 * CPU was successfully started, wait for it in __cpu_up()
171 if (!cpu_online(cpu)) { in __cpu_up()
172 pr_crit("CPU%u: failed to come online\n", cpu); in __cpu_up()
176 pr_err("CPU%u: failed to boot: %d\n", cpu, ret); in __cpu_up()
207 static int platform_cpu_kill(unsigned int cpu) in platform_cpu_kill() argument
210 return smp_ops.cpu_kill(cpu); in platform_cpu_kill()
214 static int platform_cpu_disable(unsigned int cpu) in platform_cpu_disable() argument
217 return smp_ops.cpu_disable(cpu); in platform_cpu_disable()
222 int platform_can_hotplug_cpu(unsigned int cpu) in platform_can_hotplug_cpu() argument
229 return smp_ops.cpu_can_disable(cpu); in platform_can_hotplug_cpu()
236 return cpu != 0; in platform_can_hotplug_cpu()
239 static void ipi_teardown(int cpu) in ipi_teardown() argument
255 unsigned int cpu = smp_processor_id(); in __cpu_disable() local
258 ret = platform_cpu_disable(cpu); in __cpu_disable()
263 remove_cpu_topology(cpu); in __cpu_disable()
267 * Take this CPU offline. Once we clear this, we can't return, in __cpu_disable()
268 * and we must not schedule until we're ready to give up the cpu. in __cpu_disable()
270 set_cpu_online(cpu, false); in __cpu_disable()
271 ipi_teardown(cpu); in __cpu_disable()
274 * OK - migrate IRQs away from this CPU in __cpu_disable()
279 * Flush user cache and TLB mappings, and then remove this CPU in __cpu_disable()
292 * called on the thread which is asking for a CPU to be shutdown -
295 void __cpu_die(unsigned int cpu) in __cpu_die() argument
297 if (!cpu_wait_death(cpu, 5)) { in __cpu_die()
298 pr_err("CPU%u: cpu didn't die\n", cpu); in __cpu_die()
301 pr_debug("CPU%u: shutdown\n", cpu); in __cpu_die()
303 clear_tasks_mm_cpumask(cpu); in __cpu_die()
306 * and/or cutting of clocks to the dying CPU. Optionally, this may in __cpu_die()
307 * be done by the CPU which is dying in preference to supporting in __cpu_die()
309 * the requesting CPU and the dying CPU actually losing power. in __cpu_die()
311 if (!platform_cpu_kill(cpu)) in __cpu_die()
312 pr_err("CPU%u: unable to kill\n", cpu); in __cpu_die()
316 * Called from the idle thread for the CPU which has been shutdown.
320 * of the other hotplug-cpu capable cores, so presumably coming
325 unsigned int cpu = smp_processor_id(); in arch_cpu_idle_dead() local
332 * Flush the data out of the L1 cache for this CPU. This must be in arch_cpu_idle_dead()
335 * *this* CPU and power down its cache. in arch_cpu_idle_dead()
340 * Tell __cpu_die() that this CPU is now safe to dispose of. Once in arch_cpu_idle_dead()
342 * from this CPU and its cache by platform_cpu_kill(). in arch_cpu_idle_dead()
348 * written out. This covers the case where _this_ CPU is doing the in arch_cpu_idle_dead()
350 * CPU waiting for this one. in arch_cpu_idle_dead()
355 * The actual CPU shutdown procedure is at least platform (if not in arch_cpu_idle_dead()
356 * CPU) specific. This may remove power, or it may simply spin. in arch_cpu_idle_dead()
360 * power down the CPU. These platforms are the _only_ reason we in arch_cpu_idle_dead()
364 * power off the CPU. in arch_cpu_idle_dead()
367 smp_ops.cpu_die(cpu); in arch_cpu_idle_dead()
369 pr_warn("CPU%u: smp_ops.cpu_die() returned, trying to resuscitate\n", in arch_cpu_idle_dead()
370 cpu); in arch_cpu_idle_dead()
374 * cpu initialisation. There's some initialisation which needs in arch_cpu_idle_dead()
375 * to be repeated to undo the effects of taking the CPU offline. in arch_cpu_idle_dead()
410 * This is the secondary CPU boot entry. We're using this CPUs
416 unsigned int cpu; in secondary_start_kernel() local
435 cpu = smp_processor_id(); in secondary_start_kernel()
438 cpumask_set_cpu(cpu, mm_cpumask(mm)); in secondary_start_kernel()
445 pr_debug("CPU%u: Booted secondary processor\n", cpu); in secondary_start_kernel()
453 smp_ops.smp_secondary_init(cpu); in secondary_start_kernel()
455 notify_cpu_starting(cpu); in secondary_start_kernel()
457 ipi_setup(cpu); in secondary_start_kernel()
461 smp_store_cpu_info(cpu); in secondary_start_kernel()
464 * OK, now it's safe to let the boot CPU continue. Wait for in secondary_start_kernel()
465 * the CPU migration code to notice that the CPU is online in secondary_start_kernel()
468 set_cpu_online(cpu, true); in secondary_start_kernel()
486 int cpu; in smp_cpus_done() local
489 for_each_online_cpu(cpu) in smp_cpus_done()
490 bogosum += per_cpu(cpu_data, cpu).loops_per_jiffy; in smp_cpus_done()
529 * Initialise the SCU if there are more than one CPU in smp_prepare_cpus()
538 [IPI_WAKEUP] = "CPU wakeup interrupts",
542 [IPI_CPU_STOP] = "CPU stop interrupts",
551 unsigned int cpu, i; in show_ipi_list() local
559 for_each_online_cpu(cpu) in show_ipi_list()
560 seq_printf(p, "%10u ", irq_desc_kstat_cpu(ipi_desc[i], cpu)); in show_ipi_list()
576 void arch_send_call_function_single_ipi(int cpu) in arch_send_call_function_single_ipi() argument
578 smp_cross_call(cpumask_of(cpu), IPI_CALL_FUNC); in arch_send_call_function_single_ipi()
601 static void ipi_cpu_stop(unsigned int cpu) in ipi_cpu_stop() argument
605 pr_crit("CPU%u: stopping\n", cpu); in ipi_cpu_stop()
610 set_cpu_online(cpu, false); in ipi_cpu_stop()
623 int register_ipi_completion(struct completion *completion, int cpu) in register_ipi_completion() argument
625 per_cpu(cpu_completion, cpu) = completion; in register_ipi_completion()
629 static void ipi_complete(unsigned int cpu) in ipi_complete() argument
631 complete(per_cpu(cpu_completion, cpu)); in ipi_complete()
639 unsigned int cpu = smp_processor_id(); in do_handle_IPI() local
663 ipi_cpu_stop(cpu); in do_handle_IPI()
673 ipi_complete(cpu); in do_handle_IPI()
683 pr_crit("CPU%u: Unknown IPI message 0x%x\n", in do_handle_IPI()
684 cpu, ipinr); in do_handle_IPI()
716 static void ipi_setup(int cpu) in ipi_setup() argument
747 /* Setup the boot CPU immediately */ in set_smp_ipi_range()
751 void smp_send_reschedule(int cpu) in smp_send_reschedule() argument
753 smp_cross_call(cpumask_of(cpu), IPI_RESCHEDULE); in smp_send_reschedule()
776 * and CPU 1 calls panic_smp_self_stop() before crash_smp_send_stop()
783 pr_debug("CPU %u will stop doing anything useful since another CPU has paniced\n", in panic_smp_self_stop()
802 int cpu, first = cpumask_first(cpus); in cpufreq_callback() local
809 for_each_cpu(cpu, cpus) { in cpufreq_callback()
810 per_cpu(l_p_j_ref, cpu) = in cpufreq_callback()
811 per_cpu(cpu_data, cpu).loops_per_jiffy; in cpufreq_callback()
812 per_cpu(l_p_j_ref_freq, cpu) = freq->old; in cpufreq_callback()
829 for_each_cpu(cpu, cpus) in cpufreq_callback()
830 per_cpu(cpu_data, cpu).loops_per_jiffy = lpj; in cpufreq_callback()