Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+42 -6
+42 -6
drivers/gpu/drm/amd/amdgpu/vce_v3_0.c
··· 32 32 #include "vid.h" 33 33 #include "vce/vce_3_0_d.h" 34 34 #include "vce/vce_3_0_sh_mask.h" 35 - #include "oss/oss_2_0_d.h" 36 - #include "oss/oss_2_0_sh_mask.h" 35 + #include "oss/oss_3_0_d.h" 36 + #include "oss/oss_3_0_sh_mask.h" 37 37 #include "gca/gfx_8_0_d.h" 38 38 #include "smu/smu_7_1_2_d.h" 39 39 #include "smu/smu_7_1_2_sh_mask.h" ··· 426 426 static bool vce_v3_0_is_idle(void *handle) 427 427 { 428 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 445 static int vce_v3_0_wait_for_idle(void *handle) 434 446 { 435 447 unsigned i; 436 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 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 464 return 0; 441 465 } 442 466 return -ETIMEDOUT; ··· 469 445 static int vce_v3_0_soft_reset(void *handle) 470 446 { 471 447 struct amdgpu_device *adev = (struct amdgpu_device *)handle; 448 + u32 mask = 0; 449 + int idx; 472 450 473 - WREG32_P(mmSRBM_SOFT_RESET, SRBM_SOFT_RESET__SOFT_RESET_VCE_MASK, 474 - ~SRBM_SOFT_RESET__SOFT_RESET_VCE_MASK); 451 + for (idx = 0; idx < 2; ++idx) { 452 + if (adev->vce.harvest_config & (1 << idx)) 453 + continue; 454 + 455 + if (idx == 0) 456 + mask |= SRBM_SOFT_RESET__SOFT_RESET_VCE0_MASK; 457 + else 458 + mask |= SRBM_SOFT_RESET__SOFT_RESET_VCE1_MASK; 459 + } 460 + WREG32_P(mmSRBM_SOFT_RESET, mask, 461 + ~(SRBM_SOFT_RESET__SOFT_RESET_VCE0_MASK | 462 + SRBM_SOFT_RESET__SOFT_RESET_VCE1_MASK)); 475 463 mdelay(5); 476 464 477 465 return vce_v3_0_start(adev);