Skip to content

Commit a979bb7

Browse files
committed
Merge tag 'drm-intel-fixes-2020-04-30' of git://anongit.freedesktop.org/drm/drm-intel into drm-fixes
- Fix selftest refcnt leak (Xiyu) - Fix gem vma lock (Chris) - Fix gt's i915_request.timeline acquire by checking if cacheline is valid (Chris) - Fix IRQ postinistall fault masks (Matt) Signed-off-by: Dave Airlie <[email protected]> From: Rodrigo Vivi <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
2 parents c62098c + 8598eb7 commit a979bb7

File tree

5 files changed

+36
-14
lines changed

5 files changed

+36
-14
lines changed

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

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,21 +182,35 @@ i915_gem_object_fence_prepare(struct drm_i915_gem_object *obj,
182182
int tiling_mode, unsigned int stride)
183183
{
184184
struct i915_ggtt *ggtt = &to_i915(obj->base.dev)->ggtt;
185-
struct i915_vma *vma;
185+
struct i915_vma *vma, *vn;
186+
LIST_HEAD(unbind);
186187
int ret = 0;
187188

188189
if (tiling_mode == I915_TILING_NONE)
189190
return 0;
190191

191192
mutex_lock(&ggtt->vm.mutex);
193+
194+
spin_lock(&obj->vma.lock);
192195
for_each_ggtt_vma(vma, obj) {
196+
GEM_BUG_ON(vma->vm != &ggtt->vm);
197+
193198
if (i915_vma_fence_prepare(vma, tiling_mode, stride))
194199
continue;
195200

201+
list_move(&vma->vm_link, &unbind);
202+
}
203+
spin_unlock(&obj->vma.lock);
204+
205+
list_for_each_entry_safe(vma, vn, &unbind, vm_link) {
196206
ret = __i915_vma_unbind(vma);
197-
if (ret)
207+
if (ret) {
208+
/* Restore the remaining vma on an error */
209+
list_splice(&unbind, &ggtt->vm.bound_list);
198210
break;
211+
}
199212
}
213+
200214
mutex_unlock(&ggtt->vm.mutex);
201215

202216
return ret;
@@ -268,6 +282,7 @@ i915_gem_object_set_tiling(struct drm_i915_gem_object *obj,
268282
}
269283
mutex_unlock(&obj->mm.lock);
270284

285+
spin_lock(&obj->vma.lock);
271286
for_each_ggtt_vma(vma, obj) {
272287
vma->fence_size =
273288
i915_gem_fence_size(i915, vma->size, tiling, stride);
@@ -278,6 +293,7 @@ i915_gem_object_set_tiling(struct drm_i915_gem_object *obj,
278293
if (vma->fence)
279294
vma->fence->dirty = true;
280295
}
296+
spin_unlock(&obj->vma.lock);
281297

282298
obj->tiling_and_stride = tiling | stride;
283299
i915_gem_object_unlock(obj);

drivers/gpu/drm/i915/gem/selftests/huge_pages.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1477,8 +1477,10 @@ static int igt_ppgtt_pin_update(void *arg)
14771477
unsigned int page_size = BIT(first);
14781478

14791479
obj = i915_gem_object_create_internal(dev_priv, page_size);
1480-
if (IS_ERR(obj))
1481-
return PTR_ERR(obj);
1480+
if (IS_ERR(obj)) {
1481+
err = PTR_ERR(obj);
1482+
goto out_vm;
1483+
}
14821484

14831485
vma = i915_vma_instance(obj, vm, NULL);
14841486
if (IS_ERR(vma)) {
@@ -1531,8 +1533,10 @@ static int igt_ppgtt_pin_update(void *arg)
15311533
}
15321534

15331535
obj = i915_gem_object_create_internal(dev_priv, PAGE_SIZE);
1534-
if (IS_ERR(obj))
1535-
return PTR_ERR(obj);
1536+
if (IS_ERR(obj)) {
1537+
err = PTR_ERR(obj);
1538+
goto out_vm;
1539+
}
15361540

15371541
vma = i915_vma_instance(obj, vm, NULL);
15381542
if (IS_ERR(vma)) {

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -521,6 +521,8 @@ int intel_timeline_read_hwsp(struct i915_request *from,
521521

522522
rcu_read_lock();
523523
cl = rcu_dereference(from->hwsp_cacheline);
524+
if (i915_request_completed(from)) /* confirm cacheline is valid */
525+
goto unlock;
524526
if (unlikely(!i915_active_acquire_if_busy(&cl->active)))
525527
goto unlock; /* seqno wrapped and completed! */
526528
if (unlikely(i915_request_completed(from)))

drivers/gpu/drm/i915/i915_irq.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3358,7 +3358,8 @@ static void gen8_de_irq_postinstall(struct drm_i915_private *dev_priv)
33583358
{
33593359
struct intel_uncore *uncore = &dev_priv->uncore;
33603360

3361-
u32 de_pipe_masked = GEN8_PIPE_CDCLK_CRC_DONE;
3361+
u32 de_pipe_masked = gen8_de_pipe_fault_mask(dev_priv) |
3362+
GEN8_PIPE_CDCLK_CRC_DONE;
33623363
u32 de_pipe_enables;
33633364
u32 de_port_masked = GEN8_AUX_CHANNEL_A;
33643365
u32 de_port_enables;
@@ -3369,13 +3370,10 @@ static void gen8_de_irq_postinstall(struct drm_i915_private *dev_priv)
33693370
de_misc_masked |= GEN8_DE_MISC_GSE;
33703371

33713372
if (INTEL_GEN(dev_priv) >= 9) {
3372-
de_pipe_masked |= GEN9_DE_PIPE_IRQ_FAULT_ERRORS;
33733373
de_port_masked |= GEN9_AUX_CHANNEL_B | GEN9_AUX_CHANNEL_C |
33743374
GEN9_AUX_CHANNEL_D;
33753375
if (IS_GEN9_LP(dev_priv))
33763376
de_port_masked |= BXT_DE_PORT_GMBUS;
3377-
} else {
3378-
de_pipe_masked |= GEN8_DE_PIPE_IRQ_FAULT_ERRORS;
33793377
}
33803378

33813379
if (INTEL_GEN(dev_priv) >= 11)

drivers/gpu/drm/i915/i915_vma.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,16 +158,18 @@ vma_create(struct drm_i915_gem_object *obj,
158158

159159
GEM_BUG_ON(!IS_ALIGNED(vma->size, I915_GTT_PAGE_SIZE));
160160

161+
spin_lock(&obj->vma.lock);
162+
161163
if (i915_is_ggtt(vm)) {
162164
if (unlikely(overflows_type(vma->size, u32)))
163-
goto err_vma;
165+
goto err_unlock;
164166

165167
vma->fence_size = i915_gem_fence_size(vm->i915, vma->size,
166168
i915_gem_object_get_tiling(obj),
167169
i915_gem_object_get_stride(obj));
168170
if (unlikely(vma->fence_size < vma->size || /* overflow */
169171
vma->fence_size > vm->total))
170-
goto err_vma;
172+
goto err_unlock;
171173

172174
GEM_BUG_ON(!IS_ALIGNED(vma->fence_size, I915_GTT_MIN_ALIGNMENT));
173175

@@ -179,8 +181,6 @@ vma_create(struct drm_i915_gem_object *obj,
179181
__set_bit(I915_VMA_GGTT_BIT, __i915_vma_flags(vma));
180182
}
181183

182-
spin_lock(&obj->vma.lock);
183-
184184
rb = NULL;
185185
p = &obj->vma.tree.rb_node;
186186
while (*p) {
@@ -225,6 +225,8 @@ vma_create(struct drm_i915_gem_object *obj,
225225

226226
return vma;
227227

228+
err_unlock:
229+
spin_unlock(&obj->vma.lock);
228230
err_vma:
229231
i915_vma_free(vma);
230232
return ERR_PTR(-E2BIG);

0 commit comments

Comments
 (0)