Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

schemas: bootph: Add check for bootph tags in parent nodes #99

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

robherring
Copy link
Member

When a node has boot phase tags, the parent node is implicitly included and a bootph tag is not needed. Add a schema to check for and disallow bootph tags in both parent and child nodes. It's not the greatest logic and resulting error message, but that's what works for json-schema.

When a node has boot phase tags, the parent node is implicitly included
and a bootph tag is not needed. Add a schema to check for and disallow
bootph tags in both parent and child nodes. It's not the greatest logic
and resulting error message, but that's what works for json-schema.

Signed-off-by: Rob Herring <[email protected]>
@sjg20
Copy link

sjg20 commented Feb 21, 2023

If I understand it correctly, this will break all existing devicetree files in U-Boot, since the build system does not support this yet. I need to get the fdtgrep tool upstreamed and then enhance it to handle this, then update U-Boot. I believe it if feasible but it is going to take some time.

- required: [ bootph-some-ram ]
- required: [ bootph-all ]
then:
description: Parent nodes don't need bootph tags
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They don't need the same tag, but they might need a different one. I think the rule will be that if a child has a particular phase tag then it is implied in all its parents

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That should be doable. What about a child with bootph-all and parent with something else?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In that case we are implying bootph-all in the parent so it doesn't matter what tags are present

@robherring
Copy link
Member Author

If I understand it correctly, this will break all existing devicetree files in U-Boot, since the build system does not support this yet. I need to get the fdtgrep tool upstreamed and then enhance it to handle this, then update U-Boot. I believe it if feasible but it is going to take some time.

It only breaks them if you run the checks. Nothing really breaks, just adds to the pile of warnings many platforms have. Does anyone actually run dtschema on u-boot copies of DTs?

I'm assuming the order here is enhance fdtgrep and u-boot first, then submit bootph tags to Linux copies of dts files. So this change is primarily to check the Linux copies. And from the look of it, some platforms may not need to wait as they don't have this issue.

@sjg20
Copy link

sjg20 commented Feb 22, 2023

We don't run the schema in U-Boot, but would like to one day. But once we have things in Linux, your warning is going to advise people to change the tags, and then U-Boot won't work. It will be very confusing.

Are you saying that you won't accept DTs into Linux until the fdtgrep stuff is done? That is really putting pressure on all of this...

@robherring
Copy link
Member Author

Are you saying that you won't accept DTs into Linux until the fdtgrep stuff is done? That is really putting pressure on all of this...

Yes, that's my position. The dts files in Linux are loosely coupled to u-boot compared to dts files in u-boot tree. IOW, it's an ABI. Plus, why would we add some tags and then later remove them. Just wait until things are stable. However, I don't review (typically) nor apply dts patches (have to pick my firehoses). I do look at overall warnings by platform families though.

@sjg20
Copy link

sjg20 commented Feb 27, 2023

OK, well perhaps initially I will just upstream what we have and worry about tidying up later.

I had a bit of a look at what it would take to implement your scheme. Options I came up with:

  1. Build a table of tags in each node and look that up when scanning the properties of a node, processing the inferred tags too (without emitting them)
  2. Preprocess the tree to insert tags in parents
  3. Move to a recursive approach for emitting the tree

In terms of development time, probably 2 is best.

If you want to have a look, see fdt_next_region() where it has the 'case FDT_PROP'. The h_include() function is in fdtgrep.c

Obviously fdtgrep needs to know that the bootph things must be propagated upwards. That could be done by adding a new flag in addition to --include-node-with-prop (such as --include-tree-with-prop)

@nmenon
Copy link

nmenon commented Aug 30, 2024

did we decide to pull this in?

@sjg20
Copy link

sjg20 commented Sep 1, 2024

Quote reply

Well I implemented option 2 in fdtgrep in U-Boot, so it is working. The commit is:

7a06cc2027c fdtgrep: Allow propagating properties up to supernodes

which landed in v2024.04

@nmenon
Copy link

nmenon commented Sep 1, 2024

Yes, and I would like to catch places where we can clean up in the kernel if we have this as part of a formal release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants