From: Sasha Levin <sashal@kernel.org>
To: stable@vger.kernel.org
Cc: "Maíra Canal" <mcanal@igalia.com>,
"Iago Toral Quiroga" <itoral@igalia.com>,
"Sasha Levin" <sashal@kernel.org>
Subject: [PATCH 6.18.y] drm/vc4: Rebuild the V3D interrupt mask on every power transition
Date: Thu, 3 Dec 2026 20:55:10 -0500 [thread overview]
Message-ID: <20261204015428.1740041-1-sashal@kernel.org> (raw)
In-Reply-To: <2026120220-radish-stir-e585@gregkh>
From: Maíra Canal <mcanal@igalia.com>
[ Upstream commit 83dd19480c105c8bf96c93fb18b2ea554b44445d ]
The out-of-memory interrupt is armed once, by bin_bo_alloc(), when the
binner BO is allocated. vc4_irq_disable() masks it on the way down,
vc4_irq_enable() brings back only the render bits, and bin_bo_alloc() does
not run again for a binner BO that is still referenced. An overflow after
an autosuspend therefore raises nothing and the binner stalls, until the
hangcheck resets the GPU and arms the interrupt again.
Therefore, derive the out-of-memory bit in vc4_irq_enable() from whether a
binner BO exists, which is the condition bin_bo_alloc() was standing in
for.
While here, clear the complement of the wanted mask while enabling.
V3D_INTENA and V3D_INTDIS are set/clear registers and the driver only ever
set bits, so a source left enabled will stay enabled and can reach
vc4_irq(), which returns IRQ_NONE for anything outside the three bits it
handles.
Cc: stable@vger.kernel.org
Fixes: 35c8b4b2c0fe ("drm/vc4: Allocate binner bo when starting to use the V3D")
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Link: https://patch.msgid.link/20261111-vc4-irq-cleanup-v2-2-aa757bb742f2@igalia.com
Signed-off-by: Maíra Canal <mcanal@igalia.com>
[ sashal: Kept the existing V3D_DRIVER_IRQS define (upstream removes it) because vc4_irq_prepare() still uses it here, and context lines differ slightly due to older surrounding code. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/gpu/drm/vc4/vc4_irq.c | 37 ++++++++++++++++++++---------------
1 file changed, 21 insertions(+), 16 deletions(-)
diff --git a/drivers/gpu/drm/vc4/vc4_irq.c b/drivers/gpu/drm/vc4/vc4_irq.c
index 7d783441ffe26..ac897393aab9f 100644
--- a/drivers/gpu/drm/vc4/vc4_irq.c
+++ b/drivers/gpu/drm/vc4/vc4_irq.c
@@ -266,6 +266,7 @@ void
vc4_irq_enable(struct drm_device *dev)
{
struct vc4_dev *vc4 = to_vc4_dev(dev);
+ u32 mask = V3D_INT_FLDONE | V3D_INT_FRDONE;
if (WARN_ON_ONCE(vc4->gen > VC4_GEN_4))
return;
@@ -273,10 +274,18 @@ vc4_irq_enable(struct drm_device *dev)
if (!vc4->v3d)
return;
- /* Enable the render done interrupts. The out-of-memory interrupt is
- * enabled as soon as we have a binner BO allocated.
+ /* Arming the OOM interrupt before there is a binner BO would raise an
+ * interrupt nothing can clear.
*/
- V3D_WRITE(V3D_INTENA, V3D_INT_FLDONE | V3D_INT_FRDONE);
+ if (vc4->bin_bo)
+ mask |= V3D_INT_OUTOMEM;
+
+ /* Clear any pending interrupts someone might have left around for us. */
+ V3D_WRITE(V3D_INTCTL, mask);
+
+ /* Enable our set of interrupts, masking out any others. */
+ V3D_WRITE(V3D_INTDIS, ~mask);
+ V3D_WRITE(V3D_INTENA, mask);
}
void
@@ -291,14 +300,14 @@ vc4_irq_disable(struct drm_device *dev)
return;
/* Disable sending interrupts for our driver's IRQs. */
- V3D_WRITE(V3D_INTDIS, V3D_DRIVER_IRQS);
-
- /* Clear any pending interrupts we might have left. */
- V3D_WRITE(V3D_INTCTL, V3D_DRIVER_IRQS);
+ V3D_WRITE(V3D_INTDIS, ~0);
/* Finish any interrupt handler still in flight. */
synchronize_irq(vc4->irq);
+ /* Clear any pending interrupts we might have left. */
+ V3D_WRITE(V3D_INTCTL, ~0);
+
cancel_work_sync(&vc4->overflow_mem_work);
}
@@ -344,16 +353,12 @@ void vc4_irq_reset(struct drm_device *dev)
if (WARN_ON_ONCE(vc4->gen > VC4_GEN_4))
return;
- /* Acknowledge any stale IRQs. */
- V3D_WRITE(V3D_INTCTL, V3D_DRIVER_IRQS);
-
- /*
- * Turn all our interrupts on. Binner out of memory is the
- * only one we expect to trigger at this point, since we've
- * just come from poweron and haven't supplied any overflow
- * memory yet.
+ /* bin_bo_alloc() may arm OUTOMEM between the bin_bo check and the
+ * INTDIS write in vc4_irq_enable(), which would then mask it again.
*/
- V3D_WRITE(V3D_INTENA, V3D_DRIVER_IRQS);
+ scoped_guard(mutex, &vc4->bin_bo_lock) {
+ vc4_irq_enable(dev);
+ }
spin_lock_irqsave(&vc4->job_lock, irqflags);
vc4_cancel_bin_job(dev);
--
2.53.0
prev parent reply other threads:[~2026-12-04 1:55 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-02 12:49 FAILED: patch "[PATCH] drm/vc4: Rebuild the V3D interrupt mask on every power" failed to apply to 6.18-stable tree gregkh
2026-12-04 1:55 ` Sasha Levin [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261204015428.1740041-1-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=itoral@igalia.com \
--cc=mcanal@igalia.com \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox