Received: by 10.213.65.68 with SMTP id h4csp143670imn; Wed, 21 Mar 2018 14:39:20 -0700 (PDT) X-Google-Smtp-Source: AG47ELt2SH1KEpsHD3TIgAiiGIti9cuniXm2WaKsQVXaC/bbs8vWieor+em1hmST0AkLkliuW4Gm X-Received: by 2002:a17:902:b183:: with SMTP id s3-v6mr22099840plr.108.1521668360648; Wed, 21 Mar 2018 14:39:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521668360; cv=none; d=google.com; s=arc-20160816; b=TlTK4jv0c4KQ28S8RUi/X+SsMmRYtBr5+zU1GOi11yERArVIzndcy5TU4rrVkwPE2M uVB+1gytwlQG+uVLB9u0c6e1Nc9DqNGTIsEtwBNEjHs8donov0jL3mR2p6Iloz17/rzv byBgIrB16bw0lZAMFf0rjmIITKdlRwKquB1elimsYXhEFaAHjSgXrVxWmwKi84sz5r9D D4eyMBiR00iQ79t4wBXFiI7mg20qYH8XP5XMwfi6hC9Tcf3RdfYaIzXUftdDw80Bhx2n AFiVs5yg9Sw2/QWYeX7OJT+2JdQYZRI2hI3VQNiO9mJ1zBYGXMwbkkyioCbYC3g+fY7Y WcVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dmarc-filter:arc-authentication-results; bh=tqDj+qLsEoDqYe8tvtV4blZC2PaiYPrsg+GkA+NCjfI=; b=i7vlYLQtWJtJkCSBtTC0ZrP91RD3TaaP1K2UUjJZcsZWgWAkxg4iB3sm5TvmL1dObi ICgnXy28LQrJJ0/e56gXW2ZOBy157XV6ai/fS4JvTa0WlvjbgEVPPZqB5E2mmza2UGMI ABIsmgwdnWWgKOkoJmAWJ0Kd4w7JonLVx1+0tzWDC5esbAYnkP2W7vxyAkHy3LQWJ0/C sf7CNOYcnaq/vKhGhLH0wiBR7UNmQp9nPOz7V5zqWchUJaxbFGR1FT6cRrPxhZk4xFop MeUgvDmFo4N7UT+37g9JRa2Aqn9pQ24cbcFyEe05rvZ6zeInP77Udu/DzJ0P9BHTiNxI wCww== ARC-Authentication-Results: i=1; mx.google.com; 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 b4si3243184pgq.427.2018.03.21.14.39.06; Wed, 21 Mar 2018 14:39:20 -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; 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 S1753801AbeCUVhZ (ORCPT + 99 others); Wed, 21 Mar 2018 17:37:25 -0400 Received: from mail.kernel.org ([198.145.29.99]:40808 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753777AbeCUVhX (ORCPT ); Wed, 21 Mar 2018 17:37:23 -0400 Received: from localhost (unknown [69.71.5.252]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D67DC217D8; Wed, 21 Mar 2018 21:37:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D67DC217D8 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=helgaas@kernel.org Date: Wed, 21 Mar 2018 16:37:21 -0500 From: Bjorn Helgaas To: Jay Fang Cc: bhelgaas@google.com, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] PCI: Support PCIe 4.0 data rate(16.0 GT/s) Message-ID: <20180321213721.GG38649@bhelgaas-glaptop.roam.corp.google.com> References: <1520846012-8294-1-git-send-email-f.fangjian@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1520846012-8294-1-git-send-email-f.fangjian@huawei.com> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 12, 2018 at 05:13:32PM +0800, Jay Fang wrote: > PCIe 4.0 provides an effective 16.0 GT/second/lane/direction of raw > bandwidth. Current PCI driver does not support this new feature. > For example, when you read a PCIe 4.0 EP's link data rate by sysfs, it > will return "Unknown speed", not the expected "16.0 GT/s". > > Signed-off-by: Jay Fang > Reviewed-by: Dongdong Liu Applied to pci/enumeration for v4.17, thanks! > --- > drivers/pci/pci-sysfs.c | 6 ++++++ > drivers/pci/probe.c | 2 +- > drivers/pci/slot.c | 1 + > include/linux/pci.h | 1 + > include/uapi/linux/pci_regs.h | 2 ++ > 5 files changed, 11 insertions(+), 1 deletion(-) > > diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c > index eb6bee8..7dc5be5 100644 > --- a/drivers/pci/pci-sysfs.c > +++ b/drivers/pci/pci-sysfs.c > @@ -168,6 +168,9 @@ static ssize_t max_link_speed_show(struct device *dev, > return -EINVAL; > > switch (linkcap & PCI_EXP_LNKCAP_SLS) { > + case PCI_EXP_LNKCAP_SLS_16_0GB: > + speed = "16 GT/s"; > + break; > case PCI_EXP_LNKCAP_SLS_8_0GB: > speed = "8 GT/s"; > break; > @@ -213,6 +216,9 @@ static ssize_t current_link_speed_show(struct device *dev, > return -EINVAL; > > switch (linkstat & PCI_EXP_LNKSTA_CLS) { > + case PCI_EXP_LNKSTA_CLS_16_0GB: > + speed = "16 GT/s"; > + break; > case PCI_EXP_LNKSTA_CLS_8_0GB: > speed = "8 GT/s"; > break; > diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c > index ef53774..86bf045 100644 > --- a/drivers/pci/probe.c > +++ b/drivers/pci/probe.c > @@ -592,7 +592,7 @@ const unsigned char pcie_link_speed[] = { > PCIE_SPEED_2_5GT, /* 1 */ > PCIE_SPEED_5_0GT, /* 2 */ > PCIE_SPEED_8_0GT, /* 3 */ > - PCI_SPEED_UNKNOWN, /* 4 */ > + PCIE_SPEED_16_0GT, /* 4 */ > PCI_SPEED_UNKNOWN, /* 5 */ > PCI_SPEED_UNKNOWN, /* 6 */ > PCI_SPEED_UNKNOWN, /* 7 */ > diff --git a/drivers/pci/slot.c b/drivers/pci/slot.c > index d10f556..191893e 100644 > --- a/drivers/pci/slot.c > +++ b/drivers/pci/slot.c > @@ -76,6 +76,7 @@ static const char *pci_bus_speed_strings[] = { > "2.5 GT/s PCIe", /* 0x14 */ > "5.0 GT/s PCIe", /* 0x15 */ > "8.0 GT/s PCIe", /* 0x16 */ > + "16.0 GT/s PCIe", /* 0x17 */ > }; > > static ssize_t bus_speed_read(enum pci_bus_speed speed, char *buf) > diff --git a/include/linux/pci.h b/include/linux/pci.h > index 5adabe2..44ce439 100644 > --- a/include/linux/pci.h > +++ b/include/linux/pci.h > @@ -259,6 +259,7 @@ enum pci_bus_speed { > PCIE_SPEED_2_5GT = 0x14, > PCIE_SPEED_5_0GT = 0x15, > PCIE_SPEED_8_0GT = 0x16, > + PCIE_SPEED_16_0GT = 0x17, > PCI_SPEED_UNKNOWN = 0xff, > }; > > diff --git a/include/uapi/linux/pci_regs.h b/include/uapi/linux/pci_regs.h > index 0c79eac..c1c4109 100644 > --- a/include/uapi/linux/pci_regs.h > +++ b/include/uapi/linux/pci_regs.h > @@ -520,6 +520,7 @@ > #define PCI_EXP_LNKCAP_SLS_2_5GB 0x00000001 /* LNKCAP2 SLS Vector bit 0 */ > #define PCI_EXP_LNKCAP_SLS_5_0GB 0x00000002 /* LNKCAP2 SLS Vector bit 1 */ > #define PCI_EXP_LNKCAP_SLS_8_0GB 0x00000003 /* LNKCAP2 SLS Vector bit 2 */ > +#define PCI_EXP_LNKCAP_SLS_16_0GB 0x00000004 /* LNKCAP2 SLS Vector bit 3 */ > #define PCI_EXP_LNKCAP_MLW 0x000003f0 /* Maximum Link Width */ > #define PCI_EXP_LNKCAP_ASPMS 0x00000c00 /* ASPM Support */ > #define PCI_EXP_LNKCAP_L0SEL 0x00007000 /* L0s Exit Latency */ > @@ -547,6 +548,7 @@ > #define PCI_EXP_LNKSTA_CLS_2_5GB 0x0001 /* Current Link Speed 2.5GT/s */ > #define PCI_EXP_LNKSTA_CLS_5_0GB 0x0002 /* Current Link Speed 5.0GT/s */ > #define PCI_EXP_LNKSTA_CLS_8_0GB 0x0003 /* Current Link Speed 8.0GT/s */ > +#define PCI_EXP_LNKSTA_CLS_16_0GB 0x0004 /* Current Link Speed 16.0GT/s */ > #define PCI_EXP_LNKSTA_NLW 0x03f0 /* Negotiated Link Width */ > #define PCI_EXP_LNKSTA_NLW_X1 0x0010 /* Current Link Width x1 */ > #define PCI_EXP_LNKSTA_NLW_X2 0x0020 /* Current Link Width x2 */ > -- > 2.7.4 >