2021-02-12 11:21:40

by Viresh Kumar

[permalink] [raw]
Subject: [PATCH V8 0/4] dt: Add fdtoverlay rule and statically build unittest

Hi,

This patchset adds a generic rule for applying overlays using fdtoverlay
tool and then updates unittests to get built statically using the same.

V7->V8:
- Patch 1 is new.
- Platforms need to use dtb-y += foo.dtb instead of overlay-y +=
foo.dtb.
- Use multi_depend instead of .SECONDEXPANSION.
- Use dtb-y for unittest instead of overlay-y.
- Rename the commented dtb filess in unittest Makefile as .dtbo.
- Improved Makefile code (I am learning a lot every day :)

V6->V7:
- Dropped the first 4 patches, already merged.
- Patch 1/3 is new, suggested by Rob and slightly modified by me.
- Adapt Patch 3/3 to the new rule and name the overlay dtbs as .dtbo.

--
Viresh

Rob Herring (1):
kbuild: Add generic rule to apply fdtoverlay

Viresh Kumar (3):
kbuild: Simplify builds with CONFIG_OF_ALL_DTBS
of: unittest: Create overlay_common.dtsi and testcases_common.dtsi
of: unittest: Statically apply overlays using fdtoverlay

drivers/of/unittest-data/Makefile | 50 ++++++++++
drivers/of/unittest-data/overlay_base.dts | 90 +-----------------
drivers/of/unittest-data/overlay_common.dtsi | 91 +++++++++++++++++++
drivers/of/unittest-data/static_base_1.dts | 4 +
drivers/of/unittest-data/static_base_2.dts | 4 +
drivers/of/unittest-data/testcases.dts | 18 ++--
.../of/unittest-data/testcases_common.dtsi | 19 ++++
.../of/unittest-data/tests-interrupts.dtsi | 7 --
scripts/Makefile.lib | 29 +++++-
9 files changed, 200 insertions(+), 112 deletions(-)
create mode 100644 drivers/of/unittest-data/overlay_common.dtsi
create mode 100644 drivers/of/unittest-data/static_base_1.dts
create mode 100644 drivers/of/unittest-data/static_base_2.dts
create mode 100644 drivers/of/unittest-data/testcases_common.dtsi

--
2.25.0.rc1.19.g042ed3e048af


2021-02-12 11:21:55

by Viresh Kumar

[permalink] [raw]
Subject: [PATCH V8 4/4] of: unittest: Statically apply overlays using fdtoverlay

Now that fdtoverlay is part of the kernel build, start using it to test
the unitest overlays we have by applying them statically. Create two new
base files static_base_1.dts and static_base_2.dts which includes other
.dtsi files.

Some unittest overlays deliberately contain errors that unittest checks
for. These overlays will cause fdtoverlay to fail, and are thus not
included for static builds.

Signed-off-by: Viresh Kumar <[email protected]>
---
drivers/of/unittest-data/Makefile | 50 ++++++++++++++++++++++
drivers/of/unittest-data/static_base_1.dts | 4 ++
drivers/of/unittest-data/static_base_2.dts | 4 ++
3 files changed, 58 insertions(+)
create mode 100644 drivers/of/unittest-data/static_base_1.dts
create mode 100644 drivers/of/unittest-data/static_base_2.dts

diff --git a/drivers/of/unittest-data/Makefile b/drivers/of/unittest-data/Makefile
index 009f4045c8e4..f88b2f48f172 100644
--- a/drivers/of/unittest-data/Makefile
+++ b/drivers/of/unittest-data/Makefile
@@ -34,7 +34,57 @@ DTC_FLAGS_overlay += -@
DTC_FLAGS_overlay_bad_phandle += -@
DTC_FLAGS_overlay_bad_symbol += -@
DTC_FLAGS_overlay_base += -@
+DTC_FLAGS_static_base_1 += -@
+DTC_FLAGS_static_base_2 += -@
DTC_FLAGS_testcases += -@

# suppress warnings about intentional errors
DTC_FLAGS_testcases += -Wno-interrupts_property
+
+# Apply overlays statically with fdtoverlay. This is a build time test that
+# the overlays can be applied successfully by fdtoverlay. This does not
+# guarantee that the overlays can be applied successfully at run time by
+# unittest, but it provides a bit of build time test coverage for those
+# who do not execute unittest.
+#
+# The overlays are applied on top of static_base_1.dtb and static_base_2.dtb to
+# create static_test_1.dtb and static_test_2.dtb. If fdtoverlay detects an
+# error than the kernel build will fail. static_test_1.dtb and
+# static_test_2.dtb are not consumed by unittest.
+#
+# Some unittest overlays deliberately contain errors that unittest checks for.
+# These overlays will cause fdtoverlay to fail, and are thus not included
+# in the static test:
+# overlay_bad_add_dup_node.dtbo \
+# overlay_bad_add_dup_prop.dtbo \
+# overlay_bad_phandle.dtbo \
+# overlay_bad_symbol.dtbo \
+
+apply_static_overlay_1 := overlay_0.dtbo \
+ overlay_1.dtbo \
+ overlay_2.dtbo \
+ overlay_3.dtbo \
+ overlay_4.dtbo \
+ overlay_5.dtbo \
+ overlay_6.dtbo \
+ overlay_7.dtbo \
+ overlay_8.dtbo \
+ overlay_9.dtbo \
+ overlay_10.dtbo \
+ overlay_11.dtbo \
+ overlay_12.dtbo \
+ overlay_13.dtbo \
+ overlay_15.dtbo \
+ overlay_gpio_01.dtbo \
+ overlay_gpio_02a.dtbo \
+ overlay_gpio_02b.dtbo \
+ overlay_gpio_03.dtbo \
+ overlay_gpio_04a.dtbo \
+ overlay_gpio_04b.dtbo
+
+apply_static_overlay_2 := overlay.dtbo
+
+static_test_1-dtbs := static_base_1.dtb $(apply_static_overlay_1)
+static_test_2-dtbs := static_base_2.dtb $(apply_static_overlay_2)
+
+dtb-$(CONFIG_OF_OVERLAY) += static_test_1.dtb static_test_2.dtb
diff --git a/drivers/of/unittest-data/static_base_1.dts b/drivers/of/unittest-data/static_base_1.dts
new file mode 100644
index 000000000000..10556cb3f01f
--- /dev/null
+++ b/drivers/of/unittest-data/static_base_1.dts
@@ -0,0 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0
+/dts-v1/;
+
+#include "testcases_common.dtsi"
diff --git a/drivers/of/unittest-data/static_base_2.dts b/drivers/of/unittest-data/static_base_2.dts
new file mode 100644
index 000000000000..b0ea9504d6f3
--- /dev/null
+++ b/drivers/of/unittest-data/static_base_2.dts
@@ -0,0 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0
+/dts-v1/;
+
+#include "overlay_common.dtsi"
--
2.25.0.rc1.19.g042ed3e048af

2021-02-12 11:21:59

by Viresh Kumar

[permalink] [raw]
Subject: [PATCH V8 1/4] kbuild: Simplify builds with CONFIG_OF_ALL_DTBS

We update 'extra-y' based on CONFIG_OF_ALL_DTBS three times. It would be
far more straight forward if we rather update dtb-y to include all .dtb
files if CONFIG_OF_ALL_DTBS is enabled.

Signed-off-by: Viresh Kumar <[email protected]>
---
scripts/Makefile.lib | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index b00855b247e0..fa0db696120f 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -81,14 +81,13 @@ always-y += $(userprogs-always-y) $(userprogs-always-m)

# DTB
# If CONFIG_OF_ALL_DTBS is enabled, all DT blobs are built
+dtb-$(CONFIG_OF_ALL_DTBS) += $(dtb-)
+
extra-y += $(dtb-y)
-extra-$(CONFIG_OF_ALL_DTBS) += $(dtb-)

ifneq ($(CHECK_DTBS),)
extra-y += $(patsubst %.dtb,%.dt.yaml, $(dtb-y))
extra-y += $(patsubst %.dtbo,%.dt.yaml, $(dtb-y))
-extra-$(CONFIG_OF_ALL_DTBS) += $(patsubst %.dtb,%.dt.yaml, $(dtb-))
-extra-$(CONFIG_OF_ALL_DTBS) += $(patsubst %.dtbo,%.dt.yaml, $(dtb-))
endif

# Add subdir path
--
2.25.0.rc1.19.g042ed3e048af

2021-02-12 11:22:57

by Viresh Kumar

[permalink] [raw]
Subject: [PATCH V8 2/4] kbuild: Add generic rule to apply fdtoverlay

From: Rob Herring <[email protected]>

Add a generic rule to apply fdtoverlay in Makefile.lib, so every
platform doesn't need to carry the complex rule.

The platform's Makefile only needs to have this now:

DTC_FLAGS_foo_base += -@
foo-dtbs := foo_base.dtb foo_overlay1.dtbo foo_overlay2.dtbo
dtb-y := foo.dtb

We don't want to run schema checks on foo.dtb (as foo.dts doesn't exist)
and the Makefile is updated accordingly.

Signed-off-by: Rob Herring <[email protected]>
Co-developed-by: Viresh Kumar <[email protected]>
Signed-off-by: Viresh Kumar <[email protected]>
---
scripts/Makefile.lib | 24 ++++++++++++++++++++++--
1 file changed, 22 insertions(+), 2 deletions(-)

diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index fa0db696120f..3c450bfec015 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -66,6 +66,10 @@ multi-used := $(multi-used-y) $(multi-used-m)
real-obj-y := $(foreach m, $(obj-y), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-))),$($(m:.o=-objs)) $($(m:.o=-y)),$(m)))
real-obj-m := $(foreach m, $(obj-m), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m)) $($(m:.o=-))),$($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m)),$(m)))

+# List all dtbs to be generated by fdtoverlay
+overlay-y := $(foreach m,$(dtb-y), $(if $(strip $($(m:.dtb=-dtbs))),$(m),))
+overlay-$(CONFIG_OF_ALL_DTBS) += $(foreach m,$(dtb-), $(if $(strip $($(m:.dtb=-dtbs))),$(m),))
+
always-y += $(always-m)

# hostprogs-always-y += foo
@@ -80,14 +84,21 @@ userprogs += $(userprogs-always-y) $(userprogs-always-m)
always-y += $(userprogs-always-y) $(userprogs-always-m)

# DTB
+# Add base dtb and overlay dtbo
+dtb-y += $(foreach m,$(overlay-y), $($(m:.dtb=-dtbs)))
+
# If CONFIG_OF_ALL_DTBS is enabled, all DT blobs are built
dtb-$(CONFIG_OF_ALL_DTBS) += $(dtb-)

extra-y += $(dtb-y)

ifneq ($(CHECK_DTBS),)
-extra-y += $(patsubst %.dtb,%.dt.yaml, $(dtb-y))
-extra-y += $(patsubst %.dtbo,%.dt.yaml, $(dtb-y))
+# Don't run schema checks for dtbs created by fdtoverlay as they don't
+# have corresponding dts files.
+dt-yaml-y := $(filter-out $(overlay-y),$(dtb-y))
+
+extra-y += $(patsubst %.dtb,%.dt.yaml, $(dt-yaml-y))
+extra-y += $(patsubst %.dtbo,%.dt.yaml, $(dt-yaml-y))
endif

# Add subdir path
@@ -331,6 +342,15 @@ $(obj)/%.dtb: $(src)/%.dts $(DTC) FORCE
$(obj)/%.dtbo: $(src)/%.dts $(DTC) FORCE
$(call if_changed_dep,dtc)

+overlay-y := $(addprefix $(obj)/, $(overlay-y))
+
+quiet_cmd_fdtoverlay = DTOVL $@
+ cmd_fdtoverlay = $(objtree)/scripts/dtc/fdtoverlay -o $@ -i $(real-prereqs)
+
+$(overlay-y): FORCE
+ $(call if_changed,fdtoverlay)
+$(call multi_depend, $(overlay-y), .dtb, -dtbs)
+
DT_CHECKER ?= dt-validate
DT_BINDING_DIR := Documentation/devicetree/bindings
# DT_TMP_SCHEMA may be overridden from Documentation/devicetree/bindings/Makefile
--
2.25.0.rc1.19.g042ed3e048af

2021-02-12 11:23:20

by Viresh Kumar

[permalink] [raw]
Subject: [PATCH V8 3/4] of: unittest: Create overlay_common.dtsi and testcases_common.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 counterparts. 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 by a later commit).

This is required because the base files passed to fdtoverlay tool
shouldn't be overlays themselves (i.e. shouldn't have the /plugin/;
tag).

Note that this commit also moves "testcase-device2" node to
testcases.dts from tests-interrupts.dtsi, as this node has a deliberate
error in it and is only relevant for runtime testing done with
unittest.c.

Signed-off-by: Viresh Kumar <[email protected]>
---
drivers/of/unittest-data/overlay_base.dts | 90 +-----------------
drivers/of/unittest-data/overlay_common.dtsi | 91 +++++++++++++++++++
drivers/of/unittest-data/testcases.dts | 18 ++--
.../of/unittest-data/testcases_common.dtsi | 19 ++++
.../of/unittest-data/tests-interrupts.dtsi | 7 --
5 files changed, 118 insertions(+), 107 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/;

-/*
- * 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..04b9e7bb30d9 100644
--- a/drivers/of/unittest-data/testcases.dts
+++ b/drivers/of/unittest-data/testcases.dts
@@ -2,19 +2,15 @@
/dts-v1/;
/plugin/;

+#include "testcases_common.dtsi"
+
/ {
testcase-data {
- changeset {
- prop-update = "hello";
- prop-remove = "world";
- node-remove {
- };
+ testcase-device2 {
+ compatible = "testcase-device";
+ interrupt-parent = <&test_intc2>;
+ interrupts = <1>; /* invalid specifier - too short */
};
};
+
};
-#include "tests-phandle.dtsi"
-#include "tests-interrupts.dtsi"
-#include "tests-match.dtsi"
-#include "tests-address.dtsi"
-#include "tests-platform.dtsi"
-#include "tests-overlay.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..19292bbb4cbb
--- /dev/null
+++ b/drivers/of/unittest-data/testcases_common.dtsi
@@ -0,0 +1,19 @@
+// 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"
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 */
- };
};
-
};
--
2.25.0.rc1.19.g042ed3e048af

2021-03-02 18:48:40

by Frank Rowand

[permalink] [raw]
Subject: Re: [PATCH V8 3/4] of: unittest: Create overlay_common.dtsi and testcases_common.dtsi

Hi Viresh,

I commented on this patch in v7 after you had created v8. You acknowledged
that comment and said that it will be corrected.

-Frank

On 2/12/21 5:18 AM, 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 counterparts. 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 by a later commit).
>
> This is required because the base files passed to fdtoverlay tool
> shouldn't be overlays themselves (i.e. shouldn't have the /plugin/;
> tag).
>
> Note that this commit also moves "testcase-device2" node to
> testcases.dts from tests-interrupts.dtsi, as this node has a deliberate
> error in it and is only relevant for runtime testing done with
> unittest.c.
>
> Signed-off-by: Viresh Kumar <[email protected]>
> ---
> drivers/of/unittest-data/overlay_base.dts | 90 +-----------------
> drivers/of/unittest-data/overlay_common.dtsi | 91 +++++++++++++++++++
> drivers/of/unittest-data/testcases.dts | 18 ++--
> .../of/unittest-data/testcases_common.dtsi | 19 ++++
> .../of/unittest-data/tests-interrupts.dtsi | 7 --
> 5 files changed, 118 insertions(+), 107 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/;
>
> -/*
> - * 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..04b9e7bb30d9 100644
> --- a/drivers/of/unittest-data/testcases.dts
> +++ b/drivers/of/unittest-data/testcases.dts
> @@ -2,19 +2,15 @@
> /dts-v1/;
> /plugin/;
>
> +#include "testcases_common.dtsi"
> +
> / {
> testcase-data {
> - changeset {
> - prop-update = "hello";
> - prop-remove = "world";
> - node-remove {
> - };
> + testcase-device2 {
> + compatible = "testcase-device";
> + interrupt-parent = <&test_intc2>;
> + interrupts = <1>; /* invalid specifier - too short */
> };
> };
> +
> };
> -#include "tests-phandle.dtsi"
> -#include "tests-interrupts.dtsi"
> -#include "tests-match.dtsi"
> -#include "tests-address.dtsi"
> -#include "tests-platform.dtsi"
> -#include "tests-overlay.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..19292bbb4cbb
> --- /dev/null
> +++ b/drivers/of/unittest-data/testcases_common.dtsi
> @@ -0,0 +1,19 @@
> +// 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"
> 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 */
> - };
> };
> -
> };
>

2021-03-02 18:48:41

by Frank Rowand

[permalink] [raw]
Subject: Re: [PATCH V8 0/4] dt: Add fdtoverlay rule and statically build unittest

Hi Viresh,

On 3/1/21 12:56 AM, Viresh Kumar wrote:
> On 12-02-21, 16:48, Viresh Kumar wrote:
>> Hi,
>>
>> This patchset adds a generic rule for applying overlays using fdtoverlay
>> tool and then updates unittests to get built statically using the same.
>>
>> V7->V8:
>> - Patch 1 is new.
>> - Platforms need to use dtb-y += foo.dtb instead of overlay-y +=
>> foo.dtb.
>> - Use multi_depend instead of .SECONDEXPANSION.
>> - Use dtb-y for unittest instead of overlay-y.
>> - Rename the commented dtb filess in unittest Makefile as .dtbo.
>> - Improved Makefile code (I am learning a lot every day :)
>
> Ping!
>

Please respin on 5.12-rc1, and pull in the change you said
you would make in response to my post v8 comment about the
v7 patches.

-Frank

2021-03-02 19:12:41

by Viresh Kumar

[permalink] [raw]
Subject: Re: [PATCH V8 0/4] dt: Add fdtoverlay rule and statically build unittest

On 01-03-21, 21:14, Frank Rowand wrote:
> Hi Viresh,
>
> On 3/1/21 12:56 AM, Viresh Kumar wrote:
> > On 12-02-21, 16:48, Viresh Kumar wrote:
> >> Hi,
> >>
> >> This patchset adds a generic rule for applying overlays using fdtoverlay
> >> tool and then updates unittests to get built statically using the same.
> >>
> >> V7->V8:
> >> - Patch 1 is new.
> >> - Platforms need to use dtb-y += foo.dtb instead of overlay-y +=
> >> foo.dtb.
> >> - Use multi_depend instead of .SECONDEXPANSION.
> >> - Use dtb-y for unittest instead of overlay-y.
> >> - Rename the commented dtb filess in unittest Makefile as .dtbo.
> >> - Improved Makefile code (I am learning a lot every day :)
> >
> > Ping!
> >
>
> Please respin on 5.12-rc1, and pull in the change you said
> you would make in response to my post v8 comment about the
> v7 patches.

Yes, I will do that.

I must have been more explicit about the Ping I believe. It was
more for Masahiro and Rob to see if the kbuild stuff (which is
relatively new) makes sense or not before I respin this..

--
viresh

2021-03-03 00:14:36

by Viresh Kumar

[permalink] [raw]
Subject: Re: [PATCH V8 0/4] dt: Add fdtoverlay rule and statically build unittest

On 12-02-21, 16:48, Viresh Kumar wrote:
> Hi,
>
> This patchset adds a generic rule for applying overlays using fdtoverlay
> tool and then updates unittests to get built statically using the same.
>
> V7->V8:
> - Patch 1 is new.
> - Platforms need to use dtb-y += foo.dtb instead of overlay-y +=
> foo.dtb.
> - Use multi_depend instead of .SECONDEXPANSION.
> - Use dtb-y for unittest instead of overlay-y.
> - Rename the commented dtb filess in unittest Makefile as .dtbo.
> - Improved Makefile code (I am learning a lot every day :)

Ping!

--
viresh

2021-03-04 07:15:31

by Rob Herring

[permalink] [raw]
Subject: Re: [PATCH V8 0/4] dt: Add fdtoverlay rule and statically build unittest

On Mon, Mar 1, 2021 at 10:03 PM Viresh Kumar <[email protected]> wrote:
>
> On 01-03-21, 21:14, Frank Rowand wrote:
> > Hi Viresh,
> >
> > On 3/1/21 12:56 AM, Viresh Kumar wrote:
> > > On 12-02-21, 16:48, Viresh Kumar wrote:
> > >> Hi,
> > >>
> > >> This patchset adds a generic rule for applying overlays using fdtoverlay
> > >> tool and then updates unittests to get built statically using the same.
> > >>
> > >> V7->V8:
> > >> - Patch 1 is new.
> > >> - Platforms need to use dtb-y += foo.dtb instead of overlay-y +=
> > >> foo.dtb.
> > >> - Use multi_depend instead of .SECONDEXPANSION.
> > >> - Use dtb-y for unittest instead of overlay-y.
> > >> - Rename the commented dtb filess in unittest Makefile as .dtbo.
> > >> - Improved Makefile code (I am learning a lot every day :)
> > >
> > > Ping!
> > >
> >
> > Please respin on 5.12-rc1, and pull in the change you said
> > you would make in response to my post v8 comment about the
> > v7 patches.
>
> Yes, I will do that.
>
> I must have been more explicit about the Ping I believe. It was
> more for Masahiro and Rob to see if the kbuild stuff (which is
> relatively new) makes sense or not before I respin this..

LGTM, I was mainly waiting on Acks from Masahiro and Frank.

Rob