lspci
lspci
is a handy GNU/Linux command-line utility which will display all kinds of incriminating information about a computers PCI and PCIe devices. It is provided by the pciutils
package.
Examples[edit]
lspci
will, without any arguments, show a simple list of the devices that are connected to the system - not just those that are in PCI(e) slots; it will also show bridges and on-board devices. Here is a partial example of what lspci
s output will look like:
lspci
(partial output)02:04.0 PCI bridge: Advanced Micro Devices, Inc. [AMD] 300 Series Chipset PCIe Port (rev 02)
03:00.0 USB controller: ASMedia Technology Inc. ASM1143 USB 3.1 Host Controller
04:00.0 Ethernet controller: Intel Corporation I211 Gigabit Network Connection (rev 03)
05:00.0 Ethernet controller: Qualcomm Atheros Killer E2500 Gigabit Ethernet Controller (rev 10)
07:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Ellesmere [Radeon RX 470/480/570/570X/580/580X/590] (rev ef)
07:00.1 Audio device: Advanced Micro Devices, Inc. [AMD/ATI] Ellesmere HDMI Audio [Radeon RX 470/480 / 570/580/590]
Adding the -v
will make lspci
output a lot more information about each device. Adding it twice (-vv
) adds even more information to that list. Most of the information lspci -v
and lspci -vv
can display is only available as root. lspci
will happily run lspci -vv
as any user and present what it can find out as a regular user. This will be a much shorter list than you get if you run lspci -vv
as root.
lspci
has a useful -t
option which provides a handy tree output which shows what devices are connected to what bridge. Using this option will, by default, only list the PCIe IDs. Combining it with -v
to get a "verbose" output is therefore a good idea.
lspci -tv
(partial output)-[0000:00]-+-00.0 Advanced Micro Devices, Inc. [AMD] Family 17h (Models 00h-0fh) Root Complex
+-00.2 Advanced Micro Devices, Inc. [AMD] Family 17h (Models 00h-0fh) I/O Memory Management Unit
+-01.0 Advanced Micro Devices, Inc. [AMD] Family 17h (Models 00h-1fh) PCIe Dummy Host Bridge
+-01.3-[01-06]--+-00.0 Advanced Micro Devices, Inc. [AMD] X370 Series Chipset USB 3.1 xHCI Controller
| +-00.1 Advanced Micro Devices, Inc. [AMD] X370 Series Chipset SATA Controller
| \-00.2-[02-06]--+-00.0-[03]----00.0 ASMedia Technology Inc. ASM1143 USB 3.1 Host Controller
lspci
has a lot more switches. Consult the lspci manual page or run lspci -h
to see them all.
Listing PCIe devices IOMMU Groups[edit]
lspci
can't and won't show you what IOMMU group a PCIe device belongs to. That's fine, it is possible to find out without it's help and use it to list the actual information about each device. The trick is to poke around in /sys/
to get the relevant information.
Example output of a script using lspci
to get information about a systems IOMMU devices.
#!/bin/bash for d in /sys/kernel/iommu_groups/*/devices/*; do n=${d#*/iommu_groups/*}; n=${n%%/*} printf 'IOMMU Group %s ' "$n" lspci -nns "${d##*/}" done
Place this in $HOME/bin
or /usr/local/bin/
and make it executable with chmod a+x
to use it. It can be used as a regular user, it does not require root
.
Enable comment auto-refresher