Skip to content

Commit

Permalink
drm/i915: Explicitly mark Global GTT address spaces
Browse files Browse the repository at this point in the history
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.

Signed-off-by: Tvrtko Ursulin <[email protected]>
Cc: Chris Wilson <[email protected]>
  • Loading branch information
tursulin authored and intel-lab-lkp committed Aug 15, 2018
1 parent e664532 commit 9780233
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions drivers/gpu/drm/i915/i915_gem_gtt.c
Original file line number Diff line number Diff line change
Expand Up @@ -3612,6 +3612,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);

Expand Down
5 changes: 4 additions & 1 deletion drivers/gpu/drm/i915/i915_gem_gtt.h
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,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;

Expand Down Expand Up @@ -365,7 +368,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)
Expand Down

0 comments on commit 9780233

Please sign in to comment.