Skip to content

Commit 27db6f7

Browse files
committed
Merge tag 'drm-intel-fixes-2020-05-13-1' of git://anongit.freedesktop.org/drm/drm-intel into drm-fixes
- Handle idling during i915_gem_evict_something busy loops (Chris) - Mark current submissions with a weak-dependency (Chris) - Propagate errror from completed fences (Chris) - Fixes on execlist to avoid GPU hang situation (Chris) - Fixes couple deadlocks (Chris) - Timeslice preemption fixes (Chris) - Fix Display Port interrupt handling on Tiger Lake (Imre) - Reduce debug noise around Frame Buffer Compression +(Peter) - Fix logic around IPC W/a for Coffee Lake and Kaby Lake +(Sultan) - Avoid dereferencing a dead context (Chris) Signed-off-by: Dave Airlie <[email protected]> From: Rodrigo Vivi <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
2 parents f59bcda + 955da9d commit 27db6f7

File tree

8 files changed

+79
-27
lines changed

8 files changed

+79
-27
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1721,6 +1721,9 @@ static void defer_request(struct i915_request *rq, struct list_head * const pl)
17211721
struct i915_request *w =
17221722
container_of(p->waiter, typeof(*w), sched);
17231723

1724+
if (p->flags & I915_DEPENDENCY_WEAK)
1725+
continue;
1726+
17241727
/* Leave semaphores spinning on the other engines */
17251728
if (w->engine != rq->engine)
17261729
continue;

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

Lines changed: 44 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -208,14 +208,41 @@ static void emulate_monitor_status_change(struct intel_vgpu *vgpu)
208208
SKL_FUSE_PG_DIST_STATUS(SKL_PG0) |
209209
SKL_FUSE_PG_DIST_STATUS(SKL_PG1) |
210210
SKL_FUSE_PG_DIST_STATUS(SKL_PG2);
211-
vgpu_vreg_t(vgpu, LCPLL1_CTL) |=
212-
LCPLL_PLL_ENABLE |
213-
LCPLL_PLL_LOCK;
214-
vgpu_vreg_t(vgpu, LCPLL2_CTL) |= LCPLL_PLL_ENABLE;
215-
211+
/*
212+
* Only 1 PIPE enabled in current vGPU display and PIPE_A is
213+
* tied to TRANSCODER_A in HW, so it's safe to assume PIPE_A,
214+
* TRANSCODER_A can be enabled. PORT_x depends on the input of
215+
* setup_virtual_dp_monitor, we can bind DPLL0 to any PORT_x
216+
* so we fixed to DPLL0 here.
217+
* Setup DPLL0: DP link clk 1620 MHz, non SSC, DP Mode
218+
*/
219+
vgpu_vreg_t(vgpu, DPLL_CTRL1) =
220+
DPLL_CTRL1_OVERRIDE(DPLL_ID_SKL_DPLL0);
221+
vgpu_vreg_t(vgpu, DPLL_CTRL1) |=
222+
DPLL_CTRL1_LINK_RATE(DPLL_CTRL1_LINK_RATE_1620, DPLL_ID_SKL_DPLL0);
223+
vgpu_vreg_t(vgpu, LCPLL1_CTL) =
224+
LCPLL_PLL_ENABLE | LCPLL_PLL_LOCK;
225+
vgpu_vreg_t(vgpu, DPLL_STATUS) = DPLL_LOCK(DPLL_ID_SKL_DPLL0);
226+
/*
227+
* Golden M/N are calculated based on:
228+
* 24 bpp, 4 lanes, 154000 pixel clk (from virtual EDID),
229+
* DP link clk 1620 MHz and non-constant_n.
230+
* TODO: calculate DP link symbol clk and stream clk m/n.
231+
*/
232+
vgpu_vreg_t(vgpu, PIPE_DATA_M1(TRANSCODER_A)) = 63 << TU_SIZE_SHIFT;
233+
vgpu_vreg_t(vgpu, PIPE_DATA_M1(TRANSCODER_A)) |= 0x5b425e;
234+
vgpu_vreg_t(vgpu, PIPE_DATA_N1(TRANSCODER_A)) = 0x800000;
235+
vgpu_vreg_t(vgpu, PIPE_LINK_M1(TRANSCODER_A)) = 0x3cd6e;
236+
vgpu_vreg_t(vgpu, PIPE_LINK_N1(TRANSCODER_A)) = 0x80000;
216237
}
217238

218239
if (intel_vgpu_has_monitor_on_port(vgpu, PORT_B)) {
240+
vgpu_vreg_t(vgpu, DPLL_CTRL2) &=
241+
~DPLL_CTRL2_DDI_CLK_OFF(PORT_B);
242+
vgpu_vreg_t(vgpu, DPLL_CTRL2) |=
243+
DPLL_CTRL2_DDI_CLK_SEL(DPLL_ID_SKL_DPLL0, PORT_B);
244+
vgpu_vreg_t(vgpu, DPLL_CTRL2) |=
245+
DPLL_CTRL2_DDI_SEL_OVERRIDE(PORT_B);
219246
vgpu_vreg_t(vgpu, SFUSE_STRAP) |= SFUSE_STRAP_DDIB_DETECTED;
220247
vgpu_vreg_t(vgpu, TRANS_DDI_FUNC_CTL(TRANSCODER_A)) &=
221248
~(TRANS_DDI_BPC_MASK | TRANS_DDI_MODE_SELECT_MASK |
@@ -236,6 +263,12 @@ static void emulate_monitor_status_change(struct intel_vgpu *vgpu)
236263
}
237264

238265
if (intel_vgpu_has_monitor_on_port(vgpu, PORT_C)) {
266+
vgpu_vreg_t(vgpu, DPLL_CTRL2) &=
267+
~DPLL_CTRL2_DDI_CLK_OFF(PORT_C);
268+
vgpu_vreg_t(vgpu, DPLL_CTRL2) |=
269+
DPLL_CTRL2_DDI_CLK_SEL(DPLL_ID_SKL_DPLL0, PORT_C);
270+
vgpu_vreg_t(vgpu, DPLL_CTRL2) |=
271+
DPLL_CTRL2_DDI_SEL_OVERRIDE(PORT_C);
239272
vgpu_vreg_t(vgpu, SDEISR) |= SDE_PORTC_HOTPLUG_CPT;
240273
vgpu_vreg_t(vgpu, TRANS_DDI_FUNC_CTL(TRANSCODER_A)) &=
241274
~(TRANS_DDI_BPC_MASK | TRANS_DDI_MODE_SELECT_MASK |
@@ -256,6 +289,12 @@ static void emulate_monitor_status_change(struct intel_vgpu *vgpu)
256289
}
257290

258291
if (intel_vgpu_has_monitor_on_port(vgpu, PORT_D)) {
292+
vgpu_vreg_t(vgpu, DPLL_CTRL2) &=
293+
~DPLL_CTRL2_DDI_CLK_OFF(PORT_D);
294+
vgpu_vreg_t(vgpu, DPLL_CTRL2) |=
295+
DPLL_CTRL2_DDI_CLK_SEL(DPLL_ID_SKL_DPLL0, PORT_D);
296+
vgpu_vreg_t(vgpu, DPLL_CTRL2) |=
297+
DPLL_CTRL2_DDI_SEL_OVERRIDE(PORT_D);
259298
vgpu_vreg_t(vgpu, SDEISR) |= SDE_PORTD_HOTPLUG_CPT;
260299
vgpu_vreg_t(vgpu, TRANS_DDI_FUNC_CTL(TRANSCODER_A)) &=
261300
~(TRANS_DDI_BPC_MASK | TRANS_DDI_MODE_SELECT_MASK |

drivers/gpu/drm/i915/gvt/scheduler.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,11 @@ static void set_context_ppgtt_from_shadow(struct intel_vgpu_workload *workload,
379379
for (i = 0; i < GVT_RING_CTX_NR_PDPS; i++) {
380380
struct i915_page_directory * const pd =
381381
i915_pd_entry(ppgtt->pd, i);
382-
382+
/* skip now as current i915 ppgtt alloc won't allocate
383+
top level pdp for non 4-level table, won't impact
384+
shadow ppgtt. */
385+
if (!pd)
386+
break;
383387
px_dma(pd) = mm->ppgtt_mm.shadow_pdps[i];
384388
}
385389
}

drivers/gpu/drm/i915/i915_gem_evict.c

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,13 @@ i915_gem_evict_something(struct i915_address_space *vm,
128128
active = NULL;
129129
INIT_LIST_HEAD(&eviction_list);
130130
list_for_each_entry_safe(vma, next, &vm->bound_list, vm_link) {
131+
if (vma == active) { /* now seen this vma twice */
132+
if (flags & PIN_NONBLOCK)
133+
break;
134+
135+
active = ERR_PTR(-EAGAIN);
136+
}
137+
131138
/*
132139
* We keep this list in a rough least-recently scanned order
133140
* of active elements (inactive elements are cheap to reap).
@@ -143,21 +150,12 @@ i915_gem_evict_something(struct i915_address_space *vm,
143150
* To notice when we complete one full cycle, we record the
144151
* first active element seen, before moving it to the tail.
145152
*/
146-
if (i915_vma_is_active(vma)) {
147-
if (vma == active) {
148-
if (flags & PIN_NONBLOCK)
149-
break;
150-
151-
active = ERR_PTR(-EAGAIN);
152-
}
153-
154-
if (active != ERR_PTR(-EAGAIN)) {
155-
if (!active)
156-
active = vma;
153+
if (active != ERR_PTR(-EAGAIN) && i915_vma_is_active(vma)) {
154+
if (!active)
155+
active = vma;
157156

158-
list_move_tail(&vma->vm_link, &vm->bound_list);
159-
continue;
160-
}
157+
list_move_tail(&vma->vm_link, &vm->bound_list);
158+
continue;
161159
}
162160

163161
if (mark_free(&scan, vma, flags, &eviction_list))

drivers/gpu/drm/i915/i915_request.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1017,11 +1017,15 @@ i915_request_await_request(struct i915_request *to, struct i915_request *from)
10171017
GEM_BUG_ON(to == from);
10181018
GEM_BUG_ON(to->timeline == from->timeline);
10191019

1020-
if (i915_request_completed(from))
1020+
if (i915_request_completed(from)) {
1021+
i915_sw_fence_set_error_once(&to->submit, from->fence.error);
10211022
return 0;
1023+
}
10221024

10231025
if (to->engine->schedule) {
1024-
ret = i915_sched_node_add_dependency(&to->sched, &from->sched);
1026+
ret = i915_sched_node_add_dependency(&to->sched,
1027+
&from->sched,
1028+
I915_DEPENDENCY_EXTERNAL);
10251029
if (ret < 0)
10261030
return ret;
10271031
}
@@ -1183,7 +1187,9 @@ __i915_request_await_execution(struct i915_request *to,
11831187

11841188
/* Couple the dependency tree for PI on this exposed to->fence */
11851189
if (to->engine->schedule) {
1186-
err = i915_sched_node_add_dependency(&to->sched, &from->sched);
1190+
err = i915_sched_node_add_dependency(&to->sched,
1191+
&from->sched,
1192+
I915_DEPENDENCY_WEAK);
11871193
if (err < 0)
11881194
return err;
11891195
}

drivers/gpu/drm/i915/i915_scheduler.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,8 @@ bool __i915_sched_node_add_dependency(struct i915_sched_node *node,
456456
}
457457

458458
int i915_sched_node_add_dependency(struct i915_sched_node *node,
459-
struct i915_sched_node *signal)
459+
struct i915_sched_node *signal,
460+
unsigned long flags)
460461
{
461462
struct i915_dependency *dep;
462463

@@ -465,8 +466,7 @@ int i915_sched_node_add_dependency(struct i915_sched_node *node,
465466
return -ENOMEM;
466467

467468
if (!__i915_sched_node_add_dependency(node, signal, dep,
468-
I915_DEPENDENCY_EXTERNAL |
469-
I915_DEPENDENCY_ALLOC))
469+
flags | I915_DEPENDENCY_ALLOC))
470470
i915_dependency_free(dep);
471471

472472
return 0;

drivers/gpu/drm/i915/i915_scheduler.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ bool __i915_sched_node_add_dependency(struct i915_sched_node *node,
3434
unsigned long flags);
3535

3636
int i915_sched_node_add_dependency(struct i915_sched_node *node,
37-
struct i915_sched_node *signal);
37+
struct i915_sched_node *signal,
38+
unsigned long flags);
3839

3940
void i915_sched_node_fini(struct i915_sched_node *node);
4041

drivers/gpu/drm/i915/i915_scheduler_types.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ struct i915_dependency {
7878
unsigned long flags;
7979
#define I915_DEPENDENCY_ALLOC BIT(0)
8080
#define I915_DEPENDENCY_EXTERNAL BIT(1)
81+
#define I915_DEPENDENCY_WEAK BIT(2)
8182
};
8283

8384
#endif /* _I915_SCHEDULER_TYPES_H_ */

0 commit comments

Comments
 (0)