From patchwork Fri Mar 15 20:13:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Goldschmidt X-Patchwork-Id: 1057243 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="e8TcQ5ii"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 44LcNK00mwz9s70 for ; Sat, 16 Mar 2019 07:18:40 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id A75B4C22131; Fri, 15 Mar 2019 20:18:39 +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_DNSWL_NONE, 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 4E257C22198; Fri, 15 Mar 2019 20:14:17 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id E5A24C221B9; Fri, 15 Mar 2019 20:14:02 +0000 (UTC) Received: from mail-wr1-f67.google.com (mail-wr1-f67.google.com [209.85.221.67]) by lists.denx.de (Postfix) with ESMTPS id CFB1BC22196 for ; Fri, 15 Mar 2019 20:13:58 +0000 (UTC) Received: by mail-wr1-f67.google.com with SMTP id n9so6771052wrr.9 for ; Fri, 15 Mar 2019 13:13:58 -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=fBU3YwlrX0PqXWltIB0Pbi3D0LYee9OHzG6KQ9yudGs=; b=e8TcQ5ii6SAFgj08GuSyLnbVcTGLcGdKjdm8JmWzBCnl4oQqZJimmYIILhQncPco+c CN1Kw88tws37Qp0z7Xj1f+3fBNDRPIWyDUWtxEO0Mz6f+ZJQd0N3VJ3yU4TWcP9t2HmE D7fTlgm6f4J4KZxiB1NPLY5vj6e3mWWHGjW6T0fWHu/boSueE5MbvlUxltJDCdHEMYIJ AozplSEJj1n5Az8WKJTx51Be6CDuVXp8vT+LJVipFcCisqQIbFhyWbfrJur3w0lgRWPQ sagajifLN6rztnCGORuL01e+uMYB4DHBFligQI/UemzVRi+GyUUpPmcXKImMfY8wcdBY UVWQ== 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=fBU3YwlrX0PqXWltIB0Pbi3D0LYee9OHzG6KQ9yudGs=; b=cRDZIVb8KXe3VC0H03hWCfpZFyPjK+iR18t104G6oi1HEdw+9JGpk3oy1g7M2LNNmq T8WTI+BMB9cSanr3Q2gJDDTlZBVz4n+VSlc30MAN0nfoODiJEOYn3cmLyBKI4KPyGfF2 MST5stHcZyl+sEf/YUWHc1yG4dsKEvTMftIVZmk53Uc4+Cx7sA5GsRtn3gIERp4patkH mYiPBgd+22B04fnZiUC/NUI1xI5nSNTRom41GReT47OGXdHIy5uqmQxg9R2xtRR9Y9hs qmv54Hn3ZY6CcNkVonZP9fXM8MKwQgJ32VyDQbdsNzH0R1P1gowKpyhStCwfO0FL/lHN I9PA== X-Gm-Message-State: APjAAAW7brrDx4ojezM6iYswzsm6g8ZisDJt6wk4C6Hmaqa8tnOg500H RHbdnZvUyj2guEN6wYnZ31/OJW7q X-Google-Smtp-Source: APXvYqzImBAn6Zz0vEqL7WIGgRv8PvGEMyY9XFjykwD0TAp1rVTC4kJq7zLX2vnjOQV8V05uba61hg== X-Received: by 2002:adf:c704:: with SMTP id k4mr3852380wrg.142.1552680838143; Fri, 15 Mar 2019 13:13:58 -0700 (PDT) Received: from ubuntu.home ([2a02:8071:6a3:700:a087:9044:6211:ba43]) by smtp.gmail.com with ESMTPSA id z12sm4263957wmf.31.2019.03.15.13.13.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 15 Mar 2019 13:13:57 -0700 (PDT) From: Simon Goldschmidt To: u-boot@lists.denx.de Date: Fri, 15 Mar 2019 21:13:46 +0100 Message-Id: <20190315201347.29475-6-simon.k.r.goldschmidt@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190315201347.29475-1-simon.k.r.goldschmidt@gmail.com> References: <20190315201347.29475-1-simon.k.r.goldschmidt@gmail.com> Cc: Marek Vasut Subject: [U-Boot] [PATCH v2 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 --- Changes in v2: None 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);