mbox series

[0/2] Fix sleeping function called from invalid context

Message ID 20240614040133.24967-1-jason-jh.lin@mediatek.com (mailing list archive)
Headers show
Series Fix sleeping function called from invalid context | expand

Message

Jason-JH.Lin June 14, 2024, 4:01 a.m. UTC
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"

Add API to mbox_chan_ops to make mailbox takes into account that a driver
may need PM done.

Jason-JH.Lin (2):
  mailbox: Add power_get/power_put API to mbox_chan_ops
  mailbox: mtk-cmdq: Move pm_runimte_get and put to mbox_chan_ops API

 drivers/mailbox/mailbox.c          | 55 ++++++++++++++++++++++++++++++
 drivers/mailbox/mtk-cmdq-mailbox.c | 37 ++++++++++----------
 include/linux/mailbox_controller.h | 11 ++++++
 3 files changed, 84 insertions(+), 19 deletions(-)