diff options
author | Aaron Liu <aaron.liu@amd.com> | 2019-08-09 17:34:40 +0200 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2019-08-23 00:37:05 +0200 |
commit | 97222cfac7740ba93c2c17f15db5d7184c6ab836 (patch) | |
tree | 9cbacd69b98304dd9d64a3f7b6be58cbf25f2a3b /drivers/gpu/drm/amd/powerplay/smu_v12_0.c | |
parent | drm/amdgpu/powerplay: add smu ip block for renoir (v2) (diff) | |
download | linux-97222cfac7740ba93c2c17f15db5d7184c6ab836.tar.xz linux-97222cfac7740ba93c2c17f15db5d7184c6ab836.zip |
drm/amdgpu/powerplay: add power up/down SDMA interfaces for renoir
1.Implement PowerUpSDMA/PowerDownSDMA interfaces in the swSMU for renoir
2.adjust smu ip block ahead of gfx&sdma ip block
Signed-off-by: Aaron Liu <aaron.liu@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/powerplay/smu_v12_0.c')
-rw-r--r-- | drivers/gpu/drm/amd/powerplay/smu_v12_0.c | 35 |
1 files changed, 31 insertions, 4 deletions
diff --git a/drivers/gpu/drm/amd/powerplay/smu_v12_0.c b/drivers/gpu/drm/amd/powerplay/smu_v12_0.c index fdafa2306c29..cba8507a02af 100644 --- a/drivers/gpu/drm/amd/powerplay/smu_v12_0.c +++ b/drivers/gpu/drm/amd/powerplay/smu_v12_0.c @@ -101,7 +101,6 @@ static int smu_v12_0_send_msg_with_param(struct smu_context *smu, uint16_t msg, uint32_t param) { - struct amdgpu_device *adev = smu->adev; int ret = 0, index = 0; @@ -128,27 +127,55 @@ smu_v12_0_send_msg_with_param(struct smu_context *smu, uint16_t msg, return ret; } +static int smu_v12_0_check_fw_status(struct smu_context *smu) +{ + struct amdgpu_device *adev = smu->adev; + uint32_t mp1_fw_flags; + + mp1_fw_flags = RREG32_PCIE(MP1_Public | + (smnMP1_FIRMWARE_FLAGS & 0xffffffff)); + + if ((mp1_fw_flags & MP1_FIRMWARE_FLAGS__INTERRUPTS_ENABLED_MASK) >> + MP1_FIRMWARE_FLAGS__INTERRUPTS_ENABLED__SHIFT) + return 0; + + return -EIO; +} + static int smu_v12_0_check_fw_version(struct smu_context *smu) { - uint32_t smu_version = 0xff; + uint32_t smc_if_version = 0xff; int ret = 0; ret = smu_send_smc_msg(smu, SMU_MSG_GetDriverIfVersion); if (ret) goto err; - ret = smu_read_smc_arg(smu, &smu_version); + ret = smu_read_smc_arg(smu, &smc_if_version); if (ret) goto err; - if (smu_version != smu->smc_if_version) + if (smc_if_version != smu->smc_if_version) ret = -EINVAL; err: return ret; } +static int smu_v12_0_powergate_sdma(struct smu_context *smu, bool gate) +{ + if (!(smu->adev->flags & AMD_IS_APU)) + return 0; + + if (gate) + return smu_send_smc_msg(smu, SMU_MSG_PowerDownSdma); + else + return smu_send_smc_msg(smu, SMU_MSG_PowerUpSdma); +} + static const struct smu_funcs smu_v12_0_funcs = { + .check_fw_status = smu_v12_0_check_fw_status, .check_fw_version = smu_v12_0_check_fw_version, + .powergate_sdma = smu_v12_0_powergate_sdma, .send_smc_msg = smu_v12_0_send_msg, .send_smc_msg_with_param = smu_v12_0_send_msg_with_param, .read_smc_arg = smu_v12_0_read_arg, |