2024年4月2日发(作者:)

Linux系统之lspci命令介绍

lspci,顾名思义,就是显示所有的pci设备信息。pci是一种总线,

而通过pci总线连接的设备就是pci设备了。如今,我们常用的设备很

多都是采用pci总线了,如:网卡、存储

等。下面就简单介绍下该命令。

lspci:显示所有的pci设备信息。包括设备的BDF,设备类型,

厂商信息等。

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

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

面的实例可以看出其具体的区别。

[plain] view plain copy

print?

1. # lspci -s ff:13.1

2.

3. ff:13.1 System peripheral: Intel Corporation Broadwell Me

mory Controller 0 - Target Address/Thermal/RAS (rev 03)

4.

5. # lspci -mm -s ff:13.1

6.

7. 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个。

[plain] view plain copy

print?

1. # lspci -s ff:1f.2

2. ff:1f.2 System peripheral: Intel Corporation Broadwell Pow

er Control Unit (rev 03)

3.

4. # lspci -v -s ff:1f.2

5. ff:1f.2 System peripheral: Intel Corporation Broadwell Pow

er Control Unit (rev 03) Flags: fast devsel

6.

7. # lspci -vv -s ff:1f.2

8.

9. ff:1f.2 System peripheral: Intel Corporation Broadwell Pow

er Control Unit (rev 03)

10.

11. Control: I/O- Mem- BusMaster- SpecCycle- MemWINV

- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-

12.

13. Status: Cap- 66MHz- UDF- FastB2B- ParErr- DEVSEL=f

ast >TAbort- SERR-

14.

15. # lspci -vvv -s ff:1f.2

16.

17. ff:1f.2 System peripheral: Intel Corporation Broadwell

Power Control Unit (rev 03)

18.

19. Control: I/O- Mem- BusMaster- SpecCycle- MemWINV

- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-

20.

21. Status: Cap- 66MHz- UDF- FastB2B- ParErr- DEVSEL=f

ast >TAbort- SERR-

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 )显

示却不同。

[plain] view plain copy

print?

1. # lspci -b -s 0a:00.1; lspci -b -s 0a:10.0

2. 0a:00.1 Ethernet controller: Intel Corporation Ethernet Co

ntroller 10-Gigabit X540-AT2 (rev 01)

3. 0a:10.0 Ethernet controller: Illegal Vendor ID Device ffff (r

ev 01)

4. # lspci -s 0a:00.1; lspci -s 0a:10.0

5. 0a:00.1 Ethernet controller: Intel Corporation Ethernet Co

ntroller 10-Gigabit X540-AT2 (rev 01)

6. 0a:10.0 Ethernet controller: Intel Corporation X540 Ethern

et Controller Virtual Function (rev 01)

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

值。如下示例:

[plain] view plain copy

print?

1. # lspci -s 0a:00.0

2. 0a:00.0 Ethernet controller: Intel Corporation Ethernet Co

ntroller 10-Gigabit X540-AT2 (rev 01)

3.

4. # lspci -D -s 0a:00.0

5. 0000:0a:00.0 Ethernet controller: Intel Corporation Ethern

et Controller 10-Gigabit X540-AT2 (rev 01)

lspci -n/-nn:显示设备的vendor厂商号和device设备号;显示

厂商等信息和名称。

[plain] view plain copy

print?

1. # lspci -nn | grep ff:1f.2

2. ff:1f.2 System peripheral [0880]: Intel Corporation Broadw

ell Power Control Unit [8086:6f8a] (rev 03)

3.

4. # lspci -n | grep ff:1f.2

5. ff:1f.2 0880: 8086:6f8a (rev 03)

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

[plain] view plain copy

print?

1. # lspci -Q -s 0c:00.1

2.

3. 0c:00.1 Class 0200: Device 8086:1528 (rev 01)