Skip to content
  • Luis R. Rodriguez's avatar
    test_firmware: add batched firmware tests · c92316bf
    Luis R. Rodriguez authored
    
    
    The firmware API has a feature to enable batching requests for the same fil
    e under one worker, so only one lookup is done. This only triggers if we so
    happen to schedule two lookups for same file around the same time, or if
    release_firmware() has not been called for a successful firmware call. This
    can happen for instance if you happen to have multiple devices and one
    device driver for certain drivers where the stars line up scheduling
    wise.
    
    This adds a new sync and async test trigger. Instead of adding a new
    trigger for each new test type we make the tests a bit configurable so that
    we could configure the tests in userspace and just kick a test through a
    few basic triggers. With this, for instance the two types of sync requests:
    
      o request_firmware() and
      o request_firmware_direct()
    
    can be modified with a knob. Likewise the two type of async requests:
    
       o request_firmware_nowait(uevent=true) and
       o request_firmware_nowait(uevent=false)
    
    can be configured with another knob. The call request_firmware_into_buf()
    has no users... yet.
    
    The old tests are left in place as-is given they serve a few other purposes
    which we are currently not interested in also testing yet. This will change
    later as we will be able to just consolidate all tests under a few basic
    triggers with just one general configuration setup.
    
    We perform two types of tests, one for where the file is present and one
    for where the file is not present. All test tests go tested and they now
    pass for the following 3 kernel builds possible for the firmware API:
    
    0. Most distro setup:
       CONFIG_FW_LOADER_USER_HELPER_FALLBACK=n
       CONFIG_FW_LOADER_USER_HELPER=y
    1. Android:
       CONFIG_FW_LOADER_USER_HELPER_FALLBACK=y
       CONFIG_FW_LOADER_USER_HELPER=y
    2. Rare build:
       CONFIG_FW_LOADER_USER_HELPER_FALLBACK=n
       CONFIG_FW_LOADER_USER_HELPER=n
    
    Signed-off-by: default avatarLuis R. Rodriguez <mcgrof@kernel.org>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    c92316bf