]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
drm/i915: Explicitly mark Global GTT address spaces
authorTvrtko Ursulin <tvrtko.ursulin@intel.com>
Fri, 31 Aug 2018 14:36:43 +0000 (15:36 +0100)
committerChris Wilson <chris@chris-wilson.co.uk>
Sat, 1 Sep 2018 09:25:38 +0000 (10:25 +0100)
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 <tvrtko.ursulin@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Link: https://patchwork.freedesktop.org/patch/msgid/20180831143643.12366-1-tvrtko.ursulin@linux.intel.com
drivers/gpu/drm/i915/i915_gem_gtt.c
drivers/gpu/drm/i915/i915_gem_gtt.h
drivers/gpu/drm/i915/selftests/mock_gtt.c

index d9d44639ba266f1af6b8adbc6a535e1b74a9de80..eb0e446d648232458bc7ba0eca0771ec5dd3e66b 100644 (file)
@@ -3604,6 +3604,8 @@ int i915_ggtt_init_hw(struct drm_i915_private *dev_priv)
        mutex_lock(&dev_priv->drm.struct_mutex);
        i915_address_space_init(&ggtt->vm, dev_priv);
 
+       ggtt->vm.is_ggtt = true;
+
        /* Only VLV supports read-only GGTT mappings */
        ggtt->vm.has_read_only = IS_VALLEYVIEW(dev_priv);
 
index 01d83a9431426a0f3a7e527b792fc63108147e75..7e2af5f4f39bcbb5ec355257d41decea7b45d019 100644 (file)
@@ -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)
index a140ea5c3a7c50edca13d1ad0c81955e1dea76e8..6ae418c76015b2187dd31437f3a460868765c5d5 100644 (file)
@@ -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(&ggtt->vm, i915);
+
+       ggtt->vm.is_ggtt = true;
 }
 
 void mock_fini_ggtt(struct drm_i915_private *i915)