[PATCH v3 6/8] dm: treewide: Complete migration to new driver model schema

Michal Simek michal.simek at amd.com
Tue Feb 7 16:20:49 CET 2023

Hi Simon,

On 2/7/23 14:38, Simon Glass wrote:
> Hi Michal,
> On Tue, 7 Feb 2023 at 06:14, Michal Simek <michal.simek at amd.com> wrote:
>> Hi,
>> On 2/6/23 18:12, Simon Glass wrote:
>>> +Peter Maydell
>>> Hi,
>>> On Mon, 6 Feb 2023 at 07:56, Michal Simek <michal.simek at amd.com> wrote:
>>>> On 2/6/23 15:44, Tom Rini wrote:
>>>>> On Mon, Feb 06, 2023 at 01:22:48PM +0100, Michal Simek wrote:
>>>>>> Hi Simon,
>>>>>> On 2/1/23 23:54, Simon Glass wrote:
>>>>>>> Update various build and test components to use the new schema.
>>>>>>> Signed-off-by: Simon Glass <sjg at chromium.org>
>>>>>>> ---
>>>>>>> (no changes since v1)
>>>>>>>      drivers/core/ofnode.c            | 10 +++++-----
>>>>>>>      drivers/video/video-uclass.c     |  4 ++--
>>>>>>>      dts/Kconfig                      |  2 +-
>>>>>>>      include/dm/device.h              |  2 +-
>>>>>>>      include/dm/ofnode.h              | 10 +++++-----
>>>>>>>      scripts/Makefile.lib             | 12 ++++++------
>>>>>>>      test/dm/test-fdt.c               |  2 +-
>>>>>>>      test/py/tests/test_ofplatdata.py |  8 ++++----
>>>>>>>      tools/binman/binman.rst          |  3 +--
>>>>>>>      tools/dtoc/test_fdt.py           |  8 ++++----
>>>>>>>      10 files changed, 30 insertions(+), 31 deletions(-)
>>>>>>> diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c
>>>>>>> index 4d56b1a7675..5249a60639b 100644
>>>>>>> --- a/drivers/core/ofnode.c
>>>>>>> +++ b/drivers/core/ofnode.c
>>>>>>> @@ -1265,22 +1265,22 @@ bool ofnode_pre_reloc(ofnode node)
>>>>>>>      {
>>>>>>>      #if defined(CONFIG_SPL_BUILD) || defined(CONFIG_TPL_BUILD)
>>>>>>>       /* for SPL and TPL the remaining nodes after the fdtgrep 1st pass
>>>>>>> -    * had property dm-pre-reloc or u-boot,dm-spl/tpl.
>>>>>>> +    * had property bootph-all or bootph-pre-sram/bootph-pre-ram.
>>>>>>>        * They are removed in final dtb (fdtgrep 2nd pass)
>>>>>>>        */
>>>>>>>       return true;
>>>>>>>      #else
>>>>>>> -   if (ofnode_read_bool(node, "u-boot,dm-pre-reloc"))
>>>>>>> +   if (ofnode_read_bool(node, "bootph-all"))
>>>>>>>               return true;
>>>>>>> -   if (ofnode_read_bool(node, "u-boot,dm-pre-proper"))
>>>>>>> +   if (ofnode_read_bool(node, "bootph-some-ram"))
>>>>>>>               return true;
>>>>>>>       /*
>>>>>>>        * In regular builds individual spl and tpl handling both
>>>>>>>        * count as handled pre-relocation for later second init.
>>>>>>>        */
>>>>>>> -   if (ofnode_read_bool(node, "u-boot,dm-spl") ||
>>>>>>> -       ofnode_read_bool(node, "u-boot,dm-tpl"))
>>>>>>> +   if (ofnode_read_bool(node, "bootph-pre-ram") ||
>>>>>>> +       ofnode_read_bool(node, "bootph-pre-sram"))
>>>>>>>               return true;
>>>>>> Please correct me if I am wrong but this change will likely break all boards
>>>>>> which didn't migrate to this at this stage. And because targeting early
>>>>>> stages people will be without console.
>>>>>> I think we should have transition period for 1-2 releases to give people
>>>>>> enough time to migrate. It means print big warning that they have to migrate
>>>>>> their DTS.
>>>>> What's the migration case here we're missing? Is it platforms that
>>>>> maintain a dts externally, via tooling / etc, that populate those nodes?
>>>> Yes and I expect there will be a lot of DTs around with some changes for
>>>> specific products.
>>>> Also for example QEMU is also generating DT based on it's configuration and
>>>> provide it to U-Boot.
>>>> https://gitlab.com/qemu-project/qemu/-/blob/master/hw/arm/xlnx-versal-virt.c#L91
>>>> When this patch is applied CI loop should fail for Versal.
>>> I am not sure how it helps us to drag this out. It is a breaking
>>> change, but a drawn-out process is just going to create a lot of
>>> confusion. People should be free to use the schema in Linux .dts files
>>> from now on, but if it is not immediately supported in U-Boot then
>>> they cannot. This is the most important point, after all.
>> Definitely having this sort it out is good way to go and I remember we talked
>> about it in past but none had really time to sort it out till now.
> The problem was that we've never been able to get U-Boot schema things
> into Linux. That changed with the /options one and so I thought it
> would be worth trying with this. It is a big step forward and provides
> confidence that firmware-specific challenges can be dealt with, even
> if they are utterly unrelated to the challenges faced by Linux.

It is kind of interesting to me that they accepted this flag not to be the part 
of options node as u-boot related configuration. But it is unrelated to this thread.

>> New tags are in dt-schema and they can be spread everywhere (In spite of I think
>> that property in options is cleaner solution - and could be still added in future).
> I did mention that in the schema patch[1] (if I understand what you
> are referring to). But yes, it could still be added. There are
> challenges to be solved but there were challenges to be solved in the
> existing mechanism (and still are).

good to hear and yes it was related to your dtschema patch description.

>> I just want to say that big cut after a lot of year by one series is not the
>> best thing to do. I won't have any issue with it because simply I will add both
>> u-boot,dm* and bootph* properties to all DTs which are out of mainline and for
>> some time will maintain it but for customers who are having DTB somewhere out of
>> mainline they will get to state that their newer u-boot stops to work without
>> any single line saying that property name has changed. Smart one will start
>> bisecting and will find this commit and they will know what to do with it.
> OK...but how is it better to wait? We effectively just prolong the
> agony, don't we? What is the actual benefit, since there still needs
> to be a cut-over? I really want to get this unfortunate episode behind
> us as soon as possible.
> We could announce it on the Linux mailing list and in LWN, perhaps?
> What are you proposing instead?

I understand your position. It is around for 8 years that's why adding warning 
message in log for 2 releases IMHO shouldn't really hurt us.

And the way what I am proposing is simply like this

diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c
index 5249a60639b1..e8f6575c73cc 100644
--- a/drivers/core/ofnode.c
+++ b/drivers/core/ofnode.c
@@ -1283,6 +1283,16 @@ bool ofnode_pre_reloc(ofnode node)
             ofnode_read_bool(node, "bootph-pre-sram"))
                 return true;

+       /* convert to bootph-* property */
+       if (ofnode_read_bool(node, "u-boot,dm-pre-reloc") ||
+           ofnode_read_bool(node, "u-boot,dm-pre-proper") ||
+           ofnode_read_bool(node, "u-boot,dm-spl") ||
+           ofnode_read_bool(node, "u-boot,dm-tpl")) {
+               printf("ERROR: Remove deprecated u-boot,dm-* property: %s\n",
+                       ofnode_get_name(node));
+               return true;
+       }
         return false;

this should ensure that when debug is enabled it will show problematic nodes 
which should be fixed.

>> Qemu: We use -device loader,addr for quite a long time internally and to fix
>> issue for Versal we just need to save current dtb as was described in qemu
>> thread with -M dumpdtb=out.dtb and save it to uboot-test-hooks to continue to
>> work in CI.
> Yes. In my view this shows a shameful lack of cooperation on the part
> of the QEMU project. We need to work together to solve problems,
> understanding the different challenges each project faces. I really
> hope that there is a change of heart and the patch can be applied, or
> some other way found to deal with this properly.
>> Not sure if any other target in CI is affected by this change.
> There are no failures in the U-Boot one, if that is what you mean? [2]

There is a change in u-boot behavior but doesn't affect functionality. This can 
simply suggest that we shouldn't really have that flags for Versal at all. Will 
try to look at it.


More information about the U-Boot-Custodians mailing list