From patchwork Sun Nov 24 18:38:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 845195 Delivered-To: patch@linaro.org Received: by 2002:a5d:688e:0:b0:382:43a8:7b94 with SMTP id h14csp828745wru; Sun, 24 Nov 2024 10:38:47 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCU5KS+VNufUdLFgP/jLEsbT0JH8O3rQlqsUFYqa+6HSlnd/5RY7n4mHvJ2Q+wsnOwoOjO2m0Q==@linaro.org X-Google-Smtp-Source: AGHT+IH7Uw2VRnOFW9wYntyhqYj/Mo1KCUTxbYWpIwBrIDA5gBAX7UkCLB4kgMeA1tjmhJb4uSA2 X-Received: by 2002:a05:6402:42cb:b0:5cf:f660:d58d with SMTP id 4fb4d7f45d1cf-5d0207c10c7mr6791090a12.29.1732473527383; Sun, 24 Nov 2024 10:38:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1732473527; cv=none; d=google.com; s=arc-20240605; b=iCx9f5v3Fw5CUeQQHUyAN5BOVDPADAl91Ecwf0Gfp65o/PDBnZtC6g3eSsvo0NFA4s UNLalQrP/W6brgpfg9l2GJOoXLyelx66fNw5VH5hKgF4FNCsiz/hBDSm84yH9EqRqoiF EfG5ZRpOsJGpRF8IY9ongskeWVdlc4w2Mybhq5ZwqdmIpd7gQbJ2pw9bfV7G6tjwJSLG vmOgb+AGLgHPW3gOLZliFVtuhHx2o0Cv9P/TliQbwFHSGKjlop0UURtFu73OaE2bDAiz weo26zqLNovvp055cixA5gnK5PmHets440HaTIYko0of753oJuyv1Gm1W4BcAEqd1p6T vW0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature; bh=Djcnt4zRb4tK6dxCtXwg5cfgPTfFiViYeaFFG+OS6IA=; fh=H4wblk8faiEQ/PL/dLlB9u26kzItDBjyJlFlQ7elv0I=; b=hfUOuXyRB0Z2O0on+BFaBmBKcXVSeIz6689Ydg/+zfW0SZvo2/E3qGmYadt2SDj8d5 RxaxhiipRUvHjnmWyqHEXsw5hluLR2HTR8n6FNYnBhLSkt7/HE7sP3lBSBR+tVu8ZnRq LpworcwVKzHL+2fGF/Fk0SkIJYLfzr3S7mS3nrZrSYf3HYLd7HE08vCWC/qb5BnYDS8l crWsinmKDhs3g9OL3g6mlMYuyf+xxOhs5gd3oYtkx+Tow/IfZF2wBagVmchH4byPNogA 2Iu9xU0JiRkCNUVGOfrfcWa7XWC+UarlqYKszcmsRTTJ8hMom48J8IwVy2+HZyraUKl3 vpog==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yIAbqEYC; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-5d01d3bfaa1si3955905a12.189.2024.11.24.10.38.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Nov 2024 10:38:47 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yIAbqEYC; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 07A2C88901; Sun, 24 Nov 2024 19:38:46 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org 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; unprotected) header.d=linaro.org header.i=@linaro.org header.b="yIAbqEYC"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 5DD5A895A9; Sun, 24 Nov 2024 19:38:44 +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_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-lf1-x129.google.com (mail-lf1-x129.google.com [IPv6:2a00:1450:4864:20::129]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 34D9A895A0 for ; Sun, 24 Nov 2024 19:38:42 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=caleb.connolly@linaro.org Received: by mail-lf1-x129.google.com with SMTP id 2adb3069b0e04-539eb97f26aso4154886e87.2 for ; Sun, 24 Nov 2024 10:38:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1732473521; x=1733078321; darn=lists.denx.de; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=Djcnt4zRb4tK6dxCtXwg5cfgPTfFiViYeaFFG+OS6IA=; b=yIAbqEYCMfTh8qLVbALwr81Oy3nhN0HTy908CffZOqySoILrk4sjE3cRBmWkwwfXTt BMwjhTv994VMnXUvALNrvXKoTh/N0t6Jiu3ZAKwJeLrPj92OzyGCIrF1r3g8aROgoyh6 yT/XAcj7Kho7pFp6g20SKfWm2UXMCF+r5qoEt5w3HvBImXRr1tKcCRYsqbtRT79DzeR9 I9Bivq75YXh7KYKNBpxEm3vwzQbCUPQrj5h89SlbRxq+fKuwUAQiXr9+6CN56F3WYiqd 8JM3ziJN1odTRLvDl7E1FrJaWfvdU1HucYktlK0WOoNYXRc8xEPUkGdzoft6m1PsRWFC aUSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732473521; x=1733078321; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Djcnt4zRb4tK6dxCtXwg5cfgPTfFiViYeaFFG+OS6IA=; b=dhZAQOdcmn7b658V0hzl6RcUZpGu6o8ZPbfMrdMgeP3u38j2slkKiXb3yBVoc7og91 zMVe2djOdE/AqVWXRKjv7P/VfmjU0X1EvmDvC9L2pUoUyFGqKFu1GI9j9ocQKiXyMSyh /RKc/khXDgxAWCmOdLKPgWyxXWQUjH92wg+bhFKXMErFVutLlyue8JTZDXx7TgORXwq4 yDYoel+EosHyJLXq/6VAkdWOIbHRp7aUxeEWRkjEADK7/PtGTB/lV0J9g1UCsLQMDkaF Gvtae3pNge8oYVhd+BEzK9BnNZCDiMHCMDPYIye2+3/lVG86Cd3/mRac20HHQh9n1DVf Z8lQ== X-Forwarded-Encrypted: i=1; AJvYcCXXpgqW1xqBYxTbOnA5+9cH6nYcisZTTFBW6dizRMXhgUZTWodV77RJxibB8xgoB7R4puizXQY=@lists.denx.de X-Gm-Message-State: AOJu0Ywh+jLCvLbx2ZIlh5AsyR4agcycmdqgfplvzcvz9xa8qdkZCbuG IFS7JI62PaACI3r8HcOZD/tCwkmT7DN9UfeOTMtehON3FsfH76legjpL5iLxfHE= X-Gm-Gg: ASbGncv6BNn+8O7v8pttAfMfvVufoI03b0c1Rq5/Xok3MfykTc1rP+rx2c3RzwuH61e 3tgJsnAqd+F45Zun4AXKscP2SRmNoayXCI8f+5JYjqsJNlD/oESezY2ILIdyNrV2836o9GIW1g8 5b1ErE8SntOLbq+OrW+mURYSaS8Q0XZTcmQ+YUcs6c0IrD5wlRf4jCoyDC99J/QciJjTad/5eJV /SOsmv+TbEJBvUFfGE1mKEND1UxH+KEhXsBKqBe4H+z0nhYRamdr9R2Fc3eIGubZ0lDDSde32KU i2iqDo9A X-Received: by 2002:a05:6512:12c2:b0:53d:dd7e:338e with SMTP id 2adb3069b0e04-53ddd7e33dbmr1801452e87.16.1732473520485; Sun, 24 Nov 2024 10:38:40 -0800 (PST) Received: from lion.caleb.rex.connolly.tech ([2a02:8109:888d:ff00:ca7f:54ff:fe52:4519]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aa50b344fccsm371392566b.86.2024.11.24.10.38.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Nov 2024 10:38:39 -0800 (PST) From: Caleb Connolly To: Devarsh Thakkar , Ilias Apalodimas , Jonas Karlman , Raymond Mao , Richard Weinberger , Simon Glass , This contributor prefers not to receive mails , Tom Rini Cc: Neil Armstrong , u-boot-qcom@groups.io, Caleb Connolly , u-boot@lists.denx.de Subject: [PATCH] common/board_f: init malloc earlier Date: Sun, 24 Nov 2024 19:38:29 +0100 Message-ID: <20241124183832.2476928-1-caleb.connolly@linaro.org> X-Mailer: git-send-email 2.47.0 MIME-Version: 1.0 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 Currently the early malloc initialisation is done partially in board_init_f_init_reserve() (on arm64 at least), which configures gd->malloc_base. But it isn't actually usable until initf_malloc() is called which doesn't happen until after fdtdec_setup(). This causes problems in a few scenarios: 1. when using MULTI_DTB_FIT as this needs a working malloc (especially for compressed FIT). 2. Some platforms may need to allocate memory as part of memory map initialisation (e.g. Qualcomm will need this to parse the memory map from SMEM). Move the initf_malloc() call earlier so that malloc is available during fdtdec_setup(). Signed-off-by: Caleb Connolly Reviewed-by: Ilias Apalodimas --- common/board_f.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/board_f.c b/common/board_f.c index 98dc2591e1d0..bddfa6b992b9 100644 --- a/common/board_f.c +++ b/common/board_f.c @@ -867,15 +867,15 @@ static int initf_upl(void) } static const init_fnc_t init_sequence_f[] = { setup_mon_len, + initf_malloc, #ifdef CONFIG_OF_CONTROL fdtdec_setup, #endif #ifdef CONFIG_TRACE_EARLY trace_early_init, #endif - initf_malloc, initf_upl, log_init, initf_bootstage, /* uses its own timer, so does not need DM */ event_init,