diff options
-rw-r--r-- | drivers/gpu/drm/i915/i915_gem_gtt.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c index 133cb9590003..7e403eaa9e0f 100644 --- a/drivers/gpu/drm/i915/i915_gem_gtt.c +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c | |||
@@ -1359,15 +1359,18 @@ static int gen8_ppgtt_alloc_pd(struct i915_address_space *vm, | |||
1359 | int count = gen8_pte_count(start, length); | 1359 | int count = gen8_pte_count(start, length); |
1360 | 1360 | ||
1361 | if (pt == vm->scratch_pt) { | 1361 | if (pt == vm->scratch_pt) { |
1362 | pd->used_pdes++; | ||
1363 | |||
1362 | pt = alloc_pt(vm); | 1364 | pt = alloc_pt(vm); |
1363 | if (IS_ERR(pt)) | 1365 | if (IS_ERR(pt)) { |
1366 | pd->used_pdes--; | ||
1364 | goto unwind; | 1367 | goto unwind; |
1368 | } | ||
1365 | 1369 | ||
1366 | if (count < GEN8_PTES || intel_vgpu_active(vm->i915)) | 1370 | if (count < GEN8_PTES || intel_vgpu_active(vm->i915)) |
1367 | gen8_initialize_pt(vm, pt); | 1371 | gen8_initialize_pt(vm, pt); |
1368 | 1372 | ||
1369 | gen8_ppgtt_set_pde(vm, pd, pt, pde); | 1373 | gen8_ppgtt_set_pde(vm, pd, pt, pde); |
1370 | pd->used_pdes++; | ||
1371 | GEM_BUG_ON(pd->used_pdes > I915_PDES); | 1374 | GEM_BUG_ON(pd->used_pdes > I915_PDES); |
1372 | } | 1375 | } |
1373 | 1376 | ||
@@ -1391,13 +1394,16 @@ static int gen8_ppgtt_alloc_pdp(struct i915_address_space *vm, | |||
1391 | 1394 | ||
1392 | gen8_for_each_pdpe(pd, pdp, start, length, pdpe) { | 1395 | gen8_for_each_pdpe(pd, pdp, start, length, pdpe) { |
1393 | if (pd == vm->scratch_pd) { | 1396 | if (pd == vm->scratch_pd) { |
1397 | pdp->used_pdpes++; | ||
1398 | |||
1394 | pd = alloc_pd(vm); | 1399 | pd = alloc_pd(vm); |
1395 | if (IS_ERR(pd)) | 1400 | if (IS_ERR(pd)) { |
1401 | pdp->used_pdpes--; | ||
1396 | goto unwind; | 1402 | goto unwind; |
1403 | } | ||
1397 | 1404 | ||
1398 | gen8_initialize_pd(vm, pd); | 1405 | gen8_initialize_pd(vm, pd); |
1399 | gen8_ppgtt_set_pdpe(vm, pdp, pd, pdpe); | 1406 | gen8_ppgtt_set_pdpe(vm, pdp, pd, pdpe); |
1400 | pdp->used_pdpes++; | ||
1401 | GEM_BUG_ON(pdp->used_pdpes > i915_pdpes_per_pdp(vm)); | 1407 | GEM_BUG_ON(pdp->used_pdpes > i915_pdpes_per_pdp(vm)); |
1402 | 1408 | ||
1403 | mark_tlbs_dirty(i915_vm_to_ppgtt(vm)); | 1409 | mark_tlbs_dirty(i915_vm_to_ppgtt(vm)); |