[PATCH 0/6] drm/vc4: Fix the V3D interrupt state across power transitions

Maíra Canal <[email protected]>
Newsgroups org.freedesktop.lists.dri-devel
Message-ID <[email protected]>
The V3D block is runtime suspended whenever it goes idle, and the driver
does not put its interrupt state back together on the way up: the
out-of-memory interrupt is armed once, when the binner BO is allocated, and
never again. Two more paths reach V3D registers with no runtime PM
reference at all.

Although the patches address distinct problems, they touch the same
functions and share the common goal of making the V3D interrupt handling
survive a power transition.

This applies on top of the V3D reset controller series [1], which drops the
private runtime PM refcount that vc4_reset() used to rely on.

PATCH 1 stops a GPU reset from deadlocking against its own overflow work.
vc4_v3d_get_bin_slot() waits for a render job to retire with no timeout,
and vc4_overflow_mem_work() calls it from a kworker. If the job being
waited on is the one that hung, vc4_reset() never gets past the
cancel_work_sync() in vc4_irq_disable(), and the reset that would have
retired the job never runs. The wait now takes its timeout from the caller,
avoiding the deadlock. This issue was unveiled by masoncl's review scripts.

PATCH 2 takes a runtime PM reference around the binner BO allocation.
bin_bo_alloc() arms the out-of-memory interrupt once it has the BO, and
vc4_create_bo_ioctl() reaches it through vc4_grab_bin_bo() without having
powered the block up, so that write can land on a suspended device.

PATCH 3 removes the IRQ number argument from vc4_irq_install() in favour of
vc4->irq. No functional change, just clean-up.

PATCH 4 rebuilds the interrupt mask on every resume. Nothing re-armed the
out-of-memory interrupt across a runtime suspend: it was armed once when
the binner BO was allocated, masked on the way down, and never brought
back, so an overflow after an autosuspend raised nothing and left the
binner stalled until the hangcheck. Now, vc4_irq_enable() derives that bit
from whether a binner BO exists.

PATCH 5 takes a runtime PM reference in the overflow work itself. The
out-of-memory interrupt only queues the work, so the block can be suspended
before it runs.

PATCH 6 lets runtime PM tear the block down at unbind. vc4_v3d_unbind()
writes V3D registers on a block that has probably autosuspended already,
and everything it does is done by vc4_v3d_bind() and
vc4_v3d_runtime_suspend() anyway, so a runtime suspend replaces it.

Let me know your thoughts.

[1] https://lore.kernel.org/dri-devel/[email protected]/T/

Best regards,
- Maíra

---
Maíra Canal (6):
      drm/vc4: Bound the wait for a binner slot in the overflow work
      drm/vc4: Hold a runtime PM reference while allocating the binner BO
      drm/vc4: Take the IRQ number from vc4_dev in vc4_irq_install()
      drm/vc4: Rebuild the V3D interrupt mask on every power transition
      drm/vc4: Hold a runtime PM reference in the binner overflow work
      drm/vc4: Let runtime PM tear the V3D down at unbind

 drivers/gpu/drm/vc4/vc4_drv.h      |  5 +--
 drivers/gpu/drm/vc4/vc4_irq.c      | 75 ++++++++++++++------------------------
 drivers/gpu/drm/vc4/vc4_v3d.c      | 32 ++++++++--------
 drivers/gpu/drm/vc4/vc4_validate.c |  2 +-
 4 files changed, 45 insertions(+), 69 deletions(-)
---
base-commit: 874ff27dcd2f38508b794763f56653c44ca12d03
change-id: 20260816-vc4-irq-cleanup-8a38d16f5a35
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.