Lines Matching full:cpu

20 #include <linux/cpu.h>
35 #include <asm/cpu.h>
86 static void ipi_setup(int cpu);
108 static int secondary_biglittle_prepare(unsigned int cpu) in secondary_biglittle_prepare() argument
110 if (!cpu_vtable[cpu]) in secondary_biglittle_prepare()
111 cpu_vtable[cpu] = kzalloc(sizeof(*cpu_vtable[cpu]), GFP_KERNEL); in secondary_biglittle_prepare()
113 return cpu_vtable[cpu] ? 0 : -ENOMEM; in secondary_biglittle_prepare()
121 static int secondary_biglittle_prepare(unsigned int cpu) in secondary_biglittle_prepare() argument
131 int __cpu_up(unsigned int cpu, struct task_struct *idle) in __cpu_up() argument
138 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 after the
294 void arch_cpuhp_cleanup_dead_cpu(unsigned int cpu) in arch_cpuhp_cleanup_dead_cpu() argument
296 pr_debug("CPU%u: shutdown\n", cpu); in arch_cpuhp_cleanup_dead_cpu()
298 clear_tasks_mm_cpumask(cpu); in arch_cpuhp_cleanup_dead_cpu()
301 * and/or cutting of clocks to the dying CPU. Optionally, this may in arch_cpuhp_cleanup_dead_cpu()
302 * be done by the CPU which is dying in preference to supporting in arch_cpuhp_cleanup_dead_cpu()
304 * the requesting CPU and the dying CPU actually losing power. in arch_cpuhp_cleanup_dead_cpu()
306 if (!platform_cpu_kill(cpu)) in arch_cpuhp_cleanup_dead_cpu()
307 pr_err("CPU%u: unable to kill\n", cpu); in arch_cpuhp_cleanup_dead_cpu()
311 * Called from the idle thread for the CPU which has been shutdown.
315 * of the other hotplug-cpu capable cores, so presumably coming
320 unsigned int cpu = smp_processor_id(); in arch_cpu_idle_dead() local
327 * Flush the data out of the L1 cache for this CPU. This must be in arch_cpu_idle_dead()
330 * *this* CPU and power down its cache. in arch_cpu_idle_dead()
335 * Tell cpuhp_bp_sync_dead() that this CPU is now safe to dispose in arch_cpu_idle_dead()
337 * any point from this CPU and its cache by platform_cpu_kill(). in arch_cpu_idle_dead()
343 * written out. This covers the case where _this_ CPU is doing the in arch_cpu_idle_dead()
345 * CPU waiting for this one. in arch_cpu_idle_dead()
350 * The actual CPU shutdown procedure is at least platform (if not in arch_cpu_idle_dead()
351 * CPU) specific. This may remove power, or it may simply spin. in arch_cpu_idle_dead()
355 * power down the CPU. These platforms are the _only_ reason we in arch_cpu_idle_dead()
359 * power off the CPU. in arch_cpu_idle_dead()
362 smp_ops.cpu_die(cpu); in arch_cpu_idle_dead()
364 pr_warn("CPU%u: smp_ops.cpu_die() returned, trying to resuscitate\n", in arch_cpu_idle_dead()
365 cpu); in arch_cpu_idle_dead()
369 * cpu initialisation. There's some initialisation which needs in arch_cpu_idle_dead()
370 * to be repeated to undo the effects of taking the CPU offline. in arch_cpu_idle_dead()
407 * This is the secondary CPU boot entry. We're using this CPUs
413 unsigned int cpu; in secondary_start_kernel() local
432 cpu = smp_processor_id(); in secondary_start_kernel()
435 cpumask_set_cpu(cpu, mm_cpumask(mm)); in secondary_start_kernel()
442 pr_debug("CPU%u: Booted secondary processor\n", cpu); in secondary_start_kernel()
450 smp_ops.smp_secondary_init(cpu); in secondary_start_kernel()
452 notify_cpu_starting(cpu); in secondary_start_kernel()
454 ipi_setup(cpu); in secondary_start_kernel()
458 smp_store_cpu_info(cpu); in secondary_start_kernel()
461 * OK, now it's safe to let the boot CPU continue. Wait for in secondary_start_kernel()
462 * the CPU migration code to notice that the CPU is online in secondary_start_kernel()
465 set_cpu_online(cpu, true); in secondary_start_kernel()
483 int cpu; in smp_cpus_done() local
486 for_each_online_cpu(cpu) in smp_cpus_done()
487 bogosum += per_cpu(cpu_data, cpu).loops_per_jiffy; in smp_cpus_done()
526 * Initialise the SCU if there are more than one CPU in smp_prepare_cpus()
535 [IPI_WAKEUP] = "CPU wakeup interrupts",
539 [IPI_CPU_STOP] = "CPU stop interrupts",
548 unsigned int cpu, i; in show_ipi_list() local
556 for_each_online_cpu(cpu) in show_ipi_list()
557 seq_printf(p, "%10u ", irq_desc_kstat_cpu(ipi_desc[i], cpu)); in show_ipi_list()
573 void arch_send_call_function_single_ipi(int cpu) in arch_send_call_function_single_ipi() argument
575 smp_cross_call(cpumask_of(cpu), IPI_CALL_FUNC); in arch_send_call_function_single_ipi()
598 static void ipi_cpu_stop(unsigned int cpu) in ipi_cpu_stop() argument
604 pr_crit("CPU%u: stopping\n", cpu); in ipi_cpu_stop()
609 set_cpu_online(cpu, false); in ipi_cpu_stop()
619 int register_ipi_completion(struct completion *completion, int cpu) in register_ipi_completion() argument
621 per_cpu(cpu_completion, cpu) = completion; in register_ipi_completion()
625 static void ipi_complete(unsigned int cpu) in ipi_complete() argument
627 complete(per_cpu(cpu_completion, cpu)); in ipi_complete()
635 unsigned int cpu = smp_processor_id(); in do_handle_IPI() local
659 ipi_cpu_stop(cpu); in do_handle_IPI()
669 ipi_complete(cpu); in do_handle_IPI()
679 pr_crit("CPU%u: Unknown IPI message 0x%x\n", in do_handle_IPI()
680 cpu, ipinr); in do_handle_IPI()
712 static void ipi_setup(int cpu) in ipi_setup() argument
743 /* Setup the boot CPU immediately */ in set_smp_ipi_range()
747 void arch_smp_send_reschedule(int cpu) in arch_smp_send_reschedule() argument
749 smp_cross_call(cpumask_of(cpu), IPI_RESCHEDULE); in arch_smp_send_reschedule()
772 * and CPU 1 calls panic_smp_self_stop() before crash_smp_send_stop()
779 pr_debug("CPU %u will stop doing anything useful since another CPU has paniced\n", in panic_smp_self_stop()
798 int cpu, first = cpumask_first(cpus); in cpufreq_callback() local
805 for_each_cpu(cpu, cpus) { in cpufreq_callback()
806 per_cpu(l_p_j_ref, cpu) = in cpufreq_callback()
807 per_cpu(cpu_data, cpu).loops_per_jiffy; in cpufreq_callback()
808 per_cpu(l_p_j_ref_freq, cpu) = freq->old; in cpufreq_callback()
825 for_each_cpu(cpu, cpus) in cpufreq_callback()
826 per_cpu(cpu_data, cpu).loops_per_jiffy = lpj; in cpufreq_callback()