[Intel-gfx] [PATCH 13/15] drm/i915: Extract commmon global gtt cleanup code
Thierry, Michel
michel.thierry at intel.com
Fri Aug 8 15:08:23 CEST 2014
> -----Original Message-----
> From: Intel-gfx [mailto:intel-gfx-bounces at lists.freedesktop.org] On Behalf
> Of Daniel Vetter
> Sent: Wednesday, August 06, 2014 2:05 PM
> To: Intel Graphics Development
> Cc: Daniel Vetter
> Subject: [Intel-gfx] [PATCH 13/15] drm/i915: Extract commmon global gtt
> cleanup code
>
> We want to move the aliasing ppgtt cleanup back into the global
> gtt cleanup code for symmetric, but first we need to create such
> a place.
>
> Signed-off-by: Daniel Vetter <daniel.vetter at ffwll.ch>
> ---
> drivers/gpu/drm/i915/i915_dma.c | 4 ++--
> drivers/gpu/drm/i915/i915_gem_gtt.c | 20 ++++++++++++--------
> drivers/gpu/drm/i915/i915_gem_gtt.h | 1 +
> 3 files changed, 15 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_dma.c
> b/drivers/gpu/drm/i915/i915_dma.c
> index e5ac1a6e9d26..c176a6c97c80 100644
> --- a/drivers/gpu/drm/i915/i915_dma.c
> +++ b/drivers/gpu/drm/i915/i915_dma.c
> @@ -1817,7 +1817,7 @@ out_mtrrfree:
> arch_phys_wc_del(dev_priv->gtt.mtrr);
> io_mapping_free(dev_priv->gtt.mappable);
> out_gtt:
> - dev_priv->gtt.base.cleanup(&dev_priv->gtt.base);
> + i915_global_gtt_cleanup(dev);
> out_regs:
> intel_uncore_fini(dev);
> pci_iounmap(dev->pdev, dev_priv->regs);
> @@ -1916,7 +1916,7 @@ int i915_driver_unload(struct drm_device *dev)
> destroy_workqueue(dev_priv->wq);
> pm_qos_remove_request(&dev_priv->pm_qos);
>
> - dev_priv->gtt.base.cleanup(&dev_priv->gtt.base);
> + i915_global_gtt_cleanup(dev);
>
> intel_uncore_fini(dev);
> if (dev_priv->regs != NULL)
> diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c
> b/drivers/gpu/drm/i915/i915_gem_gtt.c
> index bbf113ed7339..2eab0b6a32e8 100644
> --- a/drivers/gpu/drm/i915/i915_gem_gtt.c
> +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
> @@ -1796,6 +1796,18 @@ void i915_gem_init_global_gtt(struct drm_device
> *dev)
> i915_gem_setup_global_gtt(dev, 0, mappable_size, gtt_size);
> }
>
> +void i915_global_gtt_cleanup(struct drm_device *dev)
> +{
> + struct drm_i915_private *dev_priv = dev->dev_private;
> + struct i915_address_space *vm = &dev_priv->gtt.base;
> +
> + if (drm_mm_initialized(&vm->mm)) {
> + drm_mm_takedown(&vm->mm);
> + list_del(&vm->global_link);
> + }
> +
> + vm->cleanup(vm);
> +}
> static int setup_scratch_page(struct drm_device *dev)
> {
> struct drm_i915_private *dev_priv = dev->dev_private;
> @@ -2064,10 +2076,6 @@ static void gen6_gmch_remove(struct
> i915_address_space *vm)
>
> struct i915_gtt *gtt = container_of(vm, struct i915_gtt, base);
>
> - if (drm_mm_initialized(&vm->mm)) {
> - drm_mm_takedown(&vm->mm);
> - list_del(&vm->global_link);
> - }
> iounmap(gtt->gsm);
> teardown_scratch_page(vm->dev);
> }
> @@ -2106,10 +2114,6 @@ static int i915_gmch_probe(struct drm_device
> *dev,
>
> static void i915_gmch_remove(struct i915_address_space *vm)
> {
> - if (drm_mm_initialized(&vm->mm)) {
> - drm_mm_takedown(&vm->mm);
> - list_del(&vm->global_link);
> - }
> intel_gmch_remove();
> }
>
> diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.h
> b/drivers/gpu/drm/i915/i915_gem_gtt.h
> index bea3541d5525..6b30ebad0a0a 100644
> --- a/drivers/gpu/drm/i915/i915_gem_gtt.h
> +++ b/drivers/gpu/drm/i915/i915_gem_gtt.h
> @@ -273,6 +273,7 @@ int i915_gem_gtt_init(struct drm_device *dev);
> void i915_gem_init_global_gtt(struct drm_device *dev);
> int i915_gem_setup_global_gtt(struct drm_device *dev, unsigned long
start,
> unsigned long mappable_end, unsigned long
> end);
> +void i915_global_gtt_cleanup(struct drm_device *dev);
>
> bool intel_enable_ppgtt(struct drm_device *dev, bool full);
>
> --
> 1.9.3
Reviewed-by: Michel Thierry <michel.thierry at intel.com>
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 6656 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/intel-gfx/attachments/20140808/f0e786c2/attachment.bin>
More information about the Intel-gfx
mailing list