-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