Mapping a PCIe Device to its module on Linux

The Kernel docs are a little old. They point to the Device Drivers book, which was great, but quite outdated; it was written around version 2.6 and the Kernel is up to 6.15. Here are my notes that go from those docs to where things are today.

First, the module mapping is no longer in /lib/modules/
KERNEL_VERSION/modules.pcimap. but rather in the more general /lib/modules/
KERNEL_VERSION/modules.alias file. For example, if I run lspic, my last entry is:


03:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8211/8411 PCI Express Gigabit Ethernet Controller (rev 15)

Running lspci -k shows the module attached to that device:

03:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8211/8411 PCI Express Gigabit Ethernet Controller (rev 15)
Subsystem: Intel Corporation Device 2067
Kernel driver in use: r8169
Kernel modules: r8169

If I look in less /lib/modules/6.15.0-0.rc7.58.fc43.x86_64/modules.alias I see many entries that map to that module:

alias pci:v000010ECd00005000svsdbcsci* r8169
alias pci:v000010ECd00003000svsdbcsci* r8169
alias pci:v000010ECd00008126svsdbcsci* r8169
alias pci:v000010ECd00008125svsdbcsci* r8169

But which one is mine? Lets see how much info lspci -vvxxx can give us;

03:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8211/8411 PCI Express Gigabit Ethernet Controller (rev 15)
Subsystem: Intel Corporation Device 2067
Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx+
Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- SERR-
Kernel driver in use: r8169
Kernel modules: r8169
00: ec 10 68 81 07 04 10 00 15 00 00 02 10 00 00 00
10: 01 e0 00 00 00 00 00 00 04 40 10 91 00 00 00 00
20: 04 00 10 91 00 00 00 00 00 00 00 00 86 80 67 20
30: 00 00 00 00 40 00 00 00 00 00 00 00 ff 01 00 00

If I look a little further down the modules.alias file, I see this line:



alias pci:v00000001d00008168svsd00002410bcsci r8169

And note that the 8168 matches at least on of the entries in RTL8111/8168/8211/8411

Where as none of the others seem to match. This makes it likely, but not 100%.

More to come

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.