WSL2-Linux-Kernel/drivers/base
Vladimir Oltean 74befa447e net: mdio: don't defer probe forever if PHY IRQ provider is missing
When a driver for an interrupt controller is missing, of_irq_get()
returns -EPROBE_DEFER ad infinitum, causing
fwnode_mdiobus_phy_device_register(), and ultimately, the entire
of_mdiobus_register() call, to fail. In turn, any phy_connect() call
towards a PHY on this MDIO bus will also fail.

This is not what is expected to happen, because the PHY library falls
back to poll mode when of_irq_get() returns a hard error code, and the
MDIO bus, PHY and attached Ethernet controller work fine, albeit
suboptimally, when the PHY library polls for link status. However,
-EPROBE_DEFER has special handling given the assumption that at some
point probe deferral will stop, and the driver for the supplier will
kick in and create the IRQ domain.

Reasons for which the interrupt controller may be missing:

- It is not yet written. This may happen if a more recent DT blob (with
  an interrupt-parent for the PHY) is used to boot an old kernel where
  the driver didn't exist, and that kernel worked with the
  vintage-correct DT blob using poll mode.

- It is compiled out. Behavior is the same as above.

- It is compiled as a module. The kernel will wait for a number of
  seconds specified in the "deferred_probe_timeout" boot parameter for
  user space to load the required module. The current default is 0,
  which times out at the end of initcalls. It is possible that this
  might cause regressions unless users adjust this boot parameter.

The proposed solution is to use the driver_deferred_probe_check_state()
helper function provided by the driver core, which gives up after some
-EPROBE_DEFER attempts, taking "deferred_probe_timeout" into consideration.
The return code is changed from -EPROBE_DEFER into -ENODEV or
-ETIMEDOUT, depending on whether the kernel is compiled with support for
modules or not.

Fixes: 66bdede495 ("of_mdio: Fix broken PHY IRQ in case of probe deferral")
Suggested-by: Robin Murphy <robin.murphy@arm.com>
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Link: https://lore.kernel.org/r/20220407165538.4084809-1-vladimir.oltean@nxp.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2022-04-08 14:17:55 -07:00
..
firmware_loader
power Merge branches 'pm-sleep', 'pm-domains' and 'pm-docs' 2022-03-18 18:29:21 +01:00
regmap regmap: Updates for v5.18 2022-03-21 18:22:42 -07:00
test
Kconfig
Makefile
arch_numa.c
arch_topology.c arch_topology: obtain cpu capacity using information from CPPC 2022-03-10 20:21:58 +01:00
attribute_container.c
auxiliary.c
base.h
bus.c
cacheinfo.c
class.c
component.c component: Add common helper for compare/release functions 2022-02-25 12:16:12 +01:00
container.c
core.c
cpu.c
dd.c net: mdio: don't defer probe forever if PHY IRQ provider is missing 2022-04-08 14:17:55 -07:00
devcoredump.c
devres.c devres: fix typos in comments 2022-03-18 14:30:12 +01:00
devtmpfs.c Driver core changes for 5.18-rc1 2022-03-28 12:41:28 -07:00
driver.c
firmware.c
hypervisor.c
init.c drivers/base/node: consolidate node device subsystem initialization in node_dev_init() 2022-03-22 15:57:10 -07:00
isa.c
map.c
memory.c drivers/base/memory: clarify adding and removing of memory blocks 2022-03-22 15:57:10 -07:00
module.c
node.c drivers/base/memory: determine and store zone for single-zone memory blocks 2022-03-22 15:57:10 -07:00
pinctrl.c
platform-msi.c
platform.c
property.c
soc.c base: soc: Make soc_device_match() simpler and easier to read 2022-03-18 14:28:07 +01:00
swnode.c
syscore.c
topology.c
trace.c
trace.h
transport_class.c