Lines Matching full:cpu

20 #include <linux/cpu.h>
34 #include <asm/cpu.h>
102 static int secondary_biglittle_prepare(unsigned int cpu) in secondary_biglittle_prepare() argument
104 if (!cpu_vtable[cpu]) in secondary_biglittle_prepare()
105 cpu_vtable[cpu] = kzalloc(sizeof(*cpu_vtable[cpu]), GFP_KERNEL); in secondary_biglittle_prepare()
107 return cpu_vtable[cpu] ? 0 : -ENOMEM; in secondary_biglittle_prepare()
115 static int secondary_biglittle_prepare(unsigned int cpu) in secondary_biglittle_prepare() argument
125 int __cpu_up(unsigned int cpu, struct task_struct *idle) in __cpu_up() argument
132 ret = secondary_biglittle_prepare(cpu); in __cpu_up()
152 * Now bring the CPU into our world. in __cpu_up()
154 ret = smp_ops.smp_boot_secondary(cpu, idle); in __cpu_up()
157 * CPU was successfully started, wait for it in __cpu_up()
163 if (!cpu_online(cpu)) { in __cpu_up()
164 pr_crit("CPU%u: failed to come online\n", cpu); in __cpu_up()
168 pr_err("CPU%u: failed to boot: %d\n", cpu, ret); in __cpu_up()
199 static int platform_cpu_kill(unsigned int cpu) in platform_cpu_kill() argument
202 return smp_ops.cpu_kill(cpu); in platform_cpu_kill()
206 static int platform_cpu_disable(unsigned int cpu) in platform_cpu_disable() argument
209 return smp_ops.cpu_disable(cpu); in platform_cpu_disable()
214 int platform_can_hotplug_cpu(unsigned int cpu) in platform_can_hotplug_cpu() argument
221 return smp_ops.cpu_can_disable(cpu); in platform_can_hotplug_cpu()
228 return cpu != 0; in platform_can_hotplug_cpu()
236 unsigned int cpu = smp_processor_id(); in __cpu_disable() local
239 ret = platform_cpu_disable(cpu); in __cpu_disable()
244 * Take this CPU offline. Once we clear this, we can't return, in __cpu_disable()
245 * and we must not schedule until we're ready to give up the cpu. in __cpu_disable()
247 set_cpu_online(cpu, false); in __cpu_disable()
250 * OK - migrate IRQs away from this CPU in __cpu_disable()
255 * Flush user cache and TLB mappings, and then remove this CPU in __cpu_disable()
268 * called on the thread which is asking for a CPU to be shutdown -
271 void __cpu_die(unsigned int cpu) in __cpu_die() argument
273 if (!cpu_wait_death(cpu, 5)) { in __cpu_die()
274 pr_err("CPU%u: cpu didn't die\n", cpu); in __cpu_die()
277 pr_debug("CPU%u: shutdown\n", cpu); in __cpu_die()
279 clear_tasks_mm_cpumask(cpu); in __cpu_die()
282 * and/or cutting of clocks to the dying CPU. Optionally, this may in __cpu_die()
283 * be done by the CPU which is dying in preference to supporting in __cpu_die()
285 * the requesting CPU and the dying CPU actually losing power. in __cpu_die()
287 if (!platform_cpu_kill(cpu)) in __cpu_die()
288 pr_err("CPU%u: unable to kill\n", cpu); in __cpu_die()
292 * Called from the idle thread for the CPU which has been shutdown.
296 * of the other hotplug-cpu capable cores, so presumably coming
301 unsigned int cpu = smp_processor_id(); in arch_cpu_idle_dead() local
308 * Flush the data out of the L1 cache for this CPU. This must be in arch_cpu_idle_dead()
311 * *this* CPU and power down its cache. in arch_cpu_idle_dead()
316 * Tell __cpu_die() that this CPU is now safe to dispose of. Once in arch_cpu_idle_dead()
318 * from this CPU and its cache by platform_cpu_kill(). in arch_cpu_idle_dead()
324 * written out. This covers the case where _this_ CPU is doing the in arch_cpu_idle_dead()
326 * CPU waiting for this one. in arch_cpu_idle_dead()
331 * The actual CPU shutdown procedure is at least platform (if not in arch_cpu_idle_dead()
332 * CPU) specific. This may remove power, or it may simply spin. in arch_cpu_idle_dead()
336 * power down the CPU. These platforms are the _only_ reason we in arch_cpu_idle_dead()
340 * power off the CPU. in arch_cpu_idle_dead()
343 smp_ops.cpu_die(cpu); in arch_cpu_idle_dead()
345 pr_warn("CPU%u: smp_ops.cpu_die() returned, trying to resuscitate\n", in arch_cpu_idle_dead()
346 cpu); in arch_cpu_idle_dead()
350 * cpu initialisation. There's some initialisation which needs in arch_cpu_idle_dead()
351 * to be repeated to undo the effects of taking the CPU offline. in arch_cpu_idle_dead()
377 * This is the secondary CPU boot entry. We're using this CPUs
383 unsigned int cpu; in secondary_start_kernel() local
400 cpu = smp_processor_id(); in secondary_start_kernel()
403 cpumask_set_cpu(cpu, mm_cpumask(mm)); in secondary_start_kernel()
410 pr_debug("CPU%u: Booted secondary processor\n", cpu); in secondary_start_kernel()
419 smp_ops.smp_secondary_init(cpu); in secondary_start_kernel()
421 notify_cpu_starting(cpu); in secondary_start_kernel()
425 smp_store_cpu_info(cpu); in secondary_start_kernel()
428 * OK, now it's safe to let the boot CPU continue. Wait for in secondary_start_kernel()
429 * the CPU migration code to notice that the CPU is online in secondary_start_kernel()
432 set_cpu_online(cpu, true); in secondary_start_kernel()
450 int cpu; in smp_cpus_done() local
453 for_each_online_cpu(cpu) in smp_cpus_done()
454 bogosum += per_cpu(cpu_data, cpu).loops_per_jiffy; in smp_cpus_done()
493 * Initialise the SCU if there are more than one CPU in smp_prepare_cpus()
511 S(IPI_WAKEUP, "CPU wakeup interrupts"),
515 S(IPI_CPU_STOP, "CPU stop interrupts"),
528 unsigned int cpu, i; in show_ipi_list() local
533 for_each_online_cpu(cpu) in show_ipi_list()
535 __get_irq_stat(cpu, ipi_irqs[i])); in show_ipi_list()
541 u64 smp_irq_stat_cpu(unsigned int cpu) in smp_irq_stat_cpu() argument
547 sum += __get_irq_stat(cpu, ipi_irqs[i]); in smp_irq_stat_cpu()
562 void arch_send_call_function_single_ipi(int cpu) in arch_send_call_function_single_ipi() argument
564 smp_cross_call(cpumask_of(cpu), IPI_CALL_FUNC); in arch_send_call_function_single_ipi()
587 static void ipi_cpu_stop(unsigned int cpu) in ipi_cpu_stop() argument
591 pr_crit("CPU%u: stopping\n", cpu); in ipi_cpu_stop()
596 set_cpu_online(cpu, false); in ipi_cpu_stop()
609 int register_ipi_completion(struct completion *completion, int cpu) in register_ipi_completion() argument
611 per_cpu(cpu_completion, cpu) = completion; in register_ipi_completion()
615 static void ipi_complete(unsigned int cpu) in ipi_complete() argument
617 complete(per_cpu(cpu_completion, cpu)); in ipi_complete()
630 unsigned int cpu = smp_processor_id(); in handle_IPI() local
635 __inc_irq_stat(cpu, ipi_irqs[ipinr]); in handle_IPI()
662 ipi_cpu_stop(cpu); in handle_IPI()
676 ipi_complete(cpu); in handle_IPI()
689 pr_crit("CPU%u: Unknown IPI message 0x%x\n", in handle_IPI()
690 cpu, ipinr); in handle_IPI()
699 void smp_send_reschedule(int cpu) in smp_send_reschedule() argument
701 smp_cross_call(cpumask_of(cpu), IPI_RESCHEDULE); in smp_send_reschedule()
724 * and CPU 1 calls panic_smp_self_stop() before crash_smp_send_stop()
731 pr_debug("CPU %u will stop doing anything useful since another CPU has paniced\n", in panic_smp_self_stop()
758 int cpu, first = cpumask_first(cpus); in cpufreq_callback() local
765 for_each_cpu(cpu, cpus) { in cpufreq_callback()
766 per_cpu(l_p_j_ref, cpu) = in cpufreq_callback()
767 per_cpu(cpu_data, cpu).loops_per_jiffy; in cpufreq_callback()
768 per_cpu(l_p_j_ref_freq, cpu) = freq->old; in cpufreq_callback()
785 for_each_cpu(cpu, cpus) in cpufreq_callback()
786 per_cpu(cpu_data, cpu).loops_per_jiffy = lpj; in cpufreq_callback()