zoukankan      html  css  js  c++  java
  • pci常用命令

    -x 以十六进制显示 PCI 配置空间 (configuration space) 的前64个字节映像 (标准头部信息)。此参数对调试驱动和 lspci 本身很有用

    -xxx 以十六进制显示所有 PCI 配置空间的映像。此选项只有 root 可用,并且很多 PCI 设备在你试图读取配置空间的未定义部分时会崩溃 (此操作可能不违反PCI标准,但是它至少非常愚蠢)。

    [root@localhost ~]# lspci -D -n  -x  -s  0000:05:00.0
    0000:05:00.0 0200: 19e5:0200 (rev 45)
    00: e5 19 00 02 46 01 18 00 45 00 00 02 08 00 00 00
    10: 0c 00 b0 07 00 08 00 00 0c 00 a2 08 00 08 00 00
    20: 0c 00 20 00 00 08 00 00 00 00 00 00 e5 19 39 d1
    30: 00 00 40 e6 40 00 00 00 00 00 00 00 ff 00 00 00
    
    [root@localhost ~]# lspci -D -n   -s  0000:05:00.0
    0000:05:00.0 0200: 19e5:0200 (rev 45)
    [root@localhost ~]# 

    lspci -D:显示PCI domain号,默认的不加参数命令并不显示该值。

    [root@localhost ~]# lspci -v | grep -i ether
    05:00.0 Ethernet controller: Huawei Technologies Co., Ltd. Hi1822 Family (2*25GE) (rev 45)
    06:00.0 Ethernet controller: Huawei Technologies Co., Ltd. Hi1822 Family (2*25GE) (rev 45)
    7d:00.0 Ethernet controller: Huawei Technologies Co., Ltd. HNS GE/10GE/25GE RDMA Network Controller (rev 21)
    7d:00.1 Ethernet controller: Huawei Technologies Co., Ltd. HNS GE/10GE/25GE Network Controller (rev 21)
    7d:00.2 Ethernet controller: Huawei Technologies Co., Ltd. HNS GE/10GE/25GE RDMA Network Controller (rev 21)
    7d:00.3 Ethernet controller: Huawei Technologies Co., Ltd. HNS GE/10GE/25GE Network Controller (rev 21)
    [root@localhost ~]# lspci -v -D | grep -i ether
    0000:05:00.0 Ethernet controller: Huawei Technologies Co., Ltd. Hi1822 Family (2*25GE) (rev 45)
    0000:06:00.0 Ethernet controller: Huawei Technologies Co., Ltd. Hi1822 Family (2*25GE) (rev 45)
    0000:7d:00.0 Ethernet controller: Huawei Technologies Co., Ltd. HNS GE/10GE/25GE RDMA Network Controller (rev 21)
    0000:7d:00.1 Ethernet controller: Huawei Technologies Co., Ltd. HNS GE/10GE/25GE Network Controller (rev 21)
    0000:7d:00.2 Ethernet controller: Huawei Technologies Co., Ltd. HNS GE/10GE/25GE RDMA Network Controller (rev 21)
    0000:7d:00.3 Ethernet controller: Huawei Technologies Co., Ltd. HNS GE/10GE/25GE Network Controller (rev 21)
    [root@localhost ~]# 

    查看内核驱动

    [root@localhost ~]#  lspci -s 05:00.0 -k
    05:00.0 Ethernet controller: Huawei Technologies Co., Ltd. Hi1822 Family (2*25GE) (rev 45)
            Subsystem: Huawei Technologies Co., Ltd. Device d139
            Kernel driver in use: vfio-pci
            Kernel modules: hinic
    [root@localhost ~]# 
    $ lspci -nnk -d 10de:13c2
    06:00.0 VGA compatible controller: NVIDIA Corporation GM204 [GeForce GTX 970] [10de:13c2] (rev a1)
        Kernel driver in use: vfio-pci
        Kernel modules: nouveau nvidia
    $ lspci -nnk -d 10de:0fbb
    06:00.1 Audio device: NVIDIA Corporation GM204 High Definition Audio Controller [10de:0fbb] (rev a1)
        Kernel driver in use: vfio-pci
        Kernel modules: snd_hda_intel
    [root@localhost dpdk-19.11]# ./usertools/dpdk-devbind.py -s
    
    Network devices using DPDK-compatible driver
    ============================================
    0000:05:00.0 'Hi1822 Family (2*25GE) 0200' drv=vfio-pci unused=hinic,igb_uio
    
    Network devices using kernel driver
    ===================================
    0000:7d:00.0 'HNS GE/10GE/25GE RDMA Network Controller a222' if=enp125s0f0 drv=hns3 unused=hns_roce_hw_v2,igb_uio,vfio-pci *Active*
    0000:7d:00.1 'HNS GE/10GE/25GE Network Controller a221' if=enp125s0f1 drv=hns3 unused=igb_uio,vfio-pci 
    0000:7d:00.2 'HNS GE/10GE/25GE RDMA Network Controller a222' if=enp125s0f2 drv=hns3 unused=hns_roce_hw_v2,igb_uio,vfio-pci 
    0000:7d:00.3 'HNS GE/10GE/25GE Network Controller a221' if=enp125s0f3 drv=hns3 unused=igb_uio,vfio-pci 
    
    Other Network devices
    =====================
    0000:06:00.0 'Hi1822 Family (2*25GE) 0200' unused=hinic,igb_uio,vfio-pci
    [root@localhost ~]#  lspci -v -nn -s 06:00.0
    06:00.0 Ethernet controller [0200]: Huawei Technologies Co., Ltd. Hi1822 Family (2*25GE) [19e5:0200] (rev 45)
            Subsystem: Huawei Technologies Co., Ltd. Device [19e5:d139]
            Flags: fast devsel, NUMA node 0
            Memory at 80010400000 (64-bit, prefetchable) [disabled] [size=128K]
            Memory at 80011320000 (64-bit, prefetchable) [disabled] [size=32K]
            Memory at 80008b00000 (64-bit, prefetchable) [disabled] [size=1M]
            Expansion ROM at e9300000 [disabled] [size=1M]
            Capabilities: [40] Express Endpoint, MSI 00
            Capabilities: [80] MSI: Enable- Count=1/32 Maskable+ 64bit+
            Capabilities: [a0] MSI-X: Enable- Count=32 Masked-
            Capabilities: [b0] Power Management version 3
            Capabilities: [c0] Vital Product Data
            Capabilities: [100] Advanced Error Reporting
            Capabilities: [150] Alternative Routing-ID Interpretation (ARI)
            Capabilities: [200] Single Root I/O Virtualization (SR-IOV)
            Capabilities: [310] #19
            Capabilities: [4e0] Device Serial Number 44-a1-91-ff-ff-a4-9b-ec
            Capabilities: [4f0] Transaction Processing Hints
            Capabilities: [600] Vendor Specific Information: ID=0000 Rev=0 Len=028 <?>
            Capabilities: [630] Access Control Services
            Kernel modules: hinic            ---没有kernel driver
    [root@localhost ~]#  lspci -v -nn -s 05:00.0
    05:00.0 Ethernet controller [0200]: Huawei Technologies Co., Ltd. Hi1822 Family (2*25GE) [19e5:0200] (rev 45)
            Subsystem: Huawei Technologies Co., Ltd. Device [19e5:d139]
            Flags: fast devsel, NUMA node 0
            [virtual] Memory at 80007b00000 (64-bit, prefetchable) [size=128K]
            [virtual] Memory at 80008a20000 (64-bit, prefetchable) [size=32K]
            [virtual] Memory at 80000200000 (64-bit, prefetchable) [size=1M]
            Expansion ROM at e9200000 [disabled] [size=1M]
            Capabilities: [40] Express Endpoint, MSI 00
            Capabilities: [80] MSI: Enable- Count=1/32 Maskable+ 64bit+
            Capabilities: [a0] MSI-X: Enable- Count=32 Masked-
            Capabilities: [b0] Power Management version 3
            Capabilities: [c0] Vital Product Data
            Capabilities: [100] Advanced Error Reporting
            Capabilities: [150] Alternative Routing-ID Interpretation (ARI)
            Capabilities: [200] Single Root I/O Virtualization (SR-IOV)
            Capabilities: [310] #19
            Capabilities: [4e0] Device Serial Number 44-a1-91-ff-ff-a4-9b-eb
            Capabilities: [4f0] Transaction Processing Hints
            Capabilities: [600] Vendor Specific Information: ID=0000 Rev=0 Len=028 <?>
            Capabilities: [630] Access Control Services
            Kernel driver in use: vfio-pci
            Kernel modules: hinic
    [root@localhost vfio-pci]# lspci | grep -i ether
    05:00.0 Ethernet controller: Huawei Technologies Co., Ltd. Hi1822 Family (2*25GE) (rev 45)
    06:00.0 Ethernet controller: Huawei Technologies Co., Ltd. Hi1822 Family (2*25GE) (rev 45)
    7d:00.0 Ethernet controller: Huawei Technologies Co., Ltd. HNS GE/10GE/25GE RDMA Network Controller (rev 21)
    7d:00.1 Ethernet controller: Huawei Technologies Co., Ltd. HNS GE/10GE/25GE Network Controller (rev 21)
    7d:00.2 Ethernet controller: Huawei Technologies Co., Ltd. HNS GE/10GE/25GE RDMA Network Controller (rev 21)
    7d:00.3 Ethernet controller: Huawei Technologies Co., Ltd. HNS GE/10GE/25GE Network Controller (rev 21)
    [root@localhost vfio-pci]# 
    Then to get the ids, use:
    
    $ lspci -v -n -s 03:00.0
    03:00.0 0280: 8086:0085 (rev 34)
        Subsystem: 8086:1311
        Flags: bus master, fast devsel, latency 0, IRQ 52
    You can also find the same information in /sys:
    
    $ cd /sys/bus/pci/devices/0000:03:00.0 
    $ cat vendor device 
    0x8086
    0x0085
    $ cat subsystem_vendor subsystem_device 
    0x8086
    0x1311
    [root@localhost ~]#  lspci -v -n -s 0000:06:00.0
    06:00.0 0200: 19e5:0200 (rev 45)
            Subsystem: 19e5:d139
            Flags: fast devsel, NUMA node 0
            Memory at 80010400000 (64-bit, prefetchable) [disabled] [size=128K]
            Memory at 80011320000 (64-bit, prefetchable) [disabled] [size=32K]
            Memory at 80008b00000 (64-bit, prefetchable) [disabled] [size=1M]
            Expansion ROM at e9300000 [disabled] [size=1M]
            Capabilities: [40] Express Endpoint, MSI 00
            Capabilities: [80] MSI: Enable- Count=1/32 Maskable+ 64bit+
            Capabilities: [a0] MSI-X: Enable- Count=32 Masked-
            Capabilities: [b0] Power Management version 3
            Capabilities: [c0] Vital Product Data
            Capabilities: [100] Advanced Error Reporting
            Capabilities: [150] Alternative Routing-ID Interpretation (ARI)
            Capabilities: [200] Single Root I/O Virtualization (SR-IOV)
            Capabilities: [310] #19
            Capabilities: [4e0] Device Serial Number 44-a1-91-ff-ff-a4-9b-ec
            Capabilities: [4f0] Transaction Processing Hints
            Capabilities: [600] Vendor Specific Information: ID=0000 Rev=0 Len=028 <?>
            Capabilities: [630] Access Control Services
            Kernel modules: hinic
    
    [root@localhost ~]#  lspci -vv -nn -s 0000:06:00.0
    06:00.0 Ethernet controller [0200]: Huawei Technologies Co., Ltd. Hi1822 Family (2*25GE) [19e5:0200] (rev 45)
            Subsystem: Huawei Technologies Co., Ltd. Device [19e5:d139]
            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-
            NUMA node: 0
            Region 0: Memory at 80010400000 (64-bit, prefetchable) [disabled] [size=128K]
            Region 2: Memory at 80011320000 (64-bit, prefetchable) [disabled] [size=32K]
            Region 4: Memory at 80008b00000 (64-bit, prefetchable) [disabled] [size=1M]
            Expansion ROM at e9300000 [disabled] [size=1M]
            Capabilities: [40] Express (v2) Endpoint, MSI 00
                    DevCap: MaxPayload 512 bytes, PhantFunc 0, Latency L0s unlimited, L1 unlimited
                            ExtTag+ AttnBtn- AttnInd- PwrInd- RBE+ FLReset+ SlotPowerLimit 0.000W
                    DevCtl: Report errors: Correctable+ Non-Fatal+ Fatal+ Unsupported-
                            RlxdOrd+ ExtTag+ PhantFunc- AuxPwr- NoSnoop+ FLReset-
                            MaxPayload 256 bytes, MaxReadReq 512 bytes
                    DevSta: CorrErr+ UncorrErr- FatalErr- UnsuppReq+ AuxPwr+ TransPend-
                    LnkCap: Port #0, Speed 8GT/s, Width x16, ASPM not supported, Exit Latency L0s unlimited, L1 unlimited
                            ClockPM- Surprise- LLActRep- BwNot- ASPMOptComp+
                    LnkCtl: ASPM Disabled; RCB 128 bytes Disabled- CommClk-
                            ExtSynch- ClockPM- AutWidDis- BWInt- AutBWInt-
                    LnkSta: Speed 8GT/s, Width x16, TrErr- Train- SlotClk- DLActive- BWMgmt- ABWMgmt-
                    DevCap2: Completion Timeout: Range B, TimeoutDis+, LTR-, OBFF Not Supported
                    DevCtl2: Completion Timeout: 50us to 50ms, TimeoutDis-, LTR-, OBFF Disabled
                    LnkCtl2: Target Link Speed: 8GT/s, EnterCompliance- SpeedDis-
                             Transmit Margin: Normal Operating Range, EnterModifiedCompliance- ComplianceSOS-
                             Compliance De-emphasis: -6dB
                    LnkSta2: Current De-emphasis Level: -3.5dB, EqualizationComplete+, EqualizationPhase1+
                             EqualizationPhase2+, EqualizationPhase3+, LinkEqualizationRequest-
            Capabilities: [80] MSI: Enable- Count=1/32 Maskable+ 64bit+
                    Address: 0000000000000000  Data: 0000
                    Masking: 00000000  Pending: 00000000
            Capabilities: [a0] MSI-X: Enable- Count=32 Masked-
                    Vector table: BAR=2 offset=00000000
                    PBA: BAR=2 offset=00004000
            Capabilities: [b0] 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=0 PME-
            Capabilities: [c0] Vital Product Data
                    Product Name: Huawei IN200 2*100GE Adapter
                    Read-only fields:
                            [PN] Part number: SP572
                    End
            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- NonFatalErr+
                    CEMsk:  RxErr- BadTLP- BadDLLP- Rollover- Timeout- NonFatalErr-
                    AERCap: First Error Pointer: 14, GenCap+ CGenEn- ChkCap+ ChkEn-
            Capabilities: [150 v1] Alternative Routing-ID Interpretation (ARI)
                    ARICap: MFVC- ACS-, Next Function: 0
                    ARICtl: MFVC- ACS-, Function Group: 0
            Capabilities: [200 v1] Single Root I/O Virtualization (SR-IOV)
                    IOVCap: Migration-, Interrupt Message Number: 000
                    IOVCtl: Enable- Migration- Interrupt- MSE- ARIHierarchy+
                    IOVSta: Migration-
                    Initial VFs: 120, Total VFs: 120, Number of VFs: 0, Function Dependency Link: 00
                    VF offset: 1, stride: 1, Device ID: 375e
                    Supported Page Size: 00000553, System Page Size: 00000010
                    Region 0: Memory at 0000080010420000 (64-bit, prefetchable)
                    Region 2: Memory at 0000080010ba0000 (64-bit, prefetchable)
                    Region 4: Memory at 0000080008c00000 (64-bit, prefetchable)
                    VF Migration: offset: 00000000, BIR: 0
            Capabilities: [310 v1] #19
            Capabilities: [4e0 v1] Device Serial Number 44-a1-91-ff-ff-a4-9b-ec
            Capabilities: [4f0 v1] Transaction Processing Hints
                    Device specific mode supported
                    No steering table available
            Capabilities: [600 v1] Vendor Specific Information: ID=0000 Rev=0 Len=028 <?>
            Capabilities: [630 v1] Access Control Services
                    ACSCap: SrcValid- TransBlk- ReqRedir- CmpltRedir- UpstreamFwd- EgressCtrl- DirectTrans-
                    ACSCtl: SrcValid- TransBlk- ReqRedir- CmpltRedir- UpstreamFwd- EgressCtrl- DirectTrans-
            Kernel modules: hinic
    [root@localhost ~]#  lspci -v -n -d 19e5:0200
    05:00.0 0200: 19e5:0200 (rev 45)
            Subsystem: 19e5:d139
            Flags: fast devsel, NUMA node 0
            [virtual] Memory at 80007b00000 (64-bit, prefetchable) [size=128K]
            [virtual] Memory at 80008a20000 (64-bit, prefetchable) [size=32K]
            [virtual] Memory at 80000200000 (64-bit, prefetchable) [size=1M]
            Expansion ROM at e9200000 [disabled] [size=1M]
            Capabilities: [40] Express Endpoint, MSI 00
            Capabilities: [80] MSI: Enable- Count=1/32 Maskable+ 64bit+
            Capabilities: [a0] MSI-X: Enable- Count=32 Masked-
            Capabilities: [b0] Power Management version 3
            Capabilities: [c0] Vital Product Data
            Capabilities: [100] Advanced Error Reporting
            Capabilities: [150] Alternative Routing-ID Interpretation (ARI)
            Capabilities: [200] Single Root I/O Virtualization (SR-IOV)
            Capabilities: [310] #19
            Capabilities: [4e0] Device Serial Number 44-a1-91-ff-ff-a4-9b-eb
            Capabilities: [4f0] Transaction Processing Hints
            Capabilities: [600] Vendor Specific Information: ID=0000 Rev=0 Len=028 <?>
            Capabilities: [630] Access Control Services
            Kernel driver in use: vfio-pci
            Kernel modules: hinic
    [root@localhost ~]#  lspci -v -n -d 19e5:0200   --两个设备
    05:00.0 0200: 19e5:0200 (rev 45)
            Subsystem: 19e5:d139
            Flags: fast devsel, NUMA node 0
            [virtual] Memory at 80007b00000 (64-bit, prefetchable) [size=128K]
            [virtual] Memory at 80008a20000 (64-bit, prefetchable) [size=32K]
            [virtual] Memory at 80000200000 (64-bit, prefetchable) [size=1M]
            Expansion ROM at e9200000 [disabled] [size=1M]
            Capabilities: [40] Express Endpoint, MSI 00
            Capabilities: [80] MSI: Enable- Count=1/32 Maskable+ 64bit+
            Capabilities: [a0] MSI-X: Enable- Count=32 Masked-
            Capabilities: [b0] Power Management version 3
            Capabilities: [c0] Vital Product Data
            Capabilities: [100] Advanced Error Reporting
            Capabilities: [150] Alternative Routing-ID Interpretation (ARI)
            Capabilities: [200] Single Root I/O Virtualization (SR-IOV)
            Capabilities: [310] #19
            Capabilities: [4e0] Device Serial Number 44-a1-91-ff-ff-a4-9b-eb
            Capabilities: [4f0] Transaction Processing Hints
            Capabilities: [600] Vendor Specific Information: ID=0000 Rev=0 Len=028 <?>
            Capabilities: [630] Access Control Services
            Kernel driver in use: vfio-pci
            Kernel modules: hinic
    
    06:00.0 0200: 19e5:0200 (rev 45)
            Subsystem: 19e5:d139
            Flags: fast devsel, NUMA node 0
            Memory at 80010400000 (64-bit, prefetchable) [disabled] [size=128K]
            Memory at 80011320000 (64-bit, prefetchable) [disabled] [size=32K]
            Memory at 80008b00000 (64-bit, prefetchable) [disabled] [size=1M]
            Expansion ROM at e9300000 [disabled] [size=1M]
            Capabilities: [40] Express Endpoint, MSI 00
            Capabilities: [80] MSI: Enable- Count=1/32 Maskable+ 64bit+
            Capabilities: [a0] MSI-X: Enable- Count=32 Masked-
            Capabilities: [b0] Power Management version 3
            Capabilities: [c0] Vital Product Data
            Capabilities: [100] Advanced Error Reporting
            Capabilities: [150] Alternative Routing-ID Interpretation (ARI)
            Capabilities: [200] Single Root I/O Virtualization (SR-IOV)
            Capabilities: [310] #19
            Capabilities: [4e0] Device Serial Number 44-a1-91-ff-ff-a4-9b-ec
            Capabilities: [4f0] Transaction Processing Hints
            Capabilities: [600] Vendor Specific Information: ID=0000 Rev=0 Len=028 <?>
            Capabilities: [630] Access Control Services
            Kernel modules: hinic
    
    [root@localhost ~]# 

    linux lspci查看pci总线设备信息

    linux中lspci是一个用来显示系统中所有PCI总线设备或连接到该总线上的所有设备的工具,比如查看网卡、存储等信息。

    参数

    -v 使得 lspci 以冗余模式显示所有设备的详细信息。

    -vv 使得 lspci 以过冗余模式显示更详细的信息 (事实上是 PCI 设备能给出的所有东西)。这些数据的确切意义没有在此手册页中解释,如果你想知道更多,请参照 /usr/include/linux/pci.h 或者 PCI 规范。

    -n 以数字形式显示 PCI 生产厂商和设备号,而不是在 PCI ID 数据库中查找它们。

    -x 以十六进制显示 PCI 配置空间 (configuration space) 的前64个字节映像 (标准头部信息)。此参数对调试驱动和 lspci 本身很有用

    -xxx 以十六进制显示所有 PCI 配置空间的映像。此选项只有 root 可用,并且很多 PCI 设备在你试图读取配置空间的未定义部分时会崩溃 (此操作可能不违反PCI标准,但是它至少非常愚蠢)。

    -b 以总线为中心进行查看。显示所有 IRQ 号和记忆体地址,就像 PCI 总线上的卡看到的一样,而不是核心看到的内容。

    -t 以树形方式显示包含所有总线、桥、设备和它们的连接的图表。

    -s [[]:][][.[]] 仅显示指定总线、插槽上的设备或设备上的功能块信息。设备地址的任何部分都可以忽略,或以「*」代替 (意味著所有值)。所有数字都是十六进制。例如:「0:」指的是在0号总线上的所有设备;「0」指的是在任意总线上0号设备的所有功能块;「0.3」选择 了所有总线上0号设备的第三个功能块;「.4」则是只列出每一设备上的第四个功能块。

    -d []:[] 只显示指定生产厂商和设备 ID 的设备。 这两个 ID 都以十六进制表示,可以忽略或者以「*」代替 (意味著所有值)。

     

    -i使用作为 PCI ID 数据库而不是使用预设的 /usr/share/hwdata/pci.ids。

    -m 以机器可读的方式转储 PCI 设备数据 (支持两种模式:普通和冗余),便於稿本解析。

    -M 使用总线映射模式,这种模式对总线进行全面地扫描以查明总线上的所有设备,包括配置错误的桥之后的设备。请注意,此操作只应在调试时使 用,并可能造成系统崩溃 (只在设备有错误的时候,但是不幸的是它们存在),此命令只有 root 可以使用。同时,在不直接接触硬体的 PCI 访问模式中使用 -M 参数没有意义,因为显示的结果 (排除 lspci 中的 bug 的影响) 与普通的列表模式相同。

    --version 显示 lspci 的版本。这个选项应当单独使用。

    -P使用 linux 2.1 风格的配置,直接访问目录而非 /proc/bus/pci 目录。(只能在linux 2.1或以上版本中使用)

    -H1 通过 Intel 架构 1 来实现直接硬体访问。(只能用於 i386 及其相容机)

    -H2 通过Intel 架构2来实现直接硬体访问。警告:此模式只能寻址任何总线上的前16个设备,并且在很多情况下相当不可靠。(只能用於 i386 及其相容机)

    -S 使用 PCI 系统调用访问。(只能用於 Alpha 和 Ultra-Sparc 上的 Linux)

     

    -F从所给的包含 lspci -x 命令输出的档案中获取相关信息。这在分析使用者提交的错误报告时很有用,因为你可以用任何方式来显示硬体配置信息而无需为了获取更多信息打扰使用者。(可用於所有系统)

    -G 增加库的调试等级。(可用於所有系统)

    实例

    lspci -t [BDF]:显示指定BDF号的设备信息。

    lspci -m/-mm:以一种机器可读的格式来显示pci设备信息。

    # lspci -s ff:13.1
    ff:13.1 System peripheral: Intel Corporation Broadwell Memory Controller 0 - Target Address/Thermal/RAS (rev 03)
    # lspci -mm -s ff:13.1
    ff:13.1 "System peripheral" "Intel Corporation" "Broadwell Memory Controller 0 - Target Address/Thermal/RAS" -r03 "Intel Corporation" "Broadwell Memory Controller 0 - Target Address/Thermal/RAS"
    

    lspci -t:以树的形式显示pci设备信息。

    lspci -v/-vv/-vvv:显示详细的pci设备信息,v越多,越详细,当然,上限3个。

    lspci -x/-xxx/-xxxx:-x以16进制信息显示pci配置空间;-xxx显示部分读配置空间会crash的设备;-xxxx显示PCI-x2.0或者PCI-e总线扩展的配置空间。

    lspci -b:以总线的角度来显示所有的IRQ和地址。根据我的观察,大部分信息和不带参数时显示一致,除了SR-IOV设备分配出的Virtual Function设备。如下示例:物理网卡PF(physical function )显示一直 ,但VF(virtual function )显示却不同。

     
    # lspci -b -s 0a:00.1; lspci -b -s 0a:10.0
    0a:00.1 Ethernet controller: Intel Corporation Ethernet Controller 10-Gigabit X540-AT2 (rev 01)
    0a:10.0 Ethernet controller: Illegal Vendor ID Device ffff (rev 01)
    # lspci -s 0a:00.1; lspci -s 0a:10.0
    0a:00.1 Ethernet controller: Intel Corporation Ethernet Controller 10-Gigabit X540-AT2 (rev 01)
    0a:10.0 Ethernet controller: Intel Corporation X540 Ethernet Controller Virtual Function (rev 01)
    

    lspci -D:显示PCI domain号,默认的不加参数命令并不显示该值。

    lspci -n/-nn:显示设备的vendor厂商号和device设备号;显示厂商等信息和名称。

    # lspci -nn | grep ff:1f.2
    ff:1f.2 System peripheral [0880]: Intel Corporation Broadwell Power Control Unit [8086:6f8a] (rev 03)
    # lspci -n | grep ff:1f.2
    ff:1f.2 0880: 8086:6f8a (rev 03)
    

    lspci -D:显示设备的厂商号、设备号、Class号。

    # lspci -Q -s 0c:00.1
    0c:00.1 Class 0200: Device 8086:1528 (rev 01)





    lspci:显示所有的PCI总线设备信息。
    
    下面试lspci的全部功能介绍:
    
    $ lspci -
    Usage: lspci [<switches>]
     
    Basic display modes:
    -mm        Produce machine-readable output (single -m for an obsolete format)
            #生成机器可读的输出(单个-m用于过时的格式)
    -t        Show bus tree
            #显示巴士树
    Display options:
    -v        Be verbose (-vv for very verbose)
            #详细(-vv非常详细)
    -k        Show kernel drivers handling each device
            #显示处理每个设备的内核驱动
    -x        Show hex-dump of the standard part of the config space
            #显示配置空间的标准部分的十六进制转储
    -xxx        Show hex-dump of the whole config space (dangerous; root only)
            #显示整个配置空间的十六进制转储(危险;只有root)
    -xxxx        Show hex-dump of the 4096-byte extended config space (root only)
            #显示4096字节扩展配置空间的十六进制转储(仅限root用户)
    -b        Bus-centric view (addresses and IRQ's as seen by the bus)
            #以总线为中心的视图(巴士所看到的地址和IRQ)
    -D        Always show domain numbers
            #始终显示域名编号
    Resolving of device ID's to names:
    -n        Show numeric ID's#将设备ID解析为名称:
    -nn        Show both textual and numeric ID's (names & numbers)
            #显示文本和数字ID(姓名和号码)
    -q        Query the PCI ID database for unknown ID's via DNS
            #通过DNS查询未知ID的PCI ID数据库
    -qq        As above, but re-query locally cached entries
            #如上所述,但重新查询本地缓存条目
    -Q        Query the PCI ID database for all ID's via DNS
            #通过DNS查询所有ID的PCI ID数据库
     
    Selection of devices:
    -s [[[[<domain>]:]<bus>]:][<slot>][.[<func>]]    Show only devices in selected slots
                            #仅显示选定插槽中的设备
    -d [<vendor>]:[<device>][:<class>]        Show only devices with specified ID's
                            #仅显示具有指定ID的设备
     
    Other options:
    -i <file>    Use specified ID database instead of /usr/share/hwdata/pci.ids
            #使用指定的ID数据库而不是/usr/share/hwdata/pci.ids
    -p <file>    Look up kernel modules in a given file instead of default modules.pcimap
            #查找给定文件中的内核模块而不是默认的modules.pcimap
    -M        Enable `bus mapping' mode (dangerous; root only)
            #启用`总线映射'模式(危险;只有root)
     
    PCI access options:
    -A <method>    Use the specified PCI access method (see `-A help' for a list)
            #使用指定的PCI访问方法(请参阅`-A help'获取列表)
    -O <par>=<val>    Set PCI access parameter (see `-O help' for a list)
            #设置PCI访问参数(请参阅“-O帮助”获取列表)
    -G        Enable PCI access debugging
            #启用PCI访问调试
    -H <mode>    Use direct hardware access (<mode> = 1 or 2)
            #使用直接硬件访问(<mode> = 1或2)
    -F <file>    Read PCI configuration dump from a given file
            #从给定文件读取PCI配置转储
    简单的几个例子:(grep指令:https://blog.csdn.net/rong_toa/article/details/79799127)
    
    #查看显卡信息
    $ lspci | grep -i vga
    00:0f.0 VGA compatible controller: VMware SVGA II Adapter
    #只显示制定槽中的设备
    $ lspci -s 00:0f.0
    00:0f.0 VGA compatible controller: VMware SVGA II Adapter
    #用机器可读的形式输出
    $ lspci -mm -s 00:0f.0
    00:0f.0 "VGA compatible controller" "VMware" "SVGA II Adapter" "VMware" "SVGA II Adapter"
     
    $ lspci -Q -s 00:0f.0
    00:0f.0 VGA compatible controller: VMware SVGA II Adapter
    $ lspci -D -s 00:0f.0
    0000:00:0f.0 VGA compatible controller: VMware SVGA II Adapter
    查看详细信息:
    
    $ lspci -v -s 00:0f.0
    00:0f.0 VGA compatible controller: VMware SVGA II Adapter (prog-if 00 [VGA controller])
        Subsystem: VMware SVGA II Adapter
        Flags: bus master, medium devsel, latency 64, IRQ 16
        I/O ports at 1070 [size=16]
        Memory at e8000000 (32-bit, prefetchable) [size=128M]
        Memory at fe000000 (32-bit, non-prefetchable) [size=8M]
        [virtual] Expansion ROM at c0000000 [disabled] [size=32K]
        Capabilities: <access denied>
        Kernel driver in use: vmwgfx
  • 相关阅读:
    redis学习
    win2008下c#调用directshow问题
    vs2005升级到vs2010相关问题
    spark-shell 启动失败,显示端口问题
    监控spark-sql 等脚本
    spark 相关配置 shuffle 相关配置选项
    spark on Yarn 语句
    使用hive thriftserver 连接spark sql
    HBase 报错系列之region is not online
    HBase 表迁移中对丢失的表检查使用的语句
  • 原文地址:https://www.cnblogs.com/dream397/p/13605861.html
Copyright © 2011-2022 走看看