Message ID | 20190503063621.20380-1-stewart@linux.ibm.com |
---|---|
State | Accepted |
Headers | show |
Series | pci: Try harder to add meaningful ibm,loc-code | expand |
Stewart Smith <stewart@linux.ibm.com> writes: > We keep the existing logic of looking to the parent for the slot-label or > slot-location-code, but we add logic to (if all that fails) we look > directly for the slot-location-code (as this should give us the correct > loc code for things directly under the PHB), and otherwise we just look > for a loc-code. > > The applicable bit of PAPR here is: > > R1–12.1–1. Each instance of a hardware entity (FRU) has a platform > unique location code and any node in the OF > device tree that describes a part of a hardware entity must include the > “ibm,loc-code” property with a > value that represents the location code for that hardware entity. > > which we weren't really fully obeying at any recent (ever?) point in > time. Now we should do okay, at least for PCI. > > Signed-off-by: Stewart Smith <stewart@linux.ibm.com> Merged as of 119108908e9b1de9a3f24f27a16f4efe4ca3a0b4. Hopefully everething is smooth with it and we're at an okay state. I only think I proved this all to myself, so it complies with my version of reality at least.
diff --git a/core/pci.c b/core/pci.c index 85f3f722bf38..4a83c718beb4 100644 --- a/core/pci.c +++ b/core/pci.c @@ -1437,6 +1437,21 @@ static void pci_add_loc_code(struct dt_node *np, struct pci_device *pd) p = p->parent; } + if (!blcode) + blcode = dt_prop_get_def(np, "ibm,slot-location-code", NULL); + + if (!blcode) { + /* Fall back to finding a ibm,loc-code */ + p = np->parent; + + while (p) { + blcode = dt_prop_get_def(p, "ibm,loc-code", NULL); + if (blcode) + break; + p = p->parent; + } + } + if (!blcode) return;
We keep the existing logic of looking to the parent for the slot-label or slot-location-code, but we add logic to (if all that fails) we look directly for the slot-location-code (as this should give us the correct loc code for things directly under the PHB), and otherwise we just look for a loc-code. The applicable bit of PAPR here is: R1–12.1–1. Each instance of a hardware entity (FRU) has a platform unique location code and any node in the OF device tree that describes a part of a hardware entity must include the “ibm,loc-code” property with a value that represents the location code for that hardware entity. which we weren't really fully obeying at any recent (ever?) point in time. Now we should do okay, at least for PCI. Signed-off-by: Stewart Smith <stewart@linux.ibm.com> --- core/pci.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)