Skip to main content

Interpreting the output of lspci

On Linux, the lspci command lists all PCI devices connected to a host (a computer). Modern computers and PCI devices communicate with each other via PCI Express buses instead of the older Conventional PCI and PCI-X buses since the former buses offer many advantages such as higher throughput rates, smaller physical footprint and native hot plugging functionality. The high performance of the PCI Express bus has also led it to take over the role of other buses such as AGP; it is also expected that SATA buses too will be replaced by PCI Express buses in the future as solid-state drives become faster and therefore demand higher throughputs from the bus they are attached to (see this article for more on this topic).
As a first step, open a terminal and run lspci without any flags (note: lspci may show more information if executed with root privileges):
lspci
This is the output I get on my laptop:
00:00.0 Host bridge: Intel Corporation Haswell-ULT DRAM Controller (rev 0b)
00:02.0 VGA compatible controller: Intel Corporation Haswell-ULT Integrated Graphics Controller (rev 0b)
00:03.0 Audio device: Intel Corporation Haswell-ULT HD Audio Controller (rev 0b)
00:14.0 USB controller: Intel Corporation Lynx Point-LP USB xHCI HC (rev 04)
00:16.0 Communication controller: Intel Corporation Lynx Point-LP HECI #0 (rev 04)
00:1b.0 Audio device: Intel Corporation Lynx Point-LP HD Audio Controller (rev 04)
00:1d.0 USB controller: Intel Corporation Lynx Point-LP USB EHCI #1 (rev 04)
00:1f.0 ISA bridge: Intel Corporation Lynx Point-LP LPC Controller (rev 04)
00:1f.2 SATA controller: Intel Corporation Lynx Point-LP SATA Controller 1 [AHCI mode] (rev 04)
00:1f.3 SMBus: Intel Corporation Lynx Point-LP SMBus Controller (rev 04)
Each line on the output above shows a PCI device. Each device is given a bus number, a device number and a function number. On Linux, PCI devices are also given domain numbers, but they are usually omitted by lspci since very often all devices have the same domain number (usually zero). These four numbers are assigned by Linux to each device either on boot or when a device is hot-plugged. Since the PCI specification permits a system to host up to 256 buses, nonzero domain numbers are only used to group PCI buses in very large systems. Each bus can host up to 32 devices, and a PCI device can have up to eight functions. In more technical terms, a device's location is specified by a 16-bit domain number, an 8-bit bus number, a 5-bit device number and a 3-bit function number; the last three numbers are commonly referred to as the device's BDF or B/D/F (for bus/device/function).
Let's analyze one of the output lines above. Take a look at the first one:
00:00.0 Host bridge: Intel Corporation Haswell-ULT DRAM Controller (rev 0b)
The highlighted portion of this line shows the device's BDF: it has bus number 00, device number 00 and function number 0. This device's class is "Host bridge", its vendor is "Intel Corporation", its name is "Haswell-ULT DRAM Controller" and its revision ("rev") is 11 (0b in hexadecimal). The revision number defines the device's chipset and firmware versions. This device is a PCI host bridge: it bridges between all PCI devices and buses on one side and the processor and main memory on the other side.
Consider now the second line from bottom to top:
00:1f.2 SATA controller: Intel Corporation Lynx Point-LP SATA Controller 1 [AHCI mode] (rev 04)
This line shows a device with bus number 00, device number 1f and function number 2. This device's class is "SATA controller", its vendor is "Intel Corporation" and its name is "Lynx Point-LP SATA Controller 1 [AHCI mode]". In other words, it is a SATA controller operating in AHCI mode. Notice that this SATA controller is seen as a function of a device which also contains an ISA bridge (more precisely, a PCI/ISA bridge) and an SMBus controller: they all have the same device and bus numbers but distinct function numbers.
A natural question at this point is: how does the operational system obtain the class, name and vendor from a PCI device? The answer is simple: every PCI device has a set of registers called the device's configuration space which, among other things, display the device ID (DID), the vendor ID (VID) and the device class to the operational system. These are just numeric codes which the operational system maps into human-readable names through a predefined table. Vendor IDs are assigned by a group of companies called the PCI Special Interest Group and device IDs are assigned by their respective vendors. To display these IDs with the lspci command, use the -nn flag. For instance, try running:
lspci -nn
The output now shows the class codes (first highlighted values in each row) and the vendor and device IDs in the form [vendor-id:device-id] right after the device names:
00:00.0 Host bridge [0600]: Intel Corporation Haswell-ULT DRAM Controller [8086:0a04] (rev 0b)
00:02.0 VGA compatible controller [0300]: Intel Corporation Haswell-ULT Integrated Graphics Controller [8086:0a16] (rev 0b)
00:03.0 Audio device [0403]: Intel Corporation Haswell-ULT HD Audio Controller [8086:0a0c] (rev 0b)
00:14.0 USB controller [0c03]: Intel Corporation Lynx Point-LP USB xHCI HC [8086:9c31] (rev 04)
00:16.0 Communication controller [0780]: Intel Corporation Lynx Point-LP HECI #0 [8086:9c3a] (rev 04)
00:1b.0 Audio device [0403]: Intel Corporation Lynx Point-LP HD Audio Controller [8086:9c20] (rev 04)
00:1d.0 USB controller [0c03]: Intel Corporation Lynx Point-LP USB EHCI #1 [8086:9c26] (rev 04)
00:1f.0 ISA bridge [0601]: Intel Corporation Lynx Point-LP LPC Controller [8086:9c43] (rev 04)
00:1f.2 SATA controller [0106]: Intel Corporation Lynx Point-LP SATA Controller 1 [AHCI mode] [8086:9c03] (rev 04)
00:1f.3 SMBus [0c05]: Intel Corporation Lynx Point-LP SMBus Controller [8086:9c22] (rev 04)
As mentioned above, domain numbers are omitted since they are all equal to zero. To force lspci to display them, run it with the -D flag:
lspci -D
The domain numbers are highlighted in the output shown below. Domain numbers range from 0000 to ffff in hexadecimal notation (i.e., there are 65536 valid domain numbers), but below you can see that all devices are given the same domain number 0000:
0000:00:00.0 Host bridge: Intel Corporation Haswell-ULT DRAM Controller (rev 0b)
0000:00:02.0 VGA compatible controller: Intel Corporation Haswell-ULT Integrated Graphics Controller (rev 0b)
0000:00:03.0 Audio device: Intel Corporation Haswell-ULT HD Audio Controller (rev 0b)
0000:00:14.0 USB controller: Intel Corporation Lynx Point-LP USB xHCI HC (rev 04)
0000:00:16.0 Communication controller: Intel Corporation Lynx Point-LP HECI #0 (rev 04)
0000:00:1b.0 Audio device: Intel Corporation Lynx Point-LP HD Audio Controller (rev 04)
0000:00:1d.0 USB controller: Intel Corporation Lynx Point-LP USB EHCI #1 (rev 04)
0000:00:1f.0 ISA bridge: Intel Corporation Lynx Point-LP LPC Controller (rev 04)
0000:00:1f.2 SATA controller: Intel Corporation Lynx Point-LP SATA Controller 1 [AHCI mode] (rev 04)
0000:00:1f.3 SMBus: Intel Corporation Lynx Point-LP SMBus Controller (rev 04)
The PCI devices can be displayed on a treelike structure which reflects the actual physical structure of the PCI buses. To see it, run:
lspci -tv
The -v flag is there just to have the device vendors and names displayed as well, but can be omitted if you do not need them. As the output below shows, all PCI devices on my laptop are connected to the same bus (00):
-[0000:00]-+-00.0  Intel Corporation Haswell-ULT DRAM Controller
           +-02.0  Intel Corporation Haswell-ULT Integrated Graphics Controller
           +-03.0  Intel Corporation Haswell-ULT HD Audio Controller
           +-14.0  Intel Corporation Lynx Point-LP USB xHCI HC
           +-16.0  Intel Corporation Lynx Point-LP HECI #0
           +-1b.0  Intel Corporation Lynx Point-LP HD Audio Controller
           +-1d.0  Intel Corporation Lynx Point-LP USB EHCI #1
           +-1f.0  Intel Corporation Lynx Point-LP LPC Controller
           +-1f.2  Intel Corporation Lynx Point-LP SATA Controller 1 [AHCI mode]
           \-1f.3  Intel Corporation Lynx Point-LP SMBus Controller
Here is what the output of lspci -tv looks like on a bigger system such as a server (parts of the output were omitted for brevity; notice that all domain numbers are again zero, but the devices are no longer all under the same bus):
-+-[0000:3f]-+-00.0  Intel Corporation Xeon 5600 Series QuickPath Architecture Generic Non-core Registers
 |           +-00.1  Intel Corporation Xeon 5600 Series QuickPath Architecture System Address Decoder
 |           +-02.0  Intel Corporation Xeon 5600 Series QPI Link 0
...
 +-[0000:3e]-+-00.0  Intel Corporation Xeon 5600 Series QuickPath Architecture Generic Non-core Registers
 |           +-00.1  Intel Corporation Xeon 5600 Series QuickPath Architecture System Address Decoder
 |           +-02.0  Intel Corporation Xeon 5600 Series QPI Link 0
 ...
 \-[0000:00]-+-00.0  Intel Corporation 5520 I/O Hub to ESI Port
             +-01.0-[05]----00.0  Hewlett-Packard Company Smart Array G6 controllers
             +-02.0-[06]--
             +-03.0-[11-13]--
             +-04.0-[14]--
             +-05.0-[15-17]--
             +-06.0-[18-1a]--
             +-07.0-[0e-10]--
             +-08.0-[0b-0d]--
             +-09.0-[08-0a]----00.0  Hewlett-Packard Company Smart Array G6 controllers
             +-0a.0-[07]--
...
             +-1c.0-[03]--+-00.0  Broadcom Corporation NetXtreme II BCM5709 Gigabit Ethernet
             |            \-00.1  Broadcom Corporation NetXtreme II BCM5709 Gigabit Ethernet
             +-1c.2-[04]--+-00.0  Broadcom Corporation NetXtreme II BCM5709 Gigabit Ethernet
             |            \-00.1  Broadcom Corporation NetXtreme II BCM5709 Gigabit Ethernet
             +-1c.4-[02]--+-00.0  Hewlett-Packard Company Integrated Lights-Out Standard Slave Instrumentation & System Support
             |            +-00.2  Hewlett-Packard Company Integrated Lights-Out Standard Management Processor Support and Messaging
...
             +-1d.3  Intel Corporation 82801JI (ICH10 Family) USB UHCI Controller #6
             +-1d.7  Intel Corporation 82801JI (ICH10 Family) USB2 EHCI Controller #1
             +-1e.0-[01]----03.0  Advanced Micro Devices [AMD] nee ATI ES1000
             \-1f.0  Intel Corporation 82801JIB (ICH10) LPC Interface Controller
To display additional information about the PCI devices, run lspci with either -v, -vv or -vvv (more v's means more details, but you will hardly need more than -v since the additional information is not useful for most users):
lspci -v
The output is now significantly longer so only the lines for first three devices are displayed here. Notice that it now shows the drivers used by Linux to manage each device (except for the host bridge). Also, as a side note, you may have to run lspci with root privileges to have it display the capabilities of each device as well:
00:00.0 Host bridge: Intel Corporation Haswell-ULT DRAM Controller (rev 0b)
 Subsystem: Lenovo Device 3978
 Flags: bus master, fast devsel, latency 0
 Capabilities: [e0] Vendor Specific Information: Len=0c <?>

00:02.0 VGA compatible controller: Intel Corporation Haswell-ULT Integrated Graphics Controller (rev 0b) (prog-if 00 [VGA controller])
 Subsystem: Lenovo Device 3978
 Flags: bus master, fast devsel, latency 0, IRQ 58
 Memory at b0000000 (64-bit, non-prefetchable) [size=4M]
 Memory at a0000000 (64-bit, prefetchable) [size=256M]
 I/O ports at 4000 [size=64]
 Expansion ROM at <unassigned> [disabled]
 Capabilities: [90] MSI: Enable+ Count=1/1 Maskable- 64bit-
 Capabilities: [d0] Power Management version 2
 Capabilities: [a4] PCI Advanced Features
 Kernel driver in use: i915

00:03.0 Audio device: Intel Corporation Haswell-ULT HD Audio Controller (rev 0b)
 Subsystem: Lenovo Device 3978
 Flags: bus master, fast devsel, latency 0, IRQ 60
 Memory at b0510000 (64-bit, non-prefetchable) [size=16K]
 Capabilities: [50] Power Management version 2
 Capabilities: [60] MSI: Enable+ Count=1/1 Maskable- 64bit-
 Capabilities: [70] Express Root Complex Integrated Endpoint, MSI 00
 Kernel driver in use: snd_hda_intel
Since the output of lspci -v might be too long, you can instruct lspci to display details for only a single device using the device's domain and BDF numbers. For example, to only show details for the SATA controller mentioned earlier, you would run:
lspci -v -s 00:1f.2
The domain number was omitted on the command above as it is not necessary to uniquely specify a PCI device. The output is now significantly shorter:
00:1f.2 SATA controller: Intel Corporation Lynx Point-LP SATA Controller 1 [AHCI mode] (rev 04) (prog-if 01 [AHCI 1.0])
 Subsystem: Lenovo Device 3978
 Flags: bus master, 66MHz, medium devsel, latency 0, IRQ 57
 I/O ports at 4088 [size=8]
 I/O ports at 4094 [size=4]
 I/O ports at 4080 [size=8]
 I/O ports at 4090 [size=4]
 I/O ports at 4060 [size=32]
 Memory at b051b000 (32-bit, non-prefetchable) [size=2K]
 Capabilities: [80] MSI: Enable+ Count=1/1 Maskable- 64bit-
 Capabilities: [70] Power Management version 3
 Capabilities: [a8] SATA HBA v1.0
 Kernel driver in use: ahci
Finally, you may pass the -mm flag to lspci if you wish to obtain output in machine-readable form (check the lspci documentation for more). In combination with the -v flag, the output can actually be comfortably read by humans. Run the command below:
lspci -vmm
The output is quite easy to interpret. This is what is looks like for the first three devices on my laptop:
Slot: 00:00.0
Class: Host bridge
Vendor: Intel Corporation
Device: Haswell-ULT DRAM Controller
SVendor: Lenovo
SDevice: Device 3978
Rev: 0b

Slot: 00:02.0
Class: VGA compatible controller
Vendor: Intel Corporation
Device: Haswell-ULT Integrated Graphics Controller
SVendor: Lenovo
SDevice: Device 3978
Rev: 0b

Slot: 00:03.0
Class: Audio device
Vendor: Intel Corporation
Device: Haswell-ULT HD Audio Controller
SVendor: Lenovo
SDevice: Device 3978
Rev: 0b
The SVendor and SDevice values are determined by registers in the configuration space which are called the subsystem vendor ID (SVID) and the subsystem ID (SSID) respectively. While the vendor ID specifies the chipset manufacturer, the subsystem vendor ID specifies the card manufacturer. The subsystem ID is a number assigned by the subsystem vendor from the same number space as the device ID. These numbers are also displayed next to SVendor and SDevice if the -nn flag is passed as well.

Appendix: PCI configuration space

For the curious reader, lspci is also capable of displaying the configuration space of each PCI device in hexadecimal format. To see this, run lspci with either -x, -xx or -xxx (more x's means more bytes of the configuration space will be displayed). To better see where the device ID, the vendor ID and the class codes are located, I recommend you run lspci with the -nn flag as well:
lspci -xnn
The relevant areas are highlighted on the output shown below (in order: vendor ID, device ID and class code; all values have their bytes "inverted" because Intel processors use little-endian). Once again, only the first three devices are displayed for brevity:
00:00.0 Host bridge [0600]: Intel Corporation Haswell-ULT DRAM Controller [8086:0a04] (rev 0b)
00: 86 80 04 0a 06 00 90 20 0b 00 00 06 00 00 00 00
10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
20: 00 00 00 00 00 00 00 00 00 00 00 00 aa 17 78 39
30: 00 00 00 00 e0 00 00 00 00 00 00 00 00 00 00 00

00:02.0 VGA compatible controller [0300]: Intel Corporation Haswell-ULT Integrated Graphics Controller [8086:0a16] (rev 0b)
00: 86 80 16 0a 07 04 90 00 0b 00 00 03 00 00 00 00
10: 04 00 00 b0 00 00 00 00 0c 00 00 a0 00 00 00 00
20: 01 40 00 00 00 00 00 00 00 00 00 00 aa 17 78 39
30: 00 00 00 00 90 00 00 00 00 00 00 00 00 01 00 00

00:03.0 Audio device [0403]: Intel Corporation Haswell-ULT HD Audio Controller [8086:0a0c] (rev 0b)
00: 86 80 0c 0a 06 04 10 00 0b 00 03 04 10 00 00 00
10: 04 00 51 b0 00 00 00 00 00 00 00 00 00 00 00 00
20: 00 00 00 00 00 00 00 00 00 00 00 00 aa 17 78 39
30: 00 00 00 00 50 00 00 00 00 00 00 00 00 01 00 00

Comments

Popular posts from this blog

OWASP Top 10 Threats and Mitigations Exam - Single Select

Last updated 4 Aug 11 Course Title: OWASP Top 10 Threats and Mitigation Exam Questions - Single Select 1) Which of the following consequences is most likely to occur due to an injection attack? Spoofing Cross-site request forgery Denial of service   Correct Insecure direct object references 2) Your application is created using a language that does not support a clear distinction between code and data. Which vulnerability is most likely to occur in your application? Injection   Correct Insecure direct object references Failure to restrict URL access Insufficient transport layer protection 3) Which of the following scenarios is most likely to cause an injection attack? Unvalidated input is embedded in an instruction stream.   Correct Unvalidated input can be distinguished from valid instructions. A Web application does not validate a client’s access to a resource. A Web action performs an operation on behalf of the user without checking a shared sec

CKA Simulator Kubernetes 1.22

  https://killer.sh Pre Setup Once you've gained access to your terminal it might be wise to spend ~1 minute to setup your environment. You could set these: alias k = kubectl                         # will already be pre-configured export do = "--dry-run=client -o yaml"     # k get pod x $do export now = "--force --grace-period 0"   # k delete pod x $now Vim To make vim use 2 spaces for a tab edit ~/.vimrc to contain: set tabstop=2 set expandtab set shiftwidth=2 More setup suggestions are in the tips section .     Question 1 | Contexts Task weight: 1%   You have access to multiple clusters from your main terminal through kubectl contexts. Write all those context names into /opt/course/1/contexts . Next write a command to display the current context into /opt/course/1/context_default_kubectl.sh , the command should use kubectl . Finally write a second command doing the same thing into /opt/course/1/context_default_no_kubectl.sh , but without the use of k

标 题: 关于Daniel Guo 律师

发信人: q123452017 (水天一色), 信区: I140 标  题: 关于Daniel Guo 律师 关键字: Daniel Guo 发信站: BBS 未名空间站 (Thu Apr 26 02:11:35 2018, 美东) 这些是lz根据亲身经历在 Immigration版上发的帖以及一些关于Daniel Guo 律师的回 帖,希望大家不要被一些马甲帖广告帖所骗,慎重考虑选择律师。 WG 和Guo两家律师对比 1. fully refund的合约上的区别 wegreened家是case不过只要第二次没有file就可以fully refund。郭家是要两次case 没过才给refund,而且只要第二次pl draft好律师就可以不退任何律师费。 2. 回信速度 wegreened家一般24小时内回信。郭律师是在可以快速回复的时候才回复很快,对于需 要时间回复或者是不愿意给出确切答复的时候就回复的比较慢。 比如:lz问过郭律师他们律所在nsc区域最近eb1a的通过率,大家也知道nsc现在杀手如 云,但是郭律师过了两天只回复说让秘书update最近的case然后去网页上查,但是上面 并没有写明tsc还是nsc。 lz还问过郭律师关于准备ps (他要求的文件)的一些问题,模版上有的东西不是很清 楚,但是他一般就是把模版上的东西再copy一遍发过来。 3. 材料区别 (推荐信) 因为我只收到郭律师写的推荐信,所以可以比下两家推荐信 wegreened家推荐信写的比较长,而且每封推荐信会用不同的语气和风格,会包含lz写 的research summary里面的某个方面 郭家四封推荐信都是一个格式,一种语气,连地址,信的称呼都是一样的,怎么看四封 推荐信都是同一个人写出来的。套路基本都是第一段目的,第二段介绍推荐人,第三段 某篇或几篇文章的abstract,最后结论 4. 前期材料准备 wegreened家要按照他们的模版准备一个十几页的research summary。 郭律师在签约之前说的是只需要准备五页左右的summary,但是在lz签完约收到推荐信 ,郭律师又发来一个很长的ps要lz自己填,而且和pl的格式基本差不多。 总结下来,申请自己上心最重要。但是如果选律师,lz更倾向于wegreened,