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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EBAD4C433EF for ; Tue, 26 Oct 2021 11:45:01 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 4519960C4B for ; Tue, 26 Oct 2021 11:45:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 4519960C4B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5ECAD834CD; Tue, 26 Oct 2021 13:44:35 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org 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=linaro.org header.i=@linaro.org header.b="rW8zL7CD"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 2CAA1833E4; Tue, 26 Oct 2021 08:46:49 +0200 (CEST) Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) (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 7265F83582 for ; Tue, 26 Oct 2021 08:46:44 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=ilias.apalodimas@linaro.org Received: by mail-wr1-x433.google.com with SMTP id m22so13888986wrb.0 for ; Mon, 25 Oct 2021 23:46:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=Poslm+34Ol95G4stfL+AJ6S4vZNykhe0GtfjT8H9mAs=; b=rW8zL7CDLWMiFlFRgbroZeo7VabIbBBgy8WkS0fqvkIG5CMrBmz7sFtLtiSPJ9cMZ2 50pfySqn5xx0WC58q8S1wZAEzg7addSztNTjOvHvL2PfGO6CHUjpLMtIZG9inowoIm0v jT6cykttX0qTvNL4ED41h0MQyNV1TWtnXLWa2CuNt5enlL9hJmQ3V7fMcPI/TQn1HwIr Sl8dyF3diO+EuN4y+nTh/SUeIC9RwI6uudMT2cmy+bE9GjYFHkYY0GxjOwgu6vT/yhs4 ZsK0tIp1VvgZC4sx5P6KzPkD58jqYhiavYKARF5wvSu/kx6Am9wjsGy4BgDKTQt1obiD g44g== 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=Poslm+34Ol95G4stfL+AJ6S4vZNykhe0GtfjT8H9mAs=; b=6Y4S4ex94L/PhrM+We+87Akhr8CSe3i9MKPgCfPtr3kpp/b/nczmE7+e6uZiKFHexb jU8a4FqWinqaeqjZkjAUy2bNmhiySs9YozjSgh42mGhYYLiHRxpHdrovxGw3KXinsLKm IOR7BWVrJHAiA7x5dGgSh5hy7dqMS2SQtRNpurpLy0DvLylZCAzbfIOkwjeikZxwznfS N1gH0AweccXVYsMMdyo8Zf/sa10D85os/D24mAdlifXmgslALajzsCal38hVUUj1JZCe 31up/nWuw8kdET6jxO3/EGCfn7pnQqchjuXFETyahCPFXav8maCghongxWjQpRmPr4y0 ygNw== X-Gm-Message-State: AOAM53386378ogZWt9JwJG0YnFYu3dPw73wgdnS6So+zWRmZK85mQTQf rIf43YDK7nvGDn+r4BK2Vwmbdg== X-Google-Smtp-Source: ABdhPJyhtHM37oF4TsJWAkdy6As3OpUcL5BKjEuXNHD0r31dHEaPIjwi/4Ff12vkV50Sy7RiBssXRQ== X-Received: by 2002:a5d:508b:: with SMTP id a11mr18303808wrt.420.1635230803689; Mon, 25 Oct 2021 23:46:43 -0700 (PDT) Received: from apalos.home (ppp-94-66-220-13.home.otenet.gr. [94.66.220.13]) by smtp.gmail.com with ESMTPSA id c15sm17946305wrs.19.2021.10.25.23.46.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Oct 2021 23:46:43 -0700 (PDT) Date: Tue, 26 Oct 2021 09:46:38 +0300 From: Ilias Apalodimas To: Simon Glass Cc: Tom Rini , =?iso-8859-1?Q?Fran=E7ois?= Ozog , Aaron Williams , Albert Aribaud , Alexander Graf , Anastasiia Lukianenko , Andre Przywara , Ashok Reddy Soma , Atish Patra , Bin Meng , Bin Meng , Christian Hewitt , David Abdurachmanov , Dimitri John Ledkov , Fabio Estevam , Green Wan , Heiko Schocher , Heinrich Schuchardt , Heinrich Schuchardt , Jagan Teki , Jerry Van Baren , Kever Yang , Leo , Linus Walleij , Liviu Dudau , Marek =?iso-8859-1?Q?Beh=FAn?= , Matthias Brugger , Michal Simek , Michal Simek , Neil Armstrong , Niel Fourie , Oleksandr Andrushchenko , Padmarao Begari , Pali =?iso-8859-1?Q?Roh=E1r?= , Peter Robinson , Priyanka Jain , Rainer Boschung , Ramon Fried , Rick Chen , Sean Anderson , Sinan Akman , Stefan Roese , Stephen Warren , Stephen Warren , T Karthik Reddy , Tero Kristo , Thomas Fitzsimmons , Tianrui Wei , Tim Harvey , Tuomas Tynkkynen , U-Boot Mailing List , Valentin Longchamp , Vladimir Oltean , Wolfgang Denk , Zong Li , "qemu-devel@nongnu.org Developers" Subject: Re: [PATCH 00/16] fdt: Make OF_BOARD a boolean option Message-ID: References: <20211013010120.96851-1-sjg@chromium.org> <20211013013450.GJ7964@bill-the-cat> <20211014145626.GC7964@bill-the-cat> <20211014152801.GF7964@bill-the-cat> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Mailman-Approved-At: Tue, 26 Oct 2021 13:44:22 +0200 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.2 at phobos.denx.de X-Virus-Status: Clean Hi Simon, A bit late to the party, sorry! [...] > > > > I really want to see what the binary case looks like since we could then > > kill off rpi_{3,3_b,4}_defconfig and I would need to see if we could > > then also do a rpi_arm32_defconfig too. > > > > I want to see less device trees in U-Boot sources, if they can come > > functionally correct from the hardware/our caller. > > > > And I'm not seeing how we make use of "U-Boot /config" if we also don't > > use the device tree from build time at run time, ignoring the device > > tree provided to us at run time by the caller. > > Firstly I should say that I find building firmware very messy and > confusing these days. Lots of things to build and it's hard to find > the instructions. It doesn't have to be that way, but if we carry on > as we are, it will continue to be messy and in five years you will > need a Ph.D and a lucky charm to boot on any modern board. My > objective here is to simplify things, bringing some consistency to the > different components. Binman was one effort there. I feel that putting > at least the U-Boot house in order, in my role as devicetree > maintainer (and as author of devicetree support in U-Boot back in > 2011), is the next step. > > If we set things up correctly and agree on the bindings, devicetree > can be the unifying configuration mechanism through the whole of > firmware (except for very early bits) and into the OS, this will set > us up very well to deal with the complexity that is coming. > > Anyway, here are the mental steps that I've gone through over the past > two months: > > Step 1: At present, some people think U-Boot is not even allowed to > have its own nodes/properties in the DT. It is an abuse of the > devicetree standard, like the /chosen node but with less history. We > should sacrifice efficiency, expedience and expandability on the altar > of 'devicetree is a hardware description'. How do we get over that > one? Wel, I just think we need to accept that U-Boot uses devicetree > for its own purposes, as well as for booting the OS. I am not saying > it always has to have those properties, but with existing features > like verified boot, SPL as well as complex firmware images where > U-Boot needs to be able to find things in the image, it is essential. > So let's just assume that we need this everywhere, since we certainly > need it in at least some places. > > (stop reading here if you disagree, because nothing below will make > any sense...you can still use U-Boot v2011.06 which doesn't have > OF_CONTROL :-) Having U-Boot keep it's *internal* config state in DTs is fine. Adding that to the DTs that are copied over from linux isn't imho. There are various reasons for that. First of all syncing device trees is a huge pain and that's probably one of the main reasons our DTs are out of sync for a large number of boards. The point is this was fine in 2011 were we had SPL only, but the reality today is completely different. There's previous stage boot loaders (and enough cases were vendors prefer those over SPL). If that bootloader needs to use it's own device tree for whatever reason, imposing restrictions on it wrt to the device tree it has to include, and require them to have knowledge of U-Boot and it's internal config mechanism makes no sense not to mention it doesn't scale at all. > > Step 2: Assume U-Boot has its own nodes/properties. How do they get > there? Well, we have u-boot.dtsi files for that (the 2016 patch > "6d427c6b1fa binman: Automatically include a U-Boot .dtsi file"), we > have binman definitions, etc. So we need a way to overlay those things > into the DT. We already support this for in-tree DTs, so IMO this is > easy. Just require every board to have an in-tree DT. It helps with > discoverability and documentation, anyway. That is this series. > Again, the board might decide for it's own reason to provide it's own DT. IMHO U-Boot must be able to cope with that and asking DTs to be included in U-Boot source is not the right way to do that, not to mention cases were that's completely unrealistic (e.g QEMU or a board that reads the DTB from it's flash). > (I think most of us are at the beginning of step 2, unsure about it > and worried about step 3) > > Step 3: Ah, but there are flows (i.e. boards that use a particular > flow only, or boards that sometimes use a flow) which need the DT to > come from a prior stage. How to handle that? IMO that is only going to > grow as every man and his dog get into the write-a-bootloader > business. And that's exactly why we have to come up with something that scales, without having to add a bunch of unusable DTs in U-Boot. > We need a way to provide the U-Boot nodes/properties in a > form that the prior stage can consume and integrate with its build > system. Is TF-A the only thing being discussed here? If so, let's just > do it. We have the u-boot.dtsi and we can use binman to put the image > together, for example. Or we can get clever and create some sort of > overlay dtb. > > Step 3a. But I don't want to do that. a) If U-Boot needs this stuff > then it will need to build it in and use two devicetrees, one internal > and one from the prior stage....well that is not very efficient and it > is going to be confusing for people to figure out what U-Boot is > actually doing. But we actually already do that in a lot of cases > where U-Boot passes a DT to the kernel which is different to the one > it uses. So perhaps we have three devicetrees? OMG. No we don't. That's a moot point. If you separate the DTs U-Boot provides the internal one and inherits one 'generic'. Linux will be able to use that. So the only case were you'll need 3 DTs is if the *vendor* breaks the DT across kernel versions, In which case there's not much you can do to begin with and that's already a case we have to deal with. > b) Well then > U-Boot can have its own small devicetree with its bits and then U-Boot > can merge the two when it starts. Again that is not very efficient. It > means that U-Boot cannot be controlled by the prior stage (e.g. to get > its public key from there or to enable/disable the console), so > unified firmware config is not possible. It will get very confusing, > particularly for debugging U-Boot. c) Some other scheme to avoid > accepting step 3...please stop! > > Step 4: Yes, but there is QEMU, which makes the devicetree up out of > whole cloth. What about that? Well, we are just going to have to deal > with that. We can easily merge in the U-Boot nodes/properties and > update the U-Boot CI scripts to do this, as needed, e.g. with > qemu-riscv64_spl. It's only one use case, although Xen might do > something similar. > > To my mind, that deals with both the build-time and run-time issues. > We have a discoverable DT in U-Boot, which should be considered the > source of truth for most boards. We can sync it with Linux > automatically with the tooling that I hope Rob Herring will come up > with. We can use an empty one where there really is no default, > although I'd argue that is making perfect an enemy of the good. > > Step 5: If we get clever and want to remove them from the U-Boot tree > and pick them up from somewhere else, we can do that with sufficient > tooling. Perhaps we should set a timeline for that? A year? Two? Six? We can start slowly migrating boards and see how that works out. We could either use 2 device trees as you proposed, or have u-boot merge the 'u-boot' DTB and the inherited DTB before DM comes up. OTOH I'd prefer if linux gets handed a clean device tree without the u-boot internals in it, so I think 2 discrete DTs is cleaner overall. Regards /Ilias > > To repeat, if we set things up correctly and agree on the bindings, > devicetree can be the unifying configuration mechanism through the > whole of firmware (except for very early bits) and into the OS. I feel > this will set us up very well to deal with the complexity that is > coming. > > Regards, > Simon