Lines Matching refs:cpu

83 	unsigned int cpu, i;  in show_ipi_list()  local
87 for_each_online_cpu(cpu) in show_ipi_list()
88 seq_printf(p, "%10u ", per_cpu(irq_stat, cpu).ipi_irqs[i]); in show_ipi_list()
94 static void csr_mail_send(uint64_t data, int cpu, int mailbox) in csr_mail_send() argument
101 val |= (cpu << IOCSR_MBUF_SEND_CPU_SHIFT); in csr_mail_send()
108 val |= (cpu << IOCSR_MBUF_SEND_CPU_SHIFT); in csr_mail_send()
113 static u32 ipi_read_clear(int cpu) in ipi_read_clear() argument
126 static void ipi_write_action(int cpu, u32 action) in ipi_write_action() argument
134 val |= (cpu << IOCSR_IPI_SEND_CPU_SHIFT); in ipi_write_action()
140 void loongson_send_ipi_single(int cpu, unsigned int action) in loongson_send_ipi_single() argument
142 ipi_write_action(cpu_logical_map(cpu), (u32)action); in loongson_send_ipi_single()
158 void smp_send_reschedule(int cpu) in smp_send_reschedule() argument
160 loongson_send_ipi_single(cpu, SMP_RESCHEDULE); in smp_send_reschedule()
167 unsigned int cpu = smp_processor_id(); in loongson_ipi_interrupt() local
169 action = ipi_read_clear(cpu_logical_map(cpu)); in loongson_ipi_interrupt()
173 per_cpu(irq_stat, cpu).ipi_irqs[IPI_RESCHEDULE]++; in loongson_ipi_interrupt()
178 per_cpu(irq_stat, cpu).ipi_irqs[IPI_CALL_FUNCTION]++; in loongson_ipi_interrupt()
187 unsigned int cpu, cpuid; in fdt_smp_setup() local
199 cpu = 0; in fdt_smp_setup()
200 numa_add_cpu(cpu); in fdt_smp_setup()
202 cpu = cpumask_next_zero(-1, cpu_present_mask); in fdt_smp_setup()
206 set_cpu_possible(cpu, true); in fdt_smp_setup()
207 set_cpu_present(cpu, true); in fdt_smp_setup()
208 __cpu_number_map[cpuid] = cpu; in fdt_smp_setup()
209 __cpu_logical_map[cpu] = cpuid; in fdt_smp_setup()
242 void loongson_boot_secondary(int cpu, struct task_struct *idle) in loongson_boot_secondary() argument
246 pr_info("Booting CPU#%d...\n", cpu); in loongson_boot_secondary()
252 csr_mail_send(entry, cpu_logical_map(cpu), 0); in loongson_boot_secondary()
254 loongson_send_ipi_single(cpu, SMP_BOOT_CPU); in loongson_boot_secondary()
262 unsigned int cpu = smp_processor_id(); in loongson_init_secondary() local
271 numa_add_cpu(cpu); in loongson_init_secondary()
273 per_cpu(cpu_state, cpu) = CPU_ONLINE; in loongson_init_secondary()
274 cpu_data[cpu].core = in loongson_init_secondary()
275 cpu_logical_map(cpu) % loongson_sysconf.cores_per_package; in loongson_init_secondary()
276 cpu_data[cpu].package = in loongson_init_secondary()
277 cpu_logical_map(cpu) / loongson_sysconf.cores_per_package; in loongson_init_secondary()
292 unsigned int cpu = smp_processor_id(); in loongson_cpu_disable() local
294 if (io_master(cpu)) in loongson_cpu_disable()
298 numa_remove_cpu(cpu); in loongson_cpu_disable()
300 set_cpu_online(cpu, false); in loongson_cpu_disable()
311 void loongson_cpu_die(unsigned int cpu) in loongson_cpu_die() argument
313 while (per_cpu(cpu_state, cpu) != CPU_DEAD) in loongson_cpu_die()
377 static inline void set_cpu_sibling_map(int cpu) in set_cpu_sibling_map() argument
381 cpumask_set_cpu(cpu, &cpu_sibling_setup_map); in set_cpu_sibling_map()
384 cpumask_set_cpu(cpu, &cpu_sibling_map[cpu]); in set_cpu_sibling_map()
387 if (cpus_are_siblings(cpu, i)) { in set_cpu_sibling_map()
388 cpumask_set_cpu(i, &cpu_sibling_map[cpu]); in set_cpu_sibling_map()
389 cpumask_set_cpu(cpu, &cpu_sibling_map[i]); in set_cpu_sibling_map()
395 static inline void set_cpu_core_map(int cpu) in set_cpu_core_map() argument
399 cpumask_set_cpu(cpu, &cpu_core_setup_map); in set_cpu_core_map()
402 if (cpu_data[cpu].package == cpu_data[i].package) { in set_cpu_core_map()
403 cpumask_set_cpu(i, &cpu_core_map[cpu]); in set_cpu_core_map()
404 cpumask_set_cpu(cpu, &cpu_core_map[i]); in set_cpu_core_map()
437 unsigned int cpu, node, rr_node; in smp_prepare_boot_cpu() local
444 for_each_possible_cpu(cpu) { in smp_prepare_boot_cpu()
445 node = early_cpu_to_node(cpu); in smp_prepare_boot_cpu()
461 set_cpu_numa_node(cpu, node); in smp_prepare_boot_cpu()
463 set_cpu_numa_node(cpu, rr_node); in smp_prepare_boot_cpu()
473 current_thread_info()->cpu = 0; in smp_prepare_cpus()
483 int __cpu_up(unsigned int cpu, struct task_struct *tidle) in __cpu_up() argument
485 loongson_boot_secondary(cpu, tidle); in __cpu_up()
490 pr_crit("CPU%u: failed to start\n", cpu); in __cpu_up()
506 unsigned int cpu; in start_secondary() local
509 cpu = smp_processor_id(); in start_secondary()
510 set_my_cpu_offset(per_cpu_offset(cpu)); in start_secondary()
516 set_cpu_sibling_map(cpu); in start_secondary()
517 set_cpu_core_map(cpu); in start_secondary()
519 notify_cpu_starting(cpu); in start_secondary()
525 set_cpu_online(cpu, true); in start_secondary()
592 unsigned int cpu; in flush_tlb_mm() local
594 for_each_online_cpu(cpu) { in flush_tlb_mm()
595 if (cpu != smp_processor_id() && cpu_context(cpu, mm)) in flush_tlb_mm()
596 cpu_context(cpu, mm) = 0; in flush_tlb_mm()
631 unsigned int cpu; in flush_tlb_range() local
633 for_each_online_cpu(cpu) { in flush_tlb_range()
634 if (cpu != smp_processor_id() && cpu_context(cpu, mm)) in flush_tlb_range()
635 cpu_context(cpu, mm) = 0; in flush_tlb_range()
677 unsigned int cpu; in flush_tlb_page() local
679 for_each_online_cpu(cpu) { in flush_tlb_page()
680 if (cpu != smp_processor_id() && cpu_context(cpu, vma->vm_mm)) in flush_tlb_page()
681 cpu_context(cpu, vma->vm_mm) = 0; in flush_tlb_page()