aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd
diff options
context:
space:
mode:
authorSean Paul <seanpaul@chromium.org>2019-05-22 16:08:21 -0400
committerSean Paul <seanpaul@chromium.org>2019-05-22 16:08:21 -0400
commit374ed5429346a021c8e2d26fafce14c5b15dedd0 (patch)
tree70739e93443494993197cc11f41c0fd0a0f3aac0 /drivers/gpu/drm/amd
parent270afb37ae34fc1499d166f6edf4bc472f529d96 (diff)
parenta188339ca5a396acc588e5851ed7e19f66b0ebd9 (diff)
Merge drm/drm-next into drm-misc-next
Backmerging 5.2-rc1 to -misc-next for robher Signed-off-by: Sean Paul <seanpaul@chromium.org>
Diffstat (limited to 'drivers/gpu/drm/amd')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c3
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_device.c1
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c8
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c10
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c19
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_sched.c23
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c36
-rw-r--r--drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c1
-rw-r--r--drivers/gpu/drm/amd/amdgpu/mxgpu_ai.c3
-rw-r--r--drivers/gpu/drm/amd/amdgpu/mxgpu_ai.h1
-rw-r--r--drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c16
-rw-r--r--drivers/gpu/drm/amd/amdgpu/vce_v4_0.c17
-rw-r--r--drivers/gpu/drm/amd/amdgpu/vega10_ih.c37
-rw-r--r--drivers/gpu/drm/amd/amdkfd/kfd_topology.c3
-rw-r--r--drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c3
-rw-r--r--drivers/gpu/drm/amd/display/dc/core/dc.c19
-rw-r--r--drivers/gpu/drm/amd/display/dc/dc.h3
-rw-r--r--drivers/gpu/drm/amd/display/dc/dce/dce_aux.c9
-rw-r--r--drivers/gpu/drm/amd/display/dc/dce/dce_aux.h6
19 files changed, 166 insertions, 52 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c
index 4376b17ca594..56f8ca2a3bb4 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c
@@ -464,8 +464,7 @@ static int amdgpu_atif_handler(struct amdgpu_device *adev,
464 } 464 }
465 } 465 }
466 if (req.pending & ATIF_DGPU_DISPLAY_EVENT) { 466 if (req.pending & ATIF_DGPU_DISPLAY_EVENT) {
467 if ((adev->flags & AMD_IS_PX) && 467 if (adev->flags & AMD_IS_PX) {
468 amdgpu_atpx_dgpu_req_power_for_displays()) {
469 pm_runtime_get_sync(adev->ddev->dev); 468 pm_runtime_get_sync(adev->ddev->dev);
470 /* Just fire off a uevent and let userspace tell us what to do */ 469 /* Just fire off a uevent and let userspace tell us what to do */
471 drm_helper_hpd_irq_event(adev->ddev); 470 drm_helper_hpd_irq_event(adev->ddev);
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index b9371ec5e04f..9f282e971197 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -3184,6 +3184,7 @@ static int amdgpu_device_recover_vram(struct amdgpu_device *adev)
3184 3184
3185 /* No need to recover an evicted BO */ 3185 /* No need to recover an evicted BO */
3186 if (shadow->tbo.mem.mem_type != TTM_PL_TT || 3186 if (shadow->tbo.mem.mem_type != TTM_PL_TT ||
3187 shadow->tbo.mem.start == AMDGPU_BO_INVALID_OFFSET ||
3187 shadow->parent->tbo.mem.mem_type != TTM_PL_VRAM) 3188 shadow->parent->tbo.mem.mem_type != TTM_PL_VRAM)
3188 continue; 3189 continue;
3189 3190
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c
index 3e6823fdd939..58ed401c5996 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c
@@ -256,14 +256,14 @@ static int amdgpu_mn_invalidate_range_start_gfx(struct mmu_notifier *mn,
256 /* TODO we should be able to split locking for interval tree and 256 /* TODO we should be able to split locking for interval tree and
257 * amdgpu_mn_invalidate_node 257 * amdgpu_mn_invalidate_node
258 */ 258 */
259 if (amdgpu_mn_read_lock(amn, range->blockable)) 259 if (amdgpu_mn_read_lock(amn, mmu_notifier_range_blockable(range)))
260 return -EAGAIN; 260 return -EAGAIN;
261 261
262 it = interval_tree_iter_first(&amn->objects, range->start, end); 262 it = interval_tree_iter_first(&amn->objects, range->start, end);
263 while (it) { 263 while (it) {
264 struct amdgpu_mn_node *node; 264 struct amdgpu_mn_node *node;
265 265
266 if (!range->blockable) { 266 if (!mmu_notifier_range_blockable(range)) {
267 amdgpu_mn_read_unlock(amn); 267 amdgpu_mn_read_unlock(amn);
268 return -EAGAIN; 268 return -EAGAIN;
269 } 269 }
@@ -299,7 +299,7 @@ static int amdgpu_mn_invalidate_range_start_hsa(struct mmu_notifier *mn,
299 /* notification is exclusive, but interval is inclusive */ 299 /* notification is exclusive, but interval is inclusive */
300 end = range->end - 1; 300 end = range->end - 1;
301 301
302 if (amdgpu_mn_read_lock(amn, range->blockable)) 302 if (amdgpu_mn_read_lock(amn, mmu_notifier_range_blockable(range)))
303 return -EAGAIN; 303 return -EAGAIN;
304 304
305 it = interval_tree_iter_first(&amn->objects, range->start, end); 305 it = interval_tree_iter_first(&amn->objects, range->start, end);
@@ -307,7 +307,7 @@ static int amdgpu_mn_invalidate_range_start_hsa(struct mmu_notifier *mn,
307 struct amdgpu_mn_node *node; 307 struct amdgpu_mn_node *node;
308 struct amdgpu_bo *bo; 308 struct amdgpu_bo *bo;
309 309
310 if (!range->blockable) { 310 if (!mmu_notifier_range_blockable(range)) {
311 amdgpu_mn_read_unlock(amn); 311 amdgpu_mn_read_unlock(amn);
312 return -EAGAIN; 312 return -EAGAIN;
313 } 313 }
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
index 95144e49c7f9..34471dbaa872 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
@@ -342,6 +342,16 @@ static ssize_t amdgpu_set_dpm_forced_performance_level(struct device *dev,
342 if (current_level == level) 342 if (current_level == level)
343 return count; 343 return count;
344 344
345 /* profile_exit setting is valid only when current mode is in profile mode */
346 if (!(current_level & (AMD_DPM_FORCED_LEVEL_PROFILE_STANDARD |
347 AMD_DPM_FORCED_LEVEL_PROFILE_MIN_SCLK |
348 AMD_DPM_FORCED_LEVEL_PROFILE_MIN_MCLK |
349 AMD_DPM_FORCED_LEVEL_PROFILE_PEAK)) &&
350 (level == AMD_DPM_FORCED_LEVEL_PROFILE_EXIT)) {
351 pr_err("Currently not in any profile mode!\n");
352 return -EINVAL;
353 }
354
345 if (is_support_sw_smu(adev)) { 355 if (is_support_sw_smu(adev)) {
346 mutex_lock(&adev->pm.mutex); 356 mutex_lock(&adev->pm.mutex);
347 if (adev->pm.dpm.thermal_active) { 357 if (adev->pm.dpm.thermal_active) {
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
index 905cce1814f3..05897b05766b 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
@@ -38,18 +38,10 @@ static void psp_set_funcs(struct amdgpu_device *adev);
38static int psp_early_init(void *handle) 38static int psp_early_init(void *handle)
39{ 39{
40 struct amdgpu_device *adev = (struct amdgpu_device *)handle; 40 struct amdgpu_device *adev = (struct amdgpu_device *)handle;
41 struct psp_context *psp = &adev->psp;
41 42
42 psp_set_funcs(adev); 43 psp_set_funcs(adev);
43 44
44 return 0;
45}
46
47static int psp_sw_init(void *handle)
48{
49 struct amdgpu_device *adev = (struct amdgpu_device *)handle;
50 struct psp_context *psp = &adev->psp;
51 int ret;
52
53 switch (adev->asic_type) { 45 switch (adev->asic_type) {
54 case CHIP_VEGA10: 46 case CHIP_VEGA10:
55 case CHIP_VEGA12: 47 case CHIP_VEGA12:
@@ -67,6 +59,15 @@ static int psp_sw_init(void *handle)
67 59
68 psp->adev = adev; 60 psp->adev = adev;
69 61
62 return 0;
63}
64
65static int psp_sw_init(void *handle)
66{
67 struct amdgpu_device *adev = (struct amdgpu_device *)handle;
68 struct psp_context *psp = &adev->psp;
69 int ret;
70
70 ret = psp_init_microcode(psp); 71 ret = psp_init_microcode(psp);
71 if (ret) { 72 if (ret) {
72 DRM_ERROR("Failed to load psp firmware!\n"); 73 DRM_ERROR("Failed to load psp firmware!\n");
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_sched.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_sched.c
index 0767a93e4d91..639297250c21 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_sched.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_sched.c
@@ -53,26 +53,25 @@ static int amdgpu_sched_process_priority_override(struct amdgpu_device *adev,
53 int fd, 53 int fd,
54 enum drm_sched_priority priority) 54 enum drm_sched_priority priority)
55{ 55{
56 struct file *filp = fget(fd); 56 struct fd f = fdget(fd);
57 struct amdgpu_fpriv *fpriv; 57 struct amdgpu_fpriv *fpriv;
58 struct amdgpu_ctx *ctx; 58 struct amdgpu_ctx *ctx;
59 uint32_t id; 59 uint32_t id;
60 int r; 60 int r;
61 61
62 if (!filp) 62 if (!f.file)
63 return -EINVAL; 63 return -EINVAL;
64 64
65 r = amdgpu_file_to_fpriv(filp, &fpriv); 65 r = amdgpu_file_to_fpriv(f.file, &fpriv);
66 if (r) { 66 if (r) {
67 fput(filp); 67 fdput(f);
68 return r; 68 return r;
69 } 69 }
70 70
71 idr_for_each_entry(&fpriv->ctx_mgr.ctx_handles, ctx, id) 71 idr_for_each_entry(&fpriv->ctx_mgr.ctx_handles, ctx, id)
72 amdgpu_ctx_priority_override(ctx, priority); 72 amdgpu_ctx_priority_override(ctx, priority);
73 73
74 fput(filp); 74 fdput(f);
75
76 return 0; 75 return 0;
77} 76}
78 77
@@ -81,30 +80,30 @@ static int amdgpu_sched_context_priority_override(struct amdgpu_device *adev,
81 unsigned ctx_id, 80 unsigned ctx_id,
82 enum drm_sched_priority priority) 81 enum drm_sched_priority priority)
83{ 82{
84 struct file *filp = fget(fd); 83 struct fd f = fdget(fd);
85 struct amdgpu_fpriv *fpriv; 84 struct amdgpu_fpriv *fpriv;
86 struct amdgpu_ctx *ctx; 85 struct amdgpu_ctx *ctx;
87 int r; 86 int r;
88 87
89 if (!filp) 88 if (!f.file)
90 return -EINVAL; 89 return -EINVAL;
91 90
92 r = amdgpu_file_to_fpriv(filp, &fpriv); 91 r = amdgpu_file_to_fpriv(f.file, &fpriv);
93 if (r) { 92 if (r) {
94 fput(filp); 93 fdput(f);
95 return r; 94 return r;
96 } 95 }
97 96
98 ctx = amdgpu_ctx_get(fpriv, ctx_id); 97 ctx = amdgpu_ctx_get(fpriv, ctx_id);
99 98
100 if (!ctx) { 99 if (!ctx) {
101 fput(filp); 100 fdput(f);
102 return -EINVAL; 101 return -EINVAL;
103 } 102 }
104 103
105 amdgpu_ctx_priority_override(ctx, priority); 104 amdgpu_ctx_priority_override(ctx, priority);
106 amdgpu_ctx_put(ctx); 105 amdgpu_ctx_put(ctx);
107 fput(filp); 106 fdput(f);
108 107
109 return 0; 108 return 0;
110} 109}
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
index a07c85815b7a..4f10f5aba00b 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
@@ -2757,6 +2757,37 @@ error_free_sched_entity:
2757} 2757}
2758 2758
2759/** 2759/**
2760 * amdgpu_vm_check_clean_reserved - check if a VM is clean
2761 *
2762 * @adev: amdgpu_device pointer
2763 * @vm: the VM to check
2764 *
2765 * check all entries of the root PD, if any subsequent PDs are allocated,
2766 * it means there are page table creating and filling, and is no a clean
2767 * VM
2768 *
2769 * Returns:
2770 * 0 if this VM is clean
2771 */
2772static int amdgpu_vm_check_clean_reserved(struct amdgpu_device *adev,
2773 struct amdgpu_vm *vm)
2774{
2775 enum amdgpu_vm_level root = adev->vm_manager.root_level;
2776 unsigned int entries = amdgpu_vm_num_entries(adev, root);
2777 unsigned int i = 0;
2778
2779 if (!(vm->root.entries))
2780 return 0;
2781
2782 for (i = 0; i < entries; i++) {
2783 if (vm->root.entries[i].base.bo)
2784 return -EINVAL;
2785 }
2786
2787 return 0;
2788}
2789
2790/**
2760 * amdgpu_vm_make_compute - Turn a GFX VM into a compute VM 2791 * amdgpu_vm_make_compute - Turn a GFX VM into a compute VM
2761 * 2792 *
2762 * @adev: amdgpu_device pointer 2793 * @adev: amdgpu_device pointer
@@ -2786,10 +2817,9 @@ int amdgpu_vm_make_compute(struct amdgpu_device *adev, struct amdgpu_vm *vm, uns
2786 return r; 2817 return r;
2787 2818
2788 /* Sanity checks */ 2819 /* Sanity checks */
2789 if (!RB_EMPTY_ROOT(&vm->va.rb_root) || vm->root.entries) { 2820 r = amdgpu_vm_check_clean_reserved(adev, vm);
2790 r = -EINVAL; 2821 if (r)
2791 goto unreserve_bo; 2822 goto unreserve_bo;
2792 }
2793 2823
2794 if (pasid) { 2824 if (pasid) {
2795 unsigned long flags; 2825 unsigned long flags;
diff --git a/drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c b/drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c
index 1741056e6af6..41a9a5779623 100644
--- a/drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c
@@ -182,6 +182,7 @@ static void mmhub_v1_0_init_cache_regs(struct amdgpu_device *adev)
182 tmp = REG_SET_FIELD(tmp, VM_L2_CNTL3, 182 tmp = REG_SET_FIELD(tmp, VM_L2_CNTL3,
183 L2_CACHE_BIGK_FRAGMENT_SIZE, 6); 183 L2_CACHE_BIGK_FRAGMENT_SIZE, 6);
184 } 184 }
185 WREG32_SOC15(MMHUB, 0, mmVM_L2_CNTL3, tmp);
185 186
186 tmp = mmVM_L2_CNTL4_DEFAULT; 187 tmp = mmVM_L2_CNTL4_DEFAULT;
187 tmp = REG_SET_FIELD(tmp, VM_L2_CNTL4, VMC_TAP_PDE_REQUEST_PHYSICAL, 0); 188 tmp = REG_SET_FIELD(tmp, VM_L2_CNTL4, VMC_TAP_PDE_REQUEST_PHYSICAL, 0);
diff --git a/drivers/gpu/drm/amd/amdgpu/mxgpu_ai.c b/drivers/gpu/drm/amd/amdgpu/mxgpu_ai.c
index 8dbad496b29f..2471e7cf75ea 100644
--- a/drivers/gpu/drm/amd/amdgpu/mxgpu_ai.c
+++ b/drivers/gpu/drm/amd/amdgpu/mxgpu_ai.c
@@ -372,6 +372,9 @@ static int xgpu_ai_mailbox_rcv_irq(struct amdgpu_device *adev,
372 if (amdgpu_sriov_runtime(adev)) 372 if (amdgpu_sriov_runtime(adev))
373 schedule_work(&adev->virt.flr_work); 373 schedule_work(&adev->virt.flr_work);
374 break; 374 break;
375 case IDH_QUERY_ALIVE:
376 xgpu_ai_mailbox_send_ack(adev);
377 break;
375 /* READY_TO_ACCESS_GPU is fetched by kernel polling, IRQ can ignore 378 /* READY_TO_ACCESS_GPU is fetched by kernel polling, IRQ can ignore
376 * it byfar since that polling thread will handle it, 379 * it byfar since that polling thread will handle it,
377 * other msg like flr complete is not handled here. 380 * other msg like flr complete is not handled here.
diff --git a/drivers/gpu/drm/amd/amdgpu/mxgpu_ai.h b/drivers/gpu/drm/amd/amdgpu/mxgpu_ai.h
index 39d151b79153..077e91a33d62 100644
--- a/drivers/gpu/drm/amd/amdgpu/mxgpu_ai.h
+++ b/drivers/gpu/drm/amd/amdgpu/mxgpu_ai.h
@@ -49,6 +49,7 @@ enum idh_event {
49 IDH_FLR_NOTIFICATION_CMPL, 49 IDH_FLR_NOTIFICATION_CMPL,
50 IDH_SUCCESS, 50 IDH_SUCCESS,
51 IDH_FAIL, 51 IDH_FAIL,
52 IDH_QUERY_ALIVE,
52 IDH_EVENT_MAX 53 IDH_EVENT_MAX
53}; 54};
54 55
diff --git a/drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c b/drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c
index dc461df48da0..2191d3d0a219 100644
--- a/drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c
@@ -787,10 +787,13 @@ static int uvd_v7_0_sriov_start(struct amdgpu_device *adev)
787 0xFFFFFFFF, 0x00000004); 787 0xFFFFFFFF, 0x00000004);
788 /* mc resume*/ 788 /* mc resume*/
789 if (adev->firmware.load_type == AMDGPU_FW_LOAD_PSP) { 789 if (adev->firmware.load_type == AMDGPU_FW_LOAD_PSP) {
790 MMSCH_V1_0_INSERT_DIRECT_WT(SOC15_REG_OFFSET(UVD, i, mmUVD_LMI_VCPU_CACHE_64BIT_BAR_LOW), 790 MMSCH_V1_0_INSERT_DIRECT_WT(SOC15_REG_OFFSET(UVD, i,
791 lower_32_bits(adev->firmware.ucode[AMDGPU_UCODE_ID_UVD].mc_addr)); 791 mmUVD_LMI_VCPU_CACHE_64BIT_BAR_LOW),
792 MMSCH_V1_0_INSERT_DIRECT_WT(SOC15_REG_OFFSET(UVD, i, mmUVD_LMI_VCPU_CACHE_64BIT_BAR_HIGH), 792 adev->firmware.ucode[AMDGPU_UCODE_ID_UVD].tmr_mc_addr_lo);
793 upper_32_bits(adev->firmware.ucode[AMDGPU_UCODE_ID_UVD].mc_addr)); 793 MMSCH_V1_0_INSERT_DIRECT_WT(SOC15_REG_OFFSET(UVD, i,
794 mmUVD_LMI_VCPU_CACHE_64BIT_BAR_HIGH),
795 adev->firmware.ucode[AMDGPU_UCODE_ID_UVD].tmr_mc_addr_hi);
796 MMSCH_V1_0_INSERT_DIRECT_WT(SOC15_REG_OFFSET(UVD, 0, mmUVD_VCPU_CACHE_OFFSET0), 0);
794 offset = 0; 797 offset = 0;
795 } else { 798 } else {
796 MMSCH_V1_0_INSERT_DIRECT_WT(SOC15_REG_OFFSET(UVD, i, mmUVD_LMI_VCPU_CACHE_64BIT_BAR_LOW), 799 MMSCH_V1_0_INSERT_DIRECT_WT(SOC15_REG_OFFSET(UVD, i, mmUVD_LMI_VCPU_CACHE_64BIT_BAR_LOW),
@@ -798,10 +801,11 @@ static int uvd_v7_0_sriov_start(struct amdgpu_device *adev)
798 MMSCH_V1_0_INSERT_DIRECT_WT(SOC15_REG_OFFSET(UVD, i, mmUVD_LMI_VCPU_CACHE_64BIT_BAR_HIGH), 801 MMSCH_V1_0_INSERT_DIRECT_WT(SOC15_REG_OFFSET(UVD, i, mmUVD_LMI_VCPU_CACHE_64BIT_BAR_HIGH),
799 upper_32_bits(adev->uvd.inst[i].gpu_addr)); 802 upper_32_bits(adev->uvd.inst[i].gpu_addr));
800 offset = size; 803 offset = size;
804 MMSCH_V1_0_INSERT_DIRECT_WT(SOC15_REG_OFFSET(UVD, 0, mmUVD_VCPU_CACHE_OFFSET0),
805 AMDGPU_UVD_FIRMWARE_OFFSET >> 3);
806
801 } 807 }
802 808
803 MMSCH_V1_0_INSERT_DIRECT_WT(SOC15_REG_OFFSET(UVD, i, mmUVD_VCPU_CACHE_OFFSET0),
804 AMDGPU_UVD_FIRMWARE_OFFSET >> 3);
805 MMSCH_V1_0_INSERT_DIRECT_WT(SOC15_REG_OFFSET(UVD, i, mmUVD_VCPU_CACHE_SIZE0), size); 809 MMSCH_V1_0_INSERT_DIRECT_WT(SOC15_REG_OFFSET(UVD, i, mmUVD_VCPU_CACHE_SIZE0), size);
806 810
807 MMSCH_V1_0_INSERT_DIRECT_WT(SOC15_REG_OFFSET(UVD, i, mmUVD_LMI_VCPU_CACHE1_64BIT_BAR_LOW), 811 MMSCH_V1_0_INSERT_DIRECT_WT(SOC15_REG_OFFSET(UVD, i, mmUVD_LMI_VCPU_CACHE1_64BIT_BAR_LOW),
diff --git a/drivers/gpu/drm/amd/amdgpu/vce_v4_0.c b/drivers/gpu/drm/amd/amdgpu/vce_v4_0.c
index f3f5938430d4..c0ec27991c22 100644
--- a/drivers/gpu/drm/amd/amdgpu/vce_v4_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/vce_v4_0.c
@@ -244,13 +244,18 @@ static int vce_v4_0_sriov_start(struct amdgpu_device *adev)
244 MMSCH_V1_0_INSERT_DIRECT_WT(SOC15_REG_OFFSET(VCE, 0, mmVCE_LMI_SWAP_CNTL1), 0); 244 MMSCH_V1_0_INSERT_DIRECT_WT(SOC15_REG_OFFSET(VCE, 0, mmVCE_LMI_SWAP_CNTL1), 0);
245 MMSCH_V1_0_INSERT_DIRECT_WT(SOC15_REG_OFFSET(VCE, 0, mmVCE_LMI_VM_CTRL), 0); 245 MMSCH_V1_0_INSERT_DIRECT_WT(SOC15_REG_OFFSET(VCE, 0, mmVCE_LMI_VM_CTRL), 0);
246 246
247 offset = AMDGPU_VCE_FIRMWARE_OFFSET;
247 if (adev->firmware.load_type == AMDGPU_FW_LOAD_PSP) { 248 if (adev->firmware.load_type == AMDGPU_FW_LOAD_PSP) {
249 uint32_t low = adev->firmware.ucode[AMDGPU_UCODE_ID_VCE].tmr_mc_addr_lo;
250 uint32_t hi = adev->firmware.ucode[AMDGPU_UCODE_ID_VCE].tmr_mc_addr_hi;
251 uint64_t tmr_mc_addr = (uint64_t)(hi) << 32 | low;
252
248 MMSCH_V1_0_INSERT_DIRECT_WT(SOC15_REG_OFFSET(VCE, 0, 253 MMSCH_V1_0_INSERT_DIRECT_WT(SOC15_REG_OFFSET(VCE, 0,
249 mmVCE_LMI_VCPU_CACHE_40BIT_BAR0), 254 mmVCE_LMI_VCPU_CACHE_40BIT_BAR0), tmr_mc_addr >> 8);
250 adev->firmware.ucode[AMDGPU_UCODE_ID_VCE].mc_addr >> 8);
251 MMSCH_V1_0_INSERT_DIRECT_WT(SOC15_REG_OFFSET(VCE, 0, 255 MMSCH_V1_0_INSERT_DIRECT_WT(SOC15_REG_OFFSET(VCE, 0,
252 mmVCE_LMI_VCPU_CACHE_64BIT_BAR0), 256 mmVCE_LMI_VCPU_CACHE_64BIT_BAR0),
253 (adev->firmware.ucode[AMDGPU_UCODE_ID_VCE].mc_addr >> 40) & 0xff); 257 (tmr_mc_addr >> 40) & 0xff);
258 MMSCH_V1_0_INSERT_DIRECT_WT(SOC15_REG_OFFSET(VCE, 0, mmVCE_VCPU_CACHE_OFFSET0), 0);
254 } else { 259 } else {
255 MMSCH_V1_0_INSERT_DIRECT_WT(SOC15_REG_OFFSET(VCE, 0, 260 MMSCH_V1_0_INSERT_DIRECT_WT(SOC15_REG_OFFSET(VCE, 0,
256 mmVCE_LMI_VCPU_CACHE_40BIT_BAR0), 261 mmVCE_LMI_VCPU_CACHE_40BIT_BAR0),
@@ -258,6 +263,9 @@ static int vce_v4_0_sriov_start(struct amdgpu_device *adev)
258 MMSCH_V1_0_INSERT_DIRECT_WT(SOC15_REG_OFFSET(VCE, 0, 263 MMSCH_V1_0_INSERT_DIRECT_WT(SOC15_REG_OFFSET(VCE, 0,
259 mmVCE_LMI_VCPU_CACHE_64BIT_BAR0), 264 mmVCE_LMI_VCPU_CACHE_64BIT_BAR0),
260 (adev->vce.gpu_addr >> 40) & 0xff); 265 (adev->vce.gpu_addr >> 40) & 0xff);
266 MMSCH_V1_0_INSERT_DIRECT_WT(SOC15_REG_OFFSET(VCE, 0, mmVCE_VCPU_CACHE_OFFSET0),
267 offset & ~0x0f000000);
268
261 } 269 }
262 MMSCH_V1_0_INSERT_DIRECT_WT(SOC15_REG_OFFSET(VCE, 0, 270 MMSCH_V1_0_INSERT_DIRECT_WT(SOC15_REG_OFFSET(VCE, 0,
263 mmVCE_LMI_VCPU_CACHE_40BIT_BAR1), 271 mmVCE_LMI_VCPU_CACHE_40BIT_BAR1),
@@ -272,10 +280,7 @@ static int vce_v4_0_sriov_start(struct amdgpu_device *adev)
272 mmVCE_LMI_VCPU_CACHE_64BIT_BAR2), 280 mmVCE_LMI_VCPU_CACHE_64BIT_BAR2),
273 (adev->vce.gpu_addr >> 40) & 0xff); 281 (adev->vce.gpu_addr >> 40) & 0xff);
274 282
275 offset = AMDGPU_VCE_FIRMWARE_OFFSET;
276 size = VCE_V4_0_FW_SIZE; 283 size = VCE_V4_0_FW_SIZE;
277 MMSCH_V1_0_INSERT_DIRECT_WT(SOC15_REG_OFFSET(VCE, 0, mmVCE_VCPU_CACHE_OFFSET0),
278 offset & ~0x0f000000);
279 MMSCH_V1_0_INSERT_DIRECT_WT(SOC15_REG_OFFSET(VCE, 0, mmVCE_VCPU_CACHE_SIZE0), size); 284 MMSCH_V1_0_INSERT_DIRECT_WT(SOC15_REG_OFFSET(VCE, 0, mmVCE_VCPU_CACHE_SIZE0), size);
280 285
281 offset = (adev->firmware.load_type != AMDGPU_FW_LOAD_PSP) ? offset + size : 0; 286 offset = (adev->firmware.load_type != AMDGPU_FW_LOAD_PSP) ? offset + size : 0;
diff --git a/drivers/gpu/drm/amd/amdgpu/vega10_ih.c b/drivers/gpu/drm/amd/amdgpu/vega10_ih.c
index 1b2f69a9a24e..8d89ab7f0ae8 100644
--- a/drivers/gpu/drm/amd/amdgpu/vega10_ih.c
+++ b/drivers/gpu/drm/amd/amdgpu/vega10_ih.c
@@ -31,7 +31,7 @@
31#include "soc15_common.h" 31#include "soc15_common.h"
32#include "vega10_ih.h" 32#include "vega10_ih.h"
33 33
34 34#define MAX_REARM_RETRY 10
35 35
36static void vega10_ih_set_interrupt_funcs(struct amdgpu_device *adev); 36static void vega10_ih_set_interrupt_funcs(struct amdgpu_device *adev);
37 37
@@ -382,6 +382,38 @@ static void vega10_ih_decode_iv(struct amdgpu_device *adev,
382} 382}
383 383
384/** 384/**
385 * vega10_ih_irq_rearm - rearm IRQ if lost
386 *
387 * @adev: amdgpu_device pointer
388 *
389 */
390static void vega10_ih_irq_rearm(struct amdgpu_device *adev,
391 struct amdgpu_ih_ring *ih)
392{
393 uint32_t reg_rptr = 0;
394 uint32_t v = 0;
395 uint32_t i = 0;
396
397 if (ih == &adev->irq.ih)
398 reg_rptr = SOC15_REG_OFFSET(OSSSYS, 0, mmIH_RB_RPTR);
399 else if (ih == &adev->irq.ih1)
400 reg_rptr = SOC15_REG_OFFSET(OSSSYS, 0, mmIH_RB_RPTR_RING1);
401 else if (ih == &adev->irq.ih2)
402 reg_rptr = SOC15_REG_OFFSET(OSSSYS, 0, mmIH_RB_RPTR_RING2);
403 else
404 return;
405
406 /* Rearm IRQ / re-wwrite doorbell if doorbell write is lost */
407 for (i = 0; i < MAX_REARM_RETRY; i++) {
408 v = RREG32_NO_KIQ(reg_rptr);
409 if ((v < ih->ring_size) && (v != ih->rptr))
410 WDOORBELL32(ih->doorbell_index, ih->rptr);
411 else
412 break;
413 }
414}
415
416/**
385 * vega10_ih_set_rptr - set the IH ring buffer rptr 417 * vega10_ih_set_rptr - set the IH ring buffer rptr
386 * 418 *
387 * @adev: amdgpu_device pointer 419 * @adev: amdgpu_device pointer
@@ -395,6 +427,9 @@ static void vega10_ih_set_rptr(struct amdgpu_device *adev,
395 /* XXX check if swapping is necessary on BE */ 427 /* XXX check if swapping is necessary on BE */
396 *ih->rptr_cpu = ih->rptr; 428 *ih->rptr_cpu = ih->rptr;
397 WDOORBELL32(ih->doorbell_index, ih->rptr); 429 WDOORBELL32(ih->doorbell_index, ih->rptr);
430
431 if (amdgpu_sriov_vf(adev))
432 vega10_ih_irq_rearm(adev, ih);
398 } else if (ih == &adev->irq.ih) { 433 } else if (ih == &adev->irq.ih) {
399 WREG32_SOC15(OSSSYS, 0, mmIH_RB_RPTR, ih->rptr); 434 WREG32_SOC15(OSSSYS, 0, mmIH_RB_RPTR, ih->rptr);
400 } else if (ih == &adev->irq.ih1) { 435 } else if (ih == &adev->irq.ih1) {
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_topology.c b/drivers/gpu/drm/amd/amdkfd/kfd_topology.c
index 2cb09e088dce..769dbc7be8cb 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_topology.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_topology.c
@@ -1272,8 +1272,7 @@ int kfd_topology_add_device(struct kfd_dev *gpu)
1272 1272
1273 dev->node_props.vendor_id = gpu->pdev->vendor; 1273 dev->node_props.vendor_id = gpu->pdev->vendor;
1274 dev->node_props.device_id = gpu->pdev->device; 1274 dev->node_props.device_id = gpu->pdev->device;
1275 dev->node_props.location_id = PCI_DEVID(gpu->pdev->bus->number, 1275 dev->node_props.location_id = pci_dev_id(gpu->pdev);
1276 gpu->pdev->devfn);
1277 dev->node_props.max_engine_clk_fcompute = 1276 dev->node_props.max_engine_clk_fcompute =
1278 amdgpu_amdkfd_get_max_engine_clock_in_mhz(dev->gpu->kgd); 1277 amdgpu_amdkfd_get_max_engine_clock_in_mhz(dev->gpu->kgd);
1279 dev->node_props.max_engine_clk_ccompute = 1278 dev->node_props.max_engine_clk_ccompute =
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index 1854506e3e8f..995f9df66142 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -5242,7 +5242,7 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state,
5242 struct drm_crtc *pcrtc, 5242 struct drm_crtc *pcrtc,
5243 bool wait_for_vblank) 5243 bool wait_for_vblank)
5244{ 5244{
5245 uint32_t i, r; 5245 uint32_t i;
5246 uint64_t timestamp_ns; 5246 uint64_t timestamp_ns;
5247 struct drm_plane *plane; 5247 struct drm_plane *plane;
5248 struct drm_plane_state *old_plane_state, *new_plane_state; 5248 struct drm_plane_state *old_plane_state, *new_plane_state;
@@ -5253,6 +5253,7 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state,
5253 struct dm_crtc_state *dm_old_crtc_state = 5253 struct dm_crtc_state *dm_old_crtc_state =
5254 to_dm_crtc_state(drm_atomic_get_old_crtc_state(state, pcrtc)); 5254 to_dm_crtc_state(drm_atomic_get_old_crtc_state(state, pcrtc));
5255 int planes_count = 0, vpos, hpos; 5255 int planes_count = 0, vpos, hpos;
5256 long r;
5256 unsigned long flags; 5257 unsigned long flags;
5257 struct amdgpu_bo *abo; 5258 struct amdgpu_bo *abo;
5258 uint64_t tiling_flags; 5259 uint64_t tiling_flags;
diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c b/drivers/gpu/drm/amd/display/dc/core/dc.c
index dda10b1f8574..18c775a950cc 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc.c
@@ -1464,6 +1464,11 @@ static enum surface_update_type det_surface_update(const struct dc *dc,
1464 return UPDATE_TYPE_FULL; 1464 return UPDATE_TYPE_FULL;
1465 } 1465 }
1466 1466
1467 if (u->surface->force_full_update) {
1468 update_flags->bits.full_update = 1;
1469 return UPDATE_TYPE_FULL;
1470 }
1471
1467 type = get_plane_info_update_type(u); 1472 type = get_plane_info_update_type(u);
1468 elevate_update_type(&overall_type, type); 1473 elevate_update_type(&overall_type, type);
1469 1474
@@ -1900,6 +1905,14 @@ void dc_commit_updates_for_stream(struct dc *dc,
1900 } 1905 }
1901 1906
1902 dc_resource_state_copy_construct(state, context); 1907 dc_resource_state_copy_construct(state, context);
1908
1909 for (i = 0; i < dc->res_pool->pipe_count; i++) {
1910 struct pipe_ctx *new_pipe = &context->res_ctx.pipe_ctx[i];
1911 struct pipe_ctx *old_pipe = &dc->current_state->res_ctx.pipe_ctx[i];
1912
1913 if (new_pipe->plane_state && new_pipe->plane_state != old_pipe->plane_state)
1914 new_pipe->plane_state->force_full_update = true;
1915 }
1903 } 1916 }
1904 1917
1905 1918
@@ -1936,6 +1949,12 @@ void dc_commit_updates_for_stream(struct dc *dc,
1936 dc->current_state = context; 1949 dc->current_state = context;
1937 dc_release_state(old); 1950 dc_release_state(old);
1938 1951
1952 for (i = 0; i < dc->res_pool->pipe_count; i++) {
1953 struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[i];
1954
1955 if (pipe_ctx->plane_state && pipe_ctx->stream == stream)
1956 pipe_ctx->plane_state->force_full_update = false;
1957 }
1939 } 1958 }
1940 /*let's use current_state to update watermark etc*/ 1959 /*let's use current_state to update watermark etc*/
1941 if (update_type >= UPDATE_TYPE_FULL) 1960 if (update_type >= UPDATE_TYPE_FULL)
diff --git a/drivers/gpu/drm/amd/display/dc/dc.h b/drivers/gpu/drm/amd/display/dc/dc.h
index 70edd9ea5afe..44e4b0465587 100644
--- a/drivers/gpu/drm/amd/display/dc/dc.h
+++ b/drivers/gpu/drm/amd/display/dc/dc.h
@@ -612,6 +612,9 @@ struct dc_plane_state {
612 struct dc_plane_status status; 612 struct dc_plane_status status;
613 struct dc_context *ctx; 613 struct dc_context *ctx;
614 614
615 /* HACK: Workaround for forcing full reprogramming under some conditions */
616 bool force_full_update;
617
615 /* private to dc_surface.c */ 618 /* private to dc_surface.c */
616 enum dc_irq_source irq_source; 619 enum dc_irq_source irq_source;
617 struct kref refcount; 620 struct kref refcount;
diff --git a/drivers/gpu/drm/amd/display/dc/dce/dce_aux.c b/drivers/gpu/drm/amd/display/dc/dce/dce_aux.c
index 937b5cffd7ef..bd33c47183fc 100644
--- a/drivers/gpu/drm/amd/display/dc/dce/dce_aux.c
+++ b/drivers/gpu/drm/amd/display/dc/dce/dce_aux.c
@@ -190,6 +190,12 @@ static void submit_channel_request(
190 AUXP_IMPCAL_OVERRIDE_ENABLE, 1, 190 AUXP_IMPCAL_OVERRIDE_ENABLE, 1,
191 AUXP_IMPCAL_OVERRIDE_ENABLE, 0); 191 AUXP_IMPCAL_OVERRIDE_ENABLE, 0);
192 } 192 }
193
194 REG_UPDATE(AUX_INTERRUPT_CONTROL, AUX_SW_DONE_ACK, 1);
195
196 REG_WAIT(AUX_SW_STATUS, AUX_SW_DONE, 0,
197 10, aux110->timeout_period/10);
198
193 /* set the delay and the number of bytes to write */ 199 /* set the delay and the number of bytes to write */
194 200
195 /* The length include 201 /* The length include
@@ -242,9 +248,6 @@ static void submit_channel_request(
242 } 248 }
243 } 249 }
244 250
245 REG_UPDATE(AUX_INTERRUPT_CONTROL, AUX_SW_DONE_ACK, 1);
246 REG_WAIT(AUX_SW_STATUS, AUX_SW_DONE, 0,
247 10, aux110->timeout_period/10);
248 REG_UPDATE(AUX_SW_CONTROL, AUX_SW_GO, 1); 251 REG_UPDATE(AUX_SW_CONTROL, AUX_SW_GO, 1);
249} 252}
250 253
diff --git a/drivers/gpu/drm/amd/display/dc/dce/dce_aux.h b/drivers/gpu/drm/amd/display/dc/dce/dce_aux.h
index aab5f0c34584..ce6a26d189b0 100644
--- a/drivers/gpu/drm/amd/display/dc/dce/dce_aux.h
+++ b/drivers/gpu/drm/amd/display/dc/dce/dce_aux.h
@@ -71,11 +71,11 @@ enum { /* This is the timeout as defined in DP 1.2a,
71 * at most within ~240usec. That means, 71 * at most within ~240usec. That means,
72 * increasing this timeout will not affect normal operation, 72 * increasing this timeout will not affect normal operation,
73 * and we'll timeout after 73 * and we'll timeout after
74 * SW_AUX_TIMEOUT_PERIOD_MULTIPLIER * AUX_TIMEOUT_PERIOD = 1600usec. 74 * SW_AUX_TIMEOUT_PERIOD_MULTIPLIER * AUX_TIMEOUT_PERIOD = 2400usec.
75 * This timeout is especially important for 75 * This timeout is especially important for
76 * resume from S3 and CTS. 76 * converters, resume from S3, and CTS.
77 */ 77 */
78 SW_AUX_TIMEOUT_PERIOD_MULTIPLIER = 4 78 SW_AUX_TIMEOUT_PERIOD_MULTIPLIER = 6
79}; 79};
80 80
81struct dce_aux { 81struct dce_aux {