Re: [Intel-gfx] [PATCH] drm/i915: Explicitly mark Global GTT address spaces

2018-09-01 Thread Chris Wilson
Quoting Chris Wilson (2018-08-31 16:47:24)
> Quoting Tvrtko Ursulin (2018-08-31 15:36:43)
> > From: Tvrtko Ursulin 
> > 
> > So far we have been relying on vm->file pointer being NULL to declare
> > something GGTT.
> > 
> > This has the unfortunate consequence that the default kernel context is
> > also declared GGTT and interferes with the following patch which wants to
> > instantiate VMA's and execute requests against the kernel context.
> > 
> > Change the is_ggtt test to use an explicit flag in struct address_space to
> > solve this issue.
> > 
> > Note that the bit used is free since there is an alignment hole in the
> > struct.
> > 
> > v2:
> >  * Mark mock ggtt.
> > 
> > Signed-off-by: Tvrtko Ursulin 
> > Cc: Chris Wilson 
> > ---
> >  drivers/gpu/drm/i915/i915_gem_gtt.c   | 2 ++
> >  drivers/gpu/drm/i915/i915_gem_gtt.h   | 5 -
> >  drivers/gpu/drm/i915/selftests/mock_gtt.c | 2 ++
> >  3 files changed, 8 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c 
> > b/drivers/gpu/drm/i915/i915_gem_gtt.c
> > index d9d44639ba26..eb0e446d6482 100644
> > --- a/drivers/gpu/drm/i915/i915_gem_gtt.c
> > +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
> > @@ -3604,6 +3604,8 @@ int i915_ggtt_init_hw(struct drm_i915_private 
> > *dev_priv)
> > mutex_lock(_priv->drm.struct_mutex);
> > i915_address_space_init(>vm, dev_priv);
> >  
> > +   ggtt->vm.is_ggtt = true;
> > +
> > /* Only VLV supports read-only GGTT mappings */
> > ggtt->vm.has_read_only = IS_VALLEYVIEW(dev_priv);
> >  
> > diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.h 
> > b/drivers/gpu/drm/i915/i915_gem_gtt.h
> > index 01d83a943142..7e2af5f4f39b 100644
> > --- a/drivers/gpu/drm/i915/i915_gem_gtt.h
> > +++ b/drivers/gpu/drm/i915/i915_gem_gtt.h
> > @@ -324,6 +324,9 @@ struct i915_address_space {
> >  
> > struct pagestash free_pages;
> >  
> > +   /* Global GTT */
> > +   bool is_ggtt:1;
> > +
> > /* Some systems require uncached updates of the page directories */
> > bool pt_kmap_wc:1;
> >  
> > @@ -357,7 +360,7 @@ struct i915_address_space {
> > I915_SELFTEST_DECLARE(bool scrub_64K);
> >  };
> >  
> > -#define i915_is_ggtt(V) (!(V)->file)
> > +#define i915_is_ggtt(vm) ((vm)->is_ggtt)
> 
> But it's so explicit!
> Reviewed-by: Chris Wilson 

And pushed, thanks for the patch.
-Chris
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH] drm/i915: Explicitly mark Global GTT address spaces

2018-08-31 Thread Chris Wilson
Quoting Tvrtko Ursulin (2018-08-31 15:36:43)
> From: Tvrtko Ursulin 
> 
> So far we have been relying on vm->file pointer being NULL to declare
> something GGTT.
> 
> This has the unfortunate consequence that the default kernel context is
> also declared GGTT and interferes with the following patch which wants to
> instantiate VMA's and execute requests against the kernel context.
> 
> Change the is_ggtt test to use an explicit flag in struct address_space to
> solve this issue.
> 
> Note that the bit used is free since there is an alignment hole in the
> struct.
> 
> v2:
>  * Mark mock ggtt.
> 
> Signed-off-by: Tvrtko Ursulin 
> Cc: Chris Wilson 
> ---
>  drivers/gpu/drm/i915/i915_gem_gtt.c   | 2 ++
>  drivers/gpu/drm/i915/i915_gem_gtt.h   | 5 -
>  drivers/gpu/drm/i915/selftests/mock_gtt.c | 2 ++
>  3 files changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c 
> b/drivers/gpu/drm/i915/i915_gem_gtt.c
> index d9d44639ba26..eb0e446d6482 100644
> --- a/drivers/gpu/drm/i915/i915_gem_gtt.c
> +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
> @@ -3604,6 +3604,8 @@ int i915_ggtt_init_hw(struct drm_i915_private *dev_priv)
> mutex_lock(_priv->drm.struct_mutex);
> i915_address_space_init(>vm, dev_priv);
>  
> +   ggtt->vm.is_ggtt = true;
> +
> /* Only VLV supports read-only GGTT mappings */
> ggtt->vm.has_read_only = IS_VALLEYVIEW(dev_priv);
>  
> diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.h 
> b/drivers/gpu/drm/i915/i915_gem_gtt.h
> index 01d83a943142..7e2af5f4f39b 100644
> --- a/drivers/gpu/drm/i915/i915_gem_gtt.h
> +++ b/drivers/gpu/drm/i915/i915_gem_gtt.h
> @@ -324,6 +324,9 @@ struct i915_address_space {
>  
> struct pagestash free_pages;
>  
> +   /* Global GTT */
> +   bool is_ggtt:1;
> +
> /* Some systems require uncached updates of the page directories */
> bool pt_kmap_wc:1;
>  
> @@ -357,7 +360,7 @@ struct i915_address_space {
> I915_SELFTEST_DECLARE(bool scrub_64K);
>  };
>  
> -#define i915_is_ggtt(V) (!(V)->file)
> +#define i915_is_ggtt(vm) ((vm)->is_ggtt)

But it's so explicit!
Reviewed-by: Chris Wilson 
-Chris
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH] drm/i915: Explicitly mark Global GTT address spaces

2018-08-31 Thread Tvrtko Ursulin
From: Tvrtko Ursulin 

So far we have been relying on vm->file pointer being NULL to declare
something GGTT.

This has the unfortunate consequence that the default kernel context is
also declared GGTT and interferes with the following patch which wants to
instantiate VMA's and execute requests against the kernel context.

Change the is_ggtt test to use an explicit flag in struct address_space to
solve this issue.

Note that the bit used is free since there is an alignment hole in the
struct.

v2:
 * Mark mock ggtt.

Signed-off-by: Tvrtko Ursulin 
Cc: Chris Wilson 
---
 drivers/gpu/drm/i915/i915_gem_gtt.c   | 2 ++
 drivers/gpu/drm/i915/i915_gem_gtt.h   | 5 -
 drivers/gpu/drm/i915/selftests/mock_gtt.c | 2 ++
 3 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c 
b/drivers/gpu/drm/i915/i915_gem_gtt.c
index d9d44639ba26..eb0e446d6482 100644
--- a/drivers/gpu/drm/i915/i915_gem_gtt.c
+++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
@@ -3604,6 +3604,8 @@ int i915_ggtt_init_hw(struct drm_i915_private *dev_priv)
mutex_lock(_priv->drm.struct_mutex);
i915_address_space_init(>vm, dev_priv);
 
+   ggtt->vm.is_ggtt = true;
+
/* Only VLV supports read-only GGTT mappings */
ggtt->vm.has_read_only = IS_VALLEYVIEW(dev_priv);
 
diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.h 
b/drivers/gpu/drm/i915/i915_gem_gtt.h
index 01d83a943142..7e2af5f4f39b 100644
--- a/drivers/gpu/drm/i915/i915_gem_gtt.h
+++ b/drivers/gpu/drm/i915/i915_gem_gtt.h
@@ -324,6 +324,9 @@ struct i915_address_space {
 
struct pagestash free_pages;
 
+   /* Global GTT */
+   bool is_ggtt:1;
+
/* Some systems require uncached updates of the page directories */
bool pt_kmap_wc:1;
 
@@ -357,7 +360,7 @@ struct i915_address_space {
I915_SELFTEST_DECLARE(bool scrub_64K);
 };
 
-#define i915_is_ggtt(V) (!(V)->file)
+#define i915_is_ggtt(vm) ((vm)->is_ggtt)
 
 static inline bool
 i915_vm_is_48bit(const struct i915_address_space *vm)
diff --git a/drivers/gpu/drm/i915/selftests/mock_gtt.c 
b/drivers/gpu/drm/i915/selftests/mock_gtt.c
index a140ea5c3a7c..6ae418c76015 100644
--- a/drivers/gpu/drm/i915/selftests/mock_gtt.c
+++ b/drivers/gpu/drm/i915/selftests/mock_gtt.c
@@ -118,6 +118,8 @@ void mock_init_ggtt(struct drm_i915_private *i915)
ggtt->vm.vma_ops.clear_pages = clear_pages;
 
i915_address_space_init(>vm, i915);
+
+   ggtt->vm.is_ggtt = true;
 }
 
 void mock_fini_ggtt(struct drm_i915_private *i915)
-- 
2.17.1

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