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

acassis 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 2f80a05eae arch: qemu-rv: Fix qemu_rv_mtimer_interrupt() for 
BUILD_KERNEL
2f80a05eae is described below

commit 2f80a05eae72e360cf37b5b387c911a517134694
Author: Masayuki Ishikawa <[email protected]>
AuthorDate: Sat Dec 24 16:59:19 2022 +0900

    arch: qemu-rv: Fix qemu_rv_mtimer_interrupt() for BUILD_KERNEL
    
    Summary:
    - I noticed that rv-virt:ksmp64 sometimes stops during boot.
    - Finally, I found that it posts the Supervisor Software Interrupt
      before the OS finishes hardware initialization.
    - This commit fixes this issue.
    
    Impact:
    - None
    
    Testing:
    - Tested with QEMU-7.1
    
    Signed-off-by: Masayuki Ishikawa <[email protected]>
---
 arch/risc-v/src/qemu-rv/qemu_rv_timerisr.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/arch/risc-v/src/qemu-rv/qemu_rv_timerisr.c 
b/arch/risc-v/src/qemu-rv/qemu_rv_timerisr.c
index 1492de5a3b..92363ee7ba 100644
--- a/arch/risc-v/src/qemu-rv/qemu_rv_timerisr.c
+++ b/arch/risc-v/src/qemu-rv/qemu_rv_timerisr.c
@@ -31,6 +31,7 @@
 
 #include <nuttx/arch.h>
 #include <nuttx/clock.h>
+#include <nuttx/init.h>
 #include <nuttx/spinlock.h>
 #include <nuttx/timers/arch_alarm.h>
 #include <arch/board/board.h>
@@ -198,9 +199,12 @@ void qemu_rv_mtimer_interrupt(void)
   g_mtimer_cnt++;
   g_stimer_pending = true;
 
-  /* Post Supervisor Software Interrupt */
+  if (OSINIT_HW_READY())
+    {
+      /* Post Supervisor Software Interrupt */
 
-  SET_CSR(sip, SIP_SSIP);
+      SET_CSR(sip, SIP_SSIP);
+    }
 }
 
 #endif /* CONFIG_BUILD_KERNEL */

Reply via email to