Message ID | 1440034170-20249-2-git-send-email-benh@kernel.crashing.org |
---|---|
State | Accepted |
Headers | show |
On Thu, 2015-08-20 at 11:29 +1000, Benjamin Herrenschmidt wrote: > This is a temporary workaround. We disable the code that adds the > "-T" portion of the location code to network devices on non-FSP machines. > > This code is a bit fragile, and it does incorrect things on dual-slot > mezzanines such as the one in Habanero. If we need to support this > on OpenPower, we will need to add a concept of sibling slots to the > infrastructure to properly handle the numbering. > The entire code is a messy hack that happens to work but isn't correct in the general case. (I know this because I wrote it.) We ultimately need a better way of correctly numbering ports on network adapters - I think Ben suggested this was usually done by some (Forth?) code on the card? > Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> > --- > core/pci.c | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) > > diff --git a/core/pci.c b/core/pci.c > index 479c435..1c2247e 100644 > --- a/core/pci.c > +++ b/core/pci.c > @@ -1180,7 +1180,11 @@ static void pci_add_loc_code(struct dt_node *np, struct pci_device *pd) > class_code = dt_prop_get_u32(np, "class-code"); > class = class_code >> 16; > sub = (class_code >> 8) & 0xff; > - if (class == 0x02 && sub == 0x00) { > + > + /* XXX Don't do that on openpower for now, we will need to sort things > + * out later, otherwise the mezzanine slot on Habanero gets weird results > + */ > + if (class == 0x02 && sub == 0x00 && fsp_present()) { > /* There's usually several spaces at the end of the property. > Test for, but don't rely on, that being the case */ > len = strlen(blcode);
On Fri, 2015-08-21 at 13:13 +1000, Daniel Axtens wrote: > On Thu, 2015-08-20 at 11:29 +1000, Benjamin Herrenschmidt wrote: > > This is a temporary workaround. We disable the code that adds the > > "-T" portion of the location code to network devices on non-FSP machines. > > > > This code is a bit fragile, and it does incorrect things on dual-slot > > mezzanines such as the one in Habanero. If we need to support this > > on OpenPower, we will need to add a concept of sibling slots to the > > infrastructure to properly handle the numbering. > > > > The entire code is a messy hack that happens to work but isn't correct > in the general case. (I know this because I wrote it.) > > We ultimately need a better way of correctly numbering ports on network > adapters - I think Ben suggested this was usually done by some (Forth?) > code on the card? That or some UEFI ... :-) For the special case of the mezzanine on Habanero we could put some logic in the platform code but it's not urgent. > > Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> > > --- > > core/pci.c | 6 +++++- > > 1 file changed, 5 insertions(+), 1 deletion(-) > > > > diff --git a/core/pci.c b/core/pci.c > > index 479c435..1c2247e 100644 > > --- a/core/pci.c > > +++ b/core/pci.c > > @@ -1180,7 +1180,11 @@ static void pci_add_loc_code(struct dt_node *np, struct pci_device *pd) > > > > > > class_code = dt_prop_get_u32(np, "class-code"); > > > > > > class = class_code >> 16; > > > > > > sub = (class_code >> 8) & 0xff; > > -> > > > if (class == 0x02 && sub == 0x00) { > > + > > +> > > > /* XXX Don't do that on openpower for now, we will need to sort things > > +> > > > * out later, otherwise the mezzanine slot on Habanero gets weird results > > +> > > > */ > > +> > > > if (class == 0x02 && sub == 0x00 && fsp_present()) { > > > > > > > > /* There's usually several spaces at the end of the property. > > > > > > > > Test for, but don't rely on, that being the case */ > > > > > > > > len = strlen(blcode); >
diff --git a/core/pci.c b/core/pci.c index 479c435..1c2247e 100644 --- a/core/pci.c +++ b/core/pci.c @@ -1180,7 +1180,11 @@ static void pci_add_loc_code(struct dt_node *np, struct pci_device *pd) class_code = dt_prop_get_u32(np, "class-code"); class = class_code >> 16; sub = (class_code >> 8) & 0xff; - if (class == 0x02 && sub == 0x00) { + + /* XXX Don't do that on openpower for now, we will need to sort things + * out later, otherwise the mezzanine slot on Habanero gets weird results + */ + if (class == 0x02 && sub == 0x00 && fsp_present()) { /* There's usually several spaces at the end of the property. Test for, but don't rely on, that being the case */ len = strlen(blcode);
This is a temporary workaround. We disable the code that adds the "-T" portion of the location code to network devices on non-FSP machines. This code is a bit fragile, and it does incorrect things on dual-slot mezzanines such as the one in Habanero. If we need to support this on OpenPower, we will need to add a concept of sibling slots to the infrastructure to properly handle the numbering. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> --- core/pci.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)