aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2018-02-28 23:03:14 -0500
committerDave Airlie <airlied@redhat.com>2018-02-28 23:03:14 -0500
commit93dfdf9fde9f20f1c46738bf184adeebc7d7d66e (patch)
treeecf680e75c00aadb21d506f5d2a552316d9f979e
parent2679b96ae4c055b8cfc27da8c9f703de08ce5c4b (diff)
parentfd430a702d37747d79bb5520590ce198df02aaa5 (diff)
Merge branch 'drm-fixes-4.16' of git://people.freedesktop.org/~agd5f/linux into drm-fixes
A few misc fixes for 4.16. * 'drm-fixes-4.16' of git://people.freedesktop.org/~agd5f/linux: drm/amdgpu: skip ECC for SRIOV in gmc late_init drm/amd/amdgpu: Correct VRAM width for APUs with GMC9 drm/amdgpu: fix&cleanups for wb_clear drm/amdgpu: Correct sdma_v4 get_wptr(v2) drm/amd/powerplay: fix power over limit on Fiji drm/amdgpu:Fixed wrong emit frame size for enc drm/amdgpu: move WB_FREE to correct place drm/amdgpu: only flush hotplug work without DC drm/amd/display: check for ipp before calling cursor operations
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu.h2
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_device.c17
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c6
-rw-r--r--drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c7
-rw-r--r--drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c18
-rw-r--r--drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c2
-rw-r--r--drivers/gpu/drm/amd/display/dc/core/dc_stream.c6
-rw-r--r--drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c7
8 files changed, 32 insertions, 33 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
index d5a2eefd6c3e..74edba18b159 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
@@ -1156,7 +1156,7 @@ static inline void amdgpu_set_ib_value(struct amdgpu_cs_parser *p,
1156/* 1156/*
1157 * Writeback 1157 * Writeback
1158 */ 1158 */
1159#define AMDGPU_MAX_WB 512 /* Reserve at most 512 WB slots for amdgpu-owned rings. */ 1159#define AMDGPU_MAX_WB 128 /* Reserve at most 128 WB slots for amdgpu-owned rings. */
1160 1160
1161struct amdgpu_wb { 1161struct amdgpu_wb {
1162 struct amdgpu_bo *wb_obj; 1162 struct amdgpu_bo *wb_obj;
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index 829dc2edace6..af1b879a9ee9 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -492,7 +492,7 @@ static int amdgpu_device_wb_init(struct amdgpu_device *adev)
492 memset(&adev->wb.used, 0, sizeof(adev->wb.used)); 492 memset(&adev->wb.used, 0, sizeof(adev->wb.used));
493 493
494 /* clear wb memory */ 494 /* clear wb memory */
495 memset((char *)adev->wb.wb, 0, AMDGPU_MAX_WB * sizeof(uint32_t)); 495 memset((char *)adev->wb.wb, 0, AMDGPU_MAX_WB * sizeof(uint32_t) * 8);
496 } 496 }
497 497
498 return 0; 498 return 0;
@@ -530,8 +530,9 @@ int amdgpu_device_wb_get(struct amdgpu_device *adev, u32 *wb)
530 */ 530 */
531void amdgpu_device_wb_free(struct amdgpu_device *adev, u32 wb) 531void amdgpu_device_wb_free(struct amdgpu_device *adev, u32 wb)
532{ 532{
533 wb >>= 3;
533 if (wb < adev->wb.num_wb) 534 if (wb < adev->wb.num_wb)
534 __clear_bit(wb >> 3, adev->wb.used); 535 __clear_bit(wb, adev->wb.used);
535} 536}
536 537
537/** 538/**
@@ -1455,11 +1456,6 @@ static int amdgpu_device_ip_fini(struct amdgpu_device *adev)
1455 for (i = adev->num_ip_blocks - 1; i >= 0; i--) { 1456 for (i = adev->num_ip_blocks - 1; i >= 0; i--) {
1456 if (!adev->ip_blocks[i].status.hw) 1457 if (!adev->ip_blocks[i].status.hw)
1457 continue; 1458 continue;
1458 if (adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_GMC) {
1459 amdgpu_free_static_csa(adev);
1460 amdgpu_device_wb_fini(adev);
1461 amdgpu_device_vram_scratch_fini(adev);
1462 }
1463 1459
1464 if (adev->ip_blocks[i].version->type != AMD_IP_BLOCK_TYPE_UVD && 1460 if (adev->ip_blocks[i].version->type != AMD_IP_BLOCK_TYPE_UVD &&
1465 adev->ip_blocks[i].version->type != AMD_IP_BLOCK_TYPE_VCE) { 1461 adev->ip_blocks[i].version->type != AMD_IP_BLOCK_TYPE_VCE) {
@@ -1486,6 +1482,13 @@ static int amdgpu_device_ip_fini(struct amdgpu_device *adev)
1486 for (i = adev->num_ip_blocks - 1; i >= 0; i--) { 1482 for (i = adev->num_ip_blocks - 1; i >= 0; i--) {
1487 if (!adev->ip_blocks[i].status.sw) 1483 if (!adev->ip_blocks[i].status.sw)
1488 continue; 1484 continue;
1485
1486 if (adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_GMC) {
1487 amdgpu_free_static_csa(adev);
1488 amdgpu_device_wb_fini(adev);
1489 amdgpu_device_vram_scratch_fini(adev);
1490 }
1491
1489 r = adev->ip_blocks[i].version->funcs->sw_fini((void *)adev); 1492 r = adev->ip_blocks[i].version->funcs->sw_fini((void *)adev);
1490 /* XXX handle errors */ 1493 /* XXX handle errors */
1491 if (r) { 1494 if (r) {
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
index 56bcd59c3399..36483e0d3c97 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c
@@ -257,7 +257,8 @@ int amdgpu_irq_init(struct amdgpu_device *adev)
257 r = drm_irq_install(adev->ddev, adev->ddev->pdev->irq); 257 r = drm_irq_install(adev->ddev, adev->ddev->pdev->irq);
258 if (r) { 258 if (r) {
259 adev->irq.installed = false; 259 adev->irq.installed = false;
260 flush_work(&adev->hotplug_work); 260 if (!amdgpu_device_has_dc_support(adev))
261 flush_work(&adev->hotplug_work);
261 cancel_work_sync(&adev->reset_work); 262 cancel_work_sync(&adev->reset_work);
262 return r; 263 return r;
263 } 264 }
@@ -282,7 +283,8 @@ void amdgpu_irq_fini(struct amdgpu_device *adev)
282 adev->irq.installed = false; 283 adev->irq.installed = false;
283 if (adev->irq.msi_enabled) 284 if (adev->irq.msi_enabled)
284 pci_disable_msi(adev->pdev); 285 pci_disable_msi(adev->pdev);
285 flush_work(&adev->hotplug_work); 286 if (!amdgpu_device_has_dc_support(adev))
287 flush_work(&adev->hotplug_work);
286 cancel_work_sync(&adev->reset_work); 288 cancel_work_sync(&adev->reset_work);
287 } 289 }
288 290
diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
index 2719937e09d6..3b7e7af09ead 100644
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
@@ -634,7 +634,7 @@ static int gmc_v9_0_late_init(void *handle)
634 for(i = 0; i < AMDGPU_MAX_VMHUBS; ++i) 634 for(i = 0; i < AMDGPU_MAX_VMHUBS; ++i)
635 BUG_ON(vm_inv_eng[i] > 16); 635 BUG_ON(vm_inv_eng[i] > 16);
636 636
637 if (adev->asic_type == CHIP_VEGA10) { 637 if (adev->asic_type == CHIP_VEGA10 && !amdgpu_sriov_vf(adev)) {
638 r = gmc_v9_0_ecc_available(adev); 638 r = gmc_v9_0_ecc_available(adev);
639 if (r == 1) { 639 if (r == 1) {
640 DRM_INFO("ECC is active.\n"); 640 DRM_INFO("ECC is active.\n");
@@ -682,7 +682,10 @@ static int gmc_v9_0_mc_init(struct amdgpu_device *adev)
682 adev->mc.vram_width = amdgpu_atomfirmware_get_vram_width(adev); 682 adev->mc.vram_width = amdgpu_atomfirmware_get_vram_width(adev);
683 if (!adev->mc.vram_width) { 683 if (!adev->mc.vram_width) {
684 /* hbm memory channel size */ 684 /* hbm memory channel size */
685 chansize = 128; 685 if (adev->flags & AMD_IS_APU)
686 chansize = 64;
687 else
688 chansize = 128;
686 689
687 tmp = RREG32_SOC15(DF, 0, mmDF_CS_AON0_DramBaseAddress0); 690 tmp = RREG32_SOC15(DF, 0, mmDF_CS_AON0_DramBaseAddress0);
688 tmp &= DF_CS_AON0_DramBaseAddress0__IntLvNumChan_MASK; 691 tmp &= DF_CS_AON0_DramBaseAddress0__IntLvNumChan_MASK;
diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c b/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
index e92fb372bc99..91cf95a8c39c 100644
--- a/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
@@ -238,31 +238,27 @@ static uint64_t sdma_v4_0_ring_get_rptr(struct amdgpu_ring *ring)
238static uint64_t sdma_v4_0_ring_get_wptr(struct amdgpu_ring *ring) 238static uint64_t sdma_v4_0_ring_get_wptr(struct amdgpu_ring *ring)
239{ 239{
240 struct amdgpu_device *adev = ring->adev; 240 struct amdgpu_device *adev = ring->adev;
241 u64 *wptr = NULL; 241 u64 wptr;
242 uint64_t local_wptr = 0;
243 242
244 if (ring->use_doorbell) { 243 if (ring->use_doorbell) {
245 /* XXX check if swapping is necessary on BE */ 244 /* XXX check if swapping is necessary on BE */
246 wptr = ((u64 *)&adev->wb.wb[ring->wptr_offs]); 245 wptr = READ_ONCE(*((u64 *)&adev->wb.wb[ring->wptr_offs]));
247 DRM_DEBUG("wptr/doorbell before shift == 0x%016llx\n", *wptr); 246 DRM_DEBUG("wptr/doorbell before shift == 0x%016llx\n", wptr);
248 *wptr = (*wptr) >> 2;
249 DRM_DEBUG("wptr/doorbell after shift == 0x%016llx\n", *wptr);
250 } else { 247 } else {
251 u32 lowbit, highbit; 248 u32 lowbit, highbit;
252 int me = (ring == &adev->sdma.instance[0].ring) ? 0 : 1; 249 int me = (ring == &adev->sdma.instance[0].ring) ? 0 : 1;
253 250
254 wptr = &local_wptr;
255 lowbit = RREG32(sdma_v4_0_get_reg_offset(adev, me, mmSDMA0_GFX_RB_WPTR)) >> 2; 251 lowbit = RREG32(sdma_v4_0_get_reg_offset(adev, me, mmSDMA0_GFX_RB_WPTR)) >> 2;
256 highbit = RREG32(sdma_v4_0_get_reg_offset(adev, me, mmSDMA0_GFX_RB_WPTR_HI)) >> 2; 252 highbit = RREG32(sdma_v4_0_get_reg_offset(adev, me, mmSDMA0_GFX_RB_WPTR_HI)) >> 2;
257 253
258 DRM_DEBUG("wptr [%i]high== 0x%08x low==0x%08x\n", 254 DRM_DEBUG("wptr [%i]high== 0x%08x low==0x%08x\n",
259 me, highbit, lowbit); 255 me, highbit, lowbit);
260 *wptr = highbit; 256 wptr = highbit;
261 *wptr = (*wptr) << 32; 257 wptr = wptr << 32;
262 *wptr |= lowbit; 258 wptr |= lowbit;
263 } 259 }
264 260
265 return *wptr; 261 return wptr >> 2;
266} 262}
267 263
268/** 264/**
diff --git a/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c b/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c
index b2bfedaf57f1..9bab4842cd44 100644
--- a/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c
@@ -1618,7 +1618,7 @@ static const struct amdgpu_ring_funcs uvd_v6_0_enc_ring_vm_funcs = {
1618 .set_wptr = uvd_v6_0_enc_ring_set_wptr, 1618 .set_wptr = uvd_v6_0_enc_ring_set_wptr,
1619 .emit_frame_size = 1619 .emit_frame_size =
1620 4 + /* uvd_v6_0_enc_ring_emit_pipeline_sync */ 1620 4 + /* uvd_v6_0_enc_ring_emit_pipeline_sync */
1621 6 + /* uvd_v6_0_enc_ring_emit_vm_flush */ 1621 5 + /* uvd_v6_0_enc_ring_emit_vm_flush */
1622 5 + 5 + /* uvd_v6_0_enc_ring_emit_fence x2 vm fence */ 1622 5 + 5 + /* uvd_v6_0_enc_ring_emit_fence x2 vm fence */
1623 1, /* uvd_v6_0_enc_ring_insert_end */ 1623 1, /* uvd_v6_0_enc_ring_insert_end */
1624 .emit_ib_size = 5, /* uvd_v6_0_enc_ring_emit_ib */ 1624 .emit_ib_size = 5, /* uvd_v6_0_enc_ring_emit_ib */
diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_stream.c b/drivers/gpu/drm/amd/display/dc/core/dc_stream.c
index 261811e0c094..539c3e0a6292 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_stream.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_stream.c
@@ -197,7 +197,8 @@ bool dc_stream_set_cursor_attributes(
197 for (i = 0; i < MAX_PIPES; i++) { 197 for (i = 0; i < MAX_PIPES; i++) {
198 struct pipe_ctx *pipe_ctx = &res_ctx->pipe_ctx[i]; 198 struct pipe_ctx *pipe_ctx = &res_ctx->pipe_ctx[i];
199 199
200 if (pipe_ctx->stream != stream || (!pipe_ctx->plane_res.xfm && !pipe_ctx->plane_res.dpp)) 200 if (pipe_ctx->stream != stream || (!pipe_ctx->plane_res.xfm &&
201 !pipe_ctx->plane_res.dpp) || !pipe_ctx->plane_res.ipp)
201 continue; 202 continue;
202 if (pipe_ctx->top_pipe && pipe_ctx->plane_state != pipe_ctx->top_pipe->plane_state) 203 if (pipe_ctx->top_pipe && pipe_ctx->plane_state != pipe_ctx->top_pipe->plane_state)
203 continue; 204 continue;
@@ -273,7 +274,8 @@ bool dc_stream_set_cursor_position(
273 if (pipe_ctx->stream != stream || 274 if (pipe_ctx->stream != stream ||
274 (!pipe_ctx->plane_res.mi && !pipe_ctx->plane_res.hubp) || 275 (!pipe_ctx->plane_res.mi && !pipe_ctx->plane_res.hubp) ||
275 !pipe_ctx->plane_state || 276 !pipe_ctx->plane_state ||
276 (!pipe_ctx->plane_res.xfm && !pipe_ctx->plane_res.dpp)) 277 (!pipe_ctx->plane_res.xfm && !pipe_ctx->plane_res.dpp) ||
278 !pipe_ctx->plane_res.ipp)
277 continue; 279 continue;
278 280
279 if (pipe_ctx->plane_state->address.type 281 if (pipe_ctx->plane_state->address.type
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c
index 45be31327340..08e8a793714f 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c
@@ -4537,13 +4537,6 @@ static int smu7_set_power_profile_state(struct pp_hwmgr *hwmgr,
4537 int tmp_result, result = 0; 4537 int tmp_result, result = 0;
4538 uint32_t sclk_mask = 0, mclk_mask = 0; 4538 uint32_t sclk_mask = 0, mclk_mask = 0;
4539 4539
4540 if (hwmgr->chip_id == CHIP_FIJI) {
4541 if (request->type == AMD_PP_GFX_PROFILE)
4542 smu7_enable_power_containment(hwmgr);
4543 else if (request->type == AMD_PP_COMPUTE_PROFILE)
4544 smu7_disable_power_containment(hwmgr);
4545 }
4546
4547 if (hwmgr->dpm_level != AMD_DPM_FORCED_LEVEL_AUTO) 4540 if (hwmgr->dpm_level != AMD_DPM_FORCED_LEVEL_AUTO)
4548 return -EINVAL; 4541 return -EINVAL;
4549 4542