linux-firmware

The place to discuss Linux and Unix Operating Systems
Forum rules
Behave
Post Reply
User avatar
Grogan
Your Host
Posts: 2048
Joined: Sat Aug 21, 2021 10:04 am
Location: Ontario, Canada

linux-firmware

Post by Grogan »

It just burns my ass that the firmware blobs are such a black box. Not so much that I don't have the source code for them (I can't work with low level programming/assembly anyway) but because there isn't even clear information as to what drivers load firmware blobs. They aren't necessarily exactly named for your hardware models either, as different models often use (some of) the same blobs.

You're not going to find them with lsof because they are not open file handles (they are in memory, with the driver)

There is no need for me to keep thousands of files and hundreds of megabytes of firmware blobs when I only use a few. Moreover, I'm not using the distro packages for those, as I'm chasing DCMUB firmware updates ("Display Core Microcontroller Unit B" a.k.a "DMUB" in kernel). THAT is what fucks up when I use display power management in a window manager with no compositor these days. Ever since I went to UEFI and enabled Resizable BAR for my graphics card, I noticed sync issues but that PM thing started a few months ago. It's avoidable (use a compositor or don't use DPMS) but I'm looking to get that fixed. Also. I'm going back to Mesa/Main (24.3.0-devel it will be versioned) for some new Vulkan video work that needs new VCN firmware.

Distros help with this now by compressing them with xz or zstd, but now it's a zillion individually compressed files. Other distros (e.g. Debian I think) only install firmware for specific drivers. I guess it would take cues from udev in some way. I don't like that approach.

So today, after grabbing the latest firmware blobs from git (noting DCMUB updates 45 hours ago), I decide to find out exactly what firmware blobs are needed on this rig. I had that on the old system, but haven't gotten around to it yet. The only real way I can think of is to remove them and reboot to see what complains. Don't try that with video card firmware (pretty easy to know what directory to keep) or you'll be fucked at driver loading/modeswitching time and don't try that with some SCSI/RAID controller that uses firmware or something (if you have anything like that), but everything else you should be able to let complain in dmesg.

OK, I know I need /lib/firmware/amdgpu (actually that'd be a symlink to /usr/lib/firmware nowadays with usrmerge distros... that's probably everything but Slackware now). Within that I know I need the navi* files, but not which ones. Some of my card's architecture is "NAVI31" and "NAVI32" but that's supported by navi-12 or navi-14 firmware, I'm not sure which. There is also other supporting firmware blobs in there (common) to figure out. It's not worth worrying about, so for now I'm just going to leave all of amdgpu. It will make upgrading much easier if I just copy the amdgpu and rtl_nic directories and the files will be trivial.

That brings me to my next point. My onboard RealTek NIC again loads a firmware blob on this system. I was hoping a newer model didn't but it does still load 8125b firmware. Since I build my NIC right in the kernel, I also want that firmware blob in there too (there's a config setting to specify firmware blobs to build in). With most hardware it's even necessary... for example if you were to build amdgpu right in, it would fail unless you also built in ALL the firmware blobs it uses. I don't, but for the simple reason that I want the video card to initialize last.

I'm not even sure what the NIC firmware does, as the NIC still works without it. I'm using it right now. Furthermore, this firmware load doesn't happen at driver initialization time, but as the interface is being brought up. This is "weird" (to me lol)

Code: Select all

[grogan@nicetry ~]$ dmesg | grep firmware
[    0.459783] systemd[1]: Clear Stale Hibernate Storage Info was skipped because of an unmet condition check (ConditionPathExists=/sys/firmware/efi/efivars/HibernateLocation-8cf2644b-4b0b-428f-9387-6d876050dc67).
[    0.465828] nct6683 nct6683.2592: NCT6687D EC firmware version 1.0 build 09/09/21
[    0.579029] [drm] Loading DMUB firmware via PSP: version=0x07002A00
[    0.579133] [drm] Found VCN firmware Version ENC: 1.22 DEC: 8 VEP: 0 Revision: 3
[    0.579136] amdgpu 0000:03:00.0: amdgpu: Will use PSP to load VCN firmware
[    1.570563] r8169 0000:06:00.0: Direct firmware load for rtl_nic/rtl8125b-2.fw failed with error -2
[    1.570565] r8169 0000:06:00.0: Unable to load firmware rtl_nic/rtl8125b-2.fw (-2)
Yes, systemd, that's right, there's no hibernation support here. I don't let unwanted things in my kernel precisely because of assholes like you. (If systemd was a person I'd punch it. Hulk smash! :twisted: )

That nct6683 is my sensor chip, and that's just reading the firmware revision from the chip (not loading a firmware blob)

You can see that amdgpu doesn't really tell you all the firmware blobs it's using.

Anyway, there's my NIC firmware blob to include in the kernel. Note that I will still need to keep the rtl_nic/rtl8125b.fw (the rtl_nic directory) on disk as it will be used at kernel build time. So I need to keep two directories in /lib/firmware... amdgpu and rtl_nic.

Anyway, that's how to get a handle on what firmware files you're using. It also helps to look in the directories too of course. For example if I knew I was using, say, Atheros wifi, I'd find out what driver I'm using in dmesg. Say it's ath10K, then I'd know I need that firmware directory etc.
User avatar
Grogan
Your Host
Posts: 2048
Joined: Sat Aug 21, 2021 10:04 am
Location: Ontario, Canada

Re: linux-firmware

Post by Grogan »

It's not necessarily safe to upgrade firmware... looky here, serious DMUB issues on sienna_cichlid (RX 6800 XT).

https://gitlab.freedesktop.org/drm/amd/-/issues/3595

It looks like it's broken and an older firmware gets loaded for that card's dcmub controller

This has hit some distros (Gentoo, Open Suse), but Arch still hasn't upgraded theirs "linux-firmware 20240809.59460076-1" to the affected commit/version.

I'm using firmware from git, and mine is fine on my RX 7700 XT (navi32) moreover, I got some bugs fixed (though I haven't tried to trigger the dmub queue failure with PM without compositor) but I think maybe I won't upgrade that again for no reason now, and wait until it all catches up.

So... anyone with an RX 6800 XT card that suddenly has problems after distro updates, see if linux-firmware (a.k.a. kernel-firmware etc. in some distros) was one of the updates.
Post Reply