Page MenuHomeFreeBSD

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

Authored by bz on Jun 20 2021, 2:06 PM.
Tags
None
Referenced Files
F102771119: D30830.id91140.diff
Sat, Nov 16, 11:04 PM
Unknown Object (File)
Tue, Oct 22, 5:52 AM
Unknown Object (File)
Mon, Oct 21, 4:09 AM
Unknown Object (File)
Fri, Oct 18, 8:18 AM
Unknown Object (File)
Oct 17 2024, 1:55 PM
Unknown Object (File)
Oct 15 2024, 12:46 AM
Unknown Object (File)
Oct 10 2024, 5:56 PM
Unknown Object (File)
Oct 10 2024, 5:56 PM

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