aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Airlie <airlied@gmail.com>2015-09-04 17:46:09 -0400
committerDave Airlie <airlied@gmail.com>2015-09-04 17:46:09 -0400
commit73bf1b7be7aab60d7c651402441dd0b0b4991098 (patch)
tree3499903ffa867506f32eb36a5d46aa747c729f94
parent5b78cb668764061bd8a06f73f9bd081ba6942fef (diff)
parent35c7a9526af75040fac744babd0fafe18b8fe0a1 (diff)
Merge branch 'drm-next-4.3' of git://people.freedesktop.org/~agd5f/linux into drm-next
A few more fixes for amdgpu from the last few days: - Fix several copy paste typos - Resume from suspend fixes for VCE - Fix the GPU scheduler warning in kfifo_out - Re-enable GPUVM fault interrupts which were inadvertently disabled - GPUVM page table hang fix when paging * 'drm-next-4.3' of git://people.freedesktop.org/~agd5f/linux: drm/amdgpu: rename gmc_v8_0_init_compute_vmid drm/amdgpu: fix vce3 instance handling drm/amdgpu: remove ib test for the second VCE Ring drm/amdgpu: properly enable VM fault interrupts drm/amdgpu: fix warning in scheduler drm/amdgpu: fix buffer placement under memory pressure drm/amdgpu/cz: fix cz_dpm_update_low_memory_pstate logic drm/amdgpu: fix typo in dce11 watermark setup drm/amdgpu: fix typo in dce10 watermark setup drm/amdgpu: use top down allocation for non-CPU accessible vram drm/amdgpu: be explicit about cpu vram access for driver BOs (v2)
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c2
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_device.c3
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c4
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c3
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c3
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_object.c2
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c3
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c12
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c8
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c7
-rw-r--r--drivers/gpu/drm/amd/amdgpu/cz_dpm.c4
-rw-r--r--drivers/gpu/drm/amd/amdgpu/dce_v10_0.c2
-rw-r--r--drivers/gpu/drm/amd/amdgpu/dce_v11_0.c2
-rw-r--r--drivers/gpu/drm/amd/amdgpu/fiji_smc.c8
-rw-r--r--drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c12
-rw-r--r--drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c6
-rw-r--r--drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c16
-rw-r--r--drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c17
-rw-r--r--drivers/gpu/drm/amd/amdgpu/iceland_smc.c4
-rw-r--r--drivers/gpu/drm/amd/amdgpu/tonga_smc.c8
-rw-r--r--drivers/gpu/drm/amd/amdgpu/vce_v3_0.c48
-rw-r--r--drivers/gpu/drm/amd/scheduler/gpu_scheduler.c5
22 files changed, 127 insertions, 52 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
index 6a206f15635f..3b355aeb62fd 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
@@ -354,7 +354,7 @@ int amdgpu_cs_list_validate(struct amdgpu_cs_parser *p)
354 * into account. We don't want to disallow buffer moves 354 * into account. We don't want to disallow buffer moves
355 * completely. 355 * completely.
356 */ 356 */
357 if (current_domain != AMDGPU_GEM_DOMAIN_CPU && 357 if ((lobj->allowed_domains & current_domain) != 0 &&
358 (domain & current_domain) == 0 && /* will be moved */ 358 (domain & current_domain) == 0 && /* will be moved */
359 bytes_moved > bytes_moved_threshold) { 359 bytes_moved > bytes_moved_threshold) {
360 /* don't move it */ 360 /* don't move it */
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index 42d1a22c1199..6ff6ae945794 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -244,7 +244,8 @@ static int amdgpu_vram_scratch_init(struct amdgpu_device *adev)
244 244
245 if (adev->vram_scratch.robj == NULL) { 245 if (adev->vram_scratch.robj == NULL) {
246 r = amdgpu_bo_create(adev, AMDGPU_GPU_PAGE_SIZE, 246 r = amdgpu_bo_create(adev, AMDGPU_GPU_PAGE_SIZE,
247 PAGE_SIZE, true, AMDGPU_GEM_DOMAIN_VRAM, 0, 247 PAGE_SIZE, true, AMDGPU_GEM_DOMAIN_VRAM,
248 AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED,
248 NULL, &adev->vram_scratch.robj); 249 NULL, &adev->vram_scratch.robj);
249 if (r) { 250 if (r) {
250 return r; 251 return r;
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c
index 81b821247dde..8a122b1b7786 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c
@@ -126,8 +126,8 @@ static int amdgpufb_create_pinned_object(struct amdgpu_fbdev *rfbdev,
126 aligned_size = ALIGN(size, PAGE_SIZE); 126 aligned_size = ALIGN(size, PAGE_SIZE);
127 ret = amdgpu_gem_object_create(adev, aligned_size, 0, 127 ret = amdgpu_gem_object_create(adev, aligned_size, 0,
128 AMDGPU_GEM_DOMAIN_VRAM, 128 AMDGPU_GEM_DOMAIN_VRAM,
129 0, true, 129 AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED,
130 &gobj); 130 true, &gobj);
131 if (ret) { 131 if (ret) {
132 printk(KERN_ERR "failed to allocate framebuffer (%d)\n", 132 printk(KERN_ERR "failed to allocate framebuffer (%d)\n",
133 aligned_size); 133 aligned_size);
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c
index e02db0b2e839..cbd3a486c5c2 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gart.c
@@ -125,7 +125,8 @@ int amdgpu_gart_table_vram_alloc(struct amdgpu_device *adev)
125 125
126 if (adev->gart.robj == NULL) { 126 if (adev->gart.robj == NULL) {
127 r = amdgpu_bo_create(adev, adev->gart.table_size, 127 r = amdgpu_bo_create(adev, adev->gart.table_size,
128 PAGE_SIZE, true, AMDGPU_GEM_DOMAIN_VRAM, 0, 128 PAGE_SIZE, true, AMDGPU_GEM_DOMAIN_VRAM,
129 AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED,
129 NULL, &adev->gart.robj); 130 NULL, &adev->gart.robj);
130 if (r) { 131 if (r) {
131 return r; 132 return r;
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
index 4b36e779622f..5839fab374bf 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
@@ -656,7 +656,8 @@ int amdgpu_mode_dumb_create(struct drm_file *file_priv,
656 656
657 r = amdgpu_gem_object_create(adev, args->size, 0, 657 r = amdgpu_gem_object_create(adev, args->size, 0,
658 AMDGPU_GEM_DOMAIN_VRAM, 658 AMDGPU_GEM_DOMAIN_VRAM,
659 0, ttm_bo_type_device, 659 AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED,
660 ttm_bo_type_device,
660 &gobj); 661 &gobj);
661 if (r) 662 if (r)
662 return -ENOMEM; 663 return -ENOMEM;
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
index 57adcad2f7ba..08b09d55b96f 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
@@ -127,7 +127,7 @@ static void amdgpu_ttm_placement_init(struct amdgpu_device *adev,
127 placements[c].fpfn = 127 placements[c].fpfn =
128 adev->mc.visible_vram_size >> PAGE_SHIFT; 128 adev->mc.visible_vram_size >> PAGE_SHIFT;
129 placements[c++].flags = TTM_PL_FLAG_WC | TTM_PL_FLAG_UNCACHED | 129 placements[c++].flags = TTM_PL_FLAG_WC | TTM_PL_FLAG_UNCACHED |
130 TTM_PL_FLAG_VRAM; 130 TTM_PL_FLAG_VRAM | TTM_PL_FLAG_TOPDOWN;
131 } 131 }
132 placements[c].fpfn = 0; 132 placements[c].fpfn = 0;
133 placements[c++].flags = TTM_PL_FLAG_WC | TTM_PL_FLAG_UNCACHED | 133 placements[c++].flags = TTM_PL_FLAG_WC | TTM_PL_FLAG_UNCACHED |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
index 399143541d8a..b5abd5cde413 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -859,7 +859,8 @@ int amdgpu_ttm_init(struct amdgpu_device *adev)
859 amdgpu_ttm_set_active_vram_size(adev, adev->mc.visible_vram_size); 859 amdgpu_ttm_set_active_vram_size(adev, adev->mc.visible_vram_size);
860 860
861 r = amdgpu_bo_create(adev, 256 * 1024, PAGE_SIZE, true, 861 r = amdgpu_bo_create(adev, 256 * 1024, PAGE_SIZE, true,
862 AMDGPU_GEM_DOMAIN_VRAM, 0, 862 AMDGPU_GEM_DOMAIN_VRAM,
863 AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED,
863 NULL, &adev->stollen_vga_memory); 864 NULL, &adev->stollen_vga_memory);
864 if (r) { 865 if (r) {
865 return r; 866 return r;
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
index 3ad4a83c418f..2cf6c6b06e3b 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
@@ -154,7 +154,9 @@ int amdgpu_uvd_sw_init(struct amdgpu_device *adev)
154 bo_size = AMDGPU_GPU_PAGE_ALIGN(le32_to_cpu(hdr->ucode_size_bytes) + 8) 154 bo_size = AMDGPU_GPU_PAGE_ALIGN(le32_to_cpu(hdr->ucode_size_bytes) + 8)
155 + AMDGPU_UVD_STACK_SIZE + AMDGPU_UVD_HEAP_SIZE; 155 + AMDGPU_UVD_STACK_SIZE + AMDGPU_UVD_HEAP_SIZE;
156 r = amdgpu_bo_create(adev, bo_size, PAGE_SIZE, true, 156 r = amdgpu_bo_create(adev, bo_size, PAGE_SIZE, true,
157 AMDGPU_GEM_DOMAIN_VRAM, 0, NULL, &adev->uvd.vcpu_bo); 157 AMDGPU_GEM_DOMAIN_VRAM,
158 AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED,
159 NULL, &adev->uvd.vcpu_bo);
158 if (r) { 160 if (r) {
159 dev_err(adev->dev, "(%d) failed to allocate UVD bo\n", r); 161 dev_err(adev->dev, "(%d) failed to allocate UVD bo\n", r);
160 return r; 162 return r;
@@ -901,7 +903,9 @@ int amdgpu_uvd_get_create_msg(struct amdgpu_ring *ring, uint32_t handle,
901 int r, i; 903 int r, i;
902 904
903 r = amdgpu_bo_create(adev, 1024, PAGE_SIZE, true, 905 r = amdgpu_bo_create(adev, 1024, PAGE_SIZE, true,
904 AMDGPU_GEM_DOMAIN_VRAM, 0, NULL, &bo); 906 AMDGPU_GEM_DOMAIN_VRAM,
907 AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED,
908 NULL, &bo);
905 if (r) 909 if (r)
906 return r; 910 return r;
907 911
@@ -948,7 +952,9 @@ int amdgpu_uvd_get_destroy_msg(struct amdgpu_ring *ring, uint32_t handle,
948 int r, i; 952 int r, i;
949 953
950 r = amdgpu_bo_create(adev, 1024, PAGE_SIZE, true, 954 r = amdgpu_bo_create(adev, 1024, PAGE_SIZE, true,
951 AMDGPU_GEM_DOMAIN_VRAM, 0, NULL, &bo); 955 AMDGPU_GEM_DOMAIN_VRAM,
956 AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED,
957 NULL, &bo);
952 if (r) 958 if (r)
953 return r; 959 return r;
954 960
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c
index 1a984c934b1f..3cab96c42aa8 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c
@@ -141,7 +141,9 @@ int amdgpu_vce_sw_init(struct amdgpu_device *adev, unsigned long size)
141 /* allocate firmware, stack and heap BO */ 141 /* allocate firmware, stack and heap BO */
142 142
143 r = amdgpu_bo_create(adev, size, PAGE_SIZE, true, 143 r = amdgpu_bo_create(adev, size, PAGE_SIZE, true,
144 AMDGPU_GEM_DOMAIN_VRAM, 0, NULL, &adev->vce.vcpu_bo); 144 AMDGPU_GEM_DOMAIN_VRAM,
145 AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED,
146 NULL, &adev->vce.vcpu_bo);
145 if (r) { 147 if (r) {
146 dev_err(adev->dev, "(%d) failed to allocate VCE bo\n", r); 148 dev_err(adev->dev, "(%d) failed to allocate VCE bo\n", r);
147 return r; 149 return r;
@@ -836,6 +838,10 @@ int amdgpu_vce_ring_test_ib(struct amdgpu_ring *ring)
836 struct fence *fence = NULL; 838 struct fence *fence = NULL;
837 int r; 839 int r;
838 840
841 /* skip vce ring1 ib test for now, since it's not reliable */
842 if (ring == &ring->adev->vce.ring[1])
843 return 0;
844
839 r = amdgpu_vce_get_create_msg(ring, 1, NULL); 845 r = amdgpu_vce_get_create_msg(ring, 1, NULL);
840 if (r) { 846 if (r) {
841 DRM_ERROR("amdgpu: failed to get create msg (%d).\n", r); 847 DRM_ERROR("amdgpu: failed to get create msg (%d).\n", r);
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
index 5848564d3d66..f68b7cdc370a 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
@@ -1099,7 +1099,9 @@ int amdgpu_vm_bo_map(struct amdgpu_device *adev,
1099 1099
1100 r = amdgpu_bo_create(adev, AMDGPU_VM_PTE_COUNT * 8, 1100 r = amdgpu_bo_create(adev, AMDGPU_VM_PTE_COUNT * 8,
1101 AMDGPU_GPU_PAGE_SIZE, true, 1101 AMDGPU_GPU_PAGE_SIZE, true,
1102 AMDGPU_GEM_DOMAIN_VRAM, 0, NULL, &pt); 1102 AMDGPU_GEM_DOMAIN_VRAM,
1103 AMDGPU_GEM_CREATE_NO_CPU_ACCESS,
1104 NULL, &pt);
1103 if (r) 1105 if (r)
1104 goto error_free; 1106 goto error_free;
1105 1107
@@ -1299,7 +1301,8 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm)
1299 vm->page_directory_fence = NULL; 1301 vm->page_directory_fence = NULL;
1300 1302
1301 r = amdgpu_bo_create(adev, pd_size, align, true, 1303 r = amdgpu_bo_create(adev, pd_size, align, true,
1302 AMDGPU_GEM_DOMAIN_VRAM, 0, 1304 AMDGPU_GEM_DOMAIN_VRAM,
1305 AMDGPU_GEM_CREATE_NO_CPU_ACCESS,
1303 NULL, &vm->page_directory); 1306 NULL, &vm->page_directory);
1304 if (r) 1307 if (r)
1305 return r; 1308 return r;
diff --git a/drivers/gpu/drm/amd/amdgpu/cz_dpm.c b/drivers/gpu/drm/amd/amdgpu/cz_dpm.c
index ace870afc7d4..44fa96ad4709 100644
--- a/drivers/gpu/drm/amd/amdgpu/cz_dpm.c
+++ b/drivers/gpu/drm/amd/amdgpu/cz_dpm.c
@@ -1596,9 +1596,9 @@ static int cz_dpm_update_low_memory_pstate(struct amdgpu_device *adev)
1596 1596
1597 if (pi->sys_info.nb_dpm_enable) { 1597 if (pi->sys_info.nb_dpm_enable) {
1598 if (ps->force_high) 1598 if (ps->force_high)
1599 cz_dpm_nbdpm_lm_pstate_enable(adev, true);
1600 else
1601 cz_dpm_nbdpm_lm_pstate_enable(adev, false); 1599 cz_dpm_nbdpm_lm_pstate_enable(adev, false);
1600 else
1601 cz_dpm_nbdpm_lm_pstate_enable(adev, true);
1602 } 1602 }
1603 1603
1604 return ret; 1604 return ret;
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
index 4b255ac3043c..e4d101b1252a 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
@@ -1353,7 +1353,7 @@ static void dce_v10_0_program_watermarks(struct amdgpu_device *adev,
1353 tmp = REG_SET_FIELD(wm_mask, DPG_WATERMARK_MASK_CONTROL, URGENCY_WATERMARK_MASK, 2); 1353 tmp = REG_SET_FIELD(wm_mask, DPG_WATERMARK_MASK_CONTROL, URGENCY_WATERMARK_MASK, 2);
1354 WREG32(mmDPG_WATERMARK_MASK_CONTROL + amdgpu_crtc->crtc_offset, tmp); 1354 WREG32(mmDPG_WATERMARK_MASK_CONTROL + amdgpu_crtc->crtc_offset, tmp);
1355 tmp = RREG32(mmDPG_PIPE_URGENCY_CONTROL + amdgpu_crtc->crtc_offset); 1355 tmp = RREG32(mmDPG_PIPE_URGENCY_CONTROL + amdgpu_crtc->crtc_offset);
1356 tmp = REG_SET_FIELD(tmp, DPG_PIPE_URGENCY_CONTROL, URGENCY_LOW_WATERMARK, latency_watermark_a); 1356 tmp = REG_SET_FIELD(tmp, DPG_PIPE_URGENCY_CONTROL, URGENCY_LOW_WATERMARK, latency_watermark_b);
1357 tmp = REG_SET_FIELD(tmp, DPG_PIPE_URGENCY_CONTROL, URGENCY_HIGH_WATERMARK, line_time); 1357 tmp = REG_SET_FIELD(tmp, DPG_PIPE_URGENCY_CONTROL, URGENCY_HIGH_WATERMARK, line_time);
1358 WREG32(mmDPG_PIPE_URGENCY_CONTROL + amdgpu_crtc->crtc_offset, tmp); 1358 WREG32(mmDPG_PIPE_URGENCY_CONTROL + amdgpu_crtc->crtc_offset, tmp);
1359 /* restore original selection */ 1359 /* restore original selection */
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
index 70eee807421f..6411e8244671 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
@@ -1329,7 +1329,7 @@ static void dce_v11_0_program_watermarks(struct amdgpu_device *adev,
1329 tmp = REG_SET_FIELD(wm_mask, DPG_WATERMARK_MASK_CONTROL, URGENCY_WATERMARK_MASK, 2); 1329 tmp = REG_SET_FIELD(wm_mask, DPG_WATERMARK_MASK_CONTROL, URGENCY_WATERMARK_MASK, 2);
1330 WREG32(mmDPG_WATERMARK_MASK_CONTROL + amdgpu_crtc->crtc_offset, tmp); 1330 WREG32(mmDPG_WATERMARK_MASK_CONTROL + amdgpu_crtc->crtc_offset, tmp);
1331 tmp = RREG32(mmDPG_PIPE_URGENCY_CONTROL + amdgpu_crtc->crtc_offset); 1331 tmp = RREG32(mmDPG_PIPE_URGENCY_CONTROL + amdgpu_crtc->crtc_offset);
1332 tmp = REG_SET_FIELD(tmp, DPG_PIPE_URGENCY_CONTROL, URGENCY_LOW_WATERMARK, latency_watermark_a); 1332 tmp = REG_SET_FIELD(tmp, DPG_PIPE_URGENCY_CONTROL, URGENCY_LOW_WATERMARK, latency_watermark_b);
1333 tmp = REG_SET_FIELD(tmp, DPG_PIPE_URGENCY_CONTROL, URGENCY_HIGH_WATERMARK, line_time); 1333 tmp = REG_SET_FIELD(tmp, DPG_PIPE_URGENCY_CONTROL, URGENCY_HIGH_WATERMARK, line_time);
1334 WREG32(mmDPG_PIPE_URGENCY_CONTROL + amdgpu_crtc->crtc_offset, tmp); 1334 WREG32(mmDPG_PIPE_URGENCY_CONTROL + amdgpu_crtc->crtc_offset, tmp);
1335 /* restore original selection */ 1335 /* restore original selection */
diff --git a/drivers/gpu/drm/amd/amdgpu/fiji_smc.c b/drivers/gpu/drm/amd/amdgpu/fiji_smc.c
index 493c8c9c7faa..322edea65857 100644
--- a/drivers/gpu/drm/amd/amdgpu/fiji_smc.c
+++ b/drivers/gpu/drm/amd/amdgpu/fiji_smc.c
@@ -762,7 +762,9 @@ int fiji_smu_init(struct amdgpu_device *adev)
762 762
763 /* Allocate FW image data structure and header buffer */ 763 /* Allocate FW image data structure and header buffer */
764 ret = amdgpu_bo_create(adev, image_size, PAGE_SIZE, 764 ret = amdgpu_bo_create(adev, image_size, PAGE_SIZE,
765 true, AMDGPU_GEM_DOMAIN_VRAM, 0, NULL, toc_buf); 765 true, AMDGPU_GEM_DOMAIN_VRAM,
766 AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED,
767 NULL, toc_buf);
766 if (ret) { 768 if (ret) {
767 DRM_ERROR("Failed to allocate memory for TOC buffer\n"); 769 DRM_ERROR("Failed to allocate memory for TOC buffer\n");
768 return -ENOMEM; 770 return -ENOMEM;
@@ -770,7 +772,9 @@ int fiji_smu_init(struct amdgpu_device *adev)
770 772
771 /* Allocate buffer for SMU internal buffer */ 773 /* Allocate buffer for SMU internal buffer */
772 ret = amdgpu_bo_create(adev, smu_internal_buffer_size, PAGE_SIZE, 774 ret = amdgpu_bo_create(adev, smu_internal_buffer_size, PAGE_SIZE,
773 true, AMDGPU_GEM_DOMAIN_VRAM, 0, NULL, smu_buf); 775 true, AMDGPU_GEM_DOMAIN_VRAM,
776 AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED,
777 NULL, smu_buf);
774 if (ret) { 778 if (ret) {
775 DRM_ERROR("Failed to allocate memory for SMU internal buffer\n"); 779 DRM_ERROR("Failed to allocate memory for SMU internal buffer\n");
776 return -ENOMEM; 780 return -ENOMEM;
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
index 517a68f82ec3..4bd1e5cf65ca 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
@@ -3786,7 +3786,9 @@ static int gfx_v7_0_rlc_init(struct amdgpu_device *adev)
3786 /* save restore block */ 3786 /* save restore block */
3787 if (adev->gfx.rlc.save_restore_obj == NULL) { 3787 if (adev->gfx.rlc.save_restore_obj == NULL) {
3788 r = amdgpu_bo_create(adev, dws * 4, PAGE_SIZE, true, 3788 r = amdgpu_bo_create(adev, dws * 4, PAGE_SIZE, true,
3789 AMDGPU_GEM_DOMAIN_VRAM, 0, NULL, &adev->gfx.rlc.save_restore_obj); 3789 AMDGPU_GEM_DOMAIN_VRAM,
3790 AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED,
3791 NULL, &adev->gfx.rlc.save_restore_obj);
3790 if (r) { 3792 if (r) {
3791 dev_warn(adev->dev, "(%d) create RLC sr bo failed\n", r); 3793 dev_warn(adev->dev, "(%d) create RLC sr bo failed\n", r);
3792 return r; 3794 return r;
@@ -3827,7 +3829,9 @@ static int gfx_v7_0_rlc_init(struct amdgpu_device *adev)
3827 3829
3828 if (adev->gfx.rlc.clear_state_obj == NULL) { 3830 if (adev->gfx.rlc.clear_state_obj == NULL) {
3829 r = amdgpu_bo_create(adev, dws * 4, PAGE_SIZE, true, 3831 r = amdgpu_bo_create(adev, dws * 4, PAGE_SIZE, true,
3830 AMDGPU_GEM_DOMAIN_VRAM, 0, NULL, &adev->gfx.rlc.clear_state_obj); 3832 AMDGPU_GEM_DOMAIN_VRAM,
3833 AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED,
3834 NULL, &adev->gfx.rlc.clear_state_obj);
3831 if (r) { 3835 if (r) {
3832 dev_warn(adev->dev, "(%d) create RLC c bo failed\n", r); 3836 dev_warn(adev->dev, "(%d) create RLC c bo failed\n", r);
3833 gfx_v7_0_rlc_fini(adev); 3837 gfx_v7_0_rlc_fini(adev);
@@ -3864,7 +3868,9 @@ static int gfx_v7_0_rlc_init(struct amdgpu_device *adev)
3864 if (adev->gfx.rlc.cp_table_size) { 3868 if (adev->gfx.rlc.cp_table_size) {
3865 if (adev->gfx.rlc.cp_table_obj == NULL) { 3869 if (adev->gfx.rlc.cp_table_obj == NULL) {
3866 r = amdgpu_bo_create(adev, adev->gfx.rlc.cp_table_size, PAGE_SIZE, true, 3870 r = amdgpu_bo_create(adev, adev->gfx.rlc.cp_table_size, PAGE_SIZE, true,
3867 AMDGPU_GEM_DOMAIN_VRAM, 0, NULL, &adev->gfx.rlc.cp_table_obj); 3871 AMDGPU_GEM_DOMAIN_VRAM,
3872 AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED,
3873 NULL, &adev->gfx.rlc.cp_table_obj);
3868 if (r) { 3874 if (r) {
3869 dev_warn(adev->dev, "(%d) create RLC cp table bo failed\n", r); 3875 dev_warn(adev->dev, "(%d) create RLC cp table bo failed\n", r);
3870 gfx_v7_0_rlc_fini(adev); 3876 gfx_v7_0_rlc_fini(adev);
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
index 0af357a1a170..53f07439a512 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
@@ -2005,7 +2005,7 @@ static void gfx_v8_0_setup_rb(struct amdgpu_device *adev,
2005} 2005}
2006 2006
2007/** 2007/**
2008 * gmc_v8_0_init_compute_vmid - gart enable 2008 * gfx_v8_0_init_compute_vmid - gart enable
2009 * 2009 *
2010 * @rdev: amdgpu_device pointer 2010 * @rdev: amdgpu_device pointer
2011 * 2011 *
@@ -2015,7 +2015,7 @@ static void gfx_v8_0_setup_rb(struct amdgpu_device *adev,
2015#define DEFAULT_SH_MEM_BASES (0x6000) 2015#define DEFAULT_SH_MEM_BASES (0x6000)
2016#define FIRST_COMPUTE_VMID (8) 2016#define FIRST_COMPUTE_VMID (8)
2017#define LAST_COMPUTE_VMID (16) 2017#define LAST_COMPUTE_VMID (16)
2018static void gmc_v8_0_init_compute_vmid(struct amdgpu_device *adev) 2018static void gfx_v8_0_init_compute_vmid(struct amdgpu_device *adev)
2019{ 2019{
2020 int i; 2020 int i;
2021 uint32_t sh_mem_config; 2021 uint32_t sh_mem_config;
@@ -2282,7 +2282,7 @@ static void gfx_v8_0_gpu_init(struct amdgpu_device *adev)
2282 vi_srbm_select(adev, 0, 0, 0, 0); 2282 vi_srbm_select(adev, 0, 0, 0, 0);
2283 mutex_unlock(&adev->srbm_mutex); 2283 mutex_unlock(&adev->srbm_mutex);
2284 2284
2285 gmc_v8_0_init_compute_vmid(adev); 2285 gfx_v8_0_init_compute_vmid(adev);
2286 2286
2287 mutex_lock(&adev->grbm_idx_mutex); 2287 mutex_lock(&adev->grbm_idx_mutex);
2288 /* 2288 /*
diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c
index 10218828face..774528ab8704 100644
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c
@@ -523,17 +523,11 @@ static int gmc_v7_0_gart_enable(struct amdgpu_device *adev)
523 tmp = RREG32(mmVM_CONTEXT1_CNTL); 523 tmp = RREG32(mmVM_CONTEXT1_CNTL);
524 tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL, ENABLE_CONTEXT, 1); 524 tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL, ENABLE_CONTEXT, 1);
525 tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL, PAGE_TABLE_DEPTH, 1); 525 tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL, PAGE_TABLE_DEPTH, 1);
526 tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL, RANGE_PROTECTION_FAULT_ENABLE_INTERRUPT, 1);
527 tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL, RANGE_PROTECTION_FAULT_ENABLE_DEFAULT, 1); 526 tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL, RANGE_PROTECTION_FAULT_ENABLE_DEFAULT, 1);
528 tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL, DUMMY_PAGE_PROTECTION_FAULT_ENABLE_INTERRUPT, 1);
529 tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL, DUMMY_PAGE_PROTECTION_FAULT_ENABLE_DEFAULT, 1); 527 tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL, DUMMY_PAGE_PROTECTION_FAULT_ENABLE_DEFAULT, 1);
530 tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL, PDE0_PROTECTION_FAULT_ENABLE_INTERRUPT, 1);
531 tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL, PDE0_PROTECTION_FAULT_ENABLE_DEFAULT, 1); 528 tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL, PDE0_PROTECTION_FAULT_ENABLE_DEFAULT, 1);
532 tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL, VALID_PROTECTION_FAULT_ENABLE_INTERRUPT, 1);
533 tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL, VALID_PROTECTION_FAULT_ENABLE_DEFAULT, 1); 529 tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL, VALID_PROTECTION_FAULT_ENABLE_DEFAULT, 1);
534 tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL, READ_PROTECTION_FAULT_ENABLE_INTERRUPT, 1);
535 tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL, READ_PROTECTION_FAULT_ENABLE_DEFAULT, 1); 530 tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL, READ_PROTECTION_FAULT_ENABLE_DEFAULT, 1);
536 tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL, WRITE_PROTECTION_FAULT_ENABLE_INTERRUPT, 1);
537 tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL, WRITE_PROTECTION_FAULT_ENABLE_DEFAULT, 1); 531 tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL, WRITE_PROTECTION_FAULT_ENABLE_DEFAULT, 1);
538 tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL, PAGE_TABLE_BLOCK_SIZE, 532 tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL, PAGE_TABLE_BLOCK_SIZE,
539 amdgpu_vm_block_size - 9); 533 amdgpu_vm_block_size - 9);
@@ -852,6 +846,13 @@ static int gmc_v7_0_early_init(void *handle)
852 return 0; 846 return 0;
853} 847}
854 848
849static int gmc_v7_0_late_init(void *handle)
850{
851 struct amdgpu_device *adev = (struct amdgpu_device *)handle;
852
853 return amdgpu_irq_get(adev, &adev->mc.vm_fault, 0);
854}
855
855static int gmc_v7_0_sw_init(void *handle) 856static int gmc_v7_0_sw_init(void *handle)
856{ 857{
857 int r; 858 int r;
@@ -976,6 +977,7 @@ static int gmc_v7_0_hw_fini(void *handle)
976{ 977{
977 struct amdgpu_device *adev = (struct amdgpu_device *)handle; 978 struct amdgpu_device *adev = (struct amdgpu_device *)handle;
978 979
980 amdgpu_irq_put(adev, &adev->mc.vm_fault, 0);
979 gmc_v7_0_gart_disable(adev); 981 gmc_v7_0_gart_disable(adev);
980 982
981 return 0; 983 return 0;
@@ -1301,7 +1303,7 @@ static int gmc_v7_0_set_powergating_state(void *handle,
1301 1303
1302const struct amd_ip_funcs gmc_v7_0_ip_funcs = { 1304const struct amd_ip_funcs gmc_v7_0_ip_funcs = {
1303 .early_init = gmc_v7_0_early_init, 1305 .early_init = gmc_v7_0_early_init,
1304 .late_init = NULL, 1306 .late_init = gmc_v7_0_late_init,
1305 .sw_init = gmc_v7_0_sw_init, 1307 .sw_init = gmc_v7_0_sw_init,
1306 .sw_fini = gmc_v7_0_sw_fini, 1308 .sw_fini = gmc_v7_0_sw_fini,
1307 .hw_init = gmc_v7_0_hw_init, 1309 .hw_init = gmc_v7_0_hw_init,
diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c
index 78109b750d29..9a07742620d0 100644
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c
@@ -653,19 +653,12 @@ static int gmc_v8_0_gart_enable(struct amdgpu_device *adev)
653 tmp = RREG32(mmVM_CONTEXT1_CNTL); 653 tmp = RREG32(mmVM_CONTEXT1_CNTL);
654 tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL, ENABLE_CONTEXT, 1); 654 tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL, ENABLE_CONTEXT, 1);
655 tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL, PAGE_TABLE_DEPTH, 1); 655 tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL, PAGE_TABLE_DEPTH, 1);
656 tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL, RANGE_PROTECTION_FAULT_ENABLE_INTERRUPT, 1);
657 tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL, RANGE_PROTECTION_FAULT_ENABLE_DEFAULT, 1); 656 tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL, RANGE_PROTECTION_FAULT_ENABLE_DEFAULT, 1);
658 tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL, DUMMY_PAGE_PROTECTION_FAULT_ENABLE_INTERRUPT, 1);
659 tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL, DUMMY_PAGE_PROTECTION_FAULT_ENABLE_DEFAULT, 1); 657 tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL, DUMMY_PAGE_PROTECTION_FAULT_ENABLE_DEFAULT, 1);
660 tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL, PDE0_PROTECTION_FAULT_ENABLE_INTERRUPT, 1);
661 tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL, PDE0_PROTECTION_FAULT_ENABLE_DEFAULT, 1); 658 tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL, PDE0_PROTECTION_FAULT_ENABLE_DEFAULT, 1);
662 tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL, VALID_PROTECTION_FAULT_ENABLE_INTERRUPT, 1);
663 tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL, VALID_PROTECTION_FAULT_ENABLE_DEFAULT, 1); 659 tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL, VALID_PROTECTION_FAULT_ENABLE_DEFAULT, 1);
664 tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL, READ_PROTECTION_FAULT_ENABLE_INTERRUPT, 1);
665 tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL, READ_PROTECTION_FAULT_ENABLE_DEFAULT, 1); 660 tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL, READ_PROTECTION_FAULT_ENABLE_DEFAULT, 1);
666 tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL, WRITE_PROTECTION_FAULT_ENABLE_INTERRUPT, 1);
667 tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL, WRITE_PROTECTION_FAULT_ENABLE_DEFAULT, 1); 661 tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL, WRITE_PROTECTION_FAULT_ENABLE_DEFAULT, 1);
668 tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL, EXECUTE_PROTECTION_FAULT_ENABLE_INTERRUPT, 1);
669 tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL, EXECUTE_PROTECTION_FAULT_ENABLE_DEFAULT, 1); 662 tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL, EXECUTE_PROTECTION_FAULT_ENABLE_DEFAULT, 1);
670 tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL, PAGE_TABLE_BLOCK_SIZE, 663 tmp = REG_SET_FIELD(tmp, VM_CONTEXT1_CNTL, PAGE_TABLE_BLOCK_SIZE,
671 amdgpu_vm_block_size - 9); 664 amdgpu_vm_block_size - 9);
@@ -852,6 +845,13 @@ static int gmc_v8_0_early_init(void *handle)
852 return 0; 845 return 0;
853} 846}
854 847
848static int gmc_v8_0_late_init(void *handle)
849{
850 struct amdgpu_device *adev = (struct amdgpu_device *)handle;
851
852 return amdgpu_irq_get(adev, &adev->mc.vm_fault, 0);
853}
854
855static int gmc_v8_0_sw_init(void *handle) 855static int gmc_v8_0_sw_init(void *handle)
856{ 856{
857 int r; 857 int r;
@@ -978,6 +978,7 @@ static int gmc_v8_0_hw_fini(void *handle)
978{ 978{
979 struct amdgpu_device *adev = (struct amdgpu_device *)handle; 979 struct amdgpu_device *adev = (struct amdgpu_device *)handle;
980 980
981 amdgpu_irq_put(adev, &adev->mc.vm_fault, 0);
981 gmc_v8_0_gart_disable(adev); 982 gmc_v8_0_gart_disable(adev);
982 983
983 return 0; 984 return 0;
@@ -1288,7 +1289,7 @@ static int gmc_v8_0_set_powergating_state(void *handle,
1288 1289
1289const struct amd_ip_funcs gmc_v8_0_ip_funcs = { 1290const struct amd_ip_funcs gmc_v8_0_ip_funcs = {
1290 .early_init = gmc_v8_0_early_init, 1291 .early_init = gmc_v8_0_early_init,
1291 .late_init = NULL, 1292 .late_init = gmc_v8_0_late_init,
1292 .sw_init = gmc_v8_0_sw_init, 1293 .sw_init = gmc_v8_0_sw_init,
1293 .sw_fini = gmc_v8_0_sw_fini, 1294 .sw_fini = gmc_v8_0_sw_fini,
1294 .hw_init = gmc_v8_0_hw_init, 1295 .hw_init = gmc_v8_0_hw_init,
diff --git a/drivers/gpu/drm/amd/amdgpu/iceland_smc.c b/drivers/gpu/drm/amd/amdgpu/iceland_smc.c
index c6f1e2f12b5f..c900aa942ade 100644
--- a/drivers/gpu/drm/amd/amdgpu/iceland_smc.c
+++ b/drivers/gpu/drm/amd/amdgpu/iceland_smc.c
@@ -623,7 +623,9 @@ int iceland_smu_init(struct amdgpu_device *adev)
623 623
624 /* Allocate FW image data structure and header buffer */ 624 /* Allocate FW image data structure and header buffer */
625 ret = amdgpu_bo_create(adev, image_size, PAGE_SIZE, 625 ret = amdgpu_bo_create(adev, image_size, PAGE_SIZE,
626 true, AMDGPU_GEM_DOMAIN_VRAM, 0, NULL, toc_buf); 626 true, AMDGPU_GEM_DOMAIN_VRAM,
627 AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED,
628 NULL, toc_buf);
627 if (ret) { 629 if (ret) {
628 DRM_ERROR("Failed to allocate memory for TOC buffer\n"); 630 DRM_ERROR("Failed to allocate memory for TOC buffer\n");
629 return -ENOMEM; 631 return -ENOMEM;
diff --git a/drivers/gpu/drm/amd/amdgpu/tonga_smc.c b/drivers/gpu/drm/amd/amdgpu/tonga_smc.c
index 5fc53a40c7ac..1f5ac941a610 100644
--- a/drivers/gpu/drm/amd/amdgpu/tonga_smc.c
+++ b/drivers/gpu/drm/amd/amdgpu/tonga_smc.c
@@ -761,7 +761,9 @@ int tonga_smu_init(struct amdgpu_device *adev)
761 761
762 /* Allocate FW image data structure and header buffer */ 762 /* Allocate FW image data structure and header buffer */
763 ret = amdgpu_bo_create(adev, image_size, PAGE_SIZE, 763 ret = amdgpu_bo_create(adev, image_size, PAGE_SIZE,
764 true, AMDGPU_GEM_DOMAIN_VRAM, 0, NULL, toc_buf); 764 true, AMDGPU_GEM_DOMAIN_VRAM,
765 AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED,
766 NULL, toc_buf);
765 if (ret) { 767 if (ret) {
766 DRM_ERROR("Failed to allocate memory for TOC buffer\n"); 768 DRM_ERROR("Failed to allocate memory for TOC buffer\n");
767 return -ENOMEM; 769 return -ENOMEM;
@@ -769,7 +771,9 @@ int tonga_smu_init(struct amdgpu_device *adev)
769 771
770 /* Allocate buffer for SMU internal buffer */ 772 /* Allocate buffer for SMU internal buffer */
771 ret = amdgpu_bo_create(adev, smu_internal_buffer_size, PAGE_SIZE, 773 ret = amdgpu_bo_create(adev, smu_internal_buffer_size, PAGE_SIZE,
772 true, AMDGPU_GEM_DOMAIN_VRAM, 0, NULL, smu_buf); 774 true, AMDGPU_GEM_DOMAIN_VRAM,
775 AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED,
776 NULL, smu_buf);
773 if (ret) { 777 if (ret) {
774 DRM_ERROR("Failed to allocate memory for SMU internal buffer\n"); 778 DRM_ERROR("Failed to allocate memory for SMU internal buffer\n");
775 return -ENOMEM; 779 return -ENOMEM;
diff --git a/drivers/gpu/drm/amd/amdgpu/vce_v3_0.c b/drivers/gpu/drm/amd/amdgpu/vce_v3_0.c
index 5642b8eb92ad..f0656dfb53f3 100644
--- a/drivers/gpu/drm/amd/amdgpu/vce_v3_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/vce_v3_0.c
@@ -32,8 +32,8 @@
32#include "vid.h" 32#include "vid.h"
33#include "vce/vce_3_0_d.h" 33#include "vce/vce_3_0_d.h"
34#include "vce/vce_3_0_sh_mask.h" 34#include "vce/vce_3_0_sh_mask.h"
35#include "oss/oss_2_0_d.h" 35#include "oss/oss_3_0_d.h"
36#include "oss/oss_2_0_sh_mask.h" 36#include "oss/oss_3_0_sh_mask.h"
37#include "gca/gfx_8_0_d.h" 37#include "gca/gfx_8_0_d.h"
38#include "smu/smu_7_1_2_d.h" 38#include "smu/smu_7_1_2_d.h"
39#include "smu/smu_7_1_2_sh_mask.h" 39#include "smu/smu_7_1_2_sh_mask.h"
@@ -426,17 +426,41 @@ static void vce_v3_0_mc_resume(struct amdgpu_device *adev, int idx)
426static bool vce_v3_0_is_idle(void *handle) 426static bool vce_v3_0_is_idle(void *handle)
427{ 427{
428 struct amdgpu_device *adev = (struct amdgpu_device *)handle; 428 struct amdgpu_device *adev = (struct amdgpu_device *)handle;
429 u32 mask = 0;
430 int idx;
429 431
430 return !(RREG32(mmSRBM_STATUS2) & SRBM_STATUS2__VCE_BUSY_MASK); 432 for (idx = 0; idx < 2; ++idx) {
433 if (adev->vce.harvest_config & (1 << idx))
434 continue;
435
436 if (idx == 0)
437 mask |= SRBM_STATUS2__VCE0_BUSY_MASK;
438 else
439 mask |= SRBM_STATUS2__VCE1_BUSY_MASK;
440 }
441
442 return !(RREG32(mmSRBM_STATUS2) & mask);
431} 443}
432 444
433static int vce_v3_0_wait_for_idle(void *handle) 445static int vce_v3_0_wait_for_idle(void *handle)
434{ 446{
435 unsigned i; 447 unsigned i;
436 struct amdgpu_device *adev = (struct amdgpu_device *)handle; 448 struct amdgpu_device *adev = (struct amdgpu_device *)handle;
449 u32 mask = 0;
450 int idx;
451
452 for (idx = 0; idx < 2; ++idx) {
453 if (adev->vce.harvest_config & (1 << idx))
454 continue;
455
456 if (idx == 0)
457 mask |= SRBM_STATUS2__VCE0_BUSY_MASK;
458 else
459 mask |= SRBM_STATUS2__VCE1_BUSY_MASK;
460 }
437 461
438 for (i = 0; i < adev->usec_timeout; i++) { 462 for (i = 0; i < adev->usec_timeout; i++) {
439 if (!(RREG32(mmSRBM_STATUS2) & SRBM_STATUS2__VCE_BUSY_MASK)) 463 if (!(RREG32(mmSRBM_STATUS2) & mask))
440 return 0; 464 return 0;
441 } 465 }
442 return -ETIMEDOUT; 466 return -ETIMEDOUT;
@@ -445,9 +469,21 @@ static int vce_v3_0_wait_for_idle(void *handle)
445static int vce_v3_0_soft_reset(void *handle) 469static int vce_v3_0_soft_reset(void *handle)
446{ 470{
447 struct amdgpu_device *adev = (struct amdgpu_device *)handle; 471 struct amdgpu_device *adev = (struct amdgpu_device *)handle;
472 u32 mask = 0;
473 int idx;
474
475 for (idx = 0; idx < 2; ++idx) {
476 if (adev->vce.harvest_config & (1 << idx))
477 continue;
448 478
449 WREG32_P(mmSRBM_SOFT_RESET, SRBM_SOFT_RESET__SOFT_RESET_VCE_MASK, 479 if (idx == 0)
450 ~SRBM_SOFT_RESET__SOFT_RESET_VCE_MASK); 480 mask |= SRBM_SOFT_RESET__SOFT_RESET_VCE0_MASK;
481 else
482 mask |= SRBM_SOFT_RESET__SOFT_RESET_VCE1_MASK;
483 }
484 WREG32_P(mmSRBM_SOFT_RESET, mask,
485 ~(SRBM_SOFT_RESET__SOFT_RESET_VCE0_MASK |
486 SRBM_SOFT_RESET__SOFT_RESET_VCE1_MASK));
451 mdelay(5); 487 mdelay(5);
452 488
453 return vce_v3_0_start(adev); 489 return vce_v3_0_start(adev);
diff --git a/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c b/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c
index ab8577f8ed4a..9259f1b6664c 100644
--- a/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c
+++ b/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c
@@ -332,7 +332,7 @@ static int amd_sched_main(void *param)
332{ 332{
333 struct sched_param sparam = {.sched_priority = 1}; 333 struct sched_param sparam = {.sched_priority = 1};
334 struct amd_gpu_scheduler *sched = (struct amd_gpu_scheduler *)param; 334 struct amd_gpu_scheduler *sched = (struct amd_gpu_scheduler *)param;
335 int r; 335 int r, count;
336 336
337 sched_setscheduler(current, SCHED_FIFO, &sparam); 337 sched_setscheduler(current, SCHED_FIFO, &sparam);
338 338
@@ -361,7 +361,8 @@ static int amd_sched_main(void *param)
361 fence_put(fence); 361 fence_put(fence);
362 } 362 }
363 363
364 kfifo_out(&entity->job_queue, &job, sizeof(job)); 364 count = kfifo_out(&entity->job_queue, &job, sizeof(job));
365 WARN_ON(count != sizeof(job));
365 wake_up(&sched->job_scheduled); 366 wake_up(&sched->job_scheduled);
366 } 367 }
367 return 0; 368 return 0;