From: Russell Currey <ruscur@russell.cc>
To: Gavin Shan <gwshan@linux.vnet.ibm.com>, linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH] powerpc/eeh: Fix PE location code
Date: Wed, 20 Jan 2016 14:56:13 +1100 [thread overview]
Message-ID: <1453262173.1201.2.camel@russell.cc> (raw)
In-Reply-To: <1449033932-27307-1-git-send-email-gwshan@linux.vnet.ibm.com>
On Wed, 2015-12-02 at 16:25 +1100, Gavin Shan wrote:
> In eeh_pe_loc_get(), the PE location code is retrieved from the
> "ibm,loc-code" property of the device node for the bridge of the
> PE's primary bus. It's not correct because the property indicates
> the parent PE's location code.
>
> This reads the correct PE location code from "ibm,io-base-loc-code"
> or "ibm,slot-location-code" property of PE parent bus's device node.
>
> Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
> ---
Tested-by: Russell Currey <ruscur@russell.cc>
> arch/powerpc/kernel/eeh_pe.c | 33 +++++++++++++++------------------
> 1 file changed, 15 insertions(+), 18 deletions(-)
>
> diff --git a/arch/powerpc/kernel/eeh_pe.c b/arch/powerpc/kernel/eeh_pe.c
> index 8654cb1..ca9e537 100644
> --- a/arch/powerpc/kernel/eeh_pe.c
> +++ b/arch/powerpc/kernel/eeh_pe.c
> @@ -883,32 +883,29 @@ void eeh_pe_restore_bars(struct eeh_pe *pe)
> const char *eeh_pe_loc_get(struct eeh_pe *pe)
> {
> struct pci_bus *bus = eeh_pe_bus_get(pe);
> - struct device_node *dn = pci_bus_to_OF_node(bus);
> + struct device_node *dn;
> const char *loc = NULL;
>
> - if (!dn)
> - goto out;
> + while (bus) {
> + dn = pci_bus_to_OF_node(bus);
> + if (!dn) {
> + bus = bus->parent;
> + continue;
> + }
>
> - /* PHB PE or root PE ? */
> - if (pci_is_root_bus(bus)) {
> - loc = of_get_property(dn, "ibm,loc-code", NULL);
> - if (!loc)
> + if (pci_is_root_bus(bus))
> loc = of_get_property(dn, "ibm,io-base-loc-
> code", NULL);
> + else
> + loc = of_get_property(dn, "ibm,slot-location-
> code",
> + NULL);
> +
> if (loc)
> - goto out;
> + return loc;
>
> - /* Check the root port */
> - dn = dn->child;
> - if (!dn)
> - goto out;
> + bus = bus->parent;
> }
>
> - loc = of_get_property(dn, "ibm,loc-code", NULL);
> - if (!loc)
> - loc = of_get_property(dn, "ibm,slot-location-code",
> NULL);
> -
> -out:
> - return loc ? loc : "N/A";
> + return "N/A";
> }
>
> /**
next prev parent reply other threads:[~2016-01-20 3:56 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-02 5:25 [PATCH] powerpc/eeh: Fix PE location code Gavin Shan
2016-01-19 22:41 ` Joel Stanley
2016-01-20 3:56 ` Russell Currey [this message]
2016-01-21 0:08 ` Sam Mendoza-Jonas
2016-01-21 5:59 ` Stewart Smith
2016-01-29 1:58 ` Michael Ellerman
-- strict thread matches above, loose matches on Subject: below --
2015-12-02 5:17 [PATCH] " Gavin Shan
2015-12-02 5:41 ` Gavin Shan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1453262173.1201.2.camel@russell.cc \
--to=ruscur@russell.cc \
--cc=gwshan@linux.vnet.ibm.com \
--cc=linuxppc-dev@lists.ozlabs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.