From patchwork Mon Mar 11 21:35:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Goldschmidt X-Patchwork-Id: 1054883 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="XkzsPfsq"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 44JBH45mblz9s47 for ; Tue, 12 Mar 2019 08:35:42 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 3A411C21C2F; Mon, 11 Mar 2019 21:35:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=FREEMAIL_FROM, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 59408C21C8B; Mon, 11 Mar 2019 21:35:33 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id E6756C21C27; Mon, 11 Mar 2019 21:35:31 +0000 (UTC) Received: from mail-wm1-f65.google.com (mail-wm1-f65.google.com [209.85.128.65]) by lists.denx.de (Postfix) with ESMTPS id 83374C21BE5 for ; Mon, 11 Mar 2019 21:35:31 +0000 (UTC) Received: by mail-wm1-f65.google.com with SMTP id f3so584694wmj.4 for ; Mon, 11 Mar 2019 14:35:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=wmLxHUNerF/MVJTHf+uqW6myIaMtRRk55O7egte8+MU=; b=XkzsPfsqTdC6QQEfiAmNss0Ry6kE9LvyZwiiUnWnDDnloqBRdpFn23KWaSdqBQyUSU wWcz4nFCpkuStgTbJcq0Wub/3JXtZHYubr3Nsf2lP/CxBBB5L3W3DE7lkr02rEUfcJew YLVPrYWw+K3mc07KjdbiSdoSplNUpiGjlufy8GPOdseejOZfNL4tF7l5ixWvKqlei4Qm EHf/zgdmLDMP/zZY5gKuczLqFoYf8jN4lT2FBOF4s/XREXcFVuAr9ALpnUPnYtZVCJGf XCIW9UMylNCcWI6SQqqTehtRSIFDblNWgYwSu59tHpSSi860QYOtcK5miYLgTXrTXM7R OLRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=wmLxHUNerF/MVJTHf+uqW6myIaMtRRk55O7egte8+MU=; b=j09ShyaVE52nNaTymj6AU8J5xM9tr9NHMlv4x5Fq0P6Jk1AXlLfiJN8np86v2LZhx9 fkHUH0V98DpaUuab92HElq4zj9PVfmkToa9hYkfSYrHFJ1VfLKfAVF7Er2jjicWInR9G qpHNCkwFg5D+VF6lhN7c8kzwaZPRABw2N7qEmLfgV1r9pmaCrNKAyTUlEPVSgrOqQrBi WYpNnMq/AzLm8Jdom7FwydXaF3Dww8SKb84aQ16SOeZOlgUeVVByjIRO7eQbNqsIhzP9 jsYBKnP2OWr4DHrpJawfpTplB8OIOZKPVnhWiuwuwY6KZBBCTsmpMjNKBDtCKRFyGsoP fdvQ== X-Gm-Message-State: APjAAAX3nQSCnalBZ93jxgG4OYbaUcpH7WGWcZXLgW4GzCShQgoJfX1R pV8WFi2uXwhomzlDDZnTnGk8fO68 X-Google-Smtp-Source: APXvYqyye2PHaWI1Dn6YP7ORZFli2gsJ++3sjEJxGkpz7+NMuMiI4Q6CRtzfp+PbDRAoav3wuXG2Cg== X-Received: by 2002:a7b:c38d:: with SMTP id s13mr140529wmj.151.1552340130915; Mon, 11 Mar 2019 14:35:30 -0700 (PDT) Received: from ubuntu.home ([2a02:8071:6a3:700:3ce6:848a:8db5:3b8c]) by smtp.gmail.com with ESMTPSA id u17sm22997225wrg.71.2019.03.11.14.35.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Mar 2019 14:35:30 -0700 (PDT) From: Simon Goldschmidt To: u-boot@lists.denx.de Date: Mon, 11 Mar 2019 22:35:19 +0100 Message-Id: <20190311213524.15893-2-simon.k.r.goldschmidt@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190311213524.15893-1-simon.k.r.goldschmidt@gmail.com> References: <20190311213524.15893-1-simon.k.r.goldschmidt@gmail.com> Cc: Tien Fong Chee , Fabio Estevam , Jagan Teki Subject: [U-Boot] [PATCH 1/6] spl: add Kconfig option to clear bss early X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" This introduces a new Kconfig option SPL_CLEAR_BSS_F. If enabled, it clears the bss before calling board_init_f() instead of clearing it before calling board_init_r(). This also ensures that variables placed in BSS can be shared between board_init_f() and board_init_r() in SPL. Signed-off-by: Simon Goldschmidt --- common/spl/Kconfig | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/common/spl/Kconfig b/common/spl/Kconfig index 206c24076d..5da8697994 100644 --- a/common/spl/Kconfig +++ b/common/spl/Kconfig @@ -156,6 +156,17 @@ config SPL_STACK_R_MALLOC_SIMPLE_LEN to give board_init_r() a larger heap then the initial heap in SRAM which is limited to SYS_MALLOC_F_LEN bytes. +config SPL_CLEAR_BSS_F + bool "Clear BSS section before calling board_init_f" + help + The BSS section is initialized to zero. In SPL, this is normally done + before calling board_init_r(). + For platforms using BSS in board_init_f() already, enable this to + clear the BSS section before calling board_init_f() instead of + clearing it before calling board_init_r(). This also ensures that + variables placed in BSS can be shared between board_init_f() and + board_init_r(). + config SPL_SEPARATE_BSS bool "BSS section is in a different memory region from text" help From patchwork Mon Mar 11 21:35:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Goldschmidt X-Patchwork-Id: 1054884 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="YjCz3JWM"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 44JBHC15HYz9s47 for ; Tue, 12 Mar 2019 08:35:51 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id DC160C21D65; Mon, 11 Mar 2019 21:35:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=FREEMAIL_FROM, RCVD_IN_MSPIKE_H2, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id E7284C21DF3; Mon, 11 Mar 2019 21:35:33 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id B2963C21C27; Mon, 11 Mar 2019 21:35:32 +0000 (UTC) Received: from mail-wm1-f68.google.com (mail-wm1-f68.google.com [209.85.128.68]) by lists.denx.de (Postfix) with ESMTPS id 49ADDC21BE5 for ; Mon, 11 Mar 2019 21:35:32 +0000 (UTC) Received: by mail-wm1-f68.google.com with SMTP id n19so600900wmi.1 for ; Mon, 11 Mar 2019 14:35:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=wTYIQIV8dBaSedHMaMxoE7O87h2Sezsmhah7ReNZXzc=; b=YjCz3JWMriKWXCWeqJ0ICsmLcY9nEjks/Rc/OGLoG16wIi+cp8VFX+qnIbfPgl5FUr 0OSZk/C4qejtE1B1ppQseIMW1QDSgyH7nPOCgdgCdX6Hgdw/9pm5NQo0ORSK8N8wCCwZ ok2GwwpC0Uo5e9/YI0feuBZEJ7BLmbDQOO2qCfob3wR1+yFDsbx6PTd3BduiBW6hNMdU IzjPxUAAalO1T/VfAkUKmsJdavutS0hjJV7KztdBTqzfLj5Z/SZsXO4mkhNM4coHVJr3 OvmbBk9sA/pqnNck2BEWuVaUDzs12hPL0cAuBlSeVnkMuAXKxE/pJbXwWqBKLOUhBnJ6 7nbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=wTYIQIV8dBaSedHMaMxoE7O87h2Sezsmhah7ReNZXzc=; b=kUj8fUDc39OggRPbVgkFBJ+lLQlZtI9UFuj9Q1Yg6hX8C81+Wjta7Uo/9eXb2UUGJM 3zxolgduC3iRVNystJYKSrqnY/KOZ0IkjudLWnc6rkp53a0jYRv3X/PJzfe/JoAoVmKB qScvFWgVsoV52/7XoULj/L9oT2sogEU62HmOs+1YHCdl/STW1NTlar+MTbRzqFSTbInB D3RY97pYxQpgcvfxRK0cG1D6RXW/TYYbXnfLn9QEgy8fMcvPcobjAbpAtdxR7xYcviSV MdjMW1o1JyKRgAQ5rGyiGy+fVfVujzEBZ/chfqY+Di19QAJkyTSRgc8a0zxl7dWy1DCj ICLA== X-Gm-Message-State: APjAAAVmpemaSdBIZvjzWJ0lKxgVDUmA9JrgxSniEBZm7M7t4TsW7e3N XAd8vjhrThh7JHYWqqf6muspaJb1 X-Google-Smtp-Source: APXvYqwhAN1UD1UVNCdp1gUUDqmSxMR4OMRAmjubsi29pjQmeVq4TFnbApVN4OCbRqKVDQvHywQGbA== X-Received: by 2002:a7b:c8d8:: with SMTP id f24mr176286wml.15.1552340131710; Mon, 11 Mar 2019 14:35:31 -0700 (PDT) Received: from ubuntu.home ([2a02:8071:6a3:700:3ce6:848a:8db5:3b8c]) by smtp.gmail.com with ESMTPSA id u17sm22997225wrg.71.2019.03.11.14.35.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Mar 2019 14:35:31 -0700 (PDT) From: Simon Goldschmidt To: u-boot@lists.denx.de Date: Mon, 11 Mar 2019 22:35:20 +0100 Message-Id: <20190311213524.15893-3-simon.k.r.goldschmidt@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190311213524.15893-1-simon.k.r.goldschmidt@gmail.com> References: <20190311213524.15893-1-simon.k.r.goldschmidt@gmail.com> Cc: Tom Rini Subject: [U-Boot] [PATCH 2/6] spl: arm: implement SPL_CLEAR_BSS_F X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" This implements the new option to clear BSS early in SPL for standard arm crt0. BSS is cleared before calling board_init_f() and thus not cleared before calling board_init_r() as it is not relocated in SPL. Signed-off-by: Simon Goldschmidt --- arch/arm/lib/crt0.S | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/arch/arm/lib/crt0.S b/arch/arm/lib/crt0.S index fe312db690..b06e54e144 100644 --- a/arch/arm/lib/crt0.S +++ b/arch/arm/lib/crt0.S @@ -80,6 +80,26 @@ ENTRY(_main) mov r9, r0 bl board_init_f_init_reserve +#if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_CLEAR_BSS_F) + ldr r0, =__bss_start + +#ifdef CONFIG_USE_ARCH_MEMSET + ldr r3, =__bss_end + mov r1, #0x00000000 /* prepare zero to clear BSS */ + + subs r2, r3, r0 /* r2 = memset len */ + bl memset +#else + ldr r1, =__bss_end + mov r2, #0x00000000 /* prepare zero to clear BSS */ + +clbss_l:cmp r0, r1 /* while not at end of BSS */ + strlo r2, [r0] /* clear 32-bit BSS word */ + addlo r0, r0, #4 /* move to next */ + blo clbss_l +#endif +#endif + mov r0, #0 bl board_init_f @@ -124,6 +144,7 @@ here: movne sp, r0 movne r9, r0 # endif +#if !defined(CONFIG_SPL_BUILD) || !defined(CONFIG_SPL_CLEAR_BSS_F) ldr r0, =__bss_start /* this is auto-relocated! */ #ifdef CONFIG_USE_ARCH_MEMSET @@ -141,6 +162,7 @@ clbss_l:cmp r0, r1 /* while not at end of BSS */ addlo r0, r0, #4 /* move to next */ blo clbss_l #endif +#endif #if ! defined(CONFIG_SPL_BUILD) bl coloured_LED_init From patchwork Mon Mar 11 21:35:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Goldschmidt X-Patchwork-Id: 1054885 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="RSWi1zSB"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 44JBHr483Nz9s47 for ; Tue, 12 Mar 2019 08:36:24 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 2C70BC21EA6; Mon, 11 Mar 2019 21:36:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=FREEMAIL_FROM, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id BA805C21EE3; Mon, 11 Mar 2019 21:35:35 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 9B966C21EA7; Mon, 11 Mar 2019 21:35:33 +0000 (UTC) Received: from mail-wr1-f48.google.com (mail-wr1-f48.google.com [209.85.221.48]) by lists.denx.de (Postfix) with ESMTPS id 3E36FC21C3F for ; Mon, 11 Mar 2019 21:35:33 +0000 (UTC) Received: by mail-wr1-f48.google.com with SMTP id p1so459671wrs.8 for ; Mon, 11 Mar 2019 14:35:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=jYwLEL2+nyu1uy41FEdClIgO2/T9CmDPqZQzcNFhjJY=; b=RSWi1zSBzixCrFNqqlbuMBxQI6fa6XjDoBBgMpWcLLSBxZloX3dBxXHAT7e91iki/S o7o49XX+X6JKnOSSwVsWPKK1NiSY8n+C58XRcnHhPsht7V3eO0pvjIkZSNawlDTovdXY LeIQihUlcARSY8jeFwDUmQzg/dsTMbQ8BbD607J/hK+fxzgVwUIfz+E5S5S0RaNtaqUS JausHTxdA6cqrE0n37vZ0fZvODdcb/h4bCsD/78UUw6FVokXYUJshCzjt/o/6zjY61yH HBJE2GeUlpavtrr7b260Fovjp52DP2mOjYucn1ExljxyOxkTlkTSa183u6uypmQDhr9g VyIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=jYwLEL2+nyu1uy41FEdClIgO2/T9CmDPqZQzcNFhjJY=; b=p3yOHEO4zmD99WTaMcM7PAisNIoyeRyKBd15rV/gUEfyC0Q4NOZYOeGpbuhU1cHut5 hKKMB4sET1iS1JkBHLhQDBlp/mcVL1yWOvudukCDDfLxPRdgZpaG1YFmyWkzie0Tm/nl 3vSrhC/4+bbvVRXBOHZisOie88FA5fI53ubw7FsAUCAwWeuvfWhh510TMyYWaqzTui8p 9JsU8CqdY24yI+P9YFBClCOCX7wFfEfGkHerYC1VkZ/8LNhFXW7TSU8zMvTK9wLeePCe PueMn02cU78f7wQsi6tCCpWPAoK3cmBhrL7/CA9wkVzhYL0S5lvOpyrA8KE4cAyZiZ0t kLhw== X-Gm-Message-State: APjAAAUrZUYFl0Y3cVBAF2h37rnk++uSDRmuyieBV+Mdpd5ZcgzZ9l3s gqS1uuDSGPeTYvrJxM47fDRpzH09 X-Google-Smtp-Source: APXvYqz3WASfQ5BRcKlXsLqAkhCwKHnWsNvsx/gi4z/IMop6eddhHU2Efyke75FOlZHExIIW0CIOUA== X-Received: by 2002:adf:ec10:: with SMTP id x16mr21835378wrn.171.1552340132754; Mon, 11 Mar 2019 14:35:32 -0700 (PDT) Received: from ubuntu.home ([2a02:8071:6a3:700:3ce6:848a:8db5:3b8c]) by smtp.gmail.com with ESMTPSA id u17sm22997225wrg.71.2019.03.11.14.35.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Mar 2019 14:35:31 -0700 (PDT) From: Simon Goldschmidt To: u-boot@lists.denx.de Date: Mon, 11 Mar 2019 22:35:21 +0100 Message-Id: <20190311213524.15893-4-simon.k.r.goldschmidt@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190311213524.15893-1-simon.k.r.goldschmidt@gmail.com> References: <20190311213524.15893-1-simon.k.r.goldschmidt@gmail.com> Subject: [U-Boot] [PATCH 3/6] dlmalloc: fix malloc range at end of ram X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" If the malloc range passed to mem_malloc_init() is at the end of address range and 'start + size' overflows to 0, following allocations fail as mem_malloc_end is zero (which looks like uninitialized). Fix this by subtracting 1 of 'start + size' overflows to zero. Signed-off-by: Simon Goldschmidt --- common/dlmalloc.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/common/dlmalloc.c b/common/dlmalloc.c index edaad299bb..51d3bd671a 100644 --- a/common/dlmalloc.c +++ b/common/dlmalloc.c @@ -603,6 +603,10 @@ void mem_malloc_init(ulong start, ulong size) mem_malloc_start = start; mem_malloc_end = start + size; mem_malloc_brk = start; + if (start && size && !mem_malloc_end) { + /* overflow: malloc area is at end of address range */ + mem_malloc_end--; + } debug("using memory %#lx-%#lx for malloc()\n", mem_malloc_start, mem_malloc_end); From patchwork Mon Mar 11 21:35:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Goldschmidt X-Patchwork-Id: 1054886 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="W6M//TUb"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 44JBKB60d1z9s47 for ; Tue, 12 Mar 2019 08:37:34 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 8C4B9C21EE8; Mon, 11 Mar 2019 21:36:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=FREEMAIL_FROM, RCVD_IN_MSPIKE_H2, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 544C9C21F0F; Mon, 11 Mar 2019 21:35:49 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 83936C21D65; Mon, 11 Mar 2019 21:35:37 +0000 (UTC) Received: from mail-wr1-f66.google.com (mail-wr1-f66.google.com [209.85.221.66]) by lists.denx.de (Postfix) with ESMTPS id EC7BCC21DFF for ; Mon, 11 Mar 2019 21:35:33 +0000 (UTC) Received: by mail-wr1-f66.google.com with SMTP id p8so472370wrq.6 for ; Mon, 11 Mar 2019 14:35:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Az8n1e7v2sPFuMpLRTZAG6J+mRnU4EB6hO4mybaJ/S8=; b=W6M//TUbVFzMGDeOSuyCljIw3EIc8PnicLAFpfIj3fDTUwZA9O2lqcT/bkMpIWtnBG JtGzTZawZA6CAEuLCAKrlK85+4TsyUriWyJZEmUPdLFWYeysjnu4Yncg+mmoEQecz3se B/jHinm7qIuSZkDk7DsIOrczKGcpndJB/6OG/v9OAVWt0CFVXJgbbJNOUUIbctYzGfsl I1Q/0qmpck+uySEZOn0OIEK4BAvZfqs8ZuARHFajmFGEBFtX/4kBhIL3nB+EeqCQ6yVU +LhYy9z8rMUMVAWc7DohztWfDEf1Ixo7BWdABp9glj0QOCuUsLjVCBNWrnSIgKJ5PHyG Nl1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Az8n1e7v2sPFuMpLRTZAG6J+mRnU4EB6hO4mybaJ/S8=; b=mDoJVfSRBcK9wlOItAthTIe7ggSx6O7IT6ro4R++f3kcw/V10NDlw4aVudZFe3RL3O 4KJ/96qLaqex525RbWWcSxvnbIQdw+JLL4uzIsIx0KUp9enbH27h5BY5+z2eCsru8UDa tTqFHXtwDSDn2WpSX75azJ1NW+BMIPkWjN3R6t+6HXAkkZ5etR2RYoD0o9F9j3q3CnV3 ga+OrIWmFSqtrXkjg5IzBW6H6CGhbim13kTj4BQJu/gtbpxbhaTLECmqWMYtp+XcdzIL 7CaSDPvtPCi036OxITKU5sbbV/hDURetsFYAcTgkYgWZGtDHXKKfe21cXYxAs7HGRuqh 40Vw== X-Gm-Message-State: APjAAAX8hQM4kVO03VqPdZNMYr7msS6BkEVF8RtlwGpKME6HpHV4Uzz9 1suuC9mcgK2Okk7ddCYgbplzyPaV X-Google-Smtp-Source: APXvYqzBqPUuSrqk5SuGil2ItSERbrZCcmpeAVbQ0C6/4sf33SduCabE9RACjG77zxqIj/MDl9qFVA== X-Received: by 2002:adf:cd87:: with SMTP id q7mr22919503wrj.92.1552340133484; Mon, 11 Mar 2019 14:35:33 -0700 (PDT) Received: from ubuntu.home ([2a02:8071:6a3:700:3ce6:848a:8db5:3b8c]) by smtp.gmail.com with ESMTPSA id u17sm22997225wrg.71.2019.03.11.14.35.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Mar 2019 14:35:33 -0700 (PDT) From: Simon Goldschmidt To: u-boot@lists.denx.de Date: Mon, 11 Mar 2019 22:35:22 +0100 Message-Id: <20190311213524.15893-5-simon.k.r.goldschmidt@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190311213524.15893-1-simon.k.r.goldschmidt@gmail.com> References: <20190311213524.15893-1-simon.k.r.goldschmidt@gmail.com> Subject: [U-Boot] [PATCH 4/6] dlmalloc: be compatible to tiny printf X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Convert debug output from '%#lx' to '0x%lx' to be compatible with tiny printf used in SPL. Signed-off-by: Simon Goldschmidt --- common/dlmalloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/dlmalloc.c b/common/dlmalloc.c index 51d3bd671a..af6f43dcc9 100644 --- a/common/dlmalloc.c +++ b/common/dlmalloc.c @@ -608,7 +608,7 @@ void mem_malloc_init(ulong start, ulong size) mem_malloc_end--; } - debug("using memory %#lx-%#lx for malloc()\n", mem_malloc_start, + debug("using memory 0x%lx-0x%lx for malloc()\n", mem_malloc_start, mem_malloc_end); #ifdef CONFIG_SYS_MALLOC_CLEAR_ON_INIT memset((void *)mem_malloc_start, 0x0, size); From patchwork Mon Mar 11 21:35:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Goldschmidt X-Patchwork-Id: 1054889 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="roqY326n"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 44JBKc1Fj6z9s47 for ; Tue, 12 Mar 2019 08:37:56 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id CD2F2C21E16; Mon, 11 Mar 2019 21:36:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=FREEMAIL_FROM, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id C0C1EC21F0B; Mon, 11 Mar 2019 21:35:46 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 5CE43C21F03; Mon, 11 Mar 2019 21:35:38 +0000 (UTC) Received: from mail-wr1-f65.google.com (mail-wr1-f65.google.com [209.85.221.65]) by lists.denx.de (Postfix) with ESMTPS id CC5F7C21EA7 for ; Mon, 11 Mar 2019 21:35:34 +0000 (UTC) Received: by mail-wr1-f65.google.com with SMTP id g18so493686wru.3 for ; Mon, 11 Mar 2019 14:35:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=vDs+OaAhkpPgQvPGQT9rIE/PXKSK2rNJFhawcHbfcFg=; b=roqY326nsEjL31iX0KpQvRcK/6PRfRqJxdrBiuArikyWvXDwANh5f6RJf2xlcSxyCj 2OBcqs8niYpI4s0BhrS7m6eG+p6de1P7DJrXBsPzdofa91UYk6jPbFfkuQZjL+nsrCey 9DTRmDFEpss3Ndg5RRews6rPxj3VFIsQoli3SLJf92bQSLR0m6BQCA3Pg111wUtv+Xrb 2EUJDnOqNDO0bDckhHyqWTZvUidu3NOqudTV6Z3nJmSq7uTk0hWZxj2K2tZ0JHbz/9Tp hoFx0qUKGsV2U4D5lMBtxJNqfjwxnkQ8YBbtjha0i+8LFNz0DiTavp48tX2mekOstPBz lLTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=vDs+OaAhkpPgQvPGQT9rIE/PXKSK2rNJFhawcHbfcFg=; b=In6EzhD1EueI9JROp1y/+loO0aiVcKhfKX6gCFJHK0sqcI2c04LriPgUbivps9Sj4F oOSwREjmWtJbxsorbNimAjQavTslkfSScF5JG8wWeGdsO+mEnADxX0bgprxYwTLPRgAN xTWx0mp9/d3sGN/pY+yyT0VoMHJecoPOpsFNZV3Gi840w/cZG1eseLC7FUf4xkzA/W+X P9yaB2fIyFg7s47rd7wwE2tcwUq82tKcWYz/3p91dHkx8zqU0bnuOq9Y4tdZIlQSyW9O kfAzZw1Jhvz7mpnoBjTUa+mbcuftBWZC9UvdYeTB/BOwXw1Zu9UKdop5kLgHVCefw4mL qivw== X-Gm-Message-State: APjAAAVQzWZi6Qg5ZX8yIGpHehgElpyo0Sefz1haPodNQAmgQqkoZlFZ Qux5bFFYYpVhhSwx61NFCQgno0gE X-Google-Smtp-Source: APXvYqyydrIndgMIANSH9Ah/c4Vo4R0nQ/sbWzM4CJBYpaGtk26HqK4wafFNuG18m01koF/m22i4vQ== X-Received: by 2002:a5d:6446:: with SMTP id d6mr22251781wrw.72.1552340134325; Mon, 11 Mar 2019 14:35:34 -0700 (PDT) Received: from ubuntu.home ([2a02:8071:6a3:700:3ce6:848a:8db5:3b8c]) by smtp.gmail.com with ESMTPSA id u17sm22997225wrg.71.2019.03.11.14.35.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Mar 2019 14:35:33 -0700 (PDT) From: Simon Goldschmidt To: u-boot@lists.denx.de Date: Mon, 11 Mar 2019 22:35:23 +0100 Message-Id: <20190311213524.15893-6-simon.k.r.goldschmidt@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190311213524.15893-1-simon.k.r.goldschmidt@gmail.com> References: <20190311213524.15893-1-simon.k.r.goldschmidt@gmail.com> Cc: Marek Vasut Subject: [U-Boot] [PATCH 5/6] spl: support using full malloc with SYS_MALLOC_F_LEN X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Some platforms (like socfpga A10) need a big hep before SDRAM is available (e.g. because FAT is used). For such platforms, simple_malloc is often not a good option as it does not support freeing memory. These platforms often use the non-Kconfig defines CONFIG_SYS_SPL_MALLOC_START (and its SIZE). This patch allows enabling CONFIG_SPL_SYS_MALLOC_F_LEN while leaving CONFIG_SPL_SYS_MALLOC_SIMPLE disabled. In this case, the full malloc heap is made available as early as the simple_malloc heap would be normally. This way, platforms can drop the non-Kconfig options to set up the full heap and rely on the same automatically calculated heap allocation used for simple heap. Signed-off-by: Simon Goldschmidt --- common/spl/spl.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/common/spl/spl.c b/common/spl/spl.c index 88d4b8a9bf..b89340eb27 100644 --- a/common/spl/spl.c +++ b/common/spl/spl.c @@ -383,8 +383,13 @@ static int spl_common_init(bool setup_malloc) #ifdef CONFIG_MALLOC_F_ADDR gd->malloc_base = CONFIG_MALLOC_F_ADDR; #endif +#if CONFIG_IS_ENABLED(SYS_MALLOC_SIMPLE) gd->malloc_limit = CONFIG_VAL(SYS_MALLOC_F_LEN); gd->malloc_ptr = 0; +#else + mem_malloc_init(gd->malloc_base, CONFIG_VAL(SYS_MALLOC_F_LEN)); + gd->flags |= GD_FLG_FULL_MALLOC_INIT; +#endif } #endif ret = bootstage_init(true); From patchwork Mon Mar 11 21:35:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Goldschmidt X-Patchwork-Id: 1054888 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="GktTQ/BR"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 44JBKV6Vwrz9sCJ for ; Tue, 12 Mar 2019 08:37:50 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 5E4A8C21F01; Mon, 11 Mar 2019 21:36:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=FREEMAIL_FROM, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 31CB1C21EFF; Mon, 11 Mar 2019 21:35:43 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 298B8C21E96; Mon, 11 Mar 2019 21:35:38 +0000 (UTC) Received: from mail-wm1-f65.google.com (mail-wm1-f65.google.com [209.85.128.65]) by lists.denx.de (Postfix) with ESMTPS id B3227C21EE0 for ; Mon, 11 Mar 2019 21:35:35 +0000 (UTC) Received: by mail-wm1-f65.google.com with SMTP id c13so699070wmb.0 for ; Mon, 11 Mar 2019 14:35:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=37bMll7fQsyo9iDX01GQ07V73/0f32CZt9lnOFW/uPI=; b=GktTQ/BRbSlMPOT6l2wK2pY1pNkJZoRLB3D9/5N6PPp+oJ5xm8mgKUaeszF58gnuEM K69KwuLlq2SOU12hCf3tx5NRePxWzH0S490AZEYWPF5O5VqS5kLLNWLLrh+RvQOggrIv neoIvcqJT/kWyAvCqhpeeIdZzrIw0Nd+HRkBLOoahKc9GtJZGLOE5n/kzsPRkTL+jfqG 8jqdhDs5H4ueYY5Mj6ahhmwwDOKeNfHJAXg1TliX/5c4rPDmFWW+8PK9TIgRUX7UcGHf 63sDc31hzprkBO0T+ED4RYk4XdTIOw6zrtz0JIJ0TVZlTzfgDvv3qxZqciI28ToT2oXq F5uw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=37bMll7fQsyo9iDX01GQ07V73/0f32CZt9lnOFW/uPI=; b=UT8Rhy5t8Ufhcur0l8oJt+pPxgdfQVLtBiTmuiJfgAcqBMUpnJjRYzrF2GTekMb9eH UMIYfCoxAz4ajcd74Bj6pRWYJP0GyJ2su34Z+MgXMo0SrMLLE0k7VIepfG/xfAnHkZzW MT5KFCZoxQ0Ez1B+h2d2YJByHHN7n7vTMT4FXB7asE+M6EOvS5NRZ8eT2mK1HrsXurpO Opy+eJno24ege3TqCmGu8a7GwJcth0Fr1lFWmpDYJLRMTvzl6GX2N5iunvBwzdlvAT4D m+rWowpjLyaUTQTppdyfCEwNxGD1yWcBL0RZGrONxZIp1GwReCWjIZt87MqIReoffiwG KqVA== X-Gm-Message-State: APjAAAVEsfnvCbhwElTL/LpnVJgPuE9lW+KfMFoEjI01sV1oLIO4+jYS xJYSLxRzsmj/kGiD0MC7O0kQgHU1 X-Google-Smtp-Source: APXvYqwGBv/lfzBt+U6qifgsn+qcVJA3OOsGdqA4k9zqEWHwpEsfjJH3Egyl/vebE+JfoTCjTLIYIQ== X-Received: by 2002:a1c:400a:: with SMTP id n10mr176058wma.56.1552340135288; Mon, 11 Mar 2019 14:35:35 -0700 (PDT) Received: from ubuntu.home ([2a02:8071:6a3:700:3ce6:848a:8db5:3b8c]) by smtp.gmail.com with ESMTPSA id u17sm22997225wrg.71.2019.03.11.14.35.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Mar 2019 14:35:34 -0700 (PDT) From: Simon Goldschmidt To: u-boot@lists.denx.de Date: Mon, 11 Mar 2019 22:35:24 +0100 Message-Id: <20190311213524.15893-7-simon.k.r.goldschmidt@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190311213524.15893-1-simon.k.r.goldschmidt@gmail.com> References: <20190311213524.15893-1-simon.k.r.goldschmidt@gmail.com> Cc: Marek Vasut , Tien Fong Chee , Tom Rini , Joe Hershberger , Chin-Liang See , Stefan Roese Subject: [U-Boot] [PATCH 6/6] arm: socfpga: a10: move SPL stack size to Kconfig X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Instead of fixing the SPL stack to 64 KiB in the board config header via CONFIG_SYS_SPL_MALLOC_SIZE, let's just use CONFIG_SPL_SYS_MALLOC_F_LEN in the defconfig. This also has the advandage that it removes sub-mach specific ifdefs in socfpga_common.h. Signed-off-by: Simon Goldschmidt --- This patch was part of an socfpga series before. It didn't work there and was the reason for this series. It also serves as a demonstration of this series. --- configs/socfpga_arria10_defconfig | 1 + include/configs/socfpga_common.h | 14 -------------- 2 files changed, 1 insertion(+), 14 deletions(-) diff --git a/configs/socfpga_arria10_defconfig b/configs/socfpga_arria10_defconfig index f321a0ac3b..8d0479cc05 100644 --- a/configs/socfpga_arria10_defconfig +++ b/configs/socfpga_arria10_defconfig @@ -2,6 +2,7 @@ CONFIG_ARM=y CONFIG_ARCH_SOCFPGA=y CONFIG_SYS_TEXT_BASE=0x01000040 CONFIG_SYS_MALLOC_F_LEN=0x2000 +CONFIG_SPL_SYS_MALLOC_F_LEN=0x10000 CONFIG_TARGET_SOCFPGA_ARRIA10_SOCDK=y CONFIG_SPL=y CONFIG_IDENT_STRING="socfpga_arria10" diff --git a/include/configs/socfpga_common.h b/include/configs/socfpga_common.h index 181af9b646..16c83900c3 100644 --- a/include/configs/socfpga_common.h +++ b/include/configs/socfpga_common.h @@ -251,16 +251,6 @@ unsigned int cm_get_qspi_controller_clk_hz(void); #define CONFIG_SPL_TEXT_BASE CONFIG_SYS_INIT_RAM_ADDR #define CONFIG_SPL_MAX_SIZE CONFIG_SYS_INIT_RAM_SIZE -#if defined(CONFIG_TARGET_SOCFPGA_ARRIA10) -/* SPL memory allocation configuration, this is for FAT implementation */ -#ifndef CONFIG_SYS_SPL_MALLOC_START -#define CONFIG_SYS_SPL_MALLOC_SIZE 0x00010000 -#define CONFIG_SYS_SPL_MALLOC_START (CONFIG_SYS_INIT_RAM_SIZE - \ - CONFIG_SYS_SPL_MALLOC_SIZE + \ - CONFIG_SYS_INIT_RAM_ADDR) -#endif -#endif - /* SPL SDMMC boot support */ #ifdef CONFIG_SPL_MMC_SUPPORT #if defined(CONFIG_SPL_FS_FAT) || defined(CONFIG_SPL_FS_EXT4) @@ -294,11 +284,7 @@ unsigned int cm_get_qspi_controller_clk_hz(void); /* * Stack setup */ -#if defined(CONFIG_TARGET_SOCFPGA_GEN5) #define CONFIG_SPL_STACK CONFIG_SYS_INIT_SP_ADDR -#elif defined(CONFIG_TARGET_SOCFPGA_ARRIA10) -#define CONFIG_SPL_STACK CONFIG_SYS_SPL_MALLOC_START -#endif /* Extra Environment */ #ifndef CONFIG_SPL_BUILD