Skip to contentSkip to conversation

pciutils: Add basic decode support for CXL DVSEC

PATCH Superseded Sean V Kelley 1 participant 4 messages Apr 20, 2020 – May 4, 2020

Subsystems (2)

v6 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

v6 cover pciutils: Add basic decode support for CXL DVSEC

Changes since v5 [1]:

- There can be multiple vendor specific DVSEC IDs associated with CXL. (Bjorn Helgaas)

[1] https://lore.kernel.org/linux-pci/[email protected]/

This patch series adds support for basic lspci decode of Compute eXpress Link[2], a new CPU interconnect building upon PCIe. As a foundation for the CXL support it adds separate Designated Vendor-Specific Capability (DVSEC) defines and a cap function so as to align with PCIe r5.0, sec 7.9.6.2 terms and provide available details. It makes use of the DVSEC Vendor ID and DVSEC ID so as to identify a CXL capable device.

[2] https://www.computeexpresslink.org/

Sean V Kelley (2):
pciutils: Decode available DVSEC details
pciutils: Decode Compute eXpress Link DVSEC

 lib/header.h        |  24 ++++
 ls-ecaps.c          |  79 +++++++++-
 tests/cap-dvsec     | 340 ++++++++++++++++++++++++++++++++++++++++++++
 tests/cap-dvsec-cxl | 340 ++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 782 insertions(+), 1 deletion(-)
 create mode 100644 tests/cap-dvsec
 create mode 100644 tests/cap-dvsec-cxl

--
2.26.0

#1 lore raw

PATCH v6 1/2 pciutils: Decode available DVSEC details

Instead of current generic 'unknown' output for DVSEC, decode details on Vendor ID, Rev, etc.

---
 lib/header.h    |   4 +
 ls-ecaps.c      |  25 +++-
 tests/cap-dvsec | 340 ++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 368 insertions(+), 1 deletion(-)
 create mode 100644 tests/cap-dvsec
lib/header.h +4 -0
index bfdcc80..daeddeb 100644
@@ -1042,6 +1042,10 @@
 #define PCI_EVNDR_HEADER	4	/* Vendor-Specific Header */
 #define PCI_EVNDR_REGISTERS	8	/* Vendor-Specific Registers */
 
+/* PCIe Designated Vendor-Specific Capability */
+#define PCI_DVSEC_HEADER1	4	/* Designated Vendor-Specific Header 1 */
+#define PCI_DVSEC_HEADER2	8	/* Designated Vendor-Specific Header 2 */
+
 /* Access Control Services */
 #define PCI_ACS_CAP		0x04	/* ACS Capability Register */
 #define PCI_ACS_CAP_VALID	0x0001	/* ACS Source Validation */
ls-ecaps.c +24 -1
index 0021734..b82d37e 100644
@@ -634,6 +634,29 @@ cap_rclink(struct device *d, int where)
     }
 }
 
+static void
+cap_dvsec(struct device *d, int where)
+{
+  u32 hdr;
+
+  printf("Designated Vendor-Specific:\n");
+  if (!config_fetch(d, where + PCI_DVSEC_HEADER1, 8))
+    {
+      printf("<unreadable>\n");
+      return;
+    }
+
+  hdr = get_conf_long(d, where + PCI_DVSEC_HEADER1);
+  printf("\t\tDVSEC Vendor ID=%04x Rev=%d Len=%03x <?>\n",
+    BITS(hdr, 0, 16),
+    BITS(hdr, 16, 4),
+    BITS(hdr, 20, 12));
+
+  hdr = get_conf_long(d, where + PCI_DVSEC_HEADER2);
+  printf("\t\tDVSEC ID=%04x <?>\n",
+    BITS(hdr, 0, 16));
+}
+
 static void
 cap_evendor(struct device *d, int where)
 {
@@ -924,7 +947,7 @@ show_ext_caps(struct device *d, int type)
 	    printf("Readiness Time Reporting <?>\n");
 	    break;
 	  case PCI_EXT_CAP_ID_DVSEC:
-	    printf("Designated Vendor-Specific <?>\n");
+	    cap_dvsec(d, where);
 	    break;
 	  case PCI_EXT_CAP_ID_VF_REBAR:
 	    printf("VF Resizable BAR <?>\n");
tests/cap-dvsec new file +340 -0

340 lines not on this page · raw message

Signature · 1 line
2.26.0
#2 lore raw

PATCH v6 2/2 pciutils: Decode Compute eXpress Link DVSEC

In reply to Sean V Kelley

Compute eXpress Link[1] is a new CPU interconnect created with workload accelerators in mind. The interconnect relies on PCIe electrical and physical interconnect for communication via a Flex Bus port which allows designs to choose between providing PCIe or CXL.

This patch introduces basic support for lspci decode of CXL and builds upon the existing Designated Vendor-Specific support in lspci through identification of a supporting CXL device using DVSEC Vendor ID and DVSEC ID.

[1] https://www.computeexpresslink.org/

---
 lib/header.h        |  20 +++
 ls-ecaps.c          |  56 +++++++-
 tests/cap-dvsec-cxl | 340 ++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 415 insertions(+), 1 deletion(-)
 create mode 100644 tests/cap-dvsec-cxl
lib/header.h +20 -0
index daeddeb..1f831e8 100644
@@ -1045,6 +1045,26 @@
 /* PCIe Designated Vendor-Specific Capability */
 #define PCI_DVSEC_HEADER1	4	/* Designated Vendor-Specific Header 1 */
 #define PCI_DVSEC_HEADER2	8	/* Designated Vendor-Specific Header 2 */
+#define PCI_DVSEC_INTEL_CXL	0	/* Designated Vendor-Specific ID for Intel CXL */
+
+/* PCIe CXL Designated Vendor-Specific Capabilities, Control, Status */
+#define PCI_CXL_CAP		0x0a	/* CXL Capability Register */
+#define  PCI_CXL_CAP_CACHE	0x0001	/* CXL.cache Protocol Support */
+#define  PCI_CXL_CAP_IO		0x0002	/* CXL.io Protocol Support */
+#define  PCI_CXL_CAP_MEM	0x0004	/* CXL.mem Protocol Support */
+#define  PCI_CXL_CAP_MEM_HWINIT	0x0008	/* CXL.mem Initalizes with HW/FW Support */
+#define  PCI_CXL_CAP_HDM_CNT(x)	(((x) & (3 << 4)) >> 4)	/* CXL Number of HDM ranges */
+#define  PCI_CXL_CAP_VIRAL	0x4000	/* CXL Viral Handling Support */
+#define PCI_CXL_CTRL		0x0c	/* CXL Control Register */
+#define  PCI_CXL_CTRL_CACHE	0x0001	/* CXL.cache Protocol Enable */
+#define  PCI_CXL_CTRL_IO	0x0002	/* CXL.io Protocol Enable */
+#define  PCI_CXL_CTRL_MEM	0x0004	/* CXL.mem Protocol Enable */
+#define  PCI_CXL_CTRL_CACHE_SF_COV(x)	(((x) & (0x1f << 3)) >> 3) /* Snoop Filter Coverage */
+#define  PCI_CXL_CTRL_CACHE_SF_GRAN(x)	(((x) & (0x7 << 8)) >> 8) /* Snoop Filter Granularity */
+#define  PCI_CXL_CTRL_CACHE_CLN	0x0800	/* CXL.cache Performance Hint on Clean Evictions */
+#define  PCI_CXL_CTRL_VIRAL	0x4000	/* CXL Viral Handling Enable */
+#define PCI_CXL_STATUS		0x0e	/* CXL Status Register */
+#define  PCI_CXL_STATUS_VIRAL	0x4000	/* CXL Viral Handling Status */
 
 /* Access Control Services */
 #define PCI_ACS_CAP		0x04	/* ACS Capability Register */
ls-ecaps.c +55 -1

68 lines not on this page · raw message

tests/cap-dvsec-cxl new file +340 -0

340 lines not on this page · raw message

Signature · 1 line
2.26.0
#3 lore raw
In reply to Sean V Kelley
Quoted 7 lines · Sean V Kelley

Changes since v5 [1]:

- There can be multiple vendor specific DVSEC IDs associated with CXL. (Bjorn Helgaas)

[1] https://lore.kernel.org/linux-pci/[email protected]/

Quoted 8 lines

This patch series adds support for basic lspci decode of Compute eXpress Link[2], a new CPU interconnect building upon PCIe. As a foundation for the CXL support it adds separate Designated Vendor-Specific Capability (DVSEC) defines and a cap function so as to align with PCIe r5.0, sec 7.9.6.2 terms and provide available details. It makes use of the DVSEC Vendor ID and DVSEC ID so as to identify a CXL capable device.

[2] https://www.computeexpresslink.org/

Just a light ping on these patches.

Thanks!

Sean

Quoted 17 lines

Sean V Kelley (2):
pciutils: Decode available DVSEC details
pciutils: Decode Compute eXpress Link DVSEC

 lib/header.h        |  24 ++++
 ls-ecaps.c          |  79 +++++++++-
 tests/cap-dvsec     | 340 
++++++++++++++++++++++++++++++++++++++++++++
 tests/cap-dvsec-cxl | 340 
++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 782 insertions(+), 1 deletion(-)
 create mode 100644 tests/cap-dvsec
 create mode 100644 tests/cap-dvsec-cxl

--
2.26.0