Skip to content

Commit 1fac1fa

Browse files
committed
Merge branch 'drm-fixes' of git://people.freedesktop.org/~airlied/linux
Pull drm fixes from Dave Airlie: "I didn't want these to wait for stable cycle. The nouveau and radeon ones are the same problem, where the runtime pm stuff broke non-runtime pm managed secondary GPUs. The udl fix is for an oops on unplug, and the i915 fix is for a regression on Sandybridge even though it may break haswell (regression wins)" Daniel Vetter comments: "My apologies for the i915 regression fumble, that thing somehow fell through the cracks here for almost half a year :( Imo that's more than enough flailing to just go ahead with the revert, and the re-broken hsw should get peoples attention ..." * 'drm-fixes' of git://people.freedesktop.org/~airlied/linux: drm/i915: Undo gtt scratch pte unmapping again drm/radeon: fix runtime suspend breaking secondary GPUs drm/nouveau: fail runtime pm properly. drm/udl: take reference to device struct for dma-bufs
2 parents 350bb4b + 8ee661b commit 1fac1fa

File tree

4 files changed

+31
-13
lines changed

4 files changed

+31
-13
lines changed

drivers/gpu/drm/i915/i915_gem_gtt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -842,7 +842,7 @@ void i915_gem_suspend_gtt_mappings(struct drm_device *dev)
842842
dev_priv->gtt.base.clear_range(&dev_priv->gtt.base,
843843
dev_priv->gtt.base.start / PAGE_SIZE,
844844
dev_priv->gtt.base.total / PAGE_SIZE,
845-
false);
845+
true);
846846
}
847847

848848
void i915_gem_restore_gtt_mappings(struct drm_device *dev)

drivers/gpu/drm/nouveau/nouveau_drm.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -866,13 +866,16 @@ static int nouveau_pmops_runtime_suspend(struct device *dev)
866866
struct drm_device *drm_dev = pci_get_drvdata(pdev);
867867
int ret;
868868

869-
if (nouveau_runtime_pm == 0)
870-
return -EINVAL;
869+
if (nouveau_runtime_pm == 0) {
870+
pm_runtime_forbid(dev);
871+
return -EBUSY;
872+
}
871873

872874
/* are we optimus enabled? */
873875
if (nouveau_runtime_pm == -1 && !nouveau_is_optimus() && !nouveau_is_v1_dsm()) {
874876
DRM_DEBUG_DRIVER("failing to power off - not optimus\n");
875-
return -EINVAL;
877+
pm_runtime_forbid(dev);
878+
return -EBUSY;
876879
}
877880

878881
nv_debug_level(SILENT);
@@ -923,12 +926,15 @@ static int nouveau_pmops_runtime_idle(struct device *dev)
923926
struct nouveau_drm *drm = nouveau_drm(drm_dev);
924927
struct drm_crtc *crtc;
925928

926-
if (nouveau_runtime_pm == 0)
929+
if (nouveau_runtime_pm == 0) {
930+
pm_runtime_forbid(dev);
927931
return -EBUSY;
932+
}
928933

929934
/* are we optimus enabled? */
930935
if (nouveau_runtime_pm == -1 && !nouveau_is_optimus() && !nouveau_is_v1_dsm()) {
931936
DRM_DEBUG_DRIVER("failing to power off - not optimus\n");
937+
pm_runtime_forbid(dev);
932938
return -EBUSY;
933939
}
934940

drivers/gpu/drm/radeon/radeon_drv.c

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -403,11 +403,15 @@ static int radeon_pmops_runtime_suspend(struct device *dev)
403403
struct drm_device *drm_dev = pci_get_drvdata(pdev);
404404
int ret;
405405

406-
if (radeon_runtime_pm == 0)
407-
return -EINVAL;
406+
if (radeon_runtime_pm == 0) {
407+
pm_runtime_forbid(dev);
408+
return -EBUSY;
409+
}
408410

409-
if (radeon_runtime_pm == -1 && !radeon_is_px())
410-
return -EINVAL;
411+
if (radeon_runtime_pm == -1 && !radeon_is_px()) {
412+
pm_runtime_forbid(dev);
413+
return -EBUSY;
414+
}
411415

412416
drm_dev->switch_power_state = DRM_SWITCH_POWER_CHANGING;
413417
drm_kms_helper_poll_disable(drm_dev);
@@ -456,12 +460,15 @@ static int radeon_pmops_runtime_idle(struct device *dev)
456460
struct drm_device *drm_dev = pci_get_drvdata(pdev);
457461
struct drm_crtc *crtc;
458462

459-
if (radeon_runtime_pm == 0)
463+
if (radeon_runtime_pm == 0) {
464+
pm_runtime_forbid(dev);
460465
return -EBUSY;
466+
}
461467

462468
/* are we PX enabled? */
463469
if (radeon_runtime_pm == -1 && !radeon_is_px()) {
464470
DRM_DEBUG_DRIVER("failing to power off - not px\n");
471+
pm_runtime_forbid(dev);
465472
return -EBUSY;
466473
}
467474

drivers/gpu/drm/udl/udl_gem.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,10 @@ void udl_gem_free_object(struct drm_gem_object *gem_obj)
177177
if (obj->vmapping)
178178
udl_gem_vunmap(obj);
179179

180-
if (gem_obj->import_attach)
180+
if (gem_obj->import_attach) {
181181
drm_prime_gem_destroy(gem_obj, obj->sg);
182+
put_device(gem_obj->dev->dev);
183+
}
182184

183185
if (obj->pages)
184186
udl_gem_put_pages(obj);
@@ -256,9 +258,12 @@ struct drm_gem_object *udl_gem_prime_import(struct drm_device *dev,
256258
int ret;
257259

258260
/* need to attach */
261+
get_device(dev->dev);
259262
attach = dma_buf_attach(dma_buf, dev->dev);
260-
if (IS_ERR(attach))
263+
if (IS_ERR(attach)) {
264+
put_device(dev->dev);
261265
return ERR_CAST(attach);
266+
}
262267

263268
get_dma_buf(dma_buf);
264269

@@ -282,6 +287,6 @@ struct drm_gem_object *udl_gem_prime_import(struct drm_device *dev,
282287
fail_detach:
283288
dma_buf_detach(dma_buf, attach);
284289
dma_buf_put(dma_buf);
285-
290+
put_device(dev->dev);
286291
return ERR_PTR(ret);
287292
}

0 commit comments

Comments
 (0)