Commit a7bbbd63 authored by Ben Widawsky's avatar Ben Widawsky Committed by Daniel Vetter

drm/i915: Create a global list of vms

After we plumb our code to support multiple address spaces (VMs), there
are a few situations where we want to be able to traverse the list of
all address spaces in the system. Cases like eviction, or error state
collection are obvious example.

v2: Delete the global link instead of the list head. While this in and
of itself shouldn't be really be a problem, doing this allows us to WARN
on an non-empty list, which is a problem. (Daniel)
Signed-off-by: default avatarBen Widawsky <ben@bwidawsk.net>
Reviewed-by: default avatarImre Deak <imre.deak@intel.com>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent 93bd8649
...@@ -1492,6 +1492,10 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags) ...@@ -1492,6 +1492,10 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
i915_dump_device_info(dev_priv); 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)) { if (i915_get_bridge_dev(dev)) {
ret = -EIO; ret = -EIO;
goto free_priv; goto free_priv;
...@@ -1758,6 +1762,8 @@ int i915_driver_unload(struct drm_device *dev) ...@@ -1758,6 +1762,8 @@ int i915_driver_unload(struct drm_device *dev)
i915_free_hws(dev); i915_free_hws(dev);
} }
list_del(&dev_priv->gtt.base.global_link);
WARN_ON(!list_empty(&dev_priv->vm_list));
drm_mm_takedown(&dev_priv->gtt.base.mm); drm_mm_takedown(&dev_priv->gtt.base.mm);
if (dev_priv->regs != NULL) if (dev_priv->regs != NULL)
pci_iounmap(dev->pdev, dev_priv->regs); pci_iounmap(dev->pdev, dev_priv->regs);
......
...@@ -449,6 +449,7 @@ typedef uint32_t gen6_gtt_pte_t; ...@@ -449,6 +449,7 @@ typedef uint32_t gen6_gtt_pte_t;
struct i915_address_space { struct i915_address_space {
struct drm_mm mm; struct drm_mm mm;
struct drm_device *dev; struct drm_device *dev;
struct list_head global_link;
unsigned long start; /* Start offset always 0 for dri2 */ unsigned long start; /* Start offset always 0 for dri2 */
size_t total; /* size addr space maps (ex. 2GB for ggtt) */ size_t total; /* size addr space maps (ex. 2GB for ggtt) */
...@@ -1120,6 +1121,7 @@ typedef struct drm_i915_private { ...@@ -1120,6 +1121,7 @@ typedef struct drm_i915_private {
enum modeset_restore modeset_restore; enum modeset_restore modeset_restore;
struct mutex modeset_restore_lock; struct mutex modeset_restore_lock;
struct list_head vm_list; /* Global list of all address spaces */
struct i915_gtt gtt; /* VMA representing the global address space */ struct i915_gtt gtt; /* VMA representing the global address space */
struct i915_gem_mm mm; struct i915_gem_mm mm;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment