From: Andre Przywara <andre.przywara@linaro.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 4/7] ARM: switch to non-secure state during bootm execution
Date: Thu, 04 Jul 2013 09:42:09 +0200 [thread overview]
Message-ID: <51D52751.1010308@linaro.org> (raw)
In-Reply-To: <20130628121858.3835.AA925319@jp.panasonic.com>
On 06/28/2013 05:18 AM, Masahiro Yamada wrote:
> Hi Andre.
>
>
>> --- a/arch/arm/lib/Makefile
>> +++ b/arch/arm/lib/Makefile
>> @@ -60,6 +60,8 @@ COBJS-y += reset.o
>> COBJS-y += cache.o
>> COBJS-y += cache-cp15.o
>>
>> +COBJS-$(CONFIG_ARMV7_VIRT) += virt-v7.o
>> +
>
> Judging from the file name virt-v7.c,
> you are thinkig this file is specific to ARMv7, aren't you?
>
> If so, why don't you move this file
> to arch/arm/cpu/armv7/ ?
>
>
>> +static void set_generic_timer_frequency(void)
>> +{
>> +#ifdef CONFIG_SYS_CLK_FREQ
>> + unsigned int reg;
>> +
>> + reg = read_id_pfr1();
>> + if ((reg & CPUID_ARM_TIMER_MASK) == 1U << CPUID_ARM_TIMER_SHIFT)
>> + asm("mcr p15, 0, %0, c14, c0, 0\n"
>> + : : "r"(CONFIG_SYS_CLK_FREQ));
>> +#endif
>
> CPUID_ARM_TIMER_MASK
> CPUID_ARM_TIMER_SHIFT
>
> I think these macro names are vague.
> There are Generic Timer, Global Timer, Private Timer etc.
Good point.
> Unlike other parts, the care for Cortex-A9 is missing here.
> To be more generic, I'd like to suggest to allow Non-secure access
> to Global/Private timers before switching to non-secure state.
>
>
> How about like this for armv7_switch_nonsec function?
>
>
> /* check whether the CPU supports the security extensions */
> reg = read_id_pfr1();
> if ((reg & 0xF0) == 0)
> return HYP_ERR_NO_SEC_EXT;
>
> if ((reg & CPUID_ARM_TIMER_MASK) == 1U << CPUID_ARM_TIMER_SHIFT)
> set_generic_timer_frequency();
> else
> /* Allow Non-secure access to Global/Private timers */
> writel(0xfff, periph_base + SCU_SNSAC);
Interesting, however I don't have access to an A9 board currently to
properly test this. So I will do the renaming and let the access to the
other timers up to a follow-up patch.
Thanks,
Andre.
>
> For more info about SCU Non-secure Access Control (SNSAC) Register,
> please refer Cortex A9 mpcore TRM. page 2-11
> http://infocenter.arm.com/help/topic/com.arm.doc.ddi0407g/DDI0407G_cortex_a9_mpcore_r3p0_trm.pdf
>
>
>
>> + /* enable the GIC distributor */
>> + writel(readl(&gicdptr[GICD_CTLR]) | 0x03, &gicdptr[GICD_CTLR]);
>
> I am not sure this code is really necessary.
>
> Because your are setting all available interrupts to Group1 just below,
> I think we don't need to do this in secure state.
>
>
> Best Regards
> Masahiro Yamada
>
next prev parent reply other threads:[~2013-07-04 7:42 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-13 11:01 [U-Boot] [PATCH v2 0/7] ARMv7: Add HYP mode switching support Andre Przywara
2013-06-13 11:01 ` [U-Boot] [PATCH v2 1/7] ARM: prepare armv7.h to be included from assembly source Andre Przywara
2013-06-28 1:00 ` Masahiro Yamada
2013-07-04 7:38 ` Andre Przywara
2013-06-13 11:01 ` [U-Boot] [PATCH v2 2/7] ARM: add secure monitor handler to switch to non-secure state Andre Przywara
2013-06-28 3:00 ` Masahiro Yamada
2013-06-13 11:01 ` [U-Boot] [PATCH v2 3/7] ARM: add assembly routine " Andre Przywara
2013-06-19 22:27 ` Christoffer Dall
2013-06-28 3:09 ` Masahiro Yamada
2013-06-13 11:01 ` [U-Boot] [PATCH v2 4/7] ARM: switch to non-secure state during bootm execution Andre Przywara
2013-06-19 23:13 ` Christoffer Dall
2013-06-28 3:18 ` Masahiro Yamada
2013-07-04 7:42 ` Andre Przywara [this message]
2013-06-13 11:01 ` [U-Boot] [PATCH v2 5/7] ARM: add SMP support for non-secure switch Andre Przywara
2013-06-19 23:27 ` Christoffer Dall
2013-06-28 3:22 ` Masahiro Yamada
2013-06-13 11:01 ` [U-Boot] [PATCH v2 6/7] ARM: extend non-secure switch to also go into HYP mode Andre Przywara
2013-06-19 23:40 ` Christoffer Dall
2013-06-21 14:38 ` Nikolay Nikolaev
2013-06-25 8:27 ` Andre Przywara
2013-06-28 3:51 ` Masahiro Yamada
2013-07-04 11:29 ` Andre Przywara
2013-06-13 11:01 ` [U-Boot] [PATCH v2 7/7] ARM: VExpress: enable ARMv7 virt support for VExpress A15 Andre Przywara
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=51D52751.1010308@linaro.org \
--to=andre.przywara@linaro.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.