pciutils: Add basic decode support for CXL DVSEC
Subsystems (2)
v7 cover pciutils: Add basic decode support for CXL DVSEC
Changes since v6 [1]:
- The CXL Vendor ID assigned by the PCI SIG is 1e98h and replaces the 8086h value used in the CXL rev1.1 and prior specifications.
(Errata CXL 1.1 sec E27)
[1] https://lore.kernel.org/linux-pci/[email protected]/
This patch series adds support for basic lspci decode of Compute eXpress Link, 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.
DocLink: https://www.computeexpresslink.org/
Sean V Kelley (2):
pciutils: Decode available DVSEC details
pciutils: Decode Compute eXpress Link DVSEC
lib/header.h | 25 ++++ ls-ecaps.c | 79 +++++++++- tests/cap-dvsec | 340 ++++++++++++++++++++++++++++++++++++++++++++ tests/cap-dvsec-cxl | 340 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 783 insertions(+), 1 deletion(-) create mode 100644 tests/cap-dvsec create mode 100644 tests/cap-dvsec-cxl
--
2.26.2
PATCH v7 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
@@ -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
@@ -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.2
PATCH v7 2/2 pciutils: Decode Compute eXpress Link DVSEC
In reply to Sean V KelleyCompute 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 | 21 +++ ls-ecaps.c | 56 +++++++- tests/cap-dvsec-cxl | 340 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 416 insertions(+), 1 deletion(-) create mode 100644 tests/cap-dvsec-cxl
lib/header.h +21 -0
@@ -1045,6 +1045,27 @@/* 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 */ +#define PCI_DVSEC_VENDOR_ID_CXL 0x1e98/* Designated Vendor-Specific Vendor ID for 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.2
Hello!
I applied your patch (by mistake, I applied v6 first, so the vendor ID change is a separate commit).
I have cleaned up the code a bit, so that the DVSEC header is not parsed multiple times.
Could you also update the cap-dvsec-cxl test to match the new vendor ID?
Have a nice day
Martin
Hi Martin,
Quoted 5 lines · Martin Mareš
Hello!
I applied your patch (by mistake, I applied v6 first, so the vendor ID change is a separate commit).
Quoted 7 lines
I have cleaned up the code a bit, so that the DVSEC header is not parsed multiple times.
Could you also update the cap-dvsec-cxl test to match the new vendor ID?
Have a nice day
Martin
Will do.
Thanks!
Sean