drm/amd/amdgpu: enable cgcg and cgls
Subsystems (3)
Alex Deucher
maintainerPATCH 1/7 drm/amd/amdgpu: enable cgcg and cgls
From: Kenneth Feng <[email protected]>
enable cgcg and cgls on gc 12.0.1
--- drivers/gpu/drm/amd/amdgpu/soc24.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/soc24.c +2 -1
@@ -401,7 +401,8 @@ static int soc24_common_early_init(void *handle) adev->external_rev_id = adev->rev_id +0x40 ;break ;case IP_VERSION (12 ,0 ,1 ): - adev->cg_flags =0 ; + adev->cg_flags =AMD_CG_SUPPORT_GFX_CGCG | +AMD_CG_SUPPORT_GFX_CGLS ; adev->pg_flags =AMD_PG_SUPPORT_VCN |AMD_PG_SUPPORT_JPEG |AMD_PG_SUPPORT_VCN_DPG ;
Signature · 1 line
2.44.0
Alex Deucher
maintainerPATCH 2/7 drm/amd/amdgpu: enable mgcg on gfx 12.0.1
From: Kenneth Feng <[email protected]>
enable mgcg on gfx 12.0.1
--- drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c | 30 +++++++++++++++++++++++++- drivers/gpu/drm/amd/amdgpu/soc24.c | 6 ++---- 2 files changed, 31 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +29 -1
@@ -3729,7 +3729,35 @@ static void gfx_v12_0_update_coarse_grain_clock_gating(struct amdgpu_device *adestatic void gfx_v12_0_update_medium_grain_clock_gating (struct amdgpu_device *adev,bool enable) { -/* TODO */ +uint32_t data, def; +if (!(adev->cg_flags & (AMD_CG_SUPPORT_GFX_MGCG |AMD_CG_SUPPORT_GFX_MGLS ))) +return ; + +/* It is disabled by HW by default */ +if (enable) { +if (adev->cg_flags &AMD_CG_SUPPORT_GFX_MGCG ) { +/* 1 - RLC_CGTT_MGCG_OVERRIDE */ + def = data =RREG32_SOC15 (GC ,0 , regRLC_CGTT_MGCG_OVERRIDE); + + data &= ~(RLC_CGTT_MGCG_OVERRIDE__GRBM_CGTT_SCLK_OVERRIDE_MASK | +RLC_CGTT_MGCG_OVERRIDE__RLC_CGTT_SCLK_OVERRIDE_MASK | +RLC_CGTT_MGCG_OVERRIDE__GFXIP_MGCG_OVERRIDE_MASK ); + +if (def != data) +WREG32_SOC15 (GC ,0 , regRLC_CGTT_MGCG_OVERRIDE, data); + } + }else { +if (adev->cg_flags &AMD_CG_SUPPORT_GFX_MGCG ) { + def = data =RREG32_SOC15 (GC ,0 , regRLC_CGTT_MGCG_OVERRIDE); + + data |= (RLC_CGTT_MGCG_OVERRIDE__RLC_CGTT_SCLK_OVERRIDE_MASK | +RLC_CGTT_MGCG_OVERRIDE__GRBM_CGTT_SCLK_OVERRIDE_MASK | +RLC_CGTT_MGCG_OVERRIDE__GFXIP_MGCG_OVERRIDE_MASK ); + +if (def != data) +WREG32_SOC15 (GC ,0 , regRLC_CGTT_MGCG_OVERRIDE, data); + } + } } static void gfx_v12_0_update_repeater_fgcg(struct amdgpu_device *adev,
drivers/gpu/drm/amd/amdgpu/soc24.c +2 -4
@@ -402,14 +402,12 @@ static int soc24_common_early_init(void *handle)break ;case IP_VERSION (12 ,0 ,1 ): adev->cg_flags =AMD_CG_SUPPORT_GFX_CGCG | -AMD_CG_SUPPORT_GFX_CGLS ; +AMD_CG_SUPPORT_GFX_CGLS | +AMD_CG_SUPPORT_GFX_MGCG ; adev->pg_flags =AMD_PG_SUPPORT_VCN |AMD_PG_SUPPORT_JPEG |AMD_PG_SUPPORT_VCN_DPG ; adev->external_rev_id = adev->rev_id +0x50 ; - adev->cg_flags =AMD_CG_SUPPORT_GFX_CGCG | -AMD_CG_SUPPORT_GFX_CGLS ; -break ;default :/* FIXME: not supported yet */
Signature · 1 line
2.44.0
Alex Deucher
maintainerPATCH 3/7 drm/amd/amdgpu: enable 3D cgcg and 3D cgls
In reply to Alex DeucherFrom: Kenneth Feng <[email protected]>
enable 3D cgcg and 3D cgls on gc 12.0.1
--- drivers/gpu/drm/amd/amdgpu/soc24.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/soc24.c +3 -1
@@ -403,7 +403,9 @@ static int soc24_common_early_init(void *handle)case IP_VERSION (12 ,0 ,1 ): adev->cg_flags =AMD_CG_SUPPORT_GFX_CGCG |AMD_CG_SUPPORT_GFX_CGLS | -AMD_CG_SUPPORT_GFX_MGCG ; +AMD_CG_SUPPORT_GFX_MGCG | +AMD_CG_SUPPORT_GFX_3D_CGCG | +AMD_CG_SUPPORT_GFX_3D_CGLS ; adev->pg_flags =AMD_PG_SUPPORT_VCN |AMD_PG_SUPPORT_JPEG |AMD_PG_SUPPORT_VCN_DPG ;
Signature · 1 line
2.44.0
Alex Deucher
maintainerPATCH 4/7 drm/amd/amdgpu: enable perfcounter mgcg and repeater fgcg
In reply to Alex DeucherFrom: Kenneth Feng <[email protected]>
enable perfcounter mgcg and repeater fgcg on gc 12.0.1
--- drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c | 32 ++++++++++++++++++++++++-- drivers/gpu/drm/amd/amdgpu/soc24.c | 4 +++- 2 files changed, 33 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +30 -2
@@ -3532,7 +3532,20 @@ static void gfx_v12_0_unset_safe_mode(struct amdgpu_device *adev,static void gfx_v12_0_update_perf_clk (struct amdgpu_device *adev,bool enable) { -/* TODO */ +uint32_t def, data; + +if (!(adev->cg_flags &AMD_CG_SUPPORT_GFX_PERF_CLK )) +return ; + + def = data =RREG32_SOC15 (GC ,0 , regRLC_CGTT_MGCG_OVERRIDE); + +if (enable) + data &= ~RLC_CGTT_MGCG_OVERRIDE__PERFMON_CLOCK_STATE_MASK ; +else + data |=RLC_CGTT_MGCG_OVERRIDE__PERFMON_CLOCK_STATE_MASK ; + +if (def != data) +WREG32_SOC15 (GC ,0 , regRLC_CGTT_MGCG_OVERRIDE, data); } static void gfx_v12_0_update_spm_vmid(struct amdgpu_device *adev,
@@ -3763,7 +3776,22 @@ static void gfx_v12_0_update_medium_grain_clock_gating(struct amdgpu_device *adestatic void gfx_v12_0_update_repeater_fgcg (struct amdgpu_device *adev,bool enable) { -/* TODO */ +uint32_t def, data; + +if (!(adev->cg_flags &AMD_CG_SUPPORT_REPEATER_FGCG )) +return ; + + def = data =RREG32_SOC15 (GC ,0 , regRLC_CGTT_MGCG_OVERRIDE); + +if (enable) + data &= ~(RLC_CGTT_MGCG_OVERRIDE__GFXIP_REPEATER_FGCG_OVERRIDE_MASK | +RLC_CGTT_MGCG_OVERRIDE__RLC_REPEATER_FGCG_OVERRIDE_MASK ); +else + data |=RLC_CGTT_MGCG_OVERRIDE__GFXIP_REPEATER_FGCG_OVERRIDE_MASK | +RLC_CGTT_MGCG_OVERRIDE__RLC_REPEATER_FGCG_OVERRIDE_MASK ; + +if (def != data) +WREG32_SOC15 (GC ,0 , regRLC_CGTT_MGCG_OVERRIDE, data); } static void gfx_v12_0_update_sram_fgcg(struct amdgpu_device *adev,
drivers/gpu/drm/amd/amdgpu/soc24.c +3 -1
@@ -405,7 +405,9 @@ static int soc24_common_early_init(void *handle)AMD_CG_SUPPORT_GFX_CGLS |AMD_CG_SUPPORT_GFX_MGCG |AMD_CG_SUPPORT_GFX_3D_CGCG | -AMD_CG_SUPPORT_GFX_3D_CGLS ; +AMD_CG_SUPPORT_GFX_3D_CGLS | +AMD_CG_SUPPORT_REPEATER_FGCG | +AMD_CG_SUPPORT_GFX_PERF_CLK ; adev->pg_flags =AMD_PG_SUPPORT_VCN |AMD_PG_SUPPORT_JPEG |AMD_PG_SUPPORT_VCN_DPG ;
Signature · 1 line
2.44.0
Alex Deucher
maintainerPATCH 5/7 drm/amd/amdgpu: enable sram fgcg on gc 12.0.1
In reply to Alex DeucherFrom: Kenneth Feng <[email protected]>
enable sram fgcg on gc 12.0.1
--- drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c | 15 ++++++++++++++- drivers/gpu/drm/amd/amdgpu/soc24.c | 1 + 2 files changed, 15 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +14 -1
@@ -3797,7 +3797,20 @@ static void gfx_v12_0_update_repeater_fgcg(struct amdgpu_device *adev,static void gfx_v12_0_update_sram_fgcg (struct amdgpu_device *adev,bool enable) { -/* TODO */ +uint32_t def, data; + +if (!(adev->cg_flags &AMD_CG_SUPPORT_GFX_FGCG )) +return ; + + def = data =RREG32_SOC15 (GC ,0 , regRLC_CGTT_MGCG_OVERRIDE); + +if (enable) + data &= ~RLC_CGTT_MGCG_OVERRIDE__GFXIP_FGCG_OVERRIDE_MASK ; +else + data |=RLC_CGTT_MGCG_OVERRIDE__GFXIP_FGCG_OVERRIDE_MASK ; + +if (def != data) +WREG32_SOC15 (GC ,0 , regRLC_CGTT_MGCG_OVERRIDE, data); } static int gfx_v12_0_update_gfx_clock_gating(struct amdgpu_device *adev,
drivers/gpu/drm/amd/amdgpu/soc24.c +1 -0
@@ -407,6 +407,7 @@ static int soc24_common_early_init(void *handle)AMD_CG_SUPPORT_GFX_3D_CGCG |AMD_CG_SUPPORT_GFX_3D_CGLS |AMD_CG_SUPPORT_REPEATER_FGCG | +AMD_CG_SUPPORT_GFX_FGCG |AMD_CG_SUPPORT_GFX_PERF_CLK ; adev->pg_flags =AMD_PG_SUPPORT_VCN | AMD_PG_SUPPORT_JPEG |
Signature · 1 line
2.44.0
Alex Deucher
maintainerPATCH 6/7 drm/amdgpu: support cg state get for gfx v12
In reply to Alex DeucherFrom: Likun Gao <[email protected]>
Support to get clockgating state for gfx v12.
--- drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c | 38 +++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +37 -1
@@ -3863,7 +3863,43 @@ static int gfx_v12_0_set_clockgating_state(void *handle,static void gfx_v12_0_get_clockgating_state (void *handle,u64 *flags) { -/* TODO */ +struct amdgpu_device *adev = (struct amdgpu_device *)handle; +int data; + +/* AMD_CG_SUPPORT_GFX_MGCG */ + data =RREG32_SOC15 (GC ,0 , regRLC_CGTT_MGCG_OVERRIDE); +if (!(data &RLC_CGTT_MGCG_OVERRIDE__GFXIP_MGCG_OVERRIDE_MASK )) + *flags |=AMD_CG_SUPPORT_GFX_MGCG ; + +/* AMD_CG_SUPPORT_REPEATER_FGCG */ +if (!(data &RLC_CGTT_MGCG_OVERRIDE__GFXIP_REPEATER_FGCG_OVERRIDE_MASK )) + *flags |=AMD_CG_SUPPORT_REPEATER_FGCG ; + +/* AMD_CG_SUPPORT_GFX_FGCG */ +if (!(data &RLC_CGTT_MGCG_OVERRIDE__GFXIP_FGCG_OVERRIDE_MASK )) + *flags |=AMD_CG_SUPPORT_GFX_FGCG ; + +/* AMD_CG_SUPPORT_GFX_PERF_CLK */ +if (!(data &RLC_CGTT_MGCG_OVERRIDE__PERFMON_CLOCK_STATE_MASK )) + *flags |=AMD_CG_SUPPORT_GFX_PERF_CLK ; + +/* AMD_CG_SUPPORT_GFX_CGCG */ + data =RREG32_SOC15 (GC ,0 , regRLC_CGCG_CGLS_CTRL); +if (data &RLC_CGCG_CGLS_CTRL__CGCG_EN_MASK ) + *flags |=AMD_CG_SUPPORT_GFX_CGCG ; + +/* AMD_CG_SUPPORT_GFX_CGLS */ +if (data &RLC_CGCG_CGLS_CTRL__CGLS_EN_MASK ) + *flags |=AMD_CG_SUPPORT_GFX_CGLS ; + +/* AMD_CG_SUPPORT_GFX_3D_CGCG */ + data =RREG32_SOC15 (GC ,0 , regRLC_CGCG_CGLS_CTRL_3D); +if (data &RLC_CGCG_CGLS_CTRL_3D__CGCG_EN_MASK ) + *flags |=AMD_CG_SUPPORT_GFX_3D_CGCG ; + +/* AMD_CG_SUPPORT_GFX_3D_CGLS */ +if (data &RLC_CGCG_CGLS_CTRL_3D__CGLS_EN_MASK ) + *flags |=AMD_CG_SUPPORT_GFX_3D_CGLS ; }static u64 gfx_v12_0_ring_get_rptr_gfx (struct amdgpu_ring *ring)
Signature · 1 line
2.44.0
Alex Deucher
maintainerPATCH 7/7 drm/amd/amdgpu: enable gfxoff on gc 12.0.1
In reply to Alex DeucherFrom: Kenneth Feng <[email protected]>
Enable gfxoff on gc 12.0.1
--- drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c | 14 +++++++++++++- drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0.c | 1 + 2 files changed, 14 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +13 -1
@@ -3606,7 +3606,19 @@ static void gfx_v12_cntl_pg(struct amdgpu_device *adev, bool enable)static int gfx_v12_0_set_powergating_state (void *handle,enum amd_powergating_state state) { -/* TODO */ +struct amdgpu_device *adev = (struct amdgpu_device *)handle; +bool enable = (state ==AMD_PG_STATE_GATE ); + +if (amdgpu_sriov_vf (adev)) +return 0 ; + +switch (amdgpu_ip_version (adev,GC_HWIP ,0 )) { +case IP_VERSION (12 ,0 ,1 ): +amdgpu_gfx_off_ctrl (adev, enable); +break ; +default : +break ; + }return 0 ; }
drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0.c +1 -0
@@ -758,6 +758,7 @@ int smu_v14_0_gfx_off_control(struct smu_context *smu, bool enable)case IP_VERSION (14 ,0 ,0 ):case IP_VERSION (14 ,0 ,1 ):case IP_VERSION (14 ,0 ,2 ): +case IP_VERSION (14 ,0 ,3 ):if (!(adev->pm.pp_feature &PP_GFXOFF_MASK ))return 0 ;if (enable)
Signature · 1 line
2.44.0