diff mbox series

[V3,1/9] mailbox: bcm2835: Fix timeout during suspend mode

Message ID 20240821214052.6800-2-wahrenst@gmx.net (mailing list archive)
State New, archived
Headers show
Series ARM: bcm2835: Implement initial S2Idle for Raspberry Pi | expand

Commit Message

Stefan Wahren Aug. 21, 2024, 9:40 p.m. UTC
During noirq suspend phase the Raspberry Pi power driver suffer of
firmware property timeouts. The reason is that the IRQ of the underlying
BCM2835 mailbox is disabled and rpi_firmware_property_list() will always
run into a timeout [1].

Since the VideoCore side isn't consider as a wakeup source, set the
IRQF_NO_SUSPEND flag for the mailbox IRQ in order to keep it enabled
during suspend-resume cycle.

[1]
PM: late suspend of devices complete after 1.754 msecs
WARNING: CPU: 0 PID: 438 at drivers/firmware/raspberrypi.c:128
 rpi_firmware_property_list+0x204/0x22c
Firmware transaction 0x00028001 timeout
Modules linked in:
CPU: 0 PID: 438 Comm: bash Tainted: G         C         6.9.3-dirty #17
Hardware name: BCM2835
Call trace:
unwind_backtrace from show_stack+0x18/0x1c
show_stack from dump_stack_lvl+0x34/0x44
dump_stack_lvl from __warn+0x88/0xec
__warn from warn_slowpath_fmt+0x7c/0xb0
warn_slowpath_fmt from rpi_firmware_property_list+0x204/0x22c
rpi_firmware_property_list from rpi_firmware_property+0x68/0x8c
rpi_firmware_property from rpi_firmware_set_power+0x54/0xc0
rpi_firmware_set_power from _genpd_power_off+0xe4/0x148
_genpd_power_off from genpd_sync_power_off+0x7c/0x11c
genpd_sync_power_off from genpd_finish_suspend+0xcc/0xe0
genpd_finish_suspend from dpm_run_callback+0x78/0xd0
dpm_run_callback from device_suspend_noirq+0xc0/0x238
device_suspend_noirq from dpm_suspend_noirq+0xb0/0x168
dpm_suspend_noirq from suspend_devices_and_enter+0x1b8/0x5ac
suspend_devices_and_enter from pm_suspend+0x254/0x2e4
pm_suspend from state_store+0xa8/0xd4
state_store from kernfs_fop_write_iter+0x154/0x1a0
kernfs_fop_write_iter from vfs_write+0x12c/0x184
vfs_write from ksys_write+0x78/0xc0
ksys_write from ret_fast_syscall+0x0/0x54
Exception stack(0xcc93dfa8 to 0xcc93dff0)
[...]
PM: noirq suspend of devices complete after 3095.584 msecs

Link: https://github.com/raspberrypi/firmware/issues/1894
Fixes: 0bae6af6d704 ("mailbox: Enable BCM2835 mailbox support")
Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
---
 drivers/mailbox/bcm2835-mailbox.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--
2.34.1

Comments

Stefan Wahren Aug. 31, 2024, 9:19 a.m. UTC | #1
Hi Jassi,

Am 21.08.24 um 23:40 schrieb Stefan Wahren:
> During noirq suspend phase the Raspberry Pi power driver suffer of
> firmware property timeouts. The reason is that the IRQ of the underlying
> BCM2835 mailbox is disabled and rpi_firmware_property_list() will always
> run into a timeout [1].
>
> Since the VideoCore side isn't consider as a wakeup source, set the
> IRQF_NO_SUSPEND flag for the mailbox IRQ in order to keep it enabled
> during suspend-resume cycle.
>
> [1]
> PM: late suspend of devices complete after 1.754 msecs
> WARNING: CPU: 0 PID: 438 at drivers/firmware/raspberrypi.c:128
>   rpi_firmware_property_list+0x204/0x22c
> Firmware transaction 0x00028001 timeout
> Modules linked in:
> CPU: 0 PID: 438 Comm: bash Tainted: G         C         6.9.3-dirty #17
> Hardware name: BCM2835
> Call trace:
> unwind_backtrace from show_stack+0x18/0x1c
> show_stack from dump_stack_lvl+0x34/0x44
> dump_stack_lvl from __warn+0x88/0xec
> __warn from warn_slowpath_fmt+0x7c/0xb0
> warn_slowpath_fmt from rpi_firmware_property_list+0x204/0x22c
> rpi_firmware_property_list from rpi_firmware_property+0x68/0x8c
> rpi_firmware_property from rpi_firmware_set_power+0x54/0xc0
> rpi_firmware_set_power from _genpd_power_off+0xe4/0x148
> _genpd_power_off from genpd_sync_power_off+0x7c/0x11c
> genpd_sync_power_off from genpd_finish_suspend+0xcc/0xe0
> genpd_finish_suspend from dpm_run_callback+0x78/0xd0
> dpm_run_callback from device_suspend_noirq+0xc0/0x238
> device_suspend_noirq from dpm_suspend_noirq+0xb0/0x168
> dpm_suspend_noirq from suspend_devices_and_enter+0x1b8/0x5ac
> suspend_devices_and_enter from pm_suspend+0x254/0x2e4
> pm_suspend from state_store+0xa8/0xd4
> state_store from kernfs_fop_write_iter+0x154/0x1a0
> kernfs_fop_write_iter from vfs_write+0x12c/0x184
> vfs_write from ksys_write+0x78/0xc0
> ksys_write from ret_fast_syscall+0x0/0x54
> Exception stack(0xcc93dfa8 to 0xcc93dff0)
> [...]
> PM: noirq suspend of devices complete after 3095.584 msecs
>
> Link: https://github.com/raspberrypi/firmware/issues/1894
> Fixes: 0bae6af6d704 ("mailbox: Enable BCM2835 mailbox support")
> Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
> Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
gentle ping
> ---
>   drivers/mailbox/bcm2835-mailbox.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mailbox/bcm2835-mailbox.c b/drivers/mailbox/bcm2835-mailbox.c
> index fbfd0202047c..ea12fb8d2401 100644
> --- a/drivers/mailbox/bcm2835-mailbox.c
> +++ b/drivers/mailbox/bcm2835-mailbox.c
> @@ -145,7 +145,8 @@ static int bcm2835_mbox_probe(struct platform_device *pdev)
>   	spin_lock_init(&mbox->lock);
>
>   	ret = devm_request_irq(dev, irq_of_parse_and_map(dev->of_node, 0),
> -			       bcm2835_mbox_irq, 0, dev_name(dev), mbox);
> +			       bcm2835_mbox_irq, IRQF_NO_SUSPEND, dev_name(dev),
> +			       mbox);
>   	if (ret) {
>   		dev_err(dev, "Failed to register a mailbox IRQ handler: %d\n",
>   			ret);
> --
> 2.34.1
>
Jassi Brar Sept. 1, 2024, 8:26 p.m. UTC | #2
On Sat, Aug 31, 2024 at 4:19 AM Stefan Wahren <wahrenst@gmx.net> wrote:
>
> Hi Jassi,
>
> Am 21.08.24 um 23:40 schrieb Stefan Wahren:
> > During noirq suspend phase the Raspberry Pi power driver suffer of
> > firmware property timeouts. The reason is that the IRQ of the underlying
> > BCM2835 mailbox is disabled and rpi_firmware_property_list() will always
> > run into a timeout [1].
> >
> > Since the VideoCore side isn't consider as a wakeup source, set the
> > IRQF_NO_SUSPEND flag for the mailbox IRQ in order to keep it enabled
> > during suspend-resume cycle.
> >
> > [1]
> > PM: late suspend of devices complete after 1.754 msecs
> > WARNING: CPU: 0 PID: 438 at drivers/firmware/raspberrypi.c:128
> >   rpi_firmware_property_list+0x204/0x22c
> > Firmware transaction 0x00028001 timeout
> > Modules linked in:
> > CPU: 0 PID: 438 Comm: bash Tainted: G         C         6.9.3-dirty #17
> > Hardware name: BCM2835
> > Call trace:
> > unwind_backtrace from show_stack+0x18/0x1c
> > show_stack from dump_stack_lvl+0x34/0x44
> > dump_stack_lvl from __warn+0x88/0xec
> > __warn from warn_slowpath_fmt+0x7c/0xb0
> > warn_slowpath_fmt from rpi_firmware_property_list+0x204/0x22c
> > rpi_firmware_property_list from rpi_firmware_property+0x68/0x8c
> > rpi_firmware_property from rpi_firmware_set_power+0x54/0xc0
> > rpi_firmware_set_power from _genpd_power_off+0xe4/0x148
> > _genpd_power_off from genpd_sync_power_off+0x7c/0x11c
> > genpd_sync_power_off from genpd_finish_suspend+0xcc/0xe0
> > genpd_finish_suspend from dpm_run_callback+0x78/0xd0
> > dpm_run_callback from device_suspend_noirq+0xc0/0x238
> > device_suspend_noirq from dpm_suspend_noirq+0xb0/0x168
> > dpm_suspend_noirq from suspend_devices_and_enter+0x1b8/0x5ac
> > suspend_devices_and_enter from pm_suspend+0x254/0x2e4
> > pm_suspend from state_store+0xa8/0xd4
> > state_store from kernfs_fop_write_iter+0x154/0x1a0
> > kernfs_fop_write_iter from vfs_write+0x12c/0x184
> > vfs_write from ksys_write+0x78/0xc0
> > ksys_write from ret_fast_syscall+0x0/0x54
> > Exception stack(0xcc93dfa8 to 0xcc93dff0)
> > [...]
> > PM: noirq suspend of devices complete after 3095.584 msecs
> >
> > Link: https://github.com/raspberrypi/firmware/issues/1894
> > Fixes: 0bae6af6d704 ("mailbox: Enable BCM2835 mailbox support")
> > Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
> > Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
> gentle ping

This sounds like a fix but also a part of 9 patches update. Do you
want this merged as a bugfix now or into the next window.

thanks
Stefan Wahren Sept. 1, 2024, 8:57 p.m. UTC | #3
Hi Jassi,

Am 01.09.24 um 22:26 schrieb Jassi Brar:
> On Sat, Aug 31, 2024 at 4:19 AM Stefan Wahren <wahrenst@gmx.net> wrote:
>> Hi Jassi,
>>
>> Am 21.08.24 um 23:40 schrieb Stefan Wahren:
>>> During noirq suspend phase the Raspberry Pi power driver suffer of
>>> firmware property timeouts. The reason is that the IRQ of the underlying
>>> BCM2835 mailbox is disabled and rpi_firmware_property_list() will always
>>> run into a timeout [1].
>>>
>>> Since the VideoCore side isn't consider as a wakeup source, set the
>>> IRQF_NO_SUSPEND flag for the mailbox IRQ in order to keep it enabled
>>> during suspend-resume cycle.
>>>
>>> [1]
>>> PM: late suspend of devices complete after 1.754 msecs
>>> WARNING: CPU: 0 PID: 438 at drivers/firmware/raspberrypi.c:128
>>>    rpi_firmware_property_list+0x204/0x22c
>>> Firmware transaction 0x00028001 timeout
>>> Modules linked in:
>>> CPU: 0 PID: 438 Comm: bash Tainted: G         C         6.9.3-dirty #17
>>> Hardware name: BCM2835
>>> Call trace:
>>> unwind_backtrace from show_stack+0x18/0x1c
>>> show_stack from dump_stack_lvl+0x34/0x44
>>> dump_stack_lvl from __warn+0x88/0xec
>>> __warn from warn_slowpath_fmt+0x7c/0xb0
>>> warn_slowpath_fmt from rpi_firmware_property_list+0x204/0x22c
>>> rpi_firmware_property_list from rpi_firmware_property+0x68/0x8c
>>> rpi_firmware_property from rpi_firmware_set_power+0x54/0xc0
>>> rpi_firmware_set_power from _genpd_power_off+0xe4/0x148
>>> _genpd_power_off from genpd_sync_power_off+0x7c/0x11c
>>> genpd_sync_power_off from genpd_finish_suspend+0xcc/0xe0
>>> genpd_finish_suspend from dpm_run_callback+0x78/0xd0
>>> dpm_run_callback from device_suspend_noirq+0xc0/0x238
>>> device_suspend_noirq from dpm_suspend_noirq+0xb0/0x168
>>> dpm_suspend_noirq from suspend_devices_and_enter+0x1b8/0x5ac
>>> suspend_devices_and_enter from pm_suspend+0x254/0x2e4
>>> pm_suspend from state_store+0xa8/0xd4
>>> state_store from kernfs_fop_write_iter+0x154/0x1a0
>>> kernfs_fop_write_iter from vfs_write+0x12c/0x184
>>> vfs_write from ksys_write+0x78/0xc0
>>> ksys_write from ret_fast_syscall+0x0/0x54
>>> Exception stack(0xcc93dfa8 to 0xcc93dff0)
>>> [...]
>>> PM: noirq suspend of devices complete after 3095.584 msecs
>>>
>>> Link: https://github.com/raspberrypi/firmware/issues/1894
>>> Fixes: 0bae6af6d704 ("mailbox: Enable BCM2835 mailbox support")
>>> Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
>>> Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
>> gentle ping
> This sounds like a fix but also a part of 9 patches update. Do you
> want this merged as a bugfix now or into the next window.
there is no dependency to the rest of the series. Since this is late in
the 6.11 cycle, i'm fine with merging it for the next window.

Thanks
>
> thanks
diff mbox series

Patch

diff --git a/drivers/mailbox/bcm2835-mailbox.c b/drivers/mailbox/bcm2835-mailbox.c
index fbfd0202047c..ea12fb8d2401 100644
--- a/drivers/mailbox/bcm2835-mailbox.c
+++ b/drivers/mailbox/bcm2835-mailbox.c
@@ -145,7 +145,8 @@  static int bcm2835_mbox_probe(struct platform_device *pdev)
 	spin_lock_init(&mbox->lock);

 	ret = devm_request_irq(dev, irq_of_parse_and_map(dev->of_node, 0),
-			       bcm2835_mbox_irq, 0, dev_name(dev), mbox);
+			       bcm2835_mbox_irq, IRQF_NO_SUSPEND, dev_name(dev),
+			       mbox);
 	if (ret) {
 		dev_err(dev, "Failed to register a mailbox IRQ handler: %d\n",
 			ret);