Re: [U-Boot] [PATCHv4 4/7] ARMv8/Layerscape: switch SMP method to spin-table when the PSCI isn't available

2016-05-30 Thread Zhiqiang Hou
Hi York,

Thanks a lot for your comments and suggestions!

> -Original Message-
> From: York Sun [mailto:york@nxp.com]
> Sent: 2016年5月28日 2:06
> To: Zhiqiang Hou ; u-boot@lists.denx.de;
> albert.u.b...@aribaud.net; scottw...@freescale.com;
> mingkai...@freescale.com; york...@freescale.com; le...@freescale.com;
> prabha...@freescale.com; bhupesh.sha...@freescale.com
> Subject: Re: [PATCHv4 4/7] ARMv8/Layerscape: switch SMP method to spin-table
> when the PSCI isn't available
> 
> On 05/23/2016 04:49 AM, Zhiqiang Hou wrote:
> > From: Hou Zhiqiang 
> >
> > If the PSCI and PPA is ready, skip the fixup for spin-table and waking
> > secondary cores. If not, change SMP method to spin-table, and the
> > device node of PSCI will be removed.
> 
> I don't see how you change the boot method to spin-table. It has been 
> spin-table
> all the way. Actually you change the boot method to psci when the image is 
> valid.
> 

If the macro CONFIG_FSL_LS_PPA && CONFIG_ARMV8_PSCI is defined but the
sec firmware is invalid, the PSCI node will be removed, then the other code in 
the
function ft_fixup_cpu() will change the boot method to spin-table. Otherwise the
function ft_fixup_cpu() will return directly.

> >
> > Signed-off-by: Hou Zhiqiang 
> > ---
> > V4:
> >  - Reordered this patch.
> 
> 
> 
> >  int fdt_fixup_phy_connection(void *blob, int offset, phy_interface_t
> > phyc)  { @@ -36,7 +39,35 @@ 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_FSL_LS_PPA) && defined(CONFIG_ARMV8_PSCI)
> > +   int node;
> > +#endif
> > +
> > +#if defined(CONFIG_FSL_LS_PPA) && defined(CONFIG_ARMV8_PSCI)
> > +   if (sec_firmware_validate()) {
> 
> This function name is confusing. It returns non-zero when the image is not 
> valid.
> Please consider to change the name.
 
Yes, will change the name in next version.

> Does the existence of such image guarantee it has been loaded successfully?
> Would it be possible to detect the psci feature is up and running?

Your suggestion is great, but I'm not sure if there is an interface to check 
the psci feature.
Will check it and update, thanks!

> 
> > +   /* 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");
> >
> 
> I see you are removing the psci nodes. Do you need to update the cpus nodes 
> with
> enable-method here? You have it done in next patch cpu_update_dt_psci().

If the macro CONFIG_FSL_LS_PPA && CONFIG_ARMV8_PSCI isn't defined or the sec
firmware is invalid, the enable-method will be changed to spin-table in this 
function.

Thanks,
Zhiqiang

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCHv4 4/7] ARMv8/Layerscape: switch SMP method to spin-table when the PSCI isn't available

2016-05-27 Thread York Sun
On 05/23/2016 04:49 AM, Zhiqiang Hou wrote:
> From: Hou Zhiqiang 
> 
> If the PSCI and PPA is ready, skip the fixup for spin-table and
> waking secondary cores. If not, change SMP method to spin-table,
> and the device node of PSCI will be removed.

I don't see how you change the boot method to spin-table. It has been spin-table
all the way. Actually you change the boot method to psci when the image is 
valid.

> 
> Signed-off-by: Hou Zhiqiang 
> ---
> V4:
>  - Reordered this patch.



>  int fdt_fixup_phy_connection(void *blob, int offset, phy_interface_t phyc)
>  {
> @@ -36,7 +39,35 @@ 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_FSL_LS_PPA) && defined(CONFIG_ARMV8_PSCI)
> + int node;
> +#endif
> +
> +#if defined(CONFIG_FSL_LS_PPA) && defined(CONFIG_ARMV8_PSCI)
> + if (sec_firmware_validate()) {

This function name is confusing. It returns non-zero when the image is not
valid. Please consider to change the name.

Does the existence of such image guarantee it has been loaded successfully?
Would it be possible to detect the psci feature is up and running?

> + /* 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");
> 

I see you are removing the psci nodes. Do you need to update the cpus nodes with
enable-method here? You have it done in next patch cpu_update_dt_psci().

York

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCHv4 4/7] ARMv8/Layerscape: switch SMP method to spin-table when the PSCI isn't available

2016-05-23 Thread Zhiqiang Hou
From: Hou Zhiqiang 

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

Signed-off-by: Hou Zhiqiang 
---
V4:
 - Reordered this patch.

 arch/arm/cpu/armv8/fsl-layerscape/cpu.c | 14 +++---
 arch/arm/cpu/armv8/fsl-layerscape/fdt.c | 31 +++
 2 files changed, 42 insertions(+), 3 deletions(-)

diff --git a/arch/arm/cpu/armv8/fsl-layerscape/cpu.c 
b/arch/arm/cpu/armv8/fsl-layerscape/cpu.c
index 672a453..937f7ec 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 
 #endif
+#ifdef CONFIG_FSL_LS_PPA
+#include 
+#endif
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -625,9 +628,14 @@ 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_FSL_LS_PPA) && defined(CONFIG_ARMV8_PSCI)
+   if (sec_firmware_validate())
+#endif
+   {
+   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 1e875c4..333b973 100644
--- a/arch/arm/cpu/armv8/fsl-layerscape/fdt.c
+++ b/arch/arm/cpu/armv8/fsl-layerscape/fdt.c
@@ -20,6 +20,9 @@
 #ifdef CONFIG_MP
 #include 
 #endif
+#ifdef CONFIG_FSL_LS_PPA
+#include 
+#endif
 
 int fdt_fixup_phy_connection(void *blob, int offset, phy_interface_t phyc)
 {
@@ -36,7 +39,35 @@ 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_FSL_LS_PPA) && defined(CONFIG_ARMV8_PSCI)
+   int node;
+#endif
+
+#if defined(CONFIG_FSL_LS_PPA) && defined(CONFIG_ARMV8_PSCI)
+   if (sec_firmware_validate()) {
+   /* 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");
-- 
2.1.0.27.g96db324

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot