Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp743739imm; Thu, 31 May 2018 08:39:08 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJr+0bCVWJIA97CEIxBPPP9Gx3DHK0YiC4ydcQpwebQZw0ktmCxrLbngKeECgMnVxkIZAvD X-Received: by 2002:a62:9c93:: with SMTP id u19-v6mr7375403pfk.74.1527781148603; Thu, 31 May 2018 08:39:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527781148; cv=none; d=google.com; s=arc-20160816; b=YJi43XLNiEd30eUccnZs8oIIDsaib76BLHmfa7+LLUoTqOYGxri/AiRzEG3YNjrc0k S7FTqJ5+QUV2mFpFFcot1tfcvSLy6Xvq5RBujkq0offf6YPFVxIawmMKHo7hrdpe+2zK ZMJnwNOl9pvIbD2kwkoVg4TIWGx2MAMJhCkPvy2ybEASYpb5H/bgyJYr8NPxdVKw7Xhh tJq+rCHz9b16PthM5elZcfIlBrOK2FhNcrjZj5Rj1PBgGi2XXmfciFtKRIa5JxxyHwYk spiMWGRIzHoBZbAH7LUOmjDZvpWy7MLh2VJj11Hjv9gaG3k/vsgUvwZJlq3TSl0/cRtu Kemw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dmarc-filter :dkim-signature:dkim-signature:arc-authentication-results; bh=fQ8Txb6F2U0VXKhm2NHFdocSrhlb+gnqQAcZ1+91xmo=; b=jjWpTBKRjsqHESQDXi9TfebrpLwcKQMmco+wIyefHuq81+Huvyapr1G9Mle6IOlxIF ZDn/nAYx7eestwjfYLj+maR20lxf6GS+dRKFl0yGRaubTQmJY3AClrcawFIEdWsVxewf 1E1brDFzhzCDYMJhJ2TYbF94OsASMxCvySi9LbcJjwT0Z4KRdwTMbPnkBhX7exN8SanT zM92nHFJ9h7LJncpTtSEtKzH9LqJDmzxrhJsrBJuKIuz4e4VWVG2i5sW7NR13fpFBoG1 Iaze/EmIt7sVu/5WBKPbavB004ps44i75auwf/hUnruyCDHjpkup5L0CmlKXEUGsWnFR LZoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=UPAHo6Un; dkim=pass header.i=@codeaurora.org header.s=default header.b=R4khyhbg; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b9-v6si36829108pli.427.2018.05.31.08.38.54; Thu, 31 May 2018 08:39:08 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=UPAHo6Un; dkim=pass header.i=@codeaurora.org header.s=default header.b=R4khyhbg; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755482AbeEaPiU (ORCPT + 99 others); Thu, 31 May 2018 11:38:20 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:43494 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755417AbeEaPiR (ORCPT ); Thu, 31 May 2018 11:38:17 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 3E60660646; Thu, 31 May 2018 15:38:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1527781097; bh=ZvJS4cCw+S1w+PT3/mAPiU5DUUywd1+Mt4Uvv6Y9oxc=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=UPAHo6UnDS7hI+8DiSHXgo7glnWjDK96+yO8E1PICM43g1MAHO02vOKbs2f61ZQxq uJvIYutztVDeaC5sqBDyk2nxuDOYAFkz1hQE4AdNpsPLyL2sUWi4GF81uG7SS4DgUq sb7m0rrhQ43c/7eNm4lGaboIblX4fJARav4jdSao= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 Received: from [10.235.228.150] (global_nat1_iad_fw.qualcomm.com [129.46.232.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: okaya@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id B66226050D; Thu, 31 May 2018 15:38:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1527781095; bh=ZvJS4cCw+S1w+PT3/mAPiU5DUUywd1+Mt4Uvv6Y9oxc=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=R4khyhbgLqCOftrLd0oMDbj9pJkYIsq7S+OFL4tyNPdlH6LE76Ota+RWk8wVQlZXw izv4xzCPFUPwD4SzLM6f/36jbGMzIM5xSULRq6MscufF8V6LSGGrlWstdIpWttow2a 1eqtkxMTyKecI/rZ/F+PQ8iZBYg1Dkan1cLEA29o= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org B66226050D Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=okaya@codeaurora.org Subject: Re: [PATCH] PCI: Check for PCIe downtraining conditions To: Alex_Gagniuc@Dellteam.com, mr.nuke.me@gmail.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 References: <20180531150535.9684-1-mr.nuke.me@gmail.com> <28004506-24f0-6d10-2d1e-074e0483d2f9@codeaurora.org> <4e0611c872054e768daa96b302651db3@ausx13mps321.AMER.DELL.COM> From: Sinan Kaya Message-ID: Date: Thu, 31 May 2018 11:38:13 -0400 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <4e0611c872054e768daa96b302651db3@ausx13mps321.AMER.DELL.COM> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 are you working on linux-next? > > Alex > > -- Sinan Kaya Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm Technologies, Inc. Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.