[kvm-unit-tests PATCH v5 4/5] riscv: Add helper method to set cpu started mask
James Raphael Tiovalen
jamestiotio at gmail.com
Sat Sep 21 03:08:22 PDT 2024
When a CPU abruptly stops during the RISC-V SBI hart stop tests, it is
considered to be offline. As such, it should be removed from the
cpu_started mask so that future tests can initiate another
smp_boot_secondary. Add a helper method to allow the RISC-V SBI
boot hart to remove a dead CPU from the mask.
Signed-off-by: James Raphael Tiovalen <jamestiotio at gmail.com>
---
lib/riscv/asm/smp.h | 2 ++
lib/riscv/smp.c | 8 ++++++++
2 files changed, 10 insertions(+)
diff --git a/lib/riscv/asm/smp.h b/lib/riscv/asm/smp.h
index b3ead4e8..5d379a7a 100644
--- a/lib/riscv/asm/smp.h
+++ b/lib/riscv/asm/smp.h
@@ -26,4 +26,6 @@ secondary_func_t secondary_cinit(struct secondary_data *data);
void smp_boot_secondary(int cpu, void (*func)(void));
void smp_boot_secondary_nofail(int cpu, void (*func)(void));
+void set_cpu_started(int cpu, bool started);
+
#endif /* _ASMRISCV_SMP_H_ */
diff --git a/lib/riscv/smp.c b/lib/riscv/smp.c
index eb7061ab..eb7cfb72 100644
--- a/lib/riscv/smp.c
+++ b/lib/riscv/smp.c
@@ -74,3 +74,11 @@ void smp_boot_secondary_nofail(int cpu, void (*func)(void))
while (!cpu_online(cpu))
smp_wait_for_event();
}
+
+void set_cpu_started(int cpu, bool started)
+{
+ if (started)
+ cpumask_set_cpu(cpu, &cpu_started);
+ else
+ cpumask_clear_cpu(cpu, &cpu_started);
+}
--
2.43.0
More information about the kvm-riscv
mailing list