From: Boris Brezillon boris.brezillon@collabora.com
[ Upstream commit 6c4a3fa26799785c1873aacabcfd9b2d27e8dc97 ]
Interrupts are automatically unmasked in panthor_mmu_irq_threaded_handler() when the handler returns. Unmasking prematurely might generate spurious interrupts if the IRQ line is shared.
Changes in v2: - New patch
Changes in v3: - Add R-bs
Reviewed-by: Liviu Dudau liviu.dudau@arm.com Reviewed-by: Steven Price steven.price@arm.com Link: https://lore.kernel.org/r/20250404080933.2912674-6-boris.brezillon@collabora... Signed-off-by: Boris Brezillon boris.brezillon@collabora.com Signed-off-by: Sasha Levin sashal@kernel.org ---
**YES** This commit should be backported to stable kernel trees for the following reasons: ## Analysis of the Bug Fix **Code Change Analysis:** The commit removes a single line from `panthor_mmu_irq_handler()`: ```c - gpu_write(ptdev, MMU_INT_MASK, new_int_mask); ``` This line was prematurely unmasking MMU interrupts within the interrupt handler itself. **Technical Issue:** 1. **Interrupt Handling Architecture**: The panthor driver uses a two-stage interrupt handling approach via the `PANTHOR_IRQ_HANDLER` macro: - **Hardware IRQ handler**: Masks interrupts (`gpu_write(ptdev, MMU_INT_MASK, 0)`) and wakes the threaded handler - **Threaded handler**: Processes interrupts and automatically re-enables them at the end (`gpu_write(ptdev, MMU_INT_MASK, pirq->mask)`) 2. **The Bug**: The `panthor_mmu_irq_handler()` function was prematurely unmasking interrupts in the middle of processing, which could cause: - **Spurious interrupts** if the IRQ line is shared with other devices - **Race conditions** where new interrupts arrive before the handler completes - **Interrupt storms** in edge cases ## Backport Criteria Assessment **✅ Fixes a bug that affects users:** - Could cause spurious interrupts on shared IRQ lines - Potential for interrupt storms affecting system stability **✅ Small and contained fix:** - Single line removal - No architectural changes - Minimal risk of regression **✅ Clear side effects analysis:** - The fix aligns with the designed interrupt handling pattern - No negative side effects expected since automatic re-enabling happens at the proper time **✅ Critical subsystem:** - GPU MMU interrupt handling is critical for memory management - Affects system stability when GPU is in use **✅ Driver maturity:** - Panthor driver was introduced in v6.10 (relatively recent) - This is a bug in the core interrupt handling logic ## Comparison with Historical Commits This fix follows the same pattern as **Similar Commit #1** (drm/panthor: Fix ordering in _irq_suspend()) which was also marked as backport-worthy. Both commits fix interrupt handling ordering issues in the panthor driver. Unlike the panfrost commits (Similar Commits #2-5), which involved more complex architectural changes to interrupt handling, this panthor fix is a simple correction to align with the existing interrupt handling framework. ## Recommendation This commit should be backported because it fixes a clear bug in interrupt handling that could lead to system instability, the fix is minimal and safe, and it corrects the implementation to match the intended design pattern used throughout the panthor driver.
drivers/gpu/drm/panthor/panthor_mmu.c | 1 - 1 file changed, 1 deletion(-)
diff --git a/drivers/gpu/drm/panthor/panthor_mmu.c b/drivers/gpu/drm/panthor/panthor_mmu.c index 1202de8811c2a..68929327c31ca 100644 --- a/drivers/gpu/drm/panthor/panthor_mmu.c +++ b/drivers/gpu/drm/panthor/panthor_mmu.c @@ -1710,7 +1710,6 @@ static void panthor_mmu_irq_handler(struct panthor_device *ptdev, u32 status) * re-enabled. */ ptdev->mmu->irq.mask = new_int_mask; - gpu_write(ptdev, MMU_INT_MASK, new_int_mask);
if (ptdev->mmu->as.slots[as].vm) ptdev->mmu->as.slots[as].vm->unhandled_fault = true;