drm/panthor: Fix ordering in _irq_suspend()
authorBoris Brezillon <boris.brezillon@collabora.com>
Tue, 26 Mar 2024 11:12:04 +0000 (12:12 +0100)
committerBoris Brezillon <boris.brezillon@collabora.com>
Tue, 2 Apr 2024 07:33:48 +0000 (09:33 +0200)
commit1de434e0b2757061b09b347264f1ff5bdf996e58
treef2a4c1c8d114cc99b205708b98c4f43eb1f7c68a
parent11f0275cc1b90b4b9bf37a5ebc27c0a9b2451b4e
drm/panthor: Fix ordering in _irq_suspend()

Make sure we set suspended=true last to avoid generating an irq storm
in the unlikely case where an IRQ happens between the suspended=true
assignment and the _INT_MASK update.

We also move the mask=0 assignment before writing to the _INT_MASK
register to prevent the thread handler from unmasking the interrupt
behind our back. This means we might lose events if there were some
pending when we get to suspend the IRQ, but that's fine.
The synchronize_irq() we have in the _irq_suspend() path was not
there to make sure all IRQs are processed, just to make sure we don't
have registers accesses coming from the irq handlers after
_irq_suspend() has been called. If there's a need to have all pending
IRQs processed, it should happen before _irq_suspend() is called.

v3:
- Add Steve's R-b

v2:
- New patch

Fixes: 5fe909cae118 ("drm/panthor: Add the device logical block")
Reported-by: Steven Price <steven.price@arm.com>
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Steven Price <steven.price@arm.com>
Acked-by: Liviu Dudau <liviu.dudau@arm.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240326111205.510019-2-boris.brezillon@collabora.com
drivers/gpu/drm/panthor/panthor_device.h