Generate complete list of kernel supported devices?

Issues related to applications and software problems and general support
Post Reply
mathog
Posts: 226
Joined: 2008/07/09 23:52:06

Generate complete list of kernel supported devices?

Post by mathog » 2020/09/08 20:16:53

I am returning to the problem of figuring out a way to generate a complete list of PCI IDs that a particular CentOS kernel supports. Because, as far as I can tell, neither RedHat nor CentOS has such a thing. (RedHat has for each release a human readable, but not easily parsed list of things they no longer support, like this:

https://access.redhat.com/documentation ... enablement
)

For a positive control I have a CentOS 8 system with a list of devices known to work. This is one:

Code: Select all

02:00.0 14E4:165A tg3(module) "NetXtreme BCM5722 Gigabit Ethernet PCI Express"
For a negative control there is a CentOS 7 system which will eventually be upgraded, which my earlier script "find_centos8_needs_elrepo.pl" said might need these El Repo drivers:

Code: Select all

./find_centos8_needs_elrepo.pl DeviceIDsFile
02:00.0 14E4:163B kmod-bnx2 pci Ethernet controller: Broadcom Inc. and subsidiaries NetXtreme II BCM5716 Gigabit Ethernet (rev 20)
02:00.1 14E4:163B kmod-bnx2 pci Ethernet controller: Broadcom Inc. and subsidiaries NetXtreme II BCM5716 Gigabit Ethernet (rev 20)
03:00.0 1000:0060 kmod-megaraid_sas pci RAID bus controller: Broadcom / LSI MegaRAID SAS 1078 (rev 04)
06:08.0 1000:0030 kmod-mptspi pci SCSI storage controller: Broadcom / LSI 53c1030 PCI-X Fusion-MPT Dual Ultra320 SCSI (rev c1)
In this case the 1000:0060 device is listed at the above URL, so it is not supported by the current kernel. Get the source code for the current CentOS 8 kernel and unpack it in /tmp

Code: Select all

cd /tmp
wget http://vault.centos.org/8.2.2004/BaseOS/Source/SPackages/kernel-4.18.0-193.14.2.el8_2.src.rpm
mkdir ksrc
cd ksrc
rpm2cpio ../kernel-4.18.0-193.14.2.el8_2.src.rpm |  cpio -idmv
xzcat linux-4.18.0-193.14.2.el8_2.tar.xz | tar -xf -

grep -r PCI_DEVICE_ID_TIGON3_5722 linux-4.18.0-193.14.2.el8_2 
linux-4.18.0-193.14.2.el8_2/drivers/net/ethernet/broadcom/tg3.c:	{PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, PCI_DEVICE_ID_TIGON3_5722)},
linux-4.18.0-193.14.2.el8_2/drivers/net/ethernet/broadcom/tg3.c:			    tp->pdev->device != PCI_DEVICE_ID_TIGON3_5722)
linux-4.18.0-193.14.2.el8_2/include/linux/pci_ids.h:#define PCI_DEVICE_ID_TIGON3_5722	0x165a


grep -r PCI_DEVICE_ID_LSI_SAS1078  linux-4.18.0-193.14.2.el8_2
linux-4.18.0-193.14.2.el8_2/drivers/scsi/megaraid/megaraid_sas.h:#define	PCI_DEVICE_ID_LSI_SAS1078R		0x0060
linux-4.18.0-193.14.2.el8_2/drivers/scsi/megaraid/megaraid_sas.h:#define	PCI_DEVICE_ID_LSI_SAS1078DE		0x007C
linux-4.18.0-193.14.2.el8_2/drivers/scsi/megaraid/megaraid_sas.h:#define	PCI_DEVICE_ID_LSI_SAS1078GEN2		0x0078
linux-4.18.0-193.14.2.el8_2/drivers/scsi/megaraid/megaraid_sas_base.c:		case PCI_DEVICE_ID_LSI_SAS1078R:
linux-4.18.0-193.14.2.el8_2/drivers/scsi/megaraid/megaraid_sas_base.c:		case PCI_DEVICE_ID_LSI_SAS1078DE:
linux-4.18.0-193.14.2.el8_2/drivers/scsi/megaraid/megaraid_sas_base.c:		case PCI_DEVICE_ID_LSI_SAS1078GEN2:
linux-4.18.0-193.14.2.el8_2/drivers/scsi/megaraid/megaraid_sas_base.c:				PCI_DEVICE_ID_LSI_SAS1078GEN2) ||
linux-4.18.0-193.14.2.el8_2/include/linux/pci_ids.h:#define PCI_DEVICE_ID_LSI_SAS1078	0x0060

grep -i megaraid kernel-x86_64.config   
# CONFIG_MEGARAID_LEGACY is not set
# CONFIG_MEGARAID_NEWGEN is not set
CONFIG_MEGARAID_SAS=m
The positive control make sense, the define from pci_ids.h is exactly the same as in tg3.c. For the unavailable PCI_DEVICE_ID_LSI_SAS1078 things are a bit strange - that exact string does not exist in the kernel source tree, but slightly related ones are, like "PCI_DEVICE_ID_LSI_SAS1078GEN2". Is this one just strange or is it always the case that the nonsupported drivers have pci_ids.h strings which do not match those in the corresponding source file? I'm guessing the former because the latter would provide an easy way to distinguish between supported and nonsupported drivers.

Assuming that one must start instead with the config file we see that CONFIG_MEGARAID_SAS is the only one which should build, and those three values are found here:

Code: Select all

./linux-4.18.0-193.14.2.el8_2/drivers/scsi/Makefile
as

Code: Select all

obj-$(CONFIG_MEGARAID_LEGACY)	+= megaraid.o
obj-$(CONFIG_MEGARAID_NEWGEN)	+= megaraid/
obj-$(CONFIG_MEGARAID_SAS)	+= megaraid/
Is there any simple way to go from those obj lines to a corresponding list of PCI IDs?

Better yet, is there any way to go from the installed kernel modules.* files to a PCI IDs list?

Thanks.

User avatar
TrevorH
Forum Moderator
Posts: 29493
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Generate complete list of kernel supported devices?

Post by TrevorH » 2020/09/08 20:24:20

modinfo
CentOS 6 will die in November 2020 - migrate sooner rather than later!
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 is dead, do not use it.
Full time Geek, part time moderator. Use the FAQ Luke

mathog
Posts: 226
Joined: 2008/07/09 23:52:06

Re: Generate complete list of kernel supported devices?

Post by mathog » 2020/09/08 22:11:03

modinfo? Oh, I see, most of them have a line like:

Code: Select all

alias:          pci:v00008086d00003B25sv*sd*bc*sc*i*
which has the PCI ID encoded in it. And it works even for drivers which have no corresponding device on the corresponding machine, as in

Code: Select all

modinfo megaraid_sas
on the CentOS 8 machine, which has no RAID card in it.

Thanks.

mathog
Posts: 226
Joined: 2008/07/09 23:52:06

Re: Generate complete list of kernel supported devices?

Post by mathog » 2020/09/09 22:58:40

Modules are under control now. Not so for drivers built into the kernel. For instance these devices:

Code: Select all

00:1A.0 8086:3B3C ehci-pci(builtin) "5 Series/3400 Series Chipset USB2 Enhanced Host Controller"
00:1C.0 8086:3B42 pcieport(builtin) "5 Series/3400 Series Chipset PCI Express Root Port 1"
00:1C.2 8086:3B46 pcieport(builtin) "5 Series/3400 Series Chipset PCI Express Root Port 3"
00:1C.3 8086:3B48 pcieport(builtin) "5 Series/3400 Series Chipset PCI Express Root Port 4"
00:1C.4 8086:3B4A pcieport(builtin) "5 Series/3400 Series Chipset PCI Express Root Port 5"
00:1D.0 8086:3B34 ehci-pci(builtin) "5 Series/3400 Series Chipset USB2 Enhanced Host Controller"
In the list above the ehci-pci and pcieport drivers were determined by scanning through /sys/bus/pci/drivers, but that only exists on the running system. If the kernel is not running where would this information be found? The device seems not to be listed in any of the modules files, ie:

Code: Select all

grep 8086 /lib/modules/`uname -r`/* | grep -i 3b46
#nothing
Is there some way to extract this information from a vmlinuz?

mathog
Posts: 226
Joined: 2008/07/09 23:52:06

Re: Generate complete list of kernel supported devices?

Post by mathog » 2020/09/16 18:56:16

Bump?

Either of these would suffice:

1. A method to scan the source tree for a kernel, using its CentOS provided .config, to list drivers which will be builtin and something corresponding to the modules.alias "alias" lines.

2. A method to probe a running kernel to reveal what drivers are built into it. That way the target OS (CentOS 8.2 at this time) could be set up on just one machine and the driver support available for all other machines determined.

To date I have been unable to find either of these functions. For (1) I tried the script in this:

https://cateee.net/sources/lkddb-source ... -12.tar.gz

but while it did a good job of figuring out the modules it came up empty on the built in drivers.

Something like (2) must exist, since that is more or less how the system creates the /sys tree. I'm guessing that it scans the PCI bus and then calls some sort of function like:

Code: Select all

setup_builtin(VENDOR, DEVICE, SUBVENDOR, SUBDEVICE)
Unfortunately after a lot of searching I have come up completely empty with any sort of command line equivalent which could be probed, perhaps painfully slowly, with all 2^32 VENDOR x DEVICE combinations.

Post Reply

Return to “CentOS 8 - General Support”