All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/7] drm/amd/amdgpu: enable cgcg and cgls
@ 2024-04-30 20:33 Alex Deucher
  2024-04-30 20:34 ` [PATCH 2/7] drm/amd/amdgpu: enable mgcg on gfx 12.0.1 Alex Deucher
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Alex Deucher @ 2024-04-30 20:33 UTC (permalink / raw
  To: amd-gfx; +Cc: Kenneth Feng, Likun Gao, Alex Deucher

From: Kenneth Feng <kenneth.feng@amd.com>

enable cgcg and cgls on gc 12.0.1

Signed-off-by: Kenneth Feng <kenneth.feng@amd.com>
Reviewed-by: Likun Gao <Likun.Gao@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/soc24.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/soc24.c b/drivers/gpu/drm/amd/amdgpu/soc24.c
index 0979dffe37424..143329ed2c9a1 100644
--- a/drivers/gpu/drm/amd/amdgpu/soc24.c
+++ b/drivers/gpu/drm/amd/amdgpu/soc24.c
@@ -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;
-- 
2.44.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/7] drm/amd/amdgpu: enable mgcg on gfx 12.0.1
  2024-04-30 20:33 [PATCH 1/7] drm/amd/amdgpu: enable cgcg and cgls Alex Deucher
@ 2024-04-30 20:34 ` Alex Deucher
  2024-04-30 20:34 ` [PATCH 3/7] drm/amd/amdgpu: enable 3D cgcg and 3D cgls Alex Deucher
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Alex Deucher @ 2024-04-30 20:34 UTC (permalink / raw
  To: amd-gfx; +Cc: Kenneth Feng, Hawking Zhang, Alex Deucher

From: Kenneth Feng <kenneth.feng@amd.com>

enable mgcg on gfx 12.0.1

Signed-off-by: Kenneth Feng <kenneth.feng@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 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(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c
index 3e2a6806f1c19..f7c5b10c753dd 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c
@@ -3729,7 +3729,35 @@ static void gfx_v12_0_update_coarse_grain_clock_gating(struct amdgpu_device *ade
 static 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,
diff --git a/drivers/gpu/drm/amd/amdgpu/soc24.c b/drivers/gpu/drm/amd/amdgpu/soc24.c
index 143329ed2c9a1..30e166004e39e 100644
--- a/drivers/gpu/drm/amd/amdgpu/soc24.c
+++ b/drivers/gpu/drm/amd/amdgpu/soc24.c
@@ -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 */
-- 
2.44.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 3/7] drm/amd/amdgpu: enable 3D cgcg and 3D cgls
  2024-04-30 20:33 [PATCH 1/7] drm/amd/amdgpu: enable cgcg and cgls Alex Deucher
  2024-04-30 20:34 ` [PATCH 2/7] drm/amd/amdgpu: enable mgcg on gfx 12.0.1 Alex Deucher
@ 2024-04-30 20:34 ` Alex Deucher
  2024-04-30 20:34 ` [PATCH 4/7] drm/amd/amdgpu: enable perfcounter mgcg and repeater fgcg Alex Deucher
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Alex Deucher @ 2024-04-30 20:34 UTC (permalink / raw
  To: amd-gfx; +Cc: Kenneth Feng, Likun Gao, Alex Deucher

From: Kenneth Feng <kenneth.feng@amd.com>

enable 3D cgcg and 3D cgls on gc 12.0.1

Signed-off-by: Kenneth Feng <kenneth.feng@amd.com>
Reviewed-by: Likun Gao <Likun.Gao@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/soc24.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/soc24.c b/drivers/gpu/drm/amd/amdgpu/soc24.c
index 30e166004e39e..780e54b74979a 100644
--- a/drivers/gpu/drm/amd/amdgpu/soc24.c
+++ b/drivers/gpu/drm/amd/amdgpu/soc24.c
@@ -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;
-- 
2.44.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 4/7] drm/amd/amdgpu: enable perfcounter mgcg and repeater fgcg
  2024-04-30 20:33 [PATCH 1/7] drm/amd/amdgpu: enable cgcg and cgls Alex Deucher
  2024-04-30 20:34 ` [PATCH 2/7] drm/amd/amdgpu: enable mgcg on gfx 12.0.1 Alex Deucher
  2024-04-30 20:34 ` [PATCH 3/7] drm/amd/amdgpu: enable 3D cgcg and 3D cgls Alex Deucher
@ 2024-04-30 20:34 ` Alex Deucher
  2024-04-30 20:34 ` [PATCH 5/7] drm/amd/amdgpu: enable sram fgcg on gc 12.0.1 Alex Deucher
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Alex Deucher @ 2024-04-30 20:34 UTC (permalink / raw
  To: amd-gfx; +Cc: Kenneth Feng, Likun Gao, Alex Deucher

From: Kenneth Feng <kenneth.feng@amd.com>

enable perfcounter mgcg and repeater fgcg on gc 12.0.1

Signed-off-by: Kenneth Feng <kenneth.feng@amd.com>
Reviewed-by: Likun Gao <Likun.Gao@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 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(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c
index f7c5b10c753dd..9aeced9d31616 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c
@@ -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 *ade
 static 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,
diff --git a/drivers/gpu/drm/amd/amdgpu/soc24.c b/drivers/gpu/drm/amd/amdgpu/soc24.c
index 780e54b74979a..701056a865a4c 100644
--- a/drivers/gpu/drm/amd/amdgpu/soc24.c
+++ b/drivers/gpu/drm/amd/amdgpu/soc24.c
@@ -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;
-- 
2.44.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 5/7] drm/amd/amdgpu: enable sram fgcg on gc 12.0.1
  2024-04-30 20:33 [PATCH 1/7] drm/amd/amdgpu: enable cgcg and cgls Alex Deucher
                   ` (2 preceding siblings ...)
  2024-04-30 20:34 ` [PATCH 4/7] drm/amd/amdgpu: enable perfcounter mgcg and repeater fgcg Alex Deucher
@ 2024-04-30 20:34 ` Alex Deucher
  2024-04-30 20:34 ` [PATCH 6/7] drm/amdgpu: support cg state get for gfx v12 Alex Deucher
  2024-04-30 20:34 ` [PATCH 7/7] drm/amd/amdgpu: enable gfxoff on gc 12.0.1 Alex Deucher
  5 siblings, 0 replies; 7+ messages in thread
From: Alex Deucher @ 2024-04-30 20:34 UTC (permalink / raw
  To: amd-gfx; +Cc: Kenneth Feng, Likun Gao, Alex Deucher

From: Kenneth Feng <kenneth.feng@amd.com>

enable sram fgcg on gc 12.0.1

Signed-off-by: Kenneth Feng <kenneth.feng@amd.com>
Reviewed-by: Likun Gao <Likun.Gao@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 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(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c
index 9aeced9d31616..8d4b234bd287e 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c
@@ -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,
diff --git a/drivers/gpu/drm/amd/amdgpu/soc24.c b/drivers/gpu/drm/amd/amdgpu/soc24.c
index 701056a865a4c..174126bc5f602 100644
--- a/drivers/gpu/drm/amd/amdgpu/soc24.c
+++ b/drivers/gpu/drm/amd/amdgpu/soc24.c
@@ -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 |
-- 
2.44.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 6/7] drm/amdgpu: support cg state get for gfx v12
  2024-04-30 20:33 [PATCH 1/7] drm/amd/amdgpu: enable cgcg and cgls Alex Deucher
                   ` (3 preceding siblings ...)
  2024-04-30 20:34 ` [PATCH 5/7] drm/amd/amdgpu: enable sram fgcg on gc 12.0.1 Alex Deucher
@ 2024-04-30 20:34 ` Alex Deucher
  2024-04-30 20:34 ` [PATCH 7/7] drm/amd/amdgpu: enable gfxoff on gc 12.0.1 Alex Deucher
  5 siblings, 0 replies; 7+ messages in thread
From: Alex Deucher @ 2024-04-30 20:34 UTC (permalink / raw
  To: amd-gfx; +Cc: Likun Gao, Hawking Zhang, Alex Deucher

From: Likun Gao <Likun.Gao@amd.com>

Support to get clockgating state for gfx v12.

Signed-off-by: Likun Gao <Likun.Gao@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c | 38 +++++++++++++++++++++++++-
 1 file changed, 37 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c
index 8d4b234bd287e..08f866c5ff432 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c
@@ -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)
-- 
2.44.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 7/7] drm/amd/amdgpu: enable gfxoff on gc 12.0.1
  2024-04-30 20:33 [PATCH 1/7] drm/amd/amdgpu: enable cgcg and cgls Alex Deucher
                   ` (4 preceding siblings ...)
  2024-04-30 20:34 ` [PATCH 6/7] drm/amdgpu: support cg state get for gfx v12 Alex Deucher
@ 2024-04-30 20:34 ` Alex Deucher
  5 siblings, 0 replies; 7+ messages in thread
From: Alex Deucher @ 2024-04-30 20:34 UTC (permalink / raw
  To: amd-gfx; +Cc: Kenneth Feng, Jack Gui, Alex Deucher

From: Kenneth Feng <kenneth.feng@amd.com>

Enable gfxoff on gc 12.0.1

Signed-off-by: Kenneth Feng <kenneth.feng@amd.com>
Reviewed-by: Jack Gui <Jack.Gui@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 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(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c
index 08f866c5ff432..d9e975a9825d4 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c
@@ -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;
 }
diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0.c b/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0.c
index 68b9bf822e8d8..fe6834f1648b9 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0.c
@@ -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)
-- 
2.44.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-04-30 20:34 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-30 20:33 [PATCH 1/7] drm/amd/amdgpu: enable cgcg and cgls Alex Deucher
2024-04-30 20:34 ` [PATCH 2/7] drm/amd/amdgpu: enable mgcg on gfx 12.0.1 Alex Deucher
2024-04-30 20:34 ` [PATCH 3/7] drm/amd/amdgpu: enable 3D cgcg and 3D cgls Alex Deucher
2024-04-30 20:34 ` [PATCH 4/7] drm/amd/amdgpu: enable perfcounter mgcg and repeater fgcg Alex Deucher
2024-04-30 20:34 ` [PATCH 5/7] drm/amd/amdgpu: enable sram fgcg on gc 12.0.1 Alex Deucher
2024-04-30 20:34 ` [PATCH 6/7] drm/amdgpu: support cg state get for gfx v12 Alex Deucher
2024-04-30 20:34 ` [PATCH 7/7] drm/amd/amdgpu: enable gfxoff on gc 12.0.1 Alex Deucher

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.