Skip to content

Commit 48e9050

Browse files
tursulinickle
authored andcommitted
drm/i915: Explicitly mark Global GTT address spaces
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 <[email protected]> Cc: Chris Wilson <[email protected]> Reviewed-by: Chris Wilson <[email protected]> Signed-off-by: Chris Wilson <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 2b5cf4e commit 48e9050

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

drivers/gpu/drm/i915/i915_gem_gtt.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3604,6 +3604,8 @@ int i915_ggtt_init_hw(struct drm_i915_private *dev_priv)
36043604
mutex_lock(&dev_priv->drm.struct_mutex);
36053605
i915_address_space_init(&ggtt->vm, dev_priv);
36063606

3607+
ggtt->vm.is_ggtt = true;
3608+
36073609
/* Only VLV supports read-only GGTT mappings */
36083610
ggtt->vm.has_read_only = IS_VALLEYVIEW(dev_priv);
36093611

drivers/gpu/drm/i915/i915_gem_gtt.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,9 @@ struct i915_address_space {
324324

325325
struct pagestash free_pages;
326326

327+
/* Global GTT */
328+
bool is_ggtt:1;
329+
327330
/* Some systems require uncached updates of the page directories */
328331
bool pt_kmap_wc:1;
329332

@@ -357,7 +360,7 @@ struct i915_address_space {
357360
I915_SELFTEST_DECLARE(bool scrub_64K);
358361
};
359362

360-
#define i915_is_ggtt(V) (!(V)->file)
363+
#define i915_is_ggtt(vm) ((vm)->is_ggtt)
361364

362365
static inline bool
363366
i915_vm_is_48bit(const struct i915_address_space *vm)

drivers/gpu/drm/i915/selftests/mock_gtt.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,8 @@ void mock_init_ggtt(struct drm_i915_private *i915)
118118
ggtt->vm.vma_ops.clear_pages = clear_pages;
119119

120120
i915_address_space_init(&ggtt->vm, i915);
121+
122+
ggtt->vm.is_ggtt = true;
121123
}
122124

123125
void mock_fini_ggtt(struct drm_i915_private *i915)

0 commit comments

Comments
 (0)