2020-03-17 18:11:40 -07:00
|
|
|
// 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>
|
2022-07-14 01:02:36 -07:00
|
|
|
#include <asm/cpu_ops_sbi.h>
|
2020-03-17 18:11:40 -07:00
|
|
|
#include <asm/sbi.h>
|
|
|
|
#include <asm/smp.h>
|
|
|
|
|
2023-11-21 16:47:26 -07:00
|
|
|
const struct cpu_operations *cpu_ops __ro_after_init = &cpu_ops_spinwait;
|
2020-03-17 18:11:40 -07:00
|
|
|
|
2020-03-17 18:11:43 -07:00
|
|
|
extern const struct cpu_operations cpu_ops_sbi;
|
2022-07-14 00:18:11 -07:00
|
|
|
#ifndef CONFIG_RISCV_BOOT_SPINWAIT
|
2022-01-20 02:09:17 -07:00
|
|
|
const struct cpu_operations cpu_ops_spinwait = {
|
|
|
|
.cpu_start = NULL,
|
|
|
|
};
|
|
|
|
#endif
|
2020-03-17 18:11:40 -07:00
|
|
|
|
2023-11-21 16:47:26 -07:00
|
|
|
void __init cpu_set_ops(void)
|
2020-03-17 18:11:40 -07:00
|
|
|
{
|
2020-03-17 18:11:43 -07:00
|
|
|
#if IS_ENABLED(CONFIG_RISCV_SBI)
|
2023-04-27 09:36:26 -07:00
|
|
|
if (sbi_probe_extension(SBI_EXT_HSM)) {
|
2023-11-21 16:47:26 -07:00
|
|
|
pr_info("SBI HSM extension detected\n");
|
|
|
|
cpu_ops = &cpu_ops_sbi;
|
|
|
|
}
|
2020-03-17 18:11:43 -07:00
|
|
|
#endif
|
2020-03-17 18:11:40 -07:00
|
|
|
}
|