In the case of Orinoco USB devices, we even have fxload to download the
ez-usb firmware, but the device doesn't change identity on firmware
load, so both the hotplug helper and the driver end up accessing the
device at the same time and it blows up.
> The driver could provide a chardev interface to upload the firmware
> through, but that's a lot more work - and there are issues of mapping
> the right chardev to the right network device instance, coping with
> the device in half-alive mode (i.e. initialized enough that firmware
> can be uploaded, but not ready to use because there's no firmware yet)
> etc.
>
> I believe the idea is that hotplug (or other scripts) would copy the
> appropriate firmware into the relevant path in fwfs, so you don't need
> RAM for every firmware variant - just the one you're using.
Yes, that is the idea, although "hotplug" support is not implemented
jet. I wanted some more feedback before expending more time on this.
Taking a closer look, it should be easy to hook into the regular
hotplug mechanism. I could just run '/sbin/hotplug firmware' setting
FW_NAME=image_name in the environment and wait for it to finish like
kmod does with modprobe.
And if I also run it with 'ACTION=unload' when the firmware is not
needed, it can easily be removed to save memory.
> And if we're really worried about memory it shouldn't be hard for the
> driver to arrange to unlink the firmware image once it's done with it
> (at the cost of not being able to reload the firmware on a
> reset/reinitialize, which might be sensible or necessary for some
> devices).
On the other hand, there are already many drivers in the kernel that
include firmware in headers, keyspan, io_edgeport, dabusb, ser_a2232,
sym53c8xx_2, ...
Something like fwfs would allow the removal of such firmware and save
memory.
If the firmware is not needed to boot, it could simply be removed from
the kernel and be loaded from userspace.
If the firmware is needed to boot, the driver could declare the
firmware as __init data and register it on boot via fwfs_write_default.
And after boot it could just be unlinked from fwfs recovering the
memory.
Currently the firmware image is copied into kmalloced memory then a
drivers asks for the image, but if memory is such an issue, I'll look
for a way to use the page cache data directly all the time. I'll take a
closer look to the vmalloc code.
Have a nice day
Manuel
-- --- Manuel Estrada Sainz <ranty@debian.org> <ranty@bigfoot.com> <ranty@users.sourceforge.net> ------------------------ <manuel.estrada@hispalinux.es> ------------------- Let us have the serenity to accept the things we cannot change, courage to change the things we can, and wisdom to know the difference. - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/