Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C9027C433F5 for ; Sun, 10 Oct 2021 21:52:29 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4A4FC6023D for ; Sun, 10 Oct 2021 21:52:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 4A4FC6023D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 2092883578; Sun, 10 Oct 2021 23:52:27 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: from tr.lan (ip-89-176-112-137.net.upcbroadband.cz [89.176.112.137]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: marex@denx.de) by phobos.denx.de (Postfix) with ESMTPSA id 97BF083578; Sun, 10 Oct 2021 23:52:24 +0200 (CEST) From: marek.vasut@gmail.com To: u-boot@lists.denx.de Cc: Marek Vasut , Simon Glass , Tom Rini Subject: [PATCH 2/2] arm64: lmb: Reserve U-Boot separately if relocation is disabled Date: Sun, 10 Oct 2021 23:52:09 +0200 Message-Id: <20211010215209.872181-2-marek.vasut@gmail.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211010215209.872181-1-marek.vasut@gmail.com> References: <20211010215209.872181-1-marek.vasut@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.2 at phobos.denx.de X-Virus-Status: Clean From: Marek Vasut In case U-Boot starts with GD_FLG_SKIP_RELOC, the U-Boot code is not relocated, however the stack and heap is at the end of DRAM after relocation. Reserve a LMB area for the non-relocated U-Boot code so it won't be overwritten. Signed-off-by: Marek Vasut Cc: Simon Glass Cc: Tom Rini --- arch/arm/lib/stack.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/arch/arm/lib/stack.c b/arch/arm/lib/stack.c index 656084c7e5..d2e2715ecf 100644 --- a/arch/arm/lib/stack.c +++ b/arch/arm/lib/stack.c @@ -14,6 +14,7 @@ #include #include #include +#include DECLARE_GLOBAL_DATA_PTR; @@ -46,4 +47,12 @@ static ulong get_sp(void) void arch_lmb_reserve(struct lmb *lmb) { arch_lmb_reserve_generic(lmb, get_sp(), gd->ram_top, 16384); + +#ifdef CONFIG_ARM + if (gd->flags & GD_FLG_SKIP_RELOC) { + lmb_reserve(lmb, (phys_addr_t)__image_copy_start, + (phys_addr_t)__image_copy_end - + (phys_addr_t)__image_copy_start); + } +#endif } -- 2.33.0