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 F13D5C61DA4 for ; Tue, 14 Feb 2023 20:51:44 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id E5A8D85960; Tue, 14 Feb 2023 21:51:39 +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="cOIpWU5n"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 045CE85960; Tue, 14 Feb 2023 21:51:38 +0100 (CET) Received: from mail-qv1-xf34.google.com (mail-qv1-xf34.google.com [IPv6:2607:f8b0:4864:20::f34]) (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 840978594C for ; Tue, 14 Feb 2023 21:51:31 +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-qv1-xf34.google.com with SMTP id di14so7177352qvb.12 for ; Tue, 14 Feb 2023 12:51:31 -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=HrCDJv1abHFMvQfKDWrYegn5R4sITEIdIfUfhxRUX+8=; b=cOIpWU5nnYaF2k9ZKkHzU3jn/5rLqvDeuzVHhfiBfCRWxvuc6GFUgURy6uXv68sZ0H 720QR3x48WT2lBByCD57DylsqsgXhKFiHqEbXrFzBDMreGH7T9u8WAhaEVD+4K+x4FFr pngefWrfpbFihMAeYumpUWfL7+8EB0HXoxEOM= 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=HrCDJv1abHFMvQfKDWrYegn5R4sITEIdIfUfhxRUX+8=; b=v5omS8K/z4oGYgZy5D9/cRJNbjkzdkmc2yteHYo0w6y8jyOUt5P1LVgaCptOB5gsK5 qzm3lvMknCN/qjovvFtZONSmZQ7hyz0tizHVqFcYJgKaU95yyBpXoKym41NX8ek2JhXr vYIlCEyLTtv/L7RCoHE563mwpUJkLlTSbEqFvzHVDyYsCZ3w+QIaBhvflnauR28zCkuI LRv6Jl4ytKYonzlM0IQPxhc8V1jSQDzt29INgkHUfTVV5+rvtNHOrAi8YvdJZO2CBRpj DUbxkMUkiwLhcC2AIEedeJxaqDuWeHAmNHdLqTAONQ61sJ0UgDLjG9HQJMhwDJ2PsyDV Mvaw== X-Gm-Message-State: AO0yUKV9+ZupECYovxBnA+eviZPBEVN5Rg19VTjCBNIGXW4hlI6Set6B 1rIkzipJapDowumghqa1hhb0bg== X-Google-Smtp-Source: AK7set+nH/JjdCANalE8k8ZL8heiqwBH+b7utXIzD2DA4CvZzBqCZUk1fxAQF7N+zOkx9qEpR3mRvA== X-Received: by 2002:ad4:5bca:0:b0:537:ab77:fbd3 with SMTP id t10-20020ad45bca000000b00537ab77fbd3mr6375244qvt.1.1676407890062; Tue, 14 Feb 2023 12:51:30 -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 t73-20020a37464c000000b007186c9e167esm12466954qka.52.2023.02.14.12.51.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Feb 2023 12:51:29 -0800 (PST) Date: Tue, 14 Feb 2023 15:51:27 -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="L91s+HSLxFkLTdH0" 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 --L91s+HSLxFkLTdH0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Feb 14, 2023 at 12:59:34PM -0700, Simon Glass wrote: > Hi Tom, >=20 > 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 requirin= g the use > > > > > of a SPL_TPL_ macro in Makefiles to distinguish between options i= ntended > > > > > for SPL and U-Boot proper. > > > > > > > > > > Update the kconfig tool to also output separate files for each ph= ase: e.g. > > > > > auto_spl.conf and autoconf_spl.h > > > > > > > > > > These are similar to the existing files, but drop the SPL_ prefix= so that > > > > > SPL_TPL_ is not needed. It also allows the CONFIG_IS_ENABLED() ma= cro to be > > > > > simplified, in a later patch, eventually replacing it with IS_ENA= BLED(). > > > > > > > > > > When CONFIG_FOO is used within SPL, it means that FOO is enabled = in that > > > > > SPL phase. For example if CONFIG_SPL_FOO is enabled in the Kconfi= g, that > > > > > means that CONFIG_FOO will be enabled in the SPL phase. So the SP= L 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 symb= ol from > > > > > an SPL build, there is no way to do it. To copy with that, we nee= d a > > > > > CONFIG_PPL_FOO to be visibilty to all SPL builds. > > > > > > > > > > So this change also adds new PPL_ output for U-Boot proper (Prima= ry > > > > > Program Loader). So every CONFIG_FOO that is enabled in PPL also = has a > > > > > CONFIG_PPL_FOO > > > > > > > > > > This allows SPL to access the TEXT_BASE for U-Boot proper, for ex= ample, so > > > > > it knows where to load it. There are about 30 places where this i= s needed, > > > > > in addition to TEXT_BASE. The environment has the same problem, a= dding > > > > > another dozen or so caes in include/config_distro_bootcmd.h but i= t has > > > > > been decided to ignore that for now. > > > > > > > > > > The feature is controlled by an environment variable, since it se= ems to be > > > > > bad form to add flags to the conf tool. > > > > > > > > > > Rebuild the autoconf files if the split config is not present. Th= is allows > > > > > building this commit as part of a chain, without generating build= errors. > > > > > > > > > > These changes may benefit from some reworking to send upstream, e= =2Eg. 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 bei= ng > > > > able to say "if CONFIG_SPL_FOO is undefined, it is false" to "we mu= st > > > > define CONFIG_SPL_FOO to false". There's around 150 cases of this, = 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 instead. > > > 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 needing 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_TPL_ = 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 all of > > the prep work for split config, I think we've seen one case where we got > > things wrong (in that it lead to failure). Split config build is doing a > > whole bunch of things to then remove this feature. And the series > > intentionally ignores the Makefile design issue / feature of wrapping > > large chunks with a check for being/not-being in an xPL_BUILD phase. >=20 > 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. And I really don't see the problem with SPL_TPL_ stuff. > 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. > 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) =2E.. 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. > Finally, with the series I have, it is quite easy to add a new phase > if we want to. >=20 > > > > > 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 big > > > price to pay. > > > > > > Ultimately I am coming to the view that we should extend the Kconfig > > > language to support multiple build phases, using a 'phase' property. > > > 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. >=20 > 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 Tom --L91s+HSLxFkLTdH0 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQGzBAABCgAdFiEEGjx/cOCPqxcHgJu/FHw5/5Y0tywFAmPr9EYACgkQFHw5/5Y0 tyzGCwwAqMOaEzBTuC2SDwvSP7WEMOkc/VkIjDLJmvWWyzNFBiLfeJVXtT8KN8G5 tzTRo68VDnJ6uEEJnMHP91gHHFrNFqzJZQ6enwug7bsifyX9Ep0dqZNWPoAEj0W6 6XiqBi28L8J9vWj34TDO+xj3wSTyvR0cYfaEL9Syo5xFHEtz2FHHc1UqdMBJ/06p tReK0IEU9NnWIRemojjMwvFnu+piIjtRMZ+MNVb2Ro8zJeAHFYaO6FkZxKCN7HM5 T/Arkz10+YzujNzNtWxLsU6n490wdU1Bci5FRvwb/js1fvyWfbKoccCTe7heAhY3 8l48Pi/cqef/avamAM9/AsYIV+CqYabo9pGglrvWi9Uy06V08KJdRP72wWovop+l BwQ4jLGkrasrIbbnJSwKuSnEDktQoZhTK684L2N+2UiGuF/ABgDnNpiwO166YdsW ZnovjuttdO69njlBPx9JCYbmo/c4925Udmb14ckBCP5r5wXqn93gcTHkLKkQivmU ghAiQxS/ =BbsV -----END PGP SIGNATURE----- --L91s+HSLxFkLTdH0--