@@ -544,9 +544,6 @@ typedef struct drm_i915_private {
struct drm_mm vram;
/** Memory allocator for GTT */
struct drm_mm gtt_space;
- /** List of all objects in gtt_space. Used to restore gtt
- * mappings on resume */
- struct list_head gtt_list;
/** End of mappable part of GTT */
unsigned long gtt_mappable_end;
@@ -713,7 +710,6 @@ struct drm_i915_gem_object {
/** Current space allocated to this object in the GTT, if any. */
struct drm_mm_node gtt_space;
- struct list_head gtt_list;
/** This object's place on the active/flushing/inactive lists */
struct list_head ring_list;
@@ -94,7 +94,6 @@ static void i915_gem_info_add_gtt(struct drm_i915_private *dev_priv,
dev_priv->mm.gtt_mappable_end
- obj->gtt_space.start);
}
- list_add_tail(&obj->gtt_list, &dev_priv->mm.gtt_list);
}
static void i915_gem_info_remove_gtt(struct drm_i915_private *dev_priv,
@@ -108,7 +107,6 @@ static void i915_gem_info_remove_gtt(struct drm_i915_private *dev_priv,
dev_priv->mm.gtt_mappable_end
- obj->gtt_space.start);
}
- list_del_init(&obj->gtt_list);
}
/**
@@ -4342,7 +4340,6 @@ struct drm_i915_gem_object *i915_gem_alloc_object(struct drm_device *dev,
obj->base.driver_private = NULL;
obj->fence_reg = I915_FENCE_REG_NONE;
INIT_LIST_HEAD(&obj->mm_list);
- INIT_LIST_HEAD(&obj->gtt_list);
INIT_LIST_HEAD(&obj->ring_list);
INIT_LIST_HEAD(&obj->gpu_write_list);
obj->madv = I915_MADV_WILLNEED;
@@ -4650,7 +4647,6 @@ i915_gem_load(struct drm_device *dev)
INIT_LIST_HEAD(&dev_priv->mm.pinned_list);
INIT_LIST_HEAD(&dev_priv->mm.fence_list);
INIT_LIST_HEAD(&dev_priv->mm.deferred_free_list);
- INIT_LIST_HEAD(&dev_priv->mm.gtt_list);
init_ring_lists(&dev_priv->render_ring);
init_ring_lists(&dev_priv->bsd_ring);
init_ring_lists(&dev_priv->blt_ring);
@@ -33,8 +33,10 @@ void i915_gem_restore_gtt_mappings(struct drm_device *dev)
{
struct drm_i915_private *dev_priv = dev->dev_private;
struct drm_i915_gem_object *obj;
+ struct drm_mm_node *node;
- list_for_each_entry(obj, &dev_priv->mm.gtt_list, gtt_list) {
+ drm_mm_for_each_node(node, &dev_priv->mm.gtt_space) {
+ obj = container_of(node, struct drm_i915_gem_object, gtt_space);
if (dev_priv->mm.gtt->needs_dmar) {
BUG_ON(!obj->sg_list);