public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: York Sun <yorksun@freescale.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 2/4] ARM: HYP/non-sec: Make armv7_init_nonsec() usable before relocation
Date: Wed, 15 Oct 2014 08:44:07 -0700	[thread overview]
Message-ID: <543E9647.6070503@freescale.com> (raw)
In-Reply-To: <1412842298-3257-3-git-send-email-Yuantian.Tang@freescale.com>

On 10/09/2014 01:11 AM, Yuantian.Tang at freescale.com wrote:
> From: Tang Yuantian <Yuantian.Tang@freescale.com>
> 
> Defining variable gic_dist_addr as a globe one prevents function
> armv7_init_nonsec() from being used before relocation which is
> the case in the deep sleep resume process on Freescale QorIQ SoC
> platforms.
> This patch removes this limitation by adding a extra same meaning
> local variable. In this way, no exsiting codes get corrupts.
> 
> Signed-off-by: Tang Yuantian <Yuantian.Tang@freescale.com>
> ---
>  arch/arm/cpu/armv7/virt-v7.c | 14 ++++++++------
>  1 file changed, 8 insertions(+), 6 deletions(-)
> 
> diff --git a/arch/arm/cpu/armv7/virt-v7.c b/arch/arm/cpu/armv7/virt-v7.c
> index 651ca40..e1dfce9 100644
> --- a/arch/arm/cpu/armv7/virt-v7.c
> +++ b/arch/arm/cpu/armv7/virt-v7.c
> @@ -75,6 +75,7 @@ int armv7_init_nonsec(void)
>  {
>  	unsigned int reg;
>  	unsigned itlinesnr, i;
> +	unsigned long gic_base_addr;
>  
>  	/* check whether the CPU supports the security extensions */
>  	reg = read_id_pfr1();
> @@ -89,23 +90,24 @@ int armv7_init_nonsec(void)
>  	 * any access to it will trap.
>  	 */
>  
> -	gic_dist_addr = get_gicd_base_address();
> -	if (gic_dist_addr == -1)
> +	gic_base_addr = get_gicd_base_address();
> +	gic_dist_addr = gic_base_addr;
> +	if (gic_base_addr == -1)
>  		return -1;
>  
>  	/* enable the GIC distributor */
> -	writel(readl(gic_dist_addr + GICD_CTLR) | 0x03,
> -	       gic_dist_addr + GICD_CTLR);
> +	writel(readl(gic_base_addr + GICD_CTLR) | 0x03,
> +	       gic_base_addr + GICD_CTLR);
>  
>  	/* TYPER[4:0] contains an encoded number of available interrupts */
> -	itlinesnr = readl(gic_dist_addr + GICD_TYPER) & 0x1f;
> +	itlinesnr = readl(gic_base_addr + GICD_TYPER) & 0x1f;
>  
>  	/* set all bits in the GIC group registers to one to allow access
>  	 * from non-secure state. The first 32 interrupts are private per
>  	 * CPU and will be set later when enabling the GIC for each core
>  	 */
>  	for (i = 1; i <= itlinesnr; i++)
> -		writel((unsigned)-1, gic_dist_addr + GICD_IGROUPRn + 4 * i);
> +		writel((unsigned)-1, gic_base_addr + GICD_IGROUPRn + 4 * i);
>  
>  #ifndef CONFIG_ARMV7_PSCI
>  	smp_set_core_boot_addr((unsigned long)secure_ram_addr(_smp_pen), -1);
> 

Wouldn't it be better to declare gic_dist_base as a local variable? It is only
used once outside function armv7_switch_nonsec(). It could be replaced with
get_gicd_base_address() call.

York

  reply	other threads:[~2014-10-15 15:44 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-09  8:11 [U-Boot] [PATCH 0/4] Deep sleep patches for Freescale QorIQ platforms Yuantian.Tang at freescale.com
2014-10-09  8:11 ` [U-Boot] [PATCH 1/4] Add deep sleep framework support " Yuantian.Tang at freescale.com
2014-10-09  8:11 ` [U-Boot] [PATCH 2/4] ARM: HYP/non-sec: Make armv7_init_nonsec() usable before relocation Yuantian.Tang at freescale.com
2014-10-15 15:44   ` York Sun [this message]
2014-10-16  3:02     ` Yuantian Tang
2014-10-16  3:36       ` York Sun
2014-10-16  4:42         ` Yuantian Tang
2014-10-27  9:41           ` Albert ARIBAUD
2014-10-28  2:24             ` Yuantian Tang
2014-10-28  6:48               ` Albert ARIBAUD
2014-10-09  8:11 ` [U-Boot] [PATCH 3/4] arm: ls102xa: Fixed a register definition error Yuantian.Tang at freescale.com
2014-11-25 17:51   ` York Sun
2014-10-09  8:11 ` [U-Boot] [PATCH 4/4] arm: ls1021qds: Add deep sleep support Yuantian.Tang at freescale.com
2014-10-13  9:41 ` [U-Boot] [PATCH 0/4] Deep sleep patches for Freescale QorIQ platforms Yuantian Tang
2014-10-13  9:46   ` Albert ARIBAUD
2014-10-14  2:30     ` Yuantian Tang
  -- strict thread matches above, loose matches on Subject: below --
2014-09-28  8:59 Yuantian.Tang at freescale.com
2014-09-28  8:59 ` [U-Boot] [PATCH 2/4] ARM: HYP/non-sec: Make armv7_init_nonsec() usable before relocation Yuantian.Tang at freescale.com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=543E9647.6070503@freescale.com \
    --to=yorksun@freescale.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox