linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Kleber Sacilotto de Souza <klebers@linux.vnet.ibm.com>
To: tony@bakeyournoodle.com
Cc: David Airlie <airlied@linux.ie>,
	Brian King <brking@linux.vnet.ibm.com>,
	dri-devel@lists.freedesktop.org,
	Alex Deucher <alexander.deucher@amd.com>,
	Jerome Glisse <jglisse@redhat.com>,
	Thadeu Lima de Souza Cascardo <cascardo@linux.vnet.ibm.com>,
	Bjorn Helgaas <bhelgaas@google.com>,
	linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCHv4 1/2] ppc64: perform proper max_bus_speed detection
Date: Thu, 02 May 2013 12:21:37 -0300	[thread overview]
Message-ID: <51828481.2090406@linux.vnet.ibm.com> (raw)
In-Reply-To: <51796928.2050406@linux.vnet.ibm.com>

On 04/25/2013 02:34 PM, Lucas Kannebley Tavares wrote:
> On 04/24/2013 08:48 PM, Tony Breeds wrote:
>>> diff --git a/arch/powerpc/platforms/pseries/pci.c
>>> b/arch/powerpc/platforms/pseries/pci.c
>>> index 0b580f4..7f9c956 100644
>>> --- a/arch/powerpc/platforms/pseries/pci.c
>>> +++ b/arch/powerpc/platforms/pseries/pci.c
>>> @@ -108,3 +108,54 @@ static void fixup_winbond_82c105(struct pci_dev*
>>> dev)
>>>   }
>>>   DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_WINBOND,
>>> PCI_DEVICE_ID_WINBOND_82C105,
>>>                fixup_winbond_82c105);
>>> +
>>> +int pseries_root_bridge_prepare(struct pci_host_bridge *bridge)
>>> +{
>>> +    struct device_node *dn, *pdn;
>>> +    struct pci_bus *bus;
>>> +    const uint32_t *pcie_link_speed_stats;
>>> +
>>> +    bus = bridge->bus;
>>> +
>>> +    dn = pcibios_get_phb_of_node(bus);
>>> +    if (!dn)
>>> +        return 0;
>>> +
>>> +    for (pdn = dn; pdn != NULL; pdn = pdn->parent) {
>>> +        pcie_link_speed_stats = (const uint32_t *) of_get_property(dn,
>>> +            "ibm,pcie-link-speed-stats", NULL);
>>> +        if (pcie_link_speed_stats)
>>> +            break;
>>> +    }
>>
>> Please use the helpers in include/linux/of.h rather than open coding
>> this.
>>
>> Yours Tony
> 
> 
> Hi Tony,
> 
> 
> This is what I can find as an equivalent code:
> 
>     for (pdn = dn; pdn != NULL; pdn = of_get_next_parent(pdn)) {
>         pcie_link_speed_stats = (const uint32_t *)
>             of_get_property(dn,
>                 "ibm,pcie-link-speed-stats", NULL);
>         if (pcie_link_speed_stats)
>             break;
>     }
> 
> is this your suggestion, or was it another approach that will have the
> same result?
> 
> Thanks,
> 

Hi Tony,

It seems Lucas' change is a bit incomplete and is not handling the reference counter to
the device_node correctly. Is the following change what you had in mind?


	dn = pcibios_get_phb_of_node(bus);
	if (!dn)
		return 0;

	for (pdn = dn; pdn != NULL; pdn = of_get_next_parent(pdn)) {
		pcie_link_speed_stats = (const uint32_t *) of_get_property(pdn,
			"ibm,pcie-link-speed-stats", NULL);
		if (pcie_link_speed_stats)
			break;
	}

	of_node_put(pdn);


Thanks,

-- 
Kleber Sacilotto de Souza
IBM Linux Technology Center

  reply	other threads:[~2013-05-02 15:21 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-24 22:54 [PATCHv4 0/2] Speed Cap fixes for ppc64 lucaskt
2013-04-24 22:54 ` [PATCHv4 1/2] ppc64: perform proper max_bus_speed detection lucaskt
2013-04-24 23:48   ` Tony Breeds
2013-04-25 17:34     ` Lucas Kannebley Tavares
2013-05-02 15:21       ` Kleber Sacilotto de Souza [this message]
2013-05-03  6:40         ` Tony Breeds
2013-05-03 11:55           ` Kleber Sacilotto de Souza
2013-04-24 22:54 ` [PATCHv4 2/2] radeon: use max_bus_speed to activate gen2 speeds lucaskt

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=51828481.2090406@linux.vnet.ibm.com \
    --to=klebers@linux.vnet.ibm.com \
    --cc=airlied@linux.ie \
    --cc=alexander.deucher@amd.com \
    --cc=bhelgaas@google.com \
    --cc=brking@linux.vnet.ibm.com \
    --cc=cascardo@linux.vnet.ibm.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jglisse@redhat.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=tony@bakeyournoodle.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).