Re: [PATCH v2 3/3] LoongArch: SMP: Implement parallel CPU bring up

From: Thomas Gleixner
Date: Tue Jul 16 2024 - 00:56:32 EST


On Mon, Jul 15 2024 at 21:35, Jiaxun Yang wrote:
> */
> void loongson_boot_secondary(int cpu, struct task_struct *idle)
> {
> - unsigned long entry;
> + unsigned long entry, stack, thread_info;
>
> pr_info("Booting CPU#%d...\n", cpu);
>
> entry = __pa_symbol((unsigned long)&smpboot_entry);
> - cpuboot_data.stack = (unsigned long)__KSTK_TOS(idle);
> - cpuboot_data.thread_info = (unsigned long)task_thread_info(idle);
> + stack = (unsigned long)__KSTK_TOS(idle);
> + thread_info = (unsigned long)task_thread_info(idle);
>
> + csr_mail_send(thread_info, cpu_logical_map(cpu), 2);
> + csr_mail_send(stack, cpu_logical_map(cpu), 1);
> csr_mail_send(entry, cpu_logical_map(cpu), 0);
>
> loongson_send_ipi_single(cpu, ACTION_BOOT_CPU);
> @@ -525,20 +522,10 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
> #endif
> }
>
> -int __cpu_up(unsigned int cpu, struct task_struct *tidle)
> +int arch_cpuhp_kick_ap_alive(unsigned int cpu, struct task_struct *tidle)
> {
> loongson_boot_secondary(cpu, tidle);

What's the point of this indirection and why is
loongson_boot_secondary() global? The only caller is this function, no?

Thanks,

tglx