This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 526ba1ab34 riscv/cpustart: Ensure we receive Soft IRQ / IPI before 
booting CPU
526ba1ab34 is described below

commit 526ba1ab343a00b2e1801e089392eed64758b820
Author: Ville Juven <[email protected]>
AuthorDate: Fri Oct 11 13:22:23 2024 +0300

    riscv/cpustart: Ensure we receive Soft IRQ / IPI before booting CPU
    
    Some spurious interrupt might wake WFI, ensure we got woken by IPI before
    continuing CPU boot.
---
 arch/risc-v/src/common/riscv_cpustart.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/arch/risc-v/src/common/riscv_cpustart.c 
b/arch/risc-v/src/common/riscv_cpustart.c
index a3141aff9a..9cf04b7d63 100644
--- a/arch/risc-v/src/common/riscv_cpustart.c
+++ b/arch/risc-v/src/common/riscv_cpustart.c
@@ -77,7 +77,11 @@ void riscv_cpu_boot(int cpu)
 
   /* Wait interrupt */
 
-  asm("WFI");
+  do
+    {
+      asm("WFI");
+    }
+  while (READ_CSR(CSR_IP) != IP_SIP);
 
 #ifdef CONFIG_RISCV_PERCPU_SCRATCH
   /* Initialize the per CPU areas */

Reply via email to