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);