[PATCH v4 19/21] drivers/of: Support adding sub-tree
benh at kernel.crashing.org
Tue May 5 07:14:23 AEST 2015
On Mon, 2015-05-04 at 19:41 +0300, Pantelis Antoniou wrote:
> You get all of the corner cases handled for free. Perhaps it works for
> your case too.
> Perhaps you can educate me on what you need supported and we can make
> sure it’s included.
Which corner cases ?
IE, what I want is simply "update" the device-tree below a PCIe slot on
The DT isn't "compiled" from a dts (it's amazing how many people seem to
believe this is the only way you get fdt's nowadays). It's dynamically
(ie programatically) generated by firmware at boot time and contains
whatever PCIe devices happen to be plugged during boot.
When doing PCIe hotplug operations, the kernel does various FW calls
(among others to control slot power), and during these, the FW re-probes
underneath the slot and refreshes its internal representation. So the
phandles remain fully consistent, there is no fixup needed.
We want the kernel to also update his copy as wee in order to avoid
keeping stale nodes that don't match what's there anymore. Also, when
plugging specific kind of IO drawers, the FW can provide additional node
and properties that will be used to control slots inside the drawers.
So what we need is:
- On PCIe unplug, remove all old nodes below the slot
- On PCIe plug, get all the new nodes from FW
Note that there is no need to do anything like platform device probing
etc... the PCI layer takes care of that, we will remove the old nodes
after the pci_dev are gone and create the new ones before Linux
re-probes the PCIe bus subtree.
So what we need is very simple: The removal can be handled without FW
help, and the plug case is a matter of just transferring all those new
nodes to Linux to re-expand.
Since the phandle etc... are all consistent with the original tree,
there is no fixups required.
So the "trivial" way to do it (and the way we have implemented the FW
side so far) is to have the FW simply "flatten" the subtree below the
slot and pass it to Linux, with the intent of expanding it back below
the slot node.
This is what Gavin proposed patches do.
The overlay mechanism adds all sorts of features that we don't seen to
need and would make the above more complex.
More information about the Linuxppc-dev