Skip to content

Commit 1d85a29

Browse files
uma-inteljbloomfi-intel
authored andcommitted
drm/i915: Lower RM timeout to avoid DSI hard hangs
In BXT/APL, device 2 MMIO reads from MIPI controller requires its PLL to be turned ON. When MIPI PLL is turned off (MIPI Display is not active or connected), and someone (host or GT engine) tries to read MIPI registers, it causes hard hang. This is a hardware restriction or limitation. Driver by itself doesn't read MIPI registers when MIPI display is off. But any userspace application can submit unprivileged batch buffer for execution. In that batch buffer there can be mmio reads. And these reads are allowed even for unprivileged applications. If these register reads are for MIPI DSI controller and MIPI display is not active during that time, then the MMIO read operation causes system hard hang and only way to recover is hard reboot. A genuine process/application won't submit batch buffer like this and doesn't cause any issue. But on a compromised system, a malign userspace process/app can generate such batch buffer and can trigger system hard hang (denial of service attack). The fix is to lower the internal MMIO timeout value to an optimum value of 950us as recommended by hardware team. If the timeout is beyond 1ms (which will hit for any value we choose if MMIO READ on a DSI specific register is performed without PLL ON), it causes the system hang. But if the timeout value is lower than it will be below the threshold (even if timeout happens) and system will not get into a hung state. This will avoid a system hang without losing any programming or GT interrupts, taking the worst case of lowest CDCLK frequency and early DC5 abort into account. Signed-off-by: Uma Shankar <[email protected]> Reviewed-by: Jon Bloomfield <[email protected]>
1 parent 926abff commit 1d85a29

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

drivers/gpu/drm/i915/i915_reg.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7215,6 +7215,10 @@ enum {
72157215
#define TGL_DMC_DEBUG_DC5_COUNT _MMIO(0x101084)
72167216
#define TGL_DMC_DEBUG_DC6_COUNT _MMIO(0x101088)
72177217

7218+
/* Display Internal Timeout Register */
7219+
#define RM_TIMEOUT _MMIO(0x42060)
7220+
#define MMIO_TIMEOUT_US(us) ((us) << 0)
7221+
72187222
/* interrupts */
72197223
#define DE_MASTER_IRQ_CONTROL (1 << 31)
72207224
#define DE_SPRITEB_FLIP_DONE (1 << 29)

drivers/gpu/drm/i915/intel_pm.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,14 @@ static void bxt_init_clock_gating(struct drm_i915_private *dev_priv)
126126
*/
127127
I915_WRITE(GEN9_CLKGATE_DIS_0, I915_READ(GEN9_CLKGATE_DIS_0) |
128128
PWM1_GATING_DIS | PWM2_GATING_DIS);
129+
130+
/*
131+
* Lower the display internal timeout.
132+
* This is needed to avoid any hard hangs when DSI port PLL
133+
* is off and a MMIO access is attempted by any privilege
134+
* application, using batch buffers or any other means.
135+
*/
136+
I915_WRITE(RM_TIMEOUT, MMIO_TIMEOUT_US(950));
129137
}
130138

131139
static void glk_init_clock_gating(struct drm_i915_private *dev_priv)

0 commit comments

Comments
 (0)