[Intel-gfx] [PATCH 2/7] drm/i915: don't allow ppgtt enabling to fail anymore
Daniel Vetter
daniel.vetter at ffwll.ch
Thu Sep 26 22:31:28 CEST 2013
Trying to keep on running is poised to run into totally untested code
after a gpu reset or resume. So better just stop things from going
down the toilet.
And at driver load time we better bail out and fix whatever's breaking
ppgtt instead of ignoring it.
So there's no need for this complexity. Shovel the aliasing ppgtt cleanup
into the gen6 ggtt cleanup (there's no other platform with an aliasing
ppgtt just now). Also add the missing call to gtt.base.cleanup in
i915_load_modeset_init. Oh dear how I hate our driver load mess ;-)
Signed-off-by: Daniel Vetter <daniel.vetter at ffwll.ch>
---
drivers/gpu/drm/i915/i915_dma.c | 4 ++--
drivers/gpu/drm/i915/i915_drv.c | 4 ++--
drivers/gpu/drm/i915/i915_drv.h | 1 -
drivers/gpu/drm/i915/i915_gem.c | 8 +++-----
drivers/gpu/drm/i915/i915_gem_gtt.c | 21 +++++++++------------
5 files changed, 16 insertions(+), 22 deletions(-)
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
index d35de1b..cd6e8b8 100644
--- a/drivers/gpu/drm/i915/i915_dma.c
+++ b/drivers/gpu/drm/i915/i915_dma.c
@@ -1377,7 +1377,8 @@ cleanup_gem:
i915_gem_cleanup_ringbuffer(dev);
i915_gem_context_fini(dev);
mutex_unlock(&dev->struct_mutex);
- i915_gem_cleanup_aliasing_ppgtt(dev);
+ dev_priv->gtt.base.cleanup(&dev_priv->gtt.base);
+
drm_mm_takedown(&dev_priv->gtt.base.mm);
cleanup_power:
intel_display_power_put(dev, POWER_DOMAIN_VGA);
@@ -1782,7 +1783,6 @@ int i915_driver_unload(struct drm_device *dev)
i915_gem_cleanup_ringbuffer(dev);
i915_gem_context_fini(dev);
mutex_unlock(&dev->struct_mutex);
- i915_gem_cleanup_aliasing_ppgtt(dev);
i915_gem_cleanup_stolen(dev);
if (!I915_NEED_GFX_HWS(dev))
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 8ebb0d1..cdb0875 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -761,7 +761,7 @@ int i915_reset(struct drm_device *dev)
if (dev_priv->mm.aliasing_ppgtt) {
ret = dev_priv->mm.aliasing_ppgtt->enable(dev);
if (ret)
- i915_gem_cleanup_aliasing_ppgtt(dev);
+ DRM_ERROR("Failed to re-enable ppgtt.\n");
}
/*
@@ -779,7 +779,7 @@ int i915_reset(struct drm_device *dev)
mutex_unlock(&dev->struct_mutex);
}
- return 0;
+ return ret;
}
static int i915_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index e8ffd57..14b9697 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -2105,7 +2105,6 @@ int i915_gem_context_destroy_ioctl(struct drm_device *dev, void *data,
struct drm_file *file);
/* i915_gem_gtt.c */
-void i915_gem_cleanup_aliasing_ppgtt(struct drm_device *dev);
void i915_gem_restore_gtt_mappings(struct drm_device *dev);
int __must_check i915_gem_gtt_prepare_object(struct drm_i915_gem_object *obj);
void i915_gem_gtt_finish_object(struct drm_i915_gem_object *obj);
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 0b2bc99..932994d 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -4414,8 +4414,8 @@ i915_gem_init_hw(struct drm_device *dev)
if (dev_priv->mm.aliasing_ppgtt) {
ret = dev_priv->mm.aliasing_ppgtt->enable(dev);
if (ret) {
- i915_gem_cleanup_aliasing_ppgtt(dev);
- DRM_INFO("PPGTT enable failed. This is not fatal, but unexpected\n");
+ DRM_ERROR("PPGTT enabling failed\n");
+ return ret;
}
}
@@ -4440,10 +4440,8 @@ int i915_gem_init(struct drm_device *dev)
ret = i915_gem_init_hw(dev);
mutex_unlock(&dev->struct_mutex);
- if (ret) {
- i915_gem_cleanup_aliasing_ppgtt(dev);
+ if (ret)
return ret;
- }
/* Allow hardware batchbuffers unless told otherwise, but not for KMS. */
if (!drm_core_check_feature(dev, DRIVER_MODESET))
diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
index db39612..a4dd8ca 100644
--- a/drivers/gpu/drm/i915/i915_gem_gtt.c
+++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
@@ -459,18 +459,6 @@ static int i915_gem_init_aliasing_ppgtt(struct drm_device *dev)
return ret;
}
-void i915_gem_cleanup_aliasing_ppgtt(struct drm_device *dev)
-{
- struct drm_i915_private *dev_priv = dev->dev_private;
- struct i915_hw_ppgtt *ppgtt = dev_priv->mm.aliasing_ppgtt;
-
- if (!ppgtt)
- return;
-
- ppgtt->base.cleanup(&ppgtt->base);
- dev_priv->mm.aliasing_ppgtt = NULL;
-}
-
extern int intel_iommu_gfx_mapped;
/* Certain Gen5 chipsets require require idling the GPU before
* unmapping anything from the GTT when VT-d is enabled.
@@ -928,8 +916,17 @@ static void gen6_gmch_remove(struct i915_address_space *vm)
{
struct i915_gtt *gtt = container_of(vm, struct i915_gtt, base);
+ struct drm_i915_private *dev_priv = vm->dev->dev_private;
+ struct i915_hw_ppgtt *ppgtt = dev_priv->mm.aliasing_ppgtt;
+
+ if (ppgtt) {
+ ppgtt->base.cleanup(&ppgtt->base);
+ dev_priv->mm.aliasing_ppgtt = NULL;
+ }
+
iounmap(gtt->gsm);
teardown_scratch_page(vm->dev);
+
}
static int i915_gmch_probe(struct drm_device *dev,
--
1.8.1.4
More information about the Intel-gfx
mailing list