Skip to content

CNB: pci: add several VPD helpers

Myron Stowe requested to merge mstowe1/centos-stream-9:redhat/v515vpd into main
This series updates the kernel's PCI subsystem Vital Product Data (VPD) with
content originating from v5.15-rc1 merge branch 74797618e202:
  Merge branch 'pci/vpd'
  Merge: 1295d187abfb 2c208abd4f9e

The impitus for this series originates with a Common Networking Backport 
(CNB) request.  Note however, that the updates agument 'struct pci_dev',
replacing its 'struct pci_vpd *vpd' member with the entire structure (see
upstream commit fd00faa375fb "PCI/VPD: Embed struct pci_vpd in struct 
pci_dev".  This would break RHEL's kABI so it would be best to get the
resolution included into RHEL 9 before kABI checking is enabled.

All patches back-ported cleanly with no conflicts or context fuzz.


Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2021298
Depends: N/A
Tested: 'lspci' knows how to access VPD data (See "Vital Product Data" below -
# uname -a
Linux <hostname> 5.14.0-12.v515vpd.el9.x86_64 #1 SMP Sun Nov 7 11:51:25 EST 2021 x86_64 x86_64 x86_64 GNU/Linux
# sudo lspci -vvvv -s 03:00.0 -xxxx
03:00.0 Ethernet controller: Broadcom Inc. and subsidiaries NetXtreme BCM5719 Gigabit Ethernet PCIe (rev 01)
        DeviceName: NIC Port 1
        Subsystem: Hewlett-Packard Company Ethernet 1Gb 4-port 331FLR Adapter
        Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr+ Stepping- SERR- FastB2B- DisINTx+
        Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
        Latency: 0, Cache Line Size: 64 bytes
        Interrupt: pin A routed to IRQ 51
        NUMA node: 0
        Region 0: Memory at f6bf0000 (64-bit, prefetchable) [size=64K]
        Region 2: Memory at f6be0000 (64-bit, prefetchable) [size=64K]
        Region 4: Memory at f6bd0000 (64-bit, prefetchable) [size=64K]
        Expansion ROM at f4000000 [virtual] [disabled] [size=256K]
        Capabilities: [48] Power Management version 3
                Flags: PMEClk- DSI- D1- D2- AuxCurrent=0mA PME(D0+,D1-,D2-,D3hot+,D3cold+)
                Status: D0 NoSoftRst+ PME-Enable- DSel=0 DScale=1 PME-
        Capabilities: [50] Vital Product Data
                Product Name: HP Ethernet 1Gb 4-port 331FLR Adapter
                Read-only fields:
                        [PN] Part number: 629133-001
                        [EC] Engineering changes: ECdate
                        [SN] Serial number: serial number
                        [V0] Vendor specific: PCIe x4 gen2, PW=5W
                        [V2] Vendor specific: MFG Date
                        [V4] Vendor specific: MAC address
                        [V5] Vendor specific: Rev A
                        [RV] Reserved: checksum good, 3 byte(s) reserved
                        [\x00] Unknown: 
                        ...
                        [\x00] Unknown: 
                Read/write fields:
                        [V1] Vendor specific: N/A
                        [V3] Vendor specific: FW ver 1.24
                        [V6] Vendor specific: PXE ver 15.0.12
                        [RW] Read-write area: 99 byte(s) free
                        [\x00] Unknown: 
                        ...
                        [\x00] Unknown: 
                End
        Capabilities: [58] MSI: Enable- Count=1/8 Maskable- 64bit+
                Address: 0000000000000000  Data: 0000
        Capabilities: [a0] MSI-X: Enable+ Count=17 Masked-
                Vector table: BAR=4 offset=00000000
                PBA: BAR=4 offset=00001000
        Capabilities: [ac] Express (v2) Endpoint, MSI 00
                DevCap: MaxPayload 256 bytes, PhantFunc 0, Latency L0s <4us, L1 <64us
                        ExtTag- AttnBtn- AttnInd- PwrInd- RBE+ FLReset+ SlotPowerLimit 0.000W
                DevCtl: CorrErr- NonFatalErr+ FatalErr+ UnsupReq-
                        RlxdOrd- ExtTag- PhantFunc- AuxPwr+ NoSnoop- FLReset-
                        MaxPayload 256 bytes, MaxReadReq 4096 bytes
                DevSta: CorrErr- NonFatalErr- FatalErr- UnsupReq- AuxPwr+ TransPend-
                LnkCap: Port #0, Speed 5GT/s, Width x4, ASPM L0s L1, Exit Latency L0s <1us, L1 <2us
                        ClockPM+ Surprise- LLActRep- BwNot- ASPMOptComp-
                LnkCtl: ASPM Disabled; RCB 64 bytes, Disabled- CommClk+
                        ExtSynch- ClockPM- AutWidDis- BWInt- AutBWInt-
                LnkSta: Speed 5GT/s (ok), Width x4 (ok)
                        TrErr- Train- SlotClk+ DLActive- BWMgmt- ABWMgmt-
                DevCap2: Completion Timeout: Range ABCD, TimeoutDis+ NROPrPrP- LTR-
                         10BitTagComp- 10BitTagReq- OBFF Not Supported, ExtFmt- EETLPPrefix-
                         EmergencyPowerReduction Not Supported, EmergencyPowerReductionInit-
                         FRS- TPHComp- ExtTPHComp-
                         AtomicOpsCap: 32bit- 64bit- 128bitCAS-
                DevCtl2: Completion Timeout: 50us to 50ms, TimeoutDis- LTR- OBFF Disabled,
                         AtomicOpsCtl: ReqEn-
                LnkCtl2: Target Link Speed: 2.5GT/s, EnterCompliance- SpeedDis-
                         Transmit Margin: Normal Operating Range, EnterModifiedCompliance- ComplianceSOS-
                         Compliance De-emphasis: -6dB
                LnkSta2: Current De-emphasis Level: -6dB, EqualizationComplete- EqualizationPhase1-
                         EqualizationPhase2- EqualizationPhase3- LinkEqualizationRequest-
                         Retimer- 2Retimers- CrosslinkRes: unsupported
        Capabilities: [100 v1] Advanced Error Reporting
                UESta:  DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF- MalfTLP- ECRC- UnsupReq+ ACSViol-
                UEMsk:  DLP- SDES- TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF- MalfTLP- ECRC- UnsupReq+ ACSViol-
                UESvrt: DLP- SDES+ TLP- FCP- CmpltTO- CmpltAbrt- UnxCmplt- RxOF- MalfTLP- ECRC- UnsupReq- ACSViol-
                CESta:  RxErr- BadTLP- BadDLLP- Rollover- Timeout- AdvNonFatalErr+
                CEMsk:  RxErr- BadTLP- BadDLLP- Rollover- Timeout- AdvNonFatalErr-
                AERCap: First Error Pointer: 00, ECRCGenCap+ ECRCGenEn- ECRCChkCap+ ECRCChkEn-
                        MultHdrRecCap- MultHdrRecEn- TLPPfxPres- HdrLogCap-
                HeaderLog: 04000001 0010000f 03070000 00000000
        Capabilities: [13c v1] Device Serial Number 00-00-2c-44-fd-85-65-5c
        Capabilities: [150 v1] Power Budgeting <?>
        Capabilities: [160 v1] Virtual Channel
                Caps:   LPEVC=0 RefClk=100ns PATEntryBits=1
                Arb:    Fixed- WRR32- WRR64- WRR128-
                Ctrl:   ArbSelect=Fixed
                Status: InProgress-
                VC0:    Caps:   PATOffset=00 MaxTimeSlots=1 RejSnoopTrans-
                        Arb:    Fixed- WRR32- WRR64- WRR128- TWRR128- WRR256-
                        Ctrl:   Enable+ ID=0 ArbSelect=Fixed TC/VC=ff
                        Status: NegoPending- InProgress-
        Kernel driver in use: tg3
        Kernel modules: tg3
00: e4 14 57 16 46 04 10 00 01 00 00 02 10 00 80 00
10: 0c 00 bf f6 00 00 00 00 0c 00 be f6 00 00 00 00
20: 0c 00 bd f6 00 00 00 00 00 00 00 00 3c 10 9d 16
30: 00 00 00 00 48 00 00 00 00 00 00 00 05 01 00 00
40: 00 00 00 00 00 00 00 a0 01 50 03 c8 08 20 00 64
50: 03 58 1c 83 00 00 00 78 05 a0 86 00 00 00 00 00
    ^^^^^^^^^^^^^^^^^^^^ VPD Capability
60: 00 00 00 00 00 00 00 00 98 02 01 f0 81 00 38 00


Signed-off-by: Myron Stowe <mstowe@redhat.com>
Edited by Myron Stowe

Merge request reports