memory: mtk-smi: fail larb runtime resume until component bind
With mtk-smi and mtk-iommu built as modules, a consumer probe (e.g.
mediatek-drm on MT8183) runtime-resumes its smi-larb suppliers via
pm_runtime_get_suppliers(), possibly before the iommu's component master
bind. mtk_smi_larb_resume() then calls
mtk_smi_larb_config_port_gen2_general(), which dereferences larb->mmu
and larb->bank, both populated only in mtk_smi_larb_bind():
Internal error: Oops: 0000000096000004 [#1] SMP
pc : mtk_smi_larb_config_port_gen2_general+0xe0/0x660 [mtk_smi]
lr : mtk_smi_larb_resume+0xb8/0x1b8 [mtk_smi]
Call trace:
mtk_smi_larb_config_port_gen2_general+0xe0/0x660 [mtk_smi] (P)
mtk_smi_larb_resume+0xb8/0x1b8 [mtk_smi]
...
pm_runtime_get_suppliers+0x6c/0xb8
__driver_probe_device+0x68/0x230
...
mtk_drm_init+0x38/0xfd0 [mediatek_drm]
The oopsing udev worker holds the module loader locks, so the boot
hangs in the initrd. The same was reported on MT8188 from mtk_mdp3.
Track the bind state with a flag published with smp_store_release()
and fail the resume with -EAGAIN until it is set. The larb stays
suspended rather than active with unconfigured ports, the error is
ignored by pm_runtime_get_suppliers(), and the consumer's first real
resume (e.g. in mtk_crtc_atomic_enable()) happens after the bind and
configures the ports.
Fixes: 4f0a1a1ae351 ("memory: mtk-smi: Invoke pm runtime_callback to enable clocks")
Reported-by: Jian Hui Lee <jianhui.lee@canonical.com>
Closes: https://lore.kernel.org/linux-arm-kernel/20251111124853.2916889-1-jianhui.lee@canonical.com/
Cc: stable@vger.kernel.org
Signed-off-by: Valentin Haudiquet <valentin.haudiquet@canonical.com>
Reviewed-by: Yong Wu <yong.wu@mediatek.com>
Link: https://patch.msgid.link/20260926192417.1448813-1-valentin.haudiquet@canonical.com
[krzk: Rewrite huge wall of LLM text into something shorted and
manageable]
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
1 file changed