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/04/12 10:02:13 UTC

[GitHub] [incubator-nuttx] pussuw opened a new pull request, #6050: RISC-V: Move mhartid to own assembly macro+function

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

   Hartid and cpuindex are not the same thing. Hartid is needed regardless
   of SMP, for external interrupt handling etc.
   
   SMP needs cpuindex which might not be index == hartid, so both are
   needed. IMO it is clearer to provide separate API for both.
   
   Currently the implementation of up_cpu_index is done a bit lazily,
   because it assumes hartid == cpu index, but this is not 100% accurate,
   so it is still missing some logic.
   
   ## Summary
   Separates SMP cpuindex and mhartid
   ## Impact
   De-couples two unrelated things from each other
   ## Testing
   MPFS icicle:knsh
   


-- 
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] jerpelea merged pull request #6050: RISC-V: Move mhartid to own assembly macro+function

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


-- 
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] pussuw commented on pull request #6050: RISC-V: Move mhartid to own assembly macro+function

Posted by GitBox <gi...@apache.org>.
pussuw commented on PR #6050:
URL: https://github.com/apache/incubator-nuttx/pull/6050#issuecomment-1096761848

   Hmm, tried to fix it via the webui and made a mess. I'll try to fix it and if it's not possible I'll fix it tomorrow properly.


-- 
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] pussuw commented on a diff in pull request #6050: RISC-V: Move mhartid to own assembly macro+function

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


##########
arch/risc-v/src/common/riscv_macros.S:
##########
@@ -152,3 +152,23 @@
 .endm
 #endif /* !defined(CONFIG_SMP) && !defined(CONFIG_ARCH_USE_S_MODE) */
 #endif /* CONFIG_ARCH_INTERRUPTSTACK > 15 */
+
+/****************************************************************************
+ * Name: riscv_mhartid
+ *
+ * Description:
+ *   Context aware way to query hart id
+ *
+ * Returned Value:
+ *   Hart id
+ *
+ ****************************************************************************/
+
+.macro  riscv_mhartid out
+#ifdef CONFIG_ARCH_USE_S_MODE
+  csrr    \out, CSR_SCRATCH
+  REGLOAD \out, RISCV_PERCPU_HARTID(a0)

Review Comment:
   ```suggestion
     REGLOAD \out, RISCV_PERCPU_HARTID(\out)
   ```



-- 
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] pussuw commented on a diff in pull request #6050: RISC-V: Move mhartid to own assembly macro+function

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


##########
arch/risc-v/src/common/riscv_macros.S:
##########
@@ -152,3 +152,23 @@
 .endm
 #endif /* !defined(CONFIG_SMP) && !defined(CONFIG_ARCH_USE_S_MODE) */
 #endif /* CONFIG_ARCH_INTERRUPTSTACK > 15 */
+
+/****************************************************************************
+ * Name: riscv_mhartid
+ *
+ * Description:
+ *   Context aware way to query hart id
+ *
+ * Returned Value:
+ *   Hart id
+ *
+ ****************************************************************************/
+
+.macro  riscv_mhartid out
+#ifdef CONFIG_ARCH_USE_S_MODE
+  csrr    \out, CSR_SCRATCH
+  REGLOAD \out, RISCV_PERCPU_HARTID(a0)

Review Comment:
   bug here, a0 should be \out :(



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