xanderlent / intel-npu-driver-rpm

RPM Packages for the Intel NPU Driver for Linux
1 stars 0 forks source link

dracut not picking up intel-npu-firmware #1

Open xanderlent opened 3 months ago

xanderlent commented 3 months ago

Despite the firmware being installed to /usr/lib/firmware/updates/intel/vpu/*, it seems that dracut is not picking up the new firmware when generating the initramfs. Use sudo lsinitrd to confirm the firmware files don't make it into the initramfs.

Is this intentionally because the updates folder is meant for runtime firmware only? Or maybe updates is correctly supposed to hold third party firmware - it's created in Fedora's linux-firmware package - but maybe dracut doesn't know that?

I guess I could tweak the build so that the firmware goes into /usr/lib/firmware/intel/vpu instead but I don't want a conflict if upstream decides to package it, and also, it would be a good idea to figure out what the updates folder is for and why Linux can search it but dracut can't.

xanderlent commented 3 months ago

OK, I tried rebuilding the package with the firmware path set to /usr/lib/firmware/intel/vpu but that still did not convince dracut [technically dracut-ng for Fedora] to pick up the firmware files (even after manually reloading the module to pick up the firmware before running dracut).

I think the drm dracut module is what picks up the Intel NPU kernel driver into the initramfs in the first place, since omitting it omits /usr/lib/modules/$KERNEL_NAME/kernel/drivers/accel/ivpu/intel_vpu.ko from the final image. Skimming the source, I think this is because the drm dracut module scans for hardware on various busses including PCIe and autoloads all of those modules since they might be needed if booting with a different graphics adapter.

That said, I'm not sure why the firmware isn't getting picked up. I've skimmed the source and dracut definitely checks both /usr/lib/firmware and /usr/lib/firmware/updates as well as the other standard locations by default. Maybe the module needs to annotate itself in a certain way to say what firmware it uses and dracut uses only that? Maybe the Intel NPU/VPU driver loads firmware in an unusual way and thus doesn't have that annotation?

Aha! modinfo intel_vpu doesn't list any firmware files; I think this is actually a kernel bug, and not a dracut bug???

xanderlent commented 3 months ago

Submitted a patch to fix this to upstream, will resubmit if not picked up or reviewed.

https://lore.kernel.org/all/20240705-fix-ivpu-firmware-metadata-v1-1-704b73852d92@xanderlent.com/

xanderlent commented 3 months ago

Goofed the v2, but we now are onto v3, should be good: https://lore.kernel.org/all/20240709-fix-ivpu-firmware-metadata-v3-1-55f70bba055b@xanderlent.com/

xanderlent commented 2 months ago

Picked up into drm-misc-next, so should be in either Linux 6.11 or Linux 6.12.

I'll adjust the instructions for this repo and on copr once the fix makes it into Fedora downstream.