mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
The __cpu_up_stack/task_pointer array is only used for spinwait method now. The per cpu array based lookup is also fragile for platforms with discontiguous/sparse hartids. The spinwait method is only used for M-mode Linux or older firmwares without SBI HSM extension. For general Linux systems, ordered booting method is preferred anyways to support cpu hotplug and kexec. Make sure that __cpu_up_stack/task_pointer is only used for spinwait method. Take this opportunity to rename it to __cpu_spinwait_stack/task_pointer to emphasize the purpose as well. Reviewed-by: Anup Patel <anup@brainfault.org> Signed-off-by: Atish Patra <atishp@rivosinc.com> Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
30 lines
733 B
C
30 lines
733 B
C
// SPDX-License-Identifier: GPL-2.0-only
|
|
/*
|
|
* Copyright (c) 2020 Western Digital Corporation or its affiliates.
|
|
*/
|
|
|
|
#include <linux/errno.h>
|
|
#include <linux/mm.h>
|
|
#include <linux/of.h>
|
|
#include <linux/string.h>
|
|
#include <linux/sched.h>
|
|
#include <asm/cpu_ops.h>
|
|
#include <asm/sbi.h>
|
|
#include <asm/smp.h>
|
|
|
|
const struct cpu_operations *cpu_ops[NR_CPUS] __ro_after_init;
|
|
|
|
extern const struct cpu_operations cpu_ops_sbi;
|
|
extern const struct cpu_operations cpu_ops_spinwait;
|
|
|
|
void __init cpu_set_ops(int cpuid)
|
|
{
|
|
#if IS_ENABLED(CONFIG_RISCV_SBI)
|
|
if (sbi_probe_extension(SBI_EXT_HSM) > 0) {
|
|
if (!cpuid)
|
|
pr_info("SBI HSM extension detected\n");
|
|
cpu_ops[cpuid] = &cpu_ops_sbi;
|
|
} else
|
|
#endif
|
|
cpu_ops[cpuid] = &cpu_ops_spinwait;
|
|
}
|