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

drm/i915: Allow PPGTT enable to fail

I'm really not happy that we have to support this, but this will be the
simplest way to handle cases where PPGTT init can fail, which I promise
will be coming in the future.

v2: Resolve conflicts due to patch series reordering.

Signed-off-by: Ben Widawsky <ben@bwidawsk.net> (v1)
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent 5963cf04
...@@ -927,8 +927,11 @@ int i915_reset(struct drm_device *dev) ...@@ -927,8 +927,11 @@ int i915_reset(struct drm_device *dev)
ring->init(ring); ring->init(ring);
i915_gem_context_init(dev); i915_gem_context_init(dev);
if (dev_priv->mm.aliasing_ppgtt) if (dev_priv->mm.aliasing_ppgtt) {
dev_priv->mm.aliasing_ppgtt->enable(dev); ret = dev_priv->mm.aliasing_ppgtt->enable(dev);
if (ret)
i915_gem_cleanup_aliasing_ppgtt(dev);
}
/* /*
* It would make sense to re-init all the other hw state, at * It would make sense to re-init all the other hw state, at
......
...@@ -449,7 +449,7 @@ struct i915_hw_ppgtt { ...@@ -449,7 +449,7 @@ struct i915_hw_ppgtt {
struct sg_table *st, struct sg_table *st,
unsigned int pg_start, unsigned int pg_start,
enum i915_cache_level cache_level); enum i915_cache_level cache_level);
void (*enable)(struct drm_device *dev); int (*enable)(struct drm_device *dev);
void (*cleanup)(struct i915_hw_ppgtt *ppgtt); void (*cleanup)(struct i915_hw_ppgtt *ppgtt);
}; };
......
...@@ -4029,8 +4029,13 @@ i915_gem_init_hw(struct drm_device *dev) ...@@ -4029,8 +4029,13 @@ i915_gem_init_hw(struct drm_device *dev)
* contexts before PPGTT. * contexts before PPGTT.
*/ */
i915_gem_context_init(dev); i915_gem_context_init(dev);
if (dev_priv->mm.aliasing_ppgtt) if (dev_priv->mm.aliasing_ppgtt) {
dev_priv->mm.aliasing_ppgtt->enable(dev); 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");
}
}
return 0; return 0;
} }
......
...@@ -75,7 +75,7 @@ static inline gen6_gtt_pte_t gen6_pte_encode(struct drm_device *dev, ...@@ -75,7 +75,7 @@ static inline gen6_gtt_pte_t gen6_pte_encode(struct drm_device *dev,
return pte; return pte;
} }
static void gen6_ppgtt_enable(struct drm_device *dev) static int gen6_ppgtt_enable(struct drm_device *dev)
{ {
drm_i915_private_t *dev_priv = dev->dev_private; drm_i915_private_t *dev_priv = dev->dev_private;
uint32_t pd_offset; uint32_t pd_offset;
...@@ -128,6 +128,7 @@ static void gen6_ppgtt_enable(struct drm_device *dev) ...@@ -128,6 +128,7 @@ static void gen6_ppgtt_enable(struct drm_device *dev)
I915_WRITE(RING_PP_DIR_DCLV(ring), PP_DIR_DCLV_2G); I915_WRITE(RING_PP_DIR_DCLV(ring), PP_DIR_DCLV_2G);
I915_WRITE(RING_PP_DIR_BASE(ring), pd_offset); I915_WRITE(RING_PP_DIR_BASE(ring), pd_offset);
} }
return 0;
} }
/* PPGTT support for Sandybdrige/Gen6 and later */ /* PPGTT support for Sandybdrige/Gen6 and later */
......
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