From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH 09/10] ARM: stm32mp: add stm32mp_cpu_lowlevel_init with stack set up
Date: Tue, 12 Nov 2019 10:19:55 +0100 [thread overview]
Message-ID: <20191112091956.26628-9-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20191112091956.26628-1-a.fatoum@pengutronix.de>
When barebox is invoked out of the TF-A v2.1, it's started with
sp, r0, r1, r2 all equal to zero. To use the new RAM size calculating
stm32mp1_barebox_entry, we need to have a stack to handle spillage.
Add a stm32mp_cpu_lowlevel_init wrapper around arm_cpu_lowlevel_init,
which additionally configures a 64 byte stack after the end of the
barebox binary. This should be enough to help us through the RAM size
calculation. If not, compression will fail because of data corruption
and stack size can be increased as necessary.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
arch/arm/mach-stm32mp/include/mach/entry.h | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/arch/arm/mach-stm32mp/include/mach/entry.h b/arch/arm/mach-stm32mp/include/mach/entry.h
index 703712a9eea7..92e15b5cf4e3 100644
--- a/arch/arm/mach-stm32mp/include/mach/entry.h
+++ b/arch/arm/mach-stm32mp/include/mach/entry.h
@@ -1,7 +1,18 @@
#ifndef _STM32MP_MACH_ENTRY_H_
#define _STM32MP_MACH_ENTRY_H_
-#include <linux/compiler.h>
+#include <linux/kernel.h>
+#include <asm/barebox-arm.h>
+
+static __always_inline void stm32mp_cpu_lowlevel_init(void)
+{
+ unsigned long stack_top;
+ arm_cpu_lowlevel_init();
+
+ stack_top = (unsigned long)__image_end + get_runtime_offset() + 64;
+ stack_top = ALIGN(stack_top, 16);
+ arm_setup_stack(stack_top);
+}
void __noreturn stm32mp1_barebox_entry(void *boarddata);
--
2.24.0.rc1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2019-11-12 9:20 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-12 9:19 [PATCH 01/10] ARM: dts: stm32mp: move alias to SoC device tree Ahmad Fatoum
2019-11-12 9:19 ` [PATCH 02/10] ARM: stm32mp157c-dk2: add optional DEBUG_LL print to entry point Ahmad Fatoum
2019-11-12 9:19 ` [PATCH 03/10] mfd: stpmic1: use register define from header Ahmad Fatoum
2019-11-12 9:19 ` [PATCH 04/10] watchdog: stm32_iwdg: return -ENOSYS on attempt to disable Ahmad Fatoum
2019-11-12 9:19 ` [PATCH 05/10] i2c: stm32: use device_reset_us helper instead of open-coding Ahmad Fatoum
2019-11-12 9:19 ` [PATCH 06/10] Documentation: boards: stm32mp: document boot error LED Ahmad Fatoum
2019-11-12 9:19 ` [PATCH 07/10] ARM: stm32mp: add helper for querying ram size Ahmad Fatoum
2019-11-12 9:19 ` [PATCH 08/10] ARM: stm32mp: add basic DDR controller driver Ahmad Fatoum
2019-11-13 9:28 ` [PATCH] fixup! " Ahmad Fatoum
2019-11-12 9:19 ` Ahmad Fatoum [this message]
2019-11-12 9:19 ` [PATCH 10/10] ARM: stm32mp: dk2: don't hard-code memory size Ahmad Fatoum
2019-11-13 9:29 ` [PATCH] fixup! " Ahmad Fatoum
2019-11-13 14:25 ` [PATCH 01/10] ARM: dts: stm32mp: move alias to SoC device tree Sascha Hauer
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=20191112091956.26628-9-a.fatoum@pengutronix.de \
--to=a.fatoum@pengutronix.de \
--cc=barebox@lists.infradead.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox