Skip to content

Commit 0677170

Browse files
committed
Merge tag 'drm-intel-fixes-2021-03-18' of git://anongit.freedesktop.org/drm/drm-intel into drm-fixes
drm/i915 fixes for v5.12-rc4: - Workaround async flip + VT-d frame corruption on HSW/BDW - Fix NMI watchdog crash due to uninitialized OA buffer use on gen12+ Signed-off-by: Dave Airlie <[email protected]> From: Jani Nikula <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
2 parents a97fdab + 6a77c6b commit 0677170

File tree

3 files changed

+42
-10
lines changed

3 files changed

+42
-10
lines changed

drivers/gpu/drm/i915/i915_perf.c

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,6 @@ static int append_oa_sample(struct i915_perf_stream *stream,
603603
{
604604
int report_size = stream->oa_buffer.format_size;
605605
struct drm_i915_perf_record_header header;
606-
u32 sample_flags = stream->sample_flags;
607606

608607
header.type = DRM_I915_PERF_RECORD_SAMPLE;
609608
header.pad = 0;
@@ -617,10 +616,8 @@ static int append_oa_sample(struct i915_perf_stream *stream,
617616
return -EFAULT;
618617
buf += sizeof(header);
619618

620-
if (sample_flags & SAMPLE_OA_REPORT) {
621-
if (copy_to_user(buf, report, report_size))
622-
return -EFAULT;
623-
}
619+
if (copy_to_user(buf, report, report_size))
620+
return -EFAULT;
624621

625622
(*offset) += header.size;
626623

@@ -2682,7 +2679,7 @@ static void i915_oa_stream_enable(struct i915_perf_stream *stream)
26822679

26832680
stream->perf->ops.oa_enable(stream);
26842681

2685-
if (stream->periodic)
2682+
if (stream->sample_flags & SAMPLE_OA_REPORT)
26862683
hrtimer_start(&stream->poll_check_timer,
26872684
ns_to_ktime(stream->poll_oa_period),
26882685
HRTIMER_MODE_REL_PINNED);
@@ -2745,7 +2742,7 @@ static void i915_oa_stream_disable(struct i915_perf_stream *stream)
27452742
{
27462743
stream->perf->ops.oa_disable(stream);
27472744

2748-
if (stream->periodic)
2745+
if (stream->sample_flags & SAMPLE_OA_REPORT)
27492746
hrtimer_cancel(&stream->poll_check_timer);
27502747
}
27512748

@@ -3028,7 +3025,7 @@ static ssize_t i915_perf_read(struct file *file,
30283025
* disabled stream as an error. In particular it might otherwise lead
30293026
* to a deadlock for blocking file descriptors...
30303027
*/
3031-
if (!stream->enabled)
3028+
if (!stream->enabled || !(stream->sample_flags & SAMPLE_OA_REPORT))
30323029
return -EIO;
30333030

30343031
if (!(file->f_flags & O_NONBLOCK)) {

drivers/gpu/drm/i915/i915_reg.h

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3316,7 +3316,18 @@ static inline bool i915_mmio_reg_valid(i915_reg_t reg)
33163316

33173317
#define ILK_DISPLAY_CHICKEN1 _MMIO(0x42000)
33183318
#define ILK_FBCQ_DIS (1 << 22)
3319-
#define ILK_PABSTRETCH_DIS (1 << 21)
3319+
#define ILK_PABSTRETCH_DIS REG_BIT(21)
3320+
#define ILK_SABSTRETCH_DIS REG_BIT(20)
3321+
#define IVB_PRI_STRETCH_MAX_MASK REG_GENMASK(21, 20)
3322+
#define IVB_PRI_STRETCH_MAX_X8 REG_FIELD_PREP(IVB_PRI_STRETCH_MAX_MASK, 0)
3323+
#define IVB_PRI_STRETCH_MAX_X4 REG_FIELD_PREP(IVB_PRI_STRETCH_MAX_MASK, 1)
3324+
#define IVB_PRI_STRETCH_MAX_X2 REG_FIELD_PREP(IVB_PRI_STRETCH_MAX_MASK, 2)
3325+
#define IVB_PRI_STRETCH_MAX_X1 REG_FIELD_PREP(IVB_PRI_STRETCH_MAX_MASK, 3)
3326+
#define IVB_SPR_STRETCH_MAX_MASK REG_GENMASK(19, 18)
3327+
#define IVB_SPR_STRETCH_MAX_X8 REG_FIELD_PREP(IVB_SPR_STRETCH_MAX_MASK, 0)
3328+
#define IVB_SPR_STRETCH_MAX_X4 REG_FIELD_PREP(IVB_SPR_STRETCH_MAX_MASK, 1)
3329+
#define IVB_SPR_STRETCH_MAX_X2 REG_FIELD_PREP(IVB_SPR_STRETCH_MAX_MASK, 2)
3330+
#define IVB_SPR_STRETCH_MAX_X1 REG_FIELD_PREP(IVB_SPR_STRETCH_MAX_MASK, 3)
33203331

33213332

33223333
/*
@@ -8039,6 +8050,16 @@ enum {
80398050

80408051
#define _CHICKEN_PIPESL_1_A 0x420b0
80418052
#define _CHICKEN_PIPESL_1_B 0x420b4
8053+
#define HSW_PRI_STRETCH_MAX_MASK REG_GENMASK(28, 27)
8054+
#define HSW_PRI_STRETCH_MAX_X8 REG_FIELD_PREP(HSW_PRI_STRETCH_MAX_MASK, 0)
8055+
#define HSW_PRI_STRETCH_MAX_X4 REG_FIELD_PREP(HSW_PRI_STRETCH_MAX_MASK, 1)
8056+
#define HSW_PRI_STRETCH_MAX_X2 REG_FIELD_PREP(HSW_PRI_STRETCH_MAX_MASK, 2)
8057+
#define HSW_PRI_STRETCH_MAX_X1 REG_FIELD_PREP(HSW_PRI_STRETCH_MAX_MASK, 3)
8058+
#define HSW_SPR_STRETCH_MAX_MASK REG_GENMASK(26, 25)
8059+
#define HSW_SPR_STRETCH_MAX_X8 REG_FIELD_PREP(HSW_SPR_STRETCH_MAX_MASK, 0)
8060+
#define HSW_SPR_STRETCH_MAX_X4 REG_FIELD_PREP(HSW_SPR_STRETCH_MAX_MASK, 1)
8061+
#define HSW_SPR_STRETCH_MAX_X2 REG_FIELD_PREP(HSW_SPR_STRETCH_MAX_MASK, 2)
8062+
#define HSW_SPR_STRETCH_MAX_X1 REG_FIELD_PREP(HSW_SPR_STRETCH_MAX_MASK, 3)
80428063
#define HSW_FBCQ_DIS (1 << 22)
80438064
#define BDW_DPRS_MASK_VBLANK_SRD (1 << 0)
80448065
#define CHICKEN_PIPESL_1(pipe) _MMIO_PIPE(pipe, _CHICKEN_PIPESL_1_A, _CHICKEN_PIPESL_1_B)

drivers/gpu/drm/i915/intel_pm.c

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7245,11 +7245,16 @@ static void bdw_init_clock_gating(struct drm_i915_private *dev_priv)
72457245
intel_uncore_write(&dev_priv->uncore, CHICKEN_PAR1_1,
72467246
intel_uncore_read(&dev_priv->uncore, CHICKEN_PAR1_1) | DPA_MASK_VBLANK_SRD);
72477247

7248-
/* WaPsrDPRSUnmaskVBlankInSRD:bdw */
72497248
for_each_pipe(dev_priv, pipe) {
7249+
/* WaPsrDPRSUnmaskVBlankInSRD:bdw */
72507250
intel_uncore_write(&dev_priv->uncore, CHICKEN_PIPESL_1(pipe),
72517251
intel_uncore_read(&dev_priv->uncore, CHICKEN_PIPESL_1(pipe)) |
72527252
BDW_DPRS_MASK_VBLANK_SRD);
7253+
7254+
/* Undocumented but fixes async flip + VT-d corruption */
7255+
if (intel_vtd_active())
7256+
intel_uncore_rmw(&dev_priv->uncore, CHICKEN_PIPESL_1(pipe),
7257+
HSW_PRI_STRETCH_MAX_MASK, HSW_PRI_STRETCH_MAX_X1);
72537258
}
72547259

72557260
/* WaVSRefCountFullforceMissDisable:bdw */
@@ -7285,11 +7290,20 @@ static void bdw_init_clock_gating(struct drm_i915_private *dev_priv)
72857290

72867291
static void hsw_init_clock_gating(struct drm_i915_private *dev_priv)
72877292
{
7293+
enum pipe pipe;
7294+
72887295
/* WaFbcAsynchFlipDisableFbcQueue:hsw,bdw */
72897296
intel_uncore_write(&dev_priv->uncore, CHICKEN_PIPESL_1(PIPE_A),
72907297
intel_uncore_read(&dev_priv->uncore, CHICKEN_PIPESL_1(PIPE_A)) |
72917298
HSW_FBCQ_DIS);
72927299

7300+
for_each_pipe(dev_priv, pipe) {
7301+
/* Undocumented but fixes async flip + VT-d corruption */
7302+
if (intel_vtd_active())
7303+
intel_uncore_rmw(&dev_priv->uncore, CHICKEN_PIPESL_1(pipe),
7304+
HSW_PRI_STRETCH_MAX_MASK, HSW_PRI_STRETCH_MAX_X1);
7305+
}
7306+
72937307
/* This is required by WaCatErrorRejectionIssue:hsw */
72947308
intel_uncore_write(&dev_priv->uncore, GEN7_SQ_CHICKEN_MBCUNIT_CONFIG,
72957309
intel_uncore_read(&dev_priv->uncore, GEN7_SQ_CHICKEN_MBCUNIT_CONFIG) |

0 commit comments

Comments
 (0)