Skip to content

Commit 8a02ea4

Browse files
committed
Merge tag 'drm-intel-next-fixes-2021-06-29' of git://anongit.freedesktop.org/drm/drm-intel into drm-next
The biggest fix is the restoration of mmap ioctl for gen12 integrated parts which lack was breaking ADL-P with media stack. Besides that a small selftest fix and a theoretical overflow on i915->pipe_to_crtc_mapping. Signed-off-by: Dave Airlie <[email protected]> From: Rodrigo Vivi <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
2 parents 4bac159 + c90c4c6 commit 8a02ea4

File tree

6 files changed

+76
-42
lines changed

6 files changed

+76
-42
lines changed

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9618,7 +9618,6 @@ static int intel_atomic_check_bigjoiner(struct intel_atomic_state *state,
96189618
struct intel_crtc_state *old_crtc_state,
96199619
struct intel_crtc_state *new_crtc_state)
96209620
{
9621-
struct drm_i915_private *dev_priv = to_i915(state->base.dev);
96229621
struct intel_crtc_state *slave_crtc_state, *master_crtc_state;
96239622
struct intel_crtc *slave, *master;
96249623

@@ -9634,15 +9633,15 @@ static int intel_atomic_check_bigjoiner(struct intel_atomic_state *state,
96349633
if (!new_crtc_state->bigjoiner)
96359634
return 0;
96369635

9637-
if (1 + crtc->pipe >= INTEL_NUM_PIPES(dev_priv)) {
9636+
slave = intel_dsc_get_bigjoiner_secondary(crtc);
9637+
if (!slave) {
96389638
DRM_DEBUG_KMS("[CRTC:%d:%s] Big joiner configuration requires "
96399639
"CRTC + 1 to be used, doesn't exist\n",
96409640
crtc->base.base.id, crtc->base.name);
96419641
return -EINVAL;
96429642
}
96439643

9644-
slave = new_crtc_state->bigjoiner_linked_crtc =
9645-
intel_get_crtc_for_pipe(dev_priv, crtc->pipe + 1);
9644+
new_crtc_state->bigjoiner_linked_crtc = slave;
96469645
slave_crtc_state = intel_atomic_get_crtc_state(&state->base, slave);
96479646
master = crtc;
96489647
if (IS_ERR(slave_crtc_state))

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1723,6 +1723,14 @@ vlv_pipe_to_channel(enum pipe pipe)
17231723
}
17241724
}
17251725

1726+
static inline bool intel_pipe_valid(struct drm_i915_private *i915, enum pipe pipe)
1727+
{
1728+
return (pipe >= 0 &&
1729+
pipe < ARRAY_SIZE(i915->pipe_to_crtc_mapping) &&
1730+
INTEL_INFO(i915)->pipe_mask & BIT(pipe) &&
1731+
i915->pipe_to_crtc_mapping[pipe]);
1732+
}
1733+
17261734
static inline struct intel_crtc *
17271735
intel_get_first_crtc(struct drm_i915_private *dev_priv)
17281736
{

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

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1106,6 +1106,27 @@ static i915_reg_t dss_ctl2_reg(const struct intel_crtc_state *crtc_state)
11061106
return is_pipe_dsc(crtc_state) ? ICL_PIPE_DSS_CTL2(pipe) : DSS_CTL2;
11071107
}
11081108

1109+
static struct intel_crtc *
1110+
_get_crtc_for_pipe(struct drm_i915_private *i915, enum pipe pipe)
1111+
{
1112+
if (!intel_pipe_valid(i915, pipe))
1113+
return NULL;
1114+
1115+
return intel_get_crtc_for_pipe(i915, pipe);
1116+
}
1117+
1118+
struct intel_crtc *
1119+
intel_dsc_get_bigjoiner_secondary(const struct intel_crtc *primary_crtc)
1120+
{
1121+
return _get_crtc_for_pipe(to_i915(primary_crtc->base.dev), primary_crtc->pipe + 1);
1122+
}
1123+
1124+
static struct intel_crtc *
1125+
intel_dsc_get_bigjoiner_primary(const struct intel_crtc *secondary_crtc)
1126+
{
1127+
return _get_crtc_for_pipe(to_i915(secondary_crtc->base.dev), secondary_crtc->pipe - 1);
1128+
}
1129+
11091130
void intel_uncompressed_joiner_enable(const struct intel_crtc_state *crtc_state)
11101131
{
11111132
struct intel_crtc *crtc = to_intel_crtc(crtc_state->uapi.crtc);
@@ -1178,15 +1199,13 @@ void intel_uncompressed_joiner_get_config(struct intel_crtc_state *crtc_state)
11781199
dss_ctl1 = intel_de_read(dev_priv, dss_ctl1_reg(crtc_state));
11791200
if (dss_ctl1 & UNCOMPRESSED_JOINER_MASTER) {
11801201
crtc_state->bigjoiner = true;
1181-
if (!WARN_ON(INTEL_NUM_PIPES(dev_priv) == crtc->pipe + 1))
1182-
crtc_state->bigjoiner_linked_crtc =
1183-
intel_get_crtc_for_pipe(dev_priv, crtc->pipe + 1);
1202+
crtc_state->bigjoiner_linked_crtc = intel_dsc_get_bigjoiner_secondary(crtc);
1203+
drm_WARN_ON(&dev_priv->drm, !crtc_state->bigjoiner_linked_crtc);
11841204
} else if (dss_ctl1 & UNCOMPRESSED_JOINER_SLAVE) {
11851205
crtc_state->bigjoiner = true;
11861206
crtc_state->bigjoiner_slave = true;
1187-
if (!WARN_ON(crtc->pipe == PIPE_A))
1188-
crtc_state->bigjoiner_linked_crtc =
1189-
intel_get_crtc_for_pipe(dev_priv, crtc->pipe - 1);
1207+
crtc_state->bigjoiner_linked_crtc = intel_dsc_get_bigjoiner_primary(crtc);
1208+
drm_WARN_ON(&dev_priv->drm, !crtc_state->bigjoiner_linked_crtc);
11901209
}
11911210
}
11921211

@@ -1224,14 +1243,11 @@ void intel_dsc_get_config(struct intel_crtc_state *crtc_state)
12241243

12251244
if (!(dss_ctl1 & MASTER_BIG_JOINER_ENABLE)) {
12261245
crtc_state->bigjoiner_slave = true;
1227-
if (!WARN_ON(crtc->pipe == PIPE_A))
1228-
crtc_state->bigjoiner_linked_crtc =
1229-
intel_get_crtc_for_pipe(dev_priv, crtc->pipe - 1);
1246+
crtc_state->bigjoiner_linked_crtc = intel_dsc_get_bigjoiner_primary(crtc);
12301247
} else {
1231-
if (!WARN_ON(INTEL_NUM_PIPES(dev_priv) == crtc->pipe + 1))
1232-
crtc_state->bigjoiner_linked_crtc =
1233-
intel_get_crtc_for_pipe(dev_priv, crtc->pipe + 1);
1248+
crtc_state->bigjoiner_linked_crtc = intel_dsc_get_bigjoiner_secondary(crtc);
12341249
}
1250+
drm_WARN_ON(&dev_priv->drm, !crtc_state->bigjoiner_linked_crtc);
12351251
}
12361252

12371253
/* FIXME: add more state readout as needed */

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,6 @@ void intel_uncompressed_joiner_get_config(struct intel_crtc_state *crtc_state);
2222
void intel_dsc_get_config(struct intel_crtc_state *crtc_state);
2323
enum intel_display_power_domain
2424
intel_dsc_power_domain(const struct intel_crtc_state *crtc_state);
25+
struct intel_crtc *intel_dsc_get_bigjoiner_secondary(const struct intel_crtc *primary_crtc);
2526

2627
#endif /* __INTEL_VDSC_H__ */

drivers/gpu/drm/i915/gem/i915_gem_mman.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,11 @@ i915_gem_mmap_ioctl(struct drm_device *dev, void *data,
6161
struct drm_i915_gem_object *obj;
6262
unsigned long addr;
6363

64-
/* mmap ioctl is disallowed for all platforms after TGL-LP. This also
65-
* covers all platforms with local memory.
64+
/*
65+
* mmap ioctl is disallowed for all discrete platforms,
66+
* and for all platforms with GRAPHICS_VER > 12.
6667
*/
67-
if (GRAPHICS_VER(i915) >= 12 && !IS_TIGERLAKE(i915))
68+
if (IS_DGFX(i915) || GRAPHICS_VER(i915) > 12)
6869
return -EOPNOTSUPP;
6970

7071
if (args->flags & ~(I915_MMAP_WC))

drivers/gpu/drm/i915/gt/selftest_execlists.c

Lines changed: 32 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -551,6 +551,32 @@ static int live_pin_rewind(void *arg)
551551
return err;
552552
}
553553

554+
static int engine_lock_reset_tasklet(struct intel_engine_cs *engine)
555+
{
556+
tasklet_disable(&engine->execlists.tasklet);
557+
local_bh_disable();
558+
559+
if (test_and_set_bit(I915_RESET_ENGINE + engine->id,
560+
&engine->gt->reset.flags)) {
561+
local_bh_enable();
562+
tasklet_enable(&engine->execlists.tasklet);
563+
564+
intel_gt_set_wedged(engine->gt);
565+
return -EBUSY;
566+
}
567+
568+
return 0;
569+
}
570+
571+
static void engine_unlock_reset_tasklet(struct intel_engine_cs *engine)
572+
{
573+
clear_and_wake_up_bit(I915_RESET_ENGINE + engine->id,
574+
&engine->gt->reset.flags);
575+
576+
local_bh_enable();
577+
tasklet_enable(&engine->execlists.tasklet);
578+
}
579+
554580
static int live_hold_reset(void *arg)
555581
{
556582
struct intel_gt *gt = arg;
@@ -598,15 +624,9 @@ static int live_hold_reset(void *arg)
598624

599625
/* We have our request executing, now remove it and reset */
600626

601-
local_bh_disable();
602-
if (test_and_set_bit(I915_RESET_ENGINE + id,
603-
&gt->reset.flags)) {
604-
local_bh_enable();
605-
intel_gt_set_wedged(gt);
606-
err = -EBUSY;
627+
err = engine_lock_reset_tasklet(engine);
628+
if (err)
607629
goto out;
608-
}
609-
tasklet_disable(&engine->execlists.tasklet);
610630

611631
engine->execlists.tasklet.callback(&engine->execlists.tasklet);
612632
GEM_BUG_ON(execlists_active(&engine->execlists) != rq);
@@ -618,10 +638,7 @@ static int live_hold_reset(void *arg)
618638
__intel_engine_reset_bh(engine, NULL);
619639
GEM_BUG_ON(rq->fence.error != -EIO);
620640

621-
tasklet_enable(&engine->execlists.tasklet);
622-
clear_and_wake_up_bit(I915_RESET_ENGINE + id,
623-
&gt->reset.flags);
624-
local_bh_enable();
641+
engine_unlock_reset_tasklet(engine);
625642

626643
/* Check that we do not resubmit the held request */
627644
if (!i915_request_wait(rq, 0, HZ / 5)) {
@@ -4585,15 +4602,9 @@ static int reset_virtual_engine(struct intel_gt *gt,
45854602
GEM_BUG_ON(engine == ve->engine);
45864603

45874604
/* Take ownership of the reset and tasklet */
4588-
local_bh_disable();
4589-
if (test_and_set_bit(I915_RESET_ENGINE + engine->id,
4590-
&gt->reset.flags)) {
4591-
local_bh_enable();
4592-
intel_gt_set_wedged(gt);
4593-
err = -EBUSY;
4605+
err = engine_lock_reset_tasklet(engine);
4606+
if (err)
45944607
goto out_heartbeat;
4595-
}
4596-
tasklet_disable(&engine->execlists.tasklet);
45974608

45984609
engine->execlists.tasklet.callback(&engine->execlists.tasklet);
45994610
GEM_BUG_ON(execlists_active(&engine->execlists) != rq);
@@ -4612,9 +4623,7 @@ static int reset_virtual_engine(struct intel_gt *gt,
46124623
GEM_BUG_ON(rq->fence.error != -EIO);
46134624

46144625
/* Release our grasp on the engine, letting CS flow again */
4615-
tasklet_enable(&engine->execlists.tasklet);
4616-
clear_and_wake_up_bit(I915_RESET_ENGINE + engine->id, &gt->reset.flags);
4617-
local_bh_enable();
4626+
engine_unlock_reset_tasklet(engine);
46184627

46194628
/* Check that we do not resubmit the held request */
46204629
i915_request_get(rq);

0 commit comments

Comments
 (0)