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
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
lspcis output will look like:
-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 has a lot more switches. Consult the lspci manual page or run
lspci -h to see them all.
Listing PCIe devices IOMMU Groups
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.
Place this in
/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