mirror of
https://github.com/linux-msm/laptops-kernel.git
synced 2026-08-13 14:19:53 -07:00
drm/amdgpu: pass ip_block in set_powergating_state
Pass ip_block instead of adev in set_powergating_state callback function. Modify set_powergating_state ip functions for all correspoding ip blocks. v2: fix a ip block index error. v3: remove type casting Signed-off-by: Boyuan Zhang <boyuan.zhang@amd.com> Suggested-by: Christian König <christian.koenig@amd.com> Acked-by: Christian König <christian.koenig@amd.com> Acked-by: Alex Deucher <alexander.deucher@amd.com> Reviewed-by: Sunil Khatri <sunil.khatri@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
committed by
Alex Deucher
parent
393f026b16
commit
80d8051124
@@ -590,10 +590,10 @@ static int acp_set_clockgating_state(void *handle,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int acp_set_powergating_state(void *handle,
|
||||
static int acp_set_powergating_state(struct amdgpu_ip_block *ip_block,
|
||||
enum amd_powergating_state state)
|
||||
{
|
||||
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
|
||||
struct amdgpu_device *adev = ip_block->adev;
|
||||
bool enable = (state == AMD_PG_STATE_GATE);
|
||||
|
||||
amdgpu_dpm_set_powergating_by_smu(adev, AMD_IP_BLOCK_TYPE_ACP, enable, 0);
|
||||
|
||||
@@ -724,7 +724,9 @@ void amdgpu_amdkfd_set_compute_idle(struct amdgpu_device *adev, bool idle)
|
||||
/* Disable GFXOFF and PG. Temporary workaround
|
||||
* to fix some compute applications issue on GFX9.
|
||||
*/
|
||||
adev->ip_blocks[AMD_IP_BLOCK_TYPE_GFX].version->funcs->set_powergating_state((void *)adev, state);
|
||||
struct amdgpu_ip_block *gfx_block = amdgpu_device_ip_get_ip_block(adev, AMD_IP_BLOCK_TYPE_GFX);
|
||||
if (gfx_block != NULL)
|
||||
gfx_block->version->funcs->set_powergating_state((void *)gfx_block, state);
|
||||
}
|
||||
amdgpu_dpm_switch_power_profile(adev,
|
||||
PP_SMC_POWER_PROFILE_COMPUTE,
|
||||
|
||||
@@ -2199,7 +2199,7 @@ int amdgpu_device_ip_set_powergating_state(void *dev,
|
||||
if (!adev->ip_blocks[i].version->funcs->set_powergating_state)
|
||||
continue;
|
||||
r = adev->ip_blocks[i].version->funcs->set_powergating_state(
|
||||
(void *)adev, state);
|
||||
&adev->ip_blocks[i], state);
|
||||
if (r)
|
||||
DRM_ERROR("set_powergating_state of IP block <%s> failed %d\n",
|
||||
adev->ip_blocks[i].version->funcs->name, r);
|
||||
@@ -3174,7 +3174,7 @@ int amdgpu_device_set_pg_state(struct amdgpu_device *adev,
|
||||
adev->ip_blocks[i].version->type != AMD_IP_BLOCK_TYPE_JPEG &&
|
||||
adev->ip_blocks[i].version->funcs->set_powergating_state) {
|
||||
/* enable powergating to save power */
|
||||
r = adev->ip_blocks[i].version->funcs->set_powergating_state((void *)adev,
|
||||
r = adev->ip_blocks[i].version->funcs->set_powergating_state(&adev->ip_blocks[i],
|
||||
state);
|
||||
if (r) {
|
||||
DRM_ERROR("set_powergating_state(gate) of IP block <%s> failed %d\n",
|
||||
|
||||
@@ -134,7 +134,7 @@ static int isp_set_clockgating_state(void *handle,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int isp_set_powergating_state(void *handle,
|
||||
static int isp_set_powergating_state(struct amdgpu_ip_block *ip_block,
|
||||
enum amd_powergating_state state)
|
||||
{
|
||||
return 0;
|
||||
|
||||
@@ -3855,7 +3855,7 @@ static int psp_set_clockgating_state(void *handle,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int psp_set_powergating_state(void *handle,
|
||||
static int psp_set_powergating_state(struct amdgpu_ip_block *ip_block,
|
||||
enum amd_powergating_state state)
|
||||
{
|
||||
return 0;
|
||||
|
||||
@@ -638,7 +638,7 @@ static int amdgpu_vkms_set_clockgating_state(void *handle,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int amdgpu_vkms_set_powergating_state(void *handle,
|
||||
static int amdgpu_vkms_set_powergating_state(struct amdgpu_ip_block *ip_block,
|
||||
enum amd_powergating_state state)
|
||||
{
|
||||
return 0;
|
||||
|
||||
@@ -652,10 +652,10 @@ static int vpe_set_clockgating_state(void *handle,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int vpe_set_powergating_state(void *handle,
|
||||
static int vpe_set_powergating_state(struct amdgpu_ip_block *ip_block,
|
||||
enum amd_powergating_state state)
|
||||
{
|
||||
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
|
||||
struct amdgpu_device *adev = ip_block->adev;
|
||||
struct amdgpu_vpe *vpe = &adev->vpe;
|
||||
|
||||
if (!adev->pm.dpm_enabled)
|
||||
|
||||
@@ -2167,7 +2167,7 @@ static int cik_common_set_clockgating_state(void *handle,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cik_common_set_powergating_state(void *handle,
|
||||
static int cik_common_set_powergating_state(struct amdgpu_ip_block *ip_block,
|
||||
enum amd_powergating_state state)
|
||||
{
|
||||
return 0;
|
||||
|
||||
@@ -408,7 +408,7 @@ static int cik_ih_set_clockgating_state(void *handle,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cik_ih_set_powergating_state(void *handle,
|
||||
static int cik_ih_set_powergating_state(struct amdgpu_ip_block *ip_block,
|
||||
enum amd_powergating_state state)
|
||||
{
|
||||
return 0;
|
||||
|
||||
@@ -1204,7 +1204,7 @@ static int cik_sdma_set_clockgating_state(void *handle,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cik_sdma_set_powergating_state(void *handle,
|
||||
static int cik_sdma_set_powergating_state(struct amdgpu_ip_block *ip_block,
|
||||
enum amd_powergating_state state)
|
||||
{
|
||||
return 0;
|
||||
|
||||
@@ -405,7 +405,7 @@ static int cz_ih_set_clockgating_state(void *handle,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cz_ih_set_powergating_state(void *handle,
|
||||
static int cz_ih_set_powergating_state(struct amdgpu_ip_block *ip_block,
|
||||
enum amd_powergating_state state)
|
||||
{
|
||||
// TODO
|
||||
|
||||
@@ -3308,7 +3308,7 @@ static int dce_v10_0_set_clockgating_state(void *handle,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int dce_v10_0_set_powergating_state(void *handle,
|
||||
static int dce_v10_0_set_powergating_state(struct amdgpu_ip_block *ip_block,
|
||||
enum amd_powergating_state state)
|
||||
{
|
||||
return 0;
|
||||
|
||||
@@ -3440,7 +3440,7 @@ static int dce_v11_0_set_clockgating_state(void *handle,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int dce_v11_0_set_powergating_state(void *handle,
|
||||
static int dce_v11_0_set_powergating_state(struct amdgpu_ip_block *ip_block,
|
||||
enum amd_powergating_state state)
|
||||
{
|
||||
return 0;
|
||||
|
||||
@@ -3130,7 +3130,7 @@ static int dce_v6_0_set_clockgating_state(void *handle,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int dce_v6_0_set_powergating_state(void *handle,
|
||||
static int dce_v6_0_set_powergating_state(struct amdgpu_ip_block *ip_block,
|
||||
enum amd_powergating_state state)
|
||||
{
|
||||
return 0;
|
||||
|
||||
@@ -3218,7 +3218,7 @@ static int dce_v8_0_set_clockgating_state(void *handle,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int dce_v8_0_set_powergating_state(void *handle,
|
||||
static int dce_v8_0_set_powergating_state(struct amdgpu_ip_block *ip_block,
|
||||
enum amd_powergating_state state)
|
||||
{
|
||||
return 0;
|
||||
|
||||
@@ -3673,7 +3673,7 @@ static void gfx_v10_0_ring_invalidate_tlbs(struct amdgpu_ring *ring,
|
||||
static void gfx_v10_0_update_spm_vmid_internal(struct amdgpu_device *adev,
|
||||
unsigned int vmid);
|
||||
|
||||
static int gfx_v10_0_set_powergating_state(void *handle,
|
||||
static int gfx_v10_0_set_powergating_state(struct amdgpu_ip_block *ip_block,
|
||||
enum amd_powergating_state state);
|
||||
static void gfx10_kiq_set_resources(struct amdgpu_ring *kiq_ring, uint64_t queue_mask)
|
||||
{
|
||||
@@ -7453,7 +7453,7 @@ static int gfx_v10_0_hw_fini(struct amdgpu_ip_block *ip_block)
|
||||
* otherwise the gfxoff disallowing will be failed to set.
|
||||
*/
|
||||
if (amdgpu_ip_version(adev, GC_HWIP, 0) == IP_VERSION(10, 3, 1))
|
||||
gfx_v10_0_set_powergating_state(ip_block->adev, AMD_PG_STATE_UNGATE);
|
||||
gfx_v10_0_set_powergating_state(ip_block, AMD_PG_STATE_UNGATE);
|
||||
|
||||
if (!adev->no_hw_access) {
|
||||
if (amdgpu_async_gfx_ring) {
|
||||
@@ -8341,10 +8341,10 @@ static const struct amdgpu_rlc_funcs gfx_v10_0_rlc_funcs_sriov = {
|
||||
.is_rlcg_access_range = gfx_v10_0_is_rlcg_access_range,
|
||||
};
|
||||
|
||||
static int gfx_v10_0_set_powergating_state(void *handle,
|
||||
static int gfx_v10_0_set_powergating_state(struct amdgpu_ip_block *ip_block,
|
||||
enum amd_powergating_state state)
|
||||
{
|
||||
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
|
||||
struct amdgpu_device *adev = ip_block->adev;
|
||||
bool enable = (state == AMD_PG_STATE_GATE);
|
||||
|
||||
if (amdgpu_sriov_vf(adev))
|
||||
|
||||
@@ -5456,10 +5456,10 @@ static void gfx_v11_cntl_pg(struct amdgpu_device *adev, bool enable)
|
||||
amdgpu_gfx_rlc_exit_safe_mode(adev, 0);
|
||||
}
|
||||
|
||||
static int gfx_v11_0_set_powergating_state(void *handle,
|
||||
static int gfx_v11_0_set_powergating_state(struct amdgpu_ip_block *ip_block,
|
||||
enum amd_powergating_state state)
|
||||
{
|
||||
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
|
||||
struct amdgpu_device *adev = ip_block->adev;
|
||||
bool enable = (state == AMD_PG_STATE_GATE);
|
||||
|
||||
if (amdgpu_sriov_vf(adev))
|
||||
|
||||
@@ -3862,10 +3862,10 @@ static void gfx_v12_cntl_pg(struct amdgpu_device *adev, bool enable)
|
||||
}
|
||||
#endif
|
||||
|
||||
static int gfx_v12_0_set_powergating_state(void *handle,
|
||||
static int gfx_v12_0_set_powergating_state(struct amdgpu_ip_block *ip_block,
|
||||
enum amd_powergating_state state)
|
||||
{
|
||||
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
|
||||
struct amdgpu_device *adev = ip_block->adev;
|
||||
bool enable = (state == AMD_PG_STATE_GATE);
|
||||
|
||||
if (amdgpu_sriov_vf(adev))
|
||||
|
||||
@@ -3395,11 +3395,11 @@ static int gfx_v6_0_set_clockgating_state(void *handle,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int gfx_v6_0_set_powergating_state(void *handle,
|
||||
static int gfx_v6_0_set_powergating_state(struct amdgpu_ip_block *ip_block,
|
||||
enum amd_powergating_state state)
|
||||
{
|
||||
bool gate = false;
|
||||
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
|
||||
struct amdgpu_device *adev = ip_block->adev;
|
||||
|
||||
if (state == AMD_PG_STATE_GATE)
|
||||
gate = true;
|
||||
|
||||
@@ -4869,11 +4869,11 @@ static int gfx_v7_0_set_clockgating_state(void *handle,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int gfx_v7_0_set_powergating_state(void *handle,
|
||||
static int gfx_v7_0_set_powergating_state(struct amdgpu_ip_block *ip_block,
|
||||
enum amd_powergating_state state)
|
||||
{
|
||||
bool gate = false;
|
||||
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
|
||||
struct amdgpu_device *adev = ip_block->adev;
|
||||
|
||||
if (state == AMD_PG_STATE_GATE)
|
||||
gate = true;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user