Skip to contentSkip to conversation

accel/ivpu/40xx: Fix buttress interrupt handling

PATCH In review Stanislaw Gruszka 2 participants 2 messages Aug 22, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 accel/ivpu/40xx: Fix buttress interrupt handling

From: Karol Wachowski <[email protected]>

Buttress spec requires that the interrupt status is cleared at the source first (before clearing MTL_BUTTRESS_INTERRUPT_STAT), that implies that we have to mask out the global interrupt while handling buttress interrupts.

Fixes 79cdc56c4a54 ("accel/ivpu: Add initial support for VPU 4")
---
 drivers/accel/ivpu/ivpu_hw_40xx.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/accel/ivpu/ivpu_hw_40xx.c +8 -1
index 34626d66fa10..00c5dbbe6847 100644
@@ -1046,7 +1046,8 @@ static irqreturn_t ivpu_hw_40xx_irqb_handler(struct ivpu_device *vdev, int irq)
 	if (status == 0)
 		return IRQ_NONE;
 
-	REGB_WR32(VPU_40XX_BUTTRESS_INTERRUPT_STAT, status);
+	/* Disable global interrupt before handling local buttress interrupts */
+	REGB_WR32(VPU_40XX_BUTTRESS_GLOBAL_INT_MASK, 0x1);
 
 	if (REG_TEST_FLD(VPU_40XX_BUTTRESS_INTERRUPT_STAT, FREQ_CHANGE, status))
 		ivpu_dbg(vdev, IRQ, "FREQ_CHANGE");
@@ -1092,6 +1093,12 @@ static irqreturn_t ivpu_hw_40xx_irqb_handler(struct ivpu_device *vdev, int irq)
 		schedule_recovery = true;
 	}
 
+	/* This must be done after interrupts are cleared at the source. */
+	REGB_WR32(VPU_40XX_BUTTRESS_INTERRUPT_STAT, status);
+
+	/* Re-enable global interrupt */
+	REGB_WR32(VPU_40XX_BUTTRESS_GLOBAL_INT_MASK, 0x0);
+
 	if (schedule_recovery)
 		ivpu_pm_schedule_recovery(vdev);
 
Signature · 1 line
2.25.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 10 lines · Stanislaw Gruszka

From: Karol Wachowski <[email protected]>

Buttress spec requires that the interrupt status is cleared at the source first (before clearing MTL_BUTTRESS_INTERRUPT_STAT), that implies that we have to mask out the global interrupt while handling buttress interrupts.

Fixes 79cdc56c4a54 ("accel/ivpu: Add initial support for VPU 4")