• Saravana Kannan's avatar
    driver core: Add wait_for_init_devices_probe helper function · 2f8c3ae8
    Saravana Kannan authored
    Some devices might need to be probed and bound successfully before the
    kernel boot sequence can finish and move on to init/userspace. For
    example, a network interface might need to be bound to be able to mount
    a NFS rootfs.
    
    With fw_devlink=on by default, some of these devices might be blocked
    from probing because they are waiting on a optional supplier that
    doesn't have a driver. While fw_devlink will eventually identify such
    devices and unblock the probing automatically, it might be too late by
    the time it unblocks the probing of devices. For example, the IP4
    autoconfig might timeout before fw_devlink unblocks probing of the
    network interface.
    
    This function is available to temporarily try and probe all devices that
    have a driver even if some of their suppliers haven't been added or
    don't have drivers.
    
    The drivers can then decide which of the suppliers are optional vs
    mandatory and probe the device if possible. By the time this function
    returns, all such "best effort" probes are guaranteed to be completed.
    If a device successfully probes in this mode, we delete all fw_devlink
    discovered dependencies of that device where the supplier hasn't yet
    probed successfully because they have to be optional dependencies.
    
    This also means that some devices that aren't needed for init and could
    have waited for their optional supplier to probe (when the supplier's
    module is loaded later on) would end up probing prematurely with limited
    functionality.  So call this function only when boot would fail without
    it.
    Tested-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
    Signed-off-by: default avatarSaravana Kannan <saravanak@google.com>
    Link: https://lore.kernel.org/r/20220601070707.3946847-5-saravanak@google.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    2f8c3ae8
dd.c 34.9 KB