drm/amdgpu/si: minor clean up of reset code
Subsystems (2)
PATCH 1/7 drm/amdgpu/si: minor clean up of reset code
Drop duplicate reset method logging, whitespace changes.
--- drivers/gpu/drm/amd/amdgpu/si.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/si.c +2 -5
@@ -1380,7 +1380,7 @@ static int si_gpu_pci_config_reset(struct amdgpu_device *adev)u32 i;int r = -EINVAL ; -dev_info (adev->dev,"GPU pci config reset\n" ); +amdgpu_atombios_scratch_regs_engine_hung (adev, true);/* set mclk/sclk to bypass */ si_set_clk_bypass_mode (adev);
@@ -1404,6 +1404,7 @@ static int si_gpu_pci_config_reset(struct amdgpu_device *adev) }udelay (1 ); } +amdgpu_atombios_scratch_regs_engine_hung (adev, false);return r; }
@@ -1414,12 +1415,8 @@ static int si_asic_reset(struct amdgpu_device *adev)dev_info (adev->dev,"PCI CONFIG reset\n" ); -amdgpu_atombios_scratch_regs_engine_hung (adev, true); - r =si_gpu_pci_config_reset (adev); -amdgpu_atombios_scratch_regs_engine_hung (adev, false); -return r; }
Signature · 6 lines
2.29.2 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 2/7 drm/amdgpu/cik: minor clean up of reset code
Drop duplicate reset method logging, whitespace changes.
--- drivers/gpu/drm/amd/amdgpu/cik.c | 33 +++++++++++--------------------- 1 file changed, 11 insertions(+), 22 deletions(-)
drivers/gpu/drm/amd/amdgpu/cik.c +11 -22
@@ -1327,13 +1327,22 @@ static void kv_restore_regs_for_reset(struct amdgpu_device *adev,WREG32 (mmGMCON_RENG_EXECUTE, save->gmcon_reng_execute); } -static int cik_gpu_pci_config_reset (struct amdgpu_device *adev) +/** +* cik_asic_pci_config_reset - soft reset GPU +* +* @adev: amdgpu_device pointer +* +* Use PCI Config method to reset the GPU. +* +* Returns 0 for success. +*/ +static int cik_asic_pci_config_reset (struct amdgpu_device *adev) {struct kv_reset_save_regs kv_save = {0 };u32 i;int r = -EINVAL ; -dev_info (adev->dev,"GPU pci config reset\n" ); +amdgpu_atombios_scratch_regs_engine_hung (adev, true);if (adev->flags &AMD_IS_APU )kv_save_regs_for_reset (adev, &kv_save);
@@ -1361,26 +1370,6 @@ static int cik_gpu_pci_config_reset(struct amdgpu_device *adev)if (adev->flags &AMD_IS_APU )kv_restore_regs_for_reset (adev, &kv_save); -return r; -} - -/** -* cik_asic_pci_config_reset - soft reset GPU -* -* @adev: amdgpu_device pointer -* -* Use PCI Config method to reset the GPU. -* -* Returns 0 for success. -*/ -static int cik_asic_pci_config_reset (struct amdgpu_device *adev) -{ -int r; - -amdgpu_atombios_scratch_regs_engine_hung (adev, true); - - r =cik_gpu_pci_config_reset (adev); -amdgpu_atombios_scratch_regs_engine_hung (adev, false);return r;
Signature · 6 lines
2.29.2 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 3/7 drm/amdgpu/vi: minor clean up of reset code
In reply to Alex DeucherDrop duplicate reset method logging, whitespace changes.
--- drivers/gpu/drm/amd/amdgpu/vi.c | 36 +++++++++++++-------------------- 1 file changed, 14 insertions(+), 22 deletions(-)
drivers/gpu/drm/amd/amdgpu/vi.c +14 -22
@@ -831,11 +831,21 @@ static int vi_read_register(struct amdgpu_device *adev, u32 se_num,return -EINVAL ; } -static int vi_gpu_pci_config_reset (struct amdgpu_device *adev) +/** +* vi_asic_pci_config_reset - soft reset GPU +* +* @adev: amdgpu_device pointer +* +* Use PCI Config method to reset the GPU. +* +* Returns 0 for success. +*/ +static int vi_asic_pci_config_reset (struct amdgpu_device *adev) {u32 i; +int r = -EINVAL ; -dev_info (adev->dev,"GPU pci config reset\n" ); +amdgpu_atombios_scratch_regs_engine_hung (adev, true);/* disable BM */ pci_clear_master (adev->pdev);
@@ -850,29 +860,11 @@ static int vi_gpu_pci_config_reset(struct amdgpu_device *adev)/* enable BM */ pci_set_master (adev->pdev); adev->has_hw_reset = true; -return 0 ; + r =0 ; +break ; }udelay (1 ); } -return -EINVAL ; -} - -/** -* vi_asic_pci_config_reset - soft reset GPU -* -* @adev: amdgpu_device pointer -* -* Use PCI Config method to reset the GPU. -* -* Returns 0 for success. -*/ -static int vi_asic_pci_config_reset (struct amdgpu_device *adev) -{ -int r; - -amdgpu_atombios_scratch_regs_engine_hung (adev, true); - - r =vi_gpu_pci_config_reset (adev);amdgpu_atombios_scratch_regs_engine_hung (adev, false);
Signature · 6 lines
2.29.2 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 4/7 drm/amdgpu: add generic pci reset as an option
In reply to Alex DeucherThis allows us to use generic PCI reset mechanisms (FLR, SBR) as a reset mechanism to verify that the generic PCI reset mechanisms are working properly.
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 4 +++- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 12 ++++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 4 ++-- 3 files changed, 17 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +3 -1
@@ -579,7 +579,8 @@ enum amd_reset_method {AMD_RESET_METHOD_MODE0 ,AMD_RESET_METHOD_MODE1 ,AMD_RESET_METHOD_MODE2 , -AMD_RESET_METHOD_BACO +AMD_RESET_METHOD_BACO , + AMD_RESET_METHOD_PCI, }; struct amdgpu_video_codec_info {
@@ -1244,6 +1245,7 @@ bool amdgpu_device_should_recover_gpu(struct amdgpu_device *adev);int amdgpu_device_gpu_recover (struct amdgpu_device *adev,struct amdgpu_job * job);void amdgpu_device_pci_config_reset (struct amdgpu_device *adev); +int amdgpu_device_pci_reset (struct amdgpu_device *adev);bool amdgpu_device_need_post (struct amdgpu_device *adev); void amdgpu_cs_report_moved_bytes(struct amdgpu_device *adev, u64 num_bytes,
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +12 -0
@@ -929,6 +929,18 @@ void amdgpu_device_pci_config_reset(struct amdgpu_device *adev)pci_write_config_dword (adev->pdev,0x7c ,AMDGPU_ASIC_RESET_DATA ); } +/** +* amdgpu_device_pci_reset - reset the GPU using generic PCI means +* +* @adev: amdgpu_device pointer +* +* Resets the GPU using generic pci reset interfaces (FLR, SBR, etc.). +*/ +int amdgpu_device_pci_reset (struct amdgpu_device *adev) +{ +return pci_reset_function (adev->pdev); +} +/* * GPU doorbell aperture helpers function. */
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +2 -2
@@ -791,9 +791,9 @@ module_param_named(tmz, amdgpu_tmz, int, 0444);/** * DOC: reset_method (int) -* GPU reset method (-1 = auto (default), 0 = legacy, 1 = mode0, 2 = mode1, 3 = mode2, 4 = baco) +* GPU reset method (-1 = auto (default), 0 = legacy, 1 = mode0, 2 = mode1, 3 = mode2, 4 = baco, 5 = pci) */ -MODULE_PARM_DESC (reset_method,"GPU reset method (-1 = auto (default), 0 = legacy, 1 = mode0, 2 = mode1, 3 = mode2, 4 = baco/bamaco)" ); +MODULE_PARM_DESC (reset_method,"GPU reset method (-1 = auto (default), 0 = legacy, 1 = mode0, 2 = mode1, 3 = mode2, 4 = baco/bamaco, 5 = pci)" );module_param_named (reset_method, amdgpu_reset_method, int,0444 );/**
Signature · 6 lines
2.29.2 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 5/7 drm/amdgpu/si: add PCI reset support
In reply to Alex DeucherUse generic PCI reset for GPU reset if the user specifies PCI reset as the reset mechanism. This should in general only be used for validation.
--- drivers/gpu/drm/amd/amdgpu/si.c | 37 ++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 14 deletions(-)
drivers/gpu/drm/amd/amdgpu/si.c +23 -14
@@ -1409,17 +1409,6 @@ static int si_gpu_pci_config_reset(struct amdgpu_device *adev)return r; } -static int si_asic_reset (struct amdgpu_device *adev) -{ -int r; - -dev_info (adev->dev,"PCI CONFIG reset\n" ); - - r =si_gpu_pci_config_reset (adev); - -return r; -} -static bool si_asic_supports_baco (struct amdgpu_device *adev) {return false;
@@ -1428,14 +1417,34 @@ static bool si_asic_supports_baco(struct amdgpu_device *adev)static enum amd_reset_method si_asic_reset_method (struct amdgpu_device *adev) { -if (amdgpu_reset_method !=AMD_RESET_METHOD_LEGACY && - amdgpu_reset_method !=-1 ) +if (amdgpu_reset_method ==AMD_RESET_METHOD_PCI ) +return amdgpu_reset_method; +else if (amdgpu_reset_method !=AMD_RESET_METHOD_LEGACY && + amdgpu_reset_method !=-1 )dev_warn (adev->dev,"Specified reset method:%d isn't supported, using AUTO instead.\n" , - amdgpu_reset_method); + amdgpu_reset_method);return AMD_RESET_METHOD_LEGACY ; } +static int si_asic_reset (struct amdgpu_device *adev) +{ +int r; + +switch (si_asic_reset_method (adev)) { +case AMD_RESET_METHOD_PCI : +dev_info (adev->dev,"PCI reset\n" ); + r =amdgpu_device_pci_reset (adev); +break ; +default : +dev_info (adev->dev,"PCI CONFIG reset\n" ); + r =si_gpu_pci_config_reset (adev); +break ; + } + +return r; +} +static u32 si_get_config_memsize (struct amdgpu_device *adev) {return RREG32 (mmCONFIG_MEMSIZE);
Signature · 6 lines
2.29.2 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 6/7 drm/amdgpu/soc15: add PCI reset support
In reply to Alex DeucherUse generic PCI reset for GPU reset if the user specifies PCI reset as the reset mechanism. This should in general only be used for validation.
--- drivers/gpu/drm/amd/amdgpu/soc15.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-)
drivers/gpu/drm/amd/amdgpu/soc15.c +14 -10
@@ -709,7 +709,8 @@ soc15_asic_reset_method(struct amdgpu_device *adev)if (amdgpu_reset_method ==AMD_RESET_METHOD_MODE1 || amdgpu_reset_method ==AMD_RESET_METHOD_MODE2 || - amdgpu_reset_method ==AMD_RESET_METHOD_BACO ) + amdgpu_reset_method ==AMD_RESET_METHOD_BACO || + amdgpu_reset_method ==AMD_RESET_METHOD_PCI )return amdgpu_reset_method;if (amdgpu_reset_method !=-1 )
@@ -754,15 +755,18 @@ static int soc15_asic_reset(struct amdgpu_device *adev)return 0 ;switch (soc15_asic_reset_method (adev)) { -case AMD_RESET_METHOD_BACO : -dev_info (adev->dev,"BACO reset\n" ); -return soc15_asic_baco_reset (adev); -case AMD_RESET_METHOD_MODE2 : -dev_info (adev->dev,"MODE2 reset\n" ); -return amdgpu_dpm_mode2_reset (adev); -default : -dev_info (adev->dev,"MODE1 reset\n" ); -return soc15_asic_mode1_reset (adev); +case AMD_RESET_METHOD_PCI : +dev_info (adev->dev,"PCI reset\n" ); +return amdgpu_device_pci_reset (adev); +case AMD_RESET_METHOD_BACO : +dev_info (adev->dev,"BACO reset\n" ); +return soc15_asic_baco_reset (adev); +case AMD_RESET_METHOD_MODE2 : +dev_info (adev->dev,"MODE2 reset\n" ); +return amdgpu_dpm_mode2_reset (adev); +default : +dev_info (adev->dev,"MODE1 reset\n" ); +return soc15_asic_mode1_reset (adev); } }
Signature · 6 lines
2.29.2 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 7/7 drm/amdgpu/nv: add PCI reset support
In reply to Alex DeucherUse generic PCI reset for GPU reset if the user specifies PCI reset as the reset mechanism. This should in general only be used for validation.
--- drivers/gpu/drm/amd/amdgpu/nv.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/nv.c +6 -1
@@ -564,7 +564,8 @@ nv_asic_reset_method(struct amdgpu_device *adev)if (amdgpu_reset_method ==AMD_RESET_METHOD_MODE1 || amdgpu_reset_method ==AMD_RESET_METHOD_MODE2 || - amdgpu_reset_method ==AMD_RESET_METHOD_BACO ) + amdgpu_reset_method ==AMD_RESET_METHOD_BACO || + amdgpu_reset_method ==AMD_RESET_METHOD_PCI )return amdgpu_reset_method;if (amdgpu_reset_method !=-1 )
@@ -596,6 +597,10 @@ static int nv_asic_reset(struct amdgpu_device *adev)return 0 ;switch (nv_asic_reset_method (adev)) { +case AMD_RESET_METHOD_PCI : +dev_info (adev->dev,"PCI reset\n" ); + ret =amdgpu_device_pci_reset (adev); +break ;case AMD_RESET_METHOD_BACO :dev_info (adev->dev,"BACO reset\n" );
Signature · 6 lines
2.29.2 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
RE: [PATCH 7/7] drm/amdgpu/nv: add PCI reset support
[AMD Official Use Only - Internal Distribution Only]
Series is acked-by: Evan Quan <[email protected]>
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Alex Deucher
Sent: Friday, February 5, 2021 2:47 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: [PATCH 7/7] drm/amdgpu/nv: add PCI reset support
Use generic PCI reset for GPU reset if the user specifies PCI reset as the reset mechanism. This should in general only be used for validation.
--- drivers/gpu/drm/amd/amdgpu/nv.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/nv.c +6 -1
@@ -564,7 +564,8 @@ nv_asic_reset_method(struct amdgpu_device *adev)if (amdgpu_reset_method ==AMD_RESET_METHOD_MODE1 || amdgpu_reset_method ==AMD_RESET_METHOD_MODE2 || - amdgpu_reset_method ==AMD_RESET_METHOD_BACO ) + amdgpu_reset_method ==AMD_RESET_METHOD_BACO || + amdgpu_reset_method ==AMD_RESET_METHOD_PCI )return amdgpu_reset_method;if (amdgpu_reset_method !=-1 )
@@ -596,6 +597,10 @@ static int nv_asic_reset(struct amdgpu_device *adev)return 0 ;switch (nv_asic_reset_method (adev)) { +case AMD_RESET_METHOD_PCI : +dev_info (adev->dev,"PCI reset\n" ); +ret =amdgpu_device_pci_reset (adev); +break ;case AMD_RESET_METHOD_BACO :dev_info (adev->dev,"BACO reset\n" );
--
2.29.2
_______________________________________________
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%7Cevan.quan%40amd.com%7C6b300fc57a984e5e0b3908d8c93d4f31%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637480612452615567%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=uRNSs4Oil%2Ff14MQFnbRYw%2Fic7Trk77eyesIppwQx37k%3D&reserved=0
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx