mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Alex G." <mr.nuke.me@gmail.com>
To: Sinan Kaya <okaya@codeaurora.org>,
	Alex_Gagniuc@Dellteam.com, bhelgaas@google.com
Cc: Austin.Bolen@dell.com, Shyam.Iyer@dell.com,
	keith.busch@intel.com, linux-pci@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] PCI: Check for PCIe downtraining conditions
Date: Thu, 31 May 2018 10:46:07 -0500	[thread overview]
Message-ID: <3b8a895b-3080-7ddb-cbfd-5aa972e9bf65@gmail.com> (raw)
In-Reply-To: <f260078b-6918-7fd9-39d6-e9f300e4c048@codeaurora.org>



On 05/31/2018 10:38 AM, Sinan Kaya wrote:
> On 5/31/2018 11:29 AM, Alex_Gagniuc@Dellteam.com wrote:
>> On 5/31/2018 10:28 AM, Sinan Kaya wrote:
>>> On 5/31/2018 11:05 AM, Alexandru Gagniuc wrote:
>>>> +static void pcie_max_link_cap(struct pci_dev *dev, enum pci_bus_speed *speed,
>>>> +				enum pcie_link_width *width)
>>>> +{
>>>> +	uint32_t lnkcap;
>>>> +
>>>> +	pcie_capability_read_dword(dev, PCI_EXP_LNKCAP, &lnkcap);
>>>> +
>>>> +	*speed = pcie_link_speed[lnkcap & PCI_EXP_LNKCAP_SLS];
>>>> +	*width = (lnkcap & PCI_EXP_LNKCAP_MLW) >> PCI_EXP_LNKCAP_MLW_SHIFT;
>>>> +}
>>>> +
>>>> +static void pcie_cur_link_sta(struct pci_dev *dev, enum pci_bus_speed *speed,
>>>> +				enum pcie_link_width *width)
>>>> +{
>>>> +	uint16_t lnksta;
>>>> +
>>>> +	pcie_capability_read_word(dev, PCI_EXP_LNKSTA, &lnksta);
>>>> +	*speed = pcie_link_speed[lnksta & PCI_EXP_LNKSTA_CLS];
>>>> +	*width = (lnksta & PCI_EXP_LNKSTA_NLW) >> PCI_EXP_LNKSTA_NLW_SHIFT;
>>>> +}
>>>> +
>>>> +static const char *pcie_bus_speed_name(enum pci_bus_speed speed)
>>>> +{
>>>> +	switch (speed) {
>>>> +	case PCIE_SPEED_2_5GT:
>>>> +		return "2.5 GT/s";
>>>> +	case PCIE_SPEED_5_0GT:
>>>> +		return "5.0 GT/s";
>>>> +	case PCIE_SPEED_8_0GT:
>>>> +		return "8.0 GT/s";
>>>> +	default:
>>>> +		return "unknown";
>>>> +	}
>>>> +}
>>>
>>> I thought Bjorn added some functions to retrieve this now.
>>
>> Hmm. I couldn't find them.
> 
> https://lkml.org/lkml/2018/3/30/553

Oh, pcie_get_speed_cap()/pcie_get_width_cap() seems to handle the
capability. Not seeing one for status and speed name.

> are you working on linux-next?

v4.17-rc7

>>
>> Alex
>>
>>
> 
> 

  reply	other threads:[~2018-05-31 15:46 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-31 15:05 Alexandru Gagniuc
2018-05-31 15:28 ` Sinan Kaya
2018-05-31 15:29   ` Alex_Gagniuc
2018-05-31 15:38     ` Sinan Kaya
2018-05-31 15:46       ` Alex G. [this message]
2018-05-31 15:54         ` Sinan Kaya
2018-05-31 16:01           ` Alex G.
2018-05-31 16:13             ` Sinan Kaya
2018-05-31 16:49               ` Alex G.
2018-05-31 16:50                 ` Alex G.
2018-05-31 17:11                 ` Sinan Kaya
2018-05-31 17:27                   ` Alex G.
2018-05-31 21:52                     ` Alex G.
2018-05-31 15:30 ` Sinan Kaya
2018-05-31 21:44   ` Alex G.
2018-06-01 13:30     ` Sinan Kaya
2018-06-02 17:42 ` Pavel Machek

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=3b8a895b-3080-7ddb-cbfd-5aa972e9bf65@gmail.com \
    --to=mr.nuke.me@gmail.com \
    --cc=Alex_Gagniuc@Dellteam.com \
    --cc=Austin.Bolen@dell.com \
    --cc=Shyam.Iyer@dell.com \
    --cc=bhelgaas@google.com \
    --cc=keith.busch@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=okaya@codeaurora.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®