From: Albert ARIBAUD Date: Thu, 18 Sep 2014 11:43:50 +0200 Subject: [U-Boot] [PATCH] ARM: HYP/non-sec: Make a variable as a local one In-Reply-To: <1411031554-14849-1-git-send-email-Yuantian.Tang@freescale.com> References: <1411031554-14849-1-git-send-email-Yuantian.Tang@freescale.com> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi Tang, Please fix subject / commit summary to indicate which variable is to be made local. On Thu, 18 Sep 2014 17:12:34 +0800, Tang Yuantian wrote: > Defining variable gic_dist_addr as a globe one prevents some > functions, which use this variable, from being used before relocation > which happened in the deep sleep resume process on Freescale SoC > platforms. > > Signed-off-by: Tang Yuantian > --- > arch/arm/cpu/armv7/virt-v7.c | 9 +++++++-- > 1 file changed, 7 insertions(+), 2 deletions(-) > > diff --git a/arch/arm/cpu/armv7/virt-v7.c b/arch/arm/cpu/armv7/virt-v7.c > index 651ca40..b69fd37 100644 > --- a/arch/arm/cpu/armv7/virt-v7.c > +++ b/arch/arm/cpu/armv7/virt-v7.c > @@ -15,8 +15,6 @@ > #include > #include > > -unsigned long gic_dist_addr; > - > static unsigned int read_id_pfr1(void) > { > unsigned int reg; > @@ -68,6 +66,12 @@ static void kick_secondary_cpus_gic(unsigned long gicdaddr) > > void __weak smp_kick_all_cpus(void) > { > + unsigned long gic_dist_addr; > + > + gic_dist_addr = get_gicd_base_address(); > + if (gic_dist_addr == -1) > + return; > + > kick_secondary_cpus_gic(gic_dist_addr); > } > > @@ -75,6 +79,7 @@ int armv7_init_nonsec(void) > { > unsigned int reg; > unsigned itlinesnr, i; > + unsigned long gic_dist_addr; > > /* check whether the CPU supports the security extensions */ > reg = read_id_pfr1(); Did you check that the global was not used as a common variable between the functions? Amicalement, -- Albert.