Commit 7ace3d30 authored by Tvrtko Ursulin's avatar Tvrtko Ursulin

drm/i915: dev_priv cleanup in i915_gem_stolen.c

And a little bit of cascaded function prototype changes.
Signed-off-by: default avatarTvrtko Ursulin <tvrtko.ursulin@intel.com>
Reviewed-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
parent 275a991c
...@@ -3279,7 +3279,7 @@ int i915_gem_stolen_insert_node_in_range(struct drm_i915_private *dev_priv, ...@@ -3279,7 +3279,7 @@ int i915_gem_stolen_insert_node_in_range(struct drm_i915_private *dev_priv,
u64 end); u64 end);
void i915_gem_stolen_remove_node(struct drm_i915_private *dev_priv, void i915_gem_stolen_remove_node(struct drm_i915_private *dev_priv,
struct drm_mm_node *node); struct drm_mm_node *node);
int i915_gem_init_stolen(struct drm_device *dev); int i915_gem_init_stolen(struct drm_i915_private *dev_priv);
void i915_gem_cleanup_stolen(struct drm_device *dev); void i915_gem_cleanup_stolen(struct drm_device *dev);
struct drm_i915_gem_object * struct drm_i915_gem_object *
i915_gem_object_create_stolen(struct drm_device *dev, u32 size); i915_gem_object_create_stolen(struct drm_device *dev, u32 size);
......
...@@ -3252,7 +3252,7 @@ int i915_ggtt_init_hw(struct drm_i915_private *dev_priv) ...@@ -3252,7 +3252,7 @@ int i915_ggtt_init_hw(struct drm_i915_private *dev_priv)
* Initialise stolen early so that we may reserve preallocated * Initialise stolen early so that we may reserve preallocated
* objects for the BIOS to KMS transition. * objects for the BIOS to KMS transition.
*/ */
ret = i915_gem_init_stolen(&dev_priv->drm); ret = i915_gem_init_stolen(dev_priv);
if (ret) if (ret)
goto out_gtt_cleanup; goto out_gtt_cleanup;
......
...@@ -89,9 +89,8 @@ void i915_gem_stolen_remove_node(struct drm_i915_private *dev_priv, ...@@ -89,9 +89,8 @@ void i915_gem_stolen_remove_node(struct drm_i915_private *dev_priv,
mutex_unlock(&dev_priv->mm.stolen_lock); mutex_unlock(&dev_priv->mm.stolen_lock);
} }
static unsigned long i915_stolen_to_physical(struct drm_device *dev) static unsigned long i915_stolen_to_physical(struct drm_i915_private *dev_priv)
{ {
struct drm_i915_private *dev_priv = to_i915(dev);
struct pci_dev *pdev = dev_priv->drm.pdev; struct pci_dev *pdev = dev_priv->drm.pdev;
struct i915_ggtt *ggtt = &dev_priv->ggtt; struct i915_ggtt *ggtt = &dev_priv->ggtt;
struct resource *r; struct resource *r;
...@@ -253,7 +252,7 @@ static unsigned long i915_stolen_to_physical(struct drm_device *dev) ...@@ -253,7 +252,7 @@ static unsigned long i915_stolen_to_physical(struct drm_device *dev)
* kernel. So if the region is already marked as busy, something * kernel. So if the region is already marked as busy, something
* is seriously wrong. * is seriously wrong.
*/ */
r = devm_request_mem_region(dev->dev, base, ggtt->stolen_size, r = devm_request_mem_region(dev_priv->drm.dev, base, ggtt->stolen_size,
"Graphics Stolen Memory"); "Graphics Stolen Memory");
if (r == NULL) { if (r == NULL) {
/* /*
...@@ -264,7 +263,7 @@ static unsigned long i915_stolen_to_physical(struct drm_device *dev) ...@@ -264,7 +263,7 @@ static unsigned long i915_stolen_to_physical(struct drm_device *dev)
* PCI bus, but have an off-by-one error. Hence retry the * PCI bus, but have an off-by-one error. Hence retry the
* reservation starting from 1 instead of 0. * reservation starting from 1 instead of 0.
*/ */
r = devm_request_mem_region(dev->dev, base + 1, r = devm_request_mem_region(dev_priv->drm.dev, base + 1,
ggtt->stolen_size - 1, ggtt->stolen_size - 1,
"Graphics Stolen Memory"); "Graphics Stolen Memory");
/* /*
...@@ -408,9 +407,8 @@ static void bdw_get_stolen_reserved(struct drm_i915_private *dev_priv, ...@@ -408,9 +407,8 @@ static void bdw_get_stolen_reserved(struct drm_i915_private *dev_priv,
*size = stolen_top - *base; *size = stolen_top - *base;
} }
int i915_gem_init_stolen(struct drm_device *dev) int i915_gem_init_stolen(struct drm_i915_private *dev_priv)
{ {
struct drm_i915_private *dev_priv = to_i915(dev);
struct i915_ggtt *ggtt = &dev_priv->ggtt; struct i915_ggtt *ggtt = &dev_priv->ggtt;
unsigned long reserved_total, reserved_base = 0, reserved_size; unsigned long reserved_total, reserved_base = 0, reserved_size;
unsigned long stolen_top; unsigned long stolen_top;
...@@ -418,7 +416,7 @@ int i915_gem_init_stolen(struct drm_device *dev) ...@@ -418,7 +416,7 @@ int i915_gem_init_stolen(struct drm_device *dev)
mutex_init(&dev_priv->mm.stolen_lock); mutex_init(&dev_priv->mm.stolen_lock);
#ifdef CONFIG_INTEL_IOMMU #ifdef CONFIG_INTEL_IOMMU
if (intel_iommu_gfx_mapped && INTEL_INFO(dev)->gen < 8) { if (intel_iommu_gfx_mapped && INTEL_GEN(dev_priv) < 8) {
DRM_INFO("DMAR active, disabling use of stolen memory\n"); DRM_INFO("DMAR active, disabling use of stolen memory\n");
return 0; return 0;
} }
...@@ -427,7 +425,7 @@ int i915_gem_init_stolen(struct drm_device *dev) ...@@ -427,7 +425,7 @@ int i915_gem_init_stolen(struct drm_device *dev)
if (ggtt->stolen_size == 0) if (ggtt->stolen_size == 0)
return 0; return 0;
dev_priv->mm.stolen_base = i915_stolen_to_physical(dev); dev_priv->mm.stolen_base = i915_stolen_to_physical(dev_priv);
if (dev_priv->mm.stolen_base == 0) if (dev_priv->mm.stolen_base == 0)
return 0; return 0;
......
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