From patchwork Tue Aug 8 22:53:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 1819074 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=seco.com header.i=@seco.com header.a=rsa-sha256 header.s=selector1 header.b=YLE4zm4n; dkim=pass (2048-bit key) header.d=seco.com header.i=@seco.com header.a=rsa-sha256 header.s=selector1 header.b=YLE4zm4n; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RL7lp4gm5z1yfB for ; Wed, 9 Aug 2023 08:53:56 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 40D3B86724; Wed, 9 Aug 2023 00:53:47 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=seco.com 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=seco.com header.i=@seco.com header.b="YLE4zm4n"; dkim=pass (2048-bit key) header.d=seco.com header.i=@seco.com header.b="YLE4zm4n"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8889B86714; Wed, 9 Aug 2023 00:53:46 +0200 (CEST) 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,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on20608.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe1a::608]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id ABF7E86672 for ; Wed, 9 Aug 2023 00:53:43 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=seco.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sean.anderson@seco.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=seco.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=PYpeIDdCTJS5ZqRL3q72tdTEyDc121nTBB4KGkP3AOQ=; b=YLE4zm4n3YReU8oGi1kKCCVALQFPZJWrXs8XD+4SiiQOoj3BC53MJ16/t46gF3vSQ2kNYlG+wBD2MC0qvLTe6umMRjHpR9a3ZmjmNotaq1BI4UNTyrxJPsVNayTSED1owW/Hjg1BW4dc3Deq7mVQs4wCSFOvnQ+lF94KmkBzVC2ZrTxLShLKbaenLn/awHspveDvRByFnznXt7nfI35G+3mlHbd7mDoPYrG3oUX5dY+STWEK9pCKdINxZDYW1MlFUPbI2aVAZqH97Jq9C3+9PxcuoLtO/zPtWm17L4rZ3FsKeuCv5Hr1l1Zux1fh3zevom9FdXDRQynD5M93FpG1ew== Received: from FR3P281CA0016.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:1d::21) by AS8PR03MB7399.eurprd03.prod.outlook.com (2603:10a6:20b:2e2::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.27; Tue, 8 Aug 2023 22:53:41 +0000 Received: from VI1EUR05FT009.eop-eur05.prod.protection.outlook.com (2603:10a6:d10:1d:cafe::de) by FR3P281CA0016.outlook.office365.com (2603:10a6:d10:1d::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6678.17 via Frontend Transport; Tue, 8 Aug 2023 22:53:40 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 20.160.56.81) smtp.mailfrom=seco.com; dkim=pass (signature was verified) header.d=seco.com;dmarc=pass action=none header.from=seco.com; Received-SPF: Pass (protection.outlook.com: domain of seco.com designates 20.160.56.81 as permitted sender) receiver=protection.outlook.com; client-ip=20.160.56.81; helo=inpost-eu.tmcas.trendmicro.com; pr=C Received: from inpost-eu.tmcas.trendmicro.com (20.160.56.81) by VI1EUR05FT009.mail.protection.outlook.com (10.233.243.85) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6678.18 via Frontend Transport; Tue, 8 Aug 2023 22:53:40 +0000 Received: from outmta (unknown [192.168.82.132]) by inpost-eu.tmcas.trendmicro.com (Trend Micro CAS) with ESMTP id E46422008009E; Tue, 8 Aug 2023 22:53:39 +0000 (UTC) Received: from EUR04-VI1-obe.outbound.protection.outlook.com (unknown [104.47.14.59]) by repre.tmcas.trendmicro.com (Trend Micro CAS) with ESMTPS id 5BF5A2008006E; Tue, 8 Aug 2023 22:53:35 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KjnQ4Z6ULIb22Alb5UijvM/roL0zRGwfit+SDjFgOzQcJ7xqMVid2VSWn3cQPkcdqkfQ8u+7qpFin5iy7zVbpERE1ntutduxAP/TBuChVX+sANGw6Qxa6Rum27/H9X+KQ/b/y5gFvNGPi9HUaPNLdLlpWeza1WMXyX4NHIfkqUh4AqVQiT7Jrqo/Aw3LEz8foy7pVy4rKxfQa3nHWlg3KOXLCdQj4nJ7+TJ0mpE0JYA7ir5WdK6nvrhOLmkkEAMZkJR2ss4Clh2B4p/Gs9oXIwYOoSlYIMN3HJj73MOWbE011N0tD37wTTCDJuhX7YIsN6xmN8YQhxerIRkC+sGtqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=PYpeIDdCTJS5ZqRL3q72tdTEyDc121nTBB4KGkP3AOQ=; b=iy8oQJUwBI6S+ADoUpQKXUy+7AS2lB6Rru4DJoUj75qbfeTEqI4C6GEFn9qgBB7N7vM31xAi9PL1Y+ri2YiM+wrzMb2ixSUdxE9LS7zNvsGeD0xeVoj2rLqfpfzCksF7eBhLrY/Y9Ub/BuqXDmnAMt4LW5l/j9oWC/MlmWNDhX+Tv22XUMHF1FZJx/7rnkYejIEBqxiPZAPx99n7aj2pRMXA4efXn1Rh3iJ7zr67R0QJEpCV9mMuo8oEbGMJC5ZIEO52msYNozsjrg8J/WBTN/TlVO4F/xL5ZWyoasQs1bcitgYHu4t4odtC771GzFIjeEezVXqgj0sB3LKfumSE2Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=seco.com; dmarc=pass action=none header.from=seco.com; dkim=pass header.d=seco.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=seco.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=PYpeIDdCTJS5ZqRL3q72tdTEyDc121nTBB4KGkP3AOQ=; b=YLE4zm4n3YReU8oGi1kKCCVALQFPZJWrXs8XD+4SiiQOoj3BC53MJ16/t46gF3vSQ2kNYlG+wBD2MC0qvLTe6umMRjHpR9a3ZmjmNotaq1BI4UNTyrxJPsVNayTSED1owW/Hjg1BW4dc3Deq7mVQs4wCSFOvnQ+lF94KmkBzVC2ZrTxLShLKbaenLn/awHspveDvRByFnznXt7nfI35G+3mlHbd7mDoPYrG3oUX5dY+STWEK9pCKdINxZDYW1MlFUPbI2aVAZqH97Jq9C3+9PxcuoLtO/zPtWm17L4rZ3FsKeuCv5Hr1l1Zux1fh3zevom9FdXDRQynD5M93FpG1ew== Authentication-Results-Original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from DB9PR03MB8847.eurprd03.prod.outlook.com (2603:10a6:10:3dd::13) by PR3PR03MB6634.eurprd03.prod.outlook.com (2603:10a6:102:7d::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.27; Tue, 8 Aug 2023 22:53:33 +0000 Received: from DB9PR03MB8847.eurprd03.prod.outlook.com ([fe80::65d7:d7d8:711b:2514]) by DB9PR03MB8847.eurprd03.prod.outlook.com ([fe80::65d7:d7d8:711b:2514%5]) with mapi id 15.20.6652.025; Tue, 8 Aug 2023 22:53:33 +0000 From: Sean Anderson To: Tom Rini , u-boot@lists.denx.de Cc: Simon Glass , Heinrich Schuchardt , Sean Anderson Subject: [PATCH v2 1/4] common: Only mark malloc initialized after mem_malloc_init Date: Tue, 8 Aug 2023 18:53:17 -0400 Message-Id: <20230808225320.310926-2-sean.anderson@seco.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230808225320.310926-1-sean.anderson@seco.com> References: <20230808225320.310926-1-sean.anderson@seco.com> X-ClientProxiedBy: MN2PR05CA0036.namprd05.prod.outlook.com (2603:10b6:208:c0::49) To DB9PR03MB8847.eurprd03.prod.outlook.com (2603:10a6:10:3dd::13) MIME-Version: 1.0 X-MS-TrafficTypeDiagnostic: DB9PR03MB8847:EE_|PR3PR03MB6634:EE_|VI1EUR05FT009:EE_|AS8PR03MB7399:EE_ X-MS-Office365-Filtering-Correlation-Id: 112ea3e0-fcca-43c8-07ff-08db98624f26 X-TrendMicro-CAS-OUT-LOOP-IDENTIFIER: 656f966764b7fb185830381c646b41a1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: VUqZGpaAtIg1BEf8mcELnbdpR2+HDspE82kZU1Yw/9Upsb8AjGikN8lkk/5T5IFO7F61TpmEHuMF42ch9LWQNbDqPbpKXHeSxiyIe92ahuXtPSCRsPk7asO0csrBg2IMYdBVPzd6WSU3HXm2sKdEFiJU9B0WKTa4NqQyuZXm76orowMmc06sr7ALQiGsC54Vx6AbDRmVNU0ecB7dQMOtpSpQcDm+EbLdMNV1DRkeWQ3zq4T7VLIEILzwY8l7VP55rCyFGUWdL40ZgPrbyXi3XtkOnKXBMdmrAXUhoCbS+0pKX6jgpHWDVR05nV0jk3IPL5bwlO4oJoDn2PNL6AC64gM51NOnGBWuDo82R7BEqriy62wHWovrCQ9SS7Uq6P7cc/7x4Colm5eP+ByksVkkRr0fj2J/joOqH9wq5jKWazQNXVvVZ+N7vgx5KJKrZ/T6ba9k+XIirKVVbmmsSzSVPIKPT1p8hGL0gEjspEK+yNTWAVO6kqXdZnX0nsPR/5SbhCToLJvXMkfDK3bISW6/aDg6/VigtqJGXeUeY8dgFvSmXOsuq4Vm43PK1vnJ77cHWcggKpL2h74xDvPMUcLiwPAk3Xa0geVzXMOZX6ixYTyIlzDeG2q0zvieAH/kVpIo X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB9PR03MB8847.eurprd03.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(346002)(366004)(39850400004)(396003)(136003)(376002)(186006)(1800799006)(451199021)(2616005)(36756003)(1076003)(26005)(52116002)(6506007)(107886003)(6486002)(6512007)(6666004)(478600001)(38350700002)(38100700002)(54906003)(66476007)(66946007)(66556008)(4326008)(316002)(41300700001)(8936002)(5660300002)(44832011)(8676002)(2906002)(83380400001)(86362001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR3PR03MB6634 X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VI1EUR05FT009.eop-eur05.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 1c702c09-84ae-4504-ae7f-08db98624aed X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Fg/SmkkgRp4AmTyxiRPItlQFHxSxaWe6uIzqVnScU5gGynqo/1O4rurTJAUzyQ3+9XQuWvmZNI5lmAzg4YByQbiag2uAq31nN00vZchjhsbNbUyuRcj9a4KHFRXSvFS89sDZbJA0qThStzCymmBu0N+OGmSuFsueFzedvS0iVcm6bqeaU93ezVXRtr6RF982gGvxRxIBY88XMS/u18n39nw7br8sLMDh9RlS9w+yBNU898kOIcIe8/fYISbwmD0s0NFpjSl+Lx84hsVENT4gY297uoEDvUXAYh0/A8JLokqEhxj2ydgRINQn0lg08XkcXviDAfULnfkJq8ii8mXMp/Y9GyAVwTQbcFmQVpk/FDyHqIrgndgL+qkU4QY3LeMmeRxSTVrzByOU49xSZMMdX6oXFTTHQEcaVYt2uORwHRNyNrsIEgOpu9X0+wqRVX91HeEQhAU+Flv7dv+F4TWhx4YUGF/atDd10oNMyIIqR3LLOBrSu2tKy2Dl0DqX0+jcnfvWorMUyJvh1X3C+LGLqCby7PKMY81wblJL1IqjJDYJHYSBbYbUkfYQ1in8L2Xu1+YPqlREyMzJyIOovDh+RpxQFbvBgzDNMOartjx4lik7CIj9V4D787jgKkJBHti4kzHPKwwtm6L4udyQ3KyGiKVJs323bhsBQoK8YcmlIFZgG7cSoF0ZgK9Iaq3bIs+U2f6OCrdO46dY4LK1d0DVMzAAHXnZZPNszTryty+x6TfFQo+1kvepRewXpTq/MTdzlwKylXTAUr2C2/9TojxsWg== X-Forefront-Antispam-Report: CIP:20.160.56.81; CTRY:NL; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:inpost-eu.tmcas.trendmicro.com; PTR:inpost-eu.tmcas.trendmicro.com; CAT:NONE; SFS:(13230028)(376002)(136003)(396003)(346002)(39850400004)(82310400008)(1800799006)(451199021)(186006)(46966006)(40470700004)(36840700001)(86362001)(107886003)(44832011)(40480700001)(41300700001)(336012)(34070700002)(478600001)(8676002)(1076003)(6506007)(40460700003)(8936002)(26005)(6486002)(6666004)(2616005)(5660300002)(70586007)(47076005)(36756003)(83380400001)(2906002)(54906003)(36860700001)(316002)(356005)(7636003)(70206006)(7596003)(4326008)(82740400003)(6512007); DIR:OUT; SFP:1101; X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Aug 2023 22:53:40.4385 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 112ea3e0-fcca-43c8-07ff-08db98624f26 X-MS-Exchange-CrossTenant-Id: bebe97c3-6438-442e-ade3-ff17aa50e733 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=bebe97c3-6438-442e-ade3-ff17aa50e733; Ip=[20.160.56.81]; Helo=[inpost-eu.tmcas.trendmicro.com] X-MS-Exchange-CrossTenant-AuthSource: VI1EUR05FT009.eop-eur05.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR03MB7399 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 Instead of marking malloc as initialized as soon as relocation is done, defer it until after we call mem_malloc_init. This ensures that malloc initialization is done before we switch away from simple_malloc, and matches the SPL behavior. Fixes: c9356be3074 ("dm: Split the simple malloc() implementation into its own file") Signed-off-by: Sean Anderson Reviewed-by: Simon Glass --- Changes in v2: - New common/board_r.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/common/board_r.c b/common/board_r.c index d798c00a80a..58a5986aa54 100644 --- a/common/board_r.c +++ b/common/board_r.c @@ -98,7 +98,7 @@ static int initr_trace(void) static int initr_reloc(void) { /* tell others: relocation done */ - gd->flags |= GD_FLG_RELOC | GD_FLG_FULL_MALLOC_INIT; + gd->flags |= GD_FLG_RELOC; return 0; } @@ -210,6 +210,7 @@ static int initr_malloc(void) malloc_start = gd->relocaddr - TOTAL_MALLOC_LEN; mem_malloc_init((ulong)map_sysmem(malloc_start, TOTAL_MALLOC_LEN), TOTAL_MALLOC_LEN); + gd->flags |= GD_FLG_FULL_MALLOC_INIT; return 0; }