Lines Matching refs:cpu
80 unsigned int cpu, i; in show_ipi_list() local
84 for_each_online_cpu(cpu) in show_ipi_list()
85 seq_put_decimal_ull_width(p, " ", per_cpu(irq_stat, cpu).ipi_irqs[i], 10); in show_ipi_list()
90 static inline void set_cpu_core_map(int cpu) in set_cpu_core_map() argument
94 cpumask_set_cpu(cpu, &cpu_core_setup_map); in set_cpu_core_map()
97 if (cpu_data[cpu].package == cpu_data[i].package) { in set_cpu_core_map()
98 cpumask_set_cpu(i, &cpu_core_map[cpu]); in set_cpu_core_map()
99 cpumask_set_cpu(cpu, &cpu_core_map[i]); in set_cpu_core_map()
104 static inline void set_cpu_sibling_map(int cpu) in set_cpu_sibling_map() argument
108 cpumask_set_cpu(cpu, &cpu_sibling_setup_map); in set_cpu_sibling_map()
111 if (cpus_are_siblings(cpu, i)) { in set_cpu_sibling_map()
112 cpumask_set_cpu(i, &cpu_sibling_map[cpu]); in set_cpu_sibling_map()
113 cpumask_set_cpu(cpu, &cpu_sibling_map[i]); in set_cpu_sibling_map()
118 static inline void clear_cpu_sibling_map(int cpu) in clear_cpu_sibling_map() argument
123 if (cpus_are_siblings(cpu, i)) { in clear_cpu_sibling_map()
124 cpumask_clear_cpu(i, &cpu_sibling_map[cpu]); in clear_cpu_sibling_map()
125 cpumask_clear_cpu(cpu, &cpu_sibling_map[i]); in clear_cpu_sibling_map()
129 cpumask_clear_cpu(cpu, &cpu_sibling_setup_map); in clear_cpu_sibling_map()
158 static void csr_mail_send(uint64_t data, int cpu, int mailbox) in csr_mail_send() argument
165 val |= (cpu << IOCSR_MBUF_SEND_CPU_SHIFT); in csr_mail_send()
172 val |= (cpu << IOCSR_MBUF_SEND_CPU_SHIFT); in csr_mail_send()
177 static u32 ipi_read_clear(int cpu) in ipi_read_clear() argument
190 static void ipi_write_action(int cpu, u32 action) in ipi_write_action() argument
195 val |= (cpu << IOCSR_IPI_SEND_CPU_SHIFT); in ipi_write_action()
199 static void loongson_send_ipi_single(int cpu, unsigned int action) in loongson_send_ipi_single() argument
201 ipi_write_action(cpu_logical_map(cpu), (u32)action); in loongson_send_ipi_single()
217 void arch_smp_send_reschedule(int cpu) in arch_smp_send_reschedule() argument
219 mp_ops.send_ipi_single(cpu, ACTION_RESCHEDULE); in arch_smp_send_reschedule()
233 unsigned int cpu = smp_processor_id(); in loongson_ipi_interrupt() local
235 action = ipi_read_clear(cpu_logical_map(cpu)); in loongson_ipi_interrupt()
239 per_cpu(irq_stat, cpu).ipi_irqs[IPI_RESCHEDULE]++; in loongson_ipi_interrupt()
244 per_cpu(irq_stat, cpu).ipi_irqs[IPI_CALL_FUNCTION]++; in loongson_ipi_interrupt()
249 per_cpu(irq_stat, cpu).ipi_irqs[IPI_IRQ_WORK]++; in loongson_ipi_interrupt()
254 per_cpu(irq_stat, cpu).ipi_irqs[IPI_CLEAR_VECTOR]++; in loongson_ipi_interrupt()
283 unsigned int cpu, cpuid; in fdt_smp_setup() local
295 cpu = 0; in fdt_smp_setup()
297 cpu = find_first_zero_bit(cpumask_bits(cpu_present_mask), NR_CPUS); in fdt_smp_setup()
300 set_cpu_possible(cpu, true); in fdt_smp_setup()
301 set_cpu_present(cpu, true); in fdt_smp_setup()
302 __cpu_number_map[cpuid] = cpu; in fdt_smp_setup()
303 __cpu_logical_map[cpu] = cpuid; in fdt_smp_setup()
347 void loongson_boot_secondary(int cpu, struct task_struct *idle) in loongson_boot_secondary() argument
351 pr_info("Booting CPU#%d...\n", cpu); in loongson_boot_secondary()
357 csr_mail_send(entry, cpu_logical_map(cpu), 0); in loongson_boot_secondary()
359 loongson_send_ipi_single(cpu, ACTION_BOOT_CPU); in loongson_boot_secondary()
367 unsigned int cpu = smp_processor_id(); in loongson_init_secondary() local
376 numa_add_cpu(cpu); in loongson_init_secondary()
378 per_cpu(cpu_state, cpu) = CPU_ONLINE; in loongson_init_secondary()
379 cpu_data[cpu].package = in loongson_init_secondary()
380 cpu_logical_map(cpu) / loongson_sysconf.cores_per_package; in loongson_init_secondary()
381 cpu_data[cpu].core = pptt_enabled ? cpu_data[cpu].core : in loongson_init_secondary()
382 cpu_logical_map(cpu) % loongson_sysconf.cores_per_package; in loongson_init_secondary()
383 cpu_data[cpu].global_id = cpu_logical_map(cpu); in loongson_init_secondary()
398 unsigned int cpu = smp_processor_id(); in loongson_cpu_disable() local
400 if (io_master(cpu)) in loongson_cpu_disable()
404 numa_remove_cpu(cpu); in loongson_cpu_disable()
406 set_cpu_online(cpu, false); in loongson_cpu_disable()
407 clear_cpu_sibling_map(cpu); in loongson_cpu_disable()
418 void loongson_cpu_die(unsigned int cpu) in loongson_cpu_die() argument
420 while (per_cpu(cpu_state, cpu) != CPU_DEAD) in loongson_cpu_die()
488 unsigned int cpu, node, rr_node; in smp_prepare_boot_cpu() local
496 for_each_possible_cpu(cpu) { in smp_prepare_boot_cpu()
497 node = early_cpu_to_node(cpu); in smp_prepare_boot_cpu()
513 set_cpu_numa_node(cpu, node); in smp_prepare_boot_cpu()
515 set_cpu_numa_node(cpu, rr_node); in smp_prepare_boot_cpu()
527 current_thread_info()->cpu = 0; in smp_prepare_cpus()
537 int __cpu_up(unsigned int cpu, struct task_struct *tidle) in __cpu_up() argument
539 loongson_boot_secondary(cpu, tidle); in __cpu_up()
544 pr_crit("CPU%u: failed to start\n", cpu); in __cpu_up()
560 unsigned int cpu; in start_secondary() local
563 cpu = raw_smp_processor_id(); in start_secondary()
564 set_my_cpu_offset(per_cpu_offset(cpu)); in start_secondary()
570 set_cpu_sibling_map(cpu); in start_secondary()
571 set_cpu_core_map(cpu); in start_secondary()
573 notify_cpu_starting(cpu); in start_secondary()
579 set_cpu_online(cpu, true); in start_secondary()
648 unsigned int cpu; in flush_tlb_mm() local
650 for_each_online_cpu(cpu) { in flush_tlb_mm()
651 if (cpu != smp_processor_id() && cpu_context(cpu, mm)) in flush_tlb_mm()
652 cpu_context(cpu, mm) = 0; in flush_tlb_mm()
687 unsigned int cpu; in flush_tlb_range() local
689 for_each_online_cpu(cpu) { in flush_tlb_range()
690 if (cpu != smp_processor_id() && cpu_context(cpu, mm)) in flush_tlb_range()
691 cpu_context(cpu, mm) = 0; in flush_tlb_range()
733 unsigned int cpu; in flush_tlb_page() local
735 for_each_online_cpu(cpu) { in flush_tlb_page()
736 if (cpu != smp_processor_id() && cpu_context(cpu, vma->vm_mm)) in flush_tlb_page()
737 cpu_context(cpu, vma->vm_mm) = 0; in flush_tlb_page()