Page MenuHomeFreeBSD

LinuxKPI: firmware, implement deferred loading for "nowait"
ClosedPublic

Authored by bz on Jun 20 2021, 2:06 PM.
Tags
None
Referenced Files
Unknown Object (File)
Feb 10 2024, 7:03 PM
Unknown Object (File)
Feb 8 2024, 2:19 PM
Unknown Object (File)
Feb 6 2024, 10:42 PM
Unknown Object (File)
Feb 4 2024, 5:47 AM
Unknown Object (File)
Dec 20 2023, 4:35 AM
Unknown Object (File)
Dec 17 2023, 7:11 AM
Unknown Object (File)
Dec 14 2023, 1:37 AM
Unknown Object (File)
Dec 12 2023, 8:42 AM

Details

Summary

Change linuxkpi_request_firmware_nowait() to deferred firmware loading
scheduling a task. This changes behaviour in some cases that we
return from loading the driver before the driver is finished
initialising if the driver does not deal with it (wait).
This brings the behaviour one would expect from when this function is
called and I implemented it to see if it would help a specific case.

Sponsored by: The FreeBSD Foundation
MFC after: 12 days

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

bz requested review of this revision.Jun 20 2021, 2:06 PM

Looks good to my eye... it's super close to how I'd write it...

This revision is now accepted and ready to land.Jun 20 2021, 2:14 PM
hselasky added inline comments.
sys/compat/linuxkpi/common/src/linux_firmware.c
152

I suggest setting the "fw" to NULL here, because you pass this pointer on failure to the callback function.

164

Maybe print an error in dmesg on error. Makes it easier to locate missing firmware files.

165

Call lfwt->cont unconditionally?

bz marked 2 inline comments as done.Jun 20 2021, 2:59 PM
bz added inline comments.
sys/compat/linuxkpi/common/src/linux_firmware.c
152

That's only an issue in case we do the call unconditionally below; otherwise it should always be initialised or we don't call "cont".

164

_linuxkpi_request_firmware dos that for you.

165

Do we need to? We didn't do before but probably given there is no other error propagation, the only alternate for a driver to know would be to "timeout"?

bz marked 2 inline comments as done.

Make sure *fw is initialised in all cases.
Unconditionally call the callback function as it is the only feedback path
to the requester.

This revision now requires review to proceed.Jun 20 2021, 3:04 PM
bz marked an inline comment as done.Jun 20 2021, 3:04 PM

You may want to wait for pending tasks at linuxkpi module unload, if the driver doesn't do that.

--HPS

This revision is now accepted and ready to land.Jun 20 2021, 3:31 PM