From patchwork Fri Jan 26 12:50:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Bosch X-Patchwork-Id: 1891308 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=posteo.net header.i=@posteo.net header.a=rsa-sha256 header.s=2017 header.b=NA1HOC/K; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TLyKp5rHyz23f9 for ; Fri, 26 Jan 2024 23:53:18 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id C836287C2D; Fri, 26 Jan 2024 13:53:14 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=posteo.net Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; secure) header.d=posteo.net header.i=@posteo.net header.b="NA1HOC/K"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7A64887C20; Fri, 26 Jan 2024 13:53:13 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mout01.posteo.de (mout01.posteo.de [185.67.36.65]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 5F0C787C1F for ; Fri, 26 Jan 2024 13:53:11 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=posteo.net Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=stefan_b@posteo.net Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 117CC240028 for ; Fri, 26 Jan 2024 13:53:11 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1706273591; bh=XbL4pHMMuZTVf2o6bwJ/Q1T76XAhfgov8Fim7b/KMF4=; h=From:To:Cc:Subject:Date:Message-Id:From; b=NA1HOC/KgWLgySbL0UEeiT6LPNBp511SsmlAsEb56U7pphqE5wt2kZ7a6pzcAM+Ss aVEoROHtSssm5pZL+Dp2846nWp2eejUyd1mEXqAWwgYNZoNhOz437kBQPw8wWizcPF MzUiyWUdDJzAVLn/yicaAe+CelNRkvmNerReimZbjAOWaIGORVyTo6itGK5V61QgzO SJvjaYPVktvMmyrqMBf3R5KJIdJ1ltV+34lkQeAET9gE2kJy4K2OKneSkn6XzuBtMb t2M1YmvDuQBut+RB2aWT0VR1ZHTRB1KolZ5lFJIWA/RYURB734auKr0/iiJVRXUbK2 l4AaEQhy3vDMw== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4TLyKf2VQRz6tw9; Fri, 26 Jan 2024 13:53:10 +0100 (CET) From: Stefan Bosch To: Simon Glass Cc: u-boot@lists.denx.de, Tom Rini , Stefan Bosch Subject: [PATCH v3 1/2] common: board_f: change calculation of gd->mon_len to fix s5p4418 reloc Date: Fri, 26 Jan 2024 12:50:55 +0000 Message-Id: <20240126125056.16439-2-stefan_b@posteo.net> In-Reply-To: <20240126125056.16439-1-stefan_b@posteo.net> References: <20240126125056.16439-1-stefan_b@posteo.net> X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean ARCH_NEXELL: Change calculation of monitor length (gd->mon_len) to fix relocation at boards with s5p4418-SoC (ARCH_NEXELL). At s5p4418, _start is after the header (NSIH). Therefore the monitor length has to be calculated using __image_copy_start instead of _start in order the whole monitor code is relocated. Signed-off-by: Stefan Bosch --- Changes in v3: - MICROBLAZE has not built anymore. Therefore do change calculation of gd->mon_len for ARCH_NEXELL only. This makes sure that MICROBLAZE and other ARM-boards are not affected. Changes in v2: - Cosmetic: Fix spelling mistake in commit message common/board_f.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/common/board_f.c b/common/board_f.c index d4d7d01f8f..73297fc1b2 100644 --- a/common/board_f.c +++ b/common/board_f.c @@ -282,7 +282,9 @@ static int init_func_i2c(void) static int setup_mon_len(void) { -#if defined(__ARM__) || defined(__MICROBLAZE__) +#if defined(CONFIG_ARCH_NEXELL) + gd->mon_len = (ulong)__bss_end - (ulong)__image_copy_start; +#elif defined(__ARM__) || defined(__MICROBLAZE__) gd->mon_len = (ulong)__bss_end - (ulong)_start; #elif defined(CONFIG_SANDBOX) && !defined(__riscv) gd->mon_len = (ulong)_end - (ulong)_init; From patchwork Fri Jan 26 12:50:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Bosch X-Patchwork-Id: 1891309 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=posteo.net header.i=@posteo.net header.a=rsa-sha256 header.s=2017 header.b=n9wtHEPa; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TLyL0641Xz23f9 for ; Fri, 26 Jan 2024 23:53:28 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 697B387C15; Fri, 26 Jan 2024 13:53:17 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=posteo.net Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; secure) header.d=posteo.net header.i=@posteo.net header.b="n9wtHEPa"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id ED12487C23; Fri, 26 Jan 2024 13:53:16 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mout02.posteo.de (mout02.posteo.de [185.67.36.66]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 5A9C587C15 for ; Fri, 26 Jan 2024 13:53:13 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=posteo.net Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=stefan_b@posteo.net Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 060E2240103 for ; Fri, 26 Jan 2024 13:53:13 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1706273593; bh=g9ukzM6uZ1p/qGbjYgoa2fB9Cx3+mq8HCWrf+jmxyB0=; h=From:To:Cc:Subject:Date:Message-Id:From; b=n9wtHEPa0sft6kiTqtos60AznsTWh4gX/ajlekpW0jkPtdZDQk/QNufuHjLwBQrXY thX5LuWkkp4QzbmzxKnSE2Js7LiGDAlKrI6iazPkXlxXJ1mgiyG7fbLPfv6K5E7pm/ 4tzBVxdj8tldhmLQxew4mpNxenLXfHdyyGOKvgxuZIjzeeJHXTtRfG6GuHMQPe+SPQ UeoEQ7Q++xvM3NjM+ShZdFIWHVlt3WqwoZIqtqM/nixw9AedRCXIv+Fg4nlrsxGDLL IF0iMuCEfytFDDX7NcBW3reZtpXt4gpPgveGq0Yj8ten5k7WxnFFNFFa7exnTo4hrh ossy15/ORkX4g== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4TLyKh2v3Tz6twV; Fri, 26 Jan 2024 13:53:12 +0100 (CET) From: Stefan Bosch To: Simon Glass Cc: u-boot@lists.denx.de, Tom Rini , Stefan Bosch Subject: [PATCH v3 2/2] arm: s5p4418: fix relocation of vectors Date: Fri, 26 Jan 2024 12:50:56 +0000 Message-Id: <20240126125056.16439-3-stefan_b@posteo.net> In-Reply-To: <20240126125056.16439-1-stefan_b@posteo.net> References: <20240126125056.16439-1-stefan_b@posteo.net> X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean 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 Reviewed-by: Minkyu Kang --- (no changes since v1) 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 +# +# Copyright (C) 2023 Stefan Bosch 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 + * Copyright (C) 2023 Stefan Bosch + */ + +#include +#include +#include + +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)