Skip to contentSkip to conversation

drm/amdgpu: refine pg code for gfx_v8.

PATCH In review Rex Zhu 4 participants 6 messages Dec 1, 2016 – Dec 7, 2016 4 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

Rex Zhu

author
#0 lore raw

PATCH 1/1 drm/amdgpu: refine pg code for gfx_v8.

1. bit CP_PG_DISABLE was reversed.
2. load RLC_SRM_INDEX_CNTL_ADDR/DATA_x pairs
with valid addr/data.
3. always init gfx pg.
4. delete repeated check for pg mask.

Change-Id I9fcc8d1f79f5fa1803cb2625aa292188a656ae6b
---
 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 85 +++++++++++++++--------------------
 1 file changed, 37 insertions(+), 48 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +37 -48
index c02ae07..fee8c2a 100644
@@ -3948,8 +3948,10 @@ static int gfx_v8_0_init_save_restore_list(struct amdgpu_device *adev)
 	temp = mmRLC_SRM_INDEX_CNTL_ADDR_0;
 	data = mmRLC_SRM_INDEX_CNTL_DATA_0;
 	for (i = 0; i < sizeof(unique_indices) / sizeof(int); i++) {
-		amdgpu_mm_wreg(adev, temp + i, unique_indices[i] & 0x3FFFF, false);
-		amdgpu_mm_wreg(adev, data + i, unique_indices[i] >> 20, false);
+		if (unique_indices[i] != 0) {
+			amdgpu_mm_wreg(adev, temp + i, unique_indices[i] & 0x3FFFF, false);
+			amdgpu_mm_wreg(adev, data + i, unique_indices[i] >> 20, false);
+		}
 	}
 	kfree(register_list_format);
 
@@ -3965,20 +3967,16 @@ static void gfx_v8_0_init_power_gating(struct amdgpu_device *adev)
 {
 	uint32_t data;
 
-	if (adev->pg_flags & (AMD_PG_SUPPORT_GFX_PG |
-			      AMD_PG_SUPPORT_GFX_SMG |
-			      AMD_PG_SUPPORT_GFX_DMG)) {
-		WREG32_FIELD(CP_RB_WPTR_POLL_CNTL, IDLE_POLL_COUNT, 0x60);
+	WREG32_FIELD(CP_RB_WPTR_POLL_CNTL, IDLE_POLL_COUNT, 0x60);
 
-		data = REG_SET_FIELD(0, RLC_PG_DELAY, POWER_UP_DELAY, 0x10);
-		data = REG_SET_FIELD(data, RLC_PG_DELAY, POWER_DOWN_DELAY, 0x10);
-		data = REG_SET_FIELD(data, RLC_PG_DELAY, CMD_PROPAGATE_DELAY, 0x10);
-		data = REG_SET_FIELD(data, RLC_PG_DELAY, MEM_SLEEP_DELAY, 0x10);
-		WREG32(mmRLC_PG_DELAY, data);
+	data = REG_SET_FIELD(0, RLC_PG_DELAY, POWER_UP_DELAY, 0x10);
+	data = REG_SET_FIELD(data, RLC_PG_DELAY, POWER_DOWN_DELAY, 0x10);
+	data = REG_SET_FIELD(data, RLC_PG_DELAY, CMD_PROPAGATE_DELAY, 0x10);
+	data = REG_SET_FIELD(data, RLC_PG_DELAY, MEM_SLEEP_DELAY, 0x10);
+	WREG32(mmRLC_PG_DELAY, data);
 
-		WREG32_FIELD(RLC_PG_DELAY_2, SERDES_CMD_DELAY, 0x3);
-		WREG32_FIELD(RLC_AUTO_PG_CTRL, GRBM_REG_SAVE_GFX_IDLE_THRESHOLD, 0x55f0);
-	}
+	WREG32_FIELD(RLC_PG_DELAY_2, SERDES_CMD_DELAY, 0x3);
+	WREG32_FIELD(RLC_AUTO_PG_CTRL, GRBM_REG_SAVE_GFX_IDLE_THRESHOLD, 0x55f0);
 }
 
 static void cz_enable_sck_slow_down_on_power_up(struct amdgpu_device *adev,
@@ -3995,41 +3993,35 @@ static void cz_enable_sck_slow_down_on_power_down(struct amdgpu_device *adev,
 
 static void cz_enable_cp_power_gating(struct amdgpu_device *adev, bool enable)
 {
-	WREG32_FIELD(RLC_PG_CNTL, CP_PG_DISABLE, enable ? 1 : 0);
+	WREG32_FIELD(RLC_PG_CNTL, CP_PG_DISABLE, enable ? 0 : 1);
 }
 
 static void gfx_v8_0_init_pg(struct amdgpu_device *adev)
 {
-	if (adev->pg_flags & (AMD_PG_SUPPORT_GFX_PG |
-			      AMD_PG_SUPPORT_GFX_SMG |
-			      AMD_PG_SUPPORT_GFX_DMG |
-			      AMD_PG_SUPPORT_CP |
-			      AMD_PG_SUPPORT_GDS |
-			      AMD_PG_SUPPORT_RLC_SMU_HS)) {
-		gfx_v8_0_init_csb(adev);
-		gfx_v8_0_init_save_restore_list(adev);
-		gfx_v8_0_enable_save_restore_machine(adev);
-
-		if ((adev->asic_type == CHIP_CARRIZO) ||
-		    (adev->asic_type == CHIP_STONEY)) {
-			WREG32(mmRLC_JUMP_TABLE_RESTORE, adev->gfx.rlc.cp_table_gpu_addr >> 8);
-			gfx_v8_0_init_power_gating(adev);
-			WREG32(mmRLC_PG_ALWAYS_ON_CU_MASK, adev->gfx.cu_info.ao_cu_mask);
-			if (adev->pg_flags & AMD_PG_SUPPORT_RLC_SMU_HS) {
-				cz_enable_sck_slow_down_on_power_up(adev, true);
-				cz_enable_sck_slow_down_on_power_down(adev, true);
-			} else {
-				cz_enable_sck_slow_down_on_power_up(adev, false);
-				cz_enable_sck_slow_down_on_power_down(adev, false);
-			}
-			if (adev->pg_flags & AMD_PG_SUPPORT_CP)
-				cz_enable_cp_power_gating(adev, true);
-			else
-				cz_enable_cp_power_gating(adev, false);
-		} else if (adev->asic_type == CHIP_POLARIS11) {
-			gfx_v8_0_init_power_gating(adev);
+	gfx_v8_0_init_csb(adev);
+	gfx_v8_0_init_save_restore_list(adev);
+	gfx_v8_0_enable_save_restore_machine(adev);
+
+	if ((adev->asic_type == CHIP_CARRIZO) ||
+	    (adev->asic_type == CHIP_STONEY)) {
+		WREG32(mmRLC_JUMP_TABLE_RESTORE, adev->gfx.rlc.cp_table_gpu_addr >> 8);
+		gfx_v8_0_init_power_gating(adev);
+		WREG32(mmRLC_PG_ALWAYS_ON_CU_MASK, adev->gfx.cu_info.ao_cu_mask);
+		if (adev->pg_flags & AMD_PG_SUPPORT_RLC_SMU_HS) {
+			cz_enable_sck_slow_down_on_power_up(adev, true);
+			cz_enable_sck_slow_down_on_power_down(adev, true);
+		} else {
+			cz_enable_sck_slow_down_on_power_up(adev, false);
+			cz_enable_sck_slow_down_on_power_down(adev, false);
 		}
+		if (adev->pg_flags & AMD_PG_SUPPORT_CP)
+			cz_enable_cp_power_gating(adev, true);
+		else
+			cz_enable_cp_power_gating(adev, false);
+	} else if (adev->asic_type == CHIP_POLARIS11) {
+		gfx_v8_0_init_power_gating(adev);
 	}
+
 }
 
 static void gfx_v8_0_rlc_stop(struct amdgpu_device *adev)
@@ -5570,14 +5562,11 @@ static int gfx_v8_0_set_powergating_state(void *handle,
 	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 	bool enable = (state == AMD_PG_STATE_GATE) ? true : false;
 
-	if (!(adev->pg_flags & AMD_PG_SUPPORT_GFX_PG))
-		return 0;
-
 	switch (adev->asic_type) {
 	case CHIP_CARRIZO:
 	case CHIP_STONEY:
-		if (adev->pg_flags & AMD_PG_SUPPORT_GFX_PG)
-			cz_update_gfx_cg_power_gating(adev, enable);
+
+		cz_update_gfx_cg_power_gating(adev, enable);
 
 		if ((adev->pg_flags & AMD_PG_SUPPORT_GFX_SMG) && enable)
 			gfx_v8_0_enable_gfx_static_mg_power_gating(adev, true);
Signature · 6 lines
1.9.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 1480580677-32303-1-git-send-email-Rex.Zhu-5C7GfCeVMHo@public.gmane.org

#2 lore raw

Hi Rex,

Given how often we diagnose problems by disabling PG/CG I'd have to offer my NAK to this patch since it prevents me from disabling PG via the command line.

Any reason you want to make it permanently enabled?

Tom

________________________________
From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org> on behalf of Rex Zhu <[email protected]>
Sent: Thursday, December 1, 2016 03:24
To: [email protected]
Cc: Zhu, Rex
Subject: [PATCH] drm/amdgpu: refine pg code for gfx_v8.

1. bit CP_PG_DISABLE was reversed.
2. load RLC_SRM_INDEX_CNTL_ADDR/DATA_x pairs
with valid addr/data.
3. always init gfx pg.
4. delete repeated check for pg mask.

Change-Id I9fcc8d1f79f5fa1803cb2625aa292188a656ae6b
---
 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 85 +++++++++++++++--------------------
 1 file changed, 37 insertions(+), 48 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +37 -48
index c02ae07..fee8c2a 100644
@@ -3948,8 +3948,10 @@ static int gfx_v8_0_init_save_restore_list(struct amdgpu_device *adev)
         temp = mmRLC_SRM_INDEX_CNTL_ADDR_0;
         data = mmRLC_SRM_INDEX_CNTL_DATA_0;
         for (i = 0; i < sizeof(unique_indices) / sizeof(int); i++) {
-               amdgpu_mm_wreg(adev, temp + i, unique_indices[i] & 0x3FFFF, false);
-               amdgpu_mm_wreg(adev, data + i, unique_indices[i] >> 20, false);
+               if (unique_indices[i] != 0) {
+                       amdgpu_mm_wreg(adev, temp + i, unique_indices[i] & 0x3FFFF, false);
+                       amdgpu_mm_wreg(adev, data + i, unique_indices[i] >> 20, false);
+               }
         }
         kfree(register_list_format);
 
@@ -3965,20 +3967,16 @@ static void gfx_v8_0_init_power_gating(struct amdgpu_device *adev)
 {
         uint32_t data;
 
-       if (adev->pg_flags & (AMD_PG_SUPPORT_GFX_PG |
-                             AMD_PG_SUPPORT_GFX_SMG |
-                             AMD_PG_SUPPORT_GFX_DMG)) {
-               WREG32_FIELD(CP_RB_WPTR_POLL_CNTL, IDLE_POLL_COUNT, 0x60);
+       WREG32_FIELD(CP_RB_WPTR_POLL_CNTL, IDLE_POLL_COUNT, 0x60);
 
-               data = REG_SET_FIELD(0, RLC_PG_DELAY, POWER_UP_DELAY, 0x10);
-               data = REG_SET_FIELD(data, RLC_PG_DELAY, POWER_DOWN_DELAY, 0x10);
-               data = REG_SET_FIELD(data, RLC_PG_DELAY, CMD_PROPAGATE_DELAY, 0x10);
-               data = REG_SET_FIELD(data, RLC_PG_DELAY, MEM_SLEEP_DELAY, 0x10);
-               WREG32(mmRLC_PG_DELAY, data);
+       data = REG_SET_FIELD(0, RLC_PG_DELAY, POWER_UP_DELAY, 0x10);
+       data = REG_SET_FIELD(data, RLC_PG_DELAY, POWER_DOWN_DELAY, 0x10);
+       data = REG_SET_FIELD(data, RLC_PG_DELAY, CMD_PROPAGATE_DELAY, 0x10);
+       data = REG_SET_FIELD(data, RLC_PG_DELAY, MEM_SLEEP_DELAY, 0x10);
+       WREG32(mmRLC_PG_DELAY, data);
 
-               WREG32_FIELD(RLC_PG_DELAY_2, SERDES_CMD_DELAY, 0x3);
-               WREG32_FIELD(RLC_AUTO_PG_CTRL, GRBM_REG_SAVE_GFX_IDLE_THRESHOLD, 0x55f0);
-       }
+       WREG32_FIELD(RLC_PG_DELAY_2, SERDES_CMD_DELAY, 0x3);
+       WREG32_FIELD(RLC_AUTO_PG_CTRL, GRBM_REG_SAVE_GFX_IDLE_THRESHOLD, 0x55f0);
 }
 
 static void cz_enable_sck_slow_down_on_power_up(struct amdgpu_device *adev,
@@ -3995,41 +3993,35 @@ static void cz_enable_sck_slow_down_on_power_down(struct amdgpu_device *adev,
 
 static void cz_enable_cp_power_gating(struct amdgpu_device *adev, bool enable)
 {
-       WREG32_FIELD(RLC_PG_CNTL, CP_PG_DISABLE, enable ? 1 : 0);
+       WREG32_FIELD(RLC_PG_CNTL, CP_PG_DISABLE, enable ? 0 : 1);
 }
 
 static void gfx_v8_0_init_pg(struct amdgpu_device *adev)
 {
-       if (adev->pg_flags & (AMD_PG_SUPPORT_GFX_PG |
-                             AMD_PG_SUPPORT_GFX_SMG |
-                             AMD_PG_SUPPORT_GFX_DMG |
-                             AMD_PG_SUPPORT_CP |
-                             AMD_PG_SUPPORT_GDS |
-                             AMD_PG_SUPPORT_RLC_SMU_HS)) {
-               gfx_v8_0_init_csb(adev);
-               gfx_v8_0_init_save_restore_list(adev);
-               gfx_v8_0_enable_save_restore_machine(adev);
-
-               if ((adev->asic_type == CHIP_CARRIZO) ||
-                   (adev->asic_type == CHIP_STONEY)) {
-                       WREG32(mmRLC_JUMP_TABLE_RESTORE, adev->gfx.rlc.cp_table_gpu_addr >> 8);
-                       gfx_v8_0_init_power_gating(adev);
-                       WREG32(mmRLC_PG_ALWAYS_ON_CU_MASK, adev->gfx.cu_info.ao_cu_mask);
-                       if (adev->pg_flags & AMD_PG_SUPPORT_RLC_SMU_HS) {
-                               cz_enable_sck_slow_down_on_power_up(adev, true);
-                               cz_enable_sck_slow_down_on_power_down(adev, true);
-                       } else {
-                               cz_enable_sck_slow_down_on_power_up(adev, false);
-                               cz_enable_sck_slow_down_on_power_down(adev, false);
-                       }
-                       if (adev->pg_flags & AMD_PG_SUPPORT_CP)
-                               cz_enable_cp_power_gating(adev, true);
-                       else
-                               cz_enable_cp_power_gating(adev, false);
-               } else if (adev->asic_type == CHIP_POLARIS11) {
-                       gfx_v8_0_init_power_gating(adev);
+       gfx_v8_0_init_csb(adev);
+       gfx_v8_0_init_save_restore_list(adev);
+       gfx_v8_0_enable_save_restore_machine(adev);
+
+       if ((adev->asic_type == CHIP_CARRIZO) ||
+           (adev->asic_type == CHIP_STONEY)) {
+               WREG32(mmRLC_JUMP_TABLE_RESTORE, adev->gfx.rlc.cp_table_gpu_addr >> 8);
+               gfx_v8_0_init_power_gating(adev);
+               WREG32(mmRLC_PG_ALWAYS_ON_CU_MASK, adev->gfx.cu_info.ao_cu_mask);
+               if (adev->pg_flags & AMD_PG_SUPPORT_RLC_SMU_HS) {
+                       cz_enable_sck_slow_down_on_power_up(adev, true);
+                       cz_enable_sck_slow_down_on_power_down(adev, true);
+               } else {
+                       cz_enable_sck_slow_down_on_power_up(adev, false);
+                       cz_enable_sck_slow_down_on_power_down(adev, false);
                 }
+               if (adev->pg_flags & AMD_PG_SUPPORT_CP)
+                       cz_enable_cp_power_gating(adev, true);
+               else
+                       cz_enable_cp_power_gating(adev, false);
+       } else if (adev->asic_type == CHIP_POLARIS11) {
+               gfx_v8_0_init_power_gating(adev);
         }
+
 }
 
 static void gfx_v8_0_rlc_stop(struct amdgpu_device *adev)
@@ -5570,14 +5562,11 @@ static int gfx_v8_0_set_powergating_state(void *handle,
         struct amdgpu_device *adev = (struct amdgpu_device *)handle;
         bool enable = (state == AMD_PG_STATE_GATE) ? true : false;
 
-       if (!(adev->pg_flags & AMD_PG_SUPPORT_GFX_PG))
-               return 0;
-
         switch (adev->asic_type) {
         case CHIP_CARRIZO:
         case CHIP_STONEY:
-               if (adev->pg_flags & AMD_PG_SUPPORT_GFX_PG)
-                       cz_update_gfx_cg_power_gating(adev, enable);
+
+               cz_update_gfx_cg_power_gating(adev, enable);
 
                 if ((adev->pg_flags & AMD_PG_SUPPORT_GFX_SMG) && enable)
                         gfx_v8_0_enable_gfx_static_mg_power_gating(adev, true);

--
1.9.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
amd-gfx Info Page - lists.freedesktop.org<https://lists.freedesktop.org/mailman/listinfo/amd-gfx>
lists.freedesktop.org
To see the collection of prior postings to the list, visit the amd-gfx Archives. Using amd-gfx: To post a message to all the list members, send email ...

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#3 lore raw
In reply to a message not in the archive
Quoted 1 line · Rex Zhu

1. bit CP_PG_DISABLE was reversed.

Please split this out as a separate patch. Also, with this fixed, we should be able to enable the AMD_PG_SUPPORT_CP flag for CZ and ST.

Quoted 2 lines

2. load RLC_SRM_INDEX_CNTL_ADDR/DATA_x pairs
with valid addr/data.

Please split this out as a separate patch.

Quoted 1 line

3. always init gfx pg.

I don't think we want to do this. We need to be able to disable various pg features for debugging. Also some asics don't support gfx pg (e.g., fiji), so we don't want to enable it on those asics.

Quoted 139 lines

4. delete repeated check for pg mask.

Change-Id I9fcc8d1f79f5fa1803cb2625aa292188a656ae6b
---
 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 85 +++++++++++++++--------------------
 1 file changed, 37 insertions(+), 48 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +37 -49
index c02ae07..fee8c2a 100644
@@ -3948,8 +3948,10 @@ static int gfx_v8_0_init_save_restore_list(struct amdgpu_device *adev)
        temp = mmRLC_SRM_INDEX_CNTL_ADDR_0;
        data = mmRLC_SRM_INDEX_CNTL_DATA_0;
        for (i = 0; i < sizeof(unique_indices) / sizeof(int); i++) {
-               amdgpu_mm_wreg(adev, temp + i, unique_indices[i] & 0x3FFFF, false);
-               amdgpu_mm_wreg(adev, data + i, unique_indices[i] >> 20, false);
+               if (unique_indices[i] != 0) {
+                       amdgpu_mm_wreg(adev, temp + i, unique_indices[i] & 0x3FFFF, false);
+                       amdgpu_mm_wreg(adev, data + i, unique_indices[i] >> 20, false);
+               }
        }
        kfree(register_list_format);
 
@@ -3965,20 +3967,16 @@ static void gfx_v8_0_init_power_gating(struct amdgpu_device *adev)
 {
        uint32_t data;
 
-       if (adev->pg_flags & (AMD_PG_SUPPORT_GFX_PG |
-                             AMD_PG_SUPPORT_GFX_SMG |
-                             AMD_PG_SUPPORT_GFX_DMG)) {
-               WREG32_FIELD(CP_RB_WPTR_POLL_CNTL, IDLE_POLL_COUNT, 0x60);
+       WREG32_FIELD(CP_RB_WPTR_POLL_CNTL, IDLE_POLL_COUNT, 0x60);
 
-               data = REG_SET_FIELD(0, RLC_PG_DELAY, POWER_UP_DELAY, 0x10);
-               data = REG_SET_FIELD(data, RLC_PG_DELAY, POWER_DOWN_DELAY, 0x10);
-               data = REG_SET_FIELD(data, RLC_PG_DELAY, CMD_PROPAGATE_DELAY, 0x10);
-               data = REG_SET_FIELD(data, RLC_PG_DELAY, MEM_SLEEP_DELAY, 0x10);
-               WREG32(mmRLC_PG_DELAY, data);
+       data = REG_SET_FIELD(0, RLC_PG_DELAY, POWER_UP_DELAY, 0x10);
+       data = REG_SET_FIELD(data, RLC_PG_DELAY, POWER_DOWN_DELAY, 0x10);
+       data = REG_SET_FIELD(data, RLC_PG_DELAY, CMD_PROPAGATE_DELAY, 0x10);
+       data = REG_SET_FIELD(data, RLC_PG_DELAY, MEM_SLEEP_DELAY, 0x10);
+       WREG32(mmRLC_PG_DELAY, data);
 
-               WREG32_FIELD(RLC_PG_DELAY_2, SERDES_CMD_DELAY, 0x3);
-               WREG32_FIELD(RLC_AUTO_PG_CTRL, GRBM_REG_SAVE_GFX_IDLE_THRESHOLD, 0x55f0);
-       }
+       WREG32_FIELD(RLC_PG_DELAY_2, SERDES_CMD_DELAY, 0x3);
+       WREG32_FIELD(RLC_AUTO_PG_CTRL, GRBM_REG_SAVE_GFX_IDLE_THRESHOLD, 0x55f0);
 }
 
 static void cz_enable_sck_slow_down_on_power_up(struct amdgpu_device *adev,
@@ -3995,41 +3993,35 @@ static void cz_enable_sck_slow_down_on_power_down(struct amdgpu_device *adev,
 
 static void cz_enable_cp_power_gating(struct amdgpu_device *adev, bool enable)
 {
-       WREG32_FIELD(RLC_PG_CNTL, CP_PG_DISABLE, enable ? 1 : 0);
+       WREG32_FIELD(RLC_PG_CNTL, CP_PG_DISABLE, enable ? 0 : 1);
 }
 
 static void gfx_v8_0_init_pg(struct amdgpu_device *adev)
 {
-       if (adev->pg_flags & (AMD_PG_SUPPORT_GFX_PG |
-                             AMD_PG_SUPPORT_GFX_SMG |
-                             AMD_PG_SUPPORT_GFX_DMG |
-                             AMD_PG_SUPPORT_CP |
-                             AMD_PG_SUPPORT_GDS |
-                             AMD_PG_SUPPORT_RLC_SMU_HS)) {
-               gfx_v8_0_init_csb(adev);
-               gfx_v8_0_init_save_restore_list(adev);
-               gfx_v8_0_enable_save_restore_machine(adev);
-
-               if ((adev->asic_type == CHIP_CARRIZO) ||
-                   (adev->asic_type == CHIP_STONEY)) {
-                       WREG32(mmRLC_JUMP_TABLE_RESTORE, adev->gfx.rlc.cp_table_gpu_addr >> 8);
-                       gfx_v8_0_init_power_gating(adev);
-                       WREG32(mmRLC_PG_ALWAYS_ON_CU_MASK, adev->gfx.cu_info.ao_cu_mask);
-                       if (adev->pg_flags & AMD_PG_SUPPORT_RLC_SMU_HS) {
-                               cz_enable_sck_slow_down_on_power_up(adev, true);
-                               cz_enable_sck_slow_down_on_power_down(adev, true);
-                       } else {
-                               cz_enable_sck_slow_down_on_power_up(adev, false);
-                               cz_enable_sck_slow_down_on_power_down(adev, false);
-                       }
-                       if (adev->pg_flags & AMD_PG_SUPPORT_CP)
-                               cz_enable_cp_power_gating(adev, true);
-                       else
-                               cz_enable_cp_power_gating(adev, false);
-               } else if (adev->asic_type == CHIP_POLARIS11) {
-                       gfx_v8_0_init_power_gating(adev);
+       gfx_v8_0_init_csb(adev);
+       gfx_v8_0_init_save_restore_list(adev);
+       gfx_v8_0_enable_save_restore_machine(adev);
+
+       if ((adev->asic_type == CHIP_CARRIZO) ||
+           (adev->asic_type == CHIP_STONEY)) {
+               WREG32(mmRLC_JUMP_TABLE_RESTORE, adev->gfx.rlc.cp_table_gpu_addr >> 8);
+               gfx_v8_0_init_power_gating(adev);
+               WREG32(mmRLC_PG_ALWAYS_ON_CU_MASK, adev->gfx.cu_info.ao_cu_mask);
+               if (adev->pg_flags & AMD_PG_SUPPORT_RLC_SMU_HS) {
+                       cz_enable_sck_slow_down_on_power_up(adev, true);
+                       cz_enable_sck_slow_down_on_power_down(adev, true);
+               } else {
+                       cz_enable_sck_slow_down_on_power_up(adev, false);
+                       cz_enable_sck_slow_down_on_power_down(adev, false);
                }
+               if (adev->pg_flags & AMD_PG_SUPPORT_CP)
+                       cz_enable_cp_power_gating(adev, true);
+               else
+                       cz_enable_cp_power_gating(adev, false);
+       } else if (adev->asic_type == CHIP_POLARIS11) {
+               gfx_v8_0_init_power_gating(adev);
        }
+
 }
 
 static void gfx_v8_0_rlc_stop(struct amdgpu_device *adev)
@@ -5570,14 +5562,11 @@ static int gfx_v8_0_set_powergating_state(void *handle,
        struct amdgpu_device *adev = (struct amdgpu_device *)handle;
        bool enable = (state == AMD_PG_STATE_GATE) ? true : false;
 
-       if (!(adev->pg_flags & AMD_PG_SUPPORT_GFX_PG))
-               return 0;
-
        switch (adev->asic_type) {
        case CHIP_CARRIZO:
        case CHIP_STONEY:
-               if (adev->pg_flags & AMD_PG_SUPPORT_GFX_PG)
-                       cz_update_gfx_cg_power_gating(adev, enable);
+
+               cz_update_gfx_cg_power_gating(adev, enable);
 
                if ((adev->pg_flags & AMD_PG_SUPPORT_GFX_SMG) && enable)
                        gfx_v8_0_enable_gfx_static_mg_power_gating(adev, true);
--

1.9.1

Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): CADnq5_PYXDbwtZFD7ATtSaUxyp3Gkj=G_6T-yx5VwT705D1DEg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

author
#5 lore raw

Hi Alex, Tom,

Quoted 4 lines

3. always init gfx pg.

Quoted 2 lines

I don't think we want to do this. We need to be able to disable various pg features for debugging. Also some asics don't support gfx pg (e.g., fiji), so we don't want to enable it on those asics.

Rex: we need to call gfx_v8_0_init_pg no matter pg enable/disable. And delete repeated check for pg mask.
For example:

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static int gfx_v8_0_set_powergating_state(void *handle, · line 5574

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0 -2
-       if (!(adev->pg_flags & AMD_PG_SUPPORT_GFX_PG))
-               return 0;

We can't disable power gate when pg_flags was set to 0.

Best Regards
Rex

-----Original Message-----
From: Alex Deucher [mailto:[email protected]]
Sent: Thursday, December 01, 2016 11:44 PM
To: Zhu, Rex
Cc: amd-gfx list
Subject: Re: [PATCH] drm/amdgpu: refine pg code for gfx_v8.

Quoted 1 line · Rex Zhu

1. bit CP_PG_DISABLE was reversed.

Please split this out as a separate patch. Also, with this fixed, we should be able to enable the AMD_PG_SUPPORT_CP flag for CZ and ST.

Quoted 2 lines

2. load RLC_SRM_INDEX_CNTL_ADDR/DATA_x pairs
with valid addr/data.

Please split this out as a separate patch.

Quoted 1 line

3. always init gfx pg.

I don't think we want to do this. We need to be able to disable various pg features for debugging. Also some asics don't support gfx pg (e.g., fiji), so we don't want to enable it on those asics.

Quoted 140 lines

4. delete repeated check for pg mask.

Change-Id I9fcc8d1f79f5fa1803cb2625aa292188a656ae6b
---
 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 85 
+++++++++++++++--------------------
 1 file changed, 37 insertions(+), 48 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +13 -14
index c02ae07..fee8c2a 100644
@@ -3948,8 +3948,10 @@ static int gfx_v8_0_init_save_restore_list(struct amdgpu_device *adev)
        temp = mmRLC_SRM_INDEX_CNTL_ADDR_0;
        data = mmRLC_SRM_INDEX_CNTL_DATA_0;
        for (i = 0; i < sizeof(unique_indices) / sizeof(int); i++) {
-               amdgpu_mm_wreg(adev, temp + i, unique_indices[i] & 0x3FFFF, false);
-               amdgpu_mm_wreg(adev, data + i, unique_indices[i] >> 20, false);
+               if (unique_indices[i] != 0) {
+                       amdgpu_mm_wreg(adev, temp + i, unique_indices[i] & 0x3FFFF, false);
+                       amdgpu_mm_wreg(adev, data + i, unique_indices[i] >> 20, false);
+               }
        }
        kfree(register_list_format);
 
@@ -3965,20 +3967,16 @@ static void gfx_v8_0_init_power_gating(struct 
 amdgpu_device *adev)  {
        uint32_t data;
 
-       if (adev->pg_flags & (AMD_PG_SUPPORT_GFX_PG |
-                             AMD_PG_SUPPORT_GFX_SMG |
-                             AMD_PG_SUPPORT_GFX_DMG)) {
-               WREG32_FIELD(CP_RB_WPTR_POLL_CNTL, IDLE_POLL_COUNT, 0x60);
+       WREG32_FIELD(CP_RB_WPTR_POLL_CNTL, IDLE_POLL_COUNT, 0x60);
 
-               data = REG_SET_FIELD(0, RLC_PG_DELAY, POWER_UP_DELAY, 0x10);
-               data = REG_SET_FIELD(data, RLC_PG_DELAY, POWER_DOWN_DELAY, 0x10);
-               data = REG_SET_FIELD(data, RLC_PG_DELAY, CMD_PROPAGATE_DELAY, 0x10);
-               data = REG_SET_FIELD(data, RLC_PG_DELAY, MEM_SLEEP_DELAY, 0x10);
-               WREG32(mmRLC_PG_DELAY, data);
+       data = REG_SET_FIELD(0, RLC_PG_DELAY, POWER_UP_DELAY, 0x10);
+       data = REG_SET_FIELD(data, RLC_PG_DELAY, POWER_DOWN_DELAY, 0x10);
+       data = REG_SET_FIELD(data, RLC_PG_DELAY, CMD_PROPAGATE_DELAY, 0x10);
+       data = REG_SET_FIELD(data, RLC_PG_DELAY, MEM_SLEEP_DELAY, 0x10);
+       WREG32(mmRLC_PG_DELAY, data);
 
-               WREG32_FIELD(RLC_PG_DELAY_2, SERDES_CMD_DELAY, 0x3);
-               WREG32_FIELD(RLC_AUTO_PG_CTRL, GRBM_REG_SAVE_GFX_IDLE_THRESHOLD, 0x55f0);
-       }
+       WREG32_FIELD(RLC_PG_DELAY_2, SERDES_CMD_DELAY, 0x3);
+       WREG32_FIELD(RLC_AUTO_PG_CTRL, 
+ GRBM_REG_SAVE_GFX_IDLE_THRESHOLD, 0x55f0);
 }
 
 static void cz_enable_sck_slow_down_on_power_up(struct amdgpu_device 

*adev, @@ -3995,41 +3993,35 @@ static void cz_enable_sck_slow_down_on_power_down(struct amdgpu_device *adev,

static void cz_enable_cp_power_gating(struct amdgpu_device *adev,
bool enable) {

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +27 -34
-       WREG32_FIELD(RLC_PG_CNTL, CP_PG_DISABLE, enable ? 1 : 0);
+       WREG32_FIELD(RLC_PG_CNTL, CP_PG_DISABLE, enable ? 0 : 1);
 }
 
 static void gfx_v8_0_init_pg(struct amdgpu_device *adev)  {
-       if (adev->pg_flags & (AMD_PG_SUPPORT_GFX_PG |
-                             AMD_PG_SUPPORT_GFX_SMG |
-                             AMD_PG_SUPPORT_GFX_DMG |
-                             AMD_PG_SUPPORT_CP |
-                             AMD_PG_SUPPORT_GDS |
-                             AMD_PG_SUPPORT_RLC_SMU_HS)) {
-               gfx_v8_0_init_csb(adev);
-               gfx_v8_0_init_save_restore_list(adev);
-               gfx_v8_0_enable_save_restore_machine(adev);
-
-               if ((adev->asic_type == CHIP_CARRIZO) ||
-                   (adev->asic_type == CHIP_STONEY)) {
-                       WREG32(mmRLC_JUMP_TABLE_RESTORE, adev->gfx.rlc.cp_table_gpu_addr >> 8);
-                       gfx_v8_0_init_power_gating(adev);
-                       WREG32(mmRLC_PG_ALWAYS_ON_CU_MASK, adev->gfx.cu_info.ao_cu_mask);
-                       if (adev->pg_flags & AMD_PG_SUPPORT_RLC_SMU_HS) {
-                               cz_enable_sck_slow_down_on_power_up(adev, true);
-                               cz_enable_sck_slow_down_on_power_down(adev, true);
-                       } else {
-                               cz_enable_sck_slow_down_on_power_up(adev, false);
-                               cz_enable_sck_slow_down_on_power_down(adev, false);
-                       }
-                       if (adev->pg_flags & AMD_PG_SUPPORT_CP)
-                               cz_enable_cp_power_gating(adev, true);
-                       else
-                               cz_enable_cp_power_gating(adev, false);
-               } else if (adev->asic_type == CHIP_POLARIS11) {
-                       gfx_v8_0_init_power_gating(adev);
+       gfx_v8_0_init_csb(adev);
+       gfx_v8_0_init_save_restore_list(adev);
+       gfx_v8_0_enable_save_restore_machine(adev);
+
+       if ((adev->asic_type == CHIP_CARRIZO) ||
+           (adev->asic_type == CHIP_STONEY)) {
+               WREG32(mmRLC_JUMP_TABLE_RESTORE, adev->gfx.rlc.cp_table_gpu_addr >> 8);
+               gfx_v8_0_init_power_gating(adev);
+               WREG32(mmRLC_PG_ALWAYS_ON_CU_MASK, adev->gfx.cu_info.ao_cu_mask);
+               if (adev->pg_flags & AMD_PG_SUPPORT_RLC_SMU_HS) {
+                       cz_enable_sck_slow_down_on_power_up(adev, true);
+                       cz_enable_sck_slow_down_on_power_down(adev, true);
+               } else {
+                       cz_enable_sck_slow_down_on_power_up(adev, false);
+                       cz_enable_sck_slow_down_on_power_down(adev, 
+ false);
                }
+               if (adev->pg_flags & AMD_PG_SUPPORT_CP)
+                       cz_enable_cp_power_gating(adev, true);
+               else
+                       cz_enable_cp_power_gating(adev, false);
+       } else if (adev->asic_type == CHIP_POLARIS11) {
+               gfx_v8_0_init_power_gating(adev);
        }
+
 }
 
 static void gfx_v8_0_rlc_stop(struct amdgpu_device *adev) @@ -5570,14 
+5562,11 @@ static int gfx_v8_0_set_powergating_state(void *handle,
        struct amdgpu_device *adev = (struct amdgpu_device *)handle;
        bool enable = (state == AMD_PG_STATE_GATE) ? true : false;
 
-       if (!(adev->pg_flags & AMD_PG_SUPPORT_GFX_PG))
-               return 0;
-
        switch (adev->asic_type) {
        case CHIP_CARRIZO:
        case CHIP_STONEY:
-               if (adev->pg_flags & AMD_PG_SUPPORT_GFX_PG)
-                       cz_update_gfx_cg_power_gating(adev, enable);
+
+               cz_update_gfx_cg_power_gating(adev, enable);
 
                if ((adev->pg_flags & AMD_PG_SUPPORT_GFX_SMG) && enable)
Quoted 8 lines

gfx_v8_0_enable_gfx_static_mg_power_gating(adev, true); --
1.9.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): CY4PR12MB1687846D251399C6425C056DFB8E0-rpdhrqHFk06Y0SjTqZDccQdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org

#7 lore raw
Quoted 15 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Zhu, Rex
Sent: Friday, December 02, 2016 7:25 AM
To: Alex Deucher; StDenis, Tom
Cc: amd-gfx list
Subject: RE: [PATCH] drm/amdgpu: refine pg code for gfx_v8.

Hi Alex, Tom,

Quoted 3 lines

3. always init gfx pg.

Quoted 1 line

I don't think we want to do this. We need to be able to disable various pg

features for debugging. Also some asics don't support gfx pg (e.g., fiji), so we don't want to enable it on

Quoted 8 lines
Quoted 1 line
Quoted 1 line

those asics.

Rex: we need to call gfx_v8_0_init_pg no matter pg enable/disable. And delete repeated check for pg mask.
For example:

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static int gfx_v8_0_set_powergating_state(void *handle, · line 5574

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0 -2
-       if (!(adev->pg_flags & AMD_PG_SUPPORT_GFX_PG))
-               return 0;

We can't disable power gate when pg_flags was set to 0.

I see your point. We just assumed the default state is disabled, but it may not be. That said, we should avoid touching this stuff on asics that do not support PG at all. We should only call init_pg() on asics which support PG in the first place. I'd suggest breaking this into 3 patches:

1. fix the save/restore list
2. fix enable_cp_power_gating
3. everything else

Alex

Quoted 192 lines

Best Regards
Rex

-----Original Message-----
From: Alex Deucher [mailto:[email protected]]
Sent: Thursday, December 01, 2016 11:44 PM
To: Zhu, Rex
Cc: amd-gfx list
Subject: Re: [PATCH] drm/amdgpu: refine pg code for gfx_v8.

Quoted 1 line · Rex Zhu

1. bit CP_PG_DISABLE was reversed.

Please split this out as a separate patch. Also, with this fixed, we should be able to enable the AMD_PG_SUPPORT_CP flag for CZ and ST.

Quoted 2 lines

2. load RLC_SRM_INDEX_CNTL_ADDR/DATA_x pairs
with valid addr/data.

Please split this out as a separate patch.

Quoted 1 line

3. always init gfx pg.

I don't think we want to do this. We need to be able to disable various pg features for debugging. Also some asics don't support gfx pg (e.g., fiji), so we don't want to enable it on those asics.

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static int gfx_v8_0_init_save_restore_list(struct

Quoted 15 lines

4. delete repeated check for pg mask.

Change-Id I9fcc8d1f79f5fa1803cb2625aa292188a656ae6b
---
 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 85
+++++++++++++++--------------------
 1 file changed, 37 insertions(+), 48 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0 -0
index c02ae07..fee8c2a 100644
@@ -3948,8 +3948,10 @@ static int gfx_v8_0_init_save_restore_list(struct

amdgpu_device *adev)

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static int gfx_v8_0_init_save_restore_list(struct amdgpu_device *adev)

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0 -1
        temp = mmRLC_SRM_INDEX_CNTL_ADDR_0;
        data = mmRLC_SRM_INDEX_CNTL_DATA_0;
        for (i = 0; i < sizeof(unique_indices) / sizeof(int); i++) {
-               amdgpu_mm_wreg(adev, temp + i, unique_indices[i] & 0x3FFFF,

false);

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static int gfx_v8_0_init_save_restore_list(struct amdgpu_device *adev)

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +2 -1
-               amdgpu_mm_wreg(adev, data + i, unique_indices[i] >> 20, false);
+               if (unique_indices[i] != 0) {
+                       amdgpu_mm_wreg(adev, temp + i, unique_indices[i] &

0x3FFFF, false);

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static int gfx_v8_0_init_save_restore_list(struct · line 3953

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +1 -0
+                       amdgpu_mm_wreg(adev, data + i, unique_indices[i] >> 20,

false);

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static void gfx_v8_0_init_power_gating(struct · line 3971

Quoted 12 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +1 -4
+               }
        }
        kfree(register_list_format);
 
@@ -3965,20 +3967,16 @@ static void gfx_v8_0_init_power_gating(struct
 amdgpu_device *adev)  {
        uint32_t data;
 
-       if (adev->pg_flags & (AMD_PG_SUPPORT_GFX_PG |
-                             AMD_PG_SUPPORT_GFX_SMG |
-                             AMD_PG_SUPPORT_GFX_DMG)) {
-               WREG32_FIELD(CP_RB_WPTR_POLL_CNTL, IDLE_POLL_COUNT,

0x60);

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static void gfx_v8_0_init_power_gating(struct amdgpu_device *adev)

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +1 -1
+       WREG32_FIELD(CP_RB_WPTR_POLL_CNTL, IDLE_POLL_COUNT, 0x60);
 
-               data = REG_SET_FIELD(0, RLC_PG_DELAY, POWER_UP_DELAY,

0x10);

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static void gfx_v8_0_init_power_gating(struct · line 3974

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0 -1
-               data = REG_SET_FIELD(data, RLC_PG_DELAY,

POWER_DOWN_DELAY, 0x10);

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static void gfx_v8_0_init_power_gating(struct · line 3975

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0 -1
-               data = REG_SET_FIELD(data, RLC_PG_DELAY,

CMD_PROPAGATE_DELAY, 0x10);

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static void gfx_v8_0_init_power_gating(struct · line 3976

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0 -1
-               data = REG_SET_FIELD(data, RLC_PG_DELAY, MEM_SLEEP_DELAY,

0x10);

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static void gfx_v8_0_init_power_gating(struct amdgpu_device *adev)

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +2 -1
-               WREG32(mmRLC_PG_DELAY, data);
+       data = REG_SET_FIELD(0, RLC_PG_DELAY, POWER_UP_DELAY, 0x10);
+       data = REG_SET_FIELD(data, RLC_PG_DELAY, POWER_DOWN_DELAY,

0x10);

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static void gfx_v8_0_init_power_gating(struct · line 3974

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +1 -0
+       data = REG_SET_FIELD(data, RLC_PG_DELAY,

CMD_PROPAGATE_DELAY, 0x10);

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static void gfx_v8_0_init_power_gating(struct · line 3975

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +1 -0
+       data = REG_SET_FIELD(data, RLC_PG_DELAY, MEM_SLEEP_DELAY,

0x10);

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static void gfx_v8_0_init_power_gating(struct amdgpu_device *adev)

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +1 -2
+       WREG32(mmRLC_PG_DELAY, data);
 
-               WREG32_FIELD(RLC_PG_DELAY_2, SERDES_CMD_DELAY, 0x3);
-               WREG32_FIELD(RLC_AUTO_PG_CTRL,

GRBM_REG_SAVE_GFX_IDLE_THRESHOLD, 0x55f0);

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static void gfx_v8_0_init_power_gating(struct amdgpu_device *adev)

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +3 -1
-       }
+       WREG32_FIELD(RLC_PG_DELAY_2, SERDES_CMD_DELAY, 0x3);
+       WREG32_FIELD(RLC_AUTO_PG_CTRL,
+ GRBM_REG_SAVE_GFX_IDLE_THRESHOLD, 0x55f0);
 }
 
 static void cz_enable_sck_slow_down_on_power_up(struct

amdgpu_device

Quoted 2 lines

*adev, @@ -3995,41 +3993,35 @@ static void cz_enable_sck_slow_down_on_power_down(struct amdgpu_device

*adev,

Quoted 25 lines

static void cz_enable_cp_power_gating(struct amdgpu_device *adev,
bool enable) {

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +1 -14
-       WREG32_FIELD(RLC_PG_CNTL, CP_PG_DISABLE, enable ? 1 : 0);
+       WREG32_FIELD(RLC_PG_CNTL, CP_PG_DISABLE, enable ? 0 : 1);
 }
 
 static void gfx_v8_0_init_pg(struct amdgpu_device *adev)  {
-       if (adev->pg_flags & (AMD_PG_SUPPORT_GFX_PG |
-                             AMD_PG_SUPPORT_GFX_SMG |
-                             AMD_PG_SUPPORT_GFX_DMG |
-                             AMD_PG_SUPPORT_CP |
-                             AMD_PG_SUPPORT_GDS |
-                             AMD_PG_SUPPORT_RLC_SMU_HS)) {
-               gfx_v8_0_init_csb(adev);
-               gfx_v8_0_init_save_restore_list(adev);
-               gfx_v8_0_enable_save_restore_machine(adev);
-
-               if ((adev->asic_type == CHIP_CARRIZO) ||
-                   (adev->asic_type == CHIP_STONEY)) {
-                       WREG32(mmRLC_JUMP_TABLE_RESTORE, adev-

gfx.rlc.cp_table_gpu_addr >> 8);

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0 -2
-                       gfx_v8_0_init_power_gating(adev);
-                       WREG32(mmRLC_PG_ALWAYS_ON_CU_MASK, adev-

gfx.cu_info.ao_cu_mask);

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static void cz_enable_sck_slow_down_on_power_down(struct amdgpu_device *adev,

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0 -6
-                       if (adev->pg_flags & AMD_PG_SUPPORT_RLC_SMU_HS) {
-                               cz_enable_sck_slow_down_on_power_up(adev, true);
-                               cz_enable_sck_slow_down_on_power_down(adev, true);
-                       } else {
-                               cz_enable_sck_slow_down_on_power_up(adev, false);
-                               cz_enable_sck_slow_down_on_power_down(adev,

false);

Quoted 58 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +7 -7
-                       }
-                       if (adev->pg_flags & AMD_PG_SUPPORT_CP)
-                               cz_enable_cp_power_gating(adev, true);
-                       else
-                               cz_enable_cp_power_gating(adev, false);
-               } else if (adev->asic_type == CHIP_POLARIS11) {
-                       gfx_v8_0_init_power_gating(adev);
+       gfx_v8_0_init_csb(adev);
+       gfx_v8_0_init_save_restore_list(adev);
+       gfx_v8_0_enable_save_restore_machine(adev);
+
+       if ((adev->asic_type == CHIP_CARRIZO) ||
+           (adev->asic_type == CHIP_STONEY)) {
+               WREG32(mmRLC_JUMP_TABLE_RESTORE, adev-

gfx.rlc.cp_table_gpu_addr >> 8);

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +2 -0
+               gfx_v8_0_init_power_gating(adev);
+               WREG32(mmRLC_PG_ALWAYS_ON_CU_MASK, adev-

gfx.cu_info.ao_cu_mask);

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +17 -5
+               if (adev->pg_flags & AMD_PG_SUPPORT_RLC_SMU_HS) {
+                       cz_enable_sck_slow_down_on_power_up(adev, true);
+                       cz_enable_sck_slow_down_on_power_down(adev, true);
+               } else {
+                       cz_enable_sck_slow_down_on_power_up(adev, false);
+                       cz_enable_sck_slow_down_on_power_down(adev,
+ false);
                }
+               if (adev->pg_flags & AMD_PG_SUPPORT_CP)
+                       cz_enable_cp_power_gating(adev, true);
+               else
+                       cz_enable_cp_power_gating(adev, false);
+       } else if (adev->asic_type == CHIP_POLARIS11) {
+               gfx_v8_0_init_power_gating(adev);
        }
+
 }
 
 static void gfx_v8_0_rlc_stop(struct amdgpu_device *adev) @@ -5570,14
+5562,11 @@ static int gfx_v8_0_set_powergating_state(void *handle,
        struct amdgpu_device *adev = (struct amdgpu_device *)handle;
        bool enable = (state == AMD_PG_STATE_GATE) ? true : false;
 
-       if (!(adev->pg_flags & AMD_PG_SUPPORT_GFX_PG))
-               return 0;
-
        switch (adev->asic_type) {
        case CHIP_CARRIZO:
        case CHIP_STONEY:
-               if (adev->pg_flags & AMD_PG_SUPPORT_GFX_PG)
-                       cz_update_gfx_cg_power_gating(adev, enable);
+
+               cz_update_gfx_cg_power_gating(adev, enable);
 
                if ((adev->pg_flags & AMD_PG_SUPPORT_GFX_SMG) && enable)

gfx_v8_0_enable_gfx_static_mg_power_gating(adev, true); --
1.9.1

Quoted 8 lines
Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): MWHPR12MB169470DCE21FFC295444976DF7830-Gy0DoCVfaSW4WA4dJ5YXGAdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org

author
#9 lore raw

Hi Alex,

Patch 0001-0003 as you suggested.
Patch 0004: always initialize gfx pg for gfx_v8.0. Because if we disable pg by pg_mask, we can't enable pg in runtime. Patch 0005: in some case(passthrough), if we enabled PG first, then we can't disable it eventhrough we set pg_mask=0 when reboot VM. Patch 0006 -0007: refine set clockgating code for tonga/polars.

Best Regards
Rex
-----Original Message-----
From: Deucher, Alexander
Sent: Tuesday, December 06, 2016 5:07 AM
To: Zhu, Rex; Alex Deucher; StDenis, Tom
Cc: amd-gfx list
Subject: RE: [PATCH] drm/amdgpu: refine pg code for gfx_v8.

Quoted 16 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Zhu, Rex
Sent: Friday, December 02, 2016 7:25 AM
To: Alex Deucher; StDenis, Tom
Cc: amd-gfx list
Subject: RE: [PATCH] drm/amdgpu: refine pg code for gfx_v8.

Hi Alex, Tom,

Quoted 4 lines

3. always init gfx pg.

Quoted 2 lines

I don't think we want to do this. We need to be able to disable various pg

features for debugging. Also some asics don't support gfx pg (e.g., fiji), so we don't want to enable it on

Quoted 8 lines
Quoted 1 line
Quoted 1 line

those asics.

Rex: we need to call gfx_v8_0_init_pg no matter pg enable/disable. And delete repeated check for pg mask.
For example:

Review

Quoted 2 lines
(quoted diff) +0 -2
-       if (!(adev->pg_flags & AMD_PG_SUPPORT_GFX_PG))
-               return 0;

We can't disable power gate when pg_flags was set to 0.

I see your point. We just assumed the default state is disabled, but it may not be. That said, we should avoid touching this stuff on asics that do not support PG at all. We should only call init_pg() on asics which support PG in the first place. I'd suggest breaking this into 3 patches:

1. fix the save/restore list
2. fix enable_cp_power_gating
3. everything else

Alex

Quoted 197 lines

Best Regards
Rex

-----Original Message-----
From: Alex Deucher [mailto:[email protected]]
Sent: Thursday, December 01, 2016 11:44 PM
To: Zhu, Rex
Cc: amd-gfx list
Subject: Re: [PATCH] drm/amdgpu: refine pg code for gfx_v8.

Quoted 1 line · Rex Zhu

1. bit CP_PG_DISABLE was reversed.

Please split this out as a separate patch. Also, with this fixed, we should be able to enable the AMD_PG_SUPPORT_CP flag for CZ and ST.

Quoted 2 lines

2. load RLC_SRM_INDEX_CNTL_ADDR/DATA_x pairs
with valid addr/data.

Please split this out as a separate patch.

Quoted 1 line

3. always init gfx pg.

I don't think we want to do this. We need to be able to disable various pg features for debugging. Also some asics don't support gfx pg (e.g., fiji), so we don't want to enable it on those asics.

Quoted 15 lines

4. delete repeated check for pg mask.

Change-Id I9fcc8d1f79f5fa1803cb2625aa292188a656ae6b
---
 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 85
+++++++++++++++--------------------
 1 file changed, 37 insertions(+), 48 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0 -0
index c02ae07..fee8c2a 100644
@@ -3948,8 +3948,10 @@ static int 
Quoted 1 line

gfx_v8_0_init_save_restore_list(struct

amdgpu_device *adev)

Quoted 4 lines
        temp = mmRLC_SRM_INDEX_CNTL_ADDR_0;
        data = mmRLC_SRM_INDEX_CNTL_DATA_0;
        for (i = 0; i < sizeof(unique_indices) / sizeof(int); i++) {

- amdgpu_mm_wreg(adev, temp + i, unique_indices[i] & 0x3FFFF,

false);

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +3 -1
-               amdgpu_mm_wreg(adev, data + i, unique_indices[i] >> 20, false);
+               if (unique_indices[i] != 0) {
+                       amdgpu_mm_wreg(adev, temp + i, 
+ unique_indices[i] &

0x3FFFF, false);

Quoted 2 lines

+ amdgpu_mm_wreg(adev, data + i,
+ unique_indices[i] >> 20,

false);

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static void · line 3971

Quoted 12 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +1 -4
+               }
        }
        kfree(register_list_format);
@@ -3965,20 +3967,16 @@ static void 
 gfx_v8_0_init_power_gating(struct amdgpu_device *adev)  {
        uint32_t data;
 
-       if (adev->pg_flags & (AMD_PG_SUPPORT_GFX_PG |
-                             AMD_PG_SUPPORT_GFX_SMG |
-                             AMD_PG_SUPPORT_GFX_DMG)) {
-               WREG32_FIELD(CP_RB_WPTR_POLL_CNTL, IDLE_POLL_COUNT,

0x60);

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static void · line 3973

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +1 -1
+       WREG32_FIELD(CP_RB_WPTR_POLL_CNTL, IDLE_POLL_COUNT, 0x60);
 
-               data = REG_SET_FIELD(0, RLC_PG_DELAY, POWER_UP_DELAY,

0x10);

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static void · line 3974

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0 -1
-               data = REG_SET_FIELD(data, RLC_PG_DELAY,

POWER_DOWN_DELAY, 0x10);

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static void · line 3975

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0 -1
-               data = REG_SET_FIELD(data, RLC_PG_DELAY,

CMD_PROPAGATE_DELAY, 0x10);

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static void · line 3976

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0 -1
-               data = REG_SET_FIELD(data, RLC_PG_DELAY, MEM_SLEEP_DELAY,

0x10);

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static void · line 3973

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +2 -1
-               WREG32(mmRLC_PG_DELAY, data);
+       data = REG_SET_FIELD(0, RLC_PG_DELAY, POWER_UP_DELAY, 0x10);
+       data = REG_SET_FIELD(data, RLC_PG_DELAY, POWER_DOWN_DELAY,

0x10);

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static void · line 3974

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +1 -0
+       data = REG_SET_FIELD(data, RLC_PG_DELAY,

CMD_PROPAGATE_DELAY, 0x10);

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static void · line 3975

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +1 -0
+       data = REG_SET_FIELD(data, RLC_PG_DELAY, MEM_SLEEP_DELAY,

0x10);

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static void · line 3980

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +1 -2
+       WREG32(mmRLC_PG_DELAY, data);
 
-               WREG32_FIELD(RLC_PG_DELAY_2, SERDES_CMD_DELAY, 0x3);
-               WREG32_FIELD(RLC_AUTO_PG_CTRL,

GRBM_REG_SAVE_GFX_IDLE_THRESHOLD, 0x55f0);

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static void

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +3 -1
-       }
+       WREG32_FIELD(RLC_PG_DELAY_2, SERDES_CMD_DELAY, 0x3);
+       WREG32_FIELD(RLC_AUTO_PG_CTRL, 
+ GRBM_REG_SAVE_GFX_IDLE_THRESHOLD, 0x55f0);
 }
 
 static void cz_enable_sck_slow_down_on_power_up(struct

amdgpu_device

Quoted 2 lines

*adev, @@ -3995,41 +3993,35 @@ static void cz_enable_sck_slow_down_on_power_down(struct amdgpu_device

*adev,

Quoted 25 lines

static void cz_enable_cp_power_gating(struct amdgpu_device *adev,
bool enable) {

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +1 -14
-       WREG32_FIELD(RLC_PG_CNTL, CP_PG_DISABLE, enable ? 1 : 0);
+       WREG32_FIELD(RLC_PG_CNTL, CP_PG_DISABLE, enable ? 0 : 1);
 }
 
 static void gfx_v8_0_init_pg(struct amdgpu_device *adev)  {
-       if (adev->pg_flags & (AMD_PG_SUPPORT_GFX_PG |
-                             AMD_PG_SUPPORT_GFX_SMG |
-                             AMD_PG_SUPPORT_GFX_DMG |
-                             AMD_PG_SUPPORT_CP |
-                             AMD_PG_SUPPORT_GDS |
-                             AMD_PG_SUPPORT_RLC_SMU_HS)) {
-               gfx_v8_0_init_csb(adev);
-               gfx_v8_0_init_save_restore_list(adev);
-               gfx_v8_0_enable_save_restore_machine(adev);
-
-               if ((adev->asic_type == CHIP_CARRIZO) ||
-                   (adev->asic_type == CHIP_STONEY)) {
-                       WREG32(mmRLC_JUMP_TABLE_RESTORE, adev-

gfx.rlc.cp_table_gpu_addr >> 8);

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0 -2
-                       gfx_v8_0_init_power_gating(adev);
-                       WREG32(mmRLC_PG_ALWAYS_ON_CU_MASK, adev-

gfx.cu_info.ao_cu_mask);

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0 -6
-                       if (adev->pg_flags & AMD_PG_SUPPORT_RLC_SMU_HS) {
-                               cz_enable_sck_slow_down_on_power_up(adev, true);
-                               cz_enable_sck_slow_down_on_power_down(adev, true);
-                       } else {
-                               cz_enable_sck_slow_down_on_power_up(adev, false);
-                               cz_enable_sck_slow_down_on_power_down(adev,

false);

Quoted 60 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +7 -7
-                       }
-                       if (adev->pg_flags & AMD_PG_SUPPORT_CP)
-                               cz_enable_cp_power_gating(adev, true);
-                       else
-                               cz_enable_cp_power_gating(adev, false);
-               } else if (adev->asic_type == CHIP_POLARIS11) {
-                       gfx_v8_0_init_power_gating(adev);
+       gfx_v8_0_init_csb(adev);
+       gfx_v8_0_init_save_restore_list(adev);
+       gfx_v8_0_enable_save_restore_machine(adev);
+
+       if ((adev->asic_type == CHIP_CARRIZO) ||
+           (adev->asic_type == CHIP_STONEY)) {
+               WREG32(mmRLC_JUMP_TABLE_RESTORE, adev-

gfx.rlc.cp_table_gpu_addr >> 8);

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +2 -0
+               gfx_v8_0_init_power_gating(adev);
+               WREG32(mmRLC_PG_ALWAYS_ON_CU_MASK, adev-

gfx.cu_info.ao_cu_mask);

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +17 -6
+               if (adev->pg_flags & AMD_PG_SUPPORT_RLC_SMU_HS) {
+                       cz_enable_sck_slow_down_on_power_up(adev, true);
+                       cz_enable_sck_slow_down_on_power_down(adev, true);
+               } else {
+                       cz_enable_sck_slow_down_on_power_up(adev, false);
+                       cz_enable_sck_slow_down_on_power_down(adev,
+ false);
                }
+               if (adev->pg_flags & AMD_PG_SUPPORT_CP)
+                       cz_enable_cp_power_gating(adev, true);
+               else
+                       cz_enable_cp_power_gating(adev, false);
+       } else if (adev->asic_type == CHIP_POLARIS11) {
+               gfx_v8_0_init_power_gating(adev);
        }
+
 }
 
 static void gfx_v8_0_rlc_stop(struct amdgpu_device *adev) @@ 
-5570,14
+5562,11 @@ static int gfx_v8_0_set_powergating_state(void *handle,
        struct amdgpu_device *adev = (struct amdgpu_device *)handle;
        bool enable = (state == AMD_PG_STATE_GATE) ? true : false;
 
-       if (!(adev->pg_flags & AMD_PG_SUPPORT_GFX_PG))
-               return 0;
-
        switch (adev->asic_type) {
        case CHIP_CARRIZO:
        case CHIP_STONEY:
-               if (adev->pg_flags & AMD_PG_SUPPORT_GFX_PG)
-                       cz_update_gfx_cg_power_gating(adev, enable);
+
+               cz_update_gfx_cg_power_gating(adev, enable);
 
                if ((adev->pg_flags & AMD_PG_SUPPORT_GFX_SMG) && 

enable)

gfx_v8_0_enable_gfx_static_mg_power_gating(adev, true); --
1.9.1

Quoted 8 lines
Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

From b698c2a9797b0868edd08b00cb2a7f45d3b15bae Mon Sep 17 00:00:00 2001
From: Rex Zhu <[email protected]>
Date: Wed, 7 Dec 2016 17:22:25 +0800
Subject: [PATCH 1/7] drm/amdgpu: fix enable_cp_power_gating in gfx_v8.0.

bit CP_PG_DISABLE was reversed.

Change-Id I76659e9605ac229d00bce4a434fc3442038dbb26
---
 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +1 -1
index 9b8d3fe..c58f597 100644
@@ -3996,7 +3996,7 @@ static void cz_enable_sck_slow_down_on_power_down(struct amdgpu_device *adev,
 
 static void cz_enable_cp_power_gating(struct amdgpu_device *adev, bool enable)
 {
-	WREG32_FIELD(RLC_PG_CNTL, CP_PG_DISABLE, enable ? 1 : 0);
+	WREG32_FIELD(RLC_PG_CNTL, CP_PG_DISABLE, enable ? 0 : 1);
 }
 
 static void gfx_v8_0_init_pg(struct amdgpu_device *adev)
Signature · 1 line
1.9.1

From 851b8001c2d1f23b9a3875d848f150f62b0d2946 Mon Sep 17 00:00:00 2001
From: Rex Zhu <[email protected]>
Date: Wed, 7 Dec 2016 17:44:20 +0800
Subject: [PATCH 2/7] drm/amdgpu: fix init save/restore list in gfx_v8.0

set valid data to mmRLC_SRM_INDEX_CNTL_ADDRx/DATAx.

Change-Id I463c6c2dbbb75f57d151af5f90585725aae68bd2
---
 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +6 -2
index c58f597..ad15b62 100644
@@ -3949,8 +3949,12 @@ static int gfx_v8_0_init_save_restore_list(struct amdgpu_device *adev)
 	temp = mmRLC_SRM_INDEX_CNTL_ADDR_0;
 	data = mmRLC_SRM_INDEX_CNTL_DATA_0;
 	for (i = 0; i < sizeof(unique_indices) / sizeof(int); i++) {
-		amdgpu_mm_wreg(adev, temp + i, unique_indices[i] & 0x3FFFF, false);
-		amdgpu_mm_wreg(adev, data + i, unique_indices[i] >> 20, false);
+		if (unique_indices[i] != 0) {
+			amdgpu_mm_wreg(adev, temp + i,
+					unique_indices[i] & 0x3FFFF, false);
+			amdgpu_mm_wreg(adev, data + i,
+					unique_indices[i] >> 20, false);
+		}
 	}
 	kfree(register_list_format);
 
Signature · 1 line
1.9.1

From ce7755d11a3ee5c288b1ec01c09ac83efc50fa88 Mon Sep 17 00:00:00 2001
From: Rex Zhu <[email protected]>
Date: Wed, 7 Dec 2016 17:48:48 +0800
Subject: [PATCH 3/7] drm/amdgpu: enable AMD_PG_SUPPORT_CP in Carrizo/Stoney.

Change-Id Id01562f7f5a8316ac1ee45777adbb45adb0ea457
---
 drivers/gpu/drm/amd/amdgpu/vi.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/amdgpu/vi.c +2 -0
index 20184f1..88f660e 100644
@@ -972,6 +972,7 @@ static int vi_common_early_init(void *handle)
 			adev->pg_flags |= AMD_PG_SUPPORT_GFX_PG |
 				AMD_PG_SUPPORT_GFX_SMG |
 				AMD_PG_SUPPORT_GFX_PIPELINE |
+				AMD_PG_SUPPORT_CP |
 				AMD_PG_SUPPORT_UVD |
 				AMD_PG_SUPPORT_VCE;
 		}
@@ -997,6 +998,7 @@ static int vi_common_early_init(void *handle)
 		adev->pg_flags = AMD_PG_SUPPORT_GFX_PG |
 			AMD_PG_SUPPORT_GFX_SMG |
 			AMD_PG_SUPPORT_GFX_PIPELINE |
+			AMD_PG_SUPPORT_CP |
 			AMD_PG_SUPPORT_UVD |
 			AMD_PG_SUPPORT_VCE;
 		adev->external_rev_id = adev->rev_id + 0x61;
Signature · 1 line
1.9.1

From 5e332ba4ffc7211701f537175ad898c88e99f952 Mon Sep 17 00:00:00 2001
From: Rex Zhu <[email protected]>
Date: Wed, 7 Dec 2016 17:54:57 +0800
Subject: [PATCH 4/7] drm/amdgpu: always initialize gfx pg for gfx_v8.0.

otherwise, we can't runtime enable gfx pg.

Change-Id: I5571ac76172e7666d4149b9a94d280ac2581cb12

---
 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 76 ++++++++++++++++-------------------
 1 file changed, 34 insertions(+), 42 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +34 -42

90 lines not on this page · raw message

Signature · 1 line
1.9.1

From eb1e5b20e0a56084ed183b20ef3b9cb76a7e1ebd Mon Sep 17 00:00:00 2001
From: Rex Zhu <[email protected]>
Date: Wed, 7 Dec 2016 17:55:50 +0800
Subject: [PATCH 5/7] drm/amdgpu: fix pg can't be disabled by PG mask.

Change-Id I855d061b7e940b536750bc27f85f81c59b3ec3c1
---
 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +2 -5
index 7294850..6affc44 100644
@@ -5310,14 +5310,11 @@ static int gfx_v8_0_set_powergating_state(void *handle,
 	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 	bool enable = (state == AMD_PG_STATE_GATE) ? true : false;
 
-	if (!(adev->pg_flags & AMD_PG_SUPPORT_GFX_PG))
-		return 0;
-
 	switch (adev->asic_type) {
 	case CHIP_CARRIZO:
 	case CHIP_STONEY:
-		if (adev->pg_flags & AMD_PG_SUPPORT_GFX_PG)
-			cz_update_gfx_cg_power_gating(adev, enable);
+
+		cz_update_gfx_cg_power_gating(adev, enable);
 
 		if ((adev->pg_flags & AMD_PG_SUPPORT_GFX_SMG) && enable)
 			gfx_v8_0_enable_gfx_static_mg_power_gating(adev, true);
Signature · 1 line
1.9.1

From 5c78cfcc3e554d6aa3ef382a4d222e95ab2f622f Mon Sep 17 00:00:00 2001
From: Rex Zhu <[email protected]>
Date: Wed, 7 Dec 2016 18:22:38 +0800
Subject: [PATCH 6/7] drm/amdgpu: initialize cg flags for
tonga/polaris10/polars11.

Change-Id I8fbece47df42560b46431bc2d668bafa2374c10d
---
 drivers/gpu/drm/amd/amdgpu/vi.c          | 52 ++++++++++++++++++++++++++++++--
 drivers/gpu/drm/amd/include/amd_shared.h |  4 +++
 2 files changed, 53 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/vi.c +49 -3

67 lines not on this page · raw message

drivers/gpu/drm/amd/include/amd_shared.h +4 -0
index d198627..c02469a 100644
@@ -126,6 +126,10 @@ enum amd_vce_level {
 #define AMD_CG_SUPPORT_HDP_LS			(1 << 15)
 #define AMD_CG_SUPPORT_HDP_MGCG			(1 << 16)
 #define AMD_CG_SUPPORT_ROM_MGCG			(1 << 17)
+#define AMD_CG_SUPPORT_DRM_LS			(1 << 18)
+#define AMD_CG_SUPPORT_BIF_MGCG			(1 << 19)
+#define AMD_CG_SUPPORT_GFX_3D_CGCG		(1 << 20)
+#define AMD_CG_SUPPORT_GFX_3D_CGLS		(1 << 21)
 
 /* PG flags */
 #define AMD_PG_SUPPORT_GFX_PG			(1 << 0)
Signature · 1 line
1.9.1

From 46a068d6ff3dca3511d8c04966f740664d722f8f Mon Sep 17 00:00:00 2001
From: Rex Zhu <[email protected]>
Date: Wed, 7 Dec 2016 19:11:49 +0800
Subject: [PATCH 7/7] drm/amdgpu: refine set clock gating for tonga/polars

Change-Id I7d2c2f9ab3cad98796bcf8e32b53e83929a57c93
---
 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 165 +++++++++++++++++++++++++---------
 drivers/gpu/drm/amd/amdgpu/vi.c       | 155 ++++++++++++++++++++++----------
 2 files changed, 230 insertions(+), 90 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +122 -43

190 lines not on this page · raw message

drivers/gpu/drm/amd/amdgpu/vi.c +108 -47

165 lines not on this page · raw message

Signature · 1 line
1.9.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx