Lines Matching refs:cpu
81 unsigned int cpu, i; in show_ipi_list() local
85 for_each_online_cpu(cpu) in show_ipi_list()
86 seq_printf(p, "%10u ", per_cpu(irq_stat, cpu).ipi_irqs[i]); in show_ipi_list()
91 static inline void set_cpu_core_map(int cpu) in set_cpu_core_map() argument
95 cpumask_set_cpu(cpu, &cpu_core_setup_map); in set_cpu_core_map()
98 if (cpu_data[cpu].package == cpu_data[i].package) { in set_cpu_core_map()
99 cpumask_set_cpu(i, &cpu_core_map[cpu]); in set_cpu_core_map()
100 cpumask_set_cpu(cpu, &cpu_core_map[i]); in set_cpu_core_map()
105 static inline void set_cpu_sibling_map(int cpu) in set_cpu_sibling_map() argument
109 cpumask_set_cpu(cpu, &cpu_sibling_setup_map); in set_cpu_sibling_map()
112 if (cpus_are_siblings(cpu, i)) { in set_cpu_sibling_map()
113 cpumask_set_cpu(i, &cpu_sibling_map[cpu]); in set_cpu_sibling_map()
114 cpumask_set_cpu(cpu, &cpu_sibling_map[i]); in set_cpu_sibling_map()
119 static inline void clear_cpu_sibling_map(int cpu) in clear_cpu_sibling_map() argument
124 if (cpus_are_siblings(cpu, i)) { in clear_cpu_sibling_map()
125 cpumask_clear_cpu(i, &cpu_sibling_map[cpu]); in clear_cpu_sibling_map()
126 cpumask_clear_cpu(cpu, &cpu_sibling_map[i]); in clear_cpu_sibling_map()
130 cpumask_clear_cpu(cpu, &cpu_sibling_setup_map); in clear_cpu_sibling_map()
159 static void csr_mail_send(uint64_t data, int cpu, int mailbox) in csr_mail_send() argument
166 val |= (cpu << IOCSR_MBUF_SEND_CPU_SHIFT); in csr_mail_send()
173 val |= (cpu << IOCSR_MBUF_SEND_CPU_SHIFT); in csr_mail_send()
178 static u32 ipi_read_clear(int cpu) in ipi_read_clear() argument
191 static void ipi_write_action(int cpu, u32 action) in ipi_write_action() argument
199 val |= (cpu << IOCSR_IPI_SEND_CPU_SHIFT); in ipi_write_action()
205 void loongson_send_ipi_single(int cpu, unsigned int action) in loongson_send_ipi_single() argument
207 ipi_write_action(cpu_logical_map(cpu), (u32)action); in loongson_send_ipi_single()
223 void arch_smp_send_reschedule(int cpu) in arch_smp_send_reschedule() argument
225 loongson_send_ipi_single(cpu, SMP_RESCHEDULE); in arch_smp_send_reschedule()
232 unsigned int cpu = smp_processor_id(); in loongson_ipi_interrupt() local
234 action = ipi_read_clear(cpu_logical_map(cpu)); in loongson_ipi_interrupt()
238 per_cpu(irq_stat, cpu).ipi_irqs[IPI_RESCHEDULE]++; in loongson_ipi_interrupt()
243 per_cpu(irq_stat, cpu).ipi_irqs[IPI_CALL_FUNCTION]++; in loongson_ipi_interrupt()
252 unsigned int cpu, cpuid; in fdt_smp_setup() local
264 cpu = 0; in fdt_smp_setup()
265 numa_add_cpu(cpu); in fdt_smp_setup()
267 cpu = cpumask_next_zero(-1, cpu_present_mask); in fdt_smp_setup()
271 set_cpu_possible(cpu, true); in fdt_smp_setup()
272 set_cpu_present(cpu, true); in fdt_smp_setup()
273 __cpu_number_map[cpuid] = cpu; in fdt_smp_setup()
274 __cpu_logical_map[cpu] = cpuid; in fdt_smp_setup()
311 void loongson_boot_secondary(int cpu, struct task_struct *idle) in loongson_boot_secondary() argument
315 pr_info("Booting CPU#%d...\n", cpu); in loongson_boot_secondary()
321 csr_mail_send(entry, cpu_logical_map(cpu), 0); in loongson_boot_secondary()
323 loongson_send_ipi_single(cpu, SMP_BOOT_CPU); in loongson_boot_secondary()
331 unsigned int cpu = smp_processor_id(); in loongson_init_secondary() local
340 numa_add_cpu(cpu); in loongson_init_secondary()
342 per_cpu(cpu_state, cpu) = CPU_ONLINE; in loongson_init_secondary()
343 cpu_data[cpu].package = in loongson_init_secondary()
344 cpu_logical_map(cpu) / loongson_sysconf.cores_per_package; in loongson_init_secondary()
345 cpu_data[cpu].core = pptt_enabled ? cpu_data[cpu].core : in loongson_init_secondary()
346 cpu_logical_map(cpu) % loongson_sysconf.cores_per_package; in loongson_init_secondary()
361 unsigned int cpu = smp_processor_id(); in loongson_cpu_disable() local
363 if (io_master(cpu)) in loongson_cpu_disable()
367 numa_remove_cpu(cpu); in loongson_cpu_disable()
369 set_cpu_online(cpu, false); in loongson_cpu_disable()
370 clear_cpu_sibling_map(cpu); in loongson_cpu_disable()
381 void loongson_cpu_die(unsigned int cpu) in loongson_cpu_die() argument
383 while (per_cpu(cpu_state, cpu) != CPU_DEAD) in loongson_cpu_die()
451 unsigned int cpu, node, rr_node; in smp_prepare_boot_cpu() local
458 for_each_possible_cpu(cpu) { in smp_prepare_boot_cpu()
459 node = early_cpu_to_node(cpu); in smp_prepare_boot_cpu()
475 set_cpu_numa_node(cpu, node); in smp_prepare_boot_cpu()
477 set_cpu_numa_node(cpu, rr_node); in smp_prepare_boot_cpu()
487 current_thread_info()->cpu = 0; in smp_prepare_cpus()
497 int __cpu_up(unsigned int cpu, struct task_struct *tidle) in __cpu_up() argument
499 loongson_boot_secondary(cpu, tidle); in __cpu_up()
504 pr_crit("CPU%u: failed to start\n", cpu); in __cpu_up()
520 unsigned int cpu; in start_secondary() local
523 cpu = raw_smp_processor_id(); in start_secondary()
524 set_my_cpu_offset(per_cpu_offset(cpu)); in start_secondary()
530 set_cpu_sibling_map(cpu); in start_secondary()
531 set_cpu_core_map(cpu); in start_secondary()
533 notify_cpu_starting(cpu); in start_secondary()
539 set_cpu_online(cpu, true); in start_secondary()
608 unsigned int cpu; in flush_tlb_mm() local
610 for_each_online_cpu(cpu) { in flush_tlb_mm()
611 if (cpu != smp_processor_id() && cpu_context(cpu, mm)) in flush_tlb_mm()
612 cpu_context(cpu, mm) = 0; in flush_tlb_mm()
647 unsigned int cpu; in flush_tlb_range() local
649 for_each_online_cpu(cpu) { in flush_tlb_range()
650 if (cpu != smp_processor_id() && cpu_context(cpu, mm)) in flush_tlb_range()
651 cpu_context(cpu, mm) = 0; in flush_tlb_range()
693 unsigned int cpu; in flush_tlb_page() local
695 for_each_online_cpu(cpu) { in flush_tlb_page()
696 if (cpu != smp_processor_id() && cpu_context(cpu, vma->vm_mm)) in flush_tlb_page()
697 cpu_context(cpu, vma->vm_mm) = 0; in flush_tlb_page()