ARM: create .secure_stack section only for PSCI
authorMasahiro Yamada <yamada.masahiro@socionext.com>
Mon, 26 Sep 2016 05:21:30 +0000 (14:21 +0900)
committerTom Rini <trini@konsulko.com>
Fri, 14 Oct 2016 20:18:34 +0000 (16:18 -0400)
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/
arch/arm/cpu/u-boot.lds

index 0a5fae6efccfbe46d3477cfbff15fd72c97782d7..37d4c605aca3256032974302c2f6b916fb3731d0 100644 (file)
@@ -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));
 
@@ -107,6 +108,8 @@ SECTIONS
 #ifndef __ARMV7_PSCI_STACK_IN_RAM
        /* Reset VMA but don't allocate space if we have secure SRAM */
        . = LOADADDR(.secure_stack);
+#endif
+
 #endif
 
        .__secure_end : AT(ADDR(.__secure_end)) {