09 Jul, 2014

2 commits

  • Now that the udev firmware loader is optional request_firmware()
    will not provide any information on the kernel ring buffer if
    direct firmware loading failed and udev firmware loading is disabled.
    If no information is needed request_firmware_direct() should be used
    for optional firmware, at which point drivers can take on the onus
    over informing of any failures, if udev firmware loading is disabled
    though we should at the very least provide some sort of information
    as when the udev loader was enabled by default back in the days.

    With this change with a simple firmware load test module [0]:

    Example output without FW_LOADER_USER_HELPER_FALLBACK

    platform fake-dev.0: Direct firmware load for fake.bin failed
    with error -2

    Example with FW_LOADER_USER_HELPER_FALLBACK

    platform fake-dev.0: Direct firmware load for fake.bin failed with error -2
    platform fake-dev.0: Falling back to user helper

    Without this change without FW_LOADER_USER_HELPER_FALLBACK we
    get no output logged upon failure.

    Cc: Tom Gundersen
    Cc: Ming Lei
    Cc: Abhay Salunke
    Cc: Stefan Roese
    Cc: Arnd Bergmann
    Cc: Kay Sievers
    Signed-off-by: Luis R. Rodriguez
    Reviewed-by: Takashi Iwai
    Signed-off-by: Greg Kroah-Hartman

    Luis R. Rodriguez
     
  • [The patch was originally proposed by Tom Gundersen, and rewritten
    afterwards by me; most of changelogs below borrowed from Tom's
    original patch -- tiwai]

    Currently (at least) the dell-rbu driver selects FW_LOADER_USER_HELPER,
    which means that distros can't really stop loading firmware through
    udev without breaking other users (though some have).

    Ideally we would remove/disable the udev firmware helper in both the
    kernel and in udev, but if we were to disable it in udev and not the
    kernel, the result would be (seemingly) hung kernels as no one would
    be around to cancel firmware requests.

    This patch allows udev firmware loading to be disabled while still
    allowing non-udev firmware loading, as done by the dell-rbu driver, to
    continue working. This is achieved by only using the fallback
    mechanism when the uevent is suppressed.

    The patch renames the user-selectable Kconfig from FW_LOADER_USER_HELPER
    to FW_LOADER_USER_HELPER_FALLBACK, and the former is reverse-selected
    by the latter or the drivers that need userhelper like dell-rbu.

    Also, the "default y" is removed together with this change, since it's
    been deprecated in udev upstream, thus rather better to disable it
    nowadays.

    Tested with
    FW_LOADER_USER_HELPER=n
    LATTICE_ECP3_CONFIG=y
    DELL_RBU=y
    and udev without the firmware loading support, but I don't have the
    hardware to test the lattice/dell drivers, so additional testing would
    be appreciated.

    Reviewed-by: Tom Gundersen
    Cc: Ming Lei
    Cc: Abhay Salunke
    Cc: Stefan Roese
    Cc: Arnd Bergmann
    Cc: Kay Sievers
    Tested-by: Balaji Singh
    Signed-off-by: Takashi Iwai
    Signed-off-by: Greg Kroah-Hartman

    Takashi Iwai
     

09 Dec, 2013

1 commit

  • When CONFIG_FW_LOADER_USER_HELPER is set, request_firmware() falls
    back to the usermode helper for loading via udev when the direct
    loading fails. But the recent udev takes way too long timeout (60
    seconds) for non-existing firmware. This is unacceptable for the
    drivers like microcode loader where they load firmwares optionally,
    i.e. it's no error even if no requested file exists.

    This patch provides a new helper function, request_firmware_direct().
    It behaves as same as request_firmware() except for that it doesn't
    fall back to usermode helper but returns an error immediately if the
    f/w can't be loaded directly in kernel.

    Without CONFIG_FW_LOADER_USER_HELPER=y, request_firmware_direct() is
    just an alias of request_firmware(), due to obvious reason.

    Tested-by: Prarit Bhargava
    Acked-by: Ming Lei
    Acked-by: Borislav Petkov
    Signed-off-by: Takashi Iwai
    Signed-off-by: Greg Kroah-Hartman

    Takashi Iwai
     

07 Jun, 2013

1 commit


17 Aug, 2012

2 commits

  • This patches introduce two kernel APIs of cache_firmware and
    uncache_firmware, both of which take the firmware file name
    as the only parameter.

    So any drivers can call cache_firmware to cache the specified
    firmware file into kernel memory, and can use the cached firmware
    in situations which can't request firmware from user space.

    Signed-off-by: Ming Lei
    Cc: Linus Torvalds
    Signed-off-by: Greg Kroah-Hartman

    Ming Lei
     
  • This patch always let firmware_buf own the pages buffer allocated
    inside firmware_data_write, and add all instances of firmware_buf
    into the firmware cache global list. Also introduce one private field
    in 'struct firmware', so release_firmware will see the instance of
    firmware_buf associated with the current firmware instance, then just
    'free' the instance of firmware_buf.

    The firmware_buf instance represents one pages buffer for one
    firmware image, so lots of firmware loading requests can share
    the same firmware_buf instance if they request the same firmware
    image file.

    This patch will make implementation of the following cache_firmware/
    uncache_firmware very easy and simple.

    In fact, the patch improves request_formware/release_firmware:

    - only request userspace to write firmware image once if
    several devices share one same firmware image and its drivers
    call request_firmware concurrently.

    Signed-off-by: Ming Lei
    Cc: Linus Torvalds
    Signed-off-by: Greg Kroah-Hartman

    Ming Lei
     

01 Nov, 2011

1 commit

  • The pretty much brings in the kitchen sink along
    with it, so it should be avoided wherever reasonably possible in
    terms of being included from other commonly used
    files, as it results in a measureable increase on compile times.

    The worst culprit was probably device.h since it is used everywhere.
    This file also had an implicit dependency/usage of mutex.h which was
    masked by module.h, and is also fixed here at the same time.

    There are over a dozen other headers that simply declare the
    struct instead of pulling in the whole file, so follow their lead
    and simply make it a few more.

    Most of the implicit dependencies on module.h being present by
    these headers pulling it in have been now weeded out, so we can
    finally make this change with hopefully minimal breakage.

    Signed-off-by: Paul Gortmaker

    Paul Gortmaker
     

04 Feb, 2011

1 commit


22 May, 2010

1 commit

  • fix memory leak introduced by the patch 6e03a201bbe:
    firmware: speed up request_firmware()

    1. vfree won't release pages there were allocated explicitly and mapped
    using vmap. The memory has to be vunmap-ed and the pages needs
    to be freed explicitly

    2. page array is moved into the 'struct
    firmware' so that we can free it from release_firmware()
    and not only in fw_dev_release()

    The fix doesn't break the firmware load speed.

    Cc: Johannes Berg
    Cc: Ming Lei
    Cc: Catalin Marinas
    Singed-off-by: Kay Sievers
    Signed-off-by: David Woodhouse
    Signed-off-by: Tomas Winkler
    Signed-off-by: Greg Kroah-Hartman

    David Woodhouse
     

12 Dec, 2009

1 commit

  • Unfortunately, one cannot hold on to the struct firmware
    that request_firmware_nowait() hands off, which is needed
    in some cases. Allow this by requiring the callback to
    free it (via release_firmware).

    Additionally, give it a gfp_t parameter -- all the current
    users call it from a GFP_KERNEL context so the GFP_ATOMIC
    isn't necessary. This also marks an API break which is
    useful in a sense, although that is obviously not the
    primary purpose of this change.

    Signed-off-by: Johannes Berg
    Acked-by: Marcel Holtmann
    Cc: Ming Lei
    Cc: Catalin Marinas
    Cc: David Woodhouse
    Cc: Pavel Roskin
    Cc: Abhay Salunke
    Signed-off-by: Greg Kroah-Hartman

    Johannes Berg
     

16 Jun, 2009

1 commit

  • As we're allocating the firmware name dynamically, we no longer need this
    definition.
    This patch must be applied only after the 5 previous patches from this pacth
    set have been applied.

    Signed-off-by: Samuel Ortiz
    Signed-off-by: Greg Kroah-Hartman

    Samuel Ortiz
     

10 Jul, 2008

2 commits

  • Some drivers have their own hacks to bypass the kernel's firmware loader
    and build their firmware into the kernel; this renders those unnecessary.

    Other drivers don't use the firmware loader at all, because they always
    want the firmware to be available. This allows them to start using the
    firmware loader.

    A third set of drivers already use the firmware loader, but can't be
    used without help from userspace, which sometimes requires an initrd.
    This allows them to work in a static kernel.

    Signed-off-by: David Woodhouse

    David Woodhouse
     
  • In preparation for supporting firmware files linked into the static
    kernel, make fw->data const to ensure that users aren't modifying it (so
    that we can pass a pointer to the original in-kernel copy, rather than
    having to copy it).

    Signed-off-by: David Woodhouse

    David Woodhouse
     

05 Jul, 2008

1 commit

  • > the build (.config attached) failed, make ends with :
    > ...
    > UPD include/linux/compile.h
    > CC init/version.o
    > LD init/built-in.o
    > LD vmlinux
    > drivers/built-in.o: In function `sas_request_addr':
    > (.text+0x33bab): undefined reference to `request_firmware'
    > drivers/built-in.o: In function `sas_request_addr':
    > (.text+0x33c3f): undefined reference to `release_firmware'
    > make: *** [vmlinux] Error 1

    There's a slight fault in the stub logic. It fails for FW_LOADER=m and
    the user =y.

    This should fix it.

    This patch fixes the following 2.6.26-rc regression:
    http://bugzilla.kernel.org/show_bug.cgi?id=10730

    Reviewed-by: Toralf Foerster
    Signed-off-by: Adrian Bunk
    Cc: "Rafael J. Wysocki"
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    James Bottomley
     

11 Mar, 2008

1 commit

  • libsas has a case where it uses the firmware loader to provide services,
    but doesn't want to select it all the time. This currently causes a
    compile failure in libsas if FW_LOADER=n. Fix this by providing error
    stubs for the firmware loader API in the FW_LOADER=n case.

    Signed-off-by: James Bottomley
    Cc: Randy Dunlap
    Signed-off-by: Greg Kroah-Hartman

    James Bottomley
     

22 May, 2006

1 commit

  • - remove the following global function that is both unused and
    unimplemented:
    - register_firmware()

    - make the following needlessly global function static:
    - firmware_class_uevent()

    Signed-off-by: Adrian Bunk
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Adrian Bunk
     

05 Jan, 2006

1 commit


08 Sep, 2005

1 commit


17 Apr, 2005

1 commit

  • Initial git repository build. I'm not bothering with the full history,
    even though we have it. We can create a separate "historical" git
    archive of that later if we want to, and in the meantime it's about
    3.2GB when imported into git - space that would just make the early
    git days unnecessarily complicated, when we don't have a lot of good
    infrastructure for it.

    Let it rip!

    Linus Torvalds