Re: [PATCH] of: unittest: Statically apply overlays using fdtoverlay
From: Bill Mills <hidden>
Date: 2021-01-12 01:23:54
Also in:
linux-kbuild, lkml
On 1/11/21 5:06 PM, Frank Rowand wrote:
On 1/8/21 2:41 AM, Viresh Kumar wrote:quoted
Now that fdtoverlay is part of the kernel build, start using it to test the unitest overlays we have by applying them statically. The file overlay_base.dtb have symbols of its own and we need to apply overlay.dtb to overlay_base.dtb alone first to make it work, which gives us intermediate-overlay.dtb file. The intermediate-overlay.dtb file along with all other overlays is them applied to testcases.dtb to generate the master.dtb file. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>NACK to this specific patch, in its current form. There are restrictions on applying an overlay at runtime that do not apply to applying an overlay to an FDT that will be loaded by the kernel during early boot. Thus the unittest overlays _must_ be applied using the kernel overlay loading methods to test the kernel runtime overlay loading feature. I agree that testing fdtoverlay is a good idea. I have not looked at the parent project to see how much testing of fdtoverlay occurs there, but I would prefer that fdtoverlay tests reside in the parent project if practical and reasonable. If there is some reason that some fdtoverlay tests are more practical in the Linux kernel repository then I am open to adding them to the Linux kernel tree.
Frank, I thought we were aligned that any new overlays into the kernel today would only be for boot loader applied case. Applying overlays at kernel runtime was out of scope at your request. Rob had requested that the overlays be test applied at build time. I don't think there is any way to test the kernel runtime method at build time correct? Please clarify your concern and your suggested way forward. Thanks, Bill
-Frankquoted
--- Depends on: https://lore.kernel.org/lkml/be5cb12a68d9ac2c35ad9dd50d6b168f7cad6837.1609996381.git.viresh.kumar@linaro.org/ (local) I have kept the .dtb naming for overlays for now, lets see how we do it eventually. Rob/Frank, this doesn't work properly right now. Maybe I missed how these overlays must be applied or there is a bug in fdtoverlay. The master.dtb doesn't include any nodes from overlay_base.dtb or overlay.dtb probably because 'testcase-data-2' node isn't present in testcases.dtb and fdtoverlay doesn't allow applying new nodes to the root node, i.e. allows new sub-nodes once it gets phandle to the parent but nothing can be added to the root node itself. Though I get a feel that it works while applying the nodes dynamically and it is expected to work here as well. (And yeah, this is my first serious attempt at updating Makefiles, I am sure there is a scope of improvement here :)) --- drivers/of/unittest-data/Makefile | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+)diff --git a/drivers/of/unittest-data/Makefile b/drivers/of/unittest-data/Makefile index 009f4045c8e4..f17bce85f65f 100644 --- a/drivers/of/unittest-data/Makefile +++ b/drivers/of/unittest-data/Makefile@@ -38,3 +38,26 @@ DTC_FLAGS_testcases += -@ # suppress warnings about intentional errors DTC_FLAGS_testcases += -Wno-interrupts_property + +# Apply overlays statically with fdtoverlay +intermediate-overlay := overlay.dtb +master := overlay_0.dtb overlay_1.dtb overlay_2.dtb \ + overlay_3.dtb overlay_4.dtb overlay_5.dtb \ + overlay_6.dtb overlay_7.dtb overlay_8.dtb \ + overlay_9.dtb overlay_10.dtb overlay_11.dtb \ + overlay_12.dtb overlay_13.dtb overlay_15.dtb \ + overlay_gpio_01.dtb overlay_gpio_02a.dtb \ + overlay_gpio_02b.dtb overlay_gpio_03.dtb \ + overlay_gpio_04a.dtb overlay_gpio_04b.dtb \ + intermediate-overlay.dtb + +quiet_cmd_fdtoverlay = fdtoverlay $@ + cmd_fdtoverlay = $(objtree)/scripts/dtc/fdtoverlay -o $@ -i $^ + +$(obj)/intermediate-overlay.dtb: $(obj)/overlay_base.dtb $(addprefix $(obj)/,$(intermediate-overlay)) + $(call if_changed,fdtoverlay) + +$(obj)/master.dtb: $(obj)/testcases.dtb $(addprefix $(obj)/,$(master)) + $(call if_changed,fdtoverlay) + +always-$(CONFIG_OF_OVERLAY) += intermediate-overlay.dtb master.dtb
-- Bill Mills Principal Technical Consultant, Linaro +1-240-643-0836 TZ: US Eastern Work Schedule: Tues/Wed/Thur