Message ID | 20220802105723.1055178-1-mpe@ellerman.id.au (mailing list archive) |
---|---|
State | Accepted |
Headers | show |
Series | powerpc/pci: Fix PHB numbering when using opal-phbid | expand |
Context | Check | Description |
---|---|---|
snowpatch_ozlabs/github-powerpc_selftests | success | Successfully ran 10 jobs. |
snowpatch_ozlabs/github-powerpc_ppctests | success | Successfully ran 10 jobs. |
snowpatch_ozlabs/github-powerpc_sparse | success | Successfully ran 4 jobs. |
snowpatch_ozlabs/github-powerpc_kernel_qemu | success | Successfully ran 23 jobs. |
On Tuesday 02 August 2022 20:57:23 Michael Ellerman wrote: > The recent change to the PHB numbering logic has a logic error in the > handling of "ibm,opal-phbid". > > When an "ibm,opal-phbid" property is present, &prop is written to and > ret is set to zero. > > The following call to of_alias_get_id() is skipped because ret == 0. > > But then the if (ret >= 0) is true, and the body of that if statement > sets prop = ret which throws away the value that was just read from > "ibm,opal-phbid". Now I see, I wrote logic incorrectly. > Fix the logic by only doing the ret >= 0 check in the of_alias_get_id() > case. > > Fixes: 0fe1e96fef0a ("powerpc/pci: Prefer PCI domain assignment via DT 'linux,pci-domain' and alias") > Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Your change should fix this issue, so: Reviewed-by: Pali Rohár <pali@kernel.org> > --- > arch/powerpc/kernel/pci-common.c | 10 ++++++---- > 1 file changed, 6 insertions(+), 4 deletions(-) > > diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c > index 8ce36aba42da..bdd3332200c5 100644 > --- a/arch/powerpc/kernel/pci-common.c > +++ b/arch/powerpc/kernel/pci-common.c > @@ -91,11 +91,13 @@ static int get_phb_number(struct device_node *dn) > } > if (ret) > ret = of_property_read_u64(dn, "ibm,opal-phbid", &prop); > - if (ret) > + > + if (ret) { > ret = of_alias_get_id(dn, "pci"); > - if (ret >= 0) { > - prop = ret; > - ret = 0; > + if (ret >= 0) { > + prop = ret; > + ret = 0; > + } > } > if (ret) { > u32 prop_32; > -- > 2.35.3 >
On Tue, 2 Aug 2022 20:57:23 +1000, Michael Ellerman wrote: > The recent change to the PHB numbering logic has a logic error in the > handling of "ibm,opal-phbid". > > When an "ibm,opal-phbid" property is present, &prop is written to and > ret is set to zero. > > The following call to of_alias_get_id() is skipped because ret == 0. > > [...] Applied to powerpc/next. [1/1] powerpc/pci: Fix PHB numbering when using opal-phbid https://git.kernel.org/powerpc/c/f4b39e88b42d13366b831270306326b5c20971ca cheers
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c index 8ce36aba42da..bdd3332200c5 100644 --- a/arch/powerpc/kernel/pci-common.c +++ b/arch/powerpc/kernel/pci-common.c @@ -91,11 +91,13 @@ static int get_phb_number(struct device_node *dn) } if (ret) ret = of_property_read_u64(dn, "ibm,opal-phbid", &prop); - if (ret) + + if (ret) { ret = of_alias_get_id(dn, "pci"); - if (ret >= 0) { - prop = ret; - ret = 0; + if (ret >= 0) { + prop = ret; + ret = 0; + } } if (ret) { u32 prop_32;
The recent change to the PHB numbering logic has a logic error in the handling of "ibm,opal-phbid". When an "ibm,opal-phbid" property is present, &prop is written to and ret is set to zero. The following call to of_alias_get_id() is skipped because ret == 0. But then the if (ret >= 0) is true, and the body of that if statement sets prop = ret which throws away the value that was just read from "ibm,opal-phbid". Fix the logic by only doing the ret >= 0 check in the of_alias_get_id() case. Fixes: 0fe1e96fef0a ("powerpc/pci: Prefer PCI domain assignment via DT 'linux,pci-domain' and alias") Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> --- arch/powerpc/kernel/pci-common.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)