[SLOF] [PATCH slof] fdt: Fix creating new nodes at H_CAS

Segher Boessenkool segher at kernel.crashing.org
Thu Jan 30 21:36:13 AEDT 2020


On Thu, Jan 30, 2020 at 08:47:40AM +0100, Greg Kurz wrote:
> On Wed, 29 Jan 2020 18:46:03 -0600
> Segher Boessenkool <segher at kernel.crashing.org> wrote:
> 
> > On Thu, Jan 30, 2020 at 10:09:56AM +1100, Alexey Kardashevskiy wrote:
> > > On 29/01/2020 22:33, Greg Kurz wrote:
> > > > "finish-device" only sets the first entry of the "reg" property as a
> > > > fallback. This will be an issue when we start seeing new nodes with
> > > > bigger unit values (eg, a new PHB).
> > 
> > finish-device should never change (or create or delete or whatever) any
> > property.  It should finish up the device node, and that's that.
> > 
> 
> Sorry I mis-phrased. "finish-device" sets the unit name according to
> the only the first entry of  "reg". It doesn't changes any property.

Ah okay, never mind, that is all just fine then :-)

Surgery here is although not necessarily fragile, certainly very touchy.

> > > > The setting of the unit from "reg" is actually handled by
> > > > "fdt-unflatten-node" which calls "fdt-reg-unit":
> > > > 
> > > >       2dup s" reg" str= IF
> > > >           2swap 2dup fdt-reg-unit 2swap
> > > >       THEN
> > > > 
> > > > Something similar could be done...
> > > 
> > > Huh. Should not we then fix "finish-device"?
> > 
> > This whole unit-address setting thing is an implementation detail in SLOF,
> > it's an optimisation.  It should be kept pretty much invisible.
> 
> Is this a suggestion to consolidate most if not all of the unit address
> setting in one place instead of adding _yet_ another guy that does it ?

It wasn't, but yes that is a good idea.  Now the trick of course is to
design a good interface for it, before changing 30 callers.

> > > > This doesn't address the case of a hotplug-over-hotplug since the
> > > > new parent node doesn't have a "decode-unit" method, but at least
> > > > it covers all cases where the parent node was created at boot time.
> > 
> > If a bus node has no decode-unit, you get problems.  Big problems.
> 
> Yeah I saw that when I tried to hotplug a PCI device on a hotplugged PHB.

They are not the kind of problems you easily overlook, yup.


Segher


More information about the SLOF mailing list