All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Bosch <stefan_b@posteo.net>
To: Tom Rini <trini@konsulko.com>
Cc: u-boot@lists.denx.de, Stefan Bosch <stefan_b@posteo.net>
Subject: [PATCH v1 2/2] arm: s5p4418: fix relocation of vectors
Date: Sun, 12 Nov 2023 14:38:11 +0000	[thread overview]
Message-ID: <20231112143811.3606-3-stefan_b@posteo.net> (raw)
In-Reply-To: <20231112143811.3606-1-stefan_b@posteo.net>

The header (NSIH) used for the s5p4418-SoC is not loaded into RAM by the
2nd-bootloader, see boot0.h. Therefore, use an adapted version of
relocate_vectors which relocates the vectors after the header (at _start)
instead of the 'dummy'-vectors at the start of the header (at
__image_copy_start).

Signed-off-by: Stefan Bosch <stefan_b@posteo.net>
---

 arch/arm/cpu/armv7/s5p4418/Makefile   |  3 +++
 arch/arm/cpu/armv7/s5p4418/relocate.S | 24 ++++++++++++++++++++++++
 2 files changed, 27 insertions(+)
 create mode 100644 arch/arm/cpu/armv7/s5p4418/relocate.S

diff --git a/arch/arm/cpu/armv7/s5p4418/Makefile b/arch/arm/cpu/armv7/s5p4418/Makefile
index 321b257b6d..58042581c4 100644
--- a/arch/arm/cpu/armv7/s5p4418/Makefile
+++ b/arch/arm/cpu/armv7/s5p4418/Makefile
@@ -2,5 +2,8 @@
 #
 # (C) Copyright 2016 Nexell
 # Hyunseok, Jung <hsjung@nexell.co.kr>
+#
+# Copyright (C) 2023  Stefan Bosch <stefan_b@posteo.net>
 
 obj-y += cpu.o
+obj-y += relocate.o
diff --git a/arch/arm/cpu/armv7/s5p4418/relocate.S b/arch/arm/cpu/armv7/s5p4418/relocate.S
new file mode 100644
index 0000000000..d6e76adceb
--- /dev/null
+++ b/arch/arm/cpu/armv7/s5p4418/relocate.S
@@ -0,0 +1,24 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ *  relocate - S5P4418 specific relocation for ARM U-Boot
+ *
+ *  Copyright (c) 2013  Albert ARIBAUD <albert.u.boot@aribaud.net>
+ *  Copyright (C) 2023  Stefan Bosch <stefan_b@posteo.net>
+ */
+
+#include <asm-offsets.h>
+#include <asm/assembler.h>
+#include <linux/linkage.h>
+
+ENTRY(relocate_vectors)
+
+	/*
+	 * The s5p4418 SoC has the security extensions, so use VBAR to relocate
+	 * the exception vectors.
+	 */
+	ldr	r0, [r9, #GD_RELOCADDR]	/* r0 = gd->relocaddr */
+	add	r0, #0x400			/* vectors are after NSIH + 0x200 */
+	mcr	p15, 0, r0, c12, c0, 0	/* Set VBAR */
+	ret	lr
+
+ENDPROC(relocate_vectors)
-- 
2.17.1


      parent reply	other threads:[~2023-11-12 14:40 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-12 14:38 [PATCH v1 0/2] arm: s5p4418: fix relocation Stefan Bosch
2023-11-12 14:38 ` [PATCH v1 1/2] common: board_f: change calculation of gd->mon_len to fix s5p4418 reloc Stefan Bosch
2023-11-12 20:01   ` Simon Glass
2023-11-12 14:38 ` Stefan Bosch [this message]

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=20231112143811.3606-3-stefan_b@posteo.net \
    --to=stefan_b@posteo.net \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.