ztest: make the FPU flush workaround more generic

In addition to ARM64, it must apply to RISC-V too now.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
This commit is contained in:
Nicolas Pitre 2023-01-19 09:25:27 -05:00 committed by Carles Cufí
parent ff07da6ff1
commit 90ae60078e
2 changed files with 4 additions and 6 deletions

View file

@ -107,15 +107,14 @@ static void cpu_hold(void *arg1, void *arg2, void *arg3)
k_sem_give(&cpuhold_sem);
#if defined(CONFIG_ARM64) && defined(CONFIG_FPU_SHARING)
#if (defined(CONFIG_ARM64) || defined(CONFIG_RISCV)) && defined(CONFIG_FPU_SHARING)
/*
* We'll be spinning with IRQs disabled. The flush-your-FPU request
* IPI will never be serviced during that time. Therefore we flush
* the FPU preemptively here to prevent any other CPU waiting after
* this CPU forever and deadlock the system.
*/
extern void z_arm64_flush_local_fpu(void);
z_arm64_flush_local_fpu();
k_float_disable(_current_cpu->arch.fpu_owner);
#endif
while (cpuhold_active) {

View file

@ -132,15 +132,14 @@ static void cpu_hold(void *arg1, void *arg2, void *arg3)
k_sem_give(&cpuhold_sem);
#if defined(CONFIG_ARM64) && defined(CONFIG_FPU_SHARING)
#if (defined(CONFIG_ARM64) || defined(CONFIG_RISCV)) && defined(CONFIG_FPU_SHARING)
/*
* We'll be spinning with IRQs disabled. The flush-your-FPU request
* IPI will never be serviced during that time. Therefore we flush
* the FPU preemptively here to prevent any other CPU waiting after
* this CPU forever and deadlock the system.
*/
extern void z_arm64_flush_local_fpu(void);
z_arm64_flush_local_fpu();
k_float_disable(_current_cpu->arch.fpu_owner);
#endif
while (cpuhold_active) {