drm/amdgpu: add an asic callback to determine the reset method
Subsystems (2)
PATCH 1/12 drm/amdgpu: add an asic callback to determine the reset method
Sometimes the driver may have to behave differently depending on the method we are using to reset the GPU.
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +10 -0
@@ -532,6 +532,14 @@ struct amdgpu_allowed_register_entry {bool grbm_indexed; }; +enum amd_reset_method { +AMD_RESET_METHOD_LEGACY =0 , +AMD_RESET_METHOD_MODE0 , +AMD_RESET_METHOD_MODE1 , +AMD_RESET_METHOD_MODE2 , +AMD_RESET_METHOD_BACO +}; +/* * ASIC specific functions. */
@@ -543,6 +551,7 @@ struct amdgpu_asic_funcs { u32 sh_num, u32 reg_offset, u32 *value);void (*set_vga_state)(struct amdgpu_device *adev,bool state);int (*reset)(struct amdgpu_device *adev); +enum amd_reset_method (*reset_method)(struct amdgpu_device *adev);/* get the reference clock */ u32 (*get_xclk)(struct amdgpu_device *adev);/* MM block clocks */
@@ -1112,6 +1121,7 @@ int emu_soc_asic_init(struct amdgpu_device *adev);*/ #define amdgpu_asic_set_vga_state (adev, state) (adev)->asic_funcs->set_vga_state((adev), (state))#define amdgpu_asic_reset (adev) (adev)->asic_funcs->reset((adev)) +#define amdgpu_asic_reset_method (adev) (adev)->asic_funcs->reset_method((adev))#define amdgpu_asic_get_xclk (adev) (adev)->asic_funcs->get_xclk((adev))#define amdgpu_asic_set_uvd_clocks (adev, v, d) (adev)->asic_funcs->set_uvd_clocks((adev), (v), (d))#define amdgpu_asic_set_vce_clocks (adev, ev, ec) (adev)->asic_funcs->set_vce_clocks((adev), (ev), (ec))
Signature · 6 lines
2.20.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): 20190725165758.16928-1-alexander.deucher-5C7GfCeVMHo@public.gmane.org
PATCH 2/12 drm/amdgpu: add reset_method asic callback for si
SI always uses the legacy pci based reset.
--- drivers/gpu/drm/amd/amdgpu/si.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/gpu/drm/amd/amdgpu/si.c +7 -0
@@ -1185,6 +1185,12 @@ static int si_asic_reset(struct amdgpu_device *adev)return 0 ; } +static enum amd_reset_method +si_asic_reset_method (struct amdgpu_device *adev) +{ +return AMD_RESET_METHOD_LEGACY ; +} +static u32 si_get_config_memsize (struct amdgpu_device *adev) {return RREG32 (mmCONFIG_MEMSIZE);
@@ -1393,6 +1399,7 @@ static const struct amdgpu_asic_funcs si_asic_funcs = .read_bios_from_rom = &si_read_bios_from_rom, .read_register = &si_read_register, .reset = &si_asic_reset, + .reset_method = &si_asic_reset_method, .set_vga_state = &si_vga_set_state, .get_xclk = &si_get_xclk, .set_uvd_clocks = &si_set_uvd_clocks,
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 3/12 drm/amdgpu: add reset_method asic callback for cik
In reply to a message not in the archiveCIK always uses the legacy pci based reset.
--- drivers/gpu/drm/amd/amdgpu/cik.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/gpu/drm/amd/amdgpu/cik.c +7 -0
@@ -1290,6 +1290,12 @@ static int cik_asic_reset(struct amdgpu_device *adev)return r; } +static enum amd_reset_method +cik_asic_reset_method (struct amdgpu_device *adev) +{ +return AMD_RESET_METHOD_LEGACY ; +} +static u32 cik_get_config_memsize (struct amdgpu_device *adev) {return RREG32 (mmCONFIG_MEMSIZE);
@@ -1822,6 +1828,7 @@ static const struct amdgpu_asic_funcs cik_asic_funcs = .read_bios_from_rom = &cik_read_bios_from_rom, .read_register = &cik_read_register, .reset = &cik_asic_reset, + .reset_method = &cik_asic_reset_method, .set_vga_state = &cik_vga_set_state, .get_xclk = &cik_get_xclk, .set_uvd_clocks = &cik_set_uvd_clocks,
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 4/12 drm/amdgpu: add reset_method asic callback for vi
In reply to a message not in the archiveVI always uses the legacy pci based reset.
--- drivers/gpu/drm/amd/amdgpu/vi.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/gpu/drm/amd/amdgpu/vi.c +7 -0
@@ -709,6 +709,12 @@ static int vi_asic_reset(struct amdgpu_device *adev)return r; } +static enum amd_reset_method +vi_asic_reset_method (struct amdgpu_device *adev) +{ +return AMD_RESET_METHOD_LEGACY ; +} +static u32 vi_get_config_memsize (struct amdgpu_device *adev) {return RREG32 (mmCONFIG_MEMSIZE);
@@ -1021,6 +1027,7 @@ static const struct amdgpu_asic_funcs vi_asic_funcs = .read_bios_from_rom = &vi_read_bios_from_rom, .read_register = &vi_read_register, .reset = &vi_asic_reset, + .reset_method = &vi_asic_reset_method, .set_vga_state = &vi_vga_set_state, .get_xclk = &vi_get_xclk, .set_uvd_clocks = &vi_set_uvd_clocks,
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 5/12 drm/amdgpu: add reset_method asic callback for soc15
In reply to a message not in the archiveAPUs only support mode2 reset. dGPUs use either mode1 or baco depending on various conditions.
--- drivers/gpu/drm/amd/amdgpu/soc15.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/soc15.c +15 -2
@@ -464,12 +464,14 @@ static int soc15_asic_baco_reset(struct amdgpu_device *adev)return 0 ; } -static int soc15_asic_reset (struct amdgpu_device *adev) +static enum amd_reset_method +soc15_asic_reset_method (struct amdgpu_device *adev) { -int ret;bool baco_reset;switch (adev->asic_type) { +case CHIP_RAVEN : +return AMD_RESET_METHOD_MODE2 ;case CHIP_VEGA10 :case CHIP_VEGA12 :soc15_asic_get_baco_capability (adev, &baco_reset);
@@ -493,6 +495,16 @@ static int soc15_asic_reset(struct amdgpu_device *adev) }if (baco_reset) +return AMD_RESET_METHOD_BACO ; +else +return AMD_RESET_METHOD_MODE1 ; +} + +static int soc15_asic_reset (struct amdgpu_device *adev) +{ +int ret; + +if (soc15_asic_reset_method (adev) ==AMD_RESET_METHOD_BACO ) ret =soc15_asic_baco_reset (adev);else ret =soc15_asic_mode1_reset (adev);
@@ -806,6 +818,7 @@ static const struct amdgpu_asic_funcs soc15_asic_funcs = .read_bios_from_rom = &soc15_read_bios_from_rom, .read_register = &soc15_read_register, .reset = &soc15_asic_reset, + .reset_method = &soc15_asic_reset_method, .set_vga_state = &soc15_vga_set_state, .get_xclk = &soc15_get_xclk, .set_uvd_clocks = &soc15_set_uvd_clocks,
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 6/12 drm/amdgpu: add reset_method asic callback for navi
In reply to a message not in the archiveNavi uses either mode1 or baco depending on various conditions.
--- drivers/gpu/drm/amd/amdgpu/nv.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/nv.c +14 -1
@@ -289,6 +289,18 @@ static int nv_asic_mode1_reset(struct amdgpu_device *adev)return ret; } + +static enum amd_reset_method +nv_asic_reset_method (struct amdgpu_device *adev) +{ +struct smu_context *smu = &adev->smu; + +if (smu_baco_is_support (smu)) +return AMD_RESET_METHOD_BACO ; +else +return AMD_RESET_METHOD_MODE1 ; +} +static int nv_asic_reset (struct amdgpu_device *adev) {
@@ -303,7 +315,7 @@ static int nv_asic_reset(struct amdgpu_device *adev)int ret =0 ;struct smu_context *smu = &adev->smu; -if (smu_baco_is_support (smu)) +if (nv_asic_reset_method (adev) ==AMD_RESET_METHOD_BACO ) ret =smu_baco_reset (smu);else ret =nv_asic_mode1_reset (adev);
@@ -500,6 +512,7 @@ static const struct amdgpu_asic_funcs nv_asic_funcs = .read_bios_from_rom = &nv_read_bios_from_rom, .read_register = &nv_read_register, .reset = &nv_asic_reset, + .reset_method = &nv_asic_reset_method, .set_vga_state = &nv_vga_set_state, .get_xclk = &nv_get_xclk, .set_uvd_clocks = &nv_set_uvd_clocks,
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 7/12 drm/amdgpu/powerplay: add a new interface to set the mp1 state
In reply to a message not in the archiveThis is required for certain cases such as various GPU resets (mode1, mode2), BACO, shutdown, unload, etc. to put the SMU into the appropriate state for when the hw is re-initialized.
--- drivers/gpu/drm/amd/include/kgd_pp_interface.h | 8 ++++++++ drivers/gpu/drm/amd/powerplay/amd_powerplay.c | 16 ++++++++++++++++ drivers/gpu/drm/amd/powerplay/inc/hwmgr.h | 1 + 3 files changed, 25 insertions(+)
drivers/gpu/drm/amd/include/kgd_pp_interface.h +8 -0
@@ -171,6 +171,13 @@ enum PP_HWMON_TEMP { PP_TEMP_MAX }; +enum pp_mp1_state { +PP_MP1_STATE_NONE , +PP_MP1_STATE_SHUTDOWN , +PP_MP1_STATE_UNLOAD , +PP_MP1_STATE_RESET , +}; +#define PP_GROUP_MASK 0xF0000000#define PP_GROUP_SHIFT 28
@@ -266,6 +273,7 @@ struct amd_pm_funcs {int (*get_power_profile_mode)(void *handle,char *buf);int (*set_power_profile_mode)(void *handle,long *input,uint32_t size);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);/* export to DC */ u32 (*get_sclk)(void *handle,bool low);u32 (*get_mclk)(void *handle,bool low);
drivers/gpu/drm/amd/powerplay/amd_powerplay.c +16 -0
@@ -924,6 +924,21 @@ static int pp_odn_edit_dpm_table(void *handle, uint32_t type, long *input, uint3return hwmgr->hwmgr_func->odn_edit_dpm_table (hwmgr, type, input, size); } +static int pp_dpm_set_mp1_state (void *handle,enum pp_mp1_state mp1_state) +{ +struct pp_hwmgr *hwmgr = handle; + +if (!hwmgr || !hwmgr->pm_en) +return -EINVAL ; + +if (hwmgr->hwmgr_func->set_mp1_state ==NULL ) { +pr_info_ratelimited ("%s was not implemented.\n" , __func__); +return -EINVAL ; + } + +return hwmgr->hwmgr_func->set_mp1_state (hwmgr, mp1_state); +} +static int pp_dpm_switch_power_profile (void *handle,enum PP_SMC_POWER_PROFILE type,bool en) {
@@ -1525,6 +1540,7 @@ static const struct amd_pm_funcs pp_dpm_funcs = { .get_power_profile_mode = pp_get_power_profile_mode, .set_power_profile_mode = pp_set_power_profile_mode, .odn_edit_dpm_table = pp_odn_edit_dpm_table, + .set_mp1_state = pp_dpm_set_mp1_state, .set_power_limit = pp_set_power_limit, .get_power_limit = pp_get_power_limit,/* export to DC */
drivers/gpu/drm/amd/powerplay/inc/hwmgr.h +1 -0
@@ -344,6 +344,7 @@ struct pp_hwmgr_func {int (*set_asic_baco_state)(struct pp_hwmgr *hwmgr,enum BACO_STATE state);int (*get_ppfeature_status)(struct pp_hwmgr *hwmgr,char *buf);int (*set_ppfeature_status)(struct pp_hwmgr *hwmgr,uint64_t ppfeature_masks); +int (*set_mp1_state)(struct pp_hwmgr *hwmgr,enum pp_mp1_state mp1_state); };struct pp_table_func {
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 8/12 drm/amdgpu/powerplay: add set_mp1_state for vega20
In reply to a message not in the archiveThis sets the SMU into the proper state for various operations (shutdown, unload, GPU reset, etc.).
--- .../drm/amd/powerplay/hwmgr/vega20_hwmgr.c | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+)
drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c +29 -0
@@ -3063,6 +3063,34 @@ static int vega20_odn_edit_dpm_table(struct pp_hwmgr *hwmgr,return 0 ; } +static int vega20_set_mp1_state (struct pp_hwmgr *hwmgr, +enum pp_mp1_state mp1_state) +{ +uint16_t msg; +int ret; + +switch (mp1_state) { +case PP_MP1_STATE_SHUTDOWN : + msg = PPSMC_MSG_PrepareMp1ForShutdown; +break ; +case PP_MP1_STATE_UNLOAD : + msg = PPSMC_MSG_PrepareMp1ForUnload; +break ; +case PP_MP1_STATE_RESET : + msg = PPSMC_MSG_PrepareMp1ForReset; +break ; +case PP_MP1_STATE_NONE : +default : +return 0 ; + } + +PP_ASSERT_WITH_CODE ((ret =smum_send_msg_to_smc (hwmgr, msg)) ==0 , +"[PrepareMp1] Failed!" , + return ret); + +return 0 ; +} +static int vega20_get_ppfeature_status (struct pp_hwmgr *hwmgr,char *buf) {static const char *ppfeature_name[] = {
@@ -4123,6 +4151,7 @@ static const struct pp_hwmgr_func vega20_hwmgr_funcs = { .get_asic_baco_capability = vega20_baco_get_capability, .get_asic_baco_state = vega20_baco_get_state, .set_asic_baco_state = vega20_baco_set_state, + .set_mp1_state = vega20_set_mp1_state, };int vega20_hwmgr_init (struct pp_hwmgr *hwmgr)
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 9/12 drm/amdgpu/powerplay: add set_mp1_state for vega10
In reply to a message not in the archiveThis sets the SMU into the proper state for various operations (shutdown, unload, GPU reset, etc.).
--- .../drm/amd/powerplay/hwmgr/vega10_hwmgr.c | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+)
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +25 -0
@@ -5218,6 +5218,30 @@ static int vega10_odn_edit_dpm_table(struct pp_hwmgr *hwmgr,return 0 ; } +static int vega10_set_mp1_state (struct pp_hwmgr *hwmgr, +enum pp_mp1_state mp1_state) +{ +uint16_t msg; +int ret; + +switch (mp1_state) { +case PP_MP1_STATE_UNLOAD : + msg = PPSMC_MSG_PrepareMp1ForUnload; +break ; +case PP_MP1_STATE_SHUTDOWN : +case PP_MP1_STATE_RESET : +case PP_MP1_STATE_NONE : +default : +return 0 ; + } + +PP_ASSERT_WITH_CODE ((ret =smum_send_msg_to_smc (hwmgr, msg)) ==0 , +"[PrepareMp1] Failed!" , + return ret); + +return 0 ; +} +static int vega10_get_performance_level (struct pp_hwmgr *hwmgr,const struct pp_hw_power_state *state,PHM_PerformanceLevelDesignation designation,uint32_t index,PHM_PerformanceLevel *level)
@@ -5307,6 +5331,7 @@ static const struct pp_hwmgr_func vega10_hwmgr_funcs = { .enable_mgpu_fan_boost = vega10_enable_mgpu_fan_boost, .get_ppfeature_status = vega10_get_ppfeature_status, .set_ppfeature_status = vega10_set_ppfeature_status, + .set_mp1_state = vega10_set_mp1_state, };int vega10_hwmgr_init (struct pp_hwmgr *hwmgr)
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 10/12 drm/amdgpu/powerplay: add set_mp1_state for vega12
In reply to a message not in the archiveThis sets the SMU into the proper state for various operations (shutdown, unload, GPU reset, etc.).
--- .../drm/amd/powerplay/hwmgr/vega12_hwmgr.c | 26 ++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/powerplay/hwmgr/vega12_hwmgr.c +25 -1
@@ -2639,6 +2639,30 @@ static int vega12_get_performance_level(struct pp_hwmgr *hwmgr, const struct pp_return 0 ; } +static int vega12_set_mp1_state (struct pp_hwmgr *hwmgr, +enum pp_mp1_state mp1_state) +{ +uint16_t msg; +int ret; + +switch (mp1_state) { +case PP_MP1_STATE_UNLOAD : + msg = PPSMC_MSG_PrepareMp1ForUnload; +break ; +case PP_MP1_STATE_SHUTDOWN : +case PP_MP1_STATE_RESET : +case PP_MP1_STATE_NONE : +default : +return 0 ; + } + +PP_ASSERT_WITH_CODE ((ret =smum_send_msg_to_smc (hwmgr, msg)) ==0 , +"[PrepareMp1] Failed!" , + return ret); + +return 0 ; +} +static const struct pp_hwmgr_func vega12_hwmgr_funcs = { .backend_init = vega12_hwmgr_backend_init, .backend_fini = vega12_hwmgr_backend_fini,
@@ -2695,7 +2719,7 @@ static const struct pp_hwmgr_func vega12_hwmgr_funcs = { .set_asic_baco_state = vega12_baco_set_state, .get_ppfeature_status = vega12_get_ppfeature_status, .set_ppfeature_status = vega12_set_ppfeature_status, - + .set_mp1_state = vega12_set_mp1_state, };int vega12_hwmgr_init (struct pp_hwmgr *hwmgr)
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 11/12 drm/amdgpu: add a flag to note when the driver is in shutdown
In reply to a message not in the archiveWhen we are tearing down the device for PCI shutdown, set the flag. The driver needs to know this case so it can set the SMC into the proper state.
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 2 ++ 2 files changed, 3 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 -0
@@ -993,6 +993,7 @@ struct amdgpu_device {/* record last mm index being written through WREG32*/ unsigned long last_mm_index;bool in_gpu_reset; +bool in_gpu_shutdown;struct mutex lock_reset;struct amdgpu_doorbell_index doorbell_index;
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +2 -0
@@ -1089,12 +1089,14 @@ amdgpu_pci_shutdown(struct pci_dev *pdev)struct drm_device *dev =pci_get_drvdata (pdev);struct amdgpu_device *adev = dev->dev_private; + adev->in_gpu_shutdown = true;/* if we are running in a VM, make sure the device * torn down properly on reboot/shutdown. * unfortunately we can't detect certain * hypervisors so just do this all the time. */ amdgpu_device_ip_suspend (adev); + adev->in_gpu_shutdown = false; }static int amdgpu_pmops_suspend (struct device *dev)
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 12/12 drm/amdgpu: put the SMC into the proper state on suspend
In reply to a message not in the archiveSuspend is used for S3/S4, GPU reset, and PCI shutdown. In each case, we need to put the SMC into the proper state in order to resume or reload correctly.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 33 ++++++++++++++++++++++ 1 file changed, 33 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +33 -0
@@ -2174,6 +2174,39 @@ static int amdgpu_device_ip_suspend_phase2(struct amdgpu_device *adev)DRM_ERROR ("suspend of IP block <%s> failed %d\n" , adev->ip_blocks[i].version->funcs->name, r); } +/* handle putting the SMC in the appropriate state */ +if (adev->ip_blocks[i].version->type ==AMD_IP_BLOCK_TYPE_SMC ) { +enum pp_mp1_state mp1_state =PP_MP1_STATE_NONE ; + +if (adev->in_gpu_reset) { +switch (amdgpu_asic_reset_method (adev)) { +case AMD_RESET_METHOD_MODE1 : +case AMD_RESET_METHOD_BACO : + mp1_state =PP_MP1_STATE_SHUTDOWN ; +break ; +case AMD_RESET_METHOD_MODE2 : + mp1_state =PP_MP1_STATE_RESET ; +break ; +default : + mp1_state =PP_MP1_STATE_NONE ; +break ; + } + }else if (adev->in_gpu_shutdown) { + mp1_state =PP_MP1_STATE_UNLOAD ; + } +if (is_support_sw_smu (adev)) { +/* todo */ + }else if (adev->powerplay.pp_funcs && + adev->powerplay.pp_funcs->set_mp1_state) { + r = adev->powerplay.pp_funcs->set_mp1_state ( + adev->powerplay.pp_handle, + mp1_state); +if (r) { +DRM_ERROR ("SMC failed to set mp1 state %d, %d\n" , + mp1_state, r); + } + } + } }return 0 ;
Signature · 6 lines
2.20.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): 20190725165758.16928-12-alexander.deucher-5C7GfCeVMHo@public.gmane.org
RE: [PATCH 12/12] drm/amdgpu: put the SMC into the proper state on suspend
Patch1 - patch11: Reviewed-by: Evan Quan <[email protected]>
For patch12, comment inline
Quoted 41 lines
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Alex Deucher
Sent: Friday, July 26, 2019 12:58 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: [PATCH 12/12] drm/amdgpu: put the SMC into the proper state on suspendSuspend is used for S3/S4, GPU reset, and PCI shutdown. In each case, we need to put the SMC into the proper state in order to resume or reload correctly.
Signed-off-by Alex Deucher <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 33 ++++++++++++++++++++++ 1 file changed, 33 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +3
-0@@ -2174,6 +2174,39 @@ static int amdgpu_device_ip_suspend_phase2(struct amdgpu_device *adev) DRM_ERROR("suspend of IP block <%s> failed %d\n", adev->ip_blocks[i].version->funcs->name, r); } +/* handle putting the SMC in the appropriate state */ +if (adev->ip_blocks[i].version->type ==AMD_IP_BLOCK_TYPE_SMC ) { + enum pp_mp1_state mp1_state =
PP_MP1_STATE_NONE;drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +6
-0+ +if (adev->in_gpu_reset) { +switch (amdgpu_asic_reset_method (adev)) { +case AMD_RESET_METHOD_MODE1 : +case AMD_RESET_METHOD_BACO : + mp1_state =
Quoted 1 line
PP_MP1_STATE_SHUTDOWN;
[Quan, Evan] For AMD_RESET_METHOD_BACO, it should be PP_MP1_STATE_UNLOAD.
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c static int amdgpu_device_ip_suspend_phase2(struct amdgpu_device *adev) · line 2196
Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +11
-0+break ; +case AMD_RESET_METHOD_MODE2 : + mp1_state =PP_MP1_STATE_RESET ; +break ; +default : + mp1_state =PP_MP1_STATE_NONE ; +break ; + } + }else if (adev->in_gpu_shutdown) { + mp1_state =PP_MP1_STATE_UNLOAD ; + }
[Quan, Evan] Handling for suspend only case seems missing.
Quoted 12 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +4
-0+if (is_support_sw_smu (adev)) { +/* todo */ + }else if (adev->powerplay.pp_funcs && + adev->powerplay.pp_funcs-Quoted 1 line
set_mp1_state) {drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1
-0+ r = adev->powerplay.pp_funcs-Quoted 1 line
set_mp1_state(
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +4
-0+ adev->powerplay.pp_handle, + mp1_state); +if (r) { + DRM_ERROR("SMC failed to set mp1state %d, %d\n",
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c static int amdgpu_device_ip_suspend_phase2(struct amdgpu_device *adev) · line 2209
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +4
-0+ mp1_state, r); + } + } + }
[Quan, Evan] Baco reset will be triggered in soc15_asic_reset. And there will be SMU message issued then and needs the SMU prepared. If we stall the SMU engine here(before soc15_asic_reset), we may fail to issue BACO messages.
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-1}return 0 ; --2.20.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): MN2PR12MB33447331E5106CE7A8BC7786E4C00-rweVpJHSKToDMgCC8P//[email protected]
Re: [PATCH 12/12] drm/amdgpu: put the SMC into the proper state on suspend
Quoted 40 lines · Evan
Patch1 - patch11: Reviewed-by: Evan Quan <[email protected]>
For patch12, comment inline
Quoted 35 lines
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Alex Deucher
Sent: Friday, July 26, 2019 12:58 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: [PATCH 12/12] drm/amdgpu: put the SMC into the proper state on suspendSuspend is used for S3/S4, GPU reset, and PCI shutdown. In each case, we need to put the SMC into the proper state in order to resume or reload correctly.
Signed-off-by Alex Deucher <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 33 ++++++++++++++++++++++ 1 file changed, 33 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +3
-0@@ -2174,6 +2174,39 @@ static int amdgpu_device_ip_suspend_phase2(struct amdgpu_device *adev) DRM_ERROR("suspend of IP block <%s> failed %d\n", adev->ip_blocks[i].version->funcs->name, r); } +/* handle putting the SMC in the appropriate state */ +if (adev->ip_blocks[i].version->type ==AMD_IP_BLOCK_TYPE_SMC ) { + enum pp_mp1_state mp1_state =
PP_MP1_STATE_NONE;
Quoted 8 lines
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +6
-0+ +if (adev->in_gpu_reset) { +switch (amdgpu_asic_reset_method (adev)) { +case AMD_RESET_METHOD_MODE1 : +case AMD_RESET_METHOD_BACO : + mp1_state =
PP_MP1_STATE_SHUTDOWN;[Quan, Evan] For
AMD_RESET_METHOD_BACO, it should bePP_MP1_STATE_UNLOAD.
Ok. I thought you had said shutdown before, but see my comment below about BACO.
Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c static int amdgpu_device_ip_suspend_phase2(struct amdgpu_device *adev) · line 2196
Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +11
-0+break ; +case AMD_RESET_METHOD_MODE2 : + mp1_state =PP_MP1_STATE_RESET ; +break ; +default : + mp1_state =PP_MP1_STATE_NONE ; +break ; + } + }else if (adev->in_gpu_shutdown) { + mp1_state =PP_MP1_STATE_UNLOAD ; + }
Quoted 1 line
[Quan, Evan] Handling for suspend only case seems missing.
Do you know what state we should use for suspend? Do we even need to a case for suspend? Putting the chip into D3 might be enough as is.
Quoted 16 lines
Quoted 12 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +4
-0+if (is_support_sw_smu (adev)) { +/* todo */ + }else if (adev->powerplay.pp_funcs && + adev->powerplay.pp_funcs-Quoted 1 line
set_mp1_state) {+ r = adev->powerplay.pp_funcs-
Quoted 1 line
set_mp1_state(
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +4
-0+ adev->powerplay.pp_handle, + mp1_state); +if (r) { + DRM_ERROR("SMC failed to set mp1state %d, %d\n",
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c static int amdgpu_device_ip_suspend_phase2(struct amdgpu_device *adev) · line 2209
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +4
-0+ mp1_state, r); + } + } + }
Quoted 2 lines
[Quan, Evan] Baco reset will be triggered in
soc15_asic_reset. And there will be SMU message issued then and needs the SMU prepared. If we stall the SMU enginehere(before soc15_asic_reset), we may fail to issue BACO messages.
Good point. Although thinking a bit more about how BACO works, I'm wondering if we even need to do anything for BACO. We use the SMU to bring the chip in and out of BACO so I'm not sure if it makes sense to do anything for the BACO case.
Alex
Quoted 10 lines
Quoted 10 lines
} return 0;--
2.20.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