* [U-Boot] [RFC PATCH] ARM: create .secure_stack section only for PSCI
@ 2016-09-26 5:21 Masahiro Yamada
2016-09-26 15:40 ` Chen-Yu Tsai
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Masahiro Yamada @ 2016-09-26 5:21 UTC (permalink / raw)
To: u-boot
Jon Master reports that QEMU refuses to load a U-Boot image built
with CONFIG_ARMV7_NONSEC, but without CONFIG_ARMV7_PSCI since
commit 5a3aae68c74e ("ARM: armv7: guard memory reserve for PSCI
with #ifdef CONFIG_ARMV7_PSCI").
It looks like only PSCI that needs the Secure stack, so move
the #ifdef to guard the whole of .secure_stack allocation in order
not to create the empty section.
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reported-by: Jon Masters <jcm@redhat.com>
Link: http://patchwork.ozlabs.org/patch/664025/
---
With this commit, the SECURE_MAX_SIZE check will go inside
the #ifdef CONFIG_ARMV7_PSCI, so this patch is probably wrong.
I am CCing Chen-Yu Tsai. He mostly expanded this linker script
for PSCI work, so I hope he can suggest the correct way
for fixing this problem.
arch/arm/cpu/u-boot.lds | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/arch/arm/cpu/u-boot.lds b/arch/arm/cpu/u-boot.lds
index 0a5fae6..37d4c60 100644
--- a/arch/arm/cpu/u-boot.lds
+++ b/arch/arm/cpu/u-boot.lds
@@ -74,6 +74,7 @@ SECTIONS
*(._secure.data)
}
+#ifdef CONFIG_ARMV7_PSCI
.secure_stack ALIGN(ADDR(.secure_data) + SIZEOF(.secure_data),
CONSTANT(COMMONPAGESIZE)) (NOLOAD) :
#ifdef __ARMV7_PSCI_STACK_IN_RAM
@@ -83,10 +84,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));
@@ -109,6 +110,8 @@ SECTIONS
. = LOADADDR(.secure_stack);
#endif
+#endif
+
.__secure_end : AT(ADDR(.__secure_end)) {
*(.__secure_end)
LONG(0x1d1071c); /* Must output something to reset LMA */
--
1.9.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [U-Boot] [RFC PATCH] ARM: create .secure_stack section only for PSCI
2016-09-26 5:21 [U-Boot] [RFC PATCH] ARM: create .secure_stack section only for PSCI Masahiro Yamada
@ 2016-09-26 15:40 ` Chen-Yu Tsai
2016-10-07 13:43 ` [U-Boot] [U-Boot, RFC] " Tom Rini
2016-10-15 0:13 ` Tom Rini
2 siblings, 0 replies; 4+ messages in thread
From: Chen-Yu Tsai @ 2016-09-26 15:40 UTC (permalink / raw)
To: u-boot
On Mon, Sep 26, 2016 at 1:21 PM, Masahiro Yamada
<yamada.masahiro@socionext.com> wrote:
> Jon Master reports that QEMU refuses to load a U-Boot image built
> with CONFIG_ARMV7_NONSEC, but without CONFIG_ARMV7_PSCI since
> commit 5a3aae68c74e ("ARM: armv7: guard memory reserve for PSCI
> with #ifdef CONFIG_ARMV7_PSCI").
>
> It looks like only PSCI that needs the Secure stack, so move
> the #ifdef to guard the whole of .secure_stack allocation in order
> not to create the empty section.
>
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> Reported-by: Jon Masters <jcm@redhat.com>
> Link: http://patchwork.ozlabs.org/patch/664025/
> ---
>
> With this commit, the SECURE_MAX_SIZE check will go inside
> the #ifdef CONFIG_ARMV7_PSCI, so this patch is probably wrong.
I wonder if you could move the SECURE_MAX_SIZE check outside of
the secure_stack section. I might have put it where it is because
of some issues, but I can't remember.
> I am CCing Chen-Yu Tsai. He mostly expanded this linker script
> for PSCI work, so I hope he can suggest the correct way
> for fixing this problem.
The patch looks good. Though I wonder if you need to guard the
__secure_stack_start and __secure_stack_end symbols in
arch/arm/lib/sections.c as well. Otherwise they might end up
in the data section?
Regards
ChenYu
>
> arch/arm/cpu/u-boot.lds | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm/cpu/u-boot.lds b/arch/arm/cpu/u-boot.lds
> index 0a5fae6..37d4c60 100644
> --- a/arch/arm/cpu/u-boot.lds
> +++ b/arch/arm/cpu/u-boot.lds
> @@ -74,6 +74,7 @@ SECTIONS
> *(._secure.data)
> }
>
> +#ifdef CONFIG_ARMV7_PSCI
> .secure_stack ALIGN(ADDR(.secure_data) + SIZEOF(.secure_data),
> CONSTANT(COMMONPAGESIZE)) (NOLOAD) :
> #ifdef __ARMV7_PSCI_STACK_IN_RAM
> @@ -83,10 +84,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));
>
> @@ -109,6 +110,8 @@ SECTIONS
> . = LOADADDR(.secure_stack);
> #endif
>
> +#endif
> +
> .__secure_end : AT(ADDR(.__secure_end)) {
> *(.__secure_end)
> LONG(0x1d1071c); /* Must output something to reset LMA */
> --
> 1.9.1
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [U-Boot] [U-Boot, RFC] ARM: create .secure_stack section only for PSCI
2016-09-26 5:21 [U-Boot] [RFC PATCH] ARM: create .secure_stack section only for PSCI Masahiro Yamada
2016-09-26 15:40 ` Chen-Yu Tsai
@ 2016-10-07 13:43 ` Tom Rini
2016-10-15 0:13 ` Tom Rini
2 siblings, 0 replies; 4+ messages in thread
From: Tom Rini @ 2016-10-07 13:43 UTC (permalink / raw)
To: u-boot
On Mon, Sep 26, 2016 at 02:21:30PM +0900, Masahiro Yamada wrote:
> Jon Master reports that QEMU refuses to load a U-Boot image built
> with CONFIG_ARMV7_NONSEC, but without CONFIG_ARMV7_PSCI since
> commit 5a3aae68c74e ("ARM: armv7: guard memory reserve for PSCI
> with #ifdef CONFIG_ARMV7_PSCI").
>
> It looks like only PSCI that needs the Secure stack, so move
> the #ifdef to guard the whole of .secure_stack allocation in order
> not to create the empty section.
>
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> Reported-by: Jon Masters <jcm@redhat.com>
> Link: http://patchwork.ozlabs.org/patch/664025/
We're close I think, but this breaks boards like ls1021aqds_nor_lpuart
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20161007/9ee03830/attachment.sig>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [U-Boot] [U-Boot, RFC] ARM: create .secure_stack section only for PSCI
2016-09-26 5:21 [U-Boot] [RFC PATCH] ARM: create .secure_stack section only for PSCI Masahiro Yamada
2016-09-26 15:40 ` Chen-Yu Tsai
2016-10-07 13:43 ` [U-Boot] [U-Boot, RFC] " Tom Rini
@ 2016-10-15 0:13 ` Tom Rini
2 siblings, 0 replies; 4+ messages in thread
From: Tom Rini @ 2016-10-15 0:13 UTC (permalink / raw)
To: u-boot
On Mon, Sep 26, 2016 at 02:21:30PM +0900, Masahiro Yamada wrote:
> Jon Master reports that QEMU refuses to load a U-Boot image built
> with CONFIG_ARMV7_NONSEC, but without CONFIG_ARMV7_PSCI since
> commit 5a3aae68c74e ("ARM: armv7: guard memory reserve for PSCI
> with #ifdef CONFIG_ARMV7_PSCI").
>
> It looks like only PSCI that needs the Secure stack, so move
> the #ifdef to guard the whole of .secure_stack allocation in order
> not to create the empty section.
>
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> Reported-by: Jon Masters <jcm@redhat.com>
> Link: http://patchwork.ozlabs.org/patch/664025/
Applied to u-boot/master, thanks!
... and no, I don't know how / why this caused build failures before,
but it did and I replicated it at the time too. But I just got a
clean build everywhere. And I've added vexpress-a15 and vexpress-a9 via
QEMU to my test setup now.
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20161014/4691463b/attachment.sig>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-10-15 0:13 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-26 5:21 [U-Boot] [RFC PATCH] ARM: create .secure_stack section only for PSCI Masahiro Yamada
2016-09-26 15:40 ` Chen-Yu Tsai
2016-10-07 13:43 ` [U-Boot] [U-Boot, RFC] " Tom Rini
2016-10-15 0:13 ` Tom Rini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox