You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by "yf13 (via GitHub)" <gi...@apache.org> on 2024/02/20 10:09:18 UTC

[PR] risc-v/k230: add IPI support to speed up RPTUN/RPMSG [nuttx]

yf13 opened a new pull request, #11726:
URL: https://github.com/apache/nuttx/pull/11726

   
   ## Summary
   
   This patch adds inter-processor interrupt support using K230 mailbox device to improve the RPMsg efficiency by reducing polling blindness.
   
   Major changes:
   
   - in arch/risc-v/include/k230:
     - irq.h          add IRQ for IPI devices
   - in arch/risc-v/src/k230:
     - Kconfig        add IPI related config, increase polling delay
     - Make.defs      add k230_ipi.c to CHIP_SRCS
     - k230_hart.c    fix typo, add notes of zero MISA reading w/ NUTTSBI
     - k230_irq.c     use K230_PLIC_IRQS as ext IRQ limit to support IPI
     - k230_rptun.c   add IPI to improve efficiency w/o using extra thread
   - in boards/risc-v/k230/canmv230/configs
     - master         add IPI support
     - remote         add IPI support, enable TMPFS, RPMSGFS etc
   
   New additions:
   
   - in arch/risc-v/src/k230:
     - k230_ipi.h     add K230 IPI related defintions
     - k230_ipi.c     add K230 IPI driver
   
   ## Impact
   
   K230 devices
   
   ## Testing
   
   Checked on CanMV230 device
   


-- 
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


Re: [PR] risc-v/k230: add IPI support to improve RPMsg efficiency [nuttx]

Posted by "yf13 (via GitHub)" <gi...@apache.org>.
yf13 commented on code in PR #11726:
URL: https://github.com/apache/nuttx/pull/11726#discussion_r1496604339


##########
arch/risc-v/src/k230/Kconfig:
##########
@@ -24,20 +24,41 @@ config K230_RPTUN_SHM_SIZE
 
 config K230_RPTUN_IPI
 	bool "use IPI for RPTUN"
-	default n
-	depends on K230_IPI
+	default K230_IPI
 	---help---
 		Use Inter-Processor interruption to improve efficiency.
 		Not ready yet.
 
-
 config K230_RPTUN_WORK_DELAY
 	int "RPTUN work delay"
-	default 50
-	depends on !K230_RPTUN_IPI
+	default 100
 	---help---
-		 Ticks for polling RPTUN. Polling doesn't need IPI.
+		Ticks for polling RPTUN. Polling doesn't depend on IPI and IPI

Review Comment:
   As explained in the comment, the approach used in k230_rptun doesn't want to repeat nrf53_rptun by adding the extra kernel thread as someone may not like the overhead of kernel threads.



-- 
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


Re: [PR] risc-v/k230: add IPI support to speed up RPTUN/RPMSG [nuttx]

Posted by "xiaoxiang781216 (via GitHub)" <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #11726:
URL: https://github.com/apache/nuttx/pull/11726#discussion_r1496196255


##########
arch/risc-v/include/k230/irq.h:
##########
@@ -32,17 +32,21 @@
 /* Map RISC-V exception code to NuttX IRQ */
 
 #ifndef CONFIG_BUILD_KERNEL
-#    define K230_IRQ_TIMER  (RISCV_IRQ_MTIMER)
-#    define K230_IRQ_UART0  (RISCV_IRQ_MEXT + 16)
-#    define K230_IRQ_UART3  (RISCV_IRQ_MEXT + 19)
+#  define K230_IRQ_TIMER  (RISCV_IRQ_MTIMER)
+#  define K230_IRQ_UART0  (RISCV_IRQ_MEXT + 16)
 #else
-#    define K230_IRQ_TIMER  (RISCV_IRQ_STIMER)
-#    define K230_IRQ_UART0  (RISCV_IRQ_SEXT + 16)
-#    define K230_IRQ_UART3  (RISCV_IRQ_SEXT + 19)
+#  define K230_IRQ_TIMER  (RISCV_IRQ_STIMER)
+#  define K230_IRQ_UART0  (RISCV_IRQ_SEXT + 16)
 #endif
 
+#define K230_IRQ_UART3  (K230_IRQ_UART0 + 3)

Review Comment:
   ```suggestion
   #define K230_IRQ_UART3    (K230_IRQ_UART0 + 3)
   ```



##########
arch/risc-v/src/k230/Kconfig:
##########
@@ -24,20 +24,41 @@ config K230_RPTUN_SHM_SIZE
 
 config K230_RPTUN_IPI
 	bool "use IPI for RPTUN"
-	default n
-	depends on K230_IPI
+	default K230_IPI
 	---help---
 		Use Inter-Processor interruption to improve efficiency.
 		Not ready yet.
 
-
 config K230_RPTUN_WORK_DELAY
 	int "RPTUN work delay"
-	default 50
-	depends on !K230_RPTUN_IPI
+	default 100
 	---help---
-		 Ticks for polling RPTUN. Polling doesn't need IPI.
+		Ticks for polling RPTUN. Polling doesn't depend on IPI and IPI

Review Comment:
   why not aleady enable IPI and remove the polling code directly to simplify the code logic?



-- 
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


Re: [PR] risc-v/k230: add IPI support to improve RPMsg efficiency [nuttx]

Posted by "xiaoxiang781216 (via GitHub)" <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #11726:
URL: https://github.com/apache/nuttx/pull/11726#discussion_r1496950584


##########
arch/risc-v/src/k230/Kconfig:
##########
@@ -22,22 +22,25 @@ config K230_RPTUN_SHM_SIZE
 	---help---
 		 RPTUN shared memory size in bytes.
 
-config K230_RPTUN_IPI
-	bool "use IPI for RPTUN"
-	default n
-	depends on K230_IPI
+config K230_RPTUN_IPI_DEV
+	int "IPI device num for RPTUN purpose"
+	default 0
 	---help---
-		Use Inter-Processor interruption to improve efficiency.
-		Not ready yet.
+		Choose the IPI device for RPTUN purpose, should be within 0..3
 
+endif # RPTUN
 
-config K230_RPTUN_WORK_DELAY
-	int "RPTUN work delay"
-	default 50
-	depends on !K230_RPTUN_IPI
-	---help---
-		 Ticks for polling RPTUN. Polling doesn't need IPI.
+config K230_IPI

Review Comment:
   should we remove this Kconfig?



-- 
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


Re: [PR] risc-v/k230: add IPI support to speed up RPTUN/RPMSG [nuttx]

Posted by "yf13 (via GitHub)" <gi...@apache.org>.
yf13 commented on code in PR #11726:
URL: https://github.com/apache/nuttx/pull/11726#discussion_r1496604339


##########
arch/risc-v/src/k230/Kconfig:
##########
@@ -24,20 +24,41 @@ config K230_RPTUN_SHM_SIZE
 
 config K230_RPTUN_IPI
 	bool "use IPI for RPTUN"
-	default n
-	depends on K230_IPI
+	default K230_IPI
 	---help---
 		Use Inter-Processor interruption to improve efficiency.
 		Not ready yet.
 
-
 config K230_RPTUN_WORK_DELAY
 	int "RPTUN work delay"
-	default 50
-	depends on !K230_RPTUN_IPI
+	default 100
 	---help---
-		 Ticks for polling RPTUN. Polling doesn't need IPI.
+		Ticks for polling RPTUN. Polling doesn't depend on IPI and IPI

Review Comment:
   As explained in the comment, the approach used in k230_rptun doesn't want to simply repeat nrf53_rptun's approach by adding the extra kernel thread.  It wants to try how things work w/o adding kernel threads.



-- 
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


Re: [PR] risc-v/k230: add IPI support to speed up RPTUN/RPMSG [nuttx]

Posted by "yf13 (via GitHub)" <gi...@apache.org>.
yf13 commented on code in PR #11726:
URL: https://github.com/apache/nuttx/pull/11726#discussion_r1496604339


##########
arch/risc-v/src/k230/Kconfig:
##########
@@ -24,20 +24,41 @@ config K230_RPTUN_SHM_SIZE
 
 config K230_RPTUN_IPI
 	bool "use IPI for RPTUN"
-	default n
-	depends on K230_IPI
+	default K230_IPI
 	---help---
 		Use Inter-Processor interruption to improve efficiency.
 		Not ready yet.
 
-
 config K230_RPTUN_WORK_DELAY
 	int "RPTUN work delay"
-	default 50
-	depends on !K230_RPTUN_IPI
+	default 100
 	---help---
-		 Ticks for polling RPTUN. Polling doesn't need IPI.
+		Ticks for polling RPTUN. Polling doesn't depend on IPI and IPI

Review Comment:
   As explained in the comment, the approach used in k230_rptun doesn't want to simply repeat nrf53_rptun's approach by adding the extra kernel thread.  It also demostrates how things work differently. 



-- 
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


Re: [PR] risc-v/k230: add IPI support to improve RPMsg efficiency [nuttx]

Posted by "yf13 (via GitHub)" <gi...@apache.org>.
yf13 commented on code in PR #11726:
URL: https://github.com/apache/nuttx/pull/11726#discussion_r1496604339


##########
arch/risc-v/src/k230/Kconfig:
##########
@@ -24,20 +24,41 @@ config K230_RPTUN_SHM_SIZE
 
 config K230_RPTUN_IPI
 	bool "use IPI for RPTUN"
-	default n
-	depends on K230_IPI
+	default K230_IPI
 	---help---
 		Use Inter-Processor interruption to improve efficiency.
 		Not ready yet.
 
-
 config K230_RPTUN_WORK_DELAY
 	int "RPTUN work delay"
-	default 50
-	depends on !K230_RPTUN_IPI
+	default 100
 	---help---
-		 Ticks for polling RPTUN. Polling doesn't need IPI.
+		Ticks for polling RPTUN. Polling doesn't depend on IPI and IPI

Review Comment:
   As explained in the comment, the approach used in k230_rptun doesn't want to repeat nrf53_rptun by adding the extra kernel thread as someone may not like the overhead.



-- 
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


Re: [PR] risc-v/k230: add IPI support to improve RPMsg efficiency [nuttx]

Posted by "xiaoxiang781216 (via GitHub)" <gi...@apache.org>.
xiaoxiang781216 merged PR #11726:
URL: https://github.com/apache/nuttx/pull/11726


-- 
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


Re: [PR] risc-v/k230: add IPI support to improve RPMsg efficiency [nuttx]

Posted by "yf13 (via GitHub)" <gi...@apache.org>.
yf13 commented on code in PR #11726:
URL: https://github.com/apache/nuttx/pull/11726#discussion_r1497057356


##########
arch/risc-v/src/k230/Kconfig:
##########
@@ -22,22 +22,25 @@ config K230_RPTUN_SHM_SIZE
 	---help---
 		 RPTUN shared memory size in bytes.
 
-config K230_RPTUN_IPI
-	bool "use IPI for RPTUN"
-	default n
-	depends on K230_IPI
+config K230_RPTUN_IPI_DEV
+	int "IPI device num for RPTUN purpose"
+	default 0
 	---help---
-		Use Inter-Processor interruption to improve efficiency.
-		Not ready yet.
+		Choose the IPI device for RPTUN purpose, should be within 0..3
 
+endif # RPTUN
 
-config K230_RPTUN_WORK_DELAY
-	int "RPTUN work delay"
-	default 50
-	depends on !K230_RPTUN_IPI
-	---help---
-		 Ticks for polling RPTUN. Polling doesn't need IPI.
+config K230_IPI

Review Comment:
   I am unsure, as there might be other cases needing IPI. For example, someone might want use RPMsglite instead of RPTUN, in such cases they still can use  K230_IPI.



-- 
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


Re: [PR] risc-v/k230: add IPI support to improve RPMsg efficiency [nuttx]

Posted by "yf13 (via GitHub)" <gi...@apache.org>.
yf13 commented on code in PR #11726:
URL: https://github.com/apache/nuttx/pull/11726#discussion_r1497057356


##########
arch/risc-v/src/k230/Kconfig:
##########
@@ -22,22 +22,25 @@ config K230_RPTUN_SHM_SIZE
 	---help---
 		 RPTUN shared memory size in bytes.
 
-config K230_RPTUN_IPI
-	bool "use IPI for RPTUN"
-	default n
-	depends on K230_IPI
+config K230_RPTUN_IPI_DEV
+	int "IPI device num for RPTUN purpose"
+	default 0
 	---help---
-		Use Inter-Processor interruption to improve efficiency.
-		Not ready yet.
+		Choose the IPI device for RPTUN purpose, should be within 0..3
 
+endif # RPTUN
 
-config K230_RPTUN_WORK_DELAY
-	int "RPTUN work delay"
-	default 50
-	depends on !K230_RPTUN_IPI
-	---help---
-		 Ticks for polling RPTUN. Polling doesn't need IPI.
+config K230_IPI

Review Comment:
   I am unsure, as there might be other cases needing IPI. For example, someone might want use RPMsglite instead of RPTUN.



-- 
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


Re: [PR] risc-v/k230: add IPI support to improve RPMsg efficiency [nuttx]

Posted by "yf13 (via GitHub)" <gi...@apache.org>.
yf13 commented on code in PR #11726:
URL: https://github.com/apache/nuttx/pull/11726#discussion_r1496604339


##########
arch/risc-v/src/k230/Kconfig:
##########
@@ -24,20 +24,41 @@ config K230_RPTUN_SHM_SIZE
 
 config K230_RPTUN_IPI
 	bool "use IPI for RPTUN"
-	default n
-	depends on K230_IPI
+	default K230_IPI
 	---help---
 		Use Inter-Processor interruption to improve efficiency.
 		Not ready yet.
 
-
 config K230_RPTUN_WORK_DELAY
 	int "RPTUN work delay"
-	default 50
-	depends on !K230_RPTUN_IPI
+	default 100
 	---help---
-		 Ticks for polling RPTUN. Polling doesn't need IPI.
+		Ticks for polling RPTUN. Polling doesn't depend on IPI and IPI

Review Comment:
   As explained in the comment, the approach used in k230_rptun doesn't want to repeat nrf53_rptun by adding the extra kernel thread as someone may not like the overhead of kernel threads.  It also demostrates that thing can be done differently as using threads is not the only way. 



-- 
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