aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2016-11-04 16:30:13 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2016-11-04 16:30:13 -0400
commitd4c5f43dcd05529236a0f957b27d2597c24e5f69 (patch)
treebc7e29c358bc1e557799a6d3b2dc38ddfa619ac7
parent66cecb67894b35c6af17eb4e6b6aaec6c8957c2e (diff)
parent7ec30fca2c966293c4593e20459861b106fd62e9 (diff)
Merge tag 'drm-fixes-for-v4.9-rc4' of git://people.freedesktop.org/~airlied/linux
Pull drm fixes from Dave Airlie: "Fixes for amdgpu, radeon, intel, imx and virtio-gpu. This is a bit larger than I'd like, but I had some stuff I meant to send for -rc3 but was waiting for the PAT regression fix to land. So this is really fixes for rc3 and rc4 in one go. There are a set of fixes for an oops we've been seeing around MST display unplug, along with more suspend/resume and shutdown fixes for amdgpu, one power management follow on fix for nouveau, and set of imx fixes, and a single virtio-gpu regression fix" * tag 'drm-fixes-for-v4.9-rc4' of git://people.freedesktop.org/~airlied/linux: (54 commits) virtio-gpu: fix vblank events drm/nouveau/acpi: fix check for power resources support drm/i915: Fix SKL+ 90/270 degree rotated plane coordinate computation drm/i915: Remove two invalid warns drm/i915: Rotated view does not need a fence drm/i915/fbc: fix CFB size calculation for gen8+ drm: i915: Wait for fences on new fb, not old drm/i915: Clean up DDI DDC/AUX CH sanitation drm/i915: Respect alternate_aux_channel for all DDI ports drm/i915/gen9: fix watermarks when using the pipe scaler drm/i915: Fix mismatched INIT power domain disabling during suspend drm/i915: fix a read size argument drm/i915: Use fence_write() from rpm resume drm/i915/gen9: fix DDB partitioning for multi-screen cases drm/i915: workaround sparse warning on variable length arrays drm/i915: keep declarations in i915_drv.h drm/amd/powerplay: fix bug get wrong evv voltage of Polaris. drm/amdgpu/si_dpm: workaround for SI kickers drm/radeon/si_dpm: workaround for SI kickers drm/amdgpu: fix s3 resume back, uvd dpm randomly can't disable. ...
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c3
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_device.c9
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c1
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c2
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c6
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c1
-rw-r--r--drivers/gpu/drm/amd/amdgpu/ci_dpm.c4
-rw-r--r--drivers/gpu/drm/amd/amdgpu/dce_v10_0.c6
-rw-r--r--drivers/gpu/drm/amd/amdgpu/dce_v11_0.c6
-rw-r--r--drivers/gpu/drm/amd/amdgpu/dce_v6_0.c6
-rw-r--r--drivers/gpu/drm/amd/amdgpu/dce_v8_0.c6
-rw-r--r--drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c1
-rw-r--r--drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c1
-rw-r--r--drivers/gpu/drm/amd/amdgpu/kv_dpm.c2
-rw-r--r--drivers/gpu/drm/amd/amdgpu/si_dpm.c61
-rw-r--r--drivers/gpu/drm/amd/amdgpu/vce_v3_0.c6
-rw-r--r--drivers/gpu/drm/amd/amdgpu/vi.c2
-rw-r--r--drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c2
-rw-r--r--drivers/gpu/drm/amd/powerplay/hwmgr/ppatomctrl.c3
-rw-r--r--drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c9
-rw-r--r--drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c17
-rw-r--r--drivers/gpu/drm/amd/scheduler/gpu_scheduler.c1
-rw-r--r--drivers/gpu/drm/amd/scheduler/sched_fence.c4
-rw-r--r--drivers/gpu/drm/drm_atomic.c9
-rw-r--r--drivers/gpu/drm/drm_atomic_helper.c4
-rw-r--r--drivers/gpu/drm/drm_dp_mst_topology.c6
-rw-r--r--drivers/gpu/drm/drm_fb_helper.c68
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_drv.c20
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_drv.h1
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_fb.c2
-rw-r--r--drivers/gpu/drm/i915/i915_drv.c4
-rw-r--r--drivers/gpu/drm/i915/i915_drv.h5
-rw-r--r--drivers/gpu/drm/i915/i915_gem.c10
-rw-r--r--drivers/gpu/drm/i915/i915_gem_fence.c21
-rw-r--r--drivers/gpu/drm/i915/i915_pci.c7
-rw-r--r--drivers/gpu/drm/i915/intel_bios.c122
-rw-r--r--drivers/gpu/drm/i915/intel_device_info.c2
-rw-r--r--drivers/gpu/drm/i915/intel_display.c5
-rw-r--r--drivers/gpu/drm/i915/intel_dp.c75
-rw-r--r--drivers/gpu/drm/i915/intel_fbc.c4
-rw-r--r--drivers/gpu/drm/i915/intel_pm.c24
-rw-r--r--drivers/gpu/drm/imx/imx-drm-core.c6
-rw-r--r--drivers/gpu/drm/imx/ipuv3-plane.c28
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_acpi.c3
-rw-r--r--drivers/gpu/drm/radeon/ni.c4
-rw-r--r--drivers/gpu/drm/radeon/radeon_dp_auxch.c2
-rw-r--r--drivers/gpu/drm/radeon/si_dpm.c53
-rw-r--r--drivers/gpu/drm/rcar-du/rcar_du_kms.c12
-rw-r--r--drivers/gpu/drm/sti/sti_drv.c22
-rw-r--r--drivers/gpu/drm/virtio/virtgpu_display.c3
-rw-r--r--drivers/gpu/ipu-v3/ipu-image-convert.c2
-rw-r--r--include/drm/drm_plane.h8
52 files changed, 450 insertions, 241 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
index b0f6e6957536..82dc8d20e28a 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
@@ -519,7 +519,8 @@ static int amdgpu_cs_parser_bos(struct amdgpu_cs_parser *p,
519 r = ttm_eu_reserve_buffers(&p->ticket, &p->validated, true, 519 r = ttm_eu_reserve_buffers(&p->ticket, &p->validated, true,
520 &duplicates); 520 &duplicates);
521 if (unlikely(r != 0)) { 521 if (unlikely(r != 0)) {
522 DRM_ERROR("ttm_eu_reserve_buffers failed.\n"); 522 if (r != -ERESTARTSYS)
523 DRM_ERROR("ttm_eu_reserve_buffers failed.\n");
523 goto error_free_pages; 524 goto error_free_pages;
524 } 525 }
525 526
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index b4f4a9239069..7ca07e7b25c1 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -1959,6 +1959,7 @@ int amdgpu_device_suspend(struct drm_device *dev, bool suspend, bool fbcon)
1959 /* evict remaining vram memory */ 1959 /* evict remaining vram memory */
1960 amdgpu_bo_evict_vram(adev); 1960 amdgpu_bo_evict_vram(adev);
1961 1961
1962 amdgpu_atombios_scratch_regs_save(adev);
1962 pci_save_state(dev->pdev); 1963 pci_save_state(dev->pdev);
1963 if (suspend) { 1964 if (suspend) {
1964 /* Shut down the device */ 1965 /* Shut down the device */
@@ -2010,6 +2011,7 @@ int amdgpu_device_resume(struct drm_device *dev, bool resume, bool fbcon)
2010 return r; 2011 return r;
2011 } 2012 }
2012 } 2013 }
2014 amdgpu_atombios_scratch_regs_restore(adev);
2013 2015
2014 /* post card */ 2016 /* post card */
2015 if (!amdgpu_card_posted(adev) || !resume) { 2017 if (!amdgpu_card_posted(adev) || !resume) {
@@ -2268,8 +2270,6 @@ int amdgpu_gpu_reset(struct amdgpu_device *adev)
2268 } 2270 }
2269 2271
2270 if (need_full_reset) { 2272 if (need_full_reset) {
2271 /* save scratch */
2272 amdgpu_atombios_scratch_regs_save(adev);
2273 r = amdgpu_suspend(adev); 2273 r = amdgpu_suspend(adev);
2274 2274
2275retry: 2275retry:
@@ -2279,8 +2279,9 @@ retry:
2279 amdgpu_display_stop_mc_access(adev, &save); 2279 amdgpu_display_stop_mc_access(adev, &save);
2280 amdgpu_wait_for_idle(adev, AMD_IP_BLOCK_TYPE_GMC); 2280 amdgpu_wait_for_idle(adev, AMD_IP_BLOCK_TYPE_GMC);
2281 } 2281 }
2282 2282 amdgpu_atombios_scratch_regs_save(adev);
2283 r = amdgpu_asic_reset(adev); 2283 r = amdgpu_asic_reset(adev);
2284 amdgpu_atombios_scratch_regs_restore(adev);
2284 /* post card */ 2285 /* post card */
2285 amdgpu_atom_asic_init(adev->mode_info.atom_context); 2286 amdgpu_atom_asic_init(adev->mode_info.atom_context);
2286 2287
@@ -2288,8 +2289,6 @@ retry:
2288 dev_info(adev->dev, "GPU reset succeeded, trying to resume\n"); 2289 dev_info(adev->dev, "GPU reset succeeded, trying to resume\n");
2289 r = amdgpu_resume(adev); 2290 r = amdgpu_resume(adev);
2290 } 2291 }
2291 /* restore scratch */
2292 amdgpu_atombios_scratch_regs_restore(adev);
2293 } 2292 }
2294 if (!r) { 2293 if (!r) {
2295 amdgpu_irq_gpu_reset_resume_helper(adev); 2294 amdgpu_irq_gpu_reset_resume_helper(adev);
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
index 3a2e42f4b897..77b34ec92632 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
@@ -68,6 +68,7 @@ int amdgpu_fence_slab_init(void)
68 68
69void amdgpu_fence_slab_fini(void) 69void amdgpu_fence_slab_fini(void)
70{ 70{
71 rcu_barrier();
71 kmem_cache_destroy(amdgpu_fence_slab); 72 kmem_cache_destroy(amdgpu_fence_slab);
72} 73}
73/* 74/*
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
index 278708f5a744..9fa809876339 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
@@ -239,6 +239,7 @@ int amdgpu_irq_init(struct amdgpu_device *adev)
239 if (r) { 239 if (r) {
240 adev->irq.installed = false; 240 adev->irq.installed = false;
241 flush_work(&adev->hotplug_work); 241 flush_work(&adev->hotplug_work);
242 cancel_work_sync(&adev->reset_work);
242 return r; 243 return r;
243 } 244 }
244 245
@@ -264,6 +265,7 @@ void amdgpu_irq_fini(struct amdgpu_device *adev)
264 if (adev->irq.msi_enabled) 265 if (adev->irq.msi_enabled)
265 pci_disable_msi(adev->pdev); 266 pci_disable_msi(adev->pdev);
266 flush_work(&adev->hotplug_work); 267 flush_work(&adev->hotplug_work);
268 cancel_work_sync(&adev->reset_work);
267 } 269 }
268 270
269 for (i = 0; i < AMDGPU_MAX_IRQ_SRC_ID; ++i) { 271 for (i = 0; i < AMDGPU_MAX_IRQ_SRC_ID; ++i) {
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
index c2c7fb140338..203d98b00555 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
@@ -459,10 +459,8 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file
459 /* return all clocks in KHz */ 459 /* return all clocks in KHz */
460 dev_info.gpu_counter_freq = amdgpu_asic_get_xclk(adev) * 10; 460 dev_info.gpu_counter_freq = amdgpu_asic_get_xclk(adev) * 10;
461 if (adev->pm.dpm_enabled) { 461 if (adev->pm.dpm_enabled) {
462 dev_info.max_engine_clock = 462 dev_info.max_engine_clock = amdgpu_dpm_get_sclk(adev, false) * 10;
463 adev->pm.dpm.dyn_state.max_clock_voltage_on_ac.sclk * 10; 463 dev_info.max_memory_clock = amdgpu_dpm_get_mclk(adev, false) * 10;
464 dev_info.max_memory_clock =
465 adev->pm.dpm.dyn_state.max_clock_voltage_on_ac.mclk * 10;
466 } else { 464 } else {
467 dev_info.max_engine_clock = adev->pm.default_sclk * 10; 465 dev_info.max_engine_clock = adev->pm.default_sclk * 10;
468 dev_info.max_memory_clock = adev->pm.default_mclk * 10; 466 dev_info.max_memory_clock = adev->pm.default_mclk * 10;
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
index 06f24322e7c3..968c4260d7a7 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
@@ -1758,5 +1758,6 @@ void amdgpu_vm_manager_fini(struct amdgpu_device *adev)
1758 fence_put(adev->vm_manager.ids[i].first); 1758 fence_put(adev->vm_manager.ids[i].first);
1759 amdgpu_sync_free(&adev->vm_manager.ids[i].active); 1759 amdgpu_sync_free(&adev->vm_manager.ids[i].active);
1760 fence_put(id->flushed_updates); 1760 fence_put(id->flushed_updates);
1761 fence_put(id->last_flush);
1761 } 1762 }
1762} 1763}
diff --git a/drivers/gpu/drm/amd/amdgpu/ci_dpm.c b/drivers/gpu/drm/amd/amdgpu/ci_dpm.c
index 1d8c375a3561..5be788b269e2 100644
--- a/drivers/gpu/drm/amd/amdgpu/ci_dpm.c
+++ b/drivers/gpu/drm/amd/amdgpu/ci_dpm.c
@@ -4075,7 +4075,7 @@ static int ci_enable_uvd_dpm(struct amdgpu_device *adev, bool enable)
4075 pi->dpm_level_enable_mask.mclk_dpm_enable_mask); 4075 pi->dpm_level_enable_mask.mclk_dpm_enable_mask);
4076 } 4076 }
4077 } else { 4077 } else {
4078 if (pi->last_mclk_dpm_enable_mask & 0x1) { 4078 if (pi->uvd_enabled) {
4079 pi->uvd_enabled = false; 4079 pi->uvd_enabled = false;
4080 pi->dpm_level_enable_mask.mclk_dpm_enable_mask |= 1; 4080 pi->dpm_level_enable_mask.mclk_dpm_enable_mask |= 1;
4081 amdgpu_ci_send_msg_to_smc_with_parameter(adev, 4081 amdgpu_ci_send_msg_to_smc_with_parameter(adev,
@@ -6236,6 +6236,8 @@ static int ci_dpm_sw_fini(void *handle)
6236{ 6236{
6237 struct amdgpu_device *adev = (struct amdgpu_device *)handle; 6237 struct amdgpu_device *adev = (struct amdgpu_device *)handle;
6238 6238
6239 flush_work(&adev->pm.dpm.thermal.work);
6240
6239 mutex_lock(&adev->pm.mutex); 6241 mutex_lock(&adev->pm.mutex);
6240 amdgpu_pm_sysfs_fini(adev); 6242 amdgpu_pm_sysfs_fini(adev);
6241 ci_dpm_fini(adev); 6243 ci_dpm_fini(adev);
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
index 4108c686aa7c..9260caef74fa 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
@@ -3151,10 +3151,6 @@ static int dce_v10_0_hw_fini(void *handle)
3151 3151
3152static int dce_v10_0_suspend(void *handle) 3152static int dce_v10_0_suspend(void *handle)
3153{ 3153{
3154 struct amdgpu_device *adev = (struct amdgpu_device *)handle;
3155
3156 amdgpu_atombios_scratch_regs_save(adev);
3157
3158 return dce_v10_0_hw_fini(handle); 3154 return dce_v10_0_hw_fini(handle);
3159} 3155}
3160 3156
@@ -3165,8 +3161,6 @@ static int dce_v10_0_resume(void *handle)
3165 3161
3166 ret = dce_v10_0_hw_init(handle); 3162 ret = dce_v10_0_hw_init(handle);
3167 3163
3168 amdgpu_atombios_scratch_regs_restore(adev);
3169
3170 /* turn on the BL */ 3164 /* turn on the BL */
3171 if (adev->mode_info.bl_encoder) { 3165 if (adev->mode_info.bl_encoder) {
3172 u8 bl_level = amdgpu_display_backlight_get_level(adev, 3166 u8 bl_level = amdgpu_display_backlight_get_level(adev,
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
index f264b8f17ad1..367739bd1927 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
@@ -3215,10 +3215,6 @@ static int dce_v11_0_hw_fini(void *handle)
3215 3215
3216static int dce_v11_0_suspend(void *handle) 3216static int dce_v11_0_suspend(void *handle)
3217{ 3217{
3218 struct amdgpu_device *adev = (struct amdgpu_device *)handle;
3219
3220 amdgpu_atombios_scratch_regs_save(adev);
3221
3222 return dce_v11_0_hw_fini(handle); 3218 return dce_v11_0_hw_fini(handle);
3223} 3219}
3224 3220
@@ -3229,8 +3225,6 @@ static int dce_v11_0_resume(void *handle)
3229 3225
3230 ret = dce_v11_0_hw_init(handle); 3226 ret = dce_v11_0_hw_init(handle);
3231 3227
3232 amdgpu_atombios_scratch_regs_restore(adev);
3233
3234 /* turn on the BL */ 3228 /* turn on the BL */
3235 if (adev->mode_info.bl_encoder) { 3229 if (adev->mode_info.bl_encoder) {
3236 u8 bl_level = amdgpu_display_backlight_get_level(adev, 3230 u8 bl_level = amdgpu_display_backlight_get_level(adev,
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
index b948d6cb1399..15f9fc0514b2 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
@@ -2482,10 +2482,6 @@ static int dce_v6_0_hw_fini(void *handle)
2482 2482
2483static int dce_v6_0_suspend(void *handle) 2483static int dce_v6_0_suspend(void *handle)
2484{ 2484{
2485 struct amdgpu_device *adev = (struct amdgpu_device *)handle;
2486
2487 amdgpu_atombios_scratch_regs_save(adev);
2488
2489 return dce_v6_0_hw_fini(handle); 2485 return dce_v6_0_hw_fini(handle);
2490} 2486}
2491 2487
@@ -2496,8 +2492,6 @@ static int dce_v6_0_resume(void *handle)
2496 2492
2497 ret = dce_v6_0_hw_init(handle); 2493 ret = dce_v6_0_hw_init(handle);
2498 2494
2499 amdgpu_atombios_scratch_regs_restore(adev);
2500
2501 /* turn on the BL */ 2495 /* turn on the BL */
2502 if (adev->mode_info.bl_encoder) { 2496 if (adev->mode_info.bl_encoder) {
2503 u8 bl_level = amdgpu_display_backlight_get_level(adev, 2497 u8 bl_level = amdgpu_display_backlight_get_level(adev,
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
index 5966166ec94c..8c4d808db0f1 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
@@ -3033,10 +3033,6 @@ static int dce_v8_0_hw_fini(void *handle)
3033 3033
3034static int dce_v8_0_suspend(void *handle) 3034static int dce_v8_0_suspend(void *handle)
3035{ 3035{
3036 struct amdgpu_device *adev = (struct amdgpu_device *)handle;
3037
3038 amdgpu_atombios_scratch_regs_save(adev);
3039
3040 return dce_v8_0_hw_fini(handle); 3036 return dce_v8_0_hw_fini(handle);
3041} 3037}
3042 3038
@@ -3047,8 +3043,6 @@ static int dce_v8_0_resume(void *handle)
3047 3043
3048 ret = dce_v8_0_hw_init(handle); 3044 ret = dce_v8_0_hw_init(handle);
3049 3045
3050 amdgpu_atombios_scratch_regs_restore(adev);
3051
3052 /* turn on the BL */ 3046 /* turn on the BL */
3053 if (adev->mode_info.bl_encoder) { 3047 if (adev->mode_info.bl_encoder) {
3054 u8 bl_level = amdgpu_display_backlight_get_level(adev, 3048 u8 bl_level = amdgpu_display_backlight_get_level(adev,
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
index ee6a48a09214..bb97182dc749 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
@@ -640,7 +640,6 @@ static const u32 stoney_mgcg_cgcg_init[] =
640 mmCP_MEM_SLP_CNTL, 0xffffffff, 0x00020201, 640 mmCP_MEM_SLP_CNTL, 0xffffffff, 0x00020201,
641 mmRLC_MEM_SLP_CNTL, 0xffffffff, 0x00020201, 641 mmRLC_MEM_SLP_CNTL, 0xffffffff, 0x00020201,
642 mmCGTS_SM_CTRL_REG, 0xffffffff, 0x96940200, 642 mmCGTS_SM_CTRL_REG, 0xffffffff, 0x96940200,
643 mmATC_MISC_CG, 0xffffffff, 0x000c0200,
644}; 643};
645 644
646static void gfx_v8_0_set_ring_funcs(struct amdgpu_device *adev); 645static void gfx_v8_0_set_ring_funcs(struct amdgpu_device *adev);
diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c
index c22ef140a542..a16b2201d52c 100644
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c
@@ -100,6 +100,7 @@ static const u32 cz_mgcg_cgcg_init[] =
100 100
101static const u32 stoney_mgcg_cgcg_init[] = 101static const u32 stoney_mgcg_cgcg_init[] =
102{ 102{
103 mmATC_MISC_CG, 0xffffffff, 0x000c0200,
103 mmMC_MEM_POWER_LS, 0xffffffff, 0x00000104 104 mmMC_MEM_POWER_LS, 0xffffffff, 0x00000104
104}; 105};
105 106
diff --git a/drivers/gpu/drm/amd/amdgpu/kv_dpm.c b/drivers/gpu/drm/amd/amdgpu/kv_dpm.c
index f8618a3881a8..71d2856222fa 100644
--- a/drivers/gpu/drm/amd/amdgpu/kv_dpm.c
+++ b/drivers/gpu/drm/amd/amdgpu/kv_dpm.c
@@ -3063,6 +3063,8 @@ static int kv_dpm_sw_fini(void *handle)
3063{ 3063{
3064 struct amdgpu_device *adev = (struct amdgpu_device *)handle; 3064 struct amdgpu_device *adev = (struct amdgpu_device *)handle;
3065 3065
3066 flush_work(&adev->pm.dpm.thermal.work);
3067
3066 mutex_lock(&adev->pm.mutex); 3068 mutex_lock(&adev->pm.mutex);
3067 amdgpu_pm_sysfs_fini(adev); 3069 amdgpu_pm_sysfs_fini(adev);
3068 kv_dpm_fini(adev); 3070 kv_dpm_fini(adev);
diff --git a/drivers/gpu/drm/amd/amdgpu/si_dpm.c b/drivers/gpu/drm/amd/amdgpu/si_dpm.c
index 3de7bca5854b..d6f85b1a0b93 100644
--- a/drivers/gpu/drm/amd/amdgpu/si_dpm.c
+++ b/drivers/gpu/drm/amd/amdgpu/si_dpm.c
@@ -3477,6 +3477,49 @@ static void si_apply_state_adjust_rules(struct amdgpu_device *adev,
3477 int i; 3477 int i;
3478 struct si_dpm_quirk *p = si_dpm_quirk_list; 3478 struct si_dpm_quirk *p = si_dpm_quirk_list;
3479 3479
3480 /* limit all SI kickers */
3481 if (adev->asic_type == CHIP_PITCAIRN) {
3482 if ((adev->pdev->revision == 0x81) ||
3483 (adev->pdev->device == 0x6810) ||
3484 (adev->pdev->device == 0x6811) ||
3485 (adev->pdev->device == 0x6816) ||
3486 (adev->pdev->device == 0x6817) ||
3487 (adev->pdev->device == 0x6806))
3488 max_mclk = 120000;
3489 } else if (adev->asic_type == CHIP_VERDE) {
3490 if ((adev->pdev->revision == 0x81) ||
3491 (adev->pdev->revision == 0x83) ||
3492 (adev->pdev->revision == 0x87) ||
3493 (adev->pdev->device == 0x6820) ||
3494 (adev->pdev->device == 0x6821) ||
3495 (adev->pdev->device == 0x6822) ||
3496 (adev->pdev->device == 0x6823) ||
3497 (adev->pdev->device == 0x682A) ||
3498 (adev->pdev->device == 0x682B)) {
3499 max_sclk = 75000;
3500 max_mclk = 80000;
3501 }
3502 } else if (adev->asic_type == CHIP_OLAND) {
3503 if ((adev->pdev->revision == 0xC7) ||
3504 (adev->pdev->revision == 0x80) ||
3505 (adev->pdev->revision == 0x81) ||
3506 (adev->pdev->revision == 0x83) ||
3507 (adev->pdev->device == 0x6604) ||
3508 (adev->pdev->device == 0x6605)) {
3509 max_sclk = 75000;
3510 max_mclk = 80000;
3511 }
3512 } else if (adev->asic_type == CHIP_HAINAN) {
3513 if ((adev->pdev->revision == 0x81) ||
3514 (adev->pdev->revision == 0x83) ||
3515 (adev->pdev->revision == 0xC3) ||
3516 (adev->pdev->device == 0x6664) ||
3517 (adev->pdev->device == 0x6665) ||
3518 (adev->pdev->device == 0x6667)) {
3519 max_sclk = 75000;
3520 max_mclk = 80000;
3521 }
3522 }
3480 /* Apply dpm quirks */ 3523 /* Apply dpm quirks */
3481 while (p && p->chip_device != 0) { 3524 while (p && p->chip_device != 0) {
3482 if (adev->pdev->vendor == p->chip_vendor && 3525 if (adev->pdev->vendor == p->chip_vendor &&
@@ -3489,22 +3532,6 @@ static void si_apply_state_adjust_rules(struct amdgpu_device *adev,
3489 } 3532 }
3490 ++p; 3533 ++p;
3491 } 3534 }
3492 /* limit mclk on all R7 370 parts for stability */
3493 if (adev->pdev->device == 0x6811 &&
3494 adev->pdev->revision == 0x81)
3495 max_mclk = 120000;
3496 /* limit sclk/mclk on Jet parts for stability */
3497 if (adev->pdev->device == 0x6665 &&
3498 adev->pdev->revision == 0xc3) {
3499 max_sclk = 75000;
3500 max_mclk = 80000;
3501 }
3502 /* Limit clocks for some HD8600 parts */
3503 if (adev->pdev->device == 0x6660 &&
3504 adev->pdev->revision == 0x83) {
3505 max_sclk = 75000;
3506 max_mclk = 80000;
3507 }
3508 3535
3509 if (rps->vce_active) { 3536 if (rps->vce_active) {
3510 rps->evclk = adev->pm.dpm.vce_states[adev->pm.dpm.vce_level].evclk; 3537 rps->evclk = adev->pm.dpm.vce_states[adev->pm.dpm.vce_level].evclk;
@@ -7777,6 +7804,8 @@ static int si_dpm_sw_fini(void *handle)
7777{ 7804{
7778 struct amdgpu_device *adev = (struct amdgpu_device *)handle; 7805 struct amdgpu_device *adev = (struct amdgpu_device *)handle;
7779 7806
7807 flush_work(&adev->pm.dpm.thermal.work);
7808
7780 mutex_lock(&adev->pm.mutex); 7809 mutex_lock(&adev->pm.mutex);
7781 amdgpu_pm_sysfs_fini(adev); 7810 amdgpu_pm_sysfs_fini(adev);
7782 si_dpm_fini(adev); 7811 si_dpm_fini(adev);
diff --git a/drivers/gpu/drm/amd/amdgpu/vce_v3_0.c b/drivers/gpu/drm/amd/amdgpu/vce_v3_0.c
index 8533269ec160..6feed726e299 100644
--- a/drivers/gpu/drm/amd/amdgpu/vce_v3_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/vce_v3_0.c
@@ -52,6 +52,8 @@
52#define VCE_V3_0_STACK_SIZE (64 * 1024) 52#define VCE_V3_0_STACK_SIZE (64 * 1024)
53#define VCE_V3_0_DATA_SIZE ((16 * 1024 * AMDGPU_MAX_VCE_HANDLES) + (52 * 1024)) 53#define VCE_V3_0_DATA_SIZE ((16 * 1024 * AMDGPU_MAX_VCE_HANDLES) + (52 * 1024))
54 54
55#define FW_52_8_3 ((52 << 24) | (8 << 16) | (3 << 8))
56
55static void vce_v3_0_mc_resume(struct amdgpu_device *adev, int idx); 57static void vce_v3_0_mc_resume(struct amdgpu_device *adev, int idx);
56static void vce_v3_0_set_ring_funcs(struct amdgpu_device *adev); 58static void vce_v3_0_set_ring_funcs(struct amdgpu_device *adev);
57static void vce_v3_0_set_irq_funcs(struct amdgpu_device *adev); 59static void vce_v3_0_set_irq_funcs(struct amdgpu_device *adev);
@@ -382,6 +384,10 @@ static int vce_v3_0_sw_init(void *handle)
382 if (r) 384 if (r)
383 return r; 385 return r;
384 386
387 /* 52.8.3 required for 3 ring support */
388 if (adev->vce.fw_version < FW_52_8_3)
389 adev->vce.num_rings = 2;
390
385 r = amdgpu_vce_resume(adev); 391 r = amdgpu_vce_resume(adev);
386 if (r) 392 if (r)
387 return r; 393 return r;
diff --git a/drivers/gpu/drm/amd/amdgpu/vi.c b/drivers/gpu/drm/amd/amdgpu/vi.c
index c0d9aad7126f..7c13090df7c0 100644
--- a/drivers/gpu/drm/amd/amdgpu/vi.c
+++ b/drivers/gpu/drm/amd/amdgpu/vi.c
@@ -1651,7 +1651,7 @@ static int vi_common_early_init(void *handle)
1651 AMD_CG_SUPPORT_SDMA_MGCG | 1651 AMD_CG_SUPPORT_SDMA_MGCG |
1652 AMD_CG_SUPPORT_SDMA_LS | 1652 AMD_CG_SUPPORT_SDMA_LS |
1653 AMD_CG_SUPPORT_VCE_MGCG; 1653 AMD_CG_SUPPORT_VCE_MGCG;
1654 adev->pg_flags |= AMD_PG_SUPPORT_GFX_PG | 1654 adev->pg_flags = AMD_PG_SUPPORT_GFX_PG |
1655 AMD_PG_SUPPORT_GFX_SMG | 1655 AMD_PG_SUPPORT_GFX_SMG |
1656 AMD_PG_SUPPORT_GFX_PIPELINE | 1656 AMD_PG_SUPPORT_GFX_PIPELINE |
1657 AMD_PG_SUPPORT_UVD | 1657 AMD_PG_SUPPORT_UVD |
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c
index 1167205057b3..2ba7937d2545 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c
@@ -716,7 +716,7 @@ int phm_get_voltage_evv_on_sclk(struct pp_hwmgr *hwmgr, uint8_t voltage_type,
716 *voltage = 1150; 716 *voltage = 1150;
717 } else { 717 } else {
718 ret = atomctrl_get_voltage_evv_on_sclk_ai(hwmgr, voltage_type, sclk, id, &vol); 718 ret = atomctrl_get_voltage_evv_on_sclk_ai(hwmgr, voltage_type, sclk, id, &vol);
719 *voltage = (uint16_t)vol/100; 719 *voltage = (uint16_t)(vol/100);
720 } 720 }
721 return ret; 721 return ret;
722} 722}
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/ppatomctrl.c b/drivers/gpu/drm/amd/powerplay/hwmgr/ppatomctrl.c
index 1126bd4f74dc..0894527d932f 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/ppatomctrl.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/ppatomctrl.c
@@ -1320,7 +1320,8 @@ int atomctrl_get_voltage_evv_on_sclk_ai(struct pp_hwmgr *hwmgr, uint8_t voltage_
1320 if (0 != result) 1320 if (0 != result)
1321 return result; 1321 return result;
1322 1322
1323 *voltage = le32_to_cpu(((GET_EVV_VOLTAGE_INFO_OUTPUT_PARAMETER_V1_3 *)(&get_voltage_info_param_space))->ulVoltageLevel); 1323 *voltage = le32_to_cpu(((GET_EVV_VOLTAGE_INFO_OUTPUT_PARAMETER_V1_3 *)
1324 (&get_voltage_info_param_space))->ulVoltageLevel);
1324 1325
1325 return result; 1326 return result;
1326} 1327}
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c b/drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c
index 7de701d8a450..4477c55a58e3 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c
@@ -1201,12 +1201,15 @@ static uint32_t make_classification_flags(struct pp_hwmgr *hwmgr,
1201static int ppt_get_num_of_vce_state_table_entries_v1_0(struct pp_hwmgr *hwmgr) 1201static int ppt_get_num_of_vce_state_table_entries_v1_0(struct pp_hwmgr *hwmgr)
1202{ 1202{
1203 const ATOM_Tonga_POWERPLAYTABLE *pp_table = get_powerplay_table(hwmgr); 1203 const ATOM_Tonga_POWERPLAYTABLE *pp_table = get_powerplay_table(hwmgr);
1204 const ATOM_Tonga_VCE_State_Table *vce_state_table = 1204 const ATOM_Tonga_VCE_State_Table *vce_state_table;
1205 (ATOM_Tonga_VCE_State_Table *)(((unsigned long)pp_table) + le16_to_cpu(pp_table->usVCEStateTableOffset));
1206 1205
1207 if (vce_state_table == NULL) 1206
1207 if (pp_table == NULL)
1208 return 0; 1208 return 0;
1209 1209
1210 vce_state_table = (void *)pp_table +
1211 le16_to_cpu(pp_table->usVCEStateTableOffset);
1212
1210 return vce_state_table->ucNumEntries; 1213 return vce_state_table->ucNumEntries;
1211} 1214}
1212 1215
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c
index 609996c84ad5..75854021f403 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c
@@ -1168,8 +1168,8 @@ int smu7_enable_dpm_tasks(struct pp_hwmgr *hwmgr)
1168 1168
1169 tmp_result = (!smum_is_dpm_running(hwmgr)) ? 0 : -1; 1169 tmp_result = (!smum_is_dpm_running(hwmgr)) ? 0 : -1;
1170 PP_ASSERT_WITH_CODE(tmp_result == 0, 1170 PP_ASSERT_WITH_CODE(tmp_result == 0,
1171 "DPM is already running right now, no need to enable DPM!", 1171 "DPM is already running",
1172 return 0); 1172 );
1173 1173
1174 if (smu7_voltage_control(hwmgr)) { 1174 if (smu7_voltage_control(hwmgr)) {
1175 tmp_result = smu7_enable_voltage_control(hwmgr); 1175 tmp_result = smu7_enable_voltage_control(hwmgr);
@@ -2127,15 +2127,18 @@ static int smu7_patch_acp_vddc(struct pp_hwmgr *hwmgr,
2127} 2127}
2128 2128
2129static int smu7_patch_limits_vddc(struct pp_hwmgr *hwmgr, 2129static int smu7_patch_limits_vddc(struct pp_hwmgr *hwmgr,
2130 struct phm_clock_and_voltage_limits *tab) 2130 struct phm_clock_and_voltage_limits *tab)
2131{ 2131{
2132 uint32_t vddc, vddci;
2132 struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend); 2133 struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend);
2133 2134
2134 if (tab) { 2135 if (tab) {
2135 smu7_patch_ppt_v0_with_vdd_leakage(hwmgr, (uint32_t *)&tab->vddc, 2136 smu7_patch_ppt_v0_with_vdd_leakage(hwmgr, &vddc,
2136 &data->vddc_leakage); 2137 &data->vddc_leakage);
2137 smu7_patch_ppt_v0_with_vdd_leakage(hwmgr, (uint32_t *)&tab->vddci, 2138 tab->vddc = vddc;
2138 &data->vddci_leakage); 2139 smu7_patch_ppt_v0_with_vdd_leakage(hwmgr, &vddci,
2140 &data->vddci_leakage);
2141 tab->vddci = vddci;
2139 } 2142 }
2140 2143
2141 return 0; 2144 return 0;
diff --git a/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c b/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c
index 963a24d46a93..910b8d5b21c5 100644
--- a/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c
+++ b/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c
@@ -645,6 +645,7 @@ void amd_sched_fini(struct amd_gpu_scheduler *sched)
645{ 645{
646 if (sched->thread) 646 if (sched->thread)
647 kthread_stop(sched->thread); 647 kthread_stop(sched->thread);
648 rcu_barrier();
648 if (atomic_dec_and_test(&sched_fence_slab_ref)) 649 if (atomic_dec_and_test(&sched_fence_slab_ref))
649 kmem_cache_destroy(sched_fence_slab); 650 kmem_cache_destroy(sched_fence_slab);
650} 651}
diff --git a/drivers/gpu/drm/amd/scheduler/sched_fence.c b/drivers/gpu/drm/amd/scheduler/sched_fence.c
index 6b63beaf7574..3653b5a40494 100644
--- a/drivers/gpu/drm/amd/scheduler/sched_fence.c
+++ b/drivers/gpu/drm/amd/scheduler/sched_fence.c
@@ -103,7 +103,7 @@ static void amd_sched_fence_free(struct rcu_head *rcu)
103} 103}
104 104
105/** 105/**
106 * amd_sched_fence_release - callback that fence can be freed 106 * amd_sched_fence_release_scheduled - callback that fence can be freed
107 * 107 *
108 * @fence: fence 108 * @fence: fence
109 * 109 *
@@ -118,7 +118,7 @@ static void amd_sched_fence_release_scheduled(struct fence *f)
118} 118}
119 119
120/** 120/**
121 * amd_sched_fence_release_scheduled - drop extra reference 121 * amd_sched_fence_release_finished - drop extra reference
122 * 122 *
123 * @f: fence 123 * @f: fence
124 * 124 *
diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index 23739609427d..e6862a744210 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -420,18 +420,21 @@ drm_atomic_replace_property_blob_from_id(struct drm_crtc *crtc,
420 ssize_t expected_size, 420 ssize_t expected_size,
421 bool *replaced) 421 bool *replaced)
422{ 422{
423 struct drm_device *dev = crtc->dev;
424 struct drm_property_blob *new_blob = NULL; 423 struct drm_property_blob *new_blob = NULL;
425 424
426 if (blob_id != 0) { 425 if (blob_id != 0) {
427 new_blob = drm_property_lookup_blob(dev, blob_id); 426 new_blob = drm_property_lookup_blob(crtc->dev, blob_id);
428 if (new_blob == NULL) 427 if (new_blob == NULL)
429 return -EINVAL; 428 return -EINVAL;
430 if (expected_size > 0 && expected_size != new_blob->length) 429
430 if (expected_size > 0 && expected_size != new_blob->length) {
431 drm_property_unreference_blob(new_blob);
431 return -EINVAL; 432 return -EINVAL;
433 }
432 } 434 }
433 435
434 drm_atomic_replace_property_blob(blob, new_blob, replaced); 436 drm_atomic_replace_property_blob(blob, new_blob, replaced);
437 drm_property_unreference_blob(new_blob);
435 438
436 return 0; 439 return 0;
437} 440}
diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
index c3f83476f996..21f992605541 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -594,10 +594,6 @@ drm_atomic_helper_check_planes(struct drm_device *dev,
594 struct drm_plane_state *plane_state; 594 struct drm_plane_state *plane_state;
595 int i, ret = 0; 595 int i, ret = 0;
596 596
597 ret = drm_atomic_normalize_zpos(dev, state);
598 if (ret)
599 return ret;
600
601 for_each_plane_in_state(state, plane, plane_state, i) { 597 for_each_plane_in_state(state, plane, plane_state, i) {
602 const struct drm_plane_helper_funcs *funcs; 598 const struct drm_plane_helper_funcs *funcs;
603 599
diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c
index 04e457117980..aa644487749c 100644
--- a/drivers/gpu/drm/drm_dp_mst_topology.c
+++ b/drivers/gpu/drm/drm_dp_mst_topology.c
@@ -914,6 +914,7 @@ static void drm_dp_destroy_port(struct kref *kref)
914 /* no need to clean up vcpi 914 /* no need to clean up vcpi
915 * as if we have no connector we never setup a vcpi */ 915 * as if we have no connector we never setup a vcpi */
916 drm_dp_port_teardown_pdt(port, port->pdt); 916 drm_dp_port_teardown_pdt(port, port->pdt);
917 port->pdt = DP_PEER_DEVICE_NONE;
917 } 918 }
918 kfree(port); 919 kfree(port);
919} 920}
@@ -1159,7 +1160,9 @@ static void drm_dp_add_port(struct drm_dp_mst_branch *mstb,
1159 drm_dp_put_port(port); 1160 drm_dp_put_port(port);
1160 goto out; 1161 goto out;
1161 } 1162 }
1162 if (port->port_num >= DP_MST_LOGICAL_PORT_0) { 1163 if ((port->pdt == DP_PEER_DEVICE_DP_LEGACY_CONV ||
1164 port->pdt == DP_PEER_DEVICE_SST_SINK) &&
1165 port->port_num >= DP_MST_LOGICAL_PORT_0) {
1163 port->cached_edid = drm_get_edid(port->connector, &port->aux.ddc); 1166 port->cached_edid = drm_get_edid(port->connector, &port->aux.ddc);
1164 drm_mode_connector_set_tile_property(port->connector); 1167 drm_mode_connector_set_tile_property(port->connector);
1165 } 1168 }
@@ -2919,6 +2922,7 @@ static void drm_dp_destroy_connector_work(struct work_struct *work)
2919 mgr->cbs->destroy_connector(mgr, port->connector); 2922 mgr->cbs->destroy_connector(mgr, port->connector);
2920 2923
2921 drm_dp_port_teardown_pdt(port, port->pdt); 2924 drm_dp_port_teardown_pdt(port, port->pdt);
2925 port->pdt = DP_PEER_DEVICE_NONE;
2922 2926
2923 if (!port->input && port->vcpi.vcpi > 0) { 2927 if (!port->input && port->vcpi.vcpi > 0) {
2924 drm_dp_mst_reset_vcpi_slots(mgr, port); 2928 drm_dp_mst_reset_vcpi_slots(mgr, port);
diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index 03414bde1f15..6c75e62c0b22 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -131,7 +131,12 @@ int drm_fb_helper_single_add_all_connectors(struct drm_fb_helper *fb_helper)
131 return 0; 131 return 0;
132fail: 132fail:
133 for (i = 0; i < fb_helper->connector_count; i++) { 133 for (i = 0; i < fb_helper->connector_count; i++) {
134 kfree(fb_helper->connector_info[i]); 134 struct drm_fb_helper_connector *fb_helper_connector =
135 fb_helper->connector_info[i];
136
137 drm_connector_unreference(fb_helper_connector->connector);
138
139 kfree(fb_helper_connector);
135 fb_helper->connector_info[i] = NULL; 140 fb_helper->connector_info[i] = NULL;
136 } 141 }
137 fb_helper->connector_count = 0; 142 fb_helper->connector_count = 0;
@@ -603,6 +608,24 @@ int drm_fb_helper_blank(int blank, struct fb_info *info)
603} 608}
604EXPORT_SYMBOL(drm_fb_helper_blank); 609EXPORT_SYMBOL(drm_fb_helper_blank);
605 610
611static void drm_fb_helper_modeset_release(struct drm_fb_helper *helper,
612 struct drm_mode_set *modeset)
613{
614 int i;
615
616 for (i = 0; i < modeset->num_connectors; i++) {
617 drm_connector_unreference(modeset->connectors[i]);
618 modeset->connectors[i] = NULL;
619 }
620 modeset->num_connectors = 0;
621
622 drm_mode_destroy(helper->dev, modeset->mode);
623 modeset->mode = NULL;
624
625 /* FIXME should hold a ref? */
626 modeset->fb = NULL;
627}
628
606static void drm_fb_helper_crtc_free(struct drm_fb_helper *helper) 629static void drm_fb_helper_crtc_free(struct drm_fb_helper *helper)
607{ 630{
608 int i; 631 int i;
@@ -612,10 +635,12 @@ static void drm_fb_helper_crtc_free(struct drm_fb_helper *helper)
612 kfree(helper->connector_info[i]); 635 kfree(helper->connector_info[i]);
613 } 636 }
614 kfree(helper->connector_info); 637 kfree(helper->connector_info);
638
615 for (i = 0; i < helper->crtc_count; i++) { 639 for (i = 0; i < helper->crtc_count; i++) {
616 kfree(helper->crtc_info[i].mode_set.connectors); 640 struct drm_mode_set *modeset = &helper->crtc_info[i].mode_set;
617 if (helper->crtc_info[i].mode_set.mode) 641
618 drm_mode_destroy(helper->dev, helper->crtc_info[i].mode_set.mode); 642 drm_fb_helper_modeset_release(helper, modeset);
643 kfree(modeset->connectors);
619 } 644 }
620 kfree(helper->crtc_info); 645 kfree(helper->crtc_info);
621} 646}
@@ -644,7 +669,9 @@ static void drm_fb_helper_dirty_work(struct work_struct *work)
644 clip->x2 = clip->y2 = 0; 669 clip->x2 = clip->y2 = 0;
645 spin_unlock_irqrestore(&helper->dirty_lock, flags); 670 spin_unlock_irqrestore(&helper->dirty_lock, flags);
646 671
647 helper->fb->funcs->dirty(helper->fb, NULL, 0, 0, &clip_copy, 1); 672 /* call dirty callback only when it has been really touched */
673 if (clip_copy.x1 < clip_copy.x2 && clip_copy.y1 < clip_copy.y2)
674 helper->fb->funcs->dirty(helper->fb, NULL, 0, 0, &clip_copy, 1);
648} 675}
649 676
650/** 677/**
@@ -2088,7 +2115,6 @@ static void drm_setup_crtcs(struct drm_fb_helper *fb_helper)
2088 struct drm_fb_helper_crtc **crtcs; 2115 struct drm_fb_helper_crtc **crtcs;
2089 struct drm_display_mode **modes; 2116 struct drm_display_mode **modes;
2090 struct drm_fb_offset *offsets; 2117 struct drm_fb_offset *offsets;
2091 struct drm_mode_set *modeset;
2092 bool *enabled; 2118 bool *enabled;
2093 int width, height; 2119 int width, height;
2094 int i; 2120 int i;
@@ -2136,45 +2162,35 @@ static void drm_setup_crtcs(struct drm_fb_helper *fb_helper)
2136 2162
2137 /* need to set the modesets up here for use later */ 2163 /* need to set the modesets up here for use later */
2138 /* fill out the connector<->crtc mappings into the modesets */ 2164 /* fill out the connector<->crtc mappings into the modesets */
2139 for (i = 0; i < fb_helper->crtc_count; i++) { 2165 for (i = 0; i < fb_helper->crtc_count; i++)
2140 modeset = &fb_helper->crtc_info[i].mode_set; 2166 drm_fb_helper_modeset_release(fb_helper,
2141 modeset->num_connectors = 0; 2167 &fb_helper->crtc_info[i].mode_set);
2142 modeset->fb = NULL;
2143 }
2144 2168
2145 for (i = 0; i < fb_helper->connector_count; i++) { 2169 for (i = 0; i < fb_helper->connector_count; i++) {
2146 struct drm_display_mode *mode = modes[i]; 2170 struct drm_display_mode *mode = modes[i];
2147 struct drm_fb_helper_crtc *fb_crtc = crtcs[i]; 2171 struct drm_fb_helper_crtc *fb_crtc = crtcs[i];
2148 struct drm_fb_offset *offset = &offsets[i]; 2172 struct drm_fb_offset *offset = &offsets[i];
2149 modeset = &fb_crtc->mode_set; 2173 struct drm_mode_set *modeset = &fb_crtc->mode_set;
2150 2174
2151 if (mode && fb_crtc) { 2175 if (mode && fb_crtc) {
2176 struct drm_connector *connector =
2177 fb_helper->connector_info[i]->connector;
2178
2152 DRM_DEBUG_KMS("desired mode %s set on crtc %d (%d,%d)\n", 2179 DRM_DEBUG_KMS("desired mode %s set on crtc %d (%d,%d)\n",
2153 mode->name, fb_crtc->mode_set.crtc->base.id, offset->x, offset->y); 2180 mode->name, fb_crtc->mode_set.crtc->base.id, offset->x, offset->y);
2181
2154 fb_crtc->desired_mode = mode; 2182 fb_crtc->desired_mode = mode;
2155 fb_crtc->x = offset->x; 2183 fb_crtc->x = offset->x;
2156 fb_crtc->y = offset->y; 2184 fb_crtc->y = offset->y;
2157 if (modeset->mode)
2158 drm_mode_destroy(dev, modeset->mode);
2159 modeset->mode = drm_mode_duplicate(dev, 2185 modeset->mode = drm_mode_duplicate(dev,
2160 fb_crtc->desired_mode); 2186 fb_crtc->desired_mode);
2161 modeset->connectors[modeset->num_connectors++] = fb_helper->connector_info[i]->connector; 2187 drm_connector_reference(connector);
2188 modeset->connectors[modeset->num_connectors++] = connector;
2162 modeset->fb = fb_helper->fb; 2189 modeset->fb = fb_helper->fb;
2163 modeset->x = offset->x; 2190 modeset->x = offset->x;
2164 modeset->y = offset->y; 2191 modeset->y = offset->y;
2165 } 2192 }
2166 } 2193 }
2167
2168 /* Clear out any old modes if there are no more connected outputs. */
2169 for (i = 0; i < fb_helper->crtc_count; i++) {
2170 modeset = &fb_helper->crtc_info[i].mode_set;
2171 if (modeset->num_connectors == 0) {
2172 BUG_ON(modeset->fb);
2173 if (modeset->mode)
2174 drm_mode_destroy(dev, modeset->mode);
2175 modeset->mode = NULL;
2176 }
2177 }
2178out: 2194out:
2179 kfree(crtcs); 2195 kfree(crtcs);
2180 kfree(modes); 2196 kfree(modes);
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c b/drivers/gpu/drm/exynos/exynos_drm_drv.c
index def78c8c1780..f86e7c846678 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c
@@ -262,6 +262,26 @@ int exynos_atomic_commit(struct drm_device *dev, struct drm_atomic_state *state,
262 return 0; 262 return 0;
263} 263}
264 264
265int exynos_atomic_check(struct drm_device *dev,
266 struct drm_atomic_state *state)
267{
268 int ret;
269
270 ret = drm_atomic_helper_check_modeset(dev, state);
271 if (ret)
272 return ret;
273
274 ret = drm_atomic_normalize_zpos(dev, state);
275 if (ret)
276 return ret;
277
278 ret = drm_atomic_helper_check_planes(dev, state);
279 if (ret)
280 return ret;
281
282 return ret;
283}
284
265static int exynos_drm_open(struct drm_device *dev, struct drm_file *file) 285static int exynos_drm_open(struct drm_device *dev, struct drm_file *file)
266{ 286{
267 struct drm_exynos_file_private *file_priv; 287 struct drm_exynos_file_private *file_priv;
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h b/drivers/gpu/drm/exynos/exynos_drm_drv.h
index d215149e737b..80c4d5b81689 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h
@@ -301,6 +301,7 @@ static inline int exynos_dpi_bind(struct drm_device *dev,
301 301
302int exynos_atomic_commit(struct drm_device *dev, struct drm_atomic_state *state, 302int exynos_atomic_commit(struct drm_device *dev, struct drm_atomic_state *state,
303 bool nonblock); 303 bool nonblock);
304int exynos_atomic_check(struct drm_device *dev, struct drm_atomic_state *state);
304 305
305 306
306extern struct platform_driver fimd_driver; 307extern struct platform_driver fimd_driver;
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fb.c b/drivers/gpu/drm/exynos/exynos_drm_fb.c
index 40ce841eb952..23cce0a3f5fc 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fb.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fb.c
@@ -190,7 +190,7 @@ dma_addr_t exynos_drm_fb_dma_addr(struct drm_framebuffer *fb, int index)
190static const struct drm_mode_config_funcs exynos_drm_mode_config_funcs = { 190static const struct drm_mode_config_funcs exynos_drm_mode_config_funcs = {
191 .fb_create = exynos_user_fb_create, 191 .fb_create = exynos_user_fb_create,
192 .output_poll_changed = exynos_drm_output_poll_changed, 192 .output_poll_changed = exynos_drm_output_poll_changed,
193 .atomic_check = drm_atomic_helper_check, 193 .atomic_check = exynos_atomic_check,
194 .atomic_commit = exynos_atomic_commit, 194 .atomic_commit = exynos_atomic_commit,
195}; 195};
196 196
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index bfb2efd8d4d4..18dfdd5c1b3b 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -1447,8 +1447,6 @@ static int i915_drm_suspend(struct drm_device *dev)
1447 1447
1448 dev_priv->suspend_count++; 1448 dev_priv->suspend_count++;
1449 1449
1450 intel_display_set_init_power(dev_priv, false);
1451
1452 intel_csr_ucode_suspend(dev_priv); 1450 intel_csr_ucode_suspend(dev_priv);
1453 1451
1454out: 1452out:
@@ -1466,6 +1464,8 @@ static int i915_drm_suspend_late(struct drm_device *dev, bool hibernation)
1466 1464
1467 disable_rpm_wakeref_asserts(dev_priv); 1465 disable_rpm_wakeref_asserts(dev_priv);
1468 1466
1467 intel_display_set_init_power(dev_priv, false);
1468
1469 fw_csr = !IS_BROXTON(dev_priv) && 1469 fw_csr = !IS_BROXTON(dev_priv) &&
1470 suspend_to_idle(dev_priv) && dev_priv->csr.dmc_payload; 1470 suspend_to_idle(dev_priv) && dev_priv->csr.dmc_payload;
1471 /* 1471 /*
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 8b9ee4e390c0..685e9e065287 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -2883,6 +2883,11 @@ __i915_printk(struct drm_i915_private *dev_priv, const char *level,
2883extern long i915_compat_ioctl(struct file *filp, unsigned int cmd, 2883extern long i915_compat_ioctl(struct file *filp, unsigned int cmd,
2884 unsigned long arg); 2884 unsigned long arg);
2885#endif 2885#endif
2886extern const struct dev_pm_ops i915_pm_ops;
2887
2888extern int i915_driver_load(struct pci_dev *pdev,
2889 const struct pci_device_id *ent);
2890extern void i915_driver_unload(struct drm_device *dev);
2886extern int intel_gpu_reset(struct drm_i915_private *dev_priv, u32 engine_mask); 2891extern int intel_gpu_reset(struct drm_i915_private *dev_priv, u32 engine_mask);
2887extern bool intel_has_gpu_reset(struct drm_i915_private *dev_priv); 2892extern bool intel_has_gpu_reset(struct drm_i915_private *dev_priv);
2888extern void i915_reset(struct drm_i915_private *dev_priv); 2893extern void i915_reset(struct drm_i915_private *dev_priv);
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 947e82c2b175..23960de81b57 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -3550,8 +3550,6 @@ i915_gem_object_pin_to_display_plane(struct drm_i915_gem_object *obj,
3550 3550
3551 vma->display_alignment = max_t(u64, vma->display_alignment, alignment); 3551 vma->display_alignment = max_t(u64, vma->display_alignment, alignment);
3552 3552
3553 WARN_ON(obj->pin_display > i915_vma_pin_count(vma));
3554
3555 i915_gem_object_flush_cpu_write_domain(obj); 3553 i915_gem_object_flush_cpu_write_domain(obj);
3556 3554
3557 old_write_domain = obj->base.write_domain; 3555 old_write_domain = obj->base.write_domain;
@@ -3588,7 +3586,6 @@ i915_gem_object_unpin_from_display_plane(struct i915_vma *vma)
3588 list_move_tail(&vma->vm_link, &vma->vm->inactive_list); 3586 list_move_tail(&vma->vm_link, &vma->vm->inactive_list);
3589 3587
3590 i915_vma_unpin(vma); 3588 i915_vma_unpin(vma);
3591 WARN_ON(vma->obj->pin_display > i915_vma_pin_count(vma));
3592} 3589}
3593 3590
3594/** 3591/**
@@ -3745,7 +3742,12 @@ void __i915_vma_set_map_and_fenceable(struct i915_vma *vma)
3745 mappable = (vma->node.start + fence_size <= 3742 mappable = (vma->node.start + fence_size <=
3746 dev_priv->ggtt.mappable_end); 3743 dev_priv->ggtt.mappable_end);
3747 3744
3748 if (mappable && fenceable) 3745 /*
3746 * Explicitly disable for rotated VMA since the display does not
3747 * need the fence and the VMA is not accessible to other users.
3748 */
3749 if (mappable && fenceable &&
3750 vma->ggtt_view.type != I915_GGTT_VIEW_ROTATED)
3749 vma->flags |= I915_VMA_CAN_FENCE; 3751 vma->flags |= I915_VMA_CAN_FENCE;
3750 else 3752 else
3751 vma->flags &= ~I915_VMA_CAN_FENCE; 3753 vma->flags &= ~I915_VMA_CAN_FENCE;
diff --git a/drivers/gpu/drm/i915/i915_gem_fence.c b/drivers/gpu/drm/i915/i915_gem_fence.c
index 8df1fa7234e8..2c7ba0ee127c 100644
--- a/drivers/gpu/drm/i915/i915_gem_fence.c
+++ b/drivers/gpu/drm/i915/i915_gem_fence.c
@@ -290,6 +290,8 @@ i915_vma_put_fence(struct i915_vma *vma)
290{ 290{
291 struct drm_i915_fence_reg *fence = vma->fence; 291 struct drm_i915_fence_reg *fence = vma->fence;
292 292
293 assert_rpm_wakelock_held(to_i915(vma->vm->dev));
294
293 if (!fence) 295 if (!fence)
294 return 0; 296 return 0;
295 297
@@ -341,6 +343,8 @@ i915_vma_get_fence(struct i915_vma *vma)
341 struct drm_i915_fence_reg *fence; 343 struct drm_i915_fence_reg *fence;
342 struct i915_vma *set = i915_gem_object_is_tiled(vma->obj) ? vma : NULL; 344 struct i915_vma *set = i915_gem_object_is_tiled(vma->obj) ? vma : NULL;
343 345
346 assert_rpm_wakelock_held(to_i915(vma->vm->dev));
347
344 /* Just update our place in the LRU if our fence is getting reused. */ 348 /* Just update our place in the LRU if our fence is getting reused. */
345 if (vma->fence) { 349 if (vma->fence) {
346 fence = vma->fence; 350 fence = vma->fence;
@@ -371,6 +375,12 @@ void i915_gem_restore_fences(struct drm_device *dev)
371 struct drm_i915_private *dev_priv = to_i915(dev); 375 struct drm_i915_private *dev_priv = to_i915(dev);
372 int i; 376 int i;
373 377
378 /* Note that this may be called outside of struct_mutex, by
379 * runtime suspend/resume. The barrier we require is enforced by
380 * rpm itself - all access to fences/GTT are only within an rpm
381 * wakeref, and to acquire that wakeref you must pass through here.
382 */
383
374 for (i = 0; i < dev_priv->num_fence_regs; i++) { 384 for (i = 0; i < dev_priv->num_fence_regs; i++) {
375 struct drm_i915_fence_reg *reg = &dev_priv->fence_regs[i]; 385 struct drm_i915_fence_reg *reg = &dev_priv->fence_regs[i];
376 struct i915_vma *vma = reg->vma; 386 struct i915_vma *vma = reg->vma;
@@ -379,10 +389,17 @@ void i915_gem_restore_fences(struct drm_device *dev)
379 * Commit delayed tiling changes if we have an object still 389 * Commit delayed tiling changes if we have an object still
380 * attached to the fence, otherwise just clear the fence. 390 * attached to the fence, otherwise just clear the fence.
381 */ 391 */
382 if (vma && !i915_gem_object_is_tiled(vma->obj)) 392 if (vma && !i915_gem_object_is_tiled(vma->obj)) {
393 GEM_BUG_ON(!reg->dirty);
394 GEM_BUG_ON(vma->obj->fault_mappable);
395
396 list_move(&reg->link, &dev_priv->mm.fence_list);
397 vma->fence = NULL;
383 vma = NULL; 398 vma = NULL;
399 }
384 400
385 fence_update(reg, vma); 401 fence_write(reg, vma);
402 reg->vma = vma;
386 } 403 }
387} 404}
388 405
diff --git a/drivers/gpu/drm/i915/i915_pci.c b/drivers/gpu/drm/i915/i915_pci.c
index 687c768833b3..31e6edd08dd0 100644
--- a/drivers/gpu/drm/i915/i915_pci.c
+++ b/drivers/gpu/drm/i915/i915_pci.c
@@ -431,9 +431,6 @@ static const struct pci_device_id pciidlist[] = {
431}; 431};
432MODULE_DEVICE_TABLE(pci, pciidlist); 432MODULE_DEVICE_TABLE(pci, pciidlist);
433 433
434extern int i915_driver_load(struct pci_dev *pdev,
435 const struct pci_device_id *ent);
436
437static int i915_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) 434static int i915_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
438{ 435{
439 struct intel_device_info *intel_info = 436 struct intel_device_info *intel_info =
@@ -463,8 +460,6 @@ static int i915_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
463 return i915_driver_load(pdev, ent); 460 return i915_driver_load(pdev, ent);
464} 461}
465 462
466extern void i915_driver_unload(struct drm_device *dev);
467
468static void i915_pci_remove(struct pci_dev *pdev) 463static void i915_pci_remove(struct pci_dev *pdev)
469{ 464{
470 struct drm_device *dev = pci_get_drvdata(pdev); 465 struct drm_device *dev = pci_get_drvdata(pdev);
@@ -473,8 +468,6 @@ static void i915_pci_remove(struct pci_dev *pdev)
473 drm_dev_unref(dev); 468 drm_dev_unref(dev);
474} 469}
475 470
476extern const struct dev_pm_ops i915_pm_ops;
477
478static struct pci_driver i915_pci_driver = { 471static struct pci_driver i915_pci_driver = {
479 .name = DRIVER_NAME, 472 .name = DRIVER_NAME,
480 .id_table = pciidlist, 473 .id_table = pciidlist,
diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c
index c6e69e4cfa83..1f8af87c6294 100644
--- a/drivers/gpu/drm/i915/intel_bios.c
+++ b/drivers/gpu/drm/i915/intel_bios.c
@@ -1031,6 +1031,77 @@ static u8 translate_iboost(u8 val)
1031 return mapping[val]; 1031 return mapping[val];
1032} 1032}
1033 1033
1034static void sanitize_ddc_pin(struct drm_i915_private *dev_priv,
1035 enum port port)
1036{
1037 const struct ddi_vbt_port_info *info =
1038 &dev_priv->vbt.ddi_port_info[port];
1039 enum port p;
1040
1041 if (!info->alternate_ddc_pin)
1042 return;
1043
1044 for_each_port_masked(p, (1 << port) - 1) {
1045 struct ddi_vbt_port_info *i = &dev_priv->vbt.ddi_port_info[p];
1046
1047 if (info->alternate_ddc_pin != i->alternate_ddc_pin)
1048 continue;
1049
1050 DRM_DEBUG_KMS("port %c trying to use the same DDC pin (0x%x) as port %c, "
1051 "disabling port %c DVI/HDMI support\n",
1052 port_name(p), i->alternate_ddc_pin,
1053 port_name(port), port_name(p));
1054
1055 /*
1056 * If we have multiple ports supposedly sharing the
1057 * pin, then dvi/hdmi couldn't exist on the shared
1058 * port. Otherwise they share the same ddc bin and
1059 * system couldn't communicate with them separately.
1060 *
1061 * Due to parsing the ports in alphabetical order,
1062 * a higher port will always clobber a lower one.
1063 */
1064 i->supports_dvi = false;
1065 i->supports_hdmi = false;
1066 i->alternate_ddc_pin = 0;
1067 }
1068}
1069
1070static void sanitize_aux_ch(struct drm_i915_private *dev_priv,
1071 enum port port)
1072{
1073 const struct ddi_vbt_port_info *info =
1074 &dev_priv->vbt.ddi_port_info[port];
1075 enum port p;
1076
1077 if (!info->alternate_aux_channel)
1078 return;
1079
1080 for_each_port_masked(p, (1 << port) - 1) {
1081 struct ddi_vbt_port_info *i = &dev_priv->vbt.ddi_port_info[p];
1082
1083 if (info->alternate_aux_channel != i->alternate_aux_channel)
1084 continue;
1085
1086 DRM_DEBUG_KMS("port %c trying to use the same AUX CH (0x%x) as port %c, "
1087 "disabling port %c DP support\n",
1088 port_name(p), i->alternate_aux_channel,
1089 port_name(port), port_name(p));
1090
1091 /*
1092 * If we have multiple ports supposedlt sharing the
1093 * aux channel, then DP couldn't exist on the shared
1094 * port. Otherwise they share the same aux channel
1095 * and system couldn't communicate with them separately.
1096 *
1097 * Due to parsing the ports in alphabetical order,
1098 * a higher port will always clobber a lower one.
1099 */
1100 i->supports_dp = false;
1101 i->alternate_aux_channel = 0;
1102 }
1103}
1104
1034static void parse_ddi_port(struct drm_i915_private *dev_priv, enum port port, 1105static void parse_ddi_port(struct drm_i915_private *dev_priv, enum port port,
1035 const struct bdb_header *bdb) 1106 const struct bdb_header *bdb)
1036{ 1107{
@@ -1105,54 +1176,15 @@ static void parse_ddi_port(struct drm_i915_private *dev_priv, enum port port,
1105 DRM_DEBUG_KMS("Port %c is internal DP\n", port_name(port)); 1176 DRM_DEBUG_KMS("Port %c is internal DP\n", port_name(port));
1106 1177
1107 if (is_dvi) { 1178 if (is_dvi) {
1108 if (port == PORT_E) { 1179 info->alternate_ddc_pin = ddc_pin;
1109 info->alternate_ddc_pin = ddc_pin; 1180
1110 /* if DDIE share ddc pin with other port, then 1181 sanitize_ddc_pin(dev_priv, port);
1111 * dvi/hdmi couldn't exist on the shared port.
1112 * Otherwise they share the same ddc bin and system
1113 * couldn't communicate with them seperately. */
1114 if (ddc_pin == DDC_PIN_B) {
1115 dev_priv->vbt.ddi_port_info[PORT_B].supports_dvi = 0;
1116 dev_priv->vbt.ddi_port_info[PORT_B].supports_hdmi = 0;
1117 } else if (ddc_pin == DDC_PIN_C) {
1118 dev_priv->vbt.ddi_port_info[PORT_C].supports_dvi = 0;
1119 dev_priv->vbt.ddi_port_info[PORT_C].supports_hdmi = 0;
1120 } else if (ddc_pin == DDC_PIN_D) {
1121 dev_priv->vbt.ddi_port_info[PORT_D].supports_dvi = 0;
1122 dev_priv->vbt.ddi_port_info[PORT_D].supports_hdmi = 0;
1123 }
1124 } else if (ddc_pin == DDC_PIN_B && port != PORT_B)
1125 DRM_DEBUG_KMS("Unexpected DDC pin for port B\n");
1126 else if (ddc_pin == DDC_PIN_C && port != PORT_C)
1127 DRM_DEBUG_KMS("Unexpected DDC pin for port C\n");
1128 else if (ddc_pin == DDC_PIN_D && port != PORT_D)
1129 DRM_DEBUG_KMS("Unexpected DDC pin for port D\n");
1130 } 1182 }
1131 1183
1132 if (is_dp) { 1184 if (is_dp) {
1133 if (port == PORT_E) { 1185 info->alternate_aux_channel = aux_channel;
1134 info->alternate_aux_channel = aux_channel; 1186
1135 /* if DDIE share aux channel with other port, then 1187 sanitize_aux_ch(dev_priv, port);
1136 * DP couldn't exist on the shared port. Otherwise
1137 * they share the same aux channel and system
1138 * couldn't communicate with them seperately. */
1139 if (aux_channel == DP_AUX_A)
1140 dev_priv->vbt.ddi_port_info[PORT_A].supports_dp = 0;
1141 else if (aux_channel == DP_AUX_B)
1142 dev_priv->vbt.ddi_port_info[PORT_B].supports_dp = 0;
1143 else if (aux_channel == DP_AUX_C)
1144 dev_priv->vbt.ddi_port_info[PORT_C].supports_dp = 0;
1145 else if (aux_channel == DP_AUX_D)
1146 dev_priv->vbt.ddi_port_info[PORT_D].supports_dp = 0;
1147 }
1148 else if (aux_channel == DP_AUX_A && port != PORT_A)
1149 DRM_DEBUG_KMS("Unexpected AUX channel for port A\n");
1150 else if (aux_channel == DP_AUX_B && port != PORT_B)
1151 DRM_DEBUG_KMS("Unexpected AUX channel for port B\n");
1152 else if (aux_channel == DP_AUX_C && port != PORT_C)
1153 DRM_DEBUG_KMS("Unexpected AUX channel for port C\n");
1154 else if (aux_channel == DP_AUX_D && port != PORT_D)
1155 DRM_DEBUG_KMS("Unexpected AUX channel for port D\n");
1156 } 1188 }
1157 1189
1158 if (bdb->version >= 158) { 1190 if (bdb->version >= 158) {
diff --git a/drivers/gpu/drm/i915/intel_device_info.c b/drivers/gpu/drm/i915/intel_device_info.c
index 73b6858600ac..1b20e160bc1f 100644
--- a/drivers/gpu/drm/i915/intel_device_info.c
+++ b/drivers/gpu/drm/i915/intel_device_info.c
@@ -192,7 +192,7 @@ static void broadwell_sseu_info_init(struct drm_i915_private *dev_priv)
192 struct sseu_dev_info *sseu = &mkwrite_device_info(dev_priv)->sseu; 192 struct sseu_dev_info *sseu = &mkwrite_device_info(dev_priv)->sseu;
193 const int s_max = 3, ss_max = 3, eu_max = 8; 193 const int s_max = 3, ss_max = 3, eu_max = 8;
194 int s, ss; 194 int s, ss;
195 u32 fuse2, eu_disable[s_max]; 195 u32 fuse2, eu_disable[3]; /* s_max */
196 196
197 fuse2 = I915_READ(GEN8_FUSE2); 197 fuse2 = I915_READ(GEN8_FUSE2);
198 sseu->slice_mask = (fuse2 & GEN8_F2_S_ENA_MASK) >> GEN8_F2_S_ENA_SHIFT; 198 sseu->slice_mask = (fuse2 & GEN8_F2_S_ENA_MASK) >> GEN8_F2_S_ENA_SHIFT;
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index fbcfed63a76e..0ad1879bfd9d 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -2978,7 +2978,8 @@ int skl_check_plane_surface(struct intel_plane_state *plane_state)
2978 /* Rotate src coordinates to match rotated GTT view */ 2978 /* Rotate src coordinates to match rotated GTT view */
2979 if (intel_rotation_90_or_270(rotation)) 2979 if (intel_rotation_90_or_270(rotation))
2980 drm_rect_rotate(&plane_state->base.src, 2980 drm_rect_rotate(&plane_state->base.src,
2981 fb->width, fb->height, DRM_ROTATE_270); 2981 fb->width << 16, fb->height << 16,
2982 DRM_ROTATE_270);
2982 2983
2983 /* 2984 /*
2984 * Handle the AUX surface first since 2985 * Handle the AUX surface first since
@@ -14310,7 +14311,7 @@ static void intel_atomic_commit_tail(struct drm_atomic_state *state)
14310 14311
14311 for_each_plane_in_state(state, plane, plane_state, i) { 14312 for_each_plane_in_state(state, plane, plane_state, i) {
14312 struct intel_plane_state *intel_plane_state = 14313 struct intel_plane_state *intel_plane_state =
14313 to_intel_plane_state(plane_state); 14314 to_intel_plane_state(plane->state);
14314 14315
14315 if (!intel_plane_state->wait_req) 14316 if (!intel_plane_state->wait_req)
14316 continue; 14317 continue;
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 14a3cf0b7213..3581b5a7f716 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -1108,6 +1108,44 @@ intel_dp_aux_transfer(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg)
1108 return ret; 1108 return ret;
1109} 1109}
1110 1110
1111static enum port intel_aux_port(struct drm_i915_private *dev_priv,
1112 enum port port)
1113{
1114 const struct ddi_vbt_port_info *info =
1115 &dev_priv->vbt.ddi_port_info[port];
1116 enum port aux_port;
1117
1118 if (!info->alternate_aux_channel) {
1119 DRM_DEBUG_KMS("using AUX %c for port %c (platform default)\n",
1120 port_name(port), port_name(port));
1121 return port;
1122 }
1123
1124 switch (info->alternate_aux_channel) {
1125 case DP_AUX_A:
1126 aux_port = PORT_A;
1127 break;
1128 case DP_AUX_B:
1129 aux_port = PORT_B;
1130 break;
1131 case DP_AUX_C:
1132 aux_port = PORT_C;
1133 break;
1134 case DP_AUX_D:
1135 aux_port = PORT_D;
1136 break;
1137 default:
1138 MISSING_CASE(info->alternate_aux_channel);
1139 aux_port = PORT_A;
1140 break;
1141 }
1142
1143 DRM_DEBUG_KMS("using AUX %c for port %c (VBT)\n",
1144 port_name(aux_port), port_name(port));
1145
1146 return aux_port;
1147}
1148
1111static i915_reg_t g4x_aux_ctl_reg(struct drm_i915_private *dev_priv, 1149static i915_reg_t g4x_aux_ctl_reg(struct drm_i915_private *dev_priv,
1112 enum port port) 1150 enum port port)
1113{ 1151{
@@ -1168,36 +1206,9 @@ static i915_reg_t ilk_aux_data_reg(struct drm_i915_private *dev_priv,
1168 } 1206 }
1169} 1207}
1170 1208
1171/*
1172 * On SKL we don't have Aux for port E so we rely
1173 * on VBT to set a proper alternate aux channel.
1174 */
1175static enum port skl_porte_aux_port(struct drm_i915_private *dev_priv)
1176{
1177 const struct ddi_vbt_port_info *info =
1178 &dev_priv->vbt.ddi_port_info[PORT_E];
1179
1180 switch (info->alternate_aux_channel) {
1181 case DP_AUX_A:
1182 return PORT_A;
1183 case DP_AUX_B:
1184 return PORT_B;
1185 case DP_AUX_C:
1186 return PORT_C;
1187 case DP_AUX_D:
1188 return PORT_D;
1189 default:
1190 MISSING_CASE(info->alternate_aux_channel);
1191 return PORT_A;
1192 }
1193}
1194
1195static i915_reg_t skl_aux_ctl_reg(struct drm_i915_private *dev_priv, 1209static i915_reg_t skl_aux_ctl_reg(struct drm_i915_private *dev_priv,
1196 enum port port) 1210 enum port port)
1197{ 1211{
1198 if (port == PORT_E)
1199 port = skl_porte_aux_port(dev_priv);
1200
1201 switch (port) { 1212 switch (port) {
1202 case PORT_A: 1213 case PORT_A:
1203 case PORT_B: 1214 case PORT_B:
@@ -1213,9 +1224,6 @@ static i915_reg_t skl_aux_ctl_reg(struct drm_i915_private *dev_priv,
1213static i915_reg_t skl_aux_data_reg(struct drm_i915_private *dev_priv, 1224static i915_reg_t skl_aux_data_reg(struct drm_i915_private *dev_priv,
1214 enum port port, int index) 1225 enum port port, int index)
1215{ 1226{
1216 if (port == PORT_E)
1217 port = skl_porte_aux_port(dev_priv);
1218
1219 switch (port) { 1227 switch (port) {
1220 case PORT_A: 1228 case PORT_A:
1221 case PORT_B: 1229 case PORT_B:
@@ -1253,7 +1261,8 @@ static i915_reg_t intel_aux_data_reg(struct drm_i915_private *dev_priv,
1253static void intel_aux_reg_init(struct intel_dp *intel_dp) 1261static void intel_aux_reg_init(struct intel_dp *intel_dp)
1254{ 1262{
1255 struct drm_i915_private *dev_priv = to_i915(intel_dp_to_dev(intel_dp)); 1263 struct drm_i915_private *dev_priv = to_i915(intel_dp_to_dev(intel_dp));
1256 enum port port = dp_to_dig_port(intel_dp)->port; 1264 enum port port = intel_aux_port(dev_priv,
1265 dp_to_dig_port(intel_dp)->port);
1257 int i; 1266 int i;
1258 1267
1259 intel_dp->aux_ch_ctl_reg = intel_aux_ctl_reg(dev_priv, port); 1268 intel_dp->aux_ch_ctl_reg = intel_aux_ctl_reg(dev_priv, port);
@@ -3551,8 +3560,8 @@ intel_edp_init_dpcd(struct intel_dp *intel_dp)
3551 /* Read the eDP Display control capabilities registers */ 3560 /* Read the eDP Display control capabilities registers */
3552 if ((intel_dp->dpcd[DP_EDP_CONFIGURATION_CAP] & DP_DPCD_DISPLAY_CONTROL_CAPABLE) && 3561 if ((intel_dp->dpcd[DP_EDP_CONFIGURATION_CAP] & DP_DPCD_DISPLAY_CONTROL_CAPABLE) &&
3553 drm_dp_dpcd_read(&intel_dp->aux, DP_EDP_DPCD_REV, 3562 drm_dp_dpcd_read(&intel_dp->aux, DP_EDP_DPCD_REV,
3554 intel_dp->edp_dpcd, sizeof(intel_dp->edp_dpcd) == 3563 intel_dp->edp_dpcd, sizeof(intel_dp->edp_dpcd)) ==
3555 sizeof(intel_dp->edp_dpcd))) 3564 sizeof(intel_dp->edp_dpcd))
3556 DRM_DEBUG_KMS("EDP DPCD : %*ph\n", (int) sizeof(intel_dp->edp_dpcd), 3565 DRM_DEBUG_KMS("EDP DPCD : %*ph\n", (int) sizeof(intel_dp->edp_dpcd),
3557 intel_dp->edp_dpcd); 3566 intel_dp->edp_dpcd);
3558 3567
diff --git a/drivers/gpu/drm/i915/intel_fbc.c b/drivers/gpu/drm/i915/intel_fbc.c
index faa67624e1ed..c43dd9abce79 100644
--- a/drivers/gpu/drm/i915/intel_fbc.c
+++ b/drivers/gpu/drm/i915/intel_fbc.c
@@ -104,8 +104,10 @@ static int intel_fbc_calculate_cfb_size(struct drm_i915_private *dev_priv,
104 int lines; 104 int lines;
105 105
106 intel_fbc_get_plane_source_size(cache, NULL, &lines); 106 intel_fbc_get_plane_source_size(cache, NULL, &lines);
107 if (INTEL_INFO(dev_priv)->gen >= 7) 107 if (INTEL_GEN(dev_priv) == 7)
108 lines = min(lines, 2048); 108 lines = min(lines, 2048);
109 else if (INTEL_GEN(dev_priv) >= 8)
110 lines = min(lines, 2560);
109 111
110 /* Hardware needs the full buffer stride, not just the active area. */ 112 /* Hardware needs the full buffer stride, not just the active area. */
111 return lines * cache->fb.stride; 113 return lines * cache->fb.stride;
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index a2f751cd187a..db24f898853c 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -3362,13 +3362,15 @@ skl_allocate_pipe_ddb(struct intel_crtc_state *cstate,
3362 int num_active; 3362 int num_active;
3363 int id, i; 3363 int id, i;
3364 3364
3365 /* Clear the partitioning for disabled planes. */
3366 memset(ddb->plane[pipe], 0, sizeof(ddb->plane[pipe]));
3367 memset(ddb->y_plane[pipe], 0, sizeof(ddb->y_plane[pipe]));
3368
3365 if (WARN_ON(!state)) 3369 if (WARN_ON(!state))
3366 return 0; 3370 return 0;
3367 3371
3368 if (!cstate->base.active) { 3372 if (!cstate->base.active) {
3369 ddb->pipe[pipe].start = ddb->pipe[pipe].end = 0; 3373 ddb->pipe[pipe].start = ddb->pipe[pipe].end = 0;
3370 memset(ddb->plane[pipe], 0, sizeof(ddb->plane[pipe]));
3371 memset(ddb->y_plane[pipe], 0, sizeof(ddb->y_plane[pipe]));
3372 return 0; 3374 return 0;
3373 } 3375 }
3374 3376
@@ -3468,12 +3470,6 @@ skl_allocate_pipe_ddb(struct intel_crtc_state *cstate,
3468 return 0; 3470 return 0;
3469} 3471}
3470 3472
3471static uint32_t skl_pipe_pixel_rate(const struct intel_crtc_state *config)
3472{
3473 /* TODO: Take into account the scalers once we support them */
3474 return config->base.adjusted_mode.crtc_clock;
3475}
3476
3477/* 3473/*
3478 * The max latency should be 257 (max the punit can code is 255 and we add 2us 3474 * The max latency should be 257 (max the punit can code is 255 and we add 2us
3479 * for the read latency) and cpp should always be <= 8, so that 3475 * for the read latency) and cpp should always be <= 8, so that
@@ -3524,7 +3520,7 @@ static uint32_t skl_adjusted_plane_pixel_rate(const struct intel_crtc_state *cst
3524 * Adjusted plane pixel rate is just the pipe's adjusted pixel rate 3520 * Adjusted plane pixel rate is just the pipe's adjusted pixel rate
3525 * with additional adjustments for plane-specific scaling. 3521 * with additional adjustments for plane-specific scaling.
3526 */ 3522 */
3527 adjusted_pixel_rate = skl_pipe_pixel_rate(cstate); 3523 adjusted_pixel_rate = ilk_pipe_pixel_rate(cstate);
3528 downscale_amount = skl_plane_downscale_amount(pstate); 3524 downscale_amount = skl_plane_downscale_amount(pstate);
3529 3525
3530 pixel_rate = adjusted_pixel_rate * downscale_amount >> 16; 3526 pixel_rate = adjusted_pixel_rate * downscale_amount >> 16;
@@ -3736,11 +3732,11 @@ skl_compute_linetime_wm(struct intel_crtc_state *cstate)
3736 if (!cstate->base.active) 3732 if (!cstate->base.active)
3737 return 0; 3733 return 0;
3738 3734
3739 if (WARN_ON(skl_pipe_pixel_rate(cstate) == 0)) 3735 if (WARN_ON(ilk_pipe_pixel_rate(cstate) == 0))
3740 return 0; 3736 return 0;
3741 3737
3742 return DIV_ROUND_UP(8 * cstate->base.adjusted_mode.crtc_htotal * 1000, 3738 return DIV_ROUND_UP(8 * cstate->base.adjusted_mode.crtc_htotal * 1000,
3743 skl_pipe_pixel_rate(cstate)); 3739 ilk_pipe_pixel_rate(cstate));
3744} 3740}
3745 3741
3746static void skl_compute_transition_wm(struct intel_crtc_state *cstate, 3742static void skl_compute_transition_wm(struct intel_crtc_state *cstate,
@@ -4050,6 +4046,12 @@ skl_compute_ddb(struct drm_atomic_state *state)
4050 intel_state->wm_results.dirty_pipes = ~0; 4046 intel_state->wm_results.dirty_pipes = ~0;
4051 } 4047 }
4052 4048
4049 /*
4050 * We're not recomputing for the pipes not included in the commit, so
4051 * make sure we start with the current state.
4052 */
4053 memcpy(ddb, &dev_priv->wm.skl_hw.ddb, sizeof(*ddb));
4054
4053 for_each_intel_crtc_mask(dev, intel_crtc, realloc_pipes) { 4055 for_each_intel_crtc_mask(dev, intel_crtc, realloc_pipes) {
4054 struct intel_crtc_state *cstate; 4056 struct intel_crtc_state *cstate;
4055 4057
diff --git a/drivers/gpu/drm/imx/imx-drm-core.c b/drivers/gpu/drm/imx/imx-drm-core.c
index 98df09c2b388..9672b579f950 100644
--- a/drivers/gpu/drm/imx/imx-drm-core.c
+++ b/drivers/gpu/drm/imx/imx-drm-core.c
@@ -357,8 +357,8 @@ static int imx_drm_bind(struct device *dev)
357 int ret; 357 int ret;
358 358
359 drm = drm_dev_alloc(&imx_drm_driver, dev); 359 drm = drm_dev_alloc(&imx_drm_driver, dev);
360 if (!drm) 360 if (IS_ERR(drm))
361 return -ENOMEM; 361 return PTR_ERR(drm);
362 362
363 imxdrm = devm_kzalloc(dev, sizeof(*imxdrm), GFP_KERNEL); 363 imxdrm = devm_kzalloc(dev, sizeof(*imxdrm), GFP_KERNEL);
364 if (!imxdrm) { 364 if (!imxdrm) {
@@ -436,9 +436,11 @@ static int imx_drm_bind(struct device *dev)
436 436
437err_fbhelper: 437err_fbhelper:
438 drm_kms_helper_poll_fini(drm); 438 drm_kms_helper_poll_fini(drm);
439#if IS_ENABLED(CONFIG_DRM_FBDEV_EMULATION)
439 if (imxdrm->fbhelper) 440 if (imxdrm->fbhelper)
440 drm_fbdev_cma_fini(imxdrm->fbhelper); 441 drm_fbdev_cma_fini(imxdrm->fbhelper);
441err_unbind: 442err_unbind:
443#endif
442 component_unbind_all(drm->dev, drm); 444 component_unbind_all(drm->dev, drm);
443err_vblank: 445err_vblank:
444 drm_vblank_cleanup(drm); 446 drm_vblank_cleanup(drm);
diff --git a/drivers/gpu/drm/imx/ipuv3-plane.c b/drivers/gpu/drm/imx/ipuv3-plane.c
index ce22d0a0ddc8..d5864ed4d772 100644
--- a/drivers/gpu/drm/imx/ipuv3-plane.c
+++ b/drivers/gpu/drm/imx/ipuv3-plane.c
@@ -103,11 +103,11 @@ drm_plane_state_to_vbo(struct drm_plane_state *state)
103 (state->src_x >> 16) / 2 - eba; 103 (state->src_x >> 16) / 2 - eba;
104} 104}
105 105
106static void ipu_plane_atomic_set_base(struct ipu_plane *ipu_plane, 106static void ipu_plane_atomic_set_base(struct ipu_plane *ipu_plane)
107 struct drm_plane_state *old_state)
108{ 107{
109 struct drm_plane *plane = &ipu_plane->base; 108 struct drm_plane *plane = &ipu_plane->base;
110 struct drm_plane_state *state = plane->state; 109 struct drm_plane_state *state = plane->state;
110 struct drm_crtc_state *crtc_state = state->crtc->state;
111 struct drm_framebuffer *fb = state->fb; 111 struct drm_framebuffer *fb = state->fb;
112 unsigned long eba, ubo, vbo; 112 unsigned long eba, ubo, vbo;
113 int active; 113 int active;
@@ -117,7 +117,7 @@ static void ipu_plane_atomic_set_base(struct ipu_plane *ipu_plane,
117 switch (fb->pixel_format) { 117 switch (fb->pixel_format) {
118 case DRM_FORMAT_YUV420: 118 case DRM_FORMAT_YUV420:
119 case DRM_FORMAT_YVU420: 119 case DRM_FORMAT_YVU420:
120 if (old_state->fb) 120 if (!drm_atomic_crtc_needs_modeset(crtc_state))
121 break; 121 break;
122 122
123 /* 123 /*
@@ -149,7 +149,7 @@ static void ipu_plane_atomic_set_base(struct ipu_plane *ipu_plane,
149 break; 149 break;
150 } 150 }
151 151
152 if (old_state->fb) { 152 if (!drm_atomic_crtc_needs_modeset(crtc_state)) {
153 active = ipu_idmac_get_current_buffer(ipu_plane->ipu_ch); 153 active = ipu_idmac_get_current_buffer(ipu_plane->ipu_ch);
154 ipu_cpmem_set_buffer(ipu_plane->ipu_ch, !active, eba); 154 ipu_cpmem_set_buffer(ipu_plane->ipu_ch, !active, eba);
155 ipu_idmac_select_buffer(ipu_plane->ipu_ch, !active); 155 ipu_idmac_select_buffer(ipu_plane->ipu_ch, !active);
@@ -259,6 +259,7 @@ static int ipu_plane_atomic_check(struct drm_plane *plane,
259 struct drm_framebuffer *fb = state->fb; 259 struct drm_framebuffer *fb = state->fb;
260 struct drm_framebuffer *old_fb = old_state->fb; 260 struct drm_framebuffer *old_fb = old_state->fb;
261 unsigned long eba, ubo, vbo, old_ubo, old_vbo; 261 unsigned long eba, ubo, vbo, old_ubo, old_vbo;
262 int hsub, vsub;
262 263
263 /* Ok to disable */ 264 /* Ok to disable */
264 if (!fb) 265 if (!fb)
@@ -355,7 +356,9 @@ static int ipu_plane_atomic_check(struct drm_plane *plane,
355 if ((ubo > 0xfffff8) || (vbo > 0xfffff8)) 356 if ((ubo > 0xfffff8) || (vbo > 0xfffff8))
356 return -EINVAL; 357 return -EINVAL;
357 358
358 if (old_fb) { 359 if (old_fb &&
360 (old_fb->pixel_format == DRM_FORMAT_YUV420 ||
361 old_fb->pixel_format == DRM_FORMAT_YVU420)) {
359 old_ubo = drm_plane_state_to_ubo(old_state); 362 old_ubo = drm_plane_state_to_ubo(old_state);
360 old_vbo = drm_plane_state_to_vbo(old_state); 363 old_vbo = drm_plane_state_to_vbo(old_state);
361 if (ubo != old_ubo || vbo != old_vbo) 364 if (ubo != old_ubo || vbo != old_vbo)
@@ -370,6 +373,16 @@ static int ipu_plane_atomic_check(struct drm_plane *plane,
370 373
371 if (old_fb && old_fb->pitches[1] != fb->pitches[1]) 374 if (old_fb && old_fb->pitches[1] != fb->pitches[1])
372 crtc_state->mode_changed = true; 375 crtc_state->mode_changed = true;
376
377 /*
378 * The x/y offsets must be even in case of horizontal/vertical
379 * chroma subsampling.
380 */
381 hsub = drm_format_horz_chroma_subsampling(fb->pixel_format);
382 vsub = drm_format_vert_chroma_subsampling(fb->pixel_format);
383 if (((state->src_x >> 16) & (hsub - 1)) ||
384 ((state->src_y >> 16) & (vsub - 1)))
385 return -EINVAL;
373 } 386 }
374 387
375 return 0; 388 return 0;
@@ -392,7 +405,7 @@ static void ipu_plane_atomic_update(struct drm_plane *plane,
392 struct drm_crtc_state *crtc_state = state->crtc->state; 405 struct drm_crtc_state *crtc_state = state->crtc->state;
393 406
394 if (!drm_atomic_crtc_needs_modeset(crtc_state)) { 407 if (!drm_atomic_crtc_needs_modeset(crtc_state)) {
395 ipu_plane_atomic_set_base(ipu_plane, old_state); 408 ipu_plane_atomic_set_base(ipu_plane);
396 return; 409 return;
397 } 410 }
398 } 411 }
@@ -424,6 +437,7 @@ static void ipu_plane_atomic_update(struct drm_plane *plane,
424 ipu_dp_set_global_alpha(ipu_plane->dp, false, 0, false); 437 ipu_dp_set_global_alpha(ipu_plane->dp, false, 0, false);
425 break; 438 break;
426 default: 439 default:
440 ipu_dp_set_global_alpha(ipu_plane->dp, true, 0, true);
427 break; 441 break;
428 } 442 }
429 } 443 }
@@ -437,7 +451,7 @@ static void ipu_plane_atomic_update(struct drm_plane *plane,
437 ipu_cpmem_set_high_priority(ipu_plane->ipu_ch); 451 ipu_cpmem_set_high_priority(ipu_plane->ipu_ch);
438 ipu_idmac_set_double_buffer(ipu_plane->ipu_ch, 1); 452 ipu_idmac_set_double_buffer(ipu_plane->ipu_ch, 1);
439 ipu_cpmem_set_stride(ipu_plane->ipu_ch, state->fb->pitches[0]); 453 ipu_cpmem_set_stride(ipu_plane->ipu_ch, state->fb->pitches[0]);
440 ipu_plane_atomic_set_base(ipu_plane, old_state); 454 ipu_plane_atomic_set_base(ipu_plane);
441 ipu_plane_enable(ipu_plane); 455 ipu_plane_enable(ipu_plane);
442} 456}
443 457
diff --git a/drivers/gpu/drm/nouveau/nouveau_acpi.c b/drivers/gpu/drm/nouveau/nouveau_acpi.c
index dc57b628e074..193573d191e5 100644
--- a/drivers/gpu/drm/nouveau/nouveau_acpi.c
+++ b/drivers/gpu/drm/nouveau/nouveau_acpi.c
@@ -240,7 +240,8 @@ static bool nouveau_pr3_present(struct pci_dev *pdev)
240 if (!parent_adev) 240 if (!parent_adev)
241 return false; 241 return false;
242 242
243 return acpi_has_method(parent_adev->handle, "_PR3"); 243 return parent_adev->power.flags.power_resources &&
244 acpi_has_method(parent_adev->handle, "_PR3");
244} 245}
245 246
246static void nouveau_dsm_pci_probe(struct pci_dev *pdev, acpi_handle *dhandle_out, 247static void nouveau_dsm_pci_probe(struct pci_dev *pdev, acpi_handle *dhandle_out,
diff --git a/drivers/gpu/drm/radeon/ni.c b/drivers/gpu/drm/radeon/ni.c
index 103fc8650197..a0d4a0522fdc 100644
--- a/drivers/gpu/drm/radeon/ni.c
+++ b/drivers/gpu/drm/radeon/ni.c
@@ -1396,9 +1396,7 @@ static void cayman_pcie_gart_fini(struct radeon_device *rdev)
1396void cayman_cp_int_cntl_setup(struct radeon_device *rdev, 1396void cayman_cp_int_cntl_setup(struct radeon_device *rdev,
1397 int ring, u32 cp_int_cntl) 1397 int ring, u32 cp_int_cntl)
1398{ 1398{
1399 u32 srbm_gfx_cntl = RREG32(SRBM_GFX_CNTL) & ~3; 1399 WREG32(SRBM_GFX_CNTL, RINGID(ring));
1400
1401 WREG32(SRBM_GFX_CNTL, srbm_gfx_cntl | (ring & 3));
1402 WREG32(CP_INT_CNTL, cp_int_cntl); 1400 WREG32(CP_INT_CNTL, cp_int_cntl);
1403} 1401}
1404 1402
diff --git a/drivers/gpu/drm/radeon/radeon_dp_auxch.c b/drivers/gpu/drm/radeon/radeon_dp_auxch.c
index 2d465648856a..474a8a1886f7 100644
--- a/drivers/gpu/drm/radeon/radeon_dp_auxch.c
+++ b/drivers/gpu/drm/radeon/radeon_dp_auxch.c
@@ -105,7 +105,7 @@ radeon_dp_aux_transfer_native(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg
105 105
106 tmp &= AUX_HPD_SEL(0x7); 106 tmp &= AUX_HPD_SEL(0x7);
107 tmp |= AUX_HPD_SEL(chan->rec.hpd); 107 tmp |= AUX_HPD_SEL(chan->rec.hpd);
108 tmp |= AUX_EN | AUX_LS_READ_EN | AUX_HPD_DISCON(0x1); 108 tmp |= AUX_EN | AUX_LS_READ_EN;
109 109
110 WREG32(AUX_CONTROL + aux_offset[instance], tmp); 110 WREG32(AUX_CONTROL + aux_offset[instance], tmp);
111 111
diff --git a/drivers/gpu/drm/radeon/si_dpm.c b/drivers/gpu/drm/radeon/si_dpm.c
index 89bdf20344ae..c49934527a87 100644
--- a/drivers/gpu/drm/radeon/si_dpm.c
+++ b/drivers/gpu/drm/radeon/si_dpm.c
@@ -2999,6 +2999,49 @@ static void si_apply_state_adjust_rules(struct radeon_device *rdev,
2999 int i; 2999 int i;
3000 struct si_dpm_quirk *p = si_dpm_quirk_list; 3000 struct si_dpm_quirk *p = si_dpm_quirk_list;
3001 3001
3002 /* limit all SI kickers */
3003 if (rdev->family == CHIP_PITCAIRN) {
3004 if ((rdev->pdev->revision == 0x81) ||
3005 (rdev->pdev->device == 0x6810) ||
3006 (rdev->pdev->device == 0x6811) ||
3007 (rdev->pdev->device == 0x6816) ||
3008 (rdev->pdev->device == 0x6817) ||
3009 (rdev->pdev->device == 0x6806))
3010 max_mclk = 120000;
3011 } else if (rdev->family == CHIP_VERDE) {
3012 if ((rdev->pdev->revision == 0x81) ||
3013 (rdev->pdev->revision == 0x83) ||
3014 (rdev->pdev->revision == 0x87) ||
3015 (rdev->pdev->device == 0x6820) ||
3016 (rdev->pdev->device == 0x6821) ||
3017 (rdev->pdev->device == 0x6822) ||
3018 (rdev->pdev->device == 0x6823) ||
3019 (rdev->pdev->device == 0x682A) ||
3020 (rdev->pdev->device == 0x682B)) {
3021 max_sclk = 75000;
3022 max_mclk = 80000;
3023 }
3024 } else if (rdev->family == CHIP_OLAND) {
3025 if ((rdev->pdev->revision == 0xC7) ||
3026 (rdev->pdev->revision == 0x80) ||
3027 (rdev->pdev->revision == 0x81) ||
3028 (rdev->pdev->revision == 0x83) ||
3029 (rdev->pdev->device == 0x6604) ||
3030 (rdev->pdev->device == 0x6605)) {
3031 max_sclk = 75000;
3032 max_mclk = 80000;
3033 }
3034 } else if (rdev->family == CHIP_HAINAN) {
3035 if ((rdev->pdev->revision == 0x81) ||
3036 (rdev->pdev->revision == 0x83) ||
3037 (rdev->pdev->revision == 0xC3) ||
3038 (rdev->pdev->device == 0x6664) ||
3039 (rdev->pdev->device == 0x6665) ||
3040 (rdev->pdev->device == 0x6667)) {
3041 max_sclk = 75000;
3042 max_mclk = 80000;
3043 }
3044 }
3002 /* Apply dpm quirks */ 3045 /* Apply dpm quirks */
3003 while (p && p->chip_device != 0) { 3046 while (p && p->chip_device != 0) {
3004 if (rdev->pdev->vendor == p->chip_vendor && 3047 if (rdev->pdev->vendor == p->chip_vendor &&
@@ -3011,16 +3054,6 @@ static void si_apply_state_adjust_rules(struct radeon_device *rdev,
3011 } 3054 }
3012 ++p; 3055 ++p;
3013 } 3056 }
3014 /* limit mclk on all R7 370 parts for stability */
3015 if (rdev->pdev->device == 0x6811 &&
3016 rdev->pdev->revision == 0x81)
3017 max_mclk = 120000;
3018 /* limit sclk/mclk on Jet parts for stability */
3019 if (rdev->pdev->device == 0x6665 &&
3020 rdev->pdev->revision == 0xc3) {
3021 max_sclk = 75000;
3022 max_mclk = 80000;
3023 }
3024 3057
3025 if (rps->vce_active) { 3058 if (rps->vce_active) {
3026 rps->evclk = rdev->pm.dpm.vce_states[rdev->pm.dpm.vce_level].evclk; 3059 rps->evclk = rdev->pm.dpm.vce_states[rdev->pm.dpm.vce_level].evclk;
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_kms.c b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
index bd9c3bb9252c..392c7e6de042 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_kms.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
@@ -231,8 +231,16 @@ static int rcar_du_atomic_check(struct drm_device *dev,
231 struct rcar_du_device *rcdu = dev->dev_private; 231 struct rcar_du_device *rcdu = dev->dev_private;
232 int ret; 232 int ret;
233 233
234 ret = drm_atomic_helper_check(dev, state); 234 ret = drm_atomic_helper_check_modeset(dev, state);
235 if (ret < 0) 235 if (ret)
236 return ret;
237
238 ret = drm_atomic_normalize_zpos(dev, state);
239 if (ret)
240 return ret;
241
242 ret = drm_atomic_helper_check_planes(dev, state);
243 if (ret)
236 return ret; 244 return ret;
237 245
238 if (rcar_du_has(rcdu, RCAR_DU_FEATURE_VSP1_SOURCE)) 246 if (rcar_du_has(rcdu, RCAR_DU_FEATURE_VSP1_SOURCE))
diff --git a/drivers/gpu/drm/sti/sti_drv.c b/drivers/gpu/drm/sti/sti_drv.c
index 2784919a7366..9df308565f6c 100644
--- a/drivers/gpu/drm/sti/sti_drv.c
+++ b/drivers/gpu/drm/sti/sti_drv.c
@@ -195,6 +195,26 @@ static void sti_atomic_work(struct work_struct *work)
195 sti_atomic_complete(private, private->commit.state); 195 sti_atomic_complete(private, private->commit.state);
196} 196}
197 197
198static int sti_atomic_check(struct drm_device *dev,
199 struct drm_atomic_state *state)
200{
201 int ret;
202
203 ret = drm_atomic_helper_check_modeset(dev, state);
204 if (ret)
205 return ret;
206
207 ret = drm_atomic_normalize_zpos(dev, state);
208 if (ret)
209 return ret;
210
211 ret = drm_atomic_helper_check_planes(dev, state);
212 if (ret)
213 return ret;
214
215 return ret;
216}
217
198static int sti_atomic_commit(struct drm_device *drm, 218static int sti_atomic_commit(struct drm_device *drm,
199 struct drm_atomic_state *state, bool nonblock) 219 struct drm_atomic_state *state, bool nonblock)
200{ 220{
@@ -248,7 +268,7 @@ static void sti_output_poll_changed(struct drm_device *ddev)
248static const struct drm_mode_config_funcs sti_mode_config_funcs = { 268static const struct drm_mode_config_funcs sti_mode_config_funcs = {
249 .fb_create = drm_fb_cma_create, 269 .fb_create = drm_fb_cma_create,
250 .output_poll_changed = sti_output_poll_changed, 270 .output_poll_changed = sti_output_poll_changed,
251 .atomic_check = drm_atomic_helper_check, 271 .atomic_check = sti_atomic_check,
252 .atomic_commit = sti_atomic_commit, 272 .atomic_commit = sti_atomic_commit,
253}; 273};
254 274
diff --git a/drivers/gpu/drm/virtio/virtgpu_display.c b/drivers/gpu/drm/virtio/virtgpu_display.c
index 7cf3678623c3..58048709c34e 100644
--- a/drivers/gpu/drm/virtio/virtgpu_display.c
+++ b/drivers/gpu/drm/virtio/virtgpu_display.c
@@ -338,8 +338,7 @@ static void vgdev_atomic_commit_tail(struct drm_atomic_state *state)
338 338
339 drm_atomic_helper_commit_modeset_disables(dev, state); 339 drm_atomic_helper_commit_modeset_disables(dev, state);
340 drm_atomic_helper_commit_modeset_enables(dev, state); 340 drm_atomic_helper_commit_modeset_enables(dev, state);
341 drm_atomic_helper_commit_planes(dev, state, 341 drm_atomic_helper_commit_planes(dev, state, 0);
342 DRM_PLANE_COMMIT_ACTIVE_ONLY);
343 342
344 drm_atomic_helper_commit_hw_done(state); 343 drm_atomic_helper_commit_hw_done(state);
345 344
diff --git a/drivers/gpu/ipu-v3/ipu-image-convert.c b/drivers/gpu/ipu-v3/ipu-image-convert.c
index 2ba7d437a2af..805b6fa7b5f4 100644
--- a/drivers/gpu/ipu-v3/ipu-image-convert.c
+++ b/drivers/gpu/ipu-v3/ipu-image-convert.c
@@ -1617,7 +1617,7 @@ ipu_image_convert(struct ipu_soc *ipu, enum ipu_ic_task ic_task,
1617 ctx = ipu_image_convert_prepare(ipu, ic_task, in, out, rot_mode, 1617 ctx = ipu_image_convert_prepare(ipu, ic_task, in, out, rot_mode,
1618 complete, complete_context); 1618 complete, complete_context);
1619 if (IS_ERR(ctx)) 1619 if (IS_ERR(ctx))
1620 return ERR_PTR(PTR_ERR(ctx)); 1620 return ERR_CAST(ctx);
1621 1621
1622 run = kzalloc(sizeof(*run), GFP_KERNEL); 1622 run = kzalloc(sizeof(*run), GFP_KERNEL);
1623 if (!run) { 1623 if (!run) {
diff --git a/include/drm/drm_plane.h b/include/drm/drm_plane.h
index 43cf193e54d6..8b4dc62470ff 100644
--- a/include/drm/drm_plane.h
+++ b/include/drm/drm_plane.h
@@ -47,8 +47,14 @@ struct drm_crtc;
47 * @src_h: height of visible portion of plane (in 16.16) 47 * @src_h: height of visible portion of plane (in 16.16)
48 * @rotation: rotation of the plane 48 * @rotation: rotation of the plane
49 * @zpos: priority of the given plane on crtc (optional) 49 * @zpos: priority of the given plane on crtc (optional)
50 * Note that multiple active planes on the same crtc can have an identical
51 * zpos value. The rule to solving the conflict is to compare the plane
52 * object IDs; the plane with a higher ID must be stacked on top of a
53 * plane with a lower ID.
50 * @normalized_zpos: normalized value of zpos: unique, range from 0 to N-1 54 * @normalized_zpos: normalized value of zpos: unique, range from 0 to N-1
51 * where N is the number of active planes for given crtc 55 * where N is the number of active planes for given crtc. Note that
56 * the driver must call drm_atomic_normalize_zpos() to update this before
57 * it can be trusted.
52 * @src: clipped source coordinates of the plane (in 16.16) 58 * @src: clipped source coordinates of the plane (in 16.16)
53 * @dst: clipped destination coordinates of the plane 59 * @dst: clipped destination coordinates of the plane
54 * @visible: visibility of the plane 60 * @visible: visibility of the plane