We found that there is a spin_lock_irqsave protection in msg_submit()
of mailbox.c and it is in the atomic context.
So when the mailbox controller driver calls pm_runtime_get_sync() in
mbox_chan_ops->send_data(), it will get this BUG report.
"BUG: sleeping function called from invalid context at drivers/base/power/runtime.c:1164"
Additionally, pm_runtime_put_autosuspend() should be invoked from the
GCE IRQ handler to ensure the hardware has actually completed its work.
To resolve these issues, remove the pm_runtime calls from
cmdq_mbox_send_data() and delegate power management responsibilities
to the client driver.
---
Changes in v2:
- Move pm_runtmie APIs from cmdq driver to client drivers.
- Move pm_runtime_put_autosuspend to GCE irq callback function.
- Link to v1: https://lore.kernel.org/r/20240614040133.24967-1-jason-jh.lin@mediatek.com
---
Jason-JH Lin (3):
mailbox: mtk-cmdq: Remove pm_runtime APIs from cmdq_mbox_send_data()
drm/mediatek: Add pm_runtime support for GCE power control
media: platform: mtk-mdp3: Add pm_runtime support for GCE power
control
drivers/gpu/drm/mediatek/mtk_crtc.c | 7 +++++++
drivers/mailbox/mtk-cmdq-mailbox.c | 12 +-----------
drivers/media/platform/mediatek/mdp3/mtk-mdp3-cmdq.c | 11 +++++++++++
3 files changed, 19 insertions(+), 11 deletions(-)
--
2.43.0