Skip to content

Commit

Permalink
drm/i915/gt: Clear LOCAL_BIND from shared GGTT on resume
Browse files Browse the repository at this point in the history
We only restore GLOBAL binds upon resume as we expect these to be pinned
for use by HW, whereas the LOCAL binds can be recreated on demand once
userspace is resumed. For the LOCAL bind to be recreated in the global
GTT (for old systems without ppgtt), we need to clear its presence flag
on deciding not to restore the mapping upon resume.

Fixes: bf0840c ("drm/i915/gt: Stop cross-polluting PIN_GLOBAL with PIN_USER with no-ppgtt")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Matthew Auld <matthew.auld@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200526150739.26147-1-chris@chris-wilson.co.uk
  • Loading branch information
Chris Wilson committed May 27, 2020
1 parent 511b6d9 commit 0109a16
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions drivers/gpu/drm/i915/gt/intel_ggtt.c
Original file line number Diff line number Diff line change
Expand Up @@ -1161,6 +1161,11 @@ void i915_ggtt_disable_guc(struct i915_ggtt *ggtt)
ggtt->invalidate(ggtt);
}

static unsigned int clear_bind(struct i915_vma *vma)
{
return atomic_fetch_and(~I915_VMA_BIND_MASK, &vma->flags);
}

void i915_ggtt_resume(struct i915_ggtt *ggtt)
{
struct i915_vma *vma;
Expand All @@ -1179,10 +1184,9 @@ void i915_ggtt_resume(struct i915_ggtt *ggtt)
list_for_each_entry(vma, &ggtt->vm.bound_list, vm_link) {
struct drm_i915_gem_object *obj = vma->obj;

if (!i915_vma_is_bound(vma, I915_VMA_GLOBAL_BIND))
if (!(clear_bind(vma) & I915_VMA_GLOBAL_BIND))
continue;

clear_bit(I915_VMA_GLOBAL_BIND_BIT, __i915_vma_flags(vma));
WARN_ON(i915_vma_bind(vma,
obj ? obj->cache_level : 0,
PIN_GLOBAL, NULL));
Expand Down

0 comments on commit 0109a16

Please sign in to comment.