From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796381493; b=yv+Y94FMaICt0x3y5FGikIMOsspKf+V//23AReqjF3h9C7zwTERAT2eavUiDlujI1tWk WsVwPpmz365Orw+om2G/RICzJjNlRNW3hpMcVfbGyeo8dclvtTd62kxKrXMF0H4C0A9XO FaRRMBu8Rlc6NIHQqUCc78pwJ9MISEf7R/Q03xHiEAOOIYjBXOuX2ma2ITRj8pXNEPW0t sTrVZLw7Vv6Lj7XFzuWBwgQ1Q3BTuh3GXDzgwBbvcLYXPc9mikzyPb6fY3VEz8VQwllrw aFuGgqeHeNwe+tyez8dxK/QHLOCacW+48GeCDR1NLbliIpTnJNe3dyUG+ozSf5YbIRQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796381493; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Type:Content-Transfer-Encoding; bh=lvRuPMRdFeqvqXkAtOzQThg+CDUcdzRqJJwqTK5VOpM=; b=UYKe7Kbk+B6JK2Ju7vfaAC1B8teY29STAFaNXV5/PSVt5IRJSNecmKGmUIcrsG6/qVg5 ymbEYsD9HEIiUkiusQzAjAAJylLutNGuofobbz0qXJZ4N7TZMqXdu6oWsoM/E4hYlZZr6 Jt1OS6BRKWm77E937AgbOUtSlt1ODnnRm9JyJam95wyvRxOmZcCOdfo9ufggsch0qPxjR uUhQ3eIlMCbxYA5LzHB7Ji7SIvi8E12qzqxfirbAcxMVk68Z03JjfQtnBSbQ7szQI/lc/ /9VBucMDFyp1xFKL8nE/2QBjsq2/SXFxySpDp2R+kih6dfRrapPQOgioSEX3rjqFGbw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=dvIFHmaT; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1B659606A32D; Fri, 4 Dec 2026 10:51:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=dvIFHmaT Received: by smtp.kernel.org (Postfix) with ESMTPSA id 88A471F00897; Fri, 4 Dec 2026 10:51:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796381493; bh=lvRuPMRdFeqvqXkAtOzQThg+CDUcdzRqJJwqTK5VOpM=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=dvIFHmaTo3GXFU47PPLSVxz+8mrwaQMNwpdvj6Ikh7bQvHuWQe/891p/jN8bTBcHc 9Nq52bOXiiMqYBNL5RsBrMCJL8u5yoey/tEq2Rx/9fWgyGMUmP0A49w6d1/KEBgh0I jOZgEE7wjiDn21Cz2FrRAKwhp/H9tUhSEW1jNCKU= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Iago Toral Quiroga , =?UTF-8?q?Ma=C3=ADra=20Canal?= , Sasha Levin Subject: [PATCH 7.3 728/742] drm/vc4: Rebuild the V3D interrupt mask on every power transition Date: Fri, 4 Dec 2026 19:09:52 +0900 Message-ID: <20261204100654.422380946@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100635.034361255@linuxfoundation.org> References: <20261204100635.034361255@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 7.3-stable review patch. If anyone has any objections, please let me know. ------------------ From: Maíra Canal [ 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 Link: https://patch.msgid.link/20261111-vc4-irq-cleanup-v2-2-aa757bb742f2@igalia.com Signed-off-by: Maíra Canal [ sashal: Adjusted context for a differently worded comment above the V3D_INTENA write in vc4_irq_reset(); the resulting code is identical to upstream. ] Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/vc4/vc4_irq.c | 41 +++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-) --- a/drivers/gpu/drm/vc4/vc4_irq.c +++ b/drivers/gpu/drm/vc4/vc4_irq.c @@ -53,10 +53,6 @@ #include "vc4_regs.h" #include "vc4_trace.h" -#define V3D_DRIVER_IRQS (V3D_INT_OUTOMEM | \ - V3D_INT_FLDONE | \ - V3D_INT_FRDONE) - static void vc4_overflow_mem_work(struct work_struct *work) { @@ -249,6 +245,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; @@ -256,10 +253,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 @@ -274,14 +279,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. */ disable_irq(vc4->irq); + /* Clear any pending interrupts we might have left. */ + V3D_WRITE(V3D_INTCTL, ~0); + cancel_work_sync(&vc4->overflow_mem_work); } @@ -324,16 +329,12 @@ void vc4_irq_reset(struct drm_device *de 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);