From patchwork Sun Nov 24 20:27:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 845221 Delivered-To: patch@linaro.org Received: by 2002:a5d:688e:0:b0:382:43a8:7b94 with SMTP id h14csp861731wru; Sun, 24 Nov 2024 12:29:04 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUM8+Ehlf8sJsefSor9kSOhhhQbOWYJR5pnuIN40LS5/2oabNmhKGTegTiHiVbqpEMvphEL3A==@linaro.org X-Google-Smtp-Source: AGHT+IG8GXhWuSDD1yGCfaLoaDDLCN0A9DTfCo47AZvMV/85fgKPFq+kIj784ne55J1k9M1gfauG X-Received: by 2002:a05:6402:350f:b0:5cf:c198:e510 with SMTP id 4fb4d7f45d1cf-5d01d3de70emr10438664a12.1.1732480144654; Sun, 24 Nov 2024 12:29:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1732480144; cv=none; d=google.com; s=arc-20240605; b=RdmDDPAIgapmUfkQmEY8PgQ/jUitGpId/a7o2Ema+vx0HY1WPZ3/PwkEYCcTQer859 FDFna542KXZN+tY1cDspZXKM0fAPib0JwPwilPv2dwUofTuhK/jFa4gP4khJm6UWQ6JK bkXyhAvaRKxe714Do/lxcSruXBBeEZrM78HolTTgAk1jJt4KwEwqgfTpnPuKtJjVx2Q+ o6zSKPB0i0+tTrrGxOLm7/dSiR9tENtaymQ161s4CHFMW8OWl1lfuidUGudVZDoUCBWW ymrHUlU1Bmkbk+T6a8BoqSb8SopCIG2rzCaMtEUa/9M8WzfzNKOMIYRjskmoQ0Q6XGiv RJDg== 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:cc:to:in-reply-to:references :message-id:content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=xddMWgdhIA943YyfjJXuDDfnCAKdDdvEQznM/dPME+Y=; fh=kU7YqidQsrrzU/eX3FQjO9dYNJCHrV/Gz8IxnHw+n0c=; b=iHatE1xz60JBoLjZhjQBaxZsuJVr1FFru4YymoK4N8QanWJUf5Z97E5fHp7e5YDQsl vicgCBBLuehNG4cc+Cijej6DYAyyo+//F6vHqA+cExAOwmGXZYlntAs5HfcjaHyCh+Nl 0cSCK9REj0kNPAt2AMtZliyi/Peoeniz+F/zmyrpOtCJexSte/VHiUoe8Iy17V4ytCz3 MtC+tHMZ3c23NwcMMdKasyUtTO8LkO2OUupx7rO0zZ7RJFo9yD45DMiNa6LpFm4l0OVQ eUMI32ipNjcBp2yMcdYpBCHh+NmZKPuhp1UQ8p1Ekp29mnzh9pEzlXYjngTFOma9M0YJ H9Cg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=uX+CQiLr; 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-5d01d41dea5si3841395a12.259.2024.11.24.12.29.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Nov 2024 12:29:04 -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=uX+CQiLr; 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 87FCB89903; Sun, 24 Nov 2024 21:27:50 +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="uX+CQiLr"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 51546899D0; Sun, 24 Nov 2024 21:27:49 +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=unavailable autolearn_force=no version=3.4.2 Received: from mail-ed1-x536.google.com (mail-ed1-x536.google.com [IPv6:2a00:1450:4864:20::536]) (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 D6390895B1 for ; Sun, 24 Nov 2024 21:27:44 +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-ed1-x536.google.com with SMTP id 4fb4d7f45d1cf-5cfcb7183deso8220339a12.0 for ; Sun, 24 Nov 2024 12:27:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1732480064; x=1733084864; darn=lists.denx.de; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=xddMWgdhIA943YyfjJXuDDfnCAKdDdvEQznM/dPME+Y=; b=uX+CQiLrmHyG0NhvtY/jqWEyrKaFW7NbJjRP6aN3YwWzAOnTngFZXv/EI1cBmSajMq k6Q+dL6ezskUgz5fP07TMhow17uiVINT7IEC0HCYmwOdTuYYN5BppWuIzNut4TTfe13v xB2dW3uSFm8ncRadxJGW0M/sgTRoN6BUZkBxUpTTW76O1FeLKPYV0MoBmwujEpihPTjP scVhZdOWovNiUz+5aKwCx430T98KUvLfUGeg/HN10zTFTt/yY4WyXq+gesRUU8Ny3lzl Kjv84W4u7yV2LbK5rSA//xwMobwXrOMDKUwPeyyjs5apMIgYqvBPKHEApqaV8bA6pFd7 Uqqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732480064; x=1733084864; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xddMWgdhIA943YyfjJXuDDfnCAKdDdvEQznM/dPME+Y=; b=mWUmPdC/J686jAQuRm3vCHoUI/yFuZgfmOu8tmwvnHGEocIbn8iuBisLfTxV4ahR6S 3agAQX4xh1BXCEsbDlnGaUDFeVut+viEq9LDhOL9qfBKW70fGB9VB7LUrjFzpLYxxD2U Ux3Oyu7xTjUWxQgeiCJ49RDPmULvtM87kTeaJBjsNMXwIn2OIzEJhLaHY6zPyl4/93WR JzDA0Nsy0Pzou0RWuTmO3d/ILeFR9tt/2dhCBEPtAexuxAhYDn4pzS2FE4QUTGzexNVM T8/h9qIc8ZOZuqTtDHKERxc/zvAG+Zht15LAKFA3D2hO74YdtLH3VA6BjN3oreru436E xpLQ== X-Gm-Message-State: AOJu0YwPXRpyrs81MKXLgfRUgpOXP1SkhiyIweuIqksD0pnf2Ak4boFz c6iNBrbAxH2enMWavnhMkovMhsmJMxvgVjL42t+eyHOMB7/EuUozETux2Fu72do= X-Gm-Gg: ASbGncuQ1SAZRaE2RaEPvXcLXxTwhCy+KfudZuz21dKvTLmhsdCLg1T92YpC9hpucli qnziF1x1kfRsaozopKfM7P5cV0GlqBV2JSohoF6PbjInEupQWtzyZRZG9gsuhdL9Ra16c74rxPV pmpujS3eSIIxkrYNowVEly08yq5cEh3JCI4DcSebxs77QnibQbpnhWwtgd8bIoOd0OS4z7VTPdj ppWDJEieFLoVnTupqWUp00rqG2VLNeCjpqhgCh6phXderfwB4VGHIti90cmmOAYpWsw X-Received: by 2002:a17:907:d23:b0:a9a:170d:67b2 with SMTP id a640c23a62f3a-aa509d5c3e0mr1261638166b.29.1732480064345; Sun, 24 Nov 2024 12:27:44 -0800 (PST) Received: from lion.localdomain ([2a02:8109:888d:ff00:ca7f:54ff:fe52:4519]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aa50b28cda1sm378720666b.9.2024.11.24.12.27.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Nov 2024 12:27:43 -0800 (PST) From: Caleb Connolly Date: Sun, 24 Nov 2024 21:27:05 +0100 Subject: [PATCH RFC 09/14] common/board_f: init malloc earlier MIME-Version: 1.0 Message-Id: <20241124-b4-efistub-arm64-v1-9-3e33f0340071@linaro.org> References: <20241124-b4-efistub-arm64-v1-0-3e33f0340071@linaro.org> In-Reply-To: <20241124-b4-efistub-arm64-v1-0-3e33f0340071@linaro.org> To: Tom Rini , Heinrich Schuchardt , Ilias Apalodimas , Simon Glass , Bin Meng , Anatolij Gustschin , Caleb Connolly , Neil Armstrong , Sumit Garg Cc: u-boot@lists.denx.de, u-boot-qcom@groups.io X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=1324; i=caleb.connolly@linaro.org; h=from:subject:message-id; bh=TdQaHg2gZo8/a+Qm8OtrnXXmL8zMHHJSf56iwUc+Lfc=; b=kA0DAAgReTBFn7kwMhcByyZiAGdDjDKiuBiefUhk/AZCqh4hfQttzWhFCqcyKkYKRvMs6En3b oh1BAARCAAdFiEEF8imOYKt0z8ot6DQeTBFn7kwMhcFAmdDjDIACgkQeTBFn7kwMhefjgEAuLCM 70oEUioBeQ6jRwHbferbCV0L82RSQfaJ7jCMmgYA+wTg8J3mo+qVzMxwEzTFXReUccfZOR7r5Qv 59uuyXjoH X-Developer-Key: i=caleb.connolly@linaro.org; a=openpgp; fpr=83B24DA7FE145076BC38BB250CD904EB673A7C47 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 --- 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,