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 31746C04A68 for ; Thu, 28 Jul 2022 17:53:44 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id AD33083FA6; Thu, 28 Jul 2022 19:53:42 +0200 (CEST) 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="FUdqdJqj"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id C22ED83FC2; Thu, 28 Jul 2022 19:53:41 +0200 (CEST) Received: from mail-qk1-x734.google.com (mail-qk1-x734.google.com [IPv6:2607:f8b0:4864:20::734]) (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 CB4A483F2D for ; Thu, 28 Jul 2022 19:53:38 +0200 (CEST) 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-qk1-x734.google.com with SMTP id f14so2021353qkm.0 for ; Thu, 28 Jul 2022 10:53:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=konsulko.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=FjMRLa5XnFyLg2MQGdcOxCAHZP9Z7L6qnnVffl4jIw0=; b=FUdqdJqjbAe+b93DxVx/yTujEviW58A6foswMvVt1Gni95PAv3Jxy2cmbzcWoyvRef 8GjoeF2zkAlBqS3DNp30MetQ3JsxbnpvjFdOJ2gmok3xIdQF7h5OY+GD60rogScL5v0j TN/9QLe9vQwlT7RaAgf55gR0m/0twTUCn+/1U= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=FjMRLa5XnFyLg2MQGdcOxCAHZP9Z7L6qnnVffl4jIw0=; b=tV23jCHy9nwmOPftSca9mbcBZtkB9OS2huYhxzetAoShhTmwAqB3SUJ/fhINiOrjGO /zqtDIvKkmp3dL8CPxqKfY4nCBJFSCf6Z2TuevePmxzU3njbT3uUcZ+VNg/OQaa1/kAX waHs0+6SY7WdL1PmEH7Lx3w/+G97lauBBLBhyozVJJwLHhdv/Co4bshO8q4ykv8qkN0h CqrYGfG9L8Ef/3CAyMnMLyIBu50PBF8e+F9W3cBUnq23vtr+5XVUC1yY6UrrQp0c55pH 9GMNctqksWwQxN7MDWWENdfSYBgJHuKaSlpT263V7d0k6hKKre4LCAZdHqh3qEx3/DPi 0P0Q== X-Gm-Message-State: AJIora+bFp9t8VzT8JzTEJvxG/Rb5TMecbfUOgP7ljZk3u3CNbPLGr0k GsDn4L5ImQhhD5kezNTd/OBQzg== X-Google-Smtp-Source: AGRyM1sS4/jxK/IM1cwtunDqIg+/gL+TyEXjaT87+rhgQC5S2a/Vgzd9lqvQBvpJq0BMthanCAs92g== X-Received: by 2002:a05:620a:370d:b0:6b5:e3f0:8d with SMTP id de13-20020a05620a370d00b006b5e3f0008dmr20835643qkb.549.1659030817524; Thu, 28 Jul 2022 10:53:37 -0700 (PDT) Received: from bill-the-cat (cpe-65-184-195-139.ec.res.rr.com. [65.184.195.139]) by smtp.gmail.com with ESMTPSA id gd19-20020a05622a5c1300b0031bf484079esm797044qtb.18.2022.07.28.10.53.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Jul 2022 10:53:36 -0700 (PDT) Date: Thu, 28 Jul 2022 13:53:34 -0400 From: Tom Rini To: Heinrich Schuchardt Cc: u-boot@lists.denx.de, Pali =?iso-8859-1?Q?Roh=E1r?= , Simon Glass Subject: Re: [RFCv1] doc: develop: Describe using CONFIG vs CFG for values Message-ID: <20220728175334.GJ1146598@bill-the-cat> References: <20220728132046.2000282-1-trini@konsulko.com> <00BE3DF9-516C-4C4B-AF55-5F55FD551F53@gmx.de> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="QC2NjA+p4nW/ZUa9" Content-Disposition: inline In-Reply-To: <00BE3DF9-516C-4C4B-AF55-5F55FD551F53@gmx.de> 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 --QC2NjA+p4nW/ZUa9 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Jul 28, 2022 at 06:44:56PM +0200, Heinrich Schuchardt wrote: >=20 >=20 > Am 28. Juli 2022 15:20:46 MESZ schrieb Tom Rini : > >Document how and when to use CONFIG or CFG namespace for options. There > >are times where Kconfig is not a great fit for our needs, so we want to > >use the CFG namespace instead. > > > >Signed-off-by: Tom Rini > >--- > >RFCv1: > >- This is essentially my idea on how to better handle the problem of > > CONFIG values that just don't fit in Kconfig because it makes much > > more sense to define them statically for a given SoC or calculate them > > from other values, and so on. One example here would be to revert > > c7fad78ec0ee ("Convert CONFIG_SYS_BR0_PRELIM et al to Kconfig") and > > re-name these to CFG_SYS_.. instead. Another big example here would be > > a global search-and-replace of 's/CONFIG_HPS_/CFG_HPS_/g' as that's > > all tool-generated. Not all CONFIG_SYS_ options would get this as > > boolean choices are well handled in Kconfig, and that may not be clear > > enough in what I wrote here? > >--- > > doc/develop/build_configuration.rst | 36 +++++++++++++++++++++++++++++ > > doc/develop/index.rst | 1 + > > 2 files changed, 37 insertions(+) > > create mode 100644 doc/develop/build_configuration.rst > > > >diff --git a/doc/develop/build_configuration.rst b/doc/develop/build_con= figuration.rst > >new file mode 100644 > >index 000000000000..541ce528b36a > >--- /dev/null > >+++ b/doc/develop/build_configuration.rst > >@@ -0,0 +1,36 @@ > >+.. SPDX-License-Identifier: GPL-2.0+ > >+ > >+Using CONFIG or CFG to configure the build > >+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > >+ > >+There are two namespaces used to control the build-time configuration of > >+U-Boot, ``CONFIG`` and ``CFG``. These are used when it is either not po= ssible > >+or not practical to make a run-time determination about some functional= ity of > >+the hardware or a required software feature or similar. Each of these h= as their > >+own places where they are better suited than the other for use. > >+ > >+The first of these, ``CONFIG``` is managed in the `Kconfig language > >+`_= that is > >+most commonly associated with the Linux kernel and the Kconfig files fo= und > >+throughout our sources. Adding options to this namespace is the preferr= ed way of > >+exposing new configuration options as there are a number of ways for bo= th users > >+and system integrators to manage and change these options. Some common = examples > >+here are to enable a specific command within U-Boot or even a whole sub= system > >+such as NAND flash or network connectivity. > >+ > >+The second of these, ``CFG`` is implemented directly as C preprocessor = values or > >+macros, depending on what they are in turn describing. The nature of U-= Boot > >+means that while we have some functionality that is very reasonable to = expose to > >+the end user to enable or disable we have other places where we need to= describe > >+things such as register locations or values, memory map ranges and so o= n. When > >+practical, we should be getting these values from the :doc:`device tree > >+`. However, there are cases where this is either not > >+practical due to when we need the information and may not have a device= tree yet > >+or due to legacy reasons code has not been rewritten. As this informati= on tends > >+to be specific to a given SoC (or family of SoCs) or if board specific = something > >+that is mandated by the physical design rather than truly user configur= able, it > >+is acceptable to ``#define`` these values in the ``CFG`` namespace. It = is > >+strongly encouraged to place these in the architecture header files, if= they are > >+generic to a given SoC, or under the board directory if board specific.= Placing > >+them under the board.h file in the *include/configs/* directory should = be seen > >+as a last resort. >=20 > I would prefer to have numbered list of priorities: >=20 > Get property > 1) by runtime probing if the U-Boot binary supports multiple boards > 2) from Kconfig CONFIG value > 3) from DT at runtime > 4) from SoC specific CFG constant value > 5) from board specific CFG constant value >=20 > I am not sure about the sequence of 2 and 3. We don't want to replace def= config by DT. But we wouldn't want register addresses in Kconfig either. So= this needs mire elaboration. I've rewritten things a bit so far to try and be clearer on CONFIG vs CFG. Maybe I should rename it to system_configuration.rst and try and talk more about when to get something at run-time? --=20 Tom --QC2NjA+p4nW/ZUa9 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQGzBAABCgAdFiEEGjx/cOCPqxcHgJu/FHw5/5Y0tywFAmLizRsACgkQFHw5/5Y0 tyzaSAv9HqCFUqzJvDC8kaAi6YBHtQa5+vVPf1he1ntgVzIAjmNAf5WkilH3D1bL PioolOSXteYT5bk+FZQBYMBIpA9gFyj4w/0a/awR5ixTz0nSuSb/7fMxCKoVguH0 tNhNxbCscEeYtXzanTWSK5QNbwYVU045iBNHQREV62waAwsCjL0TAKx5iVcLOnPZ mqUP4kHinyR+qdelYvS2xjI6lmhVjn68Ws5PEVHrurgXIEYb+A2DfXEB/nc7ixjU beODA2yK2sRqe4OifvqfdIAMTxg+Vj1qaQQsmBb/4w8BTA21YxxUqSsE5dh6heZo QH3rtQXuZcAHTwx/jMpNEUc0TpRc+wUPUBq03BIAY/vkd82iSHM8eTZCf0FNQaAP fPUxGB0WL+NhTDUTPGp8qusvVRiTvB0I8vsxac5/DcPWhsrOWvlc+JLTKyM75wEO IgvDOxKByqXEVck9pYp3vz/sH0261N2G6BtdjDtkcBUdRnowHvCN2Wb/uubtIGsh TgaOJpxL =oaHt -----END PGP SIGNATURE----- --QC2NjA+p4nW/ZUa9--