• Saravana Kannan's avatar
    driver core: Refactor fw_devlink feature · f9aa4606
    Saravana Kannan authored
    The current implementation of fw_devlink is very inefficient because it
    tries to get away without creating fwnode links in the name of saving
    memory usage. Past attempts to optimize runtime at the cost of memory
    usage were blocked with request for data showing that the optimization
    made significant improvement for real world scenarios.
    
    We have those scenarios now. There have been several reports of boot
    time increase in the order of seconds in this thread [1]. Several OEMs
    and SoC manufacturers have also privately reported significant
    (350-400ms) increase in boot time due to all the parsing done by
    fw_devlink.
    
    So this patch uses all the setup done by the previous patches in this
    series to refactor fw_devlink to be more efficient. Most of the code has
    been moved out of firmware specific (DT mostly) code into driver core.
    
    This brings the following benefits:
    - Instead of parsing the device tree multiple times during bootup,
      fw_devlink parses each fwnode node/property only once and creates
      fwnode links. The rest of the fw_devlink code then just looks at these
      fwnode links to do rest of the work.
    
    - Makes it much easier to debug probe issue due to fw_devlink in the
      future. fw_devlink=on blocks the probing of devices if they depend on
      a device that hasn't been added yet. With this refactor, it'll be very
      easy to tell what that device is because we now have a reference to
      the fwnode of the device.
    
    - Much easier to add fw_devlink support to ACPI and other firmware
      types. A refactor to move the common bits from DT specific code to
      driver core was in my TODO list as a prerequisite to adding ACPI
      support to fw_devlink. This series gets that done.
    
    [1] - https://lore.kernel.org/linux-omap/ea02f57e-871d-cd16-4418-c1da4bbc4696@ti.com/Tested-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
    Tested-by: default avatarGrygorii Strashko <grygorii.strashko@ti.com>
    Signed-off-by: default avatarSaravana Kannan <saravanak@google.com>
    Link: https://lore.kernel.org/r/20201121020232.908850-17-saravanak@google.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    f9aa4606
core.c 120 KB