@@ -1518,6 +1518,10 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
i915_dump_device_info(dev_priv);
+ INIT_LIST_HEAD(&dev_priv->vm_list);
+ INIT_LIST_HEAD(&dev_priv->gtt.base.global_link);
+ list_add(&dev_priv->gtt.base.global_link, &dev_priv->vm_list);
+
if (i915_get_bridge_dev(dev)) {
ret = -EIO;
goto free_priv;
@@ -480,7 +480,10 @@ struct i915_gtt {
unsigned long *mappable_end);
void (*gtt_remove)(struct drm_device *dev);
};
-#define i915_gtt_vm ((struct i915_address_space *)&(dev_priv->gtt.base))
+#define i915_gtt_vm ((struct i915_address_space *) \
+ list_first_entry(&dev_priv->vm_list,\
+ struct i915_address_space, \
+ global_link))
struct i915_hw_ppgtt {
struct i915_address_space base;
@@ -4196,10 +4196,6 @@ i915_gem_load(struct drm_device *dev)
SLAB_HWCACHE_ALIGN,
NULL);
- INIT_LIST_HEAD(&dev_priv->vm_list);
- INIT_LIST_HEAD(&i915_gtt_vm->global_link);
- list_add(&i915_gtt_vm->global_link, &dev_priv->vm_list);
-
INIT_LIST_HEAD(&i915_gtt_vm->active_list);
INIT_LIST_HEAD(&i915_gtt_vm->inactive_list);
INIT_LIST_HEAD(&dev_priv->mm.unbound_list);
It's easy enough to test and make sure our list is accurate because we already have a member in place to access our global GTT. By porting that to use our list (which assumes the GGTT is always the first entry) we can verify a decent amount of the code is working correct. NOTE: to do this, we must initialize the list quite early. Signed-off-by: Ben Widawsky <ben@bwidawsk.net> --- drivers/gpu/drm/i915/i915_dma.c | 4 ++++ drivers/gpu/drm/i915/i915_drv.h | 5 ++++- drivers/gpu/drm/i915/i915_gem.c | 4 ---- 3 files changed, 8 insertions(+), 5 deletions(-)