You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by "qinwei2004 (via GitHub)" <gi...@apache.org> on 2023/02/27 02:06:40 UTC

[GitHub] [nuttx] qinwei2004 opened a new pull request, #8665: arm64: ARMv8-r(Cortex-R82) support

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

   ## Summary
      Adding armv8-r(Cortex-R82) support and modify some
   common code to fit the change
   
   Note:
   1. ostest is PASSED at qemu and fvp ( single core and SMP)
   2. MPU support for Cortex-R82 is testing with FVP, FVP will commit at next PR
   
   ## Impact
   1. a64 need to check if work normal, please @lupyuen to check
   2. I test with qemu-armv8a:nsh and qemu-armv8a:nsh_smp, other config maybe need to check
   
   ## Testing
   1. ostest is PASSED at qemu and fvp ( single core and SMP), FVP will commit at next PR
   


-- 
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] [nuttx] masayuki2009 commented on pull request #8665: arm64: ARMv8-r(Cortex-R82) support

Posted by "masayuki2009 (via GitHub)" <gi...@apache.org>.
masayuki2009 commented on PR #8665:
URL: https://github.com/apache/nuttx/pull/8665#issuecomment-1447340400

   @qinwei2004 
   I think we should divide one commit into smaller ones. For example, PSCI related changs. MPIDR related changes, Cortex-R related changes and so on.
   


-- 
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] [nuttx] xiaoxiang781216 merged pull request #8665: arm64: ARMv8-r(Cortex-R82) support

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


-- 
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] [nuttx] lupyuen commented on pull request #8665: arm64: ARMv8-r(Cortex-R82) support

Posted by "lupyuen (via GitHub)" <gi...@apache.org>.
lupyuen commented on PR #8665:
URL: https://github.com/apache/nuttx/pull/8665#issuecomment-1445630200

   @qinwei2004 All OK, `pinephone:nsh` tested successfully with https://github.com/qinwei2004/incubator-nuttx/tree/temp-submit-20230227-armv8r
   
   Thanks :-)
   
   ```text
   DRAM: 2048 MiB
   Trying to boot from MMC1
   NOTICE:  BL31: v2.2(release):v2.2-904-gf9ea3a629
   NOTICE:  BL31: Built : 15:32:12, Apr  9 2020
   NOTICE:  BL31: Detected Allwinner A64/H64/R18 SoC (1689)
   NOTICE:  BL31: Found U-Boot DTB at 0x4064410, model: PinePhone
   NOTICE:  PSCI: System suspend is unavailable
   
   
   U-Boot 2020.07 (Nov 08 2020 - 00:15:12 +0100)
   
   DRAM:  2 GiB
   MMC:   Device 'mmc@1c11000': seq 1 is in use by 'mmc@1c10000'
   mmc@1c0f000: 0, mmc@1c10000: 2, mmc@1c11000: 1
   Loading Environment from FAT... *** Warning - bad CRC, using default environment
   
   starting USB...
   No working controllers found
   Hit any key to stop autoboot:  0 
   switch to partitions #0, OK
   mmc0 is current device
   Scanning mmc 0:1...
   Found U-Boot script /boot.scr
   653 bytes read in 3 ms (211.9 KiB/s)
   ## Executing script at 4fc00000
   gpio: pin 114 (gpio 114) value is 1
   103378 bytes read in 9 ms (11 MiB/s)
   Uncompressed size: 274432 = 0x43000
   36162 bytes read in 4 ms (8.6 MiB/s)
   1078500 bytes read in 51 ms (20.2 MiB/s)
   ## Flattened Device Tree blob at 4fa00000
      Booting using the fdt blob at 0x4fa00000
      Loading Ramdisk to 49ef8000, end 49fff4e4 ... OK
      Loading Device Tree to 0000000049eec000, end 0000000049ef7d41 ... OK
   
   Starting kernel ...
   
   nsh: mkfatfs: command not found
   
   NuttShell (NSH) NuttX-10.3.0-RC4
   nsh> uname -a
   NuttX 10.3.0-RC4 92b77a1 Feb 27 2023 11:01:10 arm64 pinephone
   nsh> 
   ```


-- 
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] [nuttx] xiaoxiang781216 commented on a diff in pull request #8665: arm64: ARMv8-r(Cortex-R82) support

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


##########
arch/arm64/src/common/arm64_arch.h:
##########
@@ -529,6 +539,44 @@ void arm64_cpu_enable(void);
 #  define arm64_cpu_enable()
 #endif
 
+/****************************************************************************
+ * Name: arm64_get_mpidr/arm64_get_cpuindex
+ *
+ * Description:
+ *   The function from cpu index to get cpu mpid which is reading
+ * from mpidr_el1 register, the register is define:
+ *   - bit 0~7:   Aff0
+ *   - bit 8~15:  Aff1
+ *   - bit 16~23: Aff2
+ *   - bit 24:    MT, multithreading
+ *   - bit 25~29: RES0
+ *   - bit 30:    U, multiprocessor/Uniprocessor
+ *   - bit 31:    RES1
+ *   - bit 32~39: Aff3
+ *   - bit 40~63: RES0
+ *   Different ARM64 Core will use different Affn define, the mpidr_el1
+ *  value is not CPU number, So we need to change CPU number to mpid
+ *  and vice versa
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_SMP
+extern const struct arm64_cpu_info g_arm64_cpu_info[CONFIG_SMP_NCPUS];
+uint64_t arm64_get_cpumpid(int cpu);
+int arm64_get_cpu(uint64_t mpid);

Review Comment:
   why not let chip implement up_cpu_index directly



##########
arch/arm64/src/common/arm64_arch.h:
##########
@@ -529,6 +539,44 @@ void arm64_cpu_enable(void);
 #  define arm64_cpu_enable()
 #endif
 
+/****************************************************************************
+ * Name: arm64_get_mpidr/arm64_get_cpuindex
+ *
+ * Description:
+ *   The function from cpu index to get cpu mpid which is reading
+ * from mpidr_el1 register, the register is define:
+ *   - bit 0~7:   Aff0
+ *   - bit 8~15:  Aff1
+ *   - bit 16~23: Aff2
+ *   - bit 24:    MT, multithreading
+ *   - bit 25~29: RES0
+ *   - bit 30:    U, multiprocessor/Uniprocessor
+ *   - bit 31:    RES1
+ *   - bit 32~39: Aff3
+ *   - bit 40~63: RES0
+ *   Different ARM64 Core will use different Affn define, the mpidr_el1
+ *  value is not CPU number, So we need to change CPU number to mpid
+ *  and vice versa
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_SMP
+extern const struct arm64_cpu_info g_arm64_cpu_info[CONFIG_SMP_NCPUS];
+uint64_t arm64_get_cpumpid(int cpu);

Review Comment:
   arm64_get_mpid



-- 
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] [nuttx] lupyuen commented on pull request #8665: arm64: ARMv8-r(Cortex-R82) support

Posted by "lupyuen (via GitHub)" <gi...@apache.org>.
lupyuen commented on PR #8665:
URL: https://github.com/apache/nuttx/pull/8665#issuecomment-1445615109

   @qinwei2004 Thanks I'm testing on PinePhone now...


-- 
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] [nuttx] qinwei2004 commented on pull request #8665: arm64: ARMv8-r(Cortex-R82) support

Posted by "qinwei2004 (via GitHub)" <gi...@apache.org>.
qinwei2004 commented on PR #8665:
URL: https://github.com/apache/nuttx/pull/8665#issuecomment-1448191250

   > @qinwei2004 I think we should divide one commit into smaller ones. For example, PSCI related changs. MPIDR related changes, Cortex-R related changes and so on.
   
   all done, please check again and I will submit FVP change in next PR


-- 
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] [nuttx] xiaoxiang781216 commented on a diff in pull request #8665: arm64: ARMv8-r(Cortex-R82) support

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


##########
arch/arm64/src/common/arm64_arch.h:
##########
@@ -529,6 +539,44 @@ void arm64_cpu_enable(void);
 #  define arm64_cpu_enable()
 #endif
 
+/****************************************************************************
+ * Name: arm64_get_mpidr/arm64_get_cpuindex
+ *
+ * Description:
+ *   The function from cpu index to get cpu mpid which is reading
+ * from mpidr_el1 register, the register is define:
+ *   - bit 0~7:   Aff0
+ *   - bit 8~15:  Aff1
+ *   - bit 16~23: Aff2
+ *   - bit 24:    MT, multithreading
+ *   - bit 25~29: RES0
+ *   - bit 30:    U, multiprocessor/Uniprocessor
+ *   - bit 31:    RES1
+ *   - bit 32~39: Aff3
+ *   - bit 40~63: RES0
+ *   Different ARM64 Core will use different Affn define, the mpidr_el1
+ *  value is not CPU number, So we need to change CPU number to mpid
+ *  and vice versa
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_SMP
+extern const struct arm64_cpu_info g_arm64_cpu_info[CONFIG_SMP_NCPUS];

Review Comment:
   remove



-- 
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] [nuttx] xiaoxiang781216 commented on a diff in pull request #8665: arm64: ARMv8-r(Cortex-R82) support

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


##########
arch/arm64/src/common/arm64_arch.h:
##########
@@ -529,6 +539,44 @@ void arm64_cpu_enable(void);
 #  define arm64_cpu_enable()
 #endif
 
+/****************************************************************************
+ * Name: arm64_get_mpidr/arm64_get_cpuindex
+ *
+ * Description:
+ *   The function from cpu index to get cpu mpid which is reading
+ * from mpidr_el1 register, the register is define:
+ *   - bit 0~7:   Aff0
+ *   - bit 8~15:  Aff1
+ *   - bit 16~23: Aff2
+ *   - bit 24:    MT, multithreading
+ *   - bit 25~29: RES0
+ *   - bit 30:    U, multiprocessor/Uniprocessor
+ *   - bit 31:    RES1
+ *   - bit 32~39: Aff3
+ *   - bit 40~63: RES0
+ *   Different ARM64 Core will use different Affn define, the mpidr_el1
+ *  value is not CPU number, So we need to change CPU number to mpid
+ *  and vice versa
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_SMP
+extern const struct arm64_cpu_info g_arm64_cpu_info[CONFIG_SMP_NCPUS];
+uint64_t arm64_get_cpumpid(int cpu);

Review Comment:
   why not reuse up_cpu_index



-- 
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] [nuttx] qinwei2004 commented on a diff in pull request #8665: arm64: ARMv8-r(Cortex-R82) support

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


##########
arch/arm64/src/common/arm64_gicv3.c:
##########
@@ -170,7 +196,7 @@ void arm64_gic_irq_enable(unsigned int intid)
   if (GIC_IS_SPI(intid))
     {
       putreg64(MPIDR_TO_CORE(GET_MPIDR()),
-               IROUTER(GET_DIST_BASE(intid), intid));
+              IROUTER(GET_DIST_BASE(intid), intid));

Review Comment:
   commit 0fd1de1ceaff0af1495ca3a9370dc102d146afc1
   seem change this,please check



-- 
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] [nuttx] xiaoxiang781216 commented on a diff in pull request #8665: arm64: ARMv8-r(Cortex-R82) support

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


##########
arch/arm64/src/common/arm64_gicv3.c:
##########
@@ -170,7 +196,7 @@ void arm64_gic_irq_enable(unsigned int intid)
   if (GIC_IS_SPI(intid))
     {
       putreg64(MPIDR_TO_CORE(GET_MPIDR()),
-               IROUTER(GET_DIST_BASE(intid), intid));
+              IROUTER(GET_DIST_BASE(intid), intid));

Review Comment:
   revert?



##########
arch/arm64/src/common/arm64_head.S:
##########
@@ -174,8 +196,14 @@ primary_core:
     bl    up_earlyserialinit
 #endif
 
-cpu_boot:
+#ifdef CONFIG_SMP
+    PRINT(primary_boot, "- Ready to Boot Primary CPU\r\n")
+#else
     PRINT(cpu_boot, "- Ready to Boot CPU\r\n")

Review Comment:
   remove, let's allways: print  Ready to Boot Primary CPU



-- 
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] [nuttx] xiaoxiang781216 commented on a diff in pull request #8665: arm64: ARMv8-r(Cortex-R82) support

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


##########
arch/arm64/src/common/arm64_arch.h:
##########
@@ -529,6 +539,44 @@ void arm64_cpu_enable(void);
 #  define arm64_cpu_enable()
 #endif
 
+/****************************************************************************
+ * Name: arm64_get_mpidr/arm64_get_cpuindex
+ *
+ * Description:
+ *   The function from cpu index to get cpu mpid which is reading
+ * from mpidr_el1 register, the register is define:
+ *   - bit 0~7:   Aff0
+ *   - bit 8~15:  Aff1
+ *   - bit 16~23: Aff2
+ *   - bit 24:    MT, multithreading
+ *   - bit 25~29: RES0
+ *   - bit 30:    U, multiprocessor/Uniprocessor
+ *   - bit 31:    RES1
+ *   - bit 32~39: Aff3
+ *   - bit 40~63: RES0
+ *   Different ARM64 Core will use different Affn define, the mpidr_el1
+ *  value is not CPU number, So we need to change CPU number to mpid
+ *  and vice versa
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_SMP
+extern const struct arm64_cpu_info g_arm64_cpu_info[CONFIG_SMP_NCPUS];

Review Comment:
   remove



##########
arch/arm64/src/common/arm64_arch.h:
##########
@@ -529,6 +539,44 @@ void arm64_cpu_enable(void);
 #  define arm64_cpu_enable()
 #endif
 
+/****************************************************************************
+ * Name: arm64_get_mpidr/arm64_get_cpuindex
+ *
+ * Description:
+ *   The function from cpu index to get cpu mpid which is reading
+ * from mpidr_el1 register, the register is define:
+ *   - bit 0~7:   Aff0
+ *   - bit 8~15:  Aff1
+ *   - bit 16~23: Aff2
+ *   - bit 24:    MT, multithreading
+ *   - bit 25~29: RES0
+ *   - bit 30:    U, multiprocessor/Uniprocessor
+ *   - bit 31:    RES1
+ *   - bit 32~39: Aff3
+ *   - bit 40~63: RES0
+ *   Different ARM64 Core will use different Affn define, the mpidr_el1
+ *  value is not CPU number, So we need to change CPU number to mpid
+ *  and vice versa
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_SMP
+extern const struct arm64_cpu_info g_arm64_cpu_info[CONFIG_SMP_NCPUS];
+uint64_t arm64_get_cpumpid(int cpu);

Review Comment:
   why not reuse up_cpu_index



-- 
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] [nuttx] xiaoxiang781216 commented on a diff in pull request #8665: arm64: ARMv8-r(Cortex-R82) support

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


##########
arch/arm64/src/common/arm64_gicv3.c:
##########
@@ -577,8 +613,8 @@ static void arm64_gic_init(void)
   int       err;
 
   cpu               = this_cpu();
-  gic_rdists[cpu]   = CONFIG_GICR_BASE +
-                     MPIDR_TO_CORE(GET_MPIDR()) * 0x20000;
+
+  gic_rdists[cpu]   = g_arm64_cpu_info[cpu].gicr_base;

Review Comment:
   can we add arm64_gic_get_gicr_base or change 0x20000 to a macro defined in chip.h?



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