diff options
author | Alex Deucher <alexander.deucher@amd.com> | 2015-09-03 19:03:11 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2015-09-04 16:35:54 -0400 |
commit | be4f38e28ca2bbd6d06db8064277d71389746e26 (patch) | |
tree | 09649cca384dc343cde9a396def7a22fcd127646 | |
parent | 898e50d444e12f735e45d07cd3f306ac5d4abca8 (diff) |
drm/amdgpu: fix vce3 instance handling
Need to properly handle the instances for the idle
checks and soft reset.
Acked-by: Leo Liu <leo.liu@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/vce_v3_0.c | 48 |
1 files changed, 42 insertions, 6 deletions
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) | |||
426 | static bool vce_v3_0_is_idle(void *handle) | 426 | static 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 | ||
433 | static int vce_v3_0_wait_for_idle(void *handle) | 445 | static 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) | |||
445 | static int vce_v3_0_soft_reset(void *handle) | 469 | static 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); |