Message ID | 94180731aa4a17e4834458a979de7de782dc73d4.1611312122.git.viresh.kumar@linaro.org |
---|---|
State | Superseded |
Headers | show |
Series | dt: build overlays | expand |
On Fri, Jan 22, 2021 at 04:20:35PM +0530, Viresh Kumar wrote: > In order to build-test the same unit-test files using fdtoverlay tool, > move the device nodes from the existing overlay_base.dts and > testcases_common.dts files to .dtsi files. The .dts files now include > the new .dtsi files, resulting in exactly the same behavior as earlier. > > The .dtsi files can now be reused for compile time tests using > fdtoverlay (will be done in a later patch). > > This is required because the base files passed to fdtoverlay tool > shouldn't be overlays themselves (i.e. shouldn't have the /plugin/; > tag). > > Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> > --- > drivers/of/unittest-data/overlay_base.dts | 90 +----------------- > drivers/of/unittest-data/overlay_common.dtsi | 91 +++++++++++++++++++ > drivers/of/unittest-data/testcases.dts | 17 +--- > .../of/unittest-data/testcases_common.dtsi | 18 ++++ > 4 files changed, 111 insertions(+), 105 deletions(-) > create mode 100644 drivers/of/unittest-data/overlay_common.dtsi > create mode 100644 drivers/of/unittest-data/testcases_common.dtsi > > diff --git a/drivers/of/unittest-data/overlay_base.dts b/drivers/of/unittest-data/overlay_base.dts > index 99ab9d12d00b..ab9014589c5d 100644 > --- a/drivers/of/unittest-data/overlay_base.dts > +++ b/drivers/of/unittest-data/overlay_base.dts > @@ -2,92 +2,4 @@ > /dts-v1/; > /plugin/; This still makes no sense to me. Is this data intended as a base tree, or as an overlay? If it's an overlay, what are the constraints on the base tree it's supposed to apply to. This patch is treating it as both in different places, but that's such a bizarre usecase it needs detailed justification. It really looks like the unittest stuff is doing some very bogus stuff that should be fixed first, before trying to do this on top. -- David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
On 23-01-21, 14:07, David Gibson wrote: > On Fri, Jan 22, 2021 at 04:20:35PM +0530, Viresh Kumar wrote: > > In order to build-test the same unit-test files using fdtoverlay tool, > > move the device nodes from the existing overlay_base.dts and > > testcases_common.dts files to .dtsi files. The .dts files now include > > the new .dtsi files, resulting in exactly the same behavior as earlier. > > > > The .dtsi files can now be reused for compile time tests using > > fdtoverlay (will be done in a later patch). > > > > This is required because the base files passed to fdtoverlay tool > > shouldn't be overlays themselves (i.e. shouldn't have the /plugin/; > > tag). > > > > Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> > > --- > > drivers/of/unittest-data/overlay_base.dts | 90 +----------------- > > drivers/of/unittest-data/overlay_common.dtsi | 91 +++++++++++++++++++ > > drivers/of/unittest-data/testcases.dts | 17 +--- > > .../of/unittest-data/testcases_common.dtsi | 18 ++++ > > 4 files changed, 111 insertions(+), 105 deletions(-) > > create mode 100644 drivers/of/unittest-data/overlay_common.dtsi > > create mode 100644 drivers/of/unittest-data/testcases_common.dtsi > > > > diff --git a/drivers/of/unittest-data/overlay_base.dts b/drivers/of/unittest-data/overlay_base.dts > > index 99ab9d12d00b..ab9014589c5d 100644 > > --- a/drivers/of/unittest-data/overlay_base.dts > > +++ b/drivers/of/unittest-data/overlay_base.dts > > @@ -2,92 +2,4 @@ > > /dts-v1/; > > /plugin/; > > This still makes no sense to me. Is this data intended as a base > tree, or as an overlay? If it's an overlay, what are the constraints > on the base tree it's supposed to apply to. > > This patch is treating it as both in different places, but that's such > a bizarre usecase it needs detailed justification. It really looks > like the unittest stuff is doing some very bogus stuff that should be > fixed first, before trying to do this on top. I will let Frank respond to that :) -- viresh
On 1/22/21 9:07 PM, David Gibson wrote: > On Fri, Jan 22, 2021 at 04:20:35PM +0530, Viresh Kumar wrote: >> In order to build-test the same unit-test files using fdtoverlay tool, >> move the device nodes from the existing overlay_base.dts and >> testcases_common.dts files to .dtsi files. The .dts files now include >> the new .dtsi files, resulting in exactly the same behavior as earlier. >> >> The .dtsi files can now be reused for compile time tests using >> fdtoverlay (will be done in a later patch). >> >> This is required because the base files passed to fdtoverlay tool >> shouldn't be overlays themselves (i.e. shouldn't have the /plugin/; >> tag). >> >> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> >> --- >> drivers/of/unittest-data/overlay_base.dts | 90 +----------------- >> drivers/of/unittest-data/overlay_common.dtsi | 91 +++++++++++++++++++ >> drivers/of/unittest-data/testcases.dts | 17 +--- >> .../of/unittest-data/testcases_common.dtsi | 18 ++++ >> 4 files changed, 111 insertions(+), 105 deletions(-) >> create mode 100644 drivers/of/unittest-data/overlay_common.dtsi >> create mode 100644 drivers/of/unittest-data/testcases_common.dtsi >> >> diff --git a/drivers/of/unittest-data/overlay_base.dts b/drivers/of/unittest-data/overlay_base.dts >> index 99ab9d12d00b..ab9014589c5d 100644 >> --- a/drivers/of/unittest-data/overlay_base.dts >> +++ b/drivers/of/unittest-data/overlay_base.dts >> @@ -2,92 +2,4 @@ >> /dts-v1/; >> /plugin/; > > This still makes no sense to me. Is this data intended as a base > tree, or as an overlay? If it's an overlay, what are the constraints > on the base tree it's supposed to apply to. I have already replied several times that this should not make sense to anyone unless they read unittest.c and see in detail how these FDTs are abused. I have stated several times that the usage is bizarre and not normal. > > This patch is treating it as both in different places, but that's such > a bizarre usecase it needs detailed justification. It really looks > like the unittest stuff is doing some very bogus stuff that should be > fixed first, before trying to do this on top. > The unittest stuff is bizarre, but it is correct. This patch series does not alter the current usage. -Frank
On 22-01-21, 16:20, Viresh Kumar wrote: > In order to build-test the same unit-test files using fdtoverlay tool, > move the device nodes from the existing overlay_base.dts and > testcases_common.dts files to .dtsi files. The .dts files now include > the new .dtsi files, resulting in exactly the same behavior as earlier. > > The .dtsi files can now be reused for compile time tests using > fdtoverlay (will be done in a later patch). > > This is required because the base files passed to fdtoverlay tool > shouldn't be overlays themselves (i.e. shouldn't have the /plugin/; > tag). > > Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> > --- > drivers/of/unittest-data/overlay_base.dts | 90 +----------------- > drivers/of/unittest-data/overlay_common.dtsi | 91 +++++++++++++++++++ > drivers/of/unittest-data/testcases.dts | 17 +--- > .../of/unittest-data/testcases_common.dtsi | 18 ++++ > 4 files changed, 111 insertions(+), 105 deletions(-) > create mode 100644 drivers/of/unittest-data/overlay_common.dtsi > create mode 100644 drivers/of/unittest-data/testcases_common.dtsi Frank, As I mentioned in the cover-letter, I get a build warning right now: drivers/of/unittest-data/tests-interrupts.dtsi:20.5-28: Warning (interrupts_property): /testcase-data/testcase-device2:#interrupt-cells: size is (4), expected multiple of 8 I think I need to add below diff to this patch to fix this warning, will that be okay ? diff --git a/drivers/of/unittest-data/testcases.dts b/drivers/of/unittest-data/testcases.dts index 185125085784..04b9e7bb30d9 100644 --- a/drivers/of/unittest-data/testcases.dts +++ b/drivers/of/unittest-data/testcases.dts @@ -3,3 +3,14 @@ /plugin/; #include "testcases_common.dtsi" + +/ { + testcase-data { + testcase-device2 { + compatible = "testcase-device"; + interrupt-parent = <&test_intc2>; + interrupts = <1>; /* invalid specifier - too short */ + }; + }; + +}; diff --git a/drivers/of/unittest-data/tests-interrupts.dtsi b/drivers/of/unittest-data/tests-interrupts.dtsi index ec175e800725..0e5914611107 100644 --- a/drivers/of/unittest-data/tests-interrupts.dtsi +++ b/drivers/of/unittest-data/tests-interrupts.dtsi @@ -61,12 +61,5 @@ testcase-device1 { interrupt-parent = <&test_intc0>; interrupts = <1>; }; - - testcase-device2 { - compatible = "testcase-device"; - interrupt-parent = <&test_intc2>; - interrupts = <1>; /* invalid specifier - too short */ - }; }; - }; -- viresh
Hi Viresh, On 1/26/21 11:56 PM, Viresh Kumar wrote: > On 22-01-21, 16:20, Viresh Kumar wrote: >> In order to build-test the same unit-test files using fdtoverlay tool, >> move the device nodes from the existing overlay_base.dts and >> testcases_common.dts files to .dtsi files. The .dts files now include >> the new .dtsi files, resulting in exactly the same behavior as earlier. >> >> The .dtsi files can now be reused for compile time tests using >> fdtoverlay (will be done in a later patch). >> >> This is required because the base files passed to fdtoverlay tool >> shouldn't be overlays themselves (i.e. shouldn't have the /plugin/; >> tag). >> >> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> >> --- >> drivers/of/unittest-data/overlay_base.dts | 90 +----------------- >> drivers/of/unittest-data/overlay_common.dtsi | 91 +++++++++++++++++++ >> drivers/of/unittest-data/testcases.dts | 17 +--- >> .../of/unittest-data/testcases_common.dtsi | 18 ++++ >> 4 files changed, 111 insertions(+), 105 deletions(-) >> create mode 100644 drivers/of/unittest-data/overlay_common.dtsi >> create mode 100644 drivers/of/unittest-data/testcases_common.dtsi > > Frank, > > As I mentioned in the cover-letter, I get a build warning right now: > > drivers/of/unittest-data/tests-interrupts.dtsi:20.5-28: Warning (interrupts_property): /testcase-data/testcase-device2:#interrupt-cells: size is (4), expected multiple of 8 Thanks for catching that. > > I think I need to add below diff to this patch to fix this warning, will that > be okay ? Nope, the change below won't work because it removes the node testcase-device2 from the tests that unittest.c does (if I am thinking correctly). I will double check my thinking, but I know you are spinning the patch, so I didn't want to delay this reply. Note that this node has a deliberate error in it "/* invalid specifier - too short */". I'm not sure why the dtc warning triggers on line 20 instead of line 68. I'll have to go look at the dtc source to better understand the warning. -Frank > > diff --git a/drivers/of/unittest-data/testcases.dts b/drivers/of/unittest-data/testcases.dts > index 185125085784..04b9e7bb30d9 100644 > --- a/drivers/of/unittest-data/testcases.dts > +++ b/drivers/of/unittest-data/testcases.dts > @@ -3,3 +3,14 @@ > /plugin/; > > #include "testcases_common.dtsi" > + > +/ { > + testcase-data { > + testcase-device2 { > + compatible = "testcase-device"; > + interrupt-parent = <&test_intc2>; > + interrupts = <1>; /* invalid specifier - too short */ > + }; > + }; > + > +}; > diff --git a/drivers/of/unittest-data/tests-interrupts.dtsi b/drivers/of/unittest-data/tests-interrupts.dtsi > index ec175e800725..0e5914611107 100644 > --- a/drivers/of/unittest-data/tests-interrupts.dtsi > +++ b/drivers/of/unittest-data/tests-interrupts.dtsi > @@ -61,12 +61,5 @@ testcase-device1 { > interrupt-parent = <&test_intc0>; > interrupts = <1>; > }; > - > - testcase-device2 { > - compatible = "testcase-device"; > - interrupt-parent = <&test_intc2>; > - interrupts = <1>; /* invalid specifier - too short */ > - }; > }; > - > }; >
Hi Viresh, Second attempt, I think the first reply did not properly send. On 1/26/21 11:56 PM, Viresh Kumar wrote: > On 22-01-21, 16:20, Viresh Kumar wrote: >> In order to build-test the same unit-test files using fdtoverlay tool, >> move the device nodes from the existing overlay_base.dts and >> testcases_common.dts files to .dtsi files. The .dts files now include >> the new .dtsi files, resulting in exactly the same behavior as earlier. >> >> The .dtsi files can now be reused for compile time tests using >> fdtoverlay (will be done in a later patch). >> >> This is required because the base files passed to fdtoverlay tool >> shouldn't be overlays themselves (i.e. shouldn't have the /plugin/; >> tag). >> >> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> >> --- >> drivers/of/unittest-data/overlay_base.dts | 90 +----------------- >> drivers/of/unittest-data/overlay_common.dtsi | 91 +++++++++++++++++++ >> drivers/of/unittest-data/testcases.dts | 17 +--- >> .../of/unittest-data/testcases_common.dtsi | 18 ++++ >> 4 files changed, 111 insertions(+), 105 deletions(-) >> create mode 100644 drivers/of/unittest-data/overlay_common.dtsi >> create mode 100644 drivers/of/unittest-data/testcases_common.dtsi > > Frank, > > As I mentioned in the cover-letter, I get a build warning right now: > > drivers/of/unittest-data/tests-interrupts.dtsi:20.5-28: Warning (interrupts_property): /testcase-data/testcase-device2:#interrupt-cells: size is (4), expected multiple of 8 Thanks for catching that. > > I think I need to add below diff to this patch to fix this warning, will that > be okay ? In my first reply, I said "nope", or something to that effect. Upon reflection, it looks like the below diff will fix the problem. This is base on source code inspection and building with the diff applied. I did not successfully boot my target (I have some issues to resolve after updating the OS on my development host), so I have not verified that unittest is not impacted. -Frank > > diff --git a/drivers/of/unittest-data/testcases.dts b/drivers/of/unittest-data/testcases.dts > index 185125085784..04b9e7bb30d9 100644 > --- a/drivers/of/unittest-data/testcases.dts > +++ b/drivers/of/unittest-data/testcases.dts > @@ -3,3 +3,14 @@ > /plugin/; > > #include "testcases_common.dtsi" > + > +/ { > + testcase-data { > + testcase-device2 { > + compatible = "testcase-device"; > + interrupt-parent = <&test_intc2>; > + interrupts = <1>; /* invalid specifier - too short */ > + }; > + }; > + > +}; > diff --git a/drivers/of/unittest-data/tests-interrupts.dtsi b/drivers/of/unittest-data/tests-interrupts.dtsi > index ec175e800725..0e5914611107 100644 > --- a/drivers/of/unittest-data/tests-interrupts.dtsi > +++ b/drivers/of/unittest-data/tests-interrupts.dtsi > @@ -61,12 +61,5 @@ testcase-device1 { > interrupt-parent = <&test_intc0>; > interrupts = <1>; > }; > - > - testcase-device2 { > - compatible = "testcase-device"; > - interrupt-parent = <&test_intc2>; > - interrupts = <1>; /* invalid specifier - too short */ > - }; > }; > - > }; >
diff --git a/drivers/of/unittest-data/overlay_base.dts b/drivers/of/unittest-data/overlay_base.dts index 99ab9d12d00b..ab9014589c5d 100644 --- a/drivers/of/unittest-data/overlay_base.dts +++ b/drivers/of/unittest-data/overlay_base.dts @@ -2,92 +2,4 @@ /dts-v1/; /plugin/; -/* - * Base device tree that overlays will be applied against. - * - * Do not add any properties in node "/". - * Do not add any nodes other than "/testcase-data-2" in node "/". - * Do not add anything that would result in dtc creating node "/__fixups__". - * dtc will create nodes "/__symbols__" and "/__local_fixups__". - */ - -/ { - testcase-data-2 { - #address-cells = <1>; - #size-cells = <1>; - - electric_1: substation@100 { - compatible = "ot,big-volts-control"; - reg = < 0x00000100 0x100 >; - status = "disabled"; - - hvac_1: hvac-medium-1 { - compatible = "ot,hvac-medium"; - heat-range = < 50 75 >; - cool-range = < 60 80 >; - }; - - spin_ctrl_1: motor-1 { - compatible = "ot,ferris-wheel-motor"; - spin = "clockwise"; - rpm_avail = < 50 >; - }; - - spin_ctrl_2: motor-8 { - compatible = "ot,roller-coaster-motor"; - }; - }; - - rides_1: fairway-1 { - #address-cells = <1>; - #size-cells = <1>; - compatible = "ot,rides"; - status = "disabled"; - orientation = < 127 >; - - ride@100 { - #address-cells = <1>; - #size-cells = <1>; - compatible = "ot,roller-coaster"; - reg = < 0x00000100 0x100 >; - hvac-provider = < &hvac_1 >; - hvac-thermostat = < 29 > ; - hvac-zones = < 14 >; - hvac-zone-names = "operator"; - spin-controller = < &spin_ctrl_2 5 &spin_ctrl_2 7 >; - spin-controller-names = "track_1", "track_2"; - queues = < 2 >; - - track@30 { - reg = < 0x00000030 0x10 >; - }; - - track@40 { - reg = < 0x00000040 0x10 >; - }; - - }; - }; - - lights_1: lights@30000 { - compatible = "ot,work-lights"; - reg = < 0x00030000 0x1000 >; - status = "disabled"; - }; - - lights_2: lights@40000 { - compatible = "ot,show-lights"; - reg = < 0x00040000 0x1000 >; - status = "disabled"; - rate = < 13 138 >; - }; - - retail_1: vending@50000 { - reg = < 0x00050000 0x1000 >; - compatible = "ot,tickets"; - status = "disabled"; - }; - - }; -}; - +#include "overlay_common.dtsi" diff --git a/drivers/of/unittest-data/overlay_common.dtsi b/drivers/of/unittest-data/overlay_common.dtsi new file mode 100644 index 000000000000..08874a72556e --- /dev/null +++ b/drivers/of/unittest-data/overlay_common.dtsi @@ -0,0 +1,91 @@ +// SPDX-License-Identifier: GPL-2.0 + +/* + * Base device tree that overlays will be applied against. + * + * Do not add any properties in node "/". + * Do not add any nodes other than "/testcase-data-2" in node "/". + * Do not add anything that would result in dtc creating node "/__fixups__". + * dtc will create nodes "/__symbols__" and "/__local_fixups__". + */ + +/ { + testcase-data-2 { + #address-cells = <1>; + #size-cells = <1>; + + electric_1: substation@100 { + compatible = "ot,big-volts-control"; + reg = < 0x00000100 0x100 >; + status = "disabled"; + + hvac_1: hvac-medium-1 { + compatible = "ot,hvac-medium"; + heat-range = < 50 75 >; + cool-range = < 60 80 >; + }; + + spin_ctrl_1: motor-1 { + compatible = "ot,ferris-wheel-motor"; + spin = "clockwise"; + rpm_avail = < 50 >; + }; + + spin_ctrl_2: motor-8 { + compatible = "ot,roller-coaster-motor"; + }; + }; + + rides_1: fairway-1 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "ot,rides"; + status = "disabled"; + orientation = < 127 >; + + ride@100 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "ot,roller-coaster"; + reg = < 0x00000100 0x100 >; + hvac-provider = < &hvac_1 >; + hvac-thermostat = < 29 > ; + hvac-zones = < 14 >; + hvac-zone-names = "operator"; + spin-controller = < &spin_ctrl_2 5 &spin_ctrl_2 7 >; + spin-controller-names = "track_1", "track_2"; + queues = < 2 >; + + track@30 { + reg = < 0x00000030 0x10 >; + }; + + track@40 { + reg = < 0x00000040 0x10 >; + }; + + }; + }; + + lights_1: lights@30000 { + compatible = "ot,work-lights"; + reg = < 0x00030000 0x1000 >; + status = "disabled"; + }; + + lights_2: lights@40000 { + compatible = "ot,show-lights"; + reg = < 0x00040000 0x1000 >; + status = "disabled"; + rate = < 13 138 >; + }; + + retail_1: vending@50000 { + reg = < 0x00050000 0x1000 >; + compatible = "ot,tickets"; + status = "disabled"; + }; + + }; +}; + diff --git a/drivers/of/unittest-data/testcases.dts b/drivers/of/unittest-data/testcases.dts index a85b5e1c381a..185125085784 100644 --- a/drivers/of/unittest-data/testcases.dts +++ b/drivers/of/unittest-data/testcases.dts @@ -2,19 +2,4 @@ /dts-v1/; /plugin/; -/ { - testcase-data { - changeset { - prop-update = "hello"; - prop-remove = "world"; - node-remove { - }; - }; - }; -}; -#include "tests-phandle.dtsi" -#include "tests-interrupts.dtsi" -#include "tests-match.dtsi" -#include "tests-address.dtsi" -#include "tests-platform.dtsi" -#include "tests-overlay.dtsi" +#include "testcases_common.dtsi" diff --git a/drivers/of/unittest-data/testcases_common.dtsi b/drivers/of/unittest-data/testcases_common.dtsi new file mode 100644 index 000000000000..05f16606b6a5 --- /dev/null +++ b/drivers/of/unittest-data/testcases_common.dtsi @@ -0,0 +1,18 @@ +// SPDX-License-Identifier: GPL-2.0 + +/ { + testcase-data { + changeset { + prop-update = "hello"; + prop-remove = "world"; + node-remove { + }; + }; + }; +}; +#include "tests-phandle.dtsi" +#include "tests-interrupts.dtsi" +#include "tests-match.dtsi" +#include "tests-address.dtsi" +#include "tests-platform.dtsi" +#include "tests-overlay.dtsi"
In order to build-test the same unit-test files using fdtoverlay tool, move the device nodes from the existing overlay_base.dts and testcases_common.dts files to .dtsi files. The .dts files now include the new .dtsi files, resulting in exactly the same behavior as earlier. The .dtsi files can now be reused for compile time tests using fdtoverlay (will be done in a later patch). This is required because the base files passed to fdtoverlay tool shouldn't be overlays themselves (i.e. shouldn't have the /plugin/; tag). Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> --- drivers/of/unittest-data/overlay_base.dts | 90 +----------------- drivers/of/unittest-data/overlay_common.dtsi | 91 +++++++++++++++++++ drivers/of/unittest-data/testcases.dts | 17 +--- .../of/unittest-data/testcases_common.dtsi | 18 ++++ 4 files changed, 111 insertions(+), 105 deletions(-) create mode 100644 drivers/of/unittest-data/overlay_common.dtsi create mode 100644 drivers/of/unittest-data/testcases_common.dtsi -- 2.25.0.rc1.19.g042ed3e048af