pciutils: Add decode support for RCECs
Subsystems (2)
PATCH 1/1 pciutils: Add decode support for RCECs
Root Complex Event Collectors provide support for terminating error and PME messages from RCiEPs. This patch provides basic decoding for lspci RCEC Endpoint Association Extended Capability. See PCie 5.0-1, sec 7.9.10 for further details.
--- lib/header.h | 8 +- ls-ecaps.c | 30 ++++- setpci.c | 2 +- tests/cap-rcec | 299 +++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 335 insertions(+), 4 deletions(-) create mode 100644 tests/cap-rcec
lib/header.h +7 -1
@@ -219,7 +219,7 @@#define PCI_EXT_CAP_ID_PB 0x04/* Power Budgeting */ #define PCI_EXT_CAP_ID_RCLINK 0x05/* Root Complex Link Declaration */ #define PCI_EXT_CAP_ID_RCILINK 0x06/* Root Complex Internal Link Declaration */ -#define PCI_EXT_CAP_ID_RCECOLL 0x07/* Root Complex Event Collector */ +#define PCI_EXT_CAP_ID_RCEC 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_RCRB 0x0a/* Root Complex Register Block */
@@ -1048,6 +1048,12 @@#define PCI_RCLINK_LINK_ADDR 8/* Link Entry: Address (64-bit) */ #define PCI_RCLINK_LINK_SIZE 16/* Link Entry: sizeof */ +/* Root Complex Event Collector */ +#define PCI_RCEC_EP_CAP_VER (reg) (((reg) >> 16) & 0xf) +#define PCI_RCEC_BUSN_REG_VER 0x02/* as per PCIe sec 7.9.10.1 */ +#define PCI_RCEC_RCIEP_BMAP 0x0004/* as per PCIe sec 7.9.10.2 */ +#define PCI_RCEC_BUSN_REG 0x0008/* as per PCIe sec 7.9.10.3 */ +/* PCIe Vendor-Specific Capability */ #define PCI_EVNDR_HEADER 4/* Vendor-Specific Header */ #define PCI_EVNDR_REGISTERS 8/* Vendor-Specific Registers */
ls-ecaps.c +28 -2
@@ -634,6 +634,32 @@ cap_rclink(struct device *d, int where) } } +static void +cap_rcec (struct device *d,int where) +{ +printf ("Root Complex Event Collector\n" ); +if (verbose <2 ) +return ; + +if (!config_fetch (d, where,12 )) +return ; + +u32 hdr =get_conf_long (d, where); +byte cap_ver =PCI_RCEC_EP_CAP_VER (hdr); +u32 bmap =get_conf_long (d, where +PCI_RCEC_RCIEP_BMAP ); +printf ("\t\tDesc:\tCapabilityVersion=%02x RCiEPBitmap=%08x\n" , + cap_ver, + bmap); + +if (cap_ver <PCI_RCEC_BUSN_REG_VER ) +return ; + +u32 busn =get_conf_long (d, where +PCI_RCEC_BUSN_REG ); +printf ("\t\t\tRCECLastBus=%02x RCECFirstBus=%02x\n" , +BITS (busn,16 ,8 ), +BITS (busn,8 ,8 )); +} +static void cap_dvsec_cxl (struct device *d,int where) {
@@ -991,8 +1017,8 @@ show_ext_caps(struct device *d, int type)case PCI_EXT_CAP_ID_RCILINK :printf ("Root Complex Internal Link <?>\n" );break ; -case PCI_EXT_CAP_ID_RCECOLL : -printf ("Root Complex Event Collector <?>\n" ); +case PCI_EXT_CAP_ID_RCEC : +cap_rcec (d, where);break ;case PCI_EXT_CAP_ID_MFVC :printf ("Multi-Function Virtual Channel <?>\n" );
setpci.c +1 -1
@@ -350,7 +350,7 @@ static const struct reg_name pci_reg_names[] = { { 0x20004, 0, 0, "ECAP_PB" }, { 0x20005, 0, 0, "ECAP_RCLINK" }, { 0x20006, 0, 0, "ECAP_RCILINK" }, - { 0x20007, 0, 0, "ECAP_RCECOLL" }, + { 0x20007, 0, 0, "ECAP_RCEC" }, { 0x20008, 0, 0, "ECAP_MFVC" }, { 0x20009, 0, 0, "ECAP_VC2" }, { 0x2000a, 0, 0, "ECAP_RBCB" },
tests/cap-rcec new file +299 -0
299 lines not on this page · raw message
Signature · 1 line
2.27.0
Quoted 4 lines · Sean V Kelley
Root Complex Event Collectors provide support for terminating error and PME messages from RCiEPs. This patch provides basic decoding for lspci RCEC Endpoint Association Extended Capability. See PCie 5.0-1, sec 7.9.10 for further details.
s/lspci/the/
s/PCie/PCIe/
Quoted 14 lines
Signed-off-by Sean V Kelley <[email protected]>--- lib/header.h | 8 +- ls-ecaps.c | 30 ++++- setpci.c | 2 +- tests/cap-rcec | 299 +++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 335 insertions(+), 4 deletions(-) create mode 100644 tests/cap-rceclib/header.h +0
-0
lib/header.h line 222
Quoted 5 lines
lib/header.h +1
-1@@ -219,7 +219,7 @@#define PCI_EXT_CAP_ID_PB 0x04/* Power Budgeting */ #define PCI_EXT_CAP_ID_RCLINK 0x05/* Root Complex Link Declaration */ #define PCI_EXT_CAP_ID_RCILINK 0x06/* Root Complex Internal Link Declaration */ -#define PCI_EXT_CAP_ID_RCECOLL 0x07/* Root Complex Event Collector */ +#define PCI_EXT_CAP_ID_RCEC 0x07/* Root Complex Event Collector */
OK, not super descriptive, but it does match the kernel's definition in pci_regs.h.
lib/header.h line 1051
Quoted 8 lines
lib/header.h +1
-0#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_RCRB 0x0a/* Root Complex Register Block */ @@ -1048,6 +1048,12 @@#define PCI_RCLINK_LINK_ADDR 8/* Link Entry: Address (64-bit) */ #define PCI_RCLINK_LINK_SIZE 16/* Link Entry: sizeof */ +/* Root Complex Event Collector */
This comment could mention "Endpoint Association", though.
Quoted 13 lines
lib/header.h +5
-0+#define PCI_RCEC_EP_CAP_VER (reg) (((reg) >> 16) & 0xf) +#define PCI_RCEC_BUSN_REG_VER 0x02/* as per PCIe sec 7.9.10.1 */ +#define PCI_RCEC_RCIEP_BMAP 0x0004/* as per PCIe sec 7.9.10.2 */ +#define PCI_RCEC_BUSN_REG 0x0008/* as per PCIe sec 7.9.10.3 */ +/* PCIe Vendor-Specific Capability */ #define PCI_EVNDR_HEADER 4/* Vendor-Specific Header */ #define PCI_EVNDR_REGISTERS 8/* Vendor-Specific Registers */ ls-ecaps.c +0
-0
ls-ecaps.c cap_rclink(struct device *d, int where) · line 640
Quoted 7 lines
ls-ecaps.c +4
-0@@ -634,6 +634,32 @@ cap_rclink(struct device *d, int where) } } +static void +cap_rcec (struct device *d,int where) +{ +printf ("Root Complex Event Collector\n" );
This could mention "Endpoint Association", too.
ls-ecaps.c cap_rclink(struct device *d, int where) · line 652
Quoted 12 lines
ls-ecaps.c +12
-0+if (verbose <2 ) +return ; + +if (!config_fetch (d, where,12 )) +return ; + +u32 hdr =get_conf_long (d, where); +byte cap_ver =PCI_RCEC_EP_CAP_VER (hdr); +u32 bmap =get_conf_long (d, where +PCI_RCEC_RCIEP_BMAP ); +printf ("\t\tDesc:\tCapabilityVersion=%02x RCiEPBitmap=%08x\n" , + cap_ver, + bmap);
I don't think "Desc:" is necessary.
Isn't "cap_ver" already printed as part of the header?
Capabilities: [160 v2] Root Complex Event Collector
^^
The "bmap" is a bitmap of device numbers of RCiEPs on the same bus as the RCEC that are associated with this RCEC. Could be decoded as a list, e.g., "0, 1, 2, 8" or "0-3, 8". Or maybe the hex bitmap is enough. Not sure how much trouble this would be worth or if there are other examples in lspci to copy.
Quoted 8 lines
ls-ecaps.c +8
-0+if (cap_ver <PCI_RCEC_BUSN_REG_VER ) +return ; + +u32 busn =get_conf_long (d, where +PCI_RCEC_BUSN_REG ); +printf ("\t\t\tRCECLastBus=%02x RCECFirstBus=%02x\n" , +BITS (busn,16 ,8 ), +BITS (busn,8 ,8 )); +}
Hi Bjorn,
Thanks for your review. My comments below:
Quoted 8 lines · Bjorn Helgaas
Quoted 4 lines · Sean V Kelley
Root Complex Event Collectors provide support for terminating error and PME messages from RCiEPs. This patch provides basic decoding for lspci RCEC Endpoint Association Extended Capability. See PCie 5.0-1, sec 7.9.10 for further details.
s/lspci/the/
s/PCie/PCIe/
Will fix.
Quoted 11 lines
Quoted 11 lines
Signed-off-by Sean V Kelley <[email protected]>--- lib/header.h | 8 +- ls-ecaps.c | 30 ++++- setpci.c | 2 +- tests/cap-rcec | 299 +++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 335 insertions(+), 4 deletions(-) create mode 100644 tests/cap-rcec
Quoted 16 lines
Quoted 9 lines
lib/header.h +0
-0@@ -219,7 +219,7 @@#define PCI_EXT_CAP_ID_PB 0x04/* Power Budgeting */ #define PCI_EXT_CAP_ID_RCLINK 0x05/* Root Complex Link Declaration */ #define PCI_EXT_CAP_ID_RCILINK 0x06/* Root Complex Internal Link Quoted 4 lines
Declaration */
-#definePCI_EXT_CAP_ID_RCECOLL0x07/* Root Complex Event Collector
*/
+#definePCI_EXT_CAP_ID_RCEC0x07/* Root Complex Event Collector */OK, not super descriptive, but it does match the kernel's definition in
pci_regs.h.
Yes, thanks.
Quoted 9 lines
Quoted 9 lines
#define
PCI_EXT_CAP_ID_MFVC0x08/* Multi-Function Virtual Channel
*/
#definePCI_EXT_CAP_ID_VC20x09/* Virtual Channel (2nd ID) */
#definePCI_EXT_CAP_ID_RCRB0x0a/* Root Complex Register Block */lib/header.h +0
-0@@ -1048,6 +1048,12 @@#define PCI_RCLINK_LINK_ADDR 8/* Link Entry: Address (64-bit) */ #define PCI_RCLINK_LINK_SIZE 16/* Link Entry: sizeof */
Quoted 3 lines
lib/header.h line 1051
Quoted 1 line
lib/header.h +1
-0+/* Root Complex Event Collector */ This comment could mention "Endpoint Association", though.
Will do, good point.
Quoted 17 lines
Quoted 17 lines
lib/header.h +5
-0+#define PCI_RCEC_EP_CAP_VER (reg) (((reg) >> 16) & 0xf) +#define PCI_RCEC_BUSN_REG_VER 0x02/* as per PCIe sec 7.9.10.1 */ +#define PCI_RCEC_RCIEP_BMAP 0x0004/* as per PCIe sec 7.9.10.2 */ +#define PCI_RCEC_BUSN_REG 0x0008/* as per PCIe sec 7.9.10.3 */ +/* PCIe Vendor-Specific Capability */ #define PCI_EVNDR_HEADER 4/* Vendor-Specific Header */ #define PCI_EVNDR_REGISTERS 8/* Vendor-Specific Registers */ ls-ecaps.c +0
-0@@ -634,6 +634,32 @@ cap_rclink(struct device *d, int where) } }
Quoted 6 lines
ls-ecaps.c cap_rclink(struct device *d, int where) · line 640
Quoted 4 lines
ls-ecaps.c +4
-0+static void +cap_rcec (struct device *d,int where) +{ +printf ("Root Complex Event Collector\n" );This could mention "Endpoint Association", too.
Will add.
Quoted 16 lines
ls-ecaps.c cap_rclink(struct device *d, int where) · line 652
Quoted 13 lines
ls-ecaps.c +12
-0+if (verbose <2 ) +return ; + +if (!config_fetch (d, where,12 )) +return ; + +u32 hdr =get_conf_long (d, where); +byte cap_ver =PCI_RCEC_EP_CAP_VER (hdr); +u32 bmap =get_conf_long (d, where +PCI_RCEC_RCIEP_BMAP ); +printf ("\t\tDesc:\tCapabilityVersion=%02x RCiEPBitmap=%08x\n" , + cap_ver, + bmap);I don't think "Desc:" is necessary.
Quoted 4 lines
Isn't "
cap_ver" already printed as part of the header?Capabilities: [160 v2] Root Complex Event Collector
^^
Correct, it’s the same. I can skip that.
Quoted 6 lines
The "bmap" is a bitmap of device numbers of RCiEPs on the same bus as the RCEC that are associated with this RCEC. Could be decoded as a list, e.g., "0, 1, 2, 8" or "0-3, 8". Or maybe the hex bitmap is enough. Not sure how much trouble this would be worth or if there are other examples in lspci to copy.
I think it could be worth it, I’ll have a look.
Thanks,
Sean
Quoted 9 lines
Quoted 9 lines
ls-ecaps.c +8
-0+if (cap_ver <PCI_RCEC_BUSN_REG_VER ) +return ; + +u32 busn =get_conf_long (d, where +PCI_RCEC_BUSN_REG ); +printf ("\t\t\tRCECLastBus=%02x RCECFirstBus=%02x\n" , +BITS (busn,16 ,8 ), +BITS (busn,8 ,8 )); +}