drm/amdgpu: add mode2 reset support for vangogh
Subsystems (3)
PATCH 1/4 drm/amdgpu: add mode2 reset support for vangogh
GPU reset is handled via SMU similar to previous APUs.
--- drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c +6 -0
@@ -780,6 +780,11 @@ static int vangogh_set_fine_grain_gfx_freq_parameters(struct smu_context *smu)return 0 ; } +static int vangogh_mode2_reset (struct smu_context *smu) +{ +return smu_cmn_send_smc_msg_with_param (smu, SMU_MSG_GfxDeviceDriverReset,SMU_RESET_MODE_2 ,NULL ); +} +static const struct pptable_funcs vangogh_ppt_funcs = { .check_fw_status = smu_v11_0_check_fw_status,
@@ -808,6 +813,7 @@ static const struct pptable_funcs vangogh_ppt_funcs = { .print_clk_levels = vangogh_print_fine_grain_clk, .set_default_dpm_table = vangogh_set_default_dpm_tables, .set_fine_grain_gfx_freq_parameters = vangogh_set_fine_grain_gfx_freq_parameters, + .mode2_reset = vangogh_mode2_reset, };void vangogh_set_ppt_funcs (struct smu_context *smu)
Signature · 6 lines
2.25.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 2/4 drm/amdgpu/nv: add mode2 reset handling
Vangogh will use mode2 reset, so plumb it through the nv soc driver.
--- drivers/gpu/drm/amd/amdgpu/nv.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/nv.c +12 -2
@@ -352,6 +352,7 @@ nv_asic_reset_method(struct amdgpu_device *adev)struct smu_context *smu = &adev->smu;if (amdgpu_reset_method ==AMD_RESET_METHOD_MODE1 || + amdgpu_reset_method ==AMD_RESET_METHOD_MODE2 || amdgpu_reset_method ==AMD_RESET_METHOD_BACO )return amdgpu_reset_method;
@@ -360,6 +361,8 @@ nv_asic_reset_method(struct amdgpu_device *adev) amdgpu_reset_method);switch (adev->asic_type) { +case CHIP_VANGOGH : +return AMD_RESET_METHOD_MODE2 ;case CHIP_SIENNA_CICHLID :case CHIP_NAVY_FLOUNDER :return AMD_RESET_METHOD_MODE1 ;
@@ -376,7 +379,8 @@ static int nv_asic_reset(struct amdgpu_device *adev)int ret =0 ;struct smu_context *smu = &adev->smu; -if (nv_asic_reset_method (adev) ==AMD_RESET_METHOD_BACO ) { +switch (nv_asic_reset_method (adev)) { +case AMD_RESET_METHOD_BACO :dev_info (adev->dev,"BACO reset\n" ); ret =smu_baco_enter (smu);
@@ -385,9 +389,15 @@ static int nv_asic_reset(struct amdgpu_device *adev) ret =smu_baco_exit (smu);if (ret)return ret; - }else { +break ; +case AMD_RESET_METHOD_MODE2 : +dev_info (adev->dev,"MODE2 reset\n" ); + ret =amdgpu_dpm_mode2_reset (adev); +break ; +default :dev_info (adev->dev,"MODE1 reset\n" ); ret =nv_asic_mode1_reset (adev); +break ; }return ret;
Signature · 6 lines
2.25.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 3/4 drm/amdgpu: fix mode2 reset sequence for vangogh
In reply to Alex DeucherWe need to save and restore PCI config space.
--- drivers/gpu/drm/amd/amdgpu/nv.c | 34 ++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/nv.c +33 -1
@@ -336,6 +336,38 @@ static int nv_asic_mode1_reset(struct amdgpu_device *adev)return ret; } +static int nv_asic_mode2_reset (struct amdgpu_device *adev) +{ +u32 i; +int ret =0 ; + +amdgpu_atombios_scratch_regs_engine_hung (adev, true); + +/* disable BM */ +pci_clear_master (adev->pdev); + +amdgpu_device_cache_pci_state (adev->pdev); + + ret =amdgpu_dpm_mode2_reset (adev); +if (ret) +dev_err (adev->dev,"GPU mode2 reset failed\n" ); + +amdgpu_device_load_pci_state (adev->pdev); + +/* wait for asic to come out of reset */ +for (i =0 ; i < adev->usec_timeout; i++) { +u32 memsize = adev->nbio.funcs->get_memsize (adev); + +if (memsize !=0xffffffff ) +break ; +udelay (1 ); + } + +amdgpu_atombios_scratch_regs_engine_hung (adev, false); + +return ret; +} +static bool nv_asic_supports_baco (struct amdgpu_device *adev) {struct smu_context *smu = &adev->smu;
@@ -392,7 +424,7 @@ static int nv_asic_reset(struct amdgpu_device *adev)break ;case AMD_RESET_METHOD_MODE2 :dev_info (adev->dev,"MODE2 reset\n" ); - ret =amdgpu_dpm_mode2_reset (adev); + ret =nv_asic_mode2_reset (adev);break ;default :dev_info (adev->dev,"MODE1 reset\n" );
Signature · 6 lines
2.25.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Re: [PATCH 3/4] drm/amdgpu: fix mode2 reset sequence for vangogh
Quoted 3 lines · Alex Deucher
We need to save and restore PCI config space.
Signed-off-by Alex Deucher <[email protected]>
Series are Reviewed-by: Huang Rui <[email protected]>
Hi xiaomeng, let's verify these patch set in your platform.
Quoted 63 lines
--- drivers/gpu/drm/amd/amdgpu/nv.c | 34 ++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/nv.c +33
-1@@ -336,6 +336,38 @@ static int nv_asic_mode1_reset(struct amdgpu_device *adev)return ret; } +static int nv_asic_mode2_reset (struct amdgpu_device *adev) +{ +u32 i; +int ret =0 ; + +amdgpu_atombios_scratch_regs_engine_hung (adev, true); + +/* disable BM */ +pci_clear_master (adev->pdev); + +amdgpu_device_cache_pci_state (adev->pdev); + + ret =amdgpu_dpm_mode2_reset (adev); +if (ret) +dev_err (adev->dev,"GPU mode2 reset failed\n" ); + +amdgpu_device_load_pci_state (adev->pdev); + +/* wait for asic to come out of reset */ +for (i =0 ; i < adev->usec_timeout; i++) { +u32 memsize = adev->nbio.funcs->get_memsize (adev); + +if (memsize !=0xffffffff ) +break ; +udelay (1 ); + } + +amdgpu_atombios_scratch_regs_engine_hung (adev, false); + +return ret; +} +static bool nv_asic_supports_baco (struct amdgpu_device *adev) {struct smu_context *smu = &adev->smu;@@ -392,7 +424,7 @@ static int nv_asic_reset(struct amdgpu_device *adev)break ;case AMD_RESET_METHOD_MODE2 :dev_info (adev->dev,"MODE2 reset\n" ); - ret =amdgpu_dpm_mode2_reset (adev); + ret =nv_asic_mode2_reset (adev);break ;default :dev_info (adev->dev,"MODE1 reset\n" );Signature · 6 lines
2.25.4 _______________________________________________ amd-gfx mailing list [email protected] https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=04%7C01%7Cray.huang%40amd.com%7C232f4d9376fa46595ab708d8915e348c%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637419181097974222%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=G4MJVzemXHXDbWv53OWKVtD3DnJGgSs4TYbIEkQE2PE%3D&reserved=0
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 4/4 drm/amdgpu: Enable GPU reset for vangogh
In reply to Alex DeucherEnable GPU reset when we encounter a hang.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -0
@@ -4189,6 +4189,7 @@ bool amdgpu_device_should_recover_gpu(struct amdgpu_device *adev)case CHIP_NAVI14 :case CHIP_NAVI12 :case CHIP_SIENNA_CICHLID : +case CHIP_VANGOGH :break ;default : goto disabled;
Signature · 6 lines
2.25.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx