linux-stable/drivers/base
Vladimir Oltean 152b813d8b net: mdio: don't defer probe forever if PHY IRQ provider is missing
[ Upstream commit 74befa447e ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-04-20 09:34:10 +02:00
..
firmware_loader firmware_loader: fix pre-allocated buf built-in firmware use 2021-11-25 09:48:27 +01:00
power rtc: Check return value from mc146818_get_time() 2022-04-13 20:59:14 +02:00
regmap regmap-irq: Update interrupt clear register for proper reset 2022-03-02 11:48:01 +01:00
test device property: build kunit tests without structleak plugin 2021-10-06 17:53:42 -06:00
arch_numa.c memblock: introduce saner 'memblock_free_ptr()' interface 2021-09-14 13:23:22 -07:00
arch_topology.c cpufreq: qcom-cpufreq-hw: Add dcvs interrupt support 2021-08-30 10:43:35 +05:30
attribute_container.c driver core: attribute_container: fix W=1 warnings 2021-05-14 13:37:10 +02:00
auxiliary.c Merge 5.14-rc3 into driver-core-next 2021-07-27 09:22:08 +02:00
base.h software nodes: Split software_node_notify() 2021-07-16 19:17:05 +02:00
bus.c driver: base: Replace symbolic permissions with octal permissions 2021-07-21 14:56:00 +02:00
cacheinfo.c cacheinfo: clear cache_leaves(cpu) in free_cache_attributes() 2021-07-21 17:29:40 +02:00
class.c drivers: base: fix some kernel-doc markups 2020-11-09 18:56:49 +01:00
component.c component: do not leave master devres group open after bind 2021-11-18 19:16:08 +01:00
container.c
core.c PM: runtime: Add safety net to supplier device release 2022-01-27 11:04:44 +01:00
cpu.c driver: base: Prefer unsigned int to bare use of unsigned 2021-07-21 17:30:09 +02:00
dd.c net: mdio: don't defer probe forever if PHY IRQ provider is missing 2022-04-20 09:34:10 +02:00
devcoredump.c devcoredump: remove contact information 2021-06-04 15:05:44 +02:00
devres.c devres: Enable trace events 2021-06-15 17:14:36 +02:00
devtmpfs.c devtmpfs regression fix: reconfigure on each mount 2022-01-20 09:13:13 +01:00
driver.c drivers: base: Convert to printk alias functions 2020-07-10 14:16:44 +02:00
firmware.c
hypervisor.c
init.c driver core: auxiliary bus: Fix calling stage for auxiliary bus init 2021-02-11 08:43:03 +01:00
isa.c bus: Make remove callback return void 2021-07-21 11:53:42 +02:00
Kconfig RISC-V Patches for the 5.12 Merge Window 2021-02-26 10:28:35 -08:00
Makefile devres: Enable trace events 2021-06-15 17:14:36 +02:00
map.c driver: base: Prefer unsigned int to bare use of unsigned 2021-07-21 17:30:09 +02:00
memory.c drivers/base/memory: add memory block to memory group after registration succeeded 2022-04-08 14:23:12 +02:00
module.c
node.c Merge branch 'akpm' (patches from Andrew) 2021-09-08 12:55:35 -07:00
pinctrl.c
platform-msi.c platform-msi: Add ABI to show msi_irqs of platform devices 2021-08-24 09:16:20 +02:00
platform.c driver core: platform: Remove platform_device_add_properties() 2021-08-18 16:08:11 +02:00
property.c device property: Fix fwnode_graph_devcon_match() fwnode leak 2022-01-27 11:05:10 +01:00
soc.c soc: fix comment for freeing soc_dev_attr 2020-12-09 19:46:31 +01:00
swnode.c software node: fix wrong node passed to find nargs_prop 2022-01-27 11:03:46 +01:00
syscore.c syscore: Use pm_pr_dbg() for syscore_{suspend,resume}() 2020-09-08 13:32:06 +02:00
topology.c topology: use bin_attribute to break the size limitation of cpumap ABI 2021-08-13 10:27:49 +02:00
trace.c devres: Enable trace events 2021-06-15 17:14:36 +02:00
trace.h devres: Enable trace events 2021-06-15 17:14:36 +02:00
transport_class.c