Skip to content

Commit 81a1c37

Browse files
committed
drm/i915/dsb: Hook up DSB error interrupts
Enable all DSB error/fault interrupts so that we can see if anything goes terribly wrong. v2: Pass intel_display to DISPLAY_VER() (Jani) Drop extra '/' from drm_err() for consistency v3: Reorder the irq handler a bit Cc: Jani Nikula <[email protected]> Signed-off-by: Ville Syrjälä <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected] Reviewed-by: Animesh Manna <[email protected]>
1 parent 33eca84 commit 81a1c37

File tree

4 files changed

+83
-0
lines changed

4 files changed

+83
-0
lines changed

drivers/gpu/drm/i915/display/intel_display_irq.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include "intel_display_trace.h"
1515
#include "intel_display_types.h"
1616
#include "intel_dp_aux.h"
17+
#include "intel_dsb.h"
1718
#include "intel_fdi_regs.h"
1819
#include "intel_fifo_underrun.h"
1920
#include "intel_gmbus.h"
@@ -1164,6 +1165,17 @@ void gen8_de_irq_handler(struct drm_i915_private *dev_priv, u32 master_ctl)
11641165
if (iir & gen8_de_pipe_flip_done_mask(dev_priv))
11651166
flip_done_handler(dev_priv, pipe);
11661167

1168+
if (HAS_DSB(dev_priv)) {
1169+
if (iir & GEN12_DSB_INT(INTEL_DSB_0))
1170+
intel_dsb_irq_handler(&dev_priv->display, pipe, INTEL_DSB_0);
1171+
1172+
if (iir & GEN12_DSB_INT(INTEL_DSB_1))
1173+
intel_dsb_irq_handler(&dev_priv->display, pipe, INTEL_DSB_1);
1174+
1175+
if (iir & GEN12_DSB_INT(INTEL_DSB_2))
1176+
intel_dsb_irq_handler(&dev_priv->display, pipe, INTEL_DSB_2);
1177+
}
1178+
11671179
if (iir & GEN8_PIPE_CDCLK_CRC_DONE)
11681180
hsw_pipe_crc_irq_handler(dev_priv, pipe);
11691181

@@ -1736,6 +1748,11 @@ void gen8_de_irq_postinstall(struct drm_i915_private *dev_priv)
17361748
de_port_masked |= DSI0_TE | DSI1_TE;
17371749
}
17381750

1751+
if (HAS_DSB(dev_priv))
1752+
de_pipe_masked |= GEN12_DSB_INT(INTEL_DSB_0) |
1753+
GEN12_DSB_INT(INTEL_DSB_1) |
1754+
GEN12_DSB_INT(INTEL_DSB_2);
1755+
17391756
de_pipe_enables = de_pipe_masked |
17401757
GEN8_PIPE_VBLANK |
17411758
gen8_de_pipe_underrun_mask(dev_priv) |

drivers/gpu/drm/i915/display/intel_dsb.c

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,40 @@ static u32 dsb_chicken(struct intel_crtc *crtc)
339339
return DSB_SKIP_WAITS_EN;
340340
}
341341

342+
static u32 dsb_error_int_status(struct intel_display *display)
343+
{
344+
u32 errors;
345+
346+
errors = DSB_GTT_FAULT_INT_STATUS |
347+
DSB_RSPTIMEOUT_INT_STATUS |
348+
DSB_POLL_ERR_INT_STATUS;
349+
350+
/*
351+
* All the non-existing status bits operate as
352+
* normal r/w bits, so any attempt to clear them
353+
* will just end up setting them. Never do that so
354+
* we won't mistake them for actual error interrupts.
355+
*/
356+
if (DISPLAY_VER(display) >= 14)
357+
errors |= DSB_ATS_FAULT_INT_STATUS;
358+
359+
return errors;
360+
}
361+
362+
static u32 dsb_error_int_en(struct intel_display *display)
363+
{
364+
u32 errors;
365+
366+
errors = DSB_GTT_FAULT_INT_EN |
367+
DSB_RSPTIMEOUT_INT_EN |
368+
DSB_POLL_ERR_INT_EN;
369+
370+
if (DISPLAY_VER(display) >= 14)
371+
errors |= DSB_ATS_FAULT_INT_EN;
372+
373+
return errors;
374+
}
375+
342376
static void _intel_dsb_commit(struct intel_dsb *dsb, u32 ctrl,
343377
int dewake_scanline)
344378
{
@@ -363,6 +397,10 @@ static void _intel_dsb_commit(struct intel_dsb *dsb, u32 ctrl,
363397
intel_de_write_fw(display, DSB_CHICKEN(pipe, dsb->id),
364398
dsb_chicken(crtc));
365399

400+
intel_de_write_fw(display, DSB_INTERRUPT(pipe, dsb->id),
401+
dsb_error_int_status(display) | DSB_PROG_INT_STATUS |
402+
dsb_error_int_en(display));
403+
366404
intel_de_write_fw(display, DSB_HEAD(pipe, dsb->id),
367405
intel_dsb_buffer_ggtt_offset(&dsb->dsb_buf));
368406

@@ -430,6 +468,9 @@ void intel_dsb_wait(struct intel_dsb *dsb)
430468
dsb->free_pos = 0;
431469
dsb->ins_start_offset = 0;
432470
intel_de_write_fw(display, DSB_CTRL(pipe, dsb->id), 0);
471+
472+
intel_de_write_fw(display, DSB_INTERRUPT(pipe, dsb->id),
473+
dsb_error_int_status(display) | DSB_PROG_INT_STATUS);
433474
}
434475

435476
/**
@@ -513,3 +554,18 @@ void intel_dsb_cleanup(struct intel_dsb *dsb)
513554
intel_dsb_buffer_cleanup(&dsb->dsb_buf);
514555
kfree(dsb);
515556
}
557+
558+
void intel_dsb_irq_handler(struct intel_display *display,
559+
enum pipe pipe, enum intel_dsb_id dsb_id)
560+
{
561+
struct intel_crtc *crtc = intel_crtc_for_pipe(to_i915(display->drm), pipe);
562+
u32 tmp, errors;
563+
564+
tmp = intel_de_read_fw(display, DSB_INTERRUPT(pipe, dsb_id));
565+
intel_de_write_fw(display, DSB_INTERRUPT(pipe, dsb_id), tmp);
566+
567+
errors = tmp & dsb_error_int_status(display);
568+
if (errors)
569+
drm_err(display->drm, "[CRTC:%d:%s] DSB %d error interrupt: 0x%x\n",
570+
crtc->base.base.id, crtc->base.name, dsb_id, errors);
571+
}

drivers/gpu/drm/i915/display/intel_dsb.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,11 @@
1313
struct intel_atomic_state;
1414
struct intel_crtc;
1515
struct intel_crtc_state;
16+
struct intel_display;
1617
struct intel_dsb;
1718

19+
enum pipe;
20+
1821
enum intel_dsb_id {
1922
INTEL_DSB_0,
2023
INTEL_DSB_1,
@@ -41,4 +44,7 @@ void intel_dsb_commit(struct intel_dsb *dsb,
4144
bool wait_for_vblank);
4245
void intel_dsb_wait(struct intel_dsb *dsb);
4346

47+
void intel_dsb_irq_handler(struct intel_display *display,
48+
enum pipe pipe, enum intel_dsb_id dsb_id);
49+
4450
#endif

drivers/gpu/drm/i915/i915_reg.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2516,6 +2516,10 @@
25162516
#define GEN11_PIPE_PLANE7_FLIP_DONE REG_BIT(18) /* icl/tgl */
25172517
#define GEN11_PIPE_PLANE6_FLIP_DONE REG_BIT(17) /* icl/tgl */
25182518
#define GEN11_PIPE_PLANE5_FLIP_DONE REG_BIT(16) /* icl+ */
2519+
#define GEN12_DSB_2_INT REG_BIT(15) /* tgl+ */
2520+
#define GEN12_DSB_1_INT REG_BIT(14) /* tgl+ */
2521+
#define GEN12_DSB_0_INT REG_BIT(13) /* tgl+ */
2522+
#define GEN12_DSB_INT(dsb_id) REG_BIT(13 + (dsb_id))
25192523
#define GEN9_PIPE_CURSOR_FAULT REG_BIT(11) /* skl+ */
25202524
#define GEN9_PIPE_PLANE4_FAULT REG_BIT(10) /* skl+ */
25212525
#define GEN8_PIPE_CURSOR_FAULT REG_BIT(10) /* bdw */

0 commit comments

Comments
 (0)