Re: [Intel-gfx] [PATCH] drm/i915/gt: Clear LOCAL_BIND from shared GGTT on resume

2020-05-27 Thread Matthew Auld
On Tue, 26 May 2020 at 16:07, Chris Wilson  wrote:
>
> 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, we need to clear its presence flag on deciding not to restore the
> mapping upon resume.
>
> Fixes: bf0840cdb304 ("drm/i915/gt: Stop cross-polluting PIN_GLOBAL with 
> PIN_USER with no-ppgtt")
> Signed-off-by: Chris Wilson 
Reviewed-by: Matthew Auld 
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH] drm/i915/gt: Clear LOCAL_BIND from shared GGTT on resume

2020-05-26 Thread Chris Wilson
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, we need to clear its presence flag on deciding not to restore the
mapping upon resume.

Fixes: bf0840cdb304 ("drm/i915/gt: Stop cross-polluting PIN_GLOBAL with 
PIN_USER with no-ppgtt")
Signed-off-by: Chris Wilson 
---
 drivers/gpu/drm/i915/gt/intel_ggtt.c | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/gt/intel_ggtt.c 
b/drivers/gpu/drm/i915/gt/intel_ggtt.c
index 8c275f8588c3..317172ad5ef3 100644
--- a/drivers/gpu/drm/i915/gt/intel_ggtt.c
+++ b/drivers/gpu/drm/i915/gt/intel_ggtt.c
@@ -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, >flags);
+}
+
 void i915_ggtt_resume(struct i915_ggtt *ggtt)
 {
struct i915_vma *vma;
@@ -1179,10 +1184,9 @@ void i915_ggtt_resume(struct i915_ggtt *ggtt)
list_for_each_entry(vma, >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));
-- 
2.20.1

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx