aboutsummaryrefslogtreecommitdiffstats
path: root/common/recipes-kernel/linux/linux-yocto-4.14.71/4811-drm-amdgpu-Add-gfx_off-support-in-smu-through-pp_set.patch
diff options
context:
space:
mode:
Diffstat (limited to 'common/recipes-kernel/linux/linux-yocto-4.14.71/4811-drm-amdgpu-Add-gfx_off-support-in-smu-through-pp_set.patch')
-rw-r--r--common/recipes-kernel/linux/linux-yocto-4.14.71/4811-drm-amdgpu-Add-gfx_off-support-in-smu-through-pp_set.patch119
1 files changed, 119 insertions, 0 deletions
diff --git a/common/recipes-kernel/linux/linux-yocto-4.14.71/4811-drm-amdgpu-Add-gfx_off-support-in-smu-through-pp_set.patch b/common/recipes-kernel/linux/linux-yocto-4.14.71/4811-drm-amdgpu-Add-gfx_off-support-in-smu-through-pp_set.patch
new file mode 100644
index 00000000..445705d0
--- /dev/null
+++ b/common/recipes-kernel/linux/linux-yocto-4.14.71/4811-drm-amdgpu-Add-gfx_off-support-in-smu-through-pp_set.patch
@@ -0,0 +1,119 @@
+From 3e27fbb641f0383537857d80fa58093b301bb57b Mon Sep 17 00:00:00 2001
+From: Rex Zhu <Rex.Zhu@amd.com>
+Date: Tue, 5 Jun 2018 11:46:35 +0800
+Subject: [PATCH 4811/5725] drm/amdgpu: Add gfx_off support in smu through
+ pp_set_powergating_by_smu
+
+we can take gfx off feature as gfx power gate. gfx off feature is also
+controled by smu. so add gfx_off support in pp_set_powergating_by_smu.
+
+Reviewed-by: Evan Quan <evan.quan@amd.com>
+Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
+Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
+---
+ drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 19 +++++++------------
+ drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 4 ++++
+ drivers/gpu/drm/amd/powerplay/amd_powerplay.c | 16 ----------------
+ 3 files changed, 11 insertions(+), 28 deletions(-)
+
+diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+index 78d6c99..5a815cf 100644
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+@@ -1780,16 +1780,11 @@ static int amdgpu_device_ip_late_set_cg_state(struct amdgpu_device *adev)
+ }
+ }
+
+- if (adev->powerplay.pp_feature & PP_GFXOFF_MASK) {
++ if (adev->powerplay.pp_feature & PP_GFXOFF_MASK)
+ /* enable gfx powergating */
+ amdgpu_device_ip_set_powergating_state(adev,
+ AMD_IP_BLOCK_TYPE_GFX,
+ AMD_PG_STATE_GATE);
+- /* enable gfxoff */
+- amdgpu_device_ip_set_powergating_state(adev,
+- AMD_IP_BLOCK_TYPE_SMC,
+- AMD_PG_STATE_GATE);
+- }
+
+ return 0;
+ }
+@@ -1862,6 +1857,8 @@ static int amdgpu_device_ip_fini(struct amdgpu_device *adev)
+ adev->ip_blocks[i].version->funcs->name, r);
+ return r;
+ }
++ if (adev->powerplay.pp_funcs->set_powergating_by_smu)
++ amdgpu_dpm_set_powergating_by_smu(adev, AMD_IP_BLOCK_TYPE_GFX, false);
+ r = adev->ip_blocks[i].version->funcs->hw_fini((void *)adev);
+ /* XXX handle errors */
+ if (r) {
+@@ -1970,12 +1967,6 @@ int amdgpu_device_ip_suspend(struct amdgpu_device *adev)
+ if (amdgpu_sriov_vf(adev))
+ amdgpu_virt_request_full_gpu(adev, false);
+
+- /* ungate SMC block powergating */
+- if (adev->powerplay.pp_feature & PP_GFXOFF_MASK)
+- amdgpu_device_ip_set_powergating_state(adev,
+- AMD_IP_BLOCK_TYPE_SMC,
+- AMD_PG_STATE_UNGATE);
+-
+ /* ungate SMC block first */
+ r = amdgpu_device_ip_set_clockgating_state(adev, AMD_IP_BLOCK_TYPE_SMC,
+ AMD_CG_STATE_UNGATE);
+@@ -1983,6 +1974,10 @@ int amdgpu_device_ip_suspend(struct amdgpu_device *adev)
+ DRM_ERROR("set_clockgating_state(ungate) SMC failed %d\n", r);
+ }
+
++ /* call smu to disable gfx off feature first when suspend */
++ if (adev->powerplay.pp_funcs->set_powergating_by_smu)
++ amdgpu_dpm_set_powergating_by_smu(adev, AMD_IP_BLOCK_TYPE_GFX, false);
++
+ for (i = adev->num_ip_blocks - 1; i >= 0; i--) {
+ if (!adev->ip_blocks[i].status.valid)
+ continue;
+diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
+index 7a881ef..cd5668a 100644
+--- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
++++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
+@@ -3730,6 +3730,10 @@ static int gfx_v9_0_set_powergating_state(void *handle,
+
+ /* update mgcg state */
+ gfx_v9_0_update_gfx_mg_power_gating(adev, enable);
++
++ /* set gfx off through smu */
++ if (enable && adev->powerplay.pp_funcs->set_powergating_by_smu)
++ amdgpu_dpm_set_powergating_by_smu(adev, AMD_IP_BLOCK_TYPE_GFX, true);
+ break;
+ default:
+ break;
+diff --git a/drivers/gpu/drm/amd/powerplay/amd_powerplay.c b/drivers/gpu/drm/amd/powerplay/amd_powerplay.c
+index ae190f9..9e54bbe 100644
+--- a/drivers/gpu/drm/amd/powerplay/amd_powerplay.c
++++ b/drivers/gpu/drm/amd/powerplay/amd_powerplay.c
+@@ -231,23 +231,7 @@ static int pp_sw_reset(void *handle)
+ static int pp_set_powergating_state(void *handle,
+ enum amd_powergating_state state)
+ {
+- struct amdgpu_device *adev = handle;
+- struct pp_hwmgr *hwmgr = adev->powerplay.pp_handle;
+- int ret;
+-
+- if (!hwmgr || !hwmgr->pm_en)
+- return 0;
+-
+- if (hwmgr->hwmgr_func->gfx_off_control) {
+- /* Enable/disable GFX off through SMU */
+- ret = hwmgr->hwmgr_func->gfx_off_control(hwmgr,
+- state == AMD_PG_STATE_GATE);
+- if (ret)
+- pr_err("gfx off control failed!\n");
+- }
+-
+ return 0;
+-
+ }
+
+ static int pp_suspend(void *handle)
+--
+2.7.4
+