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 A9D07C61DA4 for ; Wed, 15 Feb 2023 02:35:25 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 22A00859AF; Wed, 15 Feb 2023 03:35: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=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="Ns0rOwQ4"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3AB58859CF; Wed, 15 Feb 2023 03:35:22 +0100 (CET) Received: from mail-qt1-x831.google.com (mail-qt1-x831.google.com [IPv6:2607:f8b0:4864:20::831]) (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 E032985923 for ; Wed, 15 Feb 2023 03:35:16 +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-qt1-x831.google.com with SMTP id h24so20566616qtr.0 for ; Tue, 14 Feb 2023 18:35:16 -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=WzPPlTZ1v4pL0IQNyXiX8bq668k9SsevgO2bzVaUJDw=; b=Ns0rOwQ40s0ShfMm4Bq23ni87lLKIe2grD1Qp5zfQPmDcDjvFqvg5U8alrKNf+1vsX RCIGoQXDycL6EVUCTQMF5MWTt1OrEfKA1Njdw+Xx3vZQwK7hV/my5X7nBHfrqyaJARM1 Wm2BpTcLdJxxq8HOf6nmaaJyJYtI9yZxECt+A= 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=WzPPlTZ1v4pL0IQNyXiX8bq668k9SsevgO2bzVaUJDw=; b=HykkgQAmsDSQ04ri2bB4yxxLkNSsfyZfpuBn41O9IR5e2oFl+6UEON+ZUVTulWL/Ir CpdUerVa6rafNGfzX5NNCO54Hs9P19gPExw3X8ap08wMfQ6rFp5f1DgGoqXo/ncE1G4a cSzvD6UxzBH186R88ZDmAlNjm7x+Dp6DyZkQwkbBhmnStHbNrbZ0aUMJ1oB2nPoRaRrn 4+ULDhiZu2miht0PCKz5fze2zz4+1DqQFXJHTKFXEWeyteYkwz7lVvswSROogdlG1o+e PO+BvrQF0cXb0m+ZA7t63kwm6KN50MD+uF8LqFaRASqR1DldzfqNcioPWJ6FyBQruAp5 BA9Q== X-Gm-Message-State: AO0yUKWHtYUdf8BF35ZYP5q403T3JspEF6982yXvI3HoXHAx2hEgjmFG 9E71Ya/138uqup4NFiSZg/g2tGoRMMl84X1BVyo= X-Google-Smtp-Source: AK7set+rtxqp/oaAJ4HtwKw61T1WNU3z9xgMvVxHj9VOab0RAGWgrhFvcEU+0vCIH/bhpIM1xgJPFg== X-Received: by 2002:ac8:7d88:0:b0:3b6:334b:2cbc with SMTP id c8-20020ac87d88000000b003b6334b2cbcmr816545qtd.65.1676428515414; Tue, 14 Feb 2023 18:35:15 -0800 (PST) Received: from bill-the-cat (2603-6081-7b00-6400-6a41-9f54-41e9-59eb.res6.spectrum.com. [2603:6081:7b00:6400:6a41:9f54:41e9:59eb]) by smtp.gmail.com with ESMTPSA id m16-20020ac866d0000000b003b9bf862c04sm12335224qtp.55.2023.02.14.18.35.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Feb 2023 18:35:14 -0800 (PST) Date: Tue, 14 Feb 2023 21:35:13 -0500 From: Tom Rini To: Simon Glass Cc: U-Boot Mailing List , Masahiro Yamada Subject: Re: [PATCH v3 61/95] kconfig: Support writing separate SPL files Message-ID: References: <20230212231638.1134219-1-sjg@chromium.org> <20230212231638.1134219-62-sjg@chromium.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="c25osblFs0uZeaZ9" 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 --c25osblFs0uZeaZ9 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Feb 14, 2023 at 03:42:53PM -0700, Simon Glass wrote: > Hi Tom, >=20 > On Tue, 14 Feb 2023 at 13:51, Tom Rini wrote: > > > > On Tue, Feb 14, 2023 at 12:59:34PM -0700, Simon Glass wrote: > > > Hi Tom, > > > > > > On Tue, 14 Feb 2023 at 10:38, Tom Rini wrote: > > > > > > > > On Tue, Feb 14, 2023 at 09:58:59AM -0700, Simon Glass wrote: > > > > > Hi Tom, > > > > > > > > > > On Tue, 14 Feb 2023 at 09:31, Tom Rini wrote: > > > > > > > > > > > > On Sun, Feb 12, 2023 at 04:16:04PM -0700, Simon Glass wrote: > > > > > > > > > > > > > At present kconfig writes out several files, including: > > > > > > > > > > > > > > auto.conf - CONFIG settings used by make > > > > > > > autoconf.h - header file used by C code > > > > > > > > > > > > > > This works well but is a bit ugly in places, for example requ= iring the use > > > > > > > of a SPL_TPL_ macro in Makefiles to distinguish between optio= ns intended > > > > > > > for SPL and U-Boot proper. > > > > > > > > > > > > > > Update the kconfig tool to also output separate files for eac= h phase: e.g. > > > > > > > auto_spl.conf and autoconf_spl.h > > > > > > > > > > > > > > These are similar to the existing files, but drop the SPL_ pr= efix so that > > > > > > > SPL_TPL_ is not needed. It also allows the CONFIG_IS_ENABLED(= ) macro to be > > > > > > > simplified, in a later patch, eventually replacing it with IS= _ENABLED(). > > > > > > > > > > > > > > When CONFIG_FOO is used within SPL, it means that FOO is enab= led in that > > > > > > > SPL phase. For example if CONFIG_SPL_FOO is enabled in the Kc= onfig, that > > > > > > > means that CONFIG_FOO will be enabled in the SPL phase. So th= e SPL builds > > > > > > > can just use CONFIG_FOO to check it. There is no need to use > > > > > > > CONFIG_SPL_FOO or CONFIG_IS_ENABLED() anymore. > > > > > > > > > > > > > > This of course means that if there is a need to access a PPL = symbol from > > > > > > > an SPL build, there is no way to do it. To copy with that, we= need a > > > > > > > CONFIG_PPL_FOO to be visibilty to all SPL builds. > > > > > > > > > > > > > > So this change also adds new PPL_ output for U-Boot proper (P= rimary > > > > > > > Program Loader). So every CONFIG_FOO that is enabled in PPL a= lso has a > > > > > > > CONFIG_PPL_FOO > > > > > > > > > > > > > > This allows SPL to access the TEXT_BASE for U-Boot proper, fo= r example, so > > > > > > > it knows where to load it. There are about 30 places where th= is is needed, > > > > > > > in addition to TEXT_BASE. The environment has the same proble= m, adding > > > > > > > another dozen or so caes in include/config_distro_bootcmd.h b= ut it has > > > > > > > been decided to ignore that for now. > > > > > > > > > > > > > > The feature is controlled by an environment variable, since i= t seems to be > > > > > > > bad form to add flags to the conf tool. > > > > > > > > > > > > > > Rebuild the autoconf files if the split config is not present= =2E This allows > > > > > > > building this commit as part of a chain, without generating b= uild errors. > > > > > > > > > > > > > > These changes may benefit from some reworking to send upstrea= m, e.g. to > > > > > > > use a struct for the 'arg' parameter. > > > > > > > > > > > > > > Signed-off-by: Simon Glass > > > > > > > > > > > > This patch, I think, is where my largest problem is. We go from= being > > > > > > able to say "if CONFIG_SPL_FOO is undefined, it is false" to "w= e must > > > > > > define CONFIG_SPL_FOO to false". There's around 150 cases of th= is, with > > > > > > the series. Why can we not extend the PPL logic (which I'm not = super > > > > > > happy with, but, I understand and I think an audit of everything > > > > > > not-TEXT_BASE should be fairly straight forward), to say that if > > > > > > CONFIG_FOO exists and CONFIG_SPL_FOO does not exist, say CONFIG= _SPL_FOO > > > > > > is now false. > > > > > > > > > > Well it is all about choices. > > > > > > > > > > We don't have to add a CONFIG_SPL_xxx to tell Kconfig that the PPL > > > > > symbol controls all phases. We can use the conf_nospl file instea= d. > > > > > But then the entire description is not in Kconfig. Of course, we = might > > > > > expect that some of those things in conf_nospl might end up needi= ng to > > > > > be controlled in SPL, so perhaps that file would shrink? Not sure > > > > > about that, though. > > > > > > > > > > It isn't just SPL , BTW. We might have any xPL symbol defined. > > > > > > > > > > I suppose you are thinking of something like: > > > > > > > > > > #define CONFIG_IS_ENABLED(x) IS_ENABLED(CONFIG_ ## xpl_prefix ##= x) || > > > > > ( IS_ENABLED(CONFIG_ ## x) && !IS_ENABLED(CONFIG_ SPL_ ## x) && > > > > > !IS_ENABLED(CONFIG_TPL_ ##x) ..) > > > > > > > > > > But how do we deal with Makefiles? We still end up with the SPL_T= PL_ stuff. > > > > > > > > I see it as a very useful feature that today if we don't set > > > > CONFIG_xPL_FOO, it evaluates to false, anywhere we need it to. In a= ll of > > > > the prep work for split config, I think we've seen one case where w= e got > > > > things wrong (in that it lead to failure). Split config build is do= ing a > > > > whole bunch of things to then remove this feature. And the series > > > > intentionally ignores the Makefile design issue / feature of wrappi= ng > > > > large chunks with a check for being/not-being in an xPL_BUILD phase. > > > > > > In another thread you suggested moving to separate defconfig files for > > > each phase (I think). Presumably that would operate the same way as > > > this series, in that you would not be able to handle the special case > > > you mention. So I see this series as the best of both worlds - a > > > unified Kconfig (and .config) but with separate auto.conf files for > > > each phase. Plus we can drop the SPL_TPL_ stuff. > > > > What I keep thinking of is that we would end up with separate configs. > > So while yes, we might need CONFIG_PPL_TEXT_BASE, we would not need > > CONFIG_SPL_DM_GPIO for example, because fooboard_spl_defconfig would set > > CONFIG_SPL=3Dy and CONFIG_DM_GPIO=3Dy. I don't know how workable this = ends > > up being as we have about 7k symbols for full U-Boot and about 450 for > > SPL. >=20 > I'm not sure it would be very nice. We end up having to edit three > files to change a board. It would be hard to compare them. We would > set an option in SPL that cannot be set because it is not actually > supported in SPL... I'm not sure how it would work out, exactly, no. But I think having a file for the boards SPL, and for its TPL, and for its VPL would make it easier to edit and maintain, not harder. A bigger problem is we have a ton of options that shouldn't ever really be asked of the user/developer, but instead, we do. Making it easier for the developer to say that for fooboard here are all of the frameworks you need (like ARCH_EARLY_INIT_R, sure you can say no, but then the platform won't work...) would be a bigger help. If you're only really prompted about 100 options, instead of 1000 options, it's a lot easier to work with. Especially when it's either "enable X or don't function". > > And I really don't see the problem with SPL_TPL_ stuff. >=20 > It is ugly! I think it's elegant, not ugly. I'm willing to change, but "it's ugly" isn't a good reason in and of itself. > > > We can add things to conf_nospl and then the behaviour is as you want > > > it, isn't it? > > > > I'd also rather not have a file that's going to get conflicted on, even > > if all of the comments started with "#" and so we could pass it through > > sort. But yes, that's better than adding unselectable options. >=20 > OK. I would hope that conflicts would be small as it is sorted. > Actually that is my mistake leaving out the # lines. Ooops. It probably won't be too bad in the end, but if it's avoidable, that's even better. > > > For the Makefile xPL ifdefs, is it essential to do anything there? We > > > could remove them, using the same techniques in this series. I would > > > quite like to, but we don't have to, if you like them. My reason for > > > wanting to remove them is that we end up refactoring things to enable > > > features in xPL, instead of just adding an xPL option. > > > > My point with the xPL ifdefs is that a number of config_nospl/def_bool n > > options could be resolved the same way. To me, the problem isn't that we > > have lines like: > > obj-$(CONFIG_$(SPL_TPL_)FOO +=3D foo.o > > as I've encouraged people to add them, in the case of the MULTIPLEXER > > case I'm pretty sure, rather than finding the existing block of: > > ifneq ($(CONFIG_SPL_BUILD)$(CONFIG_TPL_BUILD),y) > > ... > > endif > > for the cases where we need to have something not built in SPL/TPL. > > Removing those guards would lead to a big increase in config_nospl > > lines, I suspect. >=20 > Probably. If we didn't rely on CONFIG_CMD_USB and the like we could > use a wildcard and get rid of the CONFIG_CMD ones that way. But > really a Kconfig annotation would be better. We already get rid of the CMD ones that way, the issue is the environment, which I suggested you handle by generating it once for PPL and including for everyone verbatim. That will increase a few platforms a little, but I think is a reasonable trade-off. And if there's some case for needing a trivially tiny, or non-existent default environment really, that's another and different problem we can solve. But the environment and/or cmds are not the common use case of the CONFIG_xPL_BUILD checks in Makefiles. > If you are saying that we should have Makefiles without ifdefs, I > think I agree...or at least it is worth trying out. It means that we > don't have to trawl around to figure out why enabling X in SPL does > not in fact compile the code! Or how to ensure that X doesn't end up in xPL. Which is why I think having a load more obj-$(CONFIG_$(SPL_TPL_)FOO) +=3D bar.o (and the same for dirs) lines would make the Makefiles a lot more elegant, rather than ugly. I don't object to removing all of those SPL_TPL_ lines, but I object to removing the feature where when xPL_FOO is not a symbol it defaults to false. To repeat myself, why can't we know that if we have FOO, SPL_FOO but neither TPL_FOO nor VPL_FOO are valid symbols, go and generate auto.conf for each stage and have TPL_FOO=3Dfalse because we knew we had FOO and knew we did not have TPL_FOO already? > > > Finally, with the series I have, it is quite easy to add a new phase > > > if we want to. > > > > > > > > > > > > Yes, adding PPL moves a step forward and reduces the audit to only > > > > > uses of PPL, instead of the whole Kconfig. > > > > > > > > > > This series does get us closer to separate configs (it is really = easy > > > > > to see what is enabled in each build just by looking at the > > > > > auto_xpl.conf files) and I think those 150 exceptions are not a b= ig > > > > > price to pay. > > > > > > > > > > Ultimately I am coming to the view that we should extend the Kcon= fig > > > > > language to support multiple build phases, using a 'phase' proper= ty. > > > > > Zephyr is going to need it too, fairly soon[1]. > > > > > > > > > > Regards, > > > > > Simon > > > > > > > > > > [1] https://github.com/zephyrproject-rtos/zephyr/issues/54534 > > > > > > > > Yes, if the Kconfig language moves in a new direction, it would be = good > > > > to follow and use that. > > > > > > Well I am thinking of moving it there...but would need to start by > > > upstreaming the two patches in this series. > > > > Well, honestly, I suspect if you can work with upstreams on Kconfig the > > language supporting the concepts of phases, natively, my concerns will > > be addressed, one way or another. Because something like: > > config DM_GPIO > > bool "DM GPIO support" > > phases PPL SPL TPL > > > > config ODDBALL_THING > > # phases PPL is implied when it's only valid there > > bool "Do this one weird trick in PPL" > > > > Means that we can yes/no options like DM_GPIO for each phase, and get > > xPL_ODDBALL_THING=3Dn for free is much cleaner. >=20 > Yes...that is what I'd like to see. The only complication is that > sometimes you want SPL_DM_GPIO to default y if DM_GPIO, iwc you may > want to spell out the options separately anyway? There would need to be some logic around defining phases, and then how to present for each phase, each relevant option. It wouldn't be yes/no to "DM_GPIO" and then all phases are set the same, but it would be that's how you describe an option. --=20 Tom --c25osblFs0uZeaZ9 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQGzBAABCgAdFiEEGjx/cOCPqxcHgJu/FHw5/5Y0tywFAmPsRN0ACgkQFHw5/5Y0 tywJzwv+OS0EuX0usk5c74iyLdovd29DalqVXS9vNpqqu0gahDaarPf9EZAAz9J2 eAZz9Wrfo+XwvJXAkaHF3U/uR3gxr44xfS1BWX0XYcOua0pbc6GF3RFL4qf1T1CX vtVYV+HmCQ0zU5b7xtWBIbBCY3eswaNnF2W/IkMr6YIss8t2/VezMIzsszz6Xmio 9RlnxldVZzjvqboScqzJX3fBFbLZnWtc0djEfkP9rXNFRGCakVHpx4rHegNmnJvv 1LoU7uI3p87n9RClIA3WyPOGTbHEyMmW6tvQYFxNjEbpQQKHSSiJf/1hDERK5jbH lgV/xcTyix+xu4Hv0McR1Yzn1C+YioRp4UUMn23H9SQdKw2eWk/oejwDEcD6jgQ5 KzSMkSznPOLoVL+UM3t248NPE4NSbJhFhkW3aqFEj62rhM/uvI5htJi6OqfWRr/K s/CCROVb/pwYtXxNdjFOxxFYMYt6vPDfTcCp+iGbKMVzTDW/Znv+ETjhNFbOk0UL bAiVRo3d =CXzj -----END PGP SIGNATURE----- --c25osblFs0uZeaZ9--