From patchwork Thu Apr 19 20:16:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Helgaas X-Patchwork-Id: 901486 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-pci-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 40Rqy563Vfz9s1t for ; Fri, 20 Apr 2018 06:16:29 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752900AbeDSUQ3 (ORCPT ); Thu, 19 Apr 2018 16:16:29 -0400 Received: from mail.kernel.org ([198.145.29.99]:58220 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752507AbeDSUQ2 (ORCPT ); Thu, 19 Apr 2018 16:16:28 -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 EFF532077A; Thu, 19 Apr 2018 20:16:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EFF532077A 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 Subject: [PATCH 1/4] lspci: Clarify unknown capability IDs From: Bjorn Helgaas To: Martin Mares Cc: linux-pci@vger.kernel.org Date: Thu, 19 Apr 2018 15:16:26 -0500 Message-ID: <152416898648.71364.15417323482028209640.stgit@bhelgaas-glaptop.roam.corp.google.com> In-Reply-To: <152416880512.71364.16029919502694064334.stgit@bhelgaas-glaptop.roam.corp.google.com> References: <152416880512.71364.16029919502694064334.stgit@bhelgaas-glaptop.roam.corp.google.com> User-Agent: StGit/0.18 MIME-Version: 1.0 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org From: Bjorn Helgaas For capabilities we don't know how to decode, we print the config address, version, and capability ID: Capabilities: [220 v1] #19 This doesn't clearly identify the capability ID ("19"), whether it is a PCI-compatible Capability ID or an Extended Capability ID (although you can infer this by whether the address is 2 or 3 digits), or the fact that the ID is printed in hex, which makes it hard to parse this manually. Add a label ("Capability ID" or "Extended Capability ID") and print a "0x" prefix so it's clear the value is in hex: Capabilities: [220 v1] Extended Capability ID 0x19 Signed-off-by: Bjorn Helgaas --- ls-caps.c | 2 +- ls-ecaps.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ls-caps.c b/ls-caps.c index 3135224..bc7829c 100644 --- a/ls-caps.c +++ b/ls-caps.c @@ -1599,7 +1599,7 @@ show_caps(struct device *d, int where) cap_ea(d, where, cap); break; default: - printf("#%02x [%04x]\n", id, cap); + printf("Capability ID %#02x [%04x]\n", id, cap); } where = next; } diff --git a/ls-ecaps.c b/ls-ecaps.c index 800a032..cb3d46d 100644 --- a/ls-ecaps.c +++ b/ls-ecaps.c @@ -802,7 +802,7 @@ show_ext_caps(struct device *d, int type) cap_ptm(d, where); break; default: - printf("#%02x\n", id); + printf("Extended Capability ID %#02x\n", id); break; } where = (header >> 20) & ~3; From patchwork Thu Apr 19 20:16:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Helgaas X-Patchwork-Id: 901487 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-pci-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 40RqyF27Y1z9s1t for ; Fri, 20 Apr 2018 06:16:37 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753179AbeDSUQg (ORCPT ); Thu, 19 Apr 2018 16:16:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:58240 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753011AbeDSUQg (ORCPT ); Thu, 19 Apr 2018 16:16:36 -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 635E72077A; Thu, 19 Apr 2018 20:16:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 635E72077A 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 Subject: [PATCH 2/4] lspci: Decode Null Capability From: Bjorn Helgaas To: Martin Mares Cc: linux-pci@vger.kernel.org Date: Thu, 19 Apr 2018 15:16:33 -0500 Message-ID: <152416899351.71364.17915245982467561819.stgit@bhelgaas-glaptop.roam.corp.google.com> In-Reply-To: <152416880512.71364.16029919502694064334.stgit@bhelgaas-glaptop.roam.corp.google.com> References: <152416880512.71364.16029919502694064334.stgit@bhelgaas-glaptop.roam.corp.google.com> User-Agent: StGit/0.18 MIME-Version: 1.0 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org From: Bjorn Helgaas The PCI Code and ID Assignment spec, r1.9, sec 2, defines a "Null Capability" containing no registers other than the 8-bit Capability ID (00h) and an 8-bit Next Capability Pointer. Some devices, e.g., the Intel [8086:2058] implement this Capability. Signed-off-by: Bjorn Helgaas --- lib/header.h | 2 ++ ls-caps.c | 3 +++ ls-ecaps.c | 3 +++ 3 files changed, 8 insertions(+) diff --git a/lib/header.h b/lib/header.h index 0b12b2c..1f0e460 100644 --- a/lib/header.h +++ b/lib/header.h @@ -185,6 +185,7 @@ /* Capability lists */ #define PCI_CAP_LIST_ID 0 /* Capability ID */ +#define PCI_CAP_ID_NULL 0x00 /* Null Capability */ #define PCI_CAP_ID_PM 0x01 /* Power Management */ #define PCI_CAP_ID_AGP 0x02 /* Accelerated Graphics Port */ #define PCI_CAP_ID_VPD 0x03 /* Vital Product Data */ @@ -211,6 +212,7 @@ /* Capabilities residing in the PCI Express extended configuration space */ +#define PCI_EXT_CAP_ID_NULL 0x00 /* Null Capability */ #define PCI_EXT_CAP_ID_AER 0x01 /* Advanced Error Reporting */ #define PCI_EXT_CAP_ID_VC 0x02 /* Virtual Channel */ #define PCI_EXT_CAP_ID_DSN 0x03 /* Device Serial Number */ diff --git a/ls-caps.c b/ls-caps.c index bc7829c..8b707c2 100644 --- a/ls-caps.c +++ b/ls-caps.c @@ -1536,6 +1536,9 @@ show_caps(struct device *d, int where) } switch (id) { + case PCI_CAP_ID_NULL: + printf("Null\n"); + break; case PCI_CAP_ID_PM: cap_pm(d, where, cap); break; diff --git a/ls-ecaps.c b/ls-ecaps.c index cb3d46d..3f6a364 100644 --- a/ls-ecaps.c +++ b/ls-ecaps.c @@ -737,6 +737,9 @@ show_ext_caps(struct device *d, int type) } switch (id) { + case PCI_EXT_CAP_ID_NULL: + printf("Null\n"); + break; case PCI_EXT_CAP_ID_AER: cap_aer(d, where, type); break; From patchwork Thu Apr 19 20:16:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Helgaas X-Patchwork-Id: 901488 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-pci-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 40RqyN1cZwz9s1t for ; Fri, 20 Apr 2018 06:16:44 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753269AbeDSUQn (ORCPT ); Thu, 19 Apr 2018 16:16:43 -0400 Received: from mail.kernel.org ([198.145.29.99]:58260 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753011AbeDSUQn (ORCPT ); Thu, 19 Apr 2018 16:16:43 -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 3654F2077A; Thu, 19 Apr 2018 20:16:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3654F2077A 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 Subject: [PATCH 3/4] lspci: Print names of capabilities even if we can't decode the rest From: Bjorn Helgaas To: Martin Mares Cc: linux-pci@vger.kernel.org Date: Thu, 19 Apr 2018 15:16:40 -0500 Message-ID: <152416900089.71364.13804680545241038494.stgit@bhelgaas-glaptop.roam.corp.google.com> In-Reply-To: <152416880512.71364.16029919502694064334.stgit@bhelgaas-glaptop.roam.corp.google.com> References: <152416880512.71364.16029919502694064334.stgit@bhelgaas-glaptop.roam.corp.google.com> User-Agent: StGit/0.18 MIME-Version: 1.0 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org From: Bjorn Helgaas We don't have decoders for many new capabilities, so we currently print just the capability ID, e.g., Capabilities: [220 v1] Extended Capability ID 0x19 Print the names, even if we don't yet know how to decode the contents, e.g., Capabilities: [220 v1] Secondary PCI Express The capability IDs are taken from the PCI Code and ID Assignment spec, r1.10. The #defines are named to match those in Linux when possible. Signed-off-by: Bjorn Helgaas --- lib/header.h | 17 +++++++++++++++++ ls-ecaps.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+) diff --git a/lib/header.h b/lib/header.h index 1f0e460..0a8a548 100644 --- a/lib/header.h +++ b/lib/header.h @@ -228,13 +228,30 @@ #define PCI_EXT_CAP_ID_ARI 0x0e /* Alternative Routing-ID Interpretation */ #define PCI_EXT_CAP_ID_ATS 0x0f /* Address Translation Service */ #define PCI_EXT_CAP_ID_SRIOV 0x10 /* Single Root I/O Virtualization */ +#define PCI_EXT_CAP_ID_MRIOV 0x11 /* Multi-Root I/O Virtualization */ +#define PCI_EXT_CAP_ID_MCAST 0x12 /* Multicast */ #define PCI_EXT_CAP_ID_PRI 0x13 /* Page Request Interface */ +#define PCI_EXT_CAP_ID_REBAR 0x15 /* Resizable BAR */ +#define PCI_EXT_CAP_ID_DPA 0x16 /* Dynamic Power Allocation */ #define PCI_EXT_CAP_ID_TPH 0x17 /* Transaction processing hints */ #define PCI_EXT_CAP_ID_LTR 0x18 /* Latency Tolerance Reporting */ +#define PCI_EXT_CAP_ID_SECPCI 0x19 /* Secondary PCI Express */ +#define PCI_EXT_CAP_ID_PMUX 0x1a /* Protocol Multiplexing */ #define PCI_EXT_CAP_ID_PASID 0x1b /* Process Address Space ID */ +#define PCI_EXT_CAP_ID_LNR 0x1c /* LN Requester */ #define PCI_EXT_CAP_ID_DPC 0x1d /* Downstream Port Containment */ #define PCI_EXT_CAP_ID_L1PM 0x1e /* L1 PM Substates */ #define PCI_EXT_CAP_ID_PTM 0x1f /* Precision Time Measurement */ +#define PCI_EXT_CAP_ID_M_PCIE 0x20 /* PCIe over M-PHY */ +#define PCI_EXT_CAP_ID_FRS 0x21 /* FRS Queuing */ +#define PCI_EXT_CAP_ID_RTR 0x22 /* Readiness Time Reporting */ +#define PCI_EXT_CAP_ID_DVSEC 0x23 /* Designated Vendor-Specific */ +#define PCI_EXT_CAP_ID_VF_REBAR 0x24 /* VF Resizable BAR */ +#define PCI_EXT_CAP_ID_DLNK 0x25 /* Data Link Feature */ +#define PCI_EXT_CAP_ID_16GT 0x26 /* Physical Layer 16.0 GT/s */ +#define PCI_EXT_CAP_ID_LMR 0x27 /* Lane Margining at Receiver */ +#define PCI_EXT_CAP_ID_HIER_ID 0x28 /* Hierarchy ID */ +#define PCI_EXT_CAP_ID_NPEM 0x29 /* Native PCIe Enclosure Management */ /*** Definitions of capabilities ***/ diff --git a/ls-ecaps.c b/ls-ecaps.c index 3f6a364..a6ae751 100644 --- a/ls-ecaps.c +++ b/ls-ecaps.c @@ -786,24 +786,72 @@ show_ext_caps(struct device *d, int type) case PCI_EXT_CAP_ID_SRIOV: cap_sriov(d, where); break; + case PCI_EXT_CAP_ID_MRIOV: + printf("Multi-Root I/O Virtualization \n"); + break; case PCI_EXT_CAP_ID_PRI: cap_pri(d, where); break; + case PCI_EXT_CAP_ID_REBAR: + printf("Resizable BAR \n"); + break; + case PCI_EXT_CAP_ID_DPA: + printf("Dynamic Power Allocation \n"); + break; case PCI_EXT_CAP_ID_TPH: cap_tph(d, where); break; case PCI_EXT_CAP_ID_LTR: cap_ltr(d, where); break; + case PCI_EXT_CAP_ID_SECPCI: + printf("Secondary PCI Express \n"); + break; + case PCI_EXT_CAP_ID_PMUX: + printf("Protocol Multiplexing \n"); + break; case PCI_EXT_CAP_ID_PASID: cap_pasid(d, where); break; + case PCI_EXT_CAP_ID_LNR: + printf("LN Requester \n"); + break; case PCI_EXT_CAP_ID_L1PM: cap_l1pm(d, where); break; case PCI_EXT_CAP_ID_PTM: cap_ptm(d, where); break; + case PCI_EXT_CAP_ID_M_PCIE: + printf("PCI Express over M_PHY \n"); + break; + case PCI_EXT_CAP_ID_FRS: + printf("FRS Queueing \n"); + break; + case PCI_EXT_CAP_ID_RTR: + printf("Readiness Time Reporting \n"); + break; + case PCI_EXT_CAP_ID_DVSEC: + printf("Designated Vendor-Specific \n"); + break; + case PCI_EXT_CAP_ID_VF_REBAR: + printf("VF Resizable BAR \n"); + break; + case PCI_EXT_CAP_ID_DLNK: + printf("Data Link Feature \n"); + break; + case PCI_EXT_CAP_ID_16GT: + printf("Physical Layer 16.0 GT/s \n"); + break; + case PCI_EXT_CAP_ID_LMR: + printf("Lane Margining at the Receiver \n"); + break; + case PCI_EXT_CAP_ID_HIER_ID: + printf("Hierarchy ID \n"); + break; + case PCI_EXT_CAP_ID_NPEM: + printf("Native PCIe Enclosure Management \n"); + break; default: printf("Extended Capability ID %#02x\n", id); break; From patchwork Thu Apr 19 20:16:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Helgaas X-Patchwork-Id: 901489 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-pci-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 40RqyV5ld1z9s1t for ; Fri, 20 Apr 2018 06:16:50 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753295AbeDSUQu (ORCPT ); Thu, 19 Apr 2018 16:16:50 -0400 Received: from mail.kernel.org ([198.145.29.99]:58280 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753011AbeDSUQt (ORCPT ); Thu, 19 Apr 2018 16:16:49 -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 EC11E2077A; Thu, 19 Apr 2018 20:16:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EC11E2077A 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 Subject: [PATCH 4/4] lspci: Use spec name for RCRB ((Root Complex Register Block) From: Bjorn Helgaas To: Martin Mares Cc: linux-pci@vger.kernel.org Date: Thu, 19 Apr 2018 15:16:47 -0500 Message-ID: <152416900767.71364.196905236944429194.stgit@bhelgaas-glaptop.roam.corp.google.com> In-Reply-To: <152416880512.71364.16029919502694064334.stgit@bhelgaas-glaptop.roam.corp.google.com> References: <152416880512.71364.16029919502694064334.stgit@bhelgaas-glaptop.roam.corp.google.com> User-Agent: StGit/0.18 MIME-Version: 1.0 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org From: Bjorn Helgaas Extended Capability ID 0x000a is the RCRB (Root Complex Register Block) capability. Change the #define and the capability label to match the terminology used in the specs. Signed-off-by: Bjorn Helgaas --- lib/header.h | 2 +- ls-ecaps.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/header.h b/lib/header.h index 0a8a548..d785473 100644 --- a/lib/header.h +++ b/lib/header.h @@ -222,7 +222,7 @@ #define PCI_EXT_CAP_ID_RCECOLL 0x07 /* Root Complex Event Collector */ #define PCI_EXT_CAP_ID_MFVC 0x08 /* Multi-Function Virtual Channel */ #define PCI_EXT_CAP_ID_VC2 0x09 /* Virtual Channel (2nd ID) */ -#define PCI_EXT_CAP_ID_RBCB 0x0a /* Root Bridge Control Block */ +#define PCI_EXT_CAP_ID_RCRB 0x0a /* Root Complex Register Block */ #define PCI_EXT_CAP_ID_VNDR 0x0b /* Vendor specific */ #define PCI_EXT_CAP_ID_ACS 0x0d /* Access Controls */ #define PCI_EXT_CAP_ID_ARI 0x0e /* Alternative Routing-ID Interpretation */ diff --git a/ls-ecaps.c b/ls-ecaps.c index a6ae751..5505948 100644 --- a/ls-ecaps.c +++ b/ls-ecaps.c @@ -768,8 +768,8 @@ show_ext_caps(struct device *d, int type) case PCI_EXT_CAP_ID_MFVC: printf("Multi-Function Virtual Channel \n"); break; - case PCI_EXT_CAP_ID_RBCB: - printf("Root Bridge Control Block \n"); + case PCI_EXT_CAP_ID_RCRB: + printf("Root Complex Register Block \n"); break; case PCI_EXT_CAP_ID_VNDR: cap_evendor(d, where);