Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion arch/riscv/include/asm/cpu_ops.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ struct cpu_operations {
struct task_struct *tidle);
#ifdef CONFIG_HOTPLUG_CPU
void (*cpu_stop)(void);
int (*cpu_is_stopped)(unsigned int cpu);
bool (*cpu_is_stopped)(unsigned int cpu);
#endif
};

Expand Down
2 changes: 1 addition & 1 deletion arch/riscv/kernel/cpu-hotplug.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ void arch_cpuhp_cleanup_dead_cpu(unsigned int cpu)
/* Verify from the firmware if the cpu is really stopped*/
if (cpu_ops->cpu_is_stopped)
ret = cpu_ops->cpu_is_stopped(cpu);
if (ret)
if (!ret)
pr_warn("CPU%u may not have stopped: %d\n", cpu, ret);
}

Expand Down
17 changes: 5 additions & 12 deletions arch/riscv/kernel/cpu_ops_sbi.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,8 @@ static int sbi_hsm_hart_start(unsigned long hartid, unsigned long saddr,

ret = sbi_ecall(SBI_EXT_HSM, SBI_EXT_HSM_HART_START,
hartid, saddr, priv, 0, 0, 0);
if (ret.error)
return sbi_err_map_linux_errno(ret.error);
else
return 0;

return sbi_err_map_linux_errno(ret.error);
}

#ifdef CONFIG_HOTPLUG_CPU
Expand All @@ -43,10 +41,7 @@ static int sbi_hsm_hart_stop(void)

ret = sbi_ecall(SBI_EXT_HSM, SBI_EXT_HSM_HART_STOP, 0, 0, 0, 0, 0, 0);

if (ret.error)
return sbi_err_map_linux_errno(ret.error);
else
return 0;
return sbi_err_map_linux_errno(ret.error);
}

static int sbi_hsm_hart_get_status(unsigned long hartid)
Expand Down Expand Up @@ -88,16 +83,14 @@ static void sbi_cpu_stop(void)
pr_crit("Unable to stop the cpu %d (%d)\n", smp_processor_id(), ret);
}

static int sbi_cpu_is_stopped(unsigned int cpuid)
static bool sbi_cpu_is_stopped(unsigned int cpuid)
{
int rc;
unsigned long hartid = cpuid_to_hartid_map(cpuid);

rc = sbi_hsm_hart_get_status(hartid);

if (rc == SBI_HSM_STATE_STOPPED)
return 0;
return rc;
return (rc == SBI_HSM_STATE_STOPPED);
}
#endif

Expand Down