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

How to add lable for existing node? #144

Open
adally opened this issue Dec 27, 2022 · 4 comments
Open

How to add lable for existing node? #144

adally opened this issue Dec 27, 2022 · 4 comments

Comments

@adally
Copy link

adally commented Dec 27, 2022

The format is: "path":"property":"replacement" to modify property. My original node is as below:

                cpu@0 {
                        device_type = "cpu";
                        compatible = "arm,armv8";
                        reg = <0x00 0x00>;
                        enable-method = "psci";
                };

And I want to change it to

                CPU0:cpu@0 {
                        device_type = "cpu";
                        compatible = "arm,armv8";
                        reg = <0x00 0x00>;
                        enable-method = "psci";
                };

How to add it?

When the existing device has some phandle and add a node with label, it will cause duplicated phandle issues. I used below operation to add a node.

      lop_2 {
           // add node
           compatible = "system-device-tree-v1,lop,add";
           node_src = "idle-states";
           node_dest = "/cpus/idle-states";
           idle-states {
               entry-method = "arm,psci";

               CPU_SLEEP_0: cpu-sleep-0 {
                   compatible = "arm,idle-state";
                   local-timer-stop;
                   arm,psci-suspend-param = <0x0010000>;
                   entry-latency-us = <40>;
                   exit-latency-us = <100>;
                   min-residency-us = <150>;
               };

               CLUSTER_SLEEP_0: cluster-sleep-0 {
                   compatible = "arm,idle-state";
                   local-timer-stop;
                   arm,psci-suspend-param = <0x1010000>;
                   entry-latency-us = <500>;
                   exit-latency-us = <1000>;
                   min-residency-us = <2500>;
               };
           };
       };

And I used dtc to covert the dtb file to dts file, it has below errors

$ dtc -I dtb fvp-base-revc-xen.dtb -o fvp-base-revc-xen.dts
fvp-base-revc-xen.dts: ERROR (explicit_phandles): /cpus/idle-states/cluster-sleep-0: duplicated phandle 0x2 (seen before at /bus@8000000/motherboard-bus@8000000/iofpga-bus@300000000/sysreg@10000)
fvp-base-revc-xen.dts: ERROR (explicit_phandles): /cpus/cpu0: duplicated phandle 0x3 (seen before at /refclk32khz)
fvp-base-revc-xen.dts: ERROR (explicit_phandles): /interrupt-controller@2f000000: duplicated phandle 0x1 (seen before at /cpus/idle-states/cpu-sleep-0)
ERROR: Input tree has errors, aborting (use -f to force output)
@zeddii
Copy link
Collaborator

zeddii commented Dec 28, 2022

I wanted to follow up to let you know that I've seen this, but am out of the office until mid first week of January, so can't dig into this much before then.

Just so I'm clear, you are seeing two different problems:

  1. writing a lop to add a label to a node
  2. adding a node with phandles

As for #1, there is a label notation that needs be used, it may have issues. I need to run a test and will follow up.

As for #2, it is a bug. I'm not sure why it is generating a phandle and then not ensuring that it is globally unique in the target tree. I'll have to setup a test for this.

If you have sample input files, and lop files, can you attach them to the bug ? It will make reproducing the problem much faster on my end.

@adally
Copy link
Author

adally commented Dec 29, 2022

For #1 and #2, it has the same input files. input_dts.txt
For #2, below is its lopper operation

     lop_2 {
           // add node
           compatible = "system-device-tree-v1,lop,add";
           node_src = "idle-states";
           node_dest = "/cpus/idle-states";
           idle-states {
               entry-method = "arm,psci";

               CPU_SLEEP_0: cpu-sleep-0 {
                   compatible = "arm,idle-state";
                   local-timer-stop;
                   arm,psci-suspend-param = <0x0010000>;
                   entry-latency-us = <40>;
                   exit-latency-us = <100>;
                   min-residency-us = <150>;
               };

               CLUSTER_SLEEP_0: cluster-sleep-0 {
                   compatible = "arm,idle-state";
                   local-timer-stop;
                   arm,psci-suspend-param = <0x1010000>;
                   entry-latency-us = <500>;
                   exit-latency-us = <1000>;
                   min-residency-us = <2500>;
               };
           };
       };

@zeddii
Copy link
Collaborator

zeddii commented Jan 9, 2023

FYI: I'm back from holidays now, and will pick this up shortly.

@adally
Copy link
Author

adally commented Jan 10, 2023

FYI, I am not blocked by this now. It's ok in my use case without adding an alias for CPU nodes and /cpus/idle-states.

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

No branches or pull requests

2 participants