diff mbox

[U-Boot,PATCHv6,4/6] ARMv8/Layerscape: switch SMP method accordingly

Message ID 1466566259-33431-4-git-send-email-Zhiqiang.Hou@nxp.com
State Superseded
Delegated to: York Sun
Headers show

Commit Message

Z.Q. Hou June 22, 2016, 3:30 a.m. UTC
From: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>

If the PSCI and PPA is ready, skip the fixup for spin-table and
waking secondary cores. Otherwise, change SMP method to spin-table,
and the device node of PSCI will be removed.

Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
---
V6:
 - no change

V5:
 - Changed the checking if the PSCI feature is ready to read the psci version.

V4:
 - Reordered this patch.

 arch/arm/cpu/armv8/fsl-layerscape/cpu.c | 17 ++++++++++++++---
 arch/arm/cpu/armv8/fsl-layerscape/fdt.c | 34 +++++++++++++++++++++++++++++++++
 2 files changed, 48 insertions(+), 3 deletions(-)

Comments

York Sun June 22, 2016, 4:21 p.m. UTC | #1
On 06/21/2016 08:45 PM, Zhiqiang Hou wrote:
> From: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
>
> If the PSCI and PPA is ready, skip the fixup for spin-table and
> waking secondary cores. Otherwise, change SMP method to spin-table,
> and the device node of PSCI will be removed.
>
> Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
> ---
> V6:
>   - no change
>
> V5:
>   - Changed the checking if the PSCI feature is ready to read the psci version.
>
> V4:
>   - Reordered this patch.
>
>   arch/arm/cpu/armv8/fsl-layerscape/cpu.c | 17 ++++++++++++++---
>   arch/arm/cpu/armv8/fsl-layerscape/fdt.c | 34 +++++++++++++++++++++++++++++++++
>   2 files changed, 48 insertions(+), 3 deletions(-)
>
> diff --git a/arch/arm/cpu/armv8/fsl-layerscape/cpu.c b/arch/arm/cpu/armv8/fsl-layerscape/cpu.c
> index d5bcf67..f284b77 100644
> --- a/arch/arm/cpu/armv8/fsl-layerscape/cpu.c
> +++ b/arch/arm/cpu/armv8/fsl-layerscape/cpu.c
> @@ -23,6 +23,9 @@
>   #ifdef CONFIG_FSL_ESDHC
>   #include <fsl_esdhc.h>
>   #endif
> +#ifdef CONFIG_ARMV8_SEC_FIRMWARE_SUPPORT
> +#include <asm/armv8/sec_firmware.h>
> +#endif
>
>   DECLARE_GLOBAL_DATA_PTR;
>
> @@ -622,6 +625,7 @@ int arch_early_init_r(void)
>   {
>   #ifdef CONFIG_MP
>   	int rv = 1;
> +	bool psci_support = false;
>   #endif
>
>   #ifdef CONFIG_SYS_FSL_ERRATUM_A009635
> @@ -629,9 +633,16 @@ int arch_early_init_r(void)
>   #endif
>
>   #ifdef CONFIG_MP
> -	rv = fsl_layerscape_wake_seconday_cores();
> -	if (rv)
> -		printf("Did not wake secondary cores\n");
> +#if defined(CONFIG_ARMV8_SEC_FIRMWARE_SUPPORT) && defined(CONFIG_ARMV8_PSCI)
> +	/* Check the psci version to determine if the psci is supported */
> +	psci_support = sec_firmware_support_psci_version() != 0xffffffff ?
> +			true : false;

If the only error code is 0xffffffff, you can delete the "? true : 
false" part. The logical operation results "true" or "false" already.

> +#endif
> +	if (!psci_support) {
> +		rv = fsl_layerscape_wake_seconday_cores();
> +		if (rv)
> +			printf("Did not wake secondary cores\n");
> +	}
>   #endif

<snip>

York
Z.Q. Hou June 23, 2016, 3:56 a.m. UTC | #2
Hi York,

Thanks for your comments!

> -----Original Message-----

> From: york sun

> Sent: 2016年6月23日 0:22

> To: Zhiqiang Hou <zhiqiang.hou@nxp.com>; u-boot@lists.denx.de;

> albert.u.boot@aribaud.net; scottwood@freescale.com;

> Mingkai.hu@freescale.com; yorksun@freescale.com; leoli@freescale.com;

> prabhakar@freescale.com; bhupesh.sharma@freescale.com

> Subject: Re: [PATCHv6 4/6] ARMv8/Layerscape: switch SMP method accordingly

> 

> On 06/21/2016 08:45 PM, Zhiqiang Hou wrote:

> > From: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>

> >

> > If the PSCI and PPA is ready, skip the fixup for spin-table and waking

> > secondary cores. Otherwise, change SMP method to spin-table, and the

> > device node of PSCI will be removed.

> >

> > Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>

> > ---

> > V6:

> >   - no change

> >

> > V5:

> >   - Changed the checking if the PSCI feature is ready to read the psci version.

> >

> > V4:

> >   - Reordered this patch.

> >

> >   arch/arm/cpu/armv8/fsl-layerscape/cpu.c | 17 ++++++++++++++---

> >   arch/arm/cpu/armv8/fsl-layerscape/fdt.c | 34

> +++++++++++++++++++++++++++++++++

> >   2 files changed, 48 insertions(+), 3 deletions(-)

> >

> > diff --git a/arch/arm/cpu/armv8/fsl-layerscape/cpu.c

> > b/arch/arm/cpu/armv8/fsl-layerscape/cpu.c

> > index d5bcf67..f284b77 100644

> > --- a/arch/arm/cpu/armv8/fsl-layerscape/cpu.c

> > +++ b/arch/arm/cpu/armv8/fsl-layerscape/cpu.c

> > @@ -23,6 +23,9 @@

> >   #ifdef CONFIG_FSL_ESDHC

> >   #include <fsl_esdhc.h>

> >   #endif

> > +#ifdef CONFIG_ARMV8_SEC_FIRMWARE_SUPPORT #include

> > +<asm/armv8/sec_firmware.h> #endif

> >

> >   DECLARE_GLOBAL_DATA_PTR;

> >

> > @@ -622,6 +625,7 @@ int arch_early_init_r(void)

> >   {

> >   #ifdef CONFIG_MP

> >   	int rv = 1;

> > +	bool psci_support = false;

> >   #endif

> >

> >   #ifdef CONFIG_SYS_FSL_ERRATUM_A009635 @@ -629,9 +633,16 @@ int

> > arch_early_init_r(void)

> >   #endif

> >

> >   #ifdef CONFIG_MP

> > -	rv = fsl_layerscape_wake_seconday_cores();

> > -	if (rv)

> > -		printf("Did not wake secondary cores\n");

> > +#if defined(CONFIG_ARMV8_SEC_FIRMWARE_SUPPORT) &&

> defined(CONFIG_ARMV8_PSCI)

> > +	/* Check the psci version to determine if the psci is supported */

> > +	psci_support = sec_firmware_support_psci_version() != 0xffffffff ?

> > +			true : false;

> 

> If the only error code is 0xffffffff, you can delete the "? true :

> false" part. The logical operation results "true" or "false" already.

> 


Yes, will fix it.

> > +#endif

> > +	if (!psci_support) {

> > +		rv = fsl_layerscape_wake_seconday_cores();

> > +		if (rv)

> > +			printf("Did not wake secondary cores\n");

> > +	}

> >   #endif

> 

> <snip>


Thanks,
Zhiqiang
diff mbox

Patch

diff --git a/arch/arm/cpu/armv8/fsl-layerscape/cpu.c b/arch/arm/cpu/armv8/fsl-layerscape/cpu.c
index d5bcf67..f284b77 100644
--- a/arch/arm/cpu/armv8/fsl-layerscape/cpu.c
+++ b/arch/arm/cpu/armv8/fsl-layerscape/cpu.c
@@ -23,6 +23,9 @@ 
 #ifdef CONFIG_FSL_ESDHC
 #include <fsl_esdhc.h>
 #endif
+#ifdef CONFIG_ARMV8_SEC_FIRMWARE_SUPPORT
+#include <asm/armv8/sec_firmware.h>
+#endif
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -622,6 +625,7 @@  int arch_early_init_r(void)
 {
 #ifdef CONFIG_MP
 	int rv = 1;
+	bool psci_support = false;
 #endif
 
 #ifdef CONFIG_SYS_FSL_ERRATUM_A009635
@@ -629,9 +633,16 @@  int arch_early_init_r(void)
 #endif
 
 #ifdef CONFIG_MP
-	rv = fsl_layerscape_wake_seconday_cores();
-	if (rv)
-		printf("Did not wake secondary cores\n");
+#if defined(CONFIG_ARMV8_SEC_FIRMWARE_SUPPORT) && defined(CONFIG_ARMV8_PSCI)
+	/* Check the psci version to determine if the psci is supported */
+	psci_support = sec_firmware_support_psci_version() != 0xffffffff ?
+			true : false;
+#endif
+	if (!psci_support) {
+		rv = fsl_layerscape_wake_seconday_cores();
+		if (rv)
+			printf("Did not wake secondary cores\n");
+	}
 #endif
 
 #ifdef CONFIG_SYS_HAS_SERDES
diff --git a/arch/arm/cpu/armv8/fsl-layerscape/fdt.c b/arch/arm/cpu/armv8/fsl-layerscape/fdt.c
index d17227a..c918831 100644
--- a/arch/arm/cpu/armv8/fsl-layerscape/fdt.c
+++ b/arch/arm/cpu/armv8/fsl-layerscape/fdt.c
@@ -22,6 +22,9 @@ 
 #endif
 #include <fsl_sec.h>
 #include <asm/arch-fsl-layerscape/soc.h>
+#ifdef CONFIG_ARMV8_SEC_FIRMWARE_SUPPORT
+#include <asm/armv8/sec_firmware.h>
+#endif
 
 int fdt_fixup_phy_connection(void *blob, int offset, phy_interface_t phyc)
 {
@@ -38,7 +41,38 @@  void ft_fixup_cpu(void *blob)
 	int addr_cells;
 	u64 val, core_id;
 	size_t *boot_code_size = &(__secondary_boot_code_size);
+#if defined(CONFIG_ARMV8_SEC_FIRMWARE_SUPPORT) && defined(CONFIG_ARMV8_PSCI)
+	int node;
+	bool psci_support;
+
+	/* Check the psci version to determine if the psci is supported */
+	psci_support = sec_firmware_support_psci_version() != 0xffffffff ?
+			true : false;
+	if (!psci_support) {
+		/* remove psci DT node */
+		node = fdt_path_offset(blob, "/psci");
+		if (node >= 0)
+			goto remove_psci_node;
+
+		node = fdt_node_offset_by_compatible(blob, -1, "arm,psci");
+		if (node >= 0)
+			goto remove_psci_node;
+
+		node = fdt_node_offset_by_compatible(blob, -1, "arm,psci-0.2");
+		if (node >= 0)
+			goto remove_psci_node;
 
+		node = fdt_node_offset_by_compatible(blob, -1, "arm,psci-1.0");
+		if (node >= 0)
+			goto remove_psci_node;
+
+remove_psci_node:
+		if (node >= 0)
+			fdt_del_node(blob, node);
+	} else {
+		return;
+	}
+#endif
 	off = fdt_path_offset(blob, "/cpus");
 	if (off < 0) {
 		puts("couldn't find /cpus node\n");