Skip to contentSkip to conversation

XEN/ARM: Add Odroid-XU3/XU4 support

PATCH In review Suriyan Ramasami 2 participants 11 messages Feb 9, 2016 – Feb 17, 2016 Arm Samsung Exynos

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 XEN/ARM: Add Odroid-XU3/XU4 support

The Odroid-XU3/XU4 from hardkernel is an Exynos 5422 based board. Code from mcpm-exynos.c and mcpm-platsmp.c from the Linux kernel has been used to get all the 8 cores from the 2 clusters powered on.
The Linux DTS for these odroid uses "samsung,exynos5800" as the machine compatible string. Hence, the same is used herein.

This change has been tested on the Odroid-XU/XU3/XU4.

---
Changes between versions as follows:

v2:
Try to use common code as much as possible

v1:
Initial code submission

---
 xen/arch/arm/platforms/exynos5.c | 61 ++++++++++++++++++++++++++++++++++++++--
 1 file changed, 58 insertions(+), 3 deletions(-)
xen/arch/arm/platforms/exynos5.c +58 -3
index bf4964d..12aea31 100644
@@ -34,9 +34,18 @@ static bool_t secure_firmware;
 #define EXYNOS_ARM_CORE_CONFIG(_nr) (EXYNOS_ARM_CORE0_CONFIG + (0x80 * (_nr)))
 #define EXYNOS_ARM_CORE_STATUS(_nr) (EXYNOS_ARM_CORE_CONFIG(_nr) + 0x4)
 #define S5P_CORE_LOCAL_PWR_EN       0x3
+#define S5P_PMU_SPARE2              0x908
 
 #define SMC_CMD_CPU1BOOT            (-4)
 
+#define EXYNOS5800_CPUS_PER_CLUSTER 4
+
+#define EXYNOS5420_KFC_CORE_RESET0  BIT(8)
+#define EXYNOS5420_KFC_ETM_RESET0   BIT(20)
+
+#define EXYNOS5420_KFC_CORE_RESET(_nr) \
+        ((EXYNOS5420_KFC_CORE_RESET0 | EXYNOS5420_KFC_ETM_RESET0) << (_nr))
+
 static int exynos5_init_time(void)
 {
     uint32_t reg;
@@ -166,14 +175,23 @@ static void exynos_cpu_power_up(void __iomem *power, int cpu)
 static int exynos5_cpu_power_up(void __iomem *power, int cpu)
 {
     unsigned int timeout;
+    unsigned int mpidr, pcpu, pcluster, cpunr;
+
+    mpidr = cpu_logical_map(cpu);
+    pcpu = MPIDR_AFFINITY_LEVEL(mpidr, 0);
+    pcluster = MPIDR_AFFINITY_LEVEL(mpidr, 1);
 
-    if ( !exynos_cpu_power_state(power, cpu) )
+    cpunr = pcpu + (pcluster * EXYNOS5800_CPUS_PER_CLUSTER);
+    dprintk(XENLOG_DEBUG, "cpu: %d pcpu: %d, cluster: %d cpunr: %d\n",
+            cpu, pcpu, pcluster, cpunr);
+
+    if ( !exynos_cpu_power_state(power, cpunr) )
     {
-        exynos_cpu_power_up(power, cpu);
+        exynos_cpu_power_up(power, cpunr);
         timeout = 10;
 
         /* wait max 10 ms until cpu is on */
-        while ( exynos_cpu_power_state(power, cpu) != S5P_CORE_LOCAL_PWR_EN )
+        while ( exynos_cpu_power_state(power, cpunr) != S5P_CORE_LOCAL_PWR_EN )
         {
             if ( timeout-- == 0 )
                 break;
@@ -186,6 +204,42 @@ static int exynos5_cpu_power_up(void __iomem *power, int cpu)
             dprintk(XENLOG_ERR, "CPU%d power enable failed\n", cpu);
             return -ETIMEDOUT;
         }
+
+        /*
+         * This assumes the cluster number of the big cores(Cortex A15)
+         * is 0 and the Little cores(Cortex A7) is 1.
+         * When the system was booted from the Little core,
+         * they should be reset during power up cpu.
+         * Note that the below condition is true for Odroid XU3/XU4, and
+         * false for the XU and the Exynos5800 based boards.
+         */
+        if ( pcluster &&
+             pcluster == MPIDR_AFFINITY_LEVEL(cpu_logical_map(0), 1) ) {
+            /*
+             * Before we reset the Little cores, we should wait
+             * the SPARE2 register is set to 1 because the init
+             * codes of the iROM will set the register after
+             * initialization.
+            */
+
+            /* wait max 10ms for the spare register to be set to 1 */
+            timeout = 10;
+            while ( !__raw_readl(power + S5P_PMU_SPARE2) )
+            {
+                if ( timeout-- == 0 )
+                    break;
+
+                mdelay(1);
+            }
+
+            if ( timeout == 0 )
+            {
+                dprintk(XENLOG_ERR, "CPU%d SPARE2 register wait failed\n", cpu);
+                return -ETIMEDOUT;
+            }
+            __raw_writel(EXYNOS5420_KFC_CORE_RESET(cpu),
+                         power + EXYNOS5_SWRESET);
+        }
     }
     return 0;
 }
@@ -298,6 +352,7 @@ static const char * const exynos5250_dt_compat[] __initconst =
 static const char * const exynos5_dt_compat[] __initconst =
 {
     "samsung,exynos5410",
+    "samsung,exynos5800",
     NULL
 };
 
Signature · 1 line
2.5.0
#1 lore raw
Quoted 10 lines · Suriyan Ramasami

The Odroid-XU3/XU4 from hardkernel is an Exynos 5422 based board. Code from mcpm-exynos.c and mcpm-platsmp.c from the Linux kernel has been used to get all the 8 cores from the 2 clusters powered on.
The Linux DTS for these odroid uses "samsung,exynos5800" as the machine compatible string. Hence, the same is used herein.

This change has been tested on the Odroid-XU/XU3/XU4.

Thanks, this now looks good to me, with one question about a comment which I could resolve upon commit if we agree a wording.

Quoted 72 lines

---
Changes between versions as follows:

v2:
Try to use common code as much as possible

v1:
Initial code submission
---
 xen/arch/arm/platforms/exynos5.c | 61
++++++++++++++++++++++++++++++++++++++--

 1 file changed, 58 insertions(+), 3 deletions(-)
xen/arch/arm/platforms/exynos5.c +1 -0
index bf4964d..12aea31 100644
@@ -34,9 +34,18 @@ static bool_t secure_firmware;
  #define EXYNOS_ARM_CORE_CONFIG(_nr) (EXYNOS_ARM_CORE0_CONFIG + (0x80 *
 (_nr)))
  #define EXYNOS_ARM_CORE_STATUS(_nr) (EXYNOS_ARM_CORE_CONFIG(_nr) + 0x4)
  #define S5P_CORE_LOCAL_PWR_EN       0x3
+#define S5P_PMU_SPARE2              0x908


 #define SMC_CMD_CPU1BOOT            (-4)

xen/arch/arm/platforms/exynos5.c +7 -0
+#define EXYNOS5800_CPUS_PER_CLUSTER 4
+
+#define EXYNOS5420_KFC_CORE_RESET0  BIT(8)
+#define EXYNOS5420_KFC_ETM_RESET0   BIT(20)
+
+#define EXYNOS5420_KFC_CORE_RESET(_nr) \
+        ((EXYNOS5420_KFC_CORE_RESET0 | EXYNOS5420_KFC_ETM_RESET0) <<

(_nr))
+
 static int exynos5_init_time(void)
 {
     uint32_t reg;

xen/arch/arm/platforms/exynos5.c +5 -0
@@ -166,14 +175,23 @@ static void exynos_cpu_power_up(void __iomem
 *power, int cpu)
  static int exynos5_cpu_power_up(void __iomem *power, int cpu)
  {
      unsigned int timeout;
+    unsigned int mpidr, pcpu, pcluster, cpunr;
+
+    mpidr = cpu_logical_map(cpu);
+    pcpu = MPIDR_AFFINITY_LEVEL(mpidr, 0);
+    pcluster = MPIDR_AFFINITY_LEVEL(mpidr, 1);


-    if ( !exynos_cpu_power_state(power, cpu) )
+    cpunr = pcpu + (pcluster * EXYNOS5800_CPUS_PER_CLUSTER); +    dprintk(XENLOG_DEBUG, "cpu: %d pcpu: %d, cluster: %d cpunr: %d\n", +            cpu, pcpu, pcluster, cpunr);
+
+    if ( !exynos_cpu_power_state(power, cpunr) )
     {
-        exynos_cpu_power_up(power, cpu);
+        exynos_cpu_power_up(power, cpunr);
         timeout = 10;

         /* wait max 10 ms until cpu is on */
-        while ( exynos_cpu_power_state(power, cpu) != S5P_CORE_LOCAL_PWR_EN )
+        while ( exynos_cpu_power_state(power, cpunr) != S5P_CORE_LOCAL_PWR_EN )
         {
             if ( timeout-- == 0 )
                 break;

xen/arch/arm/platforms/exynos5.c +0 -0
@@ -186,6 +204,42 @@ static int exynos5_cpu_power_up(void __iomem *power,
 int cpu)
              dprintk(XENLOG_ERR, "CPU%d power enable failed\n", cpu);

xen/arch/arm/platforms/exynos5.c static int exynos5_cpu_power_up(void __iomem *power, · line 215

Quoted 10 lines
xen/arch/arm/platforms/exynos5.c +8 -0
              return -ETIMEDOUT;
          }
+
+        /*
+         * This assumes the cluster number of the big cores(Cortex A15)
+         * is 0 and the Little cores(Cortex A7) is 1.
+         * When the system was booted from the Little core,
+         * they should be reset during power up cpu.
+         * Note that the below condition is true for Odroid XU3/XU4, and
+         * false for the XU and the Exynos5800 based boards.

I think the SoC is more relevant/useful in this context than specific boards. So I think what it is trying to say here is that for systems matching samsung,exynos5410 pcluster will always be zero, where as for ones matching samsung,exynos5800 it can be non-zero, and for non-zero clusters we need to do some extra bringup.

I think the comment should therefore focus on the SoC (maybe giving some examples of systems, but such a list cannot be exhaustive and could be omitted IMHO). How about:

This assumes the cluster number of the big cores (Cortex A15) is 0 and the Little cores (Cortex A7) is 1.

When the system was booted from the Little core they should be reset during power up cpu.

Note that only exynos5800 based SoCs have a pcluster==1 of little cores, for exynos5410 there is only pcluster==0.

?

I would also consider perhaps moving the comment up to where pcluster is calculated, and in particular near the:

    cpunr = pcpu + (pcluster * EXYNOS5800_CPUS_PER_CLUSTER);

Since this also relies on pcluster==0 for !5800 systems.

What do you think? I could adjust the comment wording and placement on commit if you are happy.

I have one other question -- does this patch result in a Xen system which consists of both A7 and A15 pcpus being live at the same time? Does that actually work given the subtle differences in things like the cache line length? I would expect there to need to be other patches to support a heterogeneous core configuration.

Hopefully I've just misunderstood and the effect of this patch is to switch to just running the A15 processors even after booting on the A7s.

Ian.

Quoted 33 lines
xen/arch/arm/platforms/exynos5.c +28 -0
+         */
+        if ( pcluster &&
+             pcluster == MPIDR_AFFINITY_LEVEL(cpu_logical_map(0), 1) ) {
+            /*
+             * Before we reset the Little cores, we should wait
+             * the SPARE2 register is set to 1 because the init
+             * codes of the iROM will set the register after
+             * initialization.
+            */
+
+            /* wait max 10ms for the spare register to be set to 1 */
+            timeout = 10;
+            while ( !__raw_readl(power + S5P_PMU_SPARE2) )
+            {
+                if ( timeout-- == 0 )
+                    break;
+
+                mdelay(1);
+            }
+
+            if ( timeout == 0 )
+            {
+                dprintk(XENLOG_ERR, "CPU%d SPARE2 register wait
 failed\n", cpu);
+                return -ETIMEDOUT;
+            }
+            __raw_writel(EXYNOS5420_KFC_CORE_RESET(cpu),
+                         power + EXYNOS5_SWRESET);
+        }
      }

     return 0;
 }

xen/arch/arm/platforms/exynos5.c +0 -0
@@ -298,6 +352,7 @@ static const char * const exynos5250_dt_compat[]
Quoted 8 lines

__initconst =
 static const char * const exynos5_dt_compat[] __initconst = {
     "samsung,exynos5410",
+    "samsung,exynos5800",
     NULL
 };

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#2 lore raw
Quoted 95 lines · Ian Campbell
Quoted 10 lines · Suriyan Ramasami

The Odroid-XU3/XU4 from hardkernel is an Exynos 5422 based board. Code from mcpm-exynos.c and mcpm-platsmp.c from the Linux kernel has been used to get all the 8 cores from the 2 clusters powered on.
The Linux DTS for these odroid uses "samsung,exynos5800" as the machine compatible string. Hence, the same is used herein.

This change has been tested on the Odroid-XU/XU3/XU4.

Thanks, this now looks good to me, with one question about a comment which I could resolve upon commit if we agree a wording.

Quoted 80 lines

---
Changes between versions as follows:

v2:
Try to use common code as much as possible

v1:
Initial code submission

---
 xen/arch/arm/platforms/exynos5.c | 61
++++++++++++++++++++++++++++++++++++++--
 1 file changed, 58 insertions(+), 3 deletions(-)
xen/arch/arm/platforms/exynos5.c +9 -0
index bf4964d..12aea31 100644
@@ -34,9 +34,18 @@ static bool_t secure_firmware;
 #define EXYNOS_ARM_CORE_CONFIG(_nr) (EXYNOS_ARM_CORE0_CONFIG + (0x80 *
 (_nr)))
 #define EXYNOS_ARM_CORE_STATUS(_nr) (EXYNOS_ARM_CORE_CONFIG(_nr) + 0x4)
 #define S5P_CORE_LOCAL_PWR_EN       0x3
+#define S5P_PMU_SPARE2              0x908
 
 #define SMC_CMD_CPU1BOOT            (-4)
 
+#define EXYNOS5800_CPUS_PER_CLUSTER 4
+
+#define EXYNOS5420_KFC_CORE_RESET0  BIT(8)
+#define EXYNOS5420_KFC_ETM_RESET0   BIT(20)
+
+#define EXYNOS5420_KFC_CORE_RESET(_nr) \
+        ((EXYNOS5420_KFC_CORE_RESET0 | EXYNOS5420_KFC_ETM_RESET0) <<
 (_nr))
+
 static int exynos5_init_time(void)
 {
     uint32_t reg;
xen/arch/arm/platforms/exynos5.c +12 -3
@@ -166,14 +175,23 @@ static void exynos_cpu_power_up(void __iomem
 *power, int cpu)
 static int exynos5_cpu_power_up(void __iomem *power, int cpu)
 {
     unsigned int timeout;
+    unsigned int mpidr, pcpu, pcluster, cpunr;
+
+    mpidr = cpu_logical_map(cpu);
+    pcpu = MPIDR_AFFINITY_LEVEL(mpidr, 0);
+    pcluster = MPIDR_AFFINITY_LEVEL(mpidr, 1);
 
-    if ( !exynos_cpu_power_state(power, cpu) )
+    cpunr = pcpu + (pcluster * EXYNOS5800_CPUS_PER_CLUSTER);
+    dprintk(XENLOG_DEBUG, "cpu: %d pcpu: %d, cluster: %d cpunr: %d\n",
+            cpu, pcpu, pcluster, cpunr);
+
+    if ( !exynos_cpu_power_state(power, cpunr) )
     {
-        exynos_cpu_power_up(power, cpu);
+        exynos_cpu_power_up(power, cpunr);
         timeout = 10;
 
         /* wait max 10 ms until cpu is on */
-        while ( exynos_cpu_power_state(power, cpu) !=
 S5P_CORE_LOCAL_PWR_EN )
+        while ( exynos_cpu_power_state(power, cpunr) !=
 S5P_CORE_LOCAL_PWR_EN )
         {
             if ( timeout-- == 0 )
                 break;
xen/arch/arm/platforms/exynos5.c +6 -0
@@ -186,6 +204,42 @@ static int exynos5_cpu_power_up(void __iomem *power,
 int cpu)
             dprintk(XENLOG_ERR, "CPU%d power enable failed\n", cpu);
             return -ETIMEDOUT;
         }
+
+        /*
+         * This assumes the cluster number of the big cores(Cortex A15)
+         * is 0 and the Little cores(Cortex A7) is 1.
+         * When the system was booted from the Little core,
+         * they should be reset during power up cpu.
Quoted 10 lines

xen/arch/arm/platforms/exynos5.c static int exynos5_cpu_power_up(void __iomem *power, int cpu) · line 214

Quoted 2 lines
xen/arch/arm/platforms/exynos5.c +2 -0
+         * Note that the below condition is true for Odroid XU3/XU4, and
+         * false for the XU and the Exynos5800 based boards.

I think the SoC is more relevant/useful in this context than specific boards. So I think what it is trying to say here is that for systems matching samsung,exynos5410 pcluster will always be zero, where as for ones matching samsung,exynos5800 it can be non-zero, and for non-zero clusters we need to do some extra bringup.

I believe for some SoCs its board based (5422 = pin controlled) and for others its purely SoC based (5420 = A7 boot, 5800 = A15 boot). For example, please look at this post: https://lkml.org/lkml/2015/12/11/107 which mentions something along those lines.

I think the comment should therefore focus on the SoC (maybe giving some

Quoted 6 lines

examples of systems, but such a list cannot be exhaustive and could be omitted IMHO). How about:

This assumes the cluster number of the big cores (Cortex A15) is 0 and the Little cores (Cortex A7) is 1.

Quoted 9 lines

When the system was booted from the Little core they should be reset during power up cpu.

Note that only exynos5800 based SoCs have a pcluster==1 of little
cores,

    for exynos5410 there is only pcluster==0.

?

I agree on the first two paragraphs.
For the third paragraph, the rebuttal is that the exynos5800 and exynos5422 based SoCs can have both clusters on at the same time. Hence, the third paragrapah comment will have to be tweaked further. Possibly reading:
The exynos5800 and exynos5422 can have both clusters on at the same time. The exynos5800 boots up with cpu0 on cluster0 (A15). The exynos5422 can boot up on either clusters as its pin controlled. In this case the DTS should properly reflect the cpu order. The exynos5410 can have only one cluster on at a time, and it boots up with pcluster == 0.
Any tweaks and comments on the above is appreciated.

Quoted 11 lines

I would also consider perhaps moving the comment up to where pcluster is calculated, and in particular near the:

    cpunr = pcpu + (pcluster * EXYNOS5800_CPUS_PER_CLUSTER);

Since this also relies on pcluster==0 for !5800 systems.

What do you think? I could adjust the comment wording and placement on commit if you are happy.

I am definitely OK with moving the comment to where you suggest.

Quoted 7 lines

I have one other question -- does this patch result in a Xen system which consists of both A7 and A15 pcpus being live at the same time? Does that actually work given the subtle differences in things like the cache line length? I would expect there to need to be other patches to support a heterogeneous core configuration.

Yes, it does get both A7 and A15 clusters up at the same time. I am sure that there needs to be patches to support this heterogenous core configuration, but if we keep the doms pinned to the same CPU type then I haven't faced any issues.
For example if I had a domU pinned to CPU 3 (A7) and CPU 4 (A15) then I faced hangs.

Quoted 40 lines

Hopefully I've just misunderstood and the effect of this patch is to switch to just running the A15 processors even after booting on the A7s.

Ian.

Quoted 33 lines
xen/arch/arm/platforms/exynos5.c +28 -0
+         */
+        if ( pcluster &&
+             pcluster == MPIDR_AFFINITY_LEVEL(cpu_logical_map(0), 1) ) {
+            /*
+             * Before we reset the Little cores, we should wait
+             * the SPARE2 register is set to 1 because the init
+             * codes of the iROM will set the register after
+             * initialization.
+            */
+
+            /* wait max 10ms for the spare register to be set to 1 */
+            timeout = 10;
+            while ( !__raw_readl(power + S5P_PMU_SPARE2) )
+            {
+                if ( timeout-- == 0 )
+                    break;
+
+                mdelay(1);
+            }
+
+            if ( timeout == 0 )
+            {
+                dprintk(XENLOG_ERR, "CPU%d SPARE2 register wait
 failed\n", cpu);
+                return -ETIMEDOUT;
+            }
+            __raw_writel(EXYNOS5420_KFC_CORE_RESET(cpu),
+                         power + EXYNOS5_SWRESET);
+        }
     }
     return 0;

}

xen/arch/arm/platforms/exynos5.c +0 -0
@@ -298,6 +352,7 @@ static const char * const exynos5250_dt_compat[]
Quoted 9 lines
Quoted 8 lines

__initconst =
static const char * const exynos5_dt_compat[] __initconst =

 {
     "samsung,exynos5410",

+ "samsung,exynos5800",
NULL
};

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#3 lore raw
Quoted 117 lines · Suriyan Ramasami
Quoted 105 lines · Ian Campbell
Quoted 10 lines · Suriyan Ramasami

The Odroid-XU3/XU4 from hardkernel is an Exynos 5422 based board. Code from mcpm-exynos.c and mcpm-platsmp.c from the Linux kernel has been used to get all the 8 cores from the 2 clusters powered on.
The Linux DTS for these odroid uses "samsung,exynos5800" as the machine compatible string. Hence, the same is used herein.

This change has been tested on the Odroid-XU/XU3/XU4.

Thanks, this now looks good to me, with one question about a comment which
I could resolve upon commit if we agree a wording.

Quoted 19 lines

---
Changes between versions as follows:

v2:
Try to use common code as much as possible

v1:
Initial code submission
---
 xen/arch/arm/platforms/exynos5.c | 61
++++++++++++++++++++++++++++++++++++++--

 1 file changed, 58 insertions(+), 3 deletions(-)
xen/arch/arm/platforms/exynos5.c +0 -0
index bf4964d..12aea31 100644

xen/arch/arm/platforms/exynos5.c static bool_t secure_firmware; · line 34

Quoted 1 line
xen/arch/arm/platforms/exynos5.c +0 -0
@@ -34,9 +34,18 @@ static bool_t secure_firmware;
  #define EXYNOS_ARM_CORE_CONFIG(_nr) (EXYNOS_ARM_CORE0_CONFIG + (0x80

*

xen/arch/arm/platforms/exynos5.c static bool_t secure_firmware; · line 36

Quoted 2 lines
xen/arch/arm/platforms/exynos5.c +0 -0
 (_nr)))
  #define EXYNOS_ARM_CORE_STATUS(_nr) (EXYNOS_ARM_CORE_CONFIG(_nr) +

0x4)

Quoted 27 lines
xen/arch/arm/platforms/exynos5.c +1 -0
  #define S5P_CORE_LOCAL_PWR_EN       0x3
+#define S5P_PMU_SPARE2              0x908


 #define SMC_CMD_CPU1BOOT            (-4)

xen/arch/arm/platforms/exynos5.c +7 -0
+#define EXYNOS5800_CPUS_PER_CLUSTER 4
+
+#define EXYNOS5420_KFC_CORE_RESET0  BIT(8)
+#define EXYNOS5420_KFC_ETM_RESET0   BIT(20)
+
+#define EXYNOS5420_KFC_CORE_RESET(_nr) \
+        ((EXYNOS5420_KFC_CORE_RESET0 | EXYNOS5420_KFC_ETM_RESET0) <<

(_nr))
+
 static int exynos5_init_time(void)
 {
     uint32_t reg;

xen/arch/arm/platforms/exynos5.c +5 -0
@@ -166,14 +175,23 @@ static void exynos_cpu_power_up(void __iomem
 *power, int cpu)
  static int exynos5_cpu_power_up(void __iomem *power, int cpu)
  {
      unsigned int timeout;
+    unsigned int mpidr, pcpu, pcluster, cpunr;
+
+    mpidr = cpu_logical_map(cpu);
+    pcpu = MPIDR_AFFINITY_LEVEL(mpidr, 0);
+    pcluster = MPIDR_AFFINITY_LEVEL(mpidr, 1);
Quoted 4 lines


-    if ( !exynos_cpu_power_state(power, cpu) )
+    cpunr = pcpu + (pcluster * EXYNOS5800_CPUS_PER_CLUSTER); +    dprintk(XENLOG_DEBUG, "cpu: %d pcpu: %d, cluster: %d cpunr:

%d\n",

xen/arch/arm/platforms/exynos5.c static int exynos5_cpu_power_up(void __iomem

Quoted 17 lines

+            cpu, pcpu, pcluster, cpunr);
+
+    if ( !exynos_cpu_power_state(power, cpunr) ) {
-        exynos_cpu_power_up(power, cpu);
+        exynos_cpu_power_up(power, cpunr); timeout = 10;

         /* wait max 10 ms until cpu is on */
-        while ( exynos_cpu_power_state(power, cpu) != S5P_CORE_LOCAL_PWR_EN )
+        while ( exynos_cpu_power_state(power, cpunr) != S5P_CORE_LOCAL_PWR_EN )
         {
             if ( timeout-- == 0 )
                 break;

xen/arch/arm/platforms/exynos5.c +0 -0
@@ -186,6 +204,42 @@ static int exynos5_cpu_power_up(void __iomem

*power,

xen/arch/arm/platforms/exynos5.c static int exynos5_cpu_power_up(void __iomem *power, int cpu)

Quoted 7 lines
xen/arch/arm/platforms/exynos5.c +3 -0
 int cpu)
              dprintk(XENLOG_ERR, "CPU%d power enable failed\n", cpu);
              return -ETIMEDOUT;
          }
+
+        /*
+         * This assumes the cluster number of the big cores(Cortex

A15)

xen/arch/arm/platforms/exynos5.c static int exynos5_cpu_power_up(void __iomem *power, int cpu)

Quoted 4 lines
xen/arch/arm/platforms/exynos5.c +4 -0
+         * is 0 and the Little cores(Cortex A7) is 1.
+         * When the system was booted from the Little core,
+         * they should be reset during power up cpu.
+         * Note that the below condition is true for Odroid XU3/XU4,

and

xen/arch/arm/platforms/exynos5.c static int exynos5_cpu_power_up(void __iomem *power, int cpu) · line 214

Quoted 1 line
xen/arch/arm/platforms/exynos5.c +1 -0
+         * false for the XU and the Exynos5800 based boards.
Quoted 8 lines

I think the SoC is more relevant/useful in this context than specific boards. So I think what it is trying to say here is that for systems matching samsung,exynos5410 pcluster will always be zero, where as for ones
matching samsung,exynos5800 it can be non-zero, and for non-zero clusters
we need to do some extra bringup.

Quoted 14 lines

I believe for some SoCs its board based (5422 = pin controlled) and for others its purely SoC based (5420 = A7 boot, 5800 = A15 boot). For example, please look at this post: https://lkml.org/lkml/2015/12/11/107
which mentions something along those lines.
[...]
 I agree on the first two paragraphs.
For the third paragraph, the rebuttal is that the exynos5800 and exynos5422 based SoCs can have both clusters on at the same time. Hence, the third paragrapah comment will have to be tweaked further. Possibly reading:
The exynos5800 and exynos5422 can have both clusters on at the same time. The exynos5800 boots up with cpu0 on cluster0 (A15). The exynos5422 can boot up on either clusters as its pin controlled. In this case the DTS should properly reflect the cpu order.

Does the OS need to be aware of all these combinations though? Is it not sufficient to know how to bring up an A15 core and how to bring up an A7 core and then just do so based on the information in the DTS, without needing to worry about which sort of core we happened to have booted on?

Quoted 3 lines

The exynos5410 can have only one cluster on at a time, and it boots up
with pcluster == 0.
Any tweaks and comments on the above is appreciated.

How much of this is down to physical h/w limitations and how much of it is down to firmware or software limitations? Can you flip the to the other cluster somehow?

Quoted 9 lines
Quoted 9 lines

 I have one other question -- does this patch result in a Xen system which
consists of both A7 and A15 pcpus being live at the same time? Does that
actually work given the subtle differences in things like the cache line
length? I would expect there to need to be other patches to support a heterogeneous core configuration.

Quoted 6 lines

Yes, it does get both A7 and A15 clusters up at the same time. I am sure that there needs to be patches to support this heterogenous core configuration, but if we keep the doms pinned to the same CPU type then I haven't faced any issues.
For example if I had a domU pinned to CPU 3 (A7) and CPU 4 (A15) then I faced hangs.

If that's the case then I'm sorry but I'm rather wary of taking this patch as it is, since the defaults are all to allow vCPUs to migrate around, so people are just going to get a broken system out of the box.

Until actual support for heterogeneous cores is in place I'd much prefer to only bring up one cluster, I don't mind if it is

Always the A7s
Always the A15s
Always whatever the system has booted on Somehow configurable at boot time by the user.

Another option, which is a bit more work but not huge, would be to automatically partition the system into 2 cpupools at boot, corresponding to the two clusters of CPUs and ensure that dom0 is resident in only one cpu pool, I think that would be the minimally workable arrangement for a heterogeneous system.

Ian.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#4 lore raw
Quoted 133 lines · Ian Campbell
Quoted 117 lines · Suriyan Ramasami
Quoted 105 lines · Ian Campbell
Quoted 10 lines · Suriyan Ramasami

The Odroid-XU3/XU4 from hardkernel is an Exynos 5422 based board. Code from mcpm-exynos.c and mcpm-platsmp.c from the Linux kernel has been used to get all the 8 cores from the 2 clusters powered on.
The Linux DTS for these odroid uses "samsung,exynos5800" as the machine compatible string. Hence, the same is used herein.

This change has been tested on the Odroid-XU/XU3/XU4.

Thanks, this now looks good to me, with one question about a comment which
I could resolve upon commit if we agree a wording.

Quoted 19 lines

---
Changes between versions as follows:

v2:
Try to use common code as much as possible

v1:
Initial code submission

---
 xen/arch/arm/platforms/exynos5.c | 61
++++++++++++++++++++++++++++++++++++++--
 1 file changed, 58 insertions(+), 3 deletions(-)
xen/arch/arm/platforms/exynos5.c +0 -0
index bf4964d..12aea31 100644

xen/arch/arm/platforms/exynos5.c static bool_t secure_firmware; · line 34

Quoted 1 line
xen/arch/arm/platforms/exynos5.c +0 -0
@@ -34,9 +34,18 @@ static bool_t secure_firmware;
 #define EXYNOS_ARM_CORE_CONFIG(_nr) (EXYNOS_ARM_CORE0_CONFIG + (0x80

*

xen/arch/arm/platforms/exynos5.c static bool_t secure_firmware; · line 36

Quoted 2 lines
xen/arch/arm/platforms/exynos5.c +0 -0
 (_nr)))
 #define EXYNOS_ARM_CORE_STATUS(_nr) (EXYNOS_ARM_CORE_CONFIG(_nr) +

0x4)

Quoted 21 lines
xen/arch/arm/platforms/exynos5.c +9 -0
 #define S5P_CORE_LOCAL_PWR_EN       0x3
+#define S5P_PMU_SPARE2              0x908
 
 #define SMC_CMD_CPU1BOOT            (-4)
 
+#define EXYNOS5800_CPUS_PER_CLUSTER 4
+
+#define EXYNOS5420_KFC_CORE_RESET0  BIT(8)
+#define EXYNOS5420_KFC_ETM_RESET0   BIT(20)
+
+#define EXYNOS5420_KFC_CORE_RESET(_nr) \
+        ((EXYNOS5420_KFC_CORE_RESET0 | EXYNOS5420_KFC_ETM_RESET0) <<
 (_nr))
+
 static int exynos5_init_time(void)
 {
     uint32_t reg;
xen/arch/arm/platforms/exynos5.c +0 -0
@@ -166,14 +175,23 @@ static void exynos_cpu_power_up(void __iomem
 *power, int cpu)
 static int exynos5_cpu_power_up(void __iomem *power, int cpu)
 {

xen/arch/arm/platforms/exynos5.c static void exynos_cpu_power_up(void __iomem · line 186

Quoted 10 lines
xen/arch/arm/platforms/exynos5.c +7 -1
     unsigned int timeout;
+    unsigned int mpidr, pcpu, pcluster, cpunr;
+
+    mpidr = cpu_logical_map(cpu);
+    pcpu = MPIDR_AFFINITY_LEVEL(mpidr, 0);
+    pcluster = MPIDR_AFFINITY_LEVEL(mpidr, 1);
 
-    if ( !exynos_cpu_power_state(power, cpu) )
+    cpunr = pcpu + (pcluster * EXYNOS5800_CPUS_PER_CLUSTER);
+    dprintk(XENLOG_DEBUG, "cpu: %d pcpu: %d, cluster: %d cpunr:

%d\n",

xen/arch/arm/platforms/exynos5.c static int exynos5_cpu_power_up(void __iomem

Quoted 17 lines
xen/arch/arm/platforms/exynos5.c +5 -2
+            cpu, pcpu, pcluster, cpunr);
+
+    if ( !exynos_cpu_power_state(power, cpunr) )
     {
-        exynos_cpu_power_up(power, cpu);
+        exynos_cpu_power_up(power, cpunr);
         timeout = 10;
 
         /* wait max 10 ms until cpu is on */
-        while ( exynos_cpu_power_state(power, cpu) !=
 S5P_CORE_LOCAL_PWR_EN )
+        while ( exynos_cpu_power_state(power, cpunr) !=
 S5P_CORE_LOCAL_PWR_EN )
         {
             if ( timeout-- == 0 )
                 break;
xen/arch/arm/platforms/exynos5.c +0 -0
@@ -186,6 +204,42 @@ static int exynos5_cpu_power_up(void __iomem

*power,

xen/arch/arm/platforms/exynos5.c static int exynos5_cpu_power_up(void __iomem *power, int cpu)

Quoted 7 lines
xen/arch/arm/platforms/exynos5.c +3 -0
 int cpu)
             dprintk(XENLOG_ERR, "CPU%d power enable failed\n", cpu);
             return -ETIMEDOUT;
         }
+
+        /*
+         * This assumes the cluster number of the big cores(Cortex

A15)

xen/arch/arm/platforms/exynos5.c static int exynos5_cpu_power_up(void __iomem *power, int cpu)

Quoted 4 lines
xen/arch/arm/platforms/exynos5.c +4 -0
+         * is 0 and the Little cores(Cortex A7) is 1.
+         * When the system was booted from the Little core,
+         * they should be reset during power up cpu.
+         * Note that the below condition is true for Odroid XU3/XU4,

and

xen/arch/arm/platforms/exynos5.c static int exynos5_cpu_power_up(void __iomem *power, int cpu) · line 214

Quoted 1 line
xen/arch/arm/platforms/exynos5.c +1 -0
+         * false for the XU and the Exynos5800 based boards.
Quoted 8 lines

I think the SoC is more relevant/useful in this context than specific boards. So I think what it is trying to say here is that for systems matching samsung,exynos5410 pcluster will always be zero, where as for ones
matching samsung,exynos5800 it can be non-zero, and for non-zero clusters
we need to do some extra bringup.

Quoted 14 lines

I believe for some SoCs its board based (5422 = pin controlled) and for others its purely SoC based (5420 = A7 boot, 5800 = A15 boot). For example, please look at this post: https://lkml.org/lkml/2015/12/11/107
which mentions something along those lines.
[...]
I agree on the first two paragraphs.
For the third paragraph, the rebuttal is that the exynos5800 and exynos5422 based SoCs can have both clusters on at the same time. Hence, the third paragrapah comment will have to be tweaked further. Possibly reading:
The exynos5800 and exynos5422 can have both clusters on at the same time. The exynos5800 boots up with cpu0 on cluster0 (A15). The exynos5422 can boot up on either clusters as its pin controlled. In this case the DTS should properly reflect the cpu order.

Quoted 6 lines

Does the OS need to be aware of all these combinations though? Is it not sufficient to know how to bring up an A15 core and how to bring up an A7 core and then just do so based on the information in the DTS, without needing to worry about which sort of core we happened to have booted on?

Unfortunately, at least looking at the boot up code for the Exynos5422, the OS needs to be aware of it. This is what I see in the linux source code. If it boots up on an A7, then a special reset is needed which is not needed when booted up otherwise. I do not have much more details on that other than the Linux code.
Without that reset sequence, I have also verified that the powered on CPU does not come up.

Quoted 9 lines
Quoted 3 lines

The exynos5410 can have only one cluster on at a time, and it boots up
with pcluster == 0.
Any tweaks and comments on the above is appreciated.

How much of this is down to physical h/w limitations and how much of it is down to firmware or software limitations? Can you flip the to the other cluster somehow?

The 5410 boots up on an A15, and only those 4 A15 CPUs in cluster 0 are brought up. Hence, no flipping is required. I am wondering if your question was aimed at the 5422 (Odroid XU3/XU4). For the XU3/XU4, to have only 4 A15s up, its possible by a change in u-boot, where one could power on an A15 and then turn the A7 boot cpu off. I haven't tried it and I do not know if there are other issues along the way.

Quoted 16 lines
Quoted 9 lines
Quoted 9 lines

I have one other question -- does this patch result in a Xen system
which
consists of both A7 and A15 pcpus being live at the same time? Does that
actually work given the subtle differences in things like the cache line
length? I would expect there to need to be other patches to support a heterogeneous core configuration.

Quoted 6 lines

Yes, it does get both A7 and A15 clusters up at the same time. I am sure that there needs to be patches to support this heterogenous core configuration, but if we keep the doms pinned to the same CPU type then I haven't faced any issues.
For example if I had a domU pinned to CPU 3 (A7) and CPU 4 (A15) then I faced hangs.

Quoted 5 lines

If that's the case then I'm sorry but I'm rather wary of taking this patch as it is, since the defaults are all to allow vCPUs to migrate around, so people are just going to get a broken system out of the box.

I totally agree with you. This does need some work, and thanks for the suggestions you have provided below.

Quoted 8 lines

Until actual support for heterogeneous cores is in place I'd much prefer to only bring up one cluster, I don't mind if it is

Always the A7s
Always the A15s
Always whatever the system has booted on Somehow configurable at boot time by the user.

Quoted 7 lines

Another option, which is a bit more work but not huge, would be to automatically partition the system into 2 cpupools at boot, corresponding to the two clusters of CPUs and ensure that dom0 is resident in only one cpu pool, I think that would be the minimally workable arrangement for a heterogeneous system.

I like this suggestion. I shall pursue this option, and work on a Patch version 3. Thanks so much for your input. It is much appreciated!

Quoted 2 lines

Ian.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#5 lore raw
Quoted 16 lines · Suriyan Ramasami

 I agree on the first two paragraphs.

Quoted 9 lines
Quoted 8 lines

For the third paragraph, the rebuttal is that the exynos5800 and exynos5422 based SoCs can have both clusters on at the same time. Hence, the third paragrapah comment will have to be tweaked further. Possibly reading:
The exynos5800 and exynos5422 can have both clusters on at the same time. The exynos5800 boots up with cpu0 on cluster0 (A15). The exynos5422 can boot up on either clusters as its pin controlled. In this case the DTS should properly reflect the cpu order.

Quoted 6 lines

Does the OS need to be aware of all these combinations though? Is it not sufficient to know how to bring up an A15 core and how to bring up an A7 core and then just do so based on the information in the DTS, without needing to worry about which sort of core we happened to have booted on?

Quoted 7 lines

Unfortunately, at least looking at the boot up code for the Exynos5422, the OS needs to be aware of it. This is what I see in the linux source code. If it boots up on an A7, then a special reset is needed which is not needed when booted up otherwise. I do not have much more details on that other than the Linux code.
Without that reset sequence, I have also verified that the powered on CPU does not come up.

Are we able to say that if we are booted on cluster 1 (always the A7s) then we always need this magic reset? i.e. is true for all SoCs which have an A7 cluster and can boot from it? (it's tautologically true for SocS which either have no A7's or cannot boot from them).

Maybe I'm looking for similarities between different exynos variants which doesn't exist though. If we are going to talk about specific SoCs in the comments then I would rather that the code was also explicit rather than assuming cluster 1 will only be found on the 5800, that might be as simple as mapping the compatible string to a max_cluster (default 0 for unknown SoC) and warning if pcluster > max_cluster.

Quoted 6 lines
Quoted 6 lines

 >  The exynos5410 can have only one cluster on at a time, and it boots up

Quoted 2 lines

with pcluster == 0.
Any tweaks and comments on the above is appreciated.

Quoted 7 lines
Quoted 5 lines

How much of this is down to physical h/w limitations and how much of it is
down to firmware or software limitations? Can you flip the to the other cluster somehow?

The 5410 boots up on an A15, and only those 4 A15 CPUs in cluster 0 are brought up. Hence, no flipping is required.

What I meant was, given that the 5410 has a cluster of A15 and a cluster of A7s (right?) and you can only have one on at a time, how does an OS make use of the A7s if it wants to? As you say it boots from the A15, so how can the A7s be used?

Ian.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#6 lore raw
Quoted 33 lines · Ian Campbell
Quoted 3 lines · Suriyan Ramasami

I agree on the first two paragraphs.

Quoted 2 lines
Quoted 2 lines

For the third paragraph, the rebuttal is that the exynos5800 and exynos5422 based SoCs can have both clusters on at the same time.

Hence,

Quoted 1 line
Quoted 1 line
Quoted 1 line

the third paragrapah comment will have to be tweaked further.

Possibly

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

reading:
The exynos5800 and exynos5422 can have both clusters on at the same

time.

Quoted 1 line
Quoted 1 line
Quoted 1 line

The exynos5800 boots up with cpu0 on cluster0 (A15). The exynos5422

can

Quoted 1 line
Quoted 1 line
Quoted 1 line

boot up on either clusters as its pin controlled. In this case the

DTS

Quoted 3 lines
Quoted 3 lines
Quoted 1 line

should properly reflect the cpu order.

Does the OS need to be aware of all these combinations though? Is it

not

Quoted 1 line
Quoted 1 line

sufficient to know how to bring up an A15 core and how to bring up an

A7

Quoted 2 lines
Quoted 2 lines

core and then just do so based on the information in the DTS, without needing to worry about which sort of core we happened to have booted

on?

Quoted 9 lines
Quoted 2 lines

Unfortunately, at least looking at the boot up code for the Exynos5422, the OS needs to be aware of it. This is what I see in the linux source code. If it boots up on an A7, then a special reset is needed which is not needed when booted up otherwise. I do not have much more details on that other than the Linux code.
Without that reset sequence, I have also verified that the powered on CPU does not come up.

Quoted 6 lines

Are we able to say that if we are booted on cluster 1 (always the A7s) then we always need this magic reset? i.e. is true for all SoCs which have an A7 cluster and can boot from it? (it's tautologically true for SocS which either have no A7's or cannot boot from them).

I do not have the information to answer the question. I am limited to what I know (albeit a little bit) wrt the hardkernel related boards - Exynos 5410 (odroid-XU) and the Exynos 5422 (Odoird XU3/XU4). With my limited knowledge, I am only aware of Exynos 5410 which is capable of booting off of an A7 or an A15.

Quoted 7 lines

Maybe I'm looking for similarities between different exynos variants which doesn't exist though. If we are going to talk about specific SoCs in the comments then I would rather that the code was also explicit rather than assuming cluster 1 will only be found on the 5800, that might be as simple as mapping the compatible string to a max_cluster (default 0 for unknown SoC) and warning if pcluster > max_cluster.

Can you please elaborate on the mapping that you talk about above. I am lost here :-(

Quoted 15 lines
Quoted 7 lines
Quoted 7 lines
Quoted 3 lines

The exynos5410 can have only one cluster on at a time, and it boots

up

Quoted 2 lines

with pcluster == 0.
Any tweaks and comments on the above is appreciated.

Quoted 7 lines
Quoted 5 lines

How much of this is down to physical h/w limitations and how much of it is
down to firmware or software limitations? Can you flip the to the other cluster somehow?

The 5410 boots up on an A15, and only those 4 A15 CPUs in cluster 0 are brought up. Hence, no flipping is required.

Quoted 6 lines

What I meant was, given that the 5410 has a cluster of A15 and a cluster of A7s (right?) and you can only have one on at a time, how does an OS make use of the A7s if it wants to? As you say it boots from the A15, so how can the A7s be used?

The Linux OS has a bL (big - little) switcher module/code which handles

that. It maps one big core to one little core, and when the load is not high, it switches off the big cluster, and turns on the small cluster - AFAICT.

Also, are we still on wrt the two cpu pool suggestion and to have 4 cores from cluster 0 in cpupool0 and 4 cores from cluster 1 in cpupool1. It would be great if you can point me to some code as well. I have been looking at cpupool.c and also on the system call interface that it provides.

Quoted 2 lines

Ian.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#7 lore raw
Quoted 67 lines · Suriyan Ramasami
Quoted 37 lines · Ian Campbell
Quoted 3 lines · Suriyan Ramasami

 I agree on the first two paragraphs.

Quoted 2 lines
Quoted 2 lines

For the third paragraph, the rebuttal is that the exynos5800 and exynos5422 based SoCs can have both clusters on at the same time.

Hence,

Quoted 1 line
Quoted 1 line
Quoted 1 line

the third paragrapah comment will have to be tweaked further.

Possibly

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

reading:
The exynos5800 and exynos5422 can have both clusters on at the

same time.

Quoted 1 line
Quoted 1 line
Quoted 1 line

The exynos5800 boots up with cpu0 on cluster0 (A15). The

exynos5422 can

Quoted 1 line
Quoted 1 line
Quoted 1 line

boot up on either clusters as its pin controlled. In this case

the DTS

Quoted 3 lines
Quoted 3 lines
Quoted 1 line

should properly reflect the cpu order.

Does the OS need to be aware of all these combinations though? Is

it not

Quoted 1 line
Quoted 1 line

sufficient to know how to bring up an A15 core and how to bring up

an A7

Quoted 1 line
Quoted 1 line

core and then just do so based on the information in the DTS,

without

Quoted 1 line
Quoted 1 line

needing to worry about which sort of core we happened to have

booted on?

Quoted 3 lines
Quoted 2 lines

Unfortunately, at least looking at the boot up code for the

Exynos5422,

Quoted 1 line

the OS needs to be aware of it. This is what I see in the linux

source

Quoted 1 line

code. If it boots up on an A7, then a special reset is needed which

is

Quoted 1 line

not needed when booted up otherwise. I do not have much more details

on

Quoted 2 lines

that other than the Linux code.
Without that reset sequence, I have also verified that the powered on

CPU

Quoted 9 lines
Quoted 1 line

does not come up.

Are we able to say that if we are booted on cluster 1 (always the A7s) then
we always need this magic reset? i.e. is true for all SoCs which have an A7
cluster and can boot from it? (it's tautologically true for SocS which either have no A7's or cannot boot from them).

I do not have the information to answer the question. I am limited to what I know (albeit a little bit) wrt the hardkernel related boards - Exynos 5410 (odroid-XU) and the Exynos 5422 (Odoird XU3/XU4). With my limited knowledge, I am only aware of Exynos 5410 which is capable of booting off of an A7 or an A15.

Quoted 11 lines

 Maybe I'm looking for similarities between different exynos variants which
doesn't exist though. If we are going to talk about specific SoCs in the
comments then I would rather that the code was also explicit rather than
assuming cluster 1 will only be found on the 5800, that might be as simple
as mapping the compatible string to a max_cluster (default 0 for unknown
SoC) and warning if pcluster > max_cluster.

Quoted 2 lines

Can you please elaborate on the mapping that you talk about above. I am lost here :-(

What I mean is can we say:
    exynos 1234 => Two clusters (max_cluster == 1) exynos 5678 => One cluster (max_cluster == 0) exynos ABCD => Two clusters (max_cluster == 1) Unknown     => Assume one cluster

and can we also assume that cluster 0 always consists of A15s and cluster 1 (if it exists) always consists of A7s?

If so then we can say:

  max_cluster = look_up_by_compat(compat)
  pcluster = figure out from midr
  pcpu = figure it out

  if (pcluster >= max_cluster)
    error

  do bringup

  if (pluster == 1)
    do special handling for cluster 1 == a7

The difference compared with what you have is that it adds a check that we expect a second cluster for the SoC before it goes poking at stuff.

What I'm trying to avoid is coming across some other SoC variant which has 2 clusters but has something different to the A7s or which requires some different handling.

If we were confident that all exynosXXXX SoCs always require the same special handling for cluster 1 then we wouldn't really need this, but I don't think we know that?

Quoted 29 lines

Quoted 19 lines

Quoted 2 lines
Quoted 2 lines

 >  The exynos5410 can have only one cluster on at a time, and it

boots

Quoted 5 lines
Quoted 5 lines

up

Quoted 2 lines

with pcluster == 0.
Any tweaks and comments on the above is appreciated.

How much of this is down to physical h/w limitations and how much

of it

Quoted 2 lines
Quoted 2 lines

is
down to firmware or software limitations? Can you flip the to the

other

Quoted 3 lines
Quoted 2 lines

cluster somehow?

The 5410 boots up on an A15, and only those 4 A15 CPUs in cluster 0

are

Quoted 1 line

brought up. Hence, no flipping is required.

Quoted 9 lines

What I meant was, given that the 5410 has a cluster of A15 and a cluster of
A7s (right?) and you can only have one on at a time, how does an OS make
use of the A7s if it wants to? As you say it boots from the A15, so how can
the A7s be used?

Quoted 4 lines

The Linux OS has a bL (big - little) switcher module/code which handles that. It maps one big core to one little core, and when the load is not high, it switches off the big cluster, and turns on the small cluster - AFAICT.

So this is an OS limitation, not a h/w one? What's to stop an OS from brninging up the A15s and the A7s at the same time?

Quoted 5 lines

Also, are we still on wrt the two cpu pool suggestion and to have 4 cores from cluster 0 in cpupool0 and 4 cores from cluster 1 in cpupool1. It would be great if you can point me to some code as well. I have been looking at cpupool.c and also on the system call interface that it provides.

I'm afraid I'm not really very familiar with this side of things myself :-(

Ian.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#8 lore raw
Quoted 97 lines · Ian Campbell
Quoted 67 lines · Suriyan Ramasami
Quoted 37 lines · Ian Campbell
Quoted 3 lines · Suriyan Ramasami

I agree on the first two paragraphs.

Quoted 2 lines
Quoted 2 lines

For the third paragraph, the rebuttal is that the exynos5800 and exynos5422 based SoCs can have both clusters on at the same time.

Hence,

Quoted 1 line
Quoted 1 line
Quoted 1 line

the third paragrapah comment will have to be tweaked further.

Possibly

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

reading:
The exynos5800 and exynos5422 can have both clusters on at the

same time.

Quoted 1 line
Quoted 1 line
Quoted 1 line

The exynos5800 boots up with cpu0 on cluster0 (A15). The

exynos5422 can

Quoted 1 line
Quoted 1 line
Quoted 1 line

boot up on either clusters as its pin controlled. In this case

the DTS

Quoted 3 lines
Quoted 3 lines
Quoted 1 line

should properly reflect the cpu order.

Does the OS need to be aware of all these combinations though? Is

it not

Quoted 1 line
Quoted 1 line

sufficient to know how to bring up an A15 core and how to bring up

an A7

Quoted 1 line
Quoted 1 line

core and then just do so based on the information in the DTS,

without

Quoted 1 line
Quoted 1 line

needing to worry about which sort of core we happened to have

booted on?

Quoted 3 lines
Quoted 2 lines

Unfortunately, at least looking at the boot up code for the

Exynos5422,

Quoted 1 line

the OS needs to be aware of it. This is what I see in the linux

source

Quoted 1 line

code. If it boots up on an A7, then a special reset is needed which

is

Quoted 1 line

not needed when booted up otherwise. I do not have much more details

on

Quoted 2 lines

that other than the Linux code.
Without that reset sequence, I have also verified that the powered on

CPU

Quoted 9 lines
Quoted 1 line

does not come up.

Are we able to say that if we are booted on cluster 1 (always the A7s) then
we always need this magic reset? i.e. is true for all SoCs which have an A7
cluster and can boot from it? (it's tautologically true for SocS which either have no A7's or cannot boot from them).

I do not have the information to answer the question. I am limited to what I know (albeit a little bit) wrt the hardkernel related boards - Exynos 5410 (odroid-XU) and the Exynos 5422 (Odoird XU3/XU4). With my limited knowledge, I am only aware of Exynos 5410 which is capable of booting off of an A7 or an A15.

Quoted 11 lines

Maybe I'm looking for similarities between different exynos variants
which
doesn't exist though. If we are going to talk about specific SoCs in the
comments then I would rather that the code was also explicit rather than
assuming cluster 1 will only be found on the 5800, that might be as simple
as mapping the compatible string to a max_cluster (default 0 for unknown
SoC) and warning if pcluster > max_cluster.

Quoted 2 lines

Can you please elaborate on the mapping that you talk about above. I am lost here :-(

What I mean is can we say:

    exynos 1234 => Two clusters (max_cluster == 1)
    exynos 5678 => One cluster (max_cluster == 0)
    exynos ABCD => Two clusters (max_cluster == 1)
    Unknown     => Assume one cluster

and can we also assume that cluster 0 always consists of A15s and cluster 1 (if it exists) always consists of A7s?

If so then we can say:

max_cluster = look_up_by_compat(compat)
pcluster = figure out from midr
pcpu = figure it out

if (pcluster >= max_cluster)
error

do bringup

if (pluster == 1)

    do special handling for cluster 1 == a7

The difference compared with what you have is that it adds a check that we expect a second cluster for the SoC before it goes poking at stuff.

Quoted 9 lines

What I'm trying to avoid is coming across some other SoC variant which has 2 clusters but has something different to the A7s or which requires some different handling.

If we were confident that all exynosXXXX SoCs always require the same special handling for cluster 1 then we wouldn't really need this, but I don't think we know that?

I did some looking at the linux 4.4.y dts for exynos, and this is what I see:
exynos3250: cpu0, cpu1 = A7 (1 cluster)
exynos4210: cpu0, cpu1 = A9 (1 cluster)
exynos4212: cpu0, cpu1 = A9 (1 cluster)
exynos4412: cpu0, cpu1, cpu2, cpu3 = A9 (1 cluster)
exynos4415: cpu0, cpu1, cpu2, cpu3 = A9 (1 cluster)
exynos5250: cpu0, cpu1 = A15 (1 cluster)
exynos5260: cpu0, cpu1 = A15. cpu2, cpu3, cpu4, cpu5 = A7 (2 clusters)
exynos5410: cpu0, cpu1, cpu2, cpu3 = A15 (1 cluster - even thougg it has 2 clusters, but not both can be on at same time)
exynos5420: cpu0, cpu1, cpu2, cpu3 = A15. cpu4, cpu5, cpu6, cpu7 = A7 (2 clusters)
exynos5422: cpu0, cpu1, cpu2, cpu3 = A7. cpu4, cpu5, cpu6, cpu7 = A15 (2 clusters)
exynos5440: cpu0, cpu1, cpu2, cpu3 = A15 (1 cluster)

If we look at the ones that can potentially support hardware virtualization, limits us to the A7s and the A15s. That gives us:
exynos3250: cpu0, cpu1 = A7 (1 cluster)
exynos5250: cpu0, cpu1 = A15 (1 cluster)
exynos5260: cpu0, cpu1 = A15. cpu2, cpu3, cpu4, cpu5 = A7 (2 clusters)
exynos5410: cpu0, cpu1, cpu2, cpu3 = A15 (1 cluster)
exynos5420: cpu0, cpu1, cpu2, cpu3 = A15. cpu4, cpu5, cpu6, cpu7 = A7 (2 clusters)
exynos5422: cpu0, cpu1, cpu2, cpu3 = A7. cpu4, cpu5, cpu6, cpu7 = A15 (2 clusters)
exynos5440: cpu0, cpu1, cpu2, cpu3 = A15 (1 cluster)

Of these the only ones which has A7 as the 1st cluster are:
exynos3250: cpu0, cpu1 = A7
exynos5420: cpu0, cpu1, cpu2, cpu3 = A15. cpu4, cpu5, cpu6, cpu7 = A7 (2 clusters)
Note that the exynos5800 has the same cpu config as the exysno5420.

I was looking at the cpu bring up code, and notice that if the secondary cpu being brought up is an A7, then it invariably does the below:
For the exynos3250: in platsmp.c
void exynos_core_restart(u32 core_id)

{
        u32 val;

        if (!of_machine_is_compatible("samsung,exynos3250"))
                return;

        while (!pmu_raw_readl(S5P_PMU_SPARE2))
                udelay(10);
        udelay(10);

        val = pmu_raw_readl(EXYNOS_ARM_CORE_STATUS(core_id));
        val |= S5P_CORE_WAKEUP_FROM_LOCAL_CFG;
        pmu_raw_writel(val, EXYNOS_ARM_CORE_STATUS(core_id));

        pmu_raw_writel(EXYNOS_CORE_PO_RESET(core_id), EXYNOS_SWRESET);
}

And for the exynos5800/exynos5422: mcpm-exynos.c
static int exynos_cpu_powerup(unsigned int cpu, unsigned int cluster)

{
        unsigned int cpunr = cpu + (cluster * EXYNOS5420_CPUS_PER_CLUSTER);

        pr_debug("%s: cpu %u cluster %u\n", __func__, cpu, cluster);
        if (cpu >= EXYNOS5420_CPUS_PER_CLUSTER ||
                cluster >= EXYNOS5420_NR_CLUSTERS)
                return -EINVAL;

        if (!exynos_cpu_power_state(cpunr)) {
                exynos_cpu_power_up(cpunr);

                /*
                 * This assumes the cluster number of the big cores(Cortex

A15)
* is 0 and the Little cores(Cortex A7) is 1.
* When the system was booted from the Little core,
* they should be reset during power up cpu.
*/
if (cluster &&
cluster == MPIDR_AFFINITY_LEVEL(cpu_logical_map(0), 1))

{
                        /*
                         * Before we reset the Little cores, we should wait
                         * the SPARE2 register is set to 1 because the init
                         * codes of the iROM will set the register after
                         * initialization.
                         */
                        while (!pmu_raw_readl(S5P_PMU_SPARE2))
                                udelay(10);

                        pmu_raw_writel(EXYNOS5420_KFC_CORE_RESET(cpu),
                                        EXYNOS_SWRESET);
                }
        }

        return 0;
}

This pretty much indicates that when bringing up the A7s, the special reset sequence is deemed essential. Probably, we could generalize that it might be true for future exynos's having A7s.

Quoted 43 lines
Quoted 29 lines
Quoted 20 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

The exynos5410 can have only one cluster on at a time, and it

boots

Quoted 5 lines
Quoted 5 lines

up

Quoted 2 lines

with pcluster == 0.
Any tweaks and comments on the above is appreciated.

How much of this is down to physical h/w limitations and how much

of it

Quoted 2 lines
Quoted 2 lines

is
down to firmware or software limitations? Can you flip the to the

other

Quoted 3 lines
Quoted 2 lines

cluster somehow?

The 5410 boots up on an A15, and only those 4 A15 CPUs in cluster 0

are

Quoted 1 line

brought up. Hence, no flipping is required.

Quoted 9 lines

What I meant was, given that the 5410 has a cluster of A15 and a cluster of
A7s (right?) and you can only have one on at a time, how does an OS make
use of the A7s if it wants to? As you say it boots from the A15, so how can
the A7s be used?

Quoted 4 lines

The Linux OS has a bL (big - little) switcher module/code which handles that. It maps one big core to one little core, and when the load is not high, it switches off the big cluster, and turns on the small cluster - AFAICT.

So this is an OS limitation, not a h/w one? What's to stop an OS from brninging up the A15s and the A7s at the same time?

Quoted 5 lines

Also, are we still on wrt the two cpu pool suggestion and to have 4 cores from cluster 0 in cpupool0 and 4 cores from cluster 1 in cpupool1. It would be great if you can point me to some code as well. I have been looking at cpupool.c and also on the system call interface that it provides.

Quoted 7 lines

I'm afraid I'm not really very familiar with this side of things myself :-(

Thanks, I shall dig into this some more.

Ian.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#9 lore raw
Quoted 146 lines · Suriyan Ramasami
Quoted 132 lines · Ian Campbell
Quoted 3 lines · Suriyan Ramasami

On Wed, Feb 10, 2016 at 2:03 AM, Ian Campbell <

[email protected]>

Quoted 4 lines
Quoted 3 lines · wrote:
Quoted 2 lines · Suriyan Ramasami

I agree on the first two paragraphs.

Quoted 1 line
Quoted 1 line

For the third paragraph, the rebuttal is that the

exynos5800 and

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

exynos5422 based SoCs can have both clusters on at the

same time.

Quoted 2 lines
Quoted 2 lines

Hence,

Quoted 1 line
Quoted 1 line
Quoted 1 line

the third paragrapah comment will have to be tweaked

further.

Quoted 3 lines
Quoted 3 lines

Possibly

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

reading:
The exynos5800 and exynos5422 can have both clusters on

at the

Quoted 4 lines
Quoted 4 lines

same time.

Quoted 1 line
Quoted 1 line
Quoted 1 line

The exynos5800 boots up with cpu0 on cluster0 (A15). The

exynos5422 can

Quoted 1 line
Quoted 1 line
Quoted 1 line

boot up on either clusters as its pin controlled. In this

case

Quoted 4 lines
Quoted 4 lines

the DTS

Quoted 3 lines
Quoted 3 lines
Quoted 1 line

should properly reflect the cpu order.

Does the OS need to be aware of all these combinations

though? Is

Quoted 2 lines
Quoted 2 lines

it not

Quoted 1 line
Quoted 1 line

sufficient to know how to bring up an A15 core and how to

bring up

Quoted 2 lines
Quoted 2 lines

an A7

Quoted 1 line
Quoted 1 line

core and then just do so based on the information in the

DTS,

Quoted 2 lines
Quoted 2 lines

without

Quoted 1 line
Quoted 1 line

needing to worry about which sort of core we happened to

have

Quoted 6 lines
Quoted 6 lines

booted on?

Quoted 3 lines
Quoted 2 lines

Unfortunately, at least looking at the boot up code for the

Exynos5422,

Quoted 1 line

the OS needs to be aware of it. This is what I see in the

linux

Quoted 2 lines
Quoted 2 lines

source

Quoted 1 line

code. If it boots up on an A7, then a special reset is needed

which

Quoted 2 lines
Quoted 2 lines

is

Quoted 1 line

not needed when booted up otherwise. I do not have much more

details

Quoted 3 lines
Quoted 3 lines

on

Quoted 2 lines

that other than the Linux code.
Without that reset sequence, I have also verified that the

powered on

Quoted 4 lines
Quoted 4 lines

CPU

Quoted 1 line

does not come up.

Are we able to say that if we are booted on cluster 1 (always

the A7s)

Quoted 2 lines
Quoted 2 lines

then
we always need this magic reset? i.e. is true for all SoCs

which have

Quoted 2 lines
Quoted 2 lines

an A7
cluster and can boot from it? (it's tautologically true for

SocS which

Quoted 3 lines
Quoted 2 lines

either have no A7's or cannot boot from them).

I do not have the information to answer the question. I am

limited to

Quoted 1 line

what I know (albeit a little bit) wrt the hardkernel related

boards -

Quoted 1 line

Exynos 5410 (odroid-XU) and the Exynos 5422 (Odoird XU3/XU4).

With my

Quoted 1 line

limited knowledge, I am only aware of Exynos 5410 which is

capable of

Quoted 3 lines

booting off of an A7 or an A15.

Quoted 1 line

Maybe I'm looking for similarities between different exynos

variants

Quoted 2 lines
Quoted 2 lines

which
doesn't exist though. If we are going to talk about specific

SoCs in

Quoted 2 lines
Quoted 2 lines

the
comments then I would rather that the code was also explicit

rather

Quoted 2 lines
Quoted 2 lines

than
assuming cluster 1 will only be found on the 5800, that might

be as

Quoted 2 lines
Quoted 2 lines

simple
as mapping the compatible string to a max_cluster (default 0

for

Quoted 3 lines
Quoted 2 lines

unknown
SoC) and warning if pcluster > max_cluster.

Can you please elaborate on the mapping that you talk about

above. I am

Quoted 1 line

lost here :-(

What I mean is can we say:

    exynos 1234 => Two clusters (max_cluster == 1)
    exynos 5678 => One cluster (max_cluster == 0)
    exynos ABCD => Two clusters (max_cluster == 1) 
    Unknown     => Assume one cluster

and can we also assume that cluster 0 always consists of A15s and cluster 1
(if it exists) always consists of A7s?

If so then we can say:

max_cluster = look_up_by_compat(compat)
pcluster = figure out from midr
pcpu = figure it out

if (pcluster >= max_cluster)
error

do bringup

if (pluster == 1)

    do special handling for cluster 1 == a7

The difference compared with what you have is that it adds a check that we
expect a second cluster for the SoC before it goes poking at stuff.

What I'm trying to avoid is coming across some other SoC variant which has
2 clusters but has something different to the A7s or which requires some
different handling.

Quoted 7 lines

If we were confident that all exynosXXXX SoCs always require the same
special handling for cluster 1 then we wouldn't really need this, but I
don't think we know that?

I did some looking at the linux 4.4.y dts for exynos, and this is what I see:

[...]

Quoted 13 lines

If we look at the ones that can potentially support hardware virtualization, limits us to the A7s and the A15s. That gives us:
exynos3250: cpu0, cpu1 = A7 (1 cluster)
exynos5250: cpu0, cpu1 = A15 (1 cluster)
exynos5260: cpu0, cpu1 = A15. cpu2, cpu3, cpu4, cpu5 = A7 (2 clusters)
exynos5410: cpu0, cpu1, cpu2, cpu3 = A15 (1 cluster)
exynos5420: cpu0, cpu1, cpu2, cpu3 = A15. cpu4, cpu5, cpu6, cpu7 = A7 (2 clusters)
exynos5422: cpu0, cpu1, cpu2, cpu3 = A7. cpu4, cpu5, cpu6, cpu7 = A15 (2 clusters)
exynos5440: cpu0, cpu1, cpu2, cpu3 = A15 (1 cluster)

Quoted 4 lines

Of these the only ones which has A7 as the 1st cluster are:
exynos3250: cpu0, cpu1 = A7
exynos5420: cpu0, cpu1, cpu2, cpu3 = A15. cpu4, cpu5, cpu6, cpu7 = A7 (2 clusters)

Did you mean 5422 for this second one i.e.
exynos5422: cpu0, cpu1, cpu2, cpu3 = A7. cpu4, cpu5, cpu6, cpu7 = A15 (2 clusters) ? (I'm assuming you did)

In such configurations does the second cluster (A15s in this case) need the same magic dance as you were adding for the A7s in the other cases?

Quoted 60 lines

Note that the exynos5800 has the same cpu config as the exysno5420.

I was looking at the cpu bring up code, and notice that if the secondary cpu being brought up is an A7, then it invariably does the below:
For the exynos3250: in platsmp.c
void exynos_core_restart(u32 core_id)

{ 
        u32 val;

        if (!of_machine_is_compatible("samsung,exynos3250"))
                return;

        while (!pmu_raw_readl(S5P_PMU_SPARE2))
                udelay(10);
        udelay(10);

        val = pmu_raw_readl(EXYNOS_ARM_CORE_STATUS(core_id));
        val |= S5P_CORE_WAKEUP_FROM_LOCAL_CFG;
        pmu_raw_writel(val, EXYNOS_ARM_CORE_STATUS(core_id));

        pmu_raw_writel(EXYNOS_CORE_PO_RESET(core_id), EXYNOS_SWRESET);
}

And for the exynos5800/exynos5422: mcpm-exynos.c
static int exynos_cpu_powerup(unsigned int cpu, unsigned int cluster)

{
        unsigned int cpunr = cpu + (cluster * EXYNOS5420_CPUS_PER_CLUSTER);

        pr_debug("%s: cpu %u cluster %u\n", __func__, cpu, cluster);
        if (cpu >= EXYNOS5420_CPUS_PER_CLUSTER ||
                cluster >= EXYNOS5420_NR_CLUSTERS)
                return -EINVAL;

        if (!exynos_cpu_power_state(cpunr)) {
                exynos_cpu_power_up(cpunr);

                /*
                 * This assumes the cluster number of the big cores(Cortex A15)
                 * is 0 and the Little cores(Cortex A7) is 1.
                * When the system was booted from the Little core,
                 * they should be reset during power up cpu.
                 */
                if (cluster &&
                    cluster == MPIDR_AFFINITY_LEVEL(cpu_logical_map(0), 1)) {
                        /*
                         * Before we reset the Little cores, we should wait
                         * the SPARE2 register is set to 1 because the init
                         * codes of the iROM will set the register after
                         * initialization.
                         */
                        while (!pmu_raw_readl(S5P_PMU_SPARE2))
                                udelay(10);

                        pmu_raw_writel(EXYNOS5420_KFC_CORE_RESET(cpu),
                                        EXYNOS_SWRESET);
                }
        }

        return 0;
}
Quoted 2 lines

This pretty much indicates that when bringing up the A7s, the special reset sequence is deemed essential.

If (and only if) they are in the second cluster?

Quoted 2 lines

Probably, we could generalize that it might be true for future
exynos's having A7s.

This whole thing has turned into a bit of a tarpit, sorry :-/

I think I'd be happiest with code which explicitly checked for SoC configurations which we know about (and ideally can test) over code which tries to predict what future SoC variants will do -- we can always patch them in later.

Essentially I think that just means adding some machine_is_compatible type checks to the code you already have rather than relying on the overall compatibility list only have a couple of entries right now and implicitly relying on the differences between them (the presence/absence of a second cluster in this case).

Ian.

#10 lore raw
Quoted 255 lines · Ian Campbell
Quoted 146 lines · Suriyan Ramasami
Quoted 132 lines · Ian Campbell
Quoted 3 lines · Suriyan Ramasami

On Wed, Feb 10, 2016 at 2:03 AM, Ian Campbell <

[email protected]>

Quoted 4 lines
Quoted 3 lines · wrote:
Quoted 2 lines · Suriyan Ramasami

I agree on the first two paragraphs.

Quoted 1 line
Quoted 1 line

For the third paragraph, the rebuttal is that the

exynos5800 and

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

exynos5422 based SoCs can have both clusters on at the

same time.

Quoted 2 lines
Quoted 2 lines

Hence,

Quoted 1 line
Quoted 1 line
Quoted 1 line

the third paragrapah comment will have to be tweaked

further.

Quoted 3 lines
Quoted 3 lines

Possibly

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

reading:
The exynos5800 and exynos5422 can have both clusters on

at the

Quoted 4 lines
Quoted 4 lines

same time.

Quoted 1 line
Quoted 1 line
Quoted 1 line

The exynos5800 boots up with cpu0 on cluster0 (A15). The

exynos5422 can

Quoted 1 line
Quoted 1 line
Quoted 1 line

boot up on either clusters as its pin controlled. In this

case

Quoted 4 lines
Quoted 4 lines

the DTS

Quoted 3 lines
Quoted 3 lines
Quoted 1 line

should properly reflect the cpu order.

Does the OS need to be aware of all these combinations

though? Is

Quoted 2 lines
Quoted 2 lines

it not

Quoted 1 line
Quoted 1 line

sufficient to know how to bring up an A15 core and how to

bring up

Quoted 2 lines
Quoted 2 lines

an A7

Quoted 1 line
Quoted 1 line

core and then just do so based on the information in the

DTS,

Quoted 2 lines
Quoted 2 lines

without

Quoted 1 line
Quoted 1 line

needing to worry about which sort of core we happened to

have

Quoted 6 lines
Quoted 6 lines

booted on?

Quoted 3 lines
Quoted 2 lines

Unfortunately, at least looking at the boot up code for the

Exynos5422,

Quoted 1 line

the OS needs to be aware of it. This is what I see in the

linux

Quoted 2 lines
Quoted 2 lines

source

Quoted 1 line

code. If it boots up on an A7, then a special reset is needed

which

Quoted 2 lines
Quoted 2 lines

is

Quoted 1 line

not needed when booted up otherwise. I do not have much more

details

Quoted 3 lines
Quoted 3 lines

on

Quoted 2 lines

that other than the Linux code.
Without that reset sequence, I have also verified that the

powered on

Quoted 4 lines
Quoted 4 lines

CPU

Quoted 1 line

does not come up.

Are we able to say that if we are booted on cluster 1 (always

the A7s)

Quoted 2 lines
Quoted 2 lines

then
we always need this magic reset? i.e. is true for all SoCs

which have

Quoted 2 lines
Quoted 2 lines

an A7
cluster and can boot from it? (it's tautologically true for

SocS which

Quoted 3 lines
Quoted 2 lines

either have no A7's or cannot boot from them).

I do not have the information to answer the question. I am

limited to

Quoted 1 line

what I know (albeit a little bit) wrt the hardkernel related

boards -

Quoted 1 line

Exynos 5410 (odroid-XU) and the Exynos 5422 (Odoird XU3/XU4).

With my

Quoted 1 line

limited knowledge, I am only aware of Exynos 5410 which is

capable of

Quoted 3 lines

booting off of an A7 or an A15.

Quoted 1 line

Maybe I'm looking for similarities between different exynos

variants

Quoted 2 lines
Quoted 2 lines

which
doesn't exist though. If we are going to talk about specific

SoCs in

Quoted 2 lines
Quoted 2 lines

the
comments then I would rather that the code was also explicit

rather

Quoted 2 lines
Quoted 2 lines

than
assuming cluster 1 will only be found on the 5800, that might

be as

Quoted 2 lines
Quoted 2 lines

simple
as mapping the compatible string to a max_cluster (default 0

for

Quoted 3 lines
Quoted 2 lines

unknown
SoC) and warning if pcluster > max_cluster.

Can you please elaborate on the mapping that you talk about

above. I am

Quoted 1 line

lost here :-(

What I mean is can we say:

    exynos 1234 => Two clusters (max_cluster == 1)
    exynos 5678 => One cluster (max_cluster == 0)
    exynos ABCD => Two clusters (max_cluster == 1)
    Unknown     => Assume one cluster

and can we also assume that cluster 0 always consists of A15s and cluster 1
(if it exists) always consists of A7s?

If so then we can say:

max_cluster = look_up_by_compat(compat)
pcluster = figure out from midr
pcpu = figure it out

if (pcluster >= max_cluster)
error

do bringup

if (pluster == 1)

    do special handling for cluster 1 == a7

The difference compared with what you have is that it adds a check that we
expect a second cluster for the SoC before it goes poking at stuff.

What I'm trying to avoid is coming across some other SoC variant which has
2 clusters but has something different to the A7s or which requires some
different handling.

Quoted 7 lines

If we were confident that all exynosXXXX SoCs always require the same
special handling for cluster 1 then we wouldn't really need this, but I
don't think we know that?

I did some looking at the linux 4.4.y dts for exynos, and this is what I see:

[...]

Quoted 13 lines

If we look at the ones that can potentially support hardware virtualization, limits us to the A7s and the A15s. That gives us:
exynos3250: cpu0, cpu1 = A7 (1 cluster)
exynos5250: cpu0, cpu1 = A15 (1 cluster)
exynos5260: cpu0, cpu1 = A15. cpu2, cpu3, cpu4, cpu5 = A7 (2 clusters)
exynos5410: cpu0, cpu1, cpu2, cpu3 = A15 (1 cluster)
exynos5420: cpu0, cpu1, cpu2, cpu3 = A15. cpu4, cpu5, cpu6, cpu7 = A7 (2 clusters)
exynos5422: cpu0, cpu1, cpu2, cpu3 = A7. cpu4, cpu5, cpu6, cpu7 = A15 (2 clusters)
exynos5440: cpu0, cpu1, cpu2, cpu3 = A15 (1 cluster)

Quoted 4 lines

Of these the only ones which has A7 as the 1st cluster are:
exynos3250: cpu0, cpu1 = A7
exynos5420: cpu0, cpu1, cpu2, cpu3 = A15. cpu4, cpu5, cpu6, cpu7 = A7 (2 clusters)

Did you mean 5422 for this second one i.e.
exynos5422: cpu0, cpu1, cpu2, cpu3 = A7. cpu4, cpu5, cpu6, cpu7 = A15 (2 clusters)
? (I'm assuming you did)

In such configurations does the second cluster (A15s in this case) need the same magic dance as you were adding for the A7s in the other cases?

Quoted 3 lines

Note that the exynos5800 has the same cpu config as the exysno5420.

I was looking at the cpu bring up code, and notice that if the secondary

cpu being brought up is an A7, then it invariably does the below:

Quoted 19 lines

For the exynos3250: in platsmp.c
void exynos_core_restart(u32 core_id)

{
        u32 val;

        if (!of_machine_is_compatible("samsung,exynos3250"))
                return;

        while (!pmu_raw_readl(S5P_PMU_SPARE2))
                udelay(10);
        udelay(10);

        val = pmu_raw_readl(EXYNOS_ARM_CORE_STATUS(core_id));
        val |= S5P_CORE_WAKEUP_FROM_LOCAL_CFG;
        pmu_raw_writel(val, EXYNOS_ARM_CORE_STATUS(core_id));

        pmu_raw_writel(EXYNOS_CORE_PO_RESET(core_id), EXYNOS_SWRESET);
}
Quoted 4 lines

And for the exynos5800/exynos5422: mcpm-exynos.c
static int exynos_cpu_powerup(unsigned int cpu, unsigned int cluster) {
unsigned int cpunr = cpu + (cluster *

EXYNOS5420_CPUS_PER_CLUSTER);

Quoted 11 lines
        pr_debug("%s: cpu %u cluster %u\n", __func__, cpu, cluster);
        if (cpu >= EXYNOS5420_CPUS_PER_CLUSTER ||
                cluster >= EXYNOS5420_NR_CLUSTERS)
                return -EINVAL;

        if (!exynos_cpu_power_state(cpunr)) {
                exynos_cpu_power_up(cpunr);

                /*
                 * This assumes the cluster number of the big

cores(Cortex A15)

Quoted 6 lines

* is 0 and the Little cores(Cortex A7) is 1.
* When the system was booted from the Little core,
* they should be reset during power up cpu. */
if (cluster &&
cluster == MPIDR_AFFINITY_LEVEL(cpu_logical_map(0),

1)) {

Quoted 2 lines

/*
* Before we reset the Little cores, we should

wait

Quoted 1 line

* the SPARE2 register is set to 1 because the

init

Quoted 14 lines
                         * codes of the iROM will set the register after
                         * initialization.
                         */
                        while (!pmu_raw_readl(S5P_PMU_SPARE2))
                                udelay(10);

                        pmu_raw_writel(EXYNOS5420_KFC_CORE_RESET(cpu),
                                        EXYNOS_SWRESET);
                }
        }

        return 0;
}
Quoted 2 lines

This pretty much indicates that when bringing up the A7s, the special reset sequence is deemed essential.

If (and only if) they are in the second cluster?

Quoted 2 lines

Probably, we could generalize that it might be true for future
exynos's having A7s.

This whole thing has turned into a bit of a tarpit, sorry :-/

I think I'd be happiest with code which explicitly checked for SoC configurations which we know about (and ideally can test) over code which tries to predict what future SoC variants will do -- we can always patch them in later.

Quoted 7 lines

Essentially I think that just means adding some machine_is_compatible type checks to the code you already have rather than relying on the overall compatibility list only have a couple of entries right now and implicitly relying on the differences between them (the presence/absence of a second cluster in this case).

I agree. Instead of generalizing (which this patch did), I will do a function call for the A7 powering up sequence, in case it's machine_is_compatible with exynos5800.

I am still moping over the cpupool suggestion :-)

Quoted 2 lines

Ian.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel