crosvm/cros_fdt/test-files/overlay.dts
Jakob Vukalovic 12dead57f2 cros_fdt: Implement overlay filtering
For large overlay files, sometimes it is not neccessary to apply the
entire overlay, and only a few nodes must be applied instead. For
example, a large overlay file may contain nodes for all devices that can
be assigned to a VM via VFIO. However, in most cases only a small subset
of devices will actually be assigned, so only a small subset of the FDT
overlay must be applied.

This change implements device tree overlay filtering. Ie, it allows the
API user to choose which overlay nodes will be applied to the base.
It is possible to pass a set of symbols (node labels) to `apply_overlay`
function, which act as a filter for the device tree nodes.

This requires defining node labels (symbols) in DT source and compiling
DT overlays (`-@` option in dtc), so that the node symbols are exported
in `__symbols__` node.

Bug: b/296796644
Test: cd cros_fdt && cargo test
Change-Id: I2238cf08b85e1825f668f83d8edadd2446a28869
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4855967
Commit-Queue: Jakob Vukalović <jakobvukalovic@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
2023-11-10 09:38:05 +00:00

33 lines
534 B
Text

/dts-v1/;
/plugin/;
&{/} {
interrupt-parent = <&intc>;
#address-cells = <0x02>;
#size-cells = <0x02>;
mydev:mydev@8000000 {
compatible = "mydev";
reg = <0x00 0x8000000 0x00 0x1000>;
interrupts = <0x00 0x0f 0x04>;
phandle = <0x01>;
devnode1 {
prop1 = "value1";
prop2 = <0x01 0x02 0x03>;
};
};
mydev2:mydev@8001000 {
compatible = "mydev";
reg = <0x00 0x8001000 0x00 0x1000>;
interrupts = <0x00 0xff 0x04>;
phandle = <0x02>;
devnode1 {
prop1 = "value1";
prop2 = <0x01 0x02 0x03>;
};
};
};