drm/amdgpu: add s0i3 capacity check for s0i3 routine
Subsystems (3)
PATCH 1/5 drm/amdgpu: add s0i3 capacity check for s0i3 routine
add amdgpu_acpi_is_s0ix_supported() to check the platform whether support s0i3.
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 2 ++ drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 14 ++++++++++++++ 2 files changed, 16 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +2 -0
@@ -1314,9 +1314,11 @@ int amdgpu_acpi_pcie_notify_device_ready(struct amdgpu_device *adev);void amdgpu_acpi_get_backlight_caps (struct amdgpu_device *adev,struct amdgpu_dm_backlight_caps *caps); +bool amdgpu_acpi_is_s0ix_supported (void );#else static inline int amdgpu_acpi_init (struct amdgpu_device *adev) {return 0 ; }static inline void amdgpu_acpi_fini (struct amdgpu_device *adev) { } +static inline bool amdgpu_acpi_is_s0ix_supported (void ) {return false; }#endif int amdgpu_cs_find_mapping(struct amdgpu_cs_parser *parser,
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +14 -0
@@ -27,6 +27,7 @@#include <linux/power_supply.h> #include <linux/pm_runtime.h> #include <acpi/video.h> +#include <acpi/actbl.h> #include <drm/drm_crtc_helper.h> #include "amdgpu.h"
@@ -894,3 +895,16 @@ void amdgpu_acpi_fini(struct amdgpu_device *adev)unregister_acpi_notifier (&adev->acpi_nb);kfree (adev->atif); } + +/** +* amdgpu_acpi_is_s0ix_supported +* +* returns true if supported, false if not. +*/ +bool amdgpu_acpi_is_s0ix_supported () +{ +if (acpi_gbl_FADT.flags &ACPI_FADT_LOW_POWER_S0 ) +return true; + +return false; +}
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 2/5 drm/amdgpu: add amdgpu_gfx_state_change_set() set gfx power change entry
The new amdgpu_gfx_state_change_set() funtion can support set GFX power change status to D0/D3.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 20 ++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h | 7 +++++++ drivers/gpu/drm/amd/include/kgd_pp_interface.h | 1 + drivers/gpu/drm/amd/pm/inc/hwmgr.h | 1 + drivers/gpu/drm/amd/pm/inc/rv_ppsmc.h | 3 ++- drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c | 19 +++++++++++++++++++ drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.c | 10 ++++++++++ 7 files changed, 60 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +20 -0
@@ -819,3 +819,23 @@ int amdgpu_gfx_get_num_kcq(struct amdgpu_device *adev) }return amdgpu_num_kcq; } + +/* amdgpu_gfx_state_change_set - Handle gfx power state change set +* @adev: amdgpu_device pointer +* @state: gfx power state(1 -sGpuChangeState_D0Entry and 2 -sGpuChangeState_D3Entry) +* +*/ + +void amdgpu_gfx_state_change_set (struct amdgpu_device *adev,enum gfx_change_state state) +{ + +mutex_lock (&adev->pm.mutex); + +if (adev->powerplay.pp_funcs && + adev->powerplay.pp_funcs->gfx_state_change_set) + ((adev)->powerplay.pp_funcs->gfx_state_change_set ( + (adev)->powerplay.pp_handle, state)); + +mutex_unlock (&adev->pm.mutex); + +}
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h +7 -0
@@ -47,6 +47,12 @@ enum gfx_pipe_priority { AMDGPU_GFX_PIPE_PRIO_MAX }; +/* Argument for PPSMC_MSG_GpuChangeState */ +enum gfx_change_state { + sGpuChangeState_D0Entry =1 , + sGpuChangeState_D3Entry, +}; +#define AMDGPU_GFX_QUEUE_PRIORITY_MINIMUM 0#define AMDGPU_GFX_QUEUE_PRIORITY_MAXIMUM 15
@@ -394,4 +400,5 @@ int amdgpu_gfx_cp_ecc_error_irq(struct amdgpu_device *adev,uint32_t amdgpu_kiq_rreg (struct amdgpu_device *adev,uint32_t reg);void amdgpu_kiq_wreg (struct amdgpu_device *adev,uint32_t reg,uint32_t v);int amdgpu_gfx_get_num_kcq (struct amdgpu_device *adev); +void amdgpu_gfx_state_change_set (struct amdgpu_device *adev,enum gfx_change_state state);#endif
drivers/gpu/drm/amd/include/kgd_pp_interface.h +1 -0
@@ -285,6 +285,7 @@ struct amd_pm_funcs {int (*odn_edit_dpm_table)(void *handle,uint32_t type,long *input,uint32_t size);int (*set_mp1_state)(void *handle,enum pp_mp1_state mp1_state);int (*smu_i2c_bus_access)(void *handle,bool acquire); +int (*gfx_state_change_set)(void *handle,uint32_t state);/* export to DC */ u32 (*get_sclk)(void *handle,bool low);u32 (*get_mclk)(void *handle,bool low);
drivers/gpu/drm/amd/pm/inc/hwmgr.h +1 -0
@@ -366,6 +366,7 @@ struct pp_hwmgr_func {int (*disable_power_features_for_compute_performance)(struct pp_hwmgr *hwmgr,bool disable);ssize_t (*get_gpu_metrics)(struct pp_hwmgr *hwmgr,void **table); +int (*gfx_state_change)(struct pp_hwmgr *hwmgr,uint32_t state); };struct pp_table_func {
drivers/gpu/drm/amd/pm/inc/rv_ppsmc.h +2 -1
@@ -83,7 +83,8 @@#define PPSMC_MSG_SetSoftMaxVcn 0x34#define PPSMC_MSG_PowerGateMmHub 0x35#define PPSMC_MSG_SetRccPfcPmeRestoreRegister 0x36 -#define PPSMC_Message_Count 0x37 +#define PPSMC_MSG_GpuChangeState 0x37 +#define PPSMC_Message_Count 0x42typedef uint16_t PPSMC_Result ;typedef int PPSMC_Msg ;
drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c +19 -0
@@ -1629,6 +1629,24 @@ static ssize_t pp_get_gpu_metrics(void *handle, void **table)return size; } +static int pp_gfx_state_change_set (void *handle,uint32_t state) +{ +struct pp_hwmgr *hwmgr = handle; + +if (!hwmgr || !hwmgr->pm_en) +return -EINVAL ; + +if (hwmgr->hwmgr_func->gfx_state_change ==NULL ) { +pr_info_ratelimited ("%s was not implemented.\n" , __func__); +return -EINVAL ; + } + +mutex_lock (&hwmgr->smu_lock); + hwmgr->hwmgr_func->gfx_state_change (hwmgr, state); +mutex_unlock (&hwmgr->smu_lock); +return 0 ; +} +static const struct amd_pm_funcs pp_dpm_funcs = { .load_firmware = pp_dpm_load_fw, .wait_for_fw_loading_complete = pp_dpm_fw_loading_complete,
@@ -1691,4 +1709,5 @@ static const struct amd_pm_funcs pp_dpm_funcs = { .set_df_cstate = pp_set_df_cstate, .set_xgmi_pstate = pp_set_xgmi_pstate, .get_gpu_metrics = pp_get_gpu_metrics, + .gfx_state_change_set = pp_gfx_state_change_set, };
drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.c +10 -0
@@ -1439,6 +1439,15 @@ static int smu10_set_fine_grain_clk_vol(struct pp_hwmgr *hwmgr,return 0 ; } +static int smu10_gfx_state_change (struct pp_hwmgr *hwmgr,uint32_t state) +{ +struct amdgpu_device *adev = hwmgr->adev; + +smum_send_msg_to_smc_with_parameter (hwmgr, PPSMC_MSG_GpuChangeState, state,NULL ); + +return 0 ; +} +static const struct pp_hwmgr_func smu10_hwmgr_funcs = { .backend_init = smu10_hwmgr_backend_init, .backend_fini = smu10_hwmgr_backend_fini,
@@ -1485,6 +1494,7 @@ static const struct pp_hwmgr_func smu10_hwmgr_funcs = { .set_power_profile_mode = smu10_set_power_profile_mode, .asic_reset = smu10_asic_reset, .set_fine_grain_clk_vol = smu10_set_fine_grain_clk_vol, + .gfx_state_change = smu10_gfx_state_change, };int smu10_init_function_pointers (struct pp_hwmgr *hwmgr)
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Re: [PATCH 2/5] drm/amdgpu: add amdgpu_gfx_state_change_set() set gfx power change entry
Quoted 26 lines · Prike Liang
The new
amdgpu_gfx_state_change_set()funtion can support set GFX power change status to D0/D3.Signed-off-by Prike Liang <[email protected]>Acked-by Huang Rui <[email protected]>Reviewed-by Alex Deucher <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 20 ++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h | 7 +++++++ drivers/gpu/drm/amd/include/kgd_pp_interface.h | 1 + drivers/gpu/drm/amd/pm/inc/hwmgr.h | 1 + drivers/gpu/drm/amd/pm/inc/rv_ppsmc.h | 3 ++- drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c | 19 +++++++++++++++++++ drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.c | 10 ++++++++++ 7 files changed, 60 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +1
-0@@ -819,3 +819,23 @@ int amdgpu_gfx_get_num_kcq(struct amdgpu_device *adev) }return amdgpu_num_kcq; } +
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c int amdgpu_gfx_get_num_kcq(struct amdgpu_device *adev) · line 832
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +10
-0+/* amdgpu_gfx_state_change_set - Handle gfx power state change set +* @adev: amdgpu_device pointer +* @state: gfx power state(1 -sGpuChangeState_D0Entry and 2 -sGpuChangeState_D3Entry) +* +*/ + +void amdgpu_gfx_state_change_set (struct amdgpu_device *adev,enum gfx_change_state state) +{ + +mutex_lock (&adev->pm.mutex);
pm.mutex is only relevant for the powerplay case. swSMU uses different locking. Move the mutexes into the if clause.
Alex
Quoted 136 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +9
-0+ +if (adev->powerplay.pp_funcs && + adev->powerplay.pp_funcs->gfx_state_change_set) + ((adev)->powerplay.pp_funcs->gfx_state_change_set ( + (adev)->powerplay.pp_handle, state)); + +mutex_unlock (&adev->pm.mutex); + +}drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h +7
-0@@ -47,6 +47,12 @@ enum gfx_pipe_priority { AMDGPU_GFX_PIPE_PRIO_MAX }; +/* Argument for PPSMC_MSG_GpuChangeState */ +enum gfx_change_state { + sGpuChangeState_D0Entry =1 , + sGpuChangeState_D3Entry, +}; +#define AMDGPU_GFX_QUEUE_PRIORITY_MINIMUM 0#define AMDGPU_GFX_QUEUE_PRIORITY_MAXIMUM 15@@ -394,4 +400,5 @@ int amdgpu_gfx_cp_ecc_error_irq(struct amdgpu_device *adev,uint32_t amdgpu_kiq_rreg (struct amdgpu_device *adev,uint32_t reg);void amdgpu_kiq_wreg (struct amdgpu_device *adev,uint32_t reg,uint32_t v);int amdgpu_gfx_get_num_kcq (struct amdgpu_device *adev); +void amdgpu_gfx_state_change_set (struct amdgpu_device *adev,enum gfx_change_state state);#endif drivers/gpu/drm/amd/include/kgd_pp_interface.h +1
-0@@ -285,6 +285,7 @@ struct amd_pm_funcs {int (*odn_edit_dpm_table)(void *handle,uint32_t type,long *input,uint32_t size);int (*set_mp1_state)(void *handle,enum pp_mp1_state mp1_state);int (*smu_i2c_bus_access)(void *handle,bool acquire); +int (*gfx_state_change_set)(void *handle,uint32_t state);/* export to DC */ u32 (*get_sclk)(void *handle,bool low);u32 (*get_mclk)(void *handle,bool low);drivers/gpu/drm/amd/pm/inc/hwmgr.h +1
-0@@ -366,6 +366,7 @@ struct pp_hwmgr_func {int (*disable_power_features_for_compute_performance)(struct pp_hwmgr *hwmgr,bool disable);ssize_t (*get_gpu_metrics)(struct pp_hwmgr *hwmgr,void **table); +int (*gfx_state_change)(struct pp_hwmgr *hwmgr,uint32_t state); };struct pp_table_func {drivers/gpu/drm/amd/pm/inc/rv_ppsmc.h +2
-1@@ -83,7 +83,8 @@#define PPSMC_MSG_SetSoftMaxVcn 0x34#define PPSMC_MSG_PowerGateMmHub 0x35#define PPSMC_MSG_SetRccPfcPmeRestoreRegister 0x36 -#define PPSMC_Message_Count 0x37 +#define PPSMC_MSG_GpuChangeState 0x37 +#define PPSMC_Message_Count 0x42typedef uint16_t PPSMC_Result ;typedef int PPSMC_Msg ;drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c +19
-0@@ -1629,6 +1629,24 @@ static ssize_t pp_get_gpu_metrics(void *handle, void **table)return size; } +static int pp_gfx_state_change_set (void *handle,uint32_t state) +{ +struct pp_hwmgr *hwmgr = handle; + +if (!hwmgr || !hwmgr->pm_en) +return -EINVAL ; + +if (hwmgr->hwmgr_func->gfx_state_change ==NULL ) { +pr_info_ratelimited ("%s was not implemented.\n" , __func__); +return -EINVAL ; + } + +mutex_lock (&hwmgr->smu_lock); + hwmgr->hwmgr_func->gfx_state_change (hwmgr, state); +mutex_unlock (&hwmgr->smu_lock); +return 0 ; +} +static const struct amd_pm_funcs pp_dpm_funcs = { .load_firmware = pp_dpm_load_fw, .wait_for_fw_loading_complete = pp_dpm_fw_loading_complete,@@ -1691,4 +1709,5 @@ static const struct amd_pm_funcs pp_dpm_funcs = { .set_df_cstate = pp_set_df_cstate, .set_xgmi_pstate = pp_set_xgmi_pstate, .get_gpu_metrics = pp_get_gpu_metrics, + .gfx_state_change_set = pp_gfx_state_change_set, };drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.c +10
-1@@ -1439,6 +1439,15 @@ static int smu10_set_fine_grain_clk_vol(struct pp_hwmgr *hwmgr,return 0 ; } +static int smu10_gfx_state_change (struct pp_hwmgr *hwmgr,uint32_t state) +{ +struct amdgpu_device *adev = hwmgr->adev; + +smum_send_msg_to_smc_with_parameter (hwmgr, PPSMC_MSG_GpuChangeState, state,NULL ); + +return 0 ; +} +static const struct pp_hwmgr_func smu10_hwmgr_funcs = { .backend_init = smu10_hwmgr_backend_init, .backend_fini = smu10_hwmgr_backend_fini,@@ -1485,6 +1494,7 @@ static const struct pp_hwmgr_func smu10_hwmgr_funcs = { .set_power_profile_mode = smu10_set_power_profile_mode, .asic_reset = smu10_asic_reset, .set_fine_grain_clk_vol = smu10_set_fine_grain_clk_vol, + .gfx_state_change = smu10_gfx_state_change, };int smu10_init_function_pointers (struct pp_hwmgr *hwmgr) --2.7.4
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
PATCH 3/5 drm/amdgpu: update amdgpu device suspend/resume sequence for s0i3 support
In reply to Prike Liang- Need skip the RLC/CP/GFX disable for let GFXOFF enter during suspend period.
- For s0i3 suspend only need suspend DCE and each IP interrupt.
- Before VBIOS POSTed check and atom HW INT need set the GPU power status change to D0 in the resume period, otherwise the HW will be mess up and see the SDMA hang.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +11 -4
@@ -2650,8 +2650,10 @@ static int amdgpu_device_ip_suspend_phase1(struct amdgpu_device *adev) {int i, r; -amdgpu_device_set_pg_state (adev,AMD_PG_STATE_UNGATE ); -amdgpu_device_set_cg_state (adev,AMD_CG_STATE_UNGATE ); +if (!amdgpu_acpi_is_s0ix_supported ()) { +amdgpu_device_set_pg_state (adev,AMD_PG_STATE_UNGATE ); +amdgpu_device_set_cg_state (adev,AMD_CG_STATE_UNGATE ); + }for (i = adev->num_ip_blocks -1 ; i >=0 ; i--) {if (!adev->ip_blocks[i].status.valid)
@@ -3706,8 +3708,10 @@ int amdgpu_device_suspend(struct drm_device *dev, bool fbcon)amdgpu_fence_driver_suspend (adev); - r =amdgpu_device_ip_suspend_phase2 (adev); - +if (!amdgpu_acpi_is_s0ix_supported ()) + r =amdgpu_device_ip_suspend_phase2 (adev); +else +amdgpu_gfx_state_change_set (adev, sGpuChangeState_D3Entry);/* evict remaining vram memory * This second call to evict vram is to evict the gart page table * using the CPU.
@@ -3738,6 +3742,9 @@ int amdgpu_device_resume(struct drm_device *dev, bool fbcon)if (dev->switch_power_state ==DRM_SWITCH_POWER_OFF )return 0 ; +if (amdgpu_acpi_is_s0ix_supported ()) +amdgpu_gfx_state_change_set (adev, sGpuChangeState_D0Entry); +/* post card */ if (amdgpu_device_need_post (adev)) { r =amdgpu_device_asic_init (adev);
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 4/5 drm/amdgpu: fix reset support for s0i3 enablement
In reply to Prike Liangupdate amdgpu device suspend sequence for gpu reset during s0i3 enable.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +2 -2
@@ -2650,7 +2650,7 @@ static int amdgpu_device_ip_suspend_phase1(struct amdgpu_device *adev) {int i, r; -if (!amdgpu_acpi_is_s0ix_supported ()) { +if (!amdgpu_acpi_is_s0ix_supported () ||amdgpu_in_reset (adev)) {amdgpu_device_set_pg_state (adev,AMD_PG_STATE_UNGATE );amdgpu_device_set_cg_state (adev,AMD_CG_STATE_UNGATE ); }
@@ -3708,7 +3708,7 @@ int amdgpu_device_suspend(struct drm_device *dev, bool fbcon)amdgpu_fence_driver_suspend (adev); -if (!amdgpu_acpi_is_s0ix_supported ()) +if (!amdgpu_acpi_is_s0ix_supported () ||amdgpu_in_reset (adev)) r =amdgpu_device_ip_suspend_phase2 (adev);else amdgpu_gfx_state_change_set (adev, sGpuChangeState_D3Entry);
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Re: [PATCH 4/5] drm/amdgpu: fix reset support for s0i3 enablement
Quoted 4 lines · Prike Liang
update amdgpu device suspend sequence for gpu reset during s0i3 enable.
Signed-off-by Prike Liang <[email protected]>
Maybe squash this one into patch 3?
Alex
Quoted 29 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +2
-3@@ -2650,7 +2650,7 @@ static int amdgpu_device_ip_suspend_phase1(struct amdgpu_device *adev) {int i, r; -if (!amdgpu_acpi_is_s0ix_supported ()) { +if (!amdgpu_acpi_is_s0ix_supported () ||amdgpu_in_reset (adev)) {amdgpu_device_set_pg_state (adev,AMD_PG_STATE_UNGATE );amdgpu_device_set_cg_state (adev,AMD_CG_STATE_UNGATE ); }@@ -3708,7 +3708,7 @@ int amdgpu_device_suspend(struct drm_device *dev, bool fbcon)amdgpu_fence_driver_suspend (adev); -if (!amdgpu_acpi_is_s0ix_supported ()) +if (!amdgpu_acpi_is_s0ix_supported () ||amdgpu_in_reset (adev)) r =amdgpu_device_ip_suspend_phase2 (adev);else amdgpu_gfx_state_change_set (adev, sGpuChangeState_D3Entry); --2.7.4
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
RE: [PATCH 4/5] drm/amdgpu: fix reset support for s0i3 enablement
[AMD Official Use Only - Internal Distribution Only]
Quoted 10 lines
-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Friday, November 13, 2020 3:51 AM
To: Liang, Prike <[email protected]>
Cc: amd-gfx list <[email protected]>; Deucher, Alexander <[email protected]>; Huang, Ray <[email protected]>
Subject: Re: [PATCH 4/5] drm/amdgpu: fix reset support for s0i3 enablementQuoted 1 line · Prike Liang
Quoted 8 lines
Quoted 3 lines
update amdgpu device suspend sequence for gpu reset during s0i3 enable.
Signed-off-by Prike Liang <[email protected]>Maybe squash this one into patch 3?
Alex
[Prike] Yes, this patch only handle the GPU reset base on the s0i3 enablement and will merge to patch3.
Quoted 44 lines
Quoted 34 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +3
-2@@ -2650,7 +2650,7 @@ static int amdgpu_device_ip_suspend_phase1(struct amdgpu_device *adev) {int i, r; -if (!amdgpu_acpi_is_s0ix_supported ()) { +if (!amdgpu_acpi_is_s0ix_supported () ||amdgpu_in_reset (adev)) + {amdgpu_device_set_pg_state (adev,AMD_PG_STATE_UNGATE );amdgpu_device_set_cg_state (adev,AMD_CG_STATE_UNGATE ); }@@ -3708,7 +3708,7 @@ int amdgpu_device_suspend(struct drm_device *dev, bool fbcon)amdgpu_fence_driver_suspend (adev); -if (!amdgpu_acpi_is_s0ix_supported ()) +if (!amdgpu_acpi_is_s0ix_supported () ||amdgpu_in_reset (adev)) r =amdgpu_device_ip_suspend_phase2 (adev);else amdgpu_gfx_state_change_set(adev,
sGpuChangeState_D3Entry);
--
2.7.4Quoted 5 lines
_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flist
s.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=04%7C01%7CPr
Quoted 1 line
ike.Liang%40amd.com%7C59713bd6a49b4b094d8b08d887445bac%7C3dd89
61fe4884Quoted 1 line
Quoted 9 lines
e608e11a82d994e183d%7C0%7C0%7C637408074951136062%7CUnknown%7 CTWFpbGZsb
Quoted 1 line
3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0 %3D%
Quoted 1 line
7C2000&sdata=Z%2FaCe7d5aGY2HHlc7iTRny%2B2DJl8jPv3QDSa2ad%2F zPk%3D&
Quoted 1 line
amp;reserved=0
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 5/5 drm/amd/pm: add gfx_state_change_set() for rn gfx power switch
In reply to Prike LiangThe gfx_state_change_set() funtion can support set GFX power change status to D0/D3.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 3 +++ drivers/gpu/drm/amd/pm/inc/amdgpu_smu.h | 2 ++ drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 10 ++++++++++ drivers/gpu/drm/amd/pm/swsmu/smu12/renoir_ppt.c | 7 +++++++ 4 files changed, 22 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +3 -0
@@ -838,4 +838,7 @@ void amdgpu_gfx_state_change_set(struct amdgpu_device *adev, enum gfx_change_stamutex_unlock (&adev->pm.mutex); +if (is_support_sw_smu (adev)) +smu_gfx_state_change_set (&adev->smu, state); + }
drivers/gpu/drm/amd/pm/inc/amdgpu_smu.h +2 -0
@@ -576,6 +576,7 @@ struct pptable_funcs {int (*post_init)(struct smu_context *smu);void (*interrupt_work)(struct smu_context *smu);int (*gpo_control)(struct smu_context *smu,bool enablement); +int (*gfx_state_change_set)(struct smu_context *smu,uint32_t state); }; typedef enum {
@@ -764,6 +765,7 @@ int smu_get_status_gfxoff(struct amdgpu_device *adev, uint32_t *value);ssize_t smu_sys_get_gpu_metrics (struct smu_context *smu,void **table);int smu_enable_mgpu_fan_boost (struct smu_context *smu); +int smu_gfx_state_change_set (struct smu_context *smu,uint32_t state);#endif #endif
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +10 -0
@@ -2529,3 +2529,13 @@ int smu_enable_mgpu_fan_boost(struct smu_context *smu)return ret; } + +int smu_gfx_state_change_set (struct smu_context *smu,uint32_t state) +{ +int ret =0 ; + +if (smu->ppt_funcs->gfx_state_change_set) + ret = smu->ppt_funcs->gfx_state_change_set (smu, state); + +return ret; +}
drivers/gpu/drm/amd/pm/swsmu/smu12/renoir_ppt.c +7 -0
@@ -1136,6 +1136,13 @@ static ssize_t renoir_get_gpu_metrics(struct smu_context *smu,return sizeof (struct gpu_metrics_v2_0 ); } +static int renoir_gfx_state_change_set (struct smu_context *smu,uint32_t state) +{ +struct amdgpu_device *adev = smu->adev; + +return smu_cmn_send_smc_msg_with_param (smu, SMU_MSG_GpuChangeState, state,NULL ); +} +static const struct pptable_funcs renoir_ppt_funcs = { .set_power_state =NULL , .print_clk_levels = renoir_print_clk_levels,
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Re: [PATCH 5/5] drm/amd/pm: add gfx_state_change_set() for rn gfx power switch
Quoted 17 lines · Prike Liang
The
gfx_state_change_set()funtion can support set GFX power change status to D0/D3.Signed-off-by Prike Liang <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 3 +++ drivers/gpu/drm/amd/pm/inc/amdgpu_smu.h | 2 ++ drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 10 ++++++++++ drivers/gpu/drm/amd/pm/swsmu/smu12/renoir_ppt.c | 7 +++++++ 4 files changed, 22 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +0
-0
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c void amdgpu_gfx_state_change_set(struct amdgpu_device *adev, enum gfx_change_sta · line 842
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +2
-0@@ -838,4 +838,7 @@ void amdgpu_gfx_state_change_set(struct amdgpu_device *adev, enum gfx_change_stamutex_unlock (&adev->pm.mutex); +if (is_support_sw_smu (adev)) +smu_gfx_state_change_set (&adev->smu, state);
maybe move this up with the powerplay code for consistency?
Quoted 27 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +1
-0+ }drivers/gpu/drm/amd/pm/inc/amdgpu_smu.h +2
-0@@ -576,6 +576,7 @@ struct pptable_funcs {int (*post_init)(struct smu_context *smu);void (*interrupt_work)(struct smu_context *smu);int (*gpo_control)(struct smu_context *smu,bool enablement); +int (*gfx_state_change_set)(struct smu_context *smu,uint32_t state); }; typedef enum {@@ -764,6 +765,7 @@ int smu_get_status_gfxoff(struct amdgpu_device *adev, uint32_t *value);ssize_t smu_sys_get_gpu_metrics (struct smu_context *smu,void **table);int smu_enable_mgpu_fan_boost (struct smu_context *smu); +int smu_gfx_state_change_set (struct smu_context *smu,uint32_t state);#endif #endif drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +0
-0
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c int smu_enable_mgpu_fan_boost(struct smu_context *smu) · line 2536
Quoted 8 lines
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +5
-0@@ -2529,3 +2529,13 @@ int smu_enable_mgpu_fan_boost(struct smu_context *smu)return ret; } + +int smu_gfx_state_change_set (struct smu_context *smu,uint32_t state) +{ +int ret =0 ; +
I think we need to lock the smu->mutex here?
Alex
Quoted 26 lines
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +5
-0+if (smu->ppt_funcs->gfx_state_change_set) + ret = smu->ppt_funcs->gfx_state_change_set (smu, state); + +return ret; +}drivers/gpu/drm/amd/pm/swsmu/smu12/renoir_ppt.c +7
-1@@ -1136,6 +1136,13 @@ static ssize_t renoir_get_gpu_metrics(struct smu_context *smu,return sizeof (struct gpu_metrics_v2_0 ); } +static int renoir_gfx_state_change_set (struct smu_context *smu,uint32_t state) +{ +struct amdgpu_device *adev = smu->adev; + +return smu_cmn_send_smc_msg_with_param (smu, SMU_MSG_GpuChangeState, state,NULL ); +} +static const struct pptable_funcs renoir_ppt_funcs = { .set_power_state =NULL , .print_clk_levels = renoir_print_clk_levels, --2.7.4
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