forked from beagleboard/linux
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
of: change overlay apply input data from unflattened to FDT
Move duplicating and unflattening of an overlay flattened devicetree (FDT) into the overlay application code. To accomplish this, of_overlay_apply() is replaced by of_overlay_fdt_apply(). The copy of the FDT (aka "duplicate FDT") now belongs to devicetree code, which is thus responsible for freeing the duplicate FDT. The caller of of_overlay_fdt_apply() remains responsible for freeing the original FDT. The unflattened devicetree now belongs to devicetree code, which is thus responsible for freeing the unflattened devicetree. These ownership changes prevent early freeing of the duplicated FDT or the unflattened devicetree, which could result in use after free errors. of_overlay_fdt_apply() is a private function for the anticipated overlay loader. Update unittest.c to use of_overlay_fdt_apply() instead of of_overlay_apply(). Move overlay fragments from artificial locations in drivers/of/unittest-data/tests-overlay.dtsi into one devicetree source file per overlay. This led to changes in drivers/of/unitest-data/Makefile and drivers/of/unitest.c. - Add overlay directives to the overlay devicetree source files so that dtc will compile them as true overlays into one FDT data chunk per overlay. - Set CFLAGS for drivers/of/unittest-data/testcases.dts so that symbols will be generated for overlay resolution of overlays that are no longer artificially contained in testcases.dts - Unflatten and apply each unittest overlay FDT using of_overlay_fdt_apply(). - Enable the of_resolve_phandles() check for whether the unflattened overlay is detached. This check was previously disabled because the overlays from tests-overlay.dtsi were not unflattened into detached trees. - Other changes to unittest.c infrastructure to manage multiple test FDTs built into the kernel image (access by name instead of arbitrary number). - of_unittest_overlay_high_level(): previously unused code to add properties from the overlay_base devicetree to the live tree was triggered by the restructuring of tests-overlay.dtsi and thus testcases.dts. This exposed two bugs: (1) the need to dup a property before adding it, and (2) property 'name' is auto-generated in the unflatten code and thus will be a duplicate in the __symbols__ node - do not treat this duplicate as an error. Signed-off-by: Frank Rowand <[email protected]>
- Loading branch information
Showing
22 changed files
with
562 additions
and
388 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// SPDX-License-Identifier: GPL-2.0 | ||
/dts-v1/; | ||
/plugin/; | ||
|
||
/ { | ||
/* overlay_0 - enable using absolute target path */ | ||
|
||
fragment@0 { | ||
target-path = "/testcase-data/overlay-node/test-bus/test-unittest0"; | ||
__overlay__ { | ||
status = "okay"; | ||
}; | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// SPDX-License-Identifier: GPL-2.0 | ||
/dts-v1/; | ||
/plugin/; | ||
|
||
/ { | ||
/* overlay_1 - disable using absolute target path */ | ||
|
||
fragment@0 { | ||
target-path = "/testcase-data/overlay-node/test-bus/test-unittest1"; | ||
__overlay__ { | ||
status = "disabled"; | ||
}; | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// SPDX-License-Identifier: GPL-2.0 | ||
/dts-v1/; | ||
/plugin/; | ||
|
||
/ { | ||
/* overlay_10 */ | ||
/* overlays 8, 9, 10, 11 application and removal in bad sequence */ | ||
|
||
fragment@0 { | ||
target-path = "/testcase-data/overlay-node/test-bus"; | ||
__overlay__ { | ||
|
||
/* suppress DTC warning */ | ||
#address-cells = <1>; | ||
#size-cells = <0>; | ||
|
||
test-unittest10 { | ||
compatible = "unittest"; | ||
status = "okay"; | ||
reg = <10>; | ||
|
||
#address-cells = <1>; | ||
#size-cells = <0>; | ||
|
||
test-unittest101 { | ||
compatible = "unittest"; | ||
status = "okay"; | ||
reg = <1>; | ||
}; | ||
|
||
}; | ||
}; | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// SPDX-License-Identifier: GPL-2.0 | ||
/dts-v1/; | ||
/plugin/; | ||
|
||
/ { | ||
/* overlay_11 */ | ||
/* overlays 8, 9, 10, 11 application and removal in bad sequence */ | ||
|
||
fragment@0 { | ||
target-path = "/testcase-data/overlay-node/test-bus"; | ||
__overlay__ { | ||
|
||
/* suppress DTC warning */ | ||
#address-cells = <1>; | ||
#size-cells = <0>; | ||
|
||
test-unittest11 { | ||
compatible = "unittest"; | ||
status = "okay"; | ||
reg = <11>; | ||
|
||
#address-cells = <1>; | ||
#size-cells = <0>; | ||
|
||
test-unittest111 { | ||
compatible = "unittest"; | ||
status = "okay"; | ||
reg = <1>; | ||
}; | ||
|
||
}; | ||
}; | ||
}; | ||
}; |
Oops, something went wrong.