pciutils: Add available DVSEC Details
Subsystems (2)
cover pciutils: Add available DVSEC Details
Add separate Designated Vendor Specific Capability (DVSEC) defines and cap function so as to align with PCIe r5.0, sec 7.9.6.2 terms and provide available details. First step in later adding support for CXL.
Sean V Kelley (1):
lspci: Add available DVSEC details
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
--
2.26.0
PATCH 1/1 lspci: Add available DVSEC details
Instead of current generic 'unknown' output for DVSEC, add 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 Extended Capability:\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
Re: [Patch 1/1] lspci: Add available DVSEC details
Quoted 5 lines · Sean V Kelley
Instead of current generic 'unknown' output for DVSEC, add details on Vendor ID, Rev, etc.
Suggested-by Bjorn Helgaas <[email protected]>Signed-off-by Sean V Kelley <[email protected]>
Looks good to me.
ls-ecaps.c cap_rclink(struct device *d, int where) · line 642
Quoted 6 lines
ls-ecaps.c +6
-0+static void +cap_dvsec (struct device *d,int where) +{ +u32 hdr; + +printf ("Designated Vendor Specific Extended Capability:\n" );
s/Vendor Specific/Vendor-Specific/ to match the spec usage s/ Extended Capability:// to match other lspci capability output (?)
tests/cap-dvsec line 84
Quoted 8 lines
+4e:00.0 Unassigned class [ff00]: Intel Corporation Device 0d93
tests/cap-dvsec new file +6
-0+ Capabilities: [d00 v1] Vendor Specific Information: ID=0040 Rev=1 Len=04c <?> + Capabilities: [e00 v1] Designated Vendor Specific Extended Capability: + DVSEC Vendor ID=8086 Rev=0 Len=038 <?> + DVSEC ID=0000 <?> + Capabilities: [e38 v1] Device Serial Number 12-34-56-78-90-00-00-00 +00: 86 80 93 0d 00 00 10 00 00 00 00 ff 00 00 80 00
Obviously this class code is wrong. I assume it'll be fixed in real hardware, but ironically we've just spent a few days chasing a problem because of a Google Edge TPU with invalid class code. In that case, Linux doesn't assign resources to BARs, so things fall apart after that.
Re: [Patch 1/1] lspci: Add available DVSEC details
Quoted 9 lines · Bjorn Helgaas
Quoted 5 lines · Sean V Kelley
Instead of current generic 'unknown' output for DVSEC, add details on Vendor ID, Rev, etc.
Suggested-by Bjorn Helgaas <[email protected]>Signed-off-by Sean V Kelley <[email protected]>Looks good to me.
Quoted 11 lines
ls-ecaps.c cap_rclink(struct device *d, int where) · line 642
Quoted 6 lines
ls-ecaps.c +6
-0+static void +cap_dvsec (struct device *d,int where) +{ +u32 hdr; + +printf ("Designated Vendor Specific Extended Capability:\n" );s/Vendor Specific/Vendor-Specific/ to match the spec usage s/ Extended Capability:// to match other lspci capability output (?)
Sure, sounds good.
Quoted 12 lines
Quoted 11 lines
+4e:00.0 Unassigned class [ff00]: Intel Corporation Device 0d93
+ Capabilities: [d00 v1] Vendor Specific Information: ID=0040
Rev=1 Len=04c <?>
+ Capabilities: [e00 v1] Designated Vendor Specific Extended
Capability:tests/cap-dvsec new file +3
-0+ DVSEC Vendor ID=8086 Rev=0 Len=038 <?> + DVSEC ID=0000 <?> + Capabilities: [e38 v1] Device Serial Number12-34-56-78-90-00-00-00
+00: 86 80 93 0d 00 00 10 00 00 00 00 ff 00 00 80 00
Quoted 5 lines
Obviously this class code is wrong. I assume it'll be fixed in real hardware, but ironically we've just spent a few days chasing a problem because of a Google Edge TPU with invalid class code. In that case, Linux doesn't assign resources to BARs, so things fall apart after that.
Wow. Easy to forget how much depends on it. Yes, it will be fixed in real hardware with real IDs. :)
Thanks,
Sean