Skip to content

Commit 35c49cf

Browse files
akacprowjlawryno
authored andcommitted
accel/ivpu/37xx: Fix interrupt_clear_with_0 WA initialization
Using PCI Device ID/Revision to initialize the interrupt_clear_with_0 workaround is problematic - there are many pre-production steppings with different behavior, even with the same PCI ID/Revision Instead of checking for PCI Device ID/Revision, check the VPU buttress interrupt status register behavior - if this register is not zero after writing 1s it means there register is RW instead of RW1C and we need to enable the interrupt_clear_with_0 workaround. Fixes: 7f34e01 ("accel/ivpu: Clear specific interrupt status bits on C0") Signed-off-by: Andrzej Kacprowski <Andrzej.Kacprowski@intel.com> Signed-off-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com> Reviewed-by: Jeffrey Hugo <quic_jhugo@quicinc.com> Link: https://lore.kernel.org/all/20231204122331.40560-1-jacek.lawrynowicz@linux.intel.com
1 parent 6e455f5 commit 35c49cf

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

drivers/accel/ivpu/ivpu_hw_37xx.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,12 @@
5353

5454
#define ICB_0_1_IRQ_MASK ((((u64)ICB_1_IRQ_MASK) << 32) | ICB_0_IRQ_MASK)
5555

56-
#define BUTTRESS_IRQ_MASK ((REG_FLD(VPU_37XX_BUTTRESS_INTERRUPT_STAT, FREQ_CHANGE)) | \
57-
(REG_FLD(VPU_37XX_BUTTRESS_INTERRUPT_STAT, ATS_ERR)) | \
56+
#define BUTTRESS_IRQ_MASK ((REG_FLD(VPU_37XX_BUTTRESS_INTERRUPT_STAT, ATS_ERR)) | \
5857
(REG_FLD(VPU_37XX_BUTTRESS_INTERRUPT_STAT, UFI_ERR)))
5958

59+
#define BUTTRESS_ALL_IRQ_MASK (BUTTRESS_IRQ_MASK | \
60+
(REG_FLD(VPU_37XX_BUTTRESS_INTERRUPT_STAT, FREQ_CHANGE)))
61+
6062
#define BUTTRESS_IRQ_ENABLE_MASK ((u32)~BUTTRESS_IRQ_MASK)
6163
#define BUTTRESS_IRQ_DISABLE_MASK ((u32)-1)
6264

@@ -74,8 +76,12 @@ static void ivpu_hw_wa_init(struct ivpu_device *vdev)
7476
vdev->wa.clear_runtime_mem = false;
7577
vdev->wa.d3hot_after_power_off = true;
7678

77-
if (ivpu_device_id(vdev) == PCI_DEVICE_ID_MTL && ivpu_revision(vdev) < 4)
79+
REGB_WR32(VPU_37XX_BUTTRESS_INTERRUPT_STAT, BUTTRESS_ALL_IRQ_MASK);
80+
if (REGB_RD32(VPU_37XX_BUTTRESS_INTERRUPT_STAT) == BUTTRESS_ALL_IRQ_MASK) {
81+
/* Writing 1s does not clear the interrupt status register */
7882
vdev->wa.interrupt_clear_with_0 = true;
83+
REGB_WR32(VPU_37XX_BUTTRESS_INTERRUPT_STAT, 0x0);
84+
}
7985

8086
IVPU_PRINT_WA(punit_disabled);
8187
IVPU_PRINT_WA(clear_runtime_mem);

0 commit comments

Comments
 (0)