public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] ARM: HYP/non-sec: relocation before enable secondary cores
@ 2015-02-04 10:15 Peng Fan
  2015-02-04 11:02 ` Marc Zyngier
  0 siblings, 1 reply; 5+ messages in thread
From: Peng Fan @ 2015-02-04 10:15 UTC (permalink / raw)
  To: u-boot

If CONFIG_ARMV7_PSCI is not defined and CONFIG_ARMV7_SECURE_BASE is defined,
smp_kicl_all_cpus may enable secondary cores and runs into secure_ram_addr(
_smp_pen), before code is relocated to secure ram.
So need relocation to secure ram before enable secondary cores.

Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
---
 arch/arm/cpu/armv7/virt-v7.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/arch/arm/cpu/armv7/virt-v7.c b/arch/arm/cpu/armv7/virt-v7.c
index b69fd37..4cb8806 100644
--- a/arch/arm/cpu/armv7/virt-v7.c
+++ b/arch/arm/cpu/armv7/virt-v7.c
@@ -112,13 +112,20 @@ int armv7_init_nonsec(void)
 	for (i = 1; i <= itlinesnr; i++)
 		writel((unsigned)-1, gic_dist_addr + GICD_IGROUPRn + 4 * i);
 
+	/*
+	 * Relocate secure section before any cpu runs in secure ram.
+	 * smp_kick_all_cpus may enable other cores and runs into secure
+	 * ram, so need to relocate secure section before enabling other
+	 * cores.
+	 */
+	relocate_secure_section();
+
 #ifndef CONFIG_ARMV7_PSCI
 	smp_set_core_boot_addr((unsigned long)secure_ram_addr(_smp_pen), -1);
 	smp_kick_all_cpus();
 #endif
 
 	/* call the non-sec switching code on this CPU also */
-	relocate_secure_section();
 	secure_ram_addr(_nonsec_init)();
 	return 0;
 }
-- 
1.8.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [U-Boot] [PATCH] ARM: HYP/non-sec: relocation before enable secondary cores
  2015-02-04 10:15 [U-Boot] [PATCH] ARM: HYP/non-sec: relocation before enable secondary cores Peng Fan
@ 2015-02-04 11:02 ` Marc Zyngier
  2015-02-13  1:37   ` Peng Fan
  0 siblings, 1 reply; 5+ messages in thread
From: Marc Zyngier @ 2015-02-04 11:02 UTC (permalink / raw)
  To: u-boot

On 04/02/15 10:15, Peng Fan wrote:
> If CONFIG_ARMV7_PSCI is not defined and CONFIG_ARMV7_SECURE_BASE is defined,
> smp_kicl_all_cpus may enable secondary cores and runs into secure_ram_addr(
> _smp_pen), before code is relocated to secure ram.
> So need relocation to secure ram before enable secondary cores.
> 
> Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
> ---
>  arch/arm/cpu/armv7/virt-v7.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm/cpu/armv7/virt-v7.c b/arch/arm/cpu/armv7/virt-v7.c
> index b69fd37..4cb8806 100644
> --- a/arch/arm/cpu/armv7/virt-v7.c
> +++ b/arch/arm/cpu/armv7/virt-v7.c
> @@ -112,13 +112,20 @@ int armv7_init_nonsec(void)
>  	for (i = 1; i <= itlinesnr; i++)
>  		writel((unsigned)-1, gic_dist_addr + GICD_IGROUPRn + 4 * i);
>  
> +	/*
> +	 * Relocate secure section before any cpu runs in secure ram.
> +	 * smp_kick_all_cpus may enable other cores and runs into secure
> +	 * ram, so need to relocate secure section before enabling other
> +	 * cores.
> +	 */
> +	relocate_secure_section();
> +
>  #ifndef CONFIG_ARMV7_PSCI
>  	smp_set_core_boot_addr((unsigned long)secure_ram_addr(_smp_pen), -1);
>  	smp_kick_all_cpus();
>  #endif
>  
>  	/* call the non-sec switching code on this CPU also */
> -	relocate_secure_section();
>  	secure_ram_addr(_nonsec_init)();
>  	return 0;
>  }
> 

Seems like a sensible thing to do. FWIW:

Acked-by: Marc Zyngier <marc.zyngier@arm.com>

	M.
-- 
Jazz is not dead. It just smells funny...

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [U-Boot] [PATCH] ARM: HYP/non-sec: relocation before enable secondary cores
  2015-02-04 11:02 ` Marc Zyngier
@ 2015-02-13  1:37   ` Peng Fan
  2015-02-13 18:09     ` Tom Rini
  0 siblings, 1 reply; 5+ messages in thread
From: Peng Fan @ 2015-02-13  1:37 UTC (permalink / raw)
  To: u-boot

Hi, Albert and Tom

On 2/4/2015 7:02 PM, Marc Zyngier wrote:
> On 04/02/15 10:15, Peng Fan wrote:
>> If CONFIG_ARMV7_PSCI is not defined and CONFIG_ARMV7_SECURE_BASE is defined,
>> smp_kicl_all_cpus may enable secondary cores and runs into secure_ram_addr(
>> _smp_pen), before code is relocated to secure ram.
>> So need relocation to secure ram before enable secondary cores.
>>
>> Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
>> ---
>>   arch/arm/cpu/armv7/virt-v7.c | 9 ++++++++-
>>   1 file changed, 8 insertions(+), 1 deletion(-)
>>
>> diff --git a/arch/arm/cpu/armv7/virt-v7.c b/arch/arm/cpu/armv7/virt-v7.c
>> index b69fd37..4cb8806 100644
>> --- a/arch/arm/cpu/armv7/virt-v7.c
>> +++ b/arch/arm/cpu/armv7/virt-v7.c
>> @@ -112,13 +112,20 @@ int armv7_init_nonsec(void)
>>   	for (i = 1; i <= itlinesnr; i++)
>>   		writel((unsigned)-1, gic_dist_addr + GICD_IGROUPRn + 4 * i);
>>   
>> +	/*
>> +	 * Relocate secure section before any cpu runs in secure ram.
>> +	 * smp_kick_all_cpus may enable other cores and runs into secure
>> +	 * ram, so need to relocate secure section before enabling other
>> +	 * cores.
>> +	 */
>> +	relocate_secure_section();
>> +
>>   #ifndef CONFIG_ARMV7_PSCI
>>   	smp_set_core_boot_addr((unsigned long)secure_ram_addr(_smp_pen), -1);
>>   	smp_kick_all_cpus();
>>   #endif
>>   
>>   	/* call the non-sec switching code on this CPU also */
>> -	relocate_secure_section();
>>   	secure_ram_addr(_nonsec_init)();
>>   	return 0;
>>   }
>>
> Seems like a sensible thing to do. FWIW:
>
> Acked-by: Marc Zyngier <marc.zyngier@arm.com>
Just kindly remind. Will this patch be merged into u-boot-arm git repo 
or directly into u-boot master git repo?
>
> 	M.
Thanks,
Peng.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [U-Boot] [PATCH] ARM: HYP/non-sec: relocation before enable secondary cores
  2015-02-13  1:37   ` Peng Fan
@ 2015-02-13 18:09     ` Tom Rini
  2015-03-27 15:45       ` Albert ARIBAUD
  0 siblings, 1 reply; 5+ messages in thread
From: Tom Rini @ 2015-02-13 18:09 UTC (permalink / raw)
  To: u-boot

On Fri, Feb 13, 2015 at 09:37:23AM +0800, Peng Fan wrote:
> Hi, Albert and Tom
> 
> On 2/4/2015 7:02 PM, Marc Zyngier wrote:
> >On 04/02/15 10:15, Peng Fan wrote:
> >>If CONFIG_ARMV7_PSCI is not defined and CONFIG_ARMV7_SECURE_BASE is defined,
> >>smp_kicl_all_cpus may enable secondary cores and runs into secure_ram_addr(
> >>_smp_pen), before code is relocated to secure ram.
> >>So need relocation to secure ram before enable secondary cores.
> >>
> >>Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
> >>---
> >>  arch/arm/cpu/armv7/virt-v7.c | 9 ++++++++-
> >>  1 file changed, 8 insertions(+), 1 deletion(-)
> >>
> >>diff --git a/arch/arm/cpu/armv7/virt-v7.c b/arch/arm/cpu/armv7/virt-v7.c
> >>index b69fd37..4cb8806 100644
> >>--- a/arch/arm/cpu/armv7/virt-v7.c
> >>+++ b/arch/arm/cpu/armv7/virt-v7.c
> >>@@ -112,13 +112,20 @@ int armv7_init_nonsec(void)
> >>  	for (i = 1; i <= itlinesnr; i++)
> >>  		writel((unsigned)-1, gic_dist_addr + GICD_IGROUPRn + 4 * i);
> >>+	/*
> >>+	 * Relocate secure section before any cpu runs in secure ram.
> >>+	 * smp_kick_all_cpus may enable other cores and runs into secure
> >>+	 * ram, so need to relocate secure section before enabling other
> >>+	 * cores.
> >>+	 */
> >>+	relocate_secure_section();
> >>+
> >>  #ifndef CONFIG_ARMV7_PSCI
> >>  	smp_set_core_boot_addr((unsigned long)secure_ram_addr(_smp_pen), -1);
> >>  	smp_kick_all_cpus();
> >>  #endif
> >>  	/* call the non-sec switching code on this CPU also */
> >>-	relocate_secure_section();
> >>  	secure_ram_addr(_nonsec_init)();
> >>  	return 0;
> >>  }
> >>
> >Seems like a sensible thing to do. FWIW:
> >
> >Acked-by: Marc Zyngier <marc.zyngier@arm.com>
> Just kindly remind. Will this patch be merged into u-boot-arm git
> repo or directly into u-boot master git repo?

This is a core ARM thing so I'm expecting Albert to pick it up.  Albert?
Thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150213/cf4494bc/attachment.sig>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [U-Boot] [PATCH] ARM: HYP/non-sec: relocation before enable secondary cores
  2015-02-13 18:09     ` Tom Rini
@ 2015-03-27 15:45       ` Albert ARIBAUD
  0 siblings, 0 replies; 5+ messages in thread
From: Albert ARIBAUD @ 2015-03-27 15:45 UTC (permalink / raw)
  To: u-boot

Hello Tom,

On Fri, 13 Feb 2015 13:09:33 -0500, Tom Rini <trini@ti.com> wrote:
> On Fri, Feb 13, 2015 at 09:37:23AM +0800, Peng Fan wrote:
> > Hi, Albert and Tom
> > 
> > On 2/4/2015 7:02 PM, Marc Zyngier wrote:
> > >On 04/02/15 10:15, Peng Fan wrote:
> > >>If CONFIG_ARMV7_PSCI is not defined and CONFIG_ARMV7_SECURE_BASE is defined,
> > >>smp_kicl_all_cpus may enable secondary cores and runs into secure_ram_addr(
> > >>_smp_pen), before code is relocated to secure ram.
> > >>So need relocation to secure ram before enable secondary cores.
> > >>
> > >>Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
> > >>---
> > >>  arch/arm/cpu/armv7/virt-v7.c | 9 ++++++++-
> > >>  1 file changed, 8 insertions(+), 1 deletion(-)
> > >>
> > >>diff --git a/arch/arm/cpu/armv7/virt-v7.c b/arch/arm/cpu/armv7/virt-v7.c
> > >>index b69fd37..4cb8806 100644
> > >>--- a/arch/arm/cpu/armv7/virt-v7.c
> > >>+++ b/arch/arm/cpu/armv7/virt-v7.c
> > >>@@ -112,13 +112,20 @@ int armv7_init_nonsec(void)
> > >>  	for (i = 1; i <= itlinesnr; i++)
> > >>  		writel((unsigned)-1, gic_dist_addr + GICD_IGROUPRn + 4 * i);
> > >>+	/*
> > >>+	 * Relocate secure section before any cpu runs in secure ram.
> > >>+	 * smp_kick_all_cpus may enable other cores and runs into secure
> > >>+	 * ram, so need to relocate secure section before enabling other
> > >>+	 * cores.
> > >>+	 */
> > >>+	relocate_secure_section();
> > >>+
> > >>  #ifndef CONFIG_ARMV7_PSCI
> > >>  	smp_set_core_boot_addr((unsigned long)secure_ram_addr(_smp_pen), -1);
> > >>  	smp_kick_all_cpus();
> > >>  #endif
> > >>  	/* call the non-sec switching code on this CPU also */
> > >>-	relocate_secure_section();
> > >>  	secure_ram_addr(_nonsec_init)();
> > >>  	return 0;
> > >>  }
> > >>
> > >Seems like a sensible thing to do. FWIW:
> > >
> > >Acked-by: Marc Zyngier <marc.zyngier@arm.com>
> > Just kindly remind. Will this patch be merged into u-boot-arm git
> > repo or directly into u-boot master git repo?
> 
> This is a core ARM thing so I'm expecting Albert to pick it up.  Albert?
> Thanks!
> 
> -- 
> Tom

Applied (for a while now, actually) to u-boot-arm/master, thanks!

Amicalement,
-- 
Albert.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-03-27 15:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-04 10:15 [U-Boot] [PATCH] ARM: HYP/non-sec: relocation before enable secondary cores Peng Fan
2015-02-04 11:02 ` Marc Zyngier
2015-02-13  1:37   ` Peng Fan
2015-02-13 18:09     ` Tom Rini
2015-03-27 15:45       ` Albert ARIBAUD

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox