cpu_ops.c (2875fe0561569f82d0e63658ccf0d11ce7da8922) | cpu_ops.c (cfafe260137418d0265d0df3bb18dc494af2b43e) |
---|---|
1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * Copyright (c) 2020 Western Digital Corporation or its affiliates. 4 */ 5 6#include <linux/errno.h> 7#include <linux/mm.h> 8#include <linux/of.h> --- 4 unchanged lines hidden (view full) --- 13#include <asm/sbi.h> 14#include <asm/smp.h> 15 16const struct cpu_operations *cpu_ops[NR_CPUS] __ro_after_init; 17 18void *__cpu_up_stack_pointer[NR_CPUS]; 19void *__cpu_up_task_pointer[NR_CPUS]; 20 | 1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * Copyright (c) 2020 Western Digital Corporation or its affiliates. 4 */ 5 6#include <linux/errno.h> 7#include <linux/mm.h> 8#include <linux/of.h> --- 4 unchanged lines hidden (view full) --- 13#include <asm/sbi.h> 14#include <asm/smp.h> 15 16const struct cpu_operations *cpu_ops[NR_CPUS] __ro_after_init; 17 18void *__cpu_up_stack_pointer[NR_CPUS]; 19void *__cpu_up_task_pointer[NR_CPUS]; 20 |
21extern const struct cpu_operations cpu_ops_sbi; |
|
21extern const struct cpu_operations cpu_ops_spinwait; 22 23void cpu_update_secondary_bootdata(unsigned int cpuid, 24 struct task_struct *tidle) 25{ 26 int hartid = cpuid_to_hartid_map(cpuid); 27 28 /* Make sure tidle is updated */ 29 smp_mb(); 30 WRITE_ONCE(__cpu_up_stack_pointer[hartid], 31 task_stack_page(tidle) + THREAD_SIZE); 32 WRITE_ONCE(__cpu_up_task_pointer[hartid], tidle); 33} 34 35void __init cpu_set_ops(int cpuid) 36{ | 22extern const struct cpu_operations cpu_ops_spinwait; 23 24void cpu_update_secondary_bootdata(unsigned int cpuid, 25 struct task_struct *tidle) 26{ 27 int hartid = cpuid_to_hartid_map(cpuid); 28 29 /* Make sure tidle is updated */ 30 smp_mb(); 31 WRITE_ONCE(__cpu_up_stack_pointer[hartid], 32 task_stack_page(tidle) + THREAD_SIZE); 33 WRITE_ONCE(__cpu_up_task_pointer[hartid], tidle); 34} 35 36void __init cpu_set_ops(int cpuid) 37{ |
37 cpu_ops[cpuid] = &cpu_ops_spinwait; | 38#if IS_ENABLED(CONFIG_RISCV_SBI) 39 if (sbi_probe_extension(SBI_EXT_HSM) > 0) { 40 if (!cpuid) 41 pr_info("SBI v0.2 HSM extension detected\n"); 42 cpu_ops[cpuid] = &cpu_ops_sbi; 43 } else 44#endif 45 cpu_ops[cpuid] = &cpu_ops_spinwait; |
38} | 46} |