[U-Boot] [PATCH v2 2/4] ARM: armv7: guard memory reserve for PSCI with #ifdef CONFIG_ARMV7_PSCI

Masahiro Yamada yamada.masahiro at socionext.com
Mon Sep 26 07:25:59 CEST 2016


Hi Jon,


2016-09-23 14:34 GMT+09:00 Jon Masters <jcm at redhat.com>:
> On 09/23/2016 01:09 AM, Jon Masters wrote:
>> On 08/30/2016 03:22 AM, Masahiro Yamada wrote:
>>> If CONFIG_ARMV7_NONSEC is enabled, the linker script requires
>>> CONFIG_ARMV7_PSCI_NR_CPUS regardless of CONFIG_ARMV7_PSCI.
>>>
>>> Signed-off-by: Masahiro Yamada <yamada.masahiro at socionext.com>
>>> ---
>>>
>>> Changes in v2: None
>>>
>>>  arch/arm/cpu/u-boot.lds | 4 ++--
>>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/arch/arm/cpu/u-boot.lds b/arch/arm/cpu/u-boot.lds
>>> index 36c9fd0..0a5fae6 100644
>>> --- a/arch/arm/cpu/u-boot.lds
>>> +++ b/arch/arm/cpu/u-boot.lds
>>> @@ -83,10 +83,10 @@ SECTIONS
>>>  #endif
>>>      {
>>>              KEEP(*(.__secure_stack_start))
>>> -
>>> +#ifdef CONFIG_ARMV7_PSCI
>>>              /* Skip addreses for stack */
>>>              . = . + CONFIG_ARMV7_PSCI_NR_CPUS * ARM_PSCI_STACK_SIZE;
>>> -
>>> +#endif
>>>              /* Align end of stack section to page boundary */
>>>              . = ALIGN(CONSTANT(COMMONPAGESIZE));
>>>
>>>
>>
>> In the Fedora U-Boot ELF builds being tested for 32-bit U-Boot on KVM
>> (AArch32 on ARMv8 hardware, as a means of decommissioning older v7
>> builders and replacing them with VMs on v8 hosts) this results in the
>> following for a vexpress_ca15_tc2 U-Boot build target:
>>
>>   2 .secure_text  00000130  8082d000  8082d000  0003d000  2**5
>>                   CONTENTS, ALLOC, LOAD, READONLY, CODE
>>   3 .secure_stack 00000000  8082e000  8082e000  0004e000  2**0
>>                   ALLOC
>>   4 .__secure_end 00000004  8082e000  8082e000  0003e000  2**0
>>                   CONTENTS, ALLOC, LOAD, DATA
>>
>> Which QEMU then refuses to load because there's no space allocated for
>> the secure_stack. What do you think we should do about this? I haven't
>> been tracking the PSCI implementation (which is pretty cool btw, woot!)
>> work you've been doing and we don't really need it for the VM case
>> anyway, just need the resulting build to link correctly. So sure,
>> probably I/we need to understand the status of the PSCI work too.
>
> Ok, so the specific problem seems to be:
>
> commit 5a3aae68c74e029ed29d22999ab6f22687382f2d
> Author: Masahiro Yamada <yamada.masahiro at socionext.com>
> Date:   Tue Aug 30 16:22:21 2016 +0900
>
>     ARM: armv7: guard memory reserve for PSCI with #ifdef CONFIG_ARMV7_PSCI
>
>     If CONFIG_ARMV7_NONSEC is enabled, the linker script requires
>     CONFIG_ARMV7_PSCI_NR_CPUS regardless of CONFIG_ARMV7_PSCI.
>
>     Reviewed-by: Alexander Graf <agraf at suse.de>
>     Signed-off-by: Masahiro Yamada <yamada.masahiro at socionext.com>
>
> This introduced the change that results in no secure stack space being
> allocated in the ELF image. The vexpress_ca15_tc2 target doesn't claim
> to support PSCI /however/ the default includes say that we are
> ARMV7_NONSEC and CONFIG_ARMV7_PSCI_NR_CPUS will default to 4 in that
> case regardless, so this is why we were previously allocating space for
> the (presumably unused) secure_stack (prior to the above commit). That
> commit changed things by wrapping it in a conditional on ARMV7_PSCI.
>
> Can someone who is actually a U-Boot person tell us what the intention
> is in this case, and what should actually happen to the linker script?
>
> Jon.
>


My motivation for that commit was just
to move some PSCI related options to Kconfig.

If the empty section is the cause of your problem, I think
http://patchwork.ozlabs.org/patch/674962/
will work.
But, it will break CONFIG_ARMV7_SECURE_MAX_SIZE checking, instead.

The PSCI work for ARMv7 is mostly from Chen-Yu. So, I am hoping he will help us.


-- 
Best Regards
Masahiro Yamada


More information about the U-Boot mailing list