提交 a4eba47b 编写于 作者: I Imre Deak

drm/i915: Move stolen memory initialization earlier during loading

The only device specific dependency of the stolen memory setup is the
MMIO mapping and the stolen memory size. Both are already available in
i915_gtt_init(), so move the stolen initialization to there. The
clean-up code for i915_gtt_init() is in i915_global_gtt_cleanup(), so
move the stolen memory clean-up code there too.

This will be needed by an upcoming patch that needs the details of the
memory we reserve, but the change is also part of our generic goal to
move the initialization of resources with no or little dependencies on
other device specific resources towards the beginning of the init
sequence.
Suggested-by: NChris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: NImre Deak <imre.deak@intel.com>
Reviewed-by: NDavid Weinehall <david.weinehall@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1453209992-25995-8-git-send-email-imre.deak@intel.com
上级 ad5c3d3f
...@@ -391,13 +391,6 @@ static int i915_load_modeset_init(struct drm_device *dev) ...@@ -391,13 +391,6 @@ static int i915_load_modeset_init(struct drm_device *dev)
if (ret) if (ret)
goto cleanup_vga_client; goto cleanup_vga_client;
/* Initialise stolen first so that we may reserve preallocated
* objects for the BIOS to KMS transition.
*/
ret = i915_gem_init_stolen(dev);
if (ret)
goto cleanup_vga_switcheroo;
intel_power_domains_init_hw(dev_priv, false); intel_power_domains_init_hw(dev_priv, false);
intel_csr_ucode_init(dev_priv); intel_csr_ucode_init(dev_priv);
...@@ -460,8 +453,6 @@ static int i915_load_modeset_init(struct drm_device *dev) ...@@ -460,8 +453,6 @@ static int i915_load_modeset_init(struct drm_device *dev)
intel_teardown_gmbus(dev); intel_teardown_gmbus(dev);
cleanup_csr: cleanup_csr:
intel_csr_ucode_fini(dev_priv); intel_csr_ucode_fini(dev_priv);
i915_gem_cleanup_stolen(dev);
cleanup_vga_switcheroo:
vga_switcheroo_unregister_client(dev->pdev); vga_switcheroo_unregister_client(dev->pdev);
cleanup_vga_client: cleanup_vga_client:
vga_client_register(dev->pdev, NULL, NULL, NULL); vga_client_register(dev->pdev, NULL, NULL, NULL);
...@@ -1233,7 +1224,6 @@ int i915_driver_unload(struct drm_device *dev) ...@@ -1233,7 +1224,6 @@ int i915_driver_unload(struct drm_device *dev)
i915_gem_context_fini(dev); i915_gem_context_fini(dev);
mutex_unlock(&dev->struct_mutex); mutex_unlock(&dev->struct_mutex);
intel_fbc_cleanup_cfb(dev_priv); intel_fbc_cleanup_cfb(dev_priv);
i915_gem_cleanup_stolen(dev);
pm_qos_remove_request(&dev_priv->pm_qos); pm_qos_remove_request(&dev_priv->pm_qos);
......
...@@ -2809,6 +2809,8 @@ void i915_global_gtt_cleanup(struct drm_device *dev) ...@@ -2809,6 +2809,8 @@ void i915_global_gtt_cleanup(struct drm_device *dev)
ppgtt->base.cleanup(&ppgtt->base); ppgtt->base.cleanup(&ppgtt->base);
} }
i915_gem_cleanup_stolen(dev);
if (drm_mm_initialized(&vm->mm)) { if (drm_mm_initialized(&vm->mm)) {
if (intel_vgpu_active(dev)) if (intel_vgpu_active(dev))
intel_vgt_deballoon(); intel_vgt_deballoon();
...@@ -3181,6 +3183,14 @@ int i915_gem_gtt_init(struct drm_device *dev) ...@@ -3181,6 +3183,14 @@ int i915_gem_gtt_init(struct drm_device *dev)
if (ret) if (ret)
return ret; return ret;
/*
* Initialise stolen early so that we may reserve preallocated
* objects for the BIOS to KMS transition.
*/
ret = i915_gem_init_stolen(dev);
if (ret)
goto out_gtt_cleanup;
/* GMADR is the PCI mmio aperture into the global GTT. */ /* GMADR is the PCI mmio aperture into the global GTT. */
DRM_INFO("Memory usable by graphics device = %lluM\n", DRM_INFO("Memory usable by graphics device = %lluM\n",
gtt->base.total >> 20); gtt->base.total >> 20);
...@@ -3200,6 +3210,11 @@ int i915_gem_gtt_init(struct drm_device *dev) ...@@ -3200,6 +3210,11 @@ int i915_gem_gtt_init(struct drm_device *dev)
DRM_DEBUG_DRIVER("ppgtt mode: %i\n", i915.enable_ppgtt); DRM_DEBUG_DRIVER("ppgtt mode: %i\n", i915.enable_ppgtt);
return 0; return 0;
out_gtt_cleanup:
gtt->base.cleanup(&dev_priv->gtt.base);
return ret;
} }
void i915_gem_restore_gtt_mappings(struct drm_device *dev) void i915_gem_restore_gtt_mappings(struct drm_device *dev)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册