You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2022/10/05 19:58:25 UTC

[GitHub] [incubator-nuttx] masayuki2009 opened a new pull request, #7228: arch: qemu-rv: Add M-timer handling for BUILD_KERNEL

masayuki2009 opened a new pull request, #7228:
URL: https://github.com/apache/incubator-nuttx/pull/7228

   Summary:
   
   Impact:
   
   Testing:
   
   
   ## Summary
   
   - In RISC-V, BUILD_KERNEL uses S-mode and to use M-mode timer we need to handle it by using OpenSBI or self-implementation.
   - This commit adds M-timer self-implementation for BUILD_KERNEL.
   
   ## Impact
   
   - qemu-rv only
   
   ## Testing
   
   - Tested with rv-virt:knsh64 on qemu-6.2
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #7228: arch: qemu-rv: Add M-timer handling for BUILD_KERNEL

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #7228:
URL: https://github.com/apache/incubator-nuttx/pull/7228#discussion_r985934574


##########
arch/risc-v/src/qemu-rv/qemu_rv_start.c:
##########
@@ -49,6 +49,34 @@
 #  error "Target requires kernel in S-mode, enable CONFIG_ARCH_USE_S_MODE"
 #endif
 
+/****************************************************************************
+ * Extern Function Declarations
+ ****************************************************************************/
+
+#ifdef CONFIG_BUILD_KERNEL
+extern void __trap_vec(void);
+extern void __trap_vec_m(void);
+extern void up_mtimer_initialize(void);

Review Comment:
   Ok, let's do it later.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] pkarashchenko commented on a diff in pull request #7228: arch: qemu-rv: Add M-timer handling for BUILD_KERNEL

Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on code in PR #7228:
URL: https://github.com/apache/incubator-nuttx/pull/7228#discussion_r985358133


##########
arch/risc-v/src/qemu-rv/qemu_rv_start.c:
##########
@@ -154,10 +167,27 @@ void qemu_rv_start_s(int mhartid)
   extern void __trap_vec(void);
   WRITE_CSR(stvec, (uintptr_t)__trap_vec);
 
+  /* Set the trap vector for M-mode */
+
+  extern void __trap_vec_m(void);
+  WRITE_CSR(mtvec, (uintptr_t)__trap_vec_m);
+
+  /* Initialize mtimer before entering to S-mode */
+
+  extern void up_mtimer_initialize(void);

Review Comment:
   Maybe all the externs can be grouped at the upper part of the file?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] masayuki2009 commented on a diff in pull request #7228: arch: qemu-rv: Add M-timer handling for BUILD_KERNEL

Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on code in PR #7228:
URL: https://github.com/apache/incubator-nuttx/pull/7228#discussion_r985365291


##########
arch/risc-v/src/qemu-rv/qemu_rv_start.c:
##########
@@ -154,10 +167,27 @@ void qemu_rv_start_s(int mhartid)
   extern void __trap_vec(void);
   WRITE_CSR(stvec, (uintptr_t)__trap_vec);
 
+  /* Set the trap vector for M-mode */
+
+  extern void __trap_vec_m(void);
+  WRITE_CSR(mtvec, (uintptr_t)__trap_vec_m);
+
+  /* Initialize mtimer before entering to S-mode */
+
+  extern void up_mtimer_initialize(void);

Review Comment:
   Done
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #7228: arch: qemu-rv: Add M-timer handling for BUILD_KERNEL

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #7228:
URL: https://github.com/apache/incubator-nuttx/pull/7228#discussion_r985410727


##########
arch/risc-v/src/qemu-rv/qemu_rv_start.c:
##########
@@ -49,6 +49,34 @@
 #  error "Target requires kernel in S-mode, enable CONFIG_ARCH_USE_S_MODE"
 #endif
 
+/****************************************************************************
+ * Extern Function Declarations
+ ****************************************************************************/
+
+#ifdef CONFIG_BUILD_KERNEL
+extern void __trap_vec(void);
+extern void __trap_vec_m(void);
+extern void up_mtimer_initialize(void);

Review Comment:
   should we make it as a general infrastructure?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] masayuki2009 commented on a diff in pull request #7228: arch: qemu-rv: Add M-timer handling for BUILD_KERNEL

Posted by GitBox <gi...@apache.org>.
masayuki2009 commented on code in PR #7228:
URL: https://github.com/apache/incubator-nuttx/pull/7228#discussion_r985412546


##########
arch/risc-v/src/qemu-rv/qemu_rv_start.c:
##########
@@ -49,6 +49,34 @@
 #  error "Target requires kernel in S-mode, enable CONFIG_ARCH_USE_S_MODE"
 #endif
 
+/****************************************************************************
+ * Extern Function Declarations
+ ****************************************************************************/
+
+#ifdef CONFIG_BUILD_KERNEL
+extern void __trap_vec(void);
+extern void __trap_vec_m(void);
+extern void up_mtimer_initialize(void);

Review Comment:
   @xiaoxiang781216 
   I'm still not sure if this approach is suitable for other RISC-V SoCs.
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] xiaoxiang781216 merged pull request #7228: arch: qemu-rv: Add M-timer handling for BUILD_KERNEL

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 merged PR #7228:
URL: https://github.com/apache/incubator-nuttx/pull/7228


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org