pussuw commented on code in PR #15396:
URL: https://github.com/apache/nuttx/pull/15396#discussion_r1906703964


##########
arch/risc-v/src/common/riscv_internal.h:
##########
@@ -356,40 +356,24 @@ void riscv_cpu_boot(int cpu);
 int riscv_smp_call_handler(int irq, void *c, void *arg);
 #endif
 
+#ifdef CONFIG_ARCH_RV_CPUID_MAP
 /****************************************************************************
- * Name: riscv_mhartid
+ * Name: riscv_mhartid / riscv_hartid_to_cpuid / riscv_cpuid_to_hartid
  *
  * Description:
- *   Context aware way to query hart id (physical core ID)
- *
- * Returned Value:
- *   Hart id
+ *   CPU ID mapping functions for systems where physical hart IDs don't match
+ *   logical CPU IDs.
  *
  ****************************************************************************/
 
 uintptr_t riscv_mhartid(void);
-
-/****************************************************************************
- * Name: riscv_hartid_to_cpuid
- *
- * Description:
- *   Convert physical core number to logical core number. Default
- *   implementation is 1:1 mapping, i.e. physical=logical.
- *
- ****************************************************************************/
-
 int riscv_hartid_to_cpuid(int hart);
-
-/****************************************************************************
- * Name: riscv_cpuid_to_hartid
- *
- * Description:
- *   Convert logical core number to physical core number. Default
- *   implementation is 1:1 mapping, i.e. physical=logical.
- *
- ****************************************************************************/
-
 int riscv_cpuid_to_hartid(int cpu);
+#else
+#define riscv_mhartid()             (up_cpu_index())

Review Comment:
   This could be done the other way around as well:
   
   `#define up_cpu_index() (riscv_mhartid())`



-- 
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-unsubscr...@nuttx.apache.org

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

Reply via email to