public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: marek.vasut@gmail.com
To: u-boot@lists.denx.de
Cc: Marek Vasut <marek.vasut+renesas@gmail.com>,
	Simon Glass <sjg@chromium.org>, Tom Rini <trini@konsulko.com>
Subject: [RESEND][PATCH] arm64: Add missing GD_FLG_SKIP_RELOC handling
Date: Sat, 13 Nov 2021 18:34:59 +0100	[thread overview]
Message-ID: <20211113173459.32068-1-marek.vasut@gmail.com> (raw)

From: Marek Vasut <marek.vasut+renesas@gmail.com>

In case U-Boot enters relocation with GD_FLG_SKIP_RELOC, skip the
relocation. The code still has to set up new_gd pointer and new
stack pointer.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
---
 arch/arm/lib/crt0_64.S | 4 ++++
 lib/asm-offsets.c      | 3 +++
 2 files changed, 7 insertions(+)

diff --git a/arch/arm/lib/crt0_64.S b/arch/arm/lib/crt0_64.S
index 680e674fa3..28c8356aee 100644
--- a/arch/arm/lib/crt0_64.S
+++ b/arch/arm/lib/crt0_64.S
@@ -104,6 +104,10 @@ ENTRY(_main)
 	bic	sp, x0, #0xf	/* 16-byte alignment for ABI compliance */
 	ldr	x18, [x18, #GD_NEW_GD]		/* x18 <- gd->new_gd */
 
+	/* Skip relocation in case gd->gd_flags & GD_FLG_SKIP_RELOC */
+	ldr	x0, [x18, #GD_FLAGS]		/* x0 <- gd->flags */
+	tbnz	x0, 11, relocation_return	/* GD_FLG_SKIP_RELOC is bit 11 */
+
 	adr	lr, relocation_return
 #if CONFIG_POSITION_INDEPENDENT
 	/* Add in link-vs-runtime offset */
diff --git a/lib/asm-offsets.c b/lib/asm-offsets.c
index c691066332..0808cd4b0c 100644
--- a/lib/asm-offsets.c
+++ b/lib/asm-offsets.c
@@ -29,6 +29,9 @@ int main(void)
 	DEFINE(GD_SIZE, sizeof(struct global_data));
 
 	DEFINE(GD_BD, offsetof(struct global_data, bd));
+
+	DEFINE(GD_FLAGS, offsetof(struct global_data, flags));
+
 #if CONFIG_VAL(SYS_MALLOC_F_LEN)
 	DEFINE(GD_MALLOC_BASE, offsetof(struct global_data, malloc_base));
 #endif
-- 
2.33.0


             reply	other threads:[~2021-11-13 17:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-13 17:34 marek.vasut [this message]
2021-11-18 23:27 ` [RESEND][PATCH] arm64: Add missing GD_FLG_SKIP_RELOC handling Tom Rini

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=20211113173459.32068-1-marek.vasut@gmail.com \
    --to=marek.vasut@gmail.com \
    --cc=marek.vasut+renesas@gmail.com \
    --cc=sjg@chromium.org \
    --cc=trini@konsulko.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox