diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2011-03-29 05:40:27 -0400 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2011-05-10 16:56:44 -0400 |
commit | 2c7111dbaec72b01c804afb8ad77c6c7523986fd (patch) | |
tree | 28cea6c8bd6049343992bddc28417d20cdbc5833 | |
parent | 9c23f7fc4cef14b46830b7f9eb0dc1b2d6f55d4d (diff) |
drm/i915: Disable all outputs early, before KMS takeover
If the outputs are active and continuing to access the GATT when we
teardown the PTEs, then there is a potential for us to hang the GPU.
The hang tends to be a PGTBL_ER with either an invalid host access or
an invalid display plane fetch.
v2: Reorder IRQ initialisation to defer until after GEM is setup.
Reported-by: Pekka Enberg <penberg@kernel.org>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Tested-by: Daniel Vetter <daniel.vetter@ffwll.ch> (855GM)
Tested-by: Pekka Enberg <penberg@kernel.org>
# note that this doesn't fix the underlying problem of the
PGTBL_ER and pipe underruns being reported immediately upon
init on his 965GM MacBook
Reported-and-tested-by: Rick Bramley <richard.bramley@hp.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=35635
Reported-and-tested-by: Zdenek Kabelac <zdenek.kabelac@gmail.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=36048
Reviewed-by: Ben Widawsky <ben@bwidawsk.net>
-rw-r--r-- | drivers/gpu/drm/i915/i915_dma.c | 31 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/i915_drv.h | 1 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/intel_display.c | 17 |
3 files changed, 34 insertions, 15 deletions
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c index 64c6f67777f8..01ca0e97bebf 100644 --- a/drivers/gpu/drm/i915/i915_dma.c +++ b/drivers/gpu/drm/i915/i915_dma.c | |||
@@ -1176,11 +1176,11 @@ static bool i915_switcheroo_can_switch(struct pci_dev *pdev) | |||
1176 | return can_switch; | 1176 | return can_switch; |
1177 | } | 1177 | } |
1178 | 1178 | ||
1179 | static int i915_load_modeset_init(struct drm_device *dev) | 1179 | static int i915_load_gem_init(struct drm_device *dev) |
1180 | { | 1180 | { |
1181 | struct drm_i915_private *dev_priv = dev->dev_private; | 1181 | struct drm_i915_private *dev_priv = dev->dev_private; |
1182 | unsigned long prealloc_size, gtt_size, mappable_size; | 1182 | unsigned long prealloc_size, gtt_size, mappable_size; |
1183 | int ret = 0; | 1183 | int ret; |
1184 | 1184 | ||
1185 | prealloc_size = dev_priv->mm.gtt->stolen_size; | 1185 | prealloc_size = dev_priv->mm.gtt->stolen_size; |
1186 | gtt_size = dev_priv->mm.gtt->gtt_total_entries << PAGE_SHIFT; | 1186 | gtt_size = dev_priv->mm.gtt->gtt_total_entries << PAGE_SHIFT; |
@@ -1204,7 +1204,7 @@ static int i915_load_modeset_init(struct drm_device *dev) | |||
1204 | ret = i915_gem_init_ringbuffer(dev); | 1204 | ret = i915_gem_init_ringbuffer(dev); |
1205 | mutex_unlock(&dev->struct_mutex); | 1205 | mutex_unlock(&dev->struct_mutex); |
1206 | if (ret) | 1206 | if (ret) |
1207 | goto out; | 1207 | return ret; |
1208 | 1208 | ||
1209 | /* Try to set up FBC with a reasonable compressed buffer size */ | 1209 | /* Try to set up FBC with a reasonable compressed buffer size */ |
1210 | if (I915_HAS_FBC(dev) && i915_powersave) { | 1210 | if (I915_HAS_FBC(dev) && i915_powersave) { |
@@ -1222,6 +1222,13 @@ static int i915_load_modeset_init(struct drm_device *dev) | |||
1222 | 1222 | ||
1223 | /* Allow hardware batchbuffers unless told otherwise. */ | 1223 | /* Allow hardware batchbuffers unless told otherwise. */ |
1224 | dev_priv->allow_batchbuffer = 1; | 1224 | dev_priv->allow_batchbuffer = 1; |
1225 | return 0; | ||
1226 | } | ||
1227 | |||
1228 | static int i915_load_modeset_init(struct drm_device *dev) | ||
1229 | { | ||
1230 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
1231 | int ret; | ||
1225 | 1232 | ||
1226 | ret = intel_parse_bios(dev); | 1233 | ret = intel_parse_bios(dev); |
1227 | if (ret) | 1234 | if (ret) |
@@ -1236,7 +1243,7 @@ static int i915_load_modeset_init(struct drm_device *dev) | |||
1236 | */ | 1243 | */ |
1237 | ret = vga_client_register(dev->pdev, dev, NULL, i915_vga_set_decode); | 1244 | ret = vga_client_register(dev->pdev, dev, NULL, i915_vga_set_decode); |
1238 | if (ret && ret != -ENODEV) | 1245 | if (ret && ret != -ENODEV) |
1239 | goto cleanup_ringbuffer; | 1246 | goto out; |
1240 | 1247 | ||
1241 | intel_register_dsm_handler(); | 1248 | intel_register_dsm_handler(); |
1242 | 1249 | ||
@@ -1253,10 +1260,16 @@ static int i915_load_modeset_init(struct drm_device *dev) | |||
1253 | 1260 | ||
1254 | intel_modeset_init(dev); | 1261 | intel_modeset_init(dev); |
1255 | 1262 | ||
1256 | ret = drm_irq_install(dev); | 1263 | ret = i915_load_gem_init(dev); |
1257 | if (ret) | 1264 | if (ret) |
1258 | goto cleanup_vga_switcheroo; | 1265 | goto cleanup_vga_switcheroo; |
1259 | 1266 | ||
1267 | intel_modeset_gem_init(dev); | ||
1268 | |||
1269 | ret = drm_irq_install(dev); | ||
1270 | if (ret) | ||
1271 | goto cleanup_gem; | ||
1272 | |||
1260 | /* Always safe in the mode setting case. */ | 1273 | /* Always safe in the mode setting case. */ |
1261 | /* FIXME: do pre/post-mode set stuff in core KMS code */ | 1274 | /* FIXME: do pre/post-mode set stuff in core KMS code */ |
1262 | dev->vblank_disable_allowed = 1; | 1275 | dev->vblank_disable_allowed = 1; |
@@ -1274,14 +1287,14 @@ static int i915_load_modeset_init(struct drm_device *dev) | |||
1274 | 1287 | ||
1275 | cleanup_irq: | 1288 | cleanup_irq: |
1276 | drm_irq_uninstall(dev); | 1289 | drm_irq_uninstall(dev); |
1290 | cleanup_gem: | ||
1291 | mutex_lock(&dev->struct_mutex); | ||
1292 | i915_gem_cleanup_ringbuffer(dev); | ||
1293 | mutex_unlock(&dev->struct_mutex); | ||
1277 | cleanup_vga_switcheroo: | 1294 | cleanup_vga_switcheroo: |
1278 | vga_switcheroo_unregister_client(dev->pdev); | 1295 | vga_switcheroo_unregister_client(dev->pdev); |
1279 | cleanup_vga_client: | 1296 | cleanup_vga_client: |
1280 | vga_client_register(dev->pdev, NULL, NULL, NULL); | 1297 | vga_client_register(dev->pdev, NULL, NULL, NULL); |
1281 | cleanup_ringbuffer: | ||
1282 | mutex_lock(&dev->struct_mutex); | ||
1283 | i915_gem_cleanup_ringbuffer(dev); | ||
1284 | mutex_unlock(&dev->struct_mutex); | ||
1285 | out: | 1298 | out: |
1286 | return ret; | 1299 | return ret; |
1287 | } | 1300 | } |
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 7a791f8a92bb..4b862f366904 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h | |||
@@ -1277,6 +1277,7 @@ static inline void intel_unregister_dsm_handler(void) { return; } | |||
1277 | 1277 | ||
1278 | /* modesetting */ | 1278 | /* modesetting */ |
1279 | extern void intel_modeset_init(struct drm_device *dev); | 1279 | extern void intel_modeset_init(struct drm_device *dev); |
1280 | extern void intel_modeset_gem_init(struct drm_device *dev); | ||
1280 | extern void intel_modeset_cleanup(struct drm_device *dev); | 1281 | extern void intel_modeset_cleanup(struct drm_device *dev); |
1281 | extern int intel_modeset_vga_set_state(struct drm_device *dev, bool state); | 1282 | extern int intel_modeset_vga_set_state(struct drm_device *dev, bool state); |
1282 | extern void i8xx_disable_fbc(struct drm_device *dev); | 1283 | extern void i8xx_disable_fbc(struct drm_device *dev); |
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index e99ae3bd1064..a38fb3998ad1 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -6627,6 +6627,9 @@ static void intel_setup_outputs(struct drm_device *dev) | |||
6627 | } | 6627 | } |
6628 | 6628 | ||
6629 | intel_panel_setup_backlight(dev); | 6629 | intel_panel_setup_backlight(dev); |
6630 | |||
6631 | /* disable all the possible outputs/crtcs before entering KMS mode */ | ||
6632 | drm_helper_disable_unused_functions(dev); | ||
6630 | } | 6633 | } |
6631 | 6634 | ||
6632 | static void intel_user_framebuffer_destroy(struct drm_framebuffer *fb) | 6635 | static void intel_user_framebuffer_destroy(struct drm_framebuffer *fb) |
@@ -7573,13 +7576,12 @@ void intel_modeset_init(struct drm_device *dev) | |||
7573 | intel_crtc_init(dev, i); | 7576 | intel_crtc_init(dev, i); |
7574 | } | 7577 | } |
7575 | 7578 | ||
7579 | /* Just disable it once at startup */ | ||
7580 | i915_disable_vga(dev); | ||
7576 | intel_setup_outputs(dev); | 7581 | intel_setup_outputs(dev); |
7577 | 7582 | ||
7578 | intel_enable_clock_gating(dev); | 7583 | intel_enable_clock_gating(dev); |
7579 | 7584 | ||
7580 | /* Just disable it once at startup */ | ||
7581 | i915_disable_vga(dev); | ||
7582 | |||
7583 | if (IS_IRONLAKE_M(dev)) { | 7585 | if (IS_IRONLAKE_M(dev)) { |
7584 | ironlake_enable_drps(dev); | 7586 | ironlake_enable_drps(dev); |
7585 | intel_init_emon(dev); | 7587 | intel_init_emon(dev); |
@@ -7588,12 +7590,15 @@ void intel_modeset_init(struct drm_device *dev) | |||
7588 | if (IS_GEN6(dev)) | 7590 | if (IS_GEN6(dev)) |
7589 | gen6_enable_rps(dev_priv); | 7591 | gen6_enable_rps(dev_priv); |
7590 | 7592 | ||
7591 | if (IS_IRONLAKE_M(dev)) | ||
7592 | ironlake_enable_rc6(dev); | ||
7593 | |||
7594 | INIT_WORK(&dev_priv->idle_work, intel_idle_update); | 7593 | INIT_WORK(&dev_priv->idle_work, intel_idle_update); |
7595 | setup_timer(&dev_priv->idle_timer, intel_gpu_idle_timer, | 7594 | setup_timer(&dev_priv->idle_timer, intel_gpu_idle_timer, |
7596 | (unsigned long)dev); | 7595 | (unsigned long)dev); |
7596 | } | ||
7597 | |||
7598 | void intel_modeset_gem_init(struct drm_device *dev) | ||
7599 | { | ||
7600 | if (IS_IRONLAKE_M(dev)) | ||
7601 | ironlake_enable_rc6(dev); | ||
7597 | 7602 | ||
7598 | intel_setup_overlay(dev); | 7603 | intel_setup_overlay(dev); |
7599 | } | 7604 | } |