Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 71BE2C433FE for ; Wed, 30 Nov 2022 14:49:31 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 2FB1A84E00; Wed, 30 Nov 2022 15:49:29 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=konsulko.com header.i=@konsulko.com header.b="VHweUf3+"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 70D36851CB; Wed, 30 Nov 2022 15:49:27 +0100 (CET) Received: from mail-ej1-x62c.google.com (mail-ej1-x62c.google.com [IPv6:2a00:1450:4864:20::62c]) (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 471A684E00 for ; Wed, 30 Nov 2022 15:49:23 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=trini@konsulko.com Received: by mail-ej1-x62c.google.com with SMTP id ml11so17011269ejb.6 for ; Wed, 30 Nov 2022 06:49:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=konsulko.com; s=google; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=8gmy1OcSowCFfrjKJLm+54zdGrfYC8qytUuxwUoPAc0=; b=VHweUf3+SPsE+831AdNISb8ho8VsHN1mmM+K54xniPCIKXi5qqLTVXudjAAINJDhCO yq8F+1fFa/SjOB8xydHvyHi1LFXf9D7FsVY3ynOdWEjMxuBlwtaCVYlPdrm0s54ZYib+ 3+HnAvZfWjlQUMl1CcjTrNCz5VAzPHOVS5l6s= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=8gmy1OcSowCFfrjKJLm+54zdGrfYC8qytUuxwUoPAc0=; b=sULyzboXZgGiHpdAIeHJ30iFIutm92Z4VDTTOsqEb01XAEohJPdakf4iHeQXxBQ7Kz ielzkGSqVtvZ8/fj1jm68lEhQtm0oMRjZV2Bln7cjZtzJoUOLL/K+6cD8736hIso5t1d BIkw4h+EbcwsnC6a9hfqBnv+yTFBWVpw9ygYv5FT+v6rgLft0z2ksB+0iqQYVhOXOjo+ REway8itwFgqSoc8v7oBUZsku2AohLGVqsNxTfZ74V/sH57HgXm2vsDqw5AVR36oXe1j QgyNjMC28CNY04sJr7uuA0kp5j0llllrSyqzjywDEQnx6iP0/YzdVNJLo0DgXM/4WQok MqrA== X-Gm-Message-State: ANoB5pkQUOUfpIqSqendoHUzMFDg1SQkRbd7A6tnQOx8M8Crs30ABRD+ 0IPPXW3OCB4CVFF5sgNYKmk5+Q== X-Google-Smtp-Source: AA0mqf4LMbAqfiGO7oNKZgm86c6We5d19A6/BF40pi/jp44+LqWUHe93R7VvH8/lzNzRYycNB+wGLg== X-Received: by 2002:a17:906:89a0:b0:7bf:ca7b:49de with SMTP id gg32-20020a17090689a000b007bfca7b49demr13495028ejc.296.1669819762815; Wed, 30 Nov 2022 06:49:22 -0800 (PST) Received: from bill-the-cat (2603-6081-7b00-6400-3ce7-df4b-a3b5-c900.res6.spectrum.com. [2603:6081:7b00:6400:3ce7:df4b:a3b5:c900]) by smtp.gmail.com with ESMTPSA id e15-20020a170906c00f00b0078c213ad441sm733369ejz.101.2022.11.30.06.49.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Nov 2022 06:49:22 -0800 (PST) Date: Wed, 30 Nov 2022 09:49:18 -0500 From: Tom Rini To: Marek Vasut Cc: u-boot@lists.denx.de, Fabio Estevam , Kirill Kapranov , Peng Fan , Peter Robinson , Simon Glass , Stefano Babic , Uri Mashiach , Valentin Raevsky , Ying-Chun Liu Subject: Re: [PATCH] board_init: Convert CONFIG_MALLOC_F_ADDR to Kconfig Message-ID: <20221130144918.GZ3787616@bill-the-cat> References: <20220709010804.141636-1-marex@denx.de> <20220901211833.GA3400311@bill-the-cat> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="rVDsP1EMu6KJGDpG" Content-Disposition: inline In-Reply-To: X-Clacks-Overhead: GNU Terry Pratchett 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.6 at phobos.denx.de X-Virus-Status: Clean --rVDsP1EMu6KJGDpG Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Nov 13, 2022 at 08:39:36PM +0100, Marek Vasut wrote: > On 9/1/22 23:18, Tom Rini wrote: > > On Sat, Jul 09, 2022 at 03:08:04AM +0200, Marek Vasut wrote: > >=20 > > > Convert CONFIG_MALLOC_F_ADDR to Kconfig. > > >=20 > > > The CL IoT gate board used MALLOC_F_ADDR 0x912000 on i.MX8M Mini unli= ke > > > all the other platforms which use 0x930000 . This has been aligned wi= th > > > the other i.MX8M Mini platforms. > > >=20 > > > Signed-off-by: Marek Vasut > > [snip] > > > diff --git a/common/init/board_init.c b/common/init/board_init.c > > > index 6a550261778..35506f2ed35 100644 > > > --- a/common/init/board_init.c > > > +++ b/common/init/board_init.c > > > @@ -78,10 +78,8 @@ __weak void board_init_f_init_stack_protection(voi= d) > > > ulong board_init_f_alloc_reserve(ulong top) > > > { > > > /* Reserve early malloc arena */ > > > -#ifndef CONFIG_MALLOC_F_ADDR > > > -#if CONFIG_VAL(SYS_MALLOC_F_LEN) > > > +#if CONFIG_VAL(MALLOC_F_ADDR) && CONFIG_VAL(SYS_MALLOC_F_LEN) > > > top -=3D CONFIG_VAL(SYS_MALLOC_F_LEN); > > > -#endif > > > #endif > > > /* LAST : reserve GD (rounded up to a multiple of 16 bytes) */ > > > top =3D rounddown(top-sizeof(struct global_data), 16); > >=20 > > This isn't equivalent. It was "if we don't have MALLOC_F_ADDR but do > > have SYS_MALLOC_F_LEN ..." and now is "if we have MALLOC_F_ADDR and > > SYS_MALLOC_F_LEN ...". >=20 > But this is not correct. It was >=20 > if > CONFIG_MALLOC_F_ADDR is not declared > and > CONFIG_{SPL,TPL,...}SYS_MALLOC_F_LEN is non-zero >=20 > With the switch to Kconfig, the MALLOC_F_ADDR is always declared, except = for > the cases where it was not declared before, it is set to 0. So the change > to: >=20 > if > CONFIG_{SPL,TPL,...}MALLOC_F_ADDR is non-zero > and > CONFIG_{SPL,TPL,...}SYS_MALLOC_F_LEN is non-zero >=20 > seems equivalent to me, except of course for the handling of SPL/TPL part, > which is done in the Kconfig This is an annoying symbol to convert. With the exception of sandbox and kontron_sl28 (which I believe to be in error, no other imx boards do this, and it is an anti-pattern to set this symbol the way it's been set), this is only defined when CONFIG_SPL_BUILD is true. So we need to rename it to CONFIG_SPL_MALLOC_F_ADDR and then use it. And then yes, we need to switch to testing with CONFIG_VAL() and it being non-zero. I know I didn't take your original patch, and dug in more here because some platforms had binary size change here. --=20 Tom --rVDsP1EMu6KJGDpG Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQGzBAABCgAdFiEEGjx/cOCPqxcHgJu/FHw5/5Y0tywFAmOHbW0ACgkQFHw5/5Y0 tyzUvwv/VW4kZOx9G8t0+hR2YQUi7G9Wc2VgFrd5H3mv4b24O4PtQOF+NT0MtBPS RkkC7IcjpNDejLU8tW8LgWd67CXve815b0Qbf0jmibUHU1JYkRr7mp0RcOfFNzt9 8M5zLZS7Gcrj3DJA3R/bUdIJXAUv1+TteMSQqKSDyXj95laio152ZZ6/r2lfoElp bKvAkMDLa4kJ6Ei/dIwEphpad4ErENZHpureWQZmYRlzD6Mnt81P+jDrjRQYHAeZ SVPDnWKzYs4OObXlauVzwx+FaW5Ztmeuo2ajEdsLjNUb7Eo2abuNa/f3u7go+QKw nR8oHGJcrnk6XFO5TgulAK5LuRbLFM2DNHDuV4sHbj/jpNeE/2HruOh1ULoRmsFU DZmWtxu82jZXSkwR03bDpGu7BUK3UEWNCXxbMLvM54sMNcr8SpK1k0BR/zg3xrnF yPJAo7XApqSCeYvQNwhDfLHcroFJdPZ5Agoac5sqXV1CNB5TPFz6htqJ1tWhxIPc fJAQP7pQ =OnnB -----END PGP SIGNATURE----- --rVDsP1EMu6KJGDpG--