summaryrefslogtreecommitdiff
path: root/arch/riscv/kernel/cpu_ops.c
diff options
context:
space:
mode:
authorAndrew Jones <ajones@ventanamicro.com>2023-04-27 19:36:26 +0300
committerPalmer Dabbelt <palmer@rivosinc.com>2023-04-29 23:04:50 +0300
commit41cad8284d5e6bf1d49d3c10a6b52ee1ae866a20 (patch)
tree5ec9f85ff9226487c9e5bafa47a4a69338ca8915 /arch/riscv/kernel/cpu_ops.c
parente4ef93edd4e0b022529303db1915766ff9de450e (diff)
downloadlinux-41cad8284d5e6bf1d49d3c10a6b52ee1ae866a20.tar.xz
RISC-V: Align SBI probe implementation with spec
sbi_probe_extension() is specified with "Returns 0 if the given SBI extension ID (EID) is not available, or 1 if it is available unless defined as any other non-zero value by the implementation." Additionally, sbiret.value is a long. Fix the implementation to ensure any nonzero long value is considered a success, rather than only positive int values. Fixes: b9dcd9e41587 ("RISC-V: Add basic support for SBI v0.2") Signed-off-by: Andrew Jones <ajones@ventanamicro.com> Reviewed-by: Conor Dooley <conor.dooley@microchip.com> Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20230427163626.101042-1-ajones@ventanamicro.com Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
Diffstat (limited to 'arch/riscv/kernel/cpu_ops.c')
-rw-r--r--arch/riscv/kernel/cpu_ops.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/riscv/kernel/cpu_ops.c b/arch/riscv/kernel/cpu_ops.c
index 8275f237a59d..eb479a88a954 100644
--- a/arch/riscv/kernel/cpu_ops.c
+++ b/arch/riscv/kernel/cpu_ops.c
@@ -27,7 +27,7 @@ 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 (sbi_probe_extension(SBI_EXT_HSM)) {
if (!cpuid)
pr_info("SBI HSM extension detected\n");
cpu_ops[cpuid] = &cpu_ops_sbi;