aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2016-10-10 02:40:16 -0400
committerDave Airlie <airlied@redhat.com>2016-10-10 02:40:16 -0400
commitb89857852656f016328d2d7ccec5fff57445fa85 (patch)
tree1eef71273ad92cb1f5874acdb94c7b5a0b1ee958
parent9c704d14386dc1deeb695f2a180f9a00f23fa650 (diff)
parent8036617e92e3fad49eef9bbe868b661c58249aff (diff)
Merge branch 'drm-next-4.9' of git://people.freedesktop.org/~agd5f/linux into drm-next
Just some misc bug fixes for 4.9. * 'drm-next-4.9' of git://people.freedesktop.org/~agd5f/linux: drm/amdgpu: revert "use more than 64KB fragment size if possible" drm/amdgpu: warn if dp aux is still attached on free drm/amdgpu/dce11: add missing drm_mode_config_cleanup call drm/amdgpu: also track late init state drm/amdgpu/virtual_dce: adjust config ifdef drm/amdgpu/vce: add support for hw config packet (v2) drm/amdgpu: clean up to set fw_offset as 0 twice drm/amdgpu: remove DRM_AMD_POWERPLAY drm/radeon: Prevent races on pre DCE4 between flip submission and completion. drm/radeon: Slightly more robust flip completion handling for < DCE-4
-rw-r--r--drivers/gpu/drm/amd/amdgpu/Kconfig1
-rw-r--r--drivers/gpu/drm/amd/amdgpu/Makefile4
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu.h1
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c4
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_device.c4
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c2
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_i2c.c1
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_powerplay.c13
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c1
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c14
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c12
-rw-r--r--drivers/gpu/drm/amd/amdgpu/dce_v11_0.c1
-rw-r--r--drivers/gpu/drm/amd/amdgpu/dce_virtual.c4
-rw-r--r--drivers/gpu/drm/amd/powerplay/Kconfig6
-rw-r--r--drivers/gpu/drm/radeon/atombios_crtc.c4
-rw-r--r--drivers/gpu/drm/radeon/radeon_display.c47
-rw-r--r--drivers/gpu/drm/radeon/rv515.c3
17 files changed, 67 insertions, 55 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/Kconfig b/drivers/gpu/drm/amd/amdgpu/Kconfig
index 53cf3971dfc3..61360e27715f 100644
--- a/drivers/gpu/drm/amd/amdgpu/Kconfig
+++ b/drivers/gpu/drm/amd/amdgpu/Kconfig
@@ -32,5 +32,4 @@ config DRM_AMDGPU_GART_DEBUGFS
32 Selecting this option creates a debugfs file to inspect the mapped 32 Selecting this option creates a debugfs file to inspect the mapped
33 pages. Uses more memory for housekeeping, enable only for debugging. 33 pages. Uses more memory for housekeeping, enable only for debugging.
34 34
35source "drivers/gpu/drm/amd/powerplay/Kconfig"
36source "drivers/gpu/drm/amd/acp/Kconfig" 35source "drivers/gpu/drm/amd/acp/Kconfig"
diff --git a/drivers/gpu/drm/amd/amdgpu/Makefile b/drivers/gpu/drm/amd/amdgpu/Makefile
index 9ec262d4b8a2..248a05d02917 100644
--- a/drivers/gpu/drm/amd/amdgpu/Makefile
+++ b/drivers/gpu/drm/amd/amdgpu/Makefile
@@ -111,14 +111,10 @@ amdgpu-$(CONFIG_VGA_SWITCHEROO) += amdgpu_atpx_handler.o
111amdgpu-$(CONFIG_ACPI) += amdgpu_acpi.o 111amdgpu-$(CONFIG_ACPI) += amdgpu_acpi.o
112amdgpu-$(CONFIG_MMU_NOTIFIER) += amdgpu_mn.o 112amdgpu-$(CONFIG_MMU_NOTIFIER) += amdgpu_mn.o
113 113
114ifneq ($(CONFIG_DRM_AMD_POWERPLAY),)
115
116include $(FULL_AMD_PATH)/powerplay/Makefile 114include $(FULL_AMD_PATH)/powerplay/Makefile
117 115
118amdgpu-y += $(AMD_POWERPLAY_FILES) 116amdgpu-y += $(AMD_POWERPLAY_FILES)
119 117
120endif
121
122obj-$(CONFIG_DRM_AMDGPU)+= amdgpu.o 118obj-$(CONFIG_DRM_AMDGPU)+= amdgpu.o
123 119
124CFLAGS_amdgpu_trace_points.o := -I$(src) 120CFLAGS_amdgpu_trace_points.o := -I$(src)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
index 235f3902643a..039b57e4644c 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
@@ -1943,6 +1943,7 @@ struct amdgpu_ip_block_status {
1943 bool valid; 1943 bool valid;
1944 bool sw; 1944 bool sw;
1945 bool hw; 1945 bool hw;
1946 bool late_initialized;
1946 bool hang; 1947 bool hang;
1947}; 1948};
1948 1949
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c
index 22c11e7698c8..2e3a0543760d 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c
@@ -769,8 +769,10 @@ static void amdgpu_connector_destroy(struct drm_connector *connector)
769{ 769{
770 struct amdgpu_connector *amdgpu_connector = to_amdgpu_connector(connector); 770 struct amdgpu_connector *amdgpu_connector = to_amdgpu_connector(connector);
771 771
772 if (amdgpu_connector->ddc_bus->has_aux) 772 if (amdgpu_connector->ddc_bus->has_aux) {
773 drm_dp_aux_unregister(&amdgpu_connector->ddc_bus->aux); 773 drm_dp_aux_unregister(&amdgpu_connector->ddc_bus->aux);
774 amdgpu_connector->ddc_bus->has_aux = false;
775 }
774 amdgpu_connector_free_edid(connector); 776 amdgpu_connector_free_edid(connector);
775 kfree(amdgpu_connector->con_priv); 777 kfree(amdgpu_connector->con_priv);
776 drm_connector_unregister(connector); 778 drm_connector_unregister(connector);
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index 99a15cad6789..a58513f271e3 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -1424,6 +1424,7 @@ static int amdgpu_late_init(struct amdgpu_device *adev)
1424 DRM_ERROR("late_init of IP block <%s> failed %d\n", adev->ip_blocks[i].funcs->name, r); 1424 DRM_ERROR("late_init of IP block <%s> failed %d\n", adev->ip_blocks[i].funcs->name, r);
1425 return r; 1425 return r;
1426 } 1426 }
1427 adev->ip_block_status[i].late_initialized = true;
1427 } 1428 }
1428 } 1429 }
1429 1430
@@ -1469,8 +1470,11 @@ static int amdgpu_fini(struct amdgpu_device *adev)
1469 } 1470 }
1470 1471
1471 for (i = adev->num_ip_blocks - 1; i >= 0; i--) { 1472 for (i = adev->num_ip_blocks - 1; i >= 0; i--) {
1473 if (!adev->ip_block_status[i].late_initialized)
1474 continue;
1472 if (adev->ip_blocks[i].funcs->late_fini) 1475 if (adev->ip_blocks[i].funcs->late_fini)
1473 adev->ip_blocks[i].funcs->late_fini((void *)adev); 1476 adev->ip_blocks[i].funcs->late_fini((void *)adev);
1477 adev->ip_block_status[i].late_initialized = false;
1474 } 1478 }
1475 1479
1476 return 0; 1480 return 0;
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
index dbe89fb25694..71ed27eb3dde 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
@@ -174,7 +174,6 @@ module_param_named(sched_jobs, amdgpu_sched_jobs, int, 0444);
174MODULE_PARM_DESC(sched_hw_submission, "the max number of HW submissions (default 2)"); 174MODULE_PARM_DESC(sched_hw_submission, "the max number of HW submissions (default 2)");
175module_param_named(sched_hw_submission, amdgpu_sched_hw_submission, int, 0444); 175module_param_named(sched_hw_submission, amdgpu_sched_hw_submission, int, 0444);
176 176
177#ifdef CONFIG_DRM_AMD_POWERPLAY
178MODULE_PARM_DESC(powerplay, "Powerplay component (1 = enable, 0 = disable, -1 = auto (default))"); 177MODULE_PARM_DESC(powerplay, "Powerplay component (1 = enable, 0 = disable, -1 = auto (default))");
179module_param_named(powerplay, amdgpu_powerplay, int, 0444); 178module_param_named(powerplay, amdgpu_powerplay, int, 0444);
180 179
@@ -183,7 +182,6 @@ module_param_named(powercontainment, amdgpu_powercontainment, int, 0444);
183 182
184MODULE_PARM_DESC(ppfeaturemask, "all power features enabled (default))"); 183MODULE_PARM_DESC(ppfeaturemask, "all power features enabled (default))");
185module_param_named(ppfeaturemask, amdgpu_pp_feature_mask, int, 0444); 184module_param_named(ppfeaturemask, amdgpu_pp_feature_mask, int, 0444);
186#endif
187 185
188MODULE_PARM_DESC(sclkdeepsleep, "SCLK Deep Sleep (1 = enable (default), 0 = disable)"); 186MODULE_PARM_DESC(sclkdeepsleep, "SCLK Deep Sleep (1 = enable (default), 0 = disable)");
189module_param_named(sclkdeepsleep, amdgpu_sclk_deep_sleep_en, int, 0444); 187module_param_named(sclkdeepsleep, amdgpu_sclk_deep_sleep_en, int, 0444);
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_i2c.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_i2c.c
index 34bab616588c..91d367399956 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_i2c.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_i2c.c
@@ -220,6 +220,7 @@ void amdgpu_i2c_destroy(struct amdgpu_i2c_chan *i2c)
220{ 220{
221 if (!i2c) 221 if (!i2c)
222 return; 222 return;
223 WARN_ON(i2c->has_aux);
223 i2c_del_adapter(&i2c->adapter); 224 i2c_del_adapter(&i2c->adapter);
224 kfree(i2c); 225 kfree(i2c);
225} 226}
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_powerplay.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_powerplay.c
index 68ad24101a36..7532ff822aa7 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_powerplay.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_powerplay.c
@@ -42,7 +42,6 @@ static int amdgpu_powerplay_init(struct amdgpu_device *adev)
42 amd_pp = &(adev->powerplay); 42 amd_pp = &(adev->powerplay);
43 43
44 if (adev->pp_enabled) { 44 if (adev->pp_enabled) {
45#ifdef CONFIG_DRM_AMD_POWERPLAY
46 struct amd_pp_init *pp_init; 45 struct amd_pp_init *pp_init;
47 46
48 pp_init = kzalloc(sizeof(struct amd_pp_init), GFP_KERNEL); 47 pp_init = kzalloc(sizeof(struct amd_pp_init), GFP_KERNEL);
@@ -55,7 +54,6 @@ static int amdgpu_powerplay_init(struct amdgpu_device *adev)
55 pp_init->device = amdgpu_cgs_create_device(adev); 54 pp_init->device = amdgpu_cgs_create_device(adev);
56 ret = amd_powerplay_init(pp_init, amd_pp); 55 ret = amd_powerplay_init(pp_init, amd_pp);
57 kfree(pp_init); 56 kfree(pp_init);
58#endif
59 } else { 57 } else {
60 amd_pp->pp_handle = (void *)adev; 58 amd_pp->pp_handle = (void *)adev;
61 59
@@ -97,7 +95,6 @@ static int amdgpu_pp_early_init(void *handle)
97 struct amdgpu_device *adev = (struct amdgpu_device *)handle; 95 struct amdgpu_device *adev = (struct amdgpu_device *)handle;
98 int ret = 0; 96 int ret = 0;
99 97
100#ifdef CONFIG_DRM_AMD_POWERPLAY
101 switch (adev->asic_type) { 98 switch (adev->asic_type) {
102 case CHIP_POLARIS11: 99 case CHIP_POLARIS11:
103 case CHIP_POLARIS10: 100 case CHIP_POLARIS10:
@@ -120,9 +117,6 @@ static int amdgpu_pp_early_init(void *handle)
120 adev->pp_enabled = false; 117 adev->pp_enabled = false;
121 break; 118 break;
122 } 119 }
123#else
124 adev->pp_enabled = false;
125#endif
126 120
127 ret = amdgpu_powerplay_init(adev); 121 ret = amdgpu_powerplay_init(adev);
128 if (ret) 122 if (ret)
@@ -144,12 +138,11 @@ static int amdgpu_pp_late_init(void *handle)
144 ret = adev->powerplay.ip_funcs->late_init( 138 ret = adev->powerplay.ip_funcs->late_init(
145 adev->powerplay.pp_handle); 139 adev->powerplay.pp_handle);
146 140
147#ifdef CONFIG_DRM_AMD_POWERPLAY
148 if (adev->pp_enabled && adev->pm.dpm_enabled) { 141 if (adev->pp_enabled && adev->pm.dpm_enabled) {
149 amdgpu_pm_sysfs_init(adev); 142 amdgpu_pm_sysfs_init(adev);
150 amdgpu_dpm_dispatch_task(adev, AMD_PP_EVENT_COMPLETE_INIT, NULL, NULL); 143 amdgpu_dpm_dispatch_task(adev, AMD_PP_EVENT_COMPLETE_INIT, NULL, NULL);
151 } 144 }
152#endif 145
153 return ret; 146 return ret;
154} 147}
155 148
@@ -162,10 +155,8 @@ static int amdgpu_pp_sw_init(void *handle)
162 ret = adev->powerplay.ip_funcs->sw_init( 155 ret = adev->powerplay.ip_funcs->sw_init(
163 adev->powerplay.pp_handle); 156 adev->powerplay.pp_handle);
164 157
165#ifdef CONFIG_DRM_AMD_POWERPLAY
166 if (adev->pp_enabled) 158 if (adev->pp_enabled)
167 adev->pm.dpm_enabled = true; 159 adev->pm.dpm_enabled = true;
168#endif
169 160
170 return ret; 161 return ret;
171} 162}
@@ -216,7 +207,6 @@ static int amdgpu_pp_hw_fini(void *handle)
216 207
217static void amdgpu_pp_late_fini(void *handle) 208static void amdgpu_pp_late_fini(void *handle)
218{ 209{
219#ifdef CONFIG_DRM_AMD_POWERPLAY
220 struct amdgpu_device *adev = (struct amdgpu_device *)handle; 210 struct amdgpu_device *adev = (struct amdgpu_device *)handle;
221 211
222 if (adev->pp_enabled) { 212 if (adev->pp_enabled) {
@@ -227,7 +217,6 @@ static void amdgpu_pp_late_fini(void *handle)
227 if (adev->powerplay.ip_funcs->late_fini) 217 if (adev->powerplay.ip_funcs->late_fini)
228 adev->powerplay.ip_funcs->late_fini( 218 adev->powerplay.ip_funcs->late_fini(
229 adev->powerplay.pp_handle); 219 adev->powerplay.pp_handle);
230#endif
231} 220}
232 221
233static int amdgpu_pp_suspend(void *handle) 222static int amdgpu_pp_suspend(void *handle)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c
index 7a05f79818f1..cb3d252f3c78 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c
@@ -273,7 +273,6 @@ int amdgpu_ucode_init_bo(struct amdgpu_device *adev)
273 273
274 amdgpu_bo_unreserve(*bo); 274 amdgpu_bo_unreserve(*bo);
275 275
276 fw_offset = 0;
277 for (i = 0; i < AMDGPU_UCODE_ID_MAXIMUM; i++) { 276 for (i = 0; i < AMDGPU_UCODE_ID_MAXIMUM; i++) {
278 ucode = &adev->firmware.ucode[i]; 277 ucode = &adev->firmware.ucode[i];
279 if (ucode->fw) { 278 if (ucode->fw) {
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c
index 3b03558ddb01..7fe8fd884f06 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c
@@ -699,6 +699,20 @@ int amdgpu_vce_ring_parse_cs(struct amdgpu_cs_parser *p, uint32_t ib_idx)
699 case 0x05000009: /* clock table */ 699 case 0x05000009: /* clock table */
700 break; 700 break;
701 701
702 case 0x0500000c: /* hw config */
703 switch (p->adev->asic_type) {
704#ifdef CONFIG_DRM_AMDGPU_CIK
705 case CHIP_KAVERI:
706 case CHIP_MULLINS:
707#endif
708 case CHIP_CARRIZO:
709 break;
710 default:
711 r = -EINVAL;
712 goto out;
713 }
714 break;
715
702 case 0x03000001: /* encode */ 716 case 0x03000001: /* encode */
703 r = amdgpu_vce_cs_reloc(p, ib_idx, idx + 10, idx + 9, 717 r = amdgpu_vce_cs_reloc(p, ib_idx, idx + 10, idx + 9,
704 *size, 0); 718 *size, 0);
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
index bc4b22c6fc08..06f24322e7c3 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
@@ -878,13 +878,13 @@ static void amdgpu_vm_frag_ptes(struct amdgpu_pte_update_params *params,
878 * allocation size to the fragment size. 878 * allocation size to the fragment size.
879 */ 879 */
880 880
881 const uint64_t frag_align = 1 << AMDGPU_LOG2_PAGES_PER_FRAG; 881 /* SI and newer are optimized for 64KB */
882 uint64_t frag_flags = AMDGPU_PTE_FRAG(AMDGPU_LOG2_PAGES_PER_FRAG);
883 uint64_t frag_align = 1 << AMDGPU_LOG2_PAGES_PER_FRAG;
882 884
883 uint64_t frag_start = ALIGN(start, frag_align); 885 uint64_t frag_start = ALIGN(start, frag_align);
884 uint64_t frag_end = end & ~(frag_align - 1); 886 uint64_t frag_end = end & ~(frag_align - 1);
885 887
886 uint32_t frag;
887
888 /* system pages are non continuously */ 888 /* system pages are non continuously */
889 if (params->src || !(flags & AMDGPU_PTE_VALID) || 889 if (params->src || !(flags & AMDGPU_PTE_VALID) ||
890 (frag_start >= frag_end)) { 890 (frag_start >= frag_end)) {
@@ -893,10 +893,6 @@ static void amdgpu_vm_frag_ptes(struct amdgpu_pte_update_params *params,
893 return; 893 return;
894 } 894 }
895 895
896 /* use more than 64KB fragment size if possible */
897 frag = lower_32_bits(frag_start | frag_end);
898 frag = likely(frag) ? __ffs(frag) : 31;
899
900 /* handle the 4K area at the beginning */ 896 /* handle the 4K area at the beginning */
901 if (start != frag_start) { 897 if (start != frag_start) {
902 amdgpu_vm_update_ptes(params, vm, start, frag_start, 898 amdgpu_vm_update_ptes(params, vm, start, frag_start,
@@ -906,7 +902,7 @@ static void amdgpu_vm_frag_ptes(struct amdgpu_pte_update_params *params,
906 902
907 /* handle the area in the middle */ 903 /* handle the area in the middle */
908 amdgpu_vm_update_ptes(params, vm, frag_start, frag_end, dst, 904 amdgpu_vm_update_ptes(params, vm, frag_start, frag_end, dst,
909 flags | AMDGPU_PTE_FRAG(frag)); 905 flags | frag_flags);
910 906
911 /* handle the 4K area at the end */ 907 /* handle the 4K area at the end */
912 if (frag_end != end) { 908 if (frag_end != end) {
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
index 678f5eb6cbc2..f264b8f17ad1 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
@@ -3159,6 +3159,7 @@ static int dce_v11_0_sw_fini(void *handle)
3159 3159
3160 dce_v11_0_afmt_fini(adev); 3160 dce_v11_0_afmt_fini(adev);
3161 3161
3162 drm_mode_config_cleanup(adev->ddev);
3162 adev->mode_info.mode_config_initialized = false; 3163 adev->mode_info.mode_config_initialized = false;
3163 3164
3164 return 0; 3165 return 0;
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
index a754f2522ba2..c2bd9f045532 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
@@ -99,15 +99,15 @@ static void dce_virtual_stop_mc_access(struct amdgpu_device *adev,
99 struct amdgpu_mode_mc_save *save) 99 struct amdgpu_mode_mc_save *save)
100{ 100{
101 switch (adev->asic_type) { 101 switch (adev->asic_type) {
102#ifdef CONFIG_DRM_AMDGPU_CIK
102 case CHIP_BONAIRE: 103 case CHIP_BONAIRE:
103 case CHIP_HAWAII: 104 case CHIP_HAWAII:
104 case CHIP_KAVERI: 105 case CHIP_KAVERI:
105 case CHIP_KABINI: 106 case CHIP_KABINI:
106 case CHIP_MULLINS: 107 case CHIP_MULLINS:
107#ifdef CONFIG_DRM_AMDGPU_CIK
108 dce_v8_0_disable_dce(adev); 108 dce_v8_0_disable_dce(adev);
109#endif
110 break; 109 break;
110#endif
111 case CHIP_FIJI: 111 case CHIP_FIJI:
112 case CHIP_TONGA: 112 case CHIP_TONGA:
113 dce_v10_0_disable_dce(adev); 113 dce_v10_0_disable_dce(adev);
diff --git a/drivers/gpu/drm/amd/powerplay/Kconfig b/drivers/gpu/drm/amd/powerplay/Kconfig
deleted file mode 100644
index af380335b425..000000000000
--- a/drivers/gpu/drm/amd/powerplay/Kconfig
+++ /dev/null
@@ -1,6 +0,0 @@
1config DRM_AMD_POWERPLAY
2 bool "Enable AMD powerplay component"
3 depends on DRM_AMDGPU
4 default n
5 help
6 select this option will enable AMD powerplay component.
diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c
index a4e9f35da3a2..74f99bac08b1 100644
--- a/drivers/gpu/drm/radeon/atombios_crtc.c
+++ b/drivers/gpu/drm/radeon/atombios_crtc.c
@@ -1638,8 +1638,8 @@ static int avivo_crtc_do_set_base(struct drm_crtc *crtc,
1638 WREG32(AVIVO_D1MODE_VIEWPORT_SIZE + radeon_crtc->crtc_offset, 1638 WREG32(AVIVO_D1MODE_VIEWPORT_SIZE + radeon_crtc->crtc_offset,
1639 (viewport_w << 16) | viewport_h); 1639 (viewport_w << 16) | viewport_h);
1640 1640
1641 /* set pageflip to happen anywhere in vblank interval */ 1641 /* set pageflip to happen only at start of vblank interval (front porch) */
1642 WREG32(AVIVO_D1MODE_MASTER_UPDATE_MODE + radeon_crtc->crtc_offset, 0); 1642 WREG32(AVIVO_D1MODE_MASTER_UPDATE_MODE + radeon_crtc->crtc_offset, 3);
1643 1643
1644 if (!atomic && fb && fb != crtc->primary->fb) { 1644 if (!atomic && fb && fb != crtc->primary->fb) {
1645 radeon_fb = to_radeon_framebuffer(fb); 1645 radeon_fb = to_radeon_framebuffer(fb);
diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c
index 890171f08987..b8ab30a7dd6d 100644
--- a/drivers/gpu/drm/radeon/radeon_display.c
+++ b/drivers/gpu/drm/radeon/radeon_display.c
@@ -321,16 +321,30 @@ void radeon_crtc_handle_vblank(struct radeon_device *rdev, int crtc_id)
321 update_pending = radeon_page_flip_pending(rdev, crtc_id); 321 update_pending = radeon_page_flip_pending(rdev, crtc_id);
322 322
323 /* Has the pageflip already completed in crtc, or is it certain 323 /* Has the pageflip already completed in crtc, or is it certain
324 * to complete in this vblank? 324 * to complete in this vblank? GET_DISTANCE_TO_VBLANKSTART provides
325 * distance to start of "fudged earlier" vblank in vpos, distance to
326 * start of real vblank in hpos. vpos >= 0 && hpos < 0 means we are in
327 * the last few scanlines before start of real vblank, where the vblank
328 * irq can fire, so we have sampled update_pending a bit too early and
329 * know the flip will complete at leading edge of the upcoming real
330 * vblank. On pre-AVIVO hardware, flips also complete inside the real
331 * vblank, not only at leading edge, so if update_pending for hpos >= 0
332 * == inside real vblank, the flip will complete almost immediately.
333 * Note that this method of completion handling is still not 100% race
334 * free, as we could execute before the radeon_flip_work_func managed
335 * to run and set the RADEON_FLIP_SUBMITTED status, thereby we no-op,
336 * but the flip still gets programmed into hw and completed during
337 * vblank, leading to a delayed emission of the flip completion event.
338 * This applies at least to pre-AVIVO hardware, where flips are always
339 * completing inside vblank, not only at leading edge of vblank.
325 */ 340 */
326 if (update_pending && 341 if (update_pending &&
327 (DRM_SCANOUTPOS_VALID & radeon_get_crtc_scanoutpos(rdev->ddev, 342 (DRM_SCANOUTPOS_VALID &
328 crtc_id, 343 radeon_get_crtc_scanoutpos(rdev->ddev, crtc_id,
329 USE_REAL_VBLANKSTART, 344 GET_DISTANCE_TO_VBLANKSTART,
330 &vpos, &hpos, NULL, NULL, 345 &vpos, &hpos, NULL, NULL,
331 &rdev->mode_info.crtcs[crtc_id]->base.hwmode)) && 346 &rdev->mode_info.crtcs[crtc_id]->base.hwmode)) &&
332 ((vpos >= (99 * rdev->mode_info.crtcs[crtc_id]->base.hwmode.crtc_vdisplay)/100) || 347 ((vpos >= 0 && hpos < 0) || (hpos >= 0 && !ASIC_IS_AVIVO(rdev)))) {
333 (vpos < 0 && !ASIC_IS_AVIVO(rdev)))) {
334 /* crtc didn't flip in this target vblank interval, 348 /* crtc didn't flip in this target vblank interval,
335 * but flip is pending in crtc. Based on the current 349 * but flip is pending in crtc. Based on the current
336 * scanout position we know that the current frame is 350 * scanout position we know that the current frame is
@@ -438,16 +452,19 @@ static void radeon_flip_work_func(struct work_struct *__work)
438 } 452 }
439 453
440 /* Wait until we're out of the vertical blank period before the one 454 /* Wait until we're out of the vertical blank period before the one
441 * targeted by the flip 455 * targeted by the flip. Always wait on pre DCE4 to avoid races with
456 * flip completion handling from vblank irq, as these old asics don't
457 * have reliable pageflip completion interrupts.
442 */ 458 */
443 while (radeon_crtc->enabled && 459 while (radeon_crtc->enabled &&
444 (radeon_get_crtc_scanoutpos(dev, work->crtc_id, 0, 460 (radeon_get_crtc_scanoutpos(dev, work->crtc_id, 0,
445 &vpos, &hpos, NULL, NULL, 461 &vpos, &hpos, NULL, NULL,
446 &crtc->hwmode) 462 &crtc->hwmode)
447 & (DRM_SCANOUTPOS_VALID | DRM_SCANOUTPOS_IN_VBLANK)) == 463 & (DRM_SCANOUTPOS_VALID | DRM_SCANOUTPOS_IN_VBLANK)) ==
448 (DRM_SCANOUTPOS_VALID | DRM_SCANOUTPOS_IN_VBLANK) && 464 (DRM_SCANOUTPOS_VALID | DRM_SCANOUTPOS_IN_VBLANK) &&
449 (int)(work->target_vblank - 465 (!ASIC_IS_AVIVO(rdev) ||
450 dev->driver->get_vblank_counter(dev, work->crtc_id)) > 0) 466 ((int) (work->target_vblank -
467 dev->driver->get_vblank_counter(dev, work->crtc_id)) > 0)))
451 usleep_range(1000, 2000); 468 usleep_range(1000, 2000);
452 469
453 /* We borrow the event spin lock for protecting flip_status */ 470 /* We borrow the event spin lock for protecting flip_status */
diff --git a/drivers/gpu/drm/radeon/rv515.c b/drivers/gpu/drm/radeon/rv515.c
index 76c55c5d11ec..c55d653aaf5f 100644
--- a/drivers/gpu/drm/radeon/rv515.c
+++ b/drivers/gpu/drm/radeon/rv515.c
@@ -406,8 +406,9 @@ void rv515_mc_resume(struct radeon_device *rdev, struct rv515_mc_save *save)
406 for (i = 0; i < rdev->num_crtc; i++) { 406 for (i = 0; i < rdev->num_crtc; i++) {
407 if (save->crtc_enabled[i]) { 407 if (save->crtc_enabled[i]) {
408 tmp = RREG32(AVIVO_D1MODE_MASTER_UPDATE_MODE + crtc_offsets[i]); 408 tmp = RREG32(AVIVO_D1MODE_MASTER_UPDATE_MODE + crtc_offsets[i]);
409 if ((tmp & 0x7) != 0) { 409 if ((tmp & 0x7) != 3) {
410 tmp &= ~0x7; 410 tmp &= ~0x7;
411 tmp |= 0x3;
411 WREG32(AVIVO_D1MODE_MASTER_UPDATE_MODE + crtc_offsets[i], tmp); 412 WREG32(AVIVO_D1MODE_MASTER_UPDATE_MODE + crtc_offsets[i], tmp);
412 } 413 }
413 tmp = RREG32(AVIVO_D1GRPH_UPDATE + crtc_offsets[i]); 414 tmp = RREG32(AVIVO_D1GRPH_UPDATE + crtc_offsets[i]);