From: jsg Date: Wed, 27 Mar 2024 04:27:17 +0000 (+0000) Subject: drm/amdgpu: Enable gpu reset for S3 abort cases on Raven series X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=e4435d5d7fda6172f859d49f385970c818120d4f;p=openbsd drm/amdgpu: Enable gpu reset for S3 abort cases on Raven series From Prike Liang b5f085b46f0e9482f5035f798b402d1ad7ee8e3c in linux-6.6.y/6.6.23 c671ec01311b4744b377f98b0b4c6d033fe569b3 in mainline linux --- diff --git a/sys/dev/pci/drm/amd/amdgpu/soc15.c b/sys/dev/pci/drm/amd/amdgpu/soc15.c index 408c053a32c..9ce6e30ac94 100644 --- a/sys/dev/pci/drm/amd/amdgpu/soc15.c +++ b/sys/dev/pci/drm/amd/amdgpu/soc15.c @@ -574,11 +574,34 @@ soc15_asic_reset_method(struct amdgpu_device *adev) return AMD_RESET_METHOD_MODE1; } +static bool soc15_need_reset_on_resume(struct amdgpu_device *adev) +{ + u32 sol_reg; + + sol_reg = RREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_81); + + /* Will reset for the following suspend abort cases. + * 1) Only reset limit on APU side, dGPU hasn't checked yet. + * 2) S3 suspend abort and TOS already launched. + */ + if (adev->flags & AMD_IS_APU && adev->in_s3 && + !adev->suspend_complete && + sol_reg) + return true; + + return false; +} + static int soc15_asic_reset(struct amdgpu_device *adev) { /* original raven doesn't have full asic reset */ - if ((adev->apu_flags & AMD_APU_IS_RAVEN) || - (adev->apu_flags & AMD_APU_IS_RAVEN2)) + /* On the latest Raven, the GPU reset can be performed + * successfully. So now, temporarily enable it for the + * S3 suspend abort case. + */ + if (((adev->apu_flags & AMD_APU_IS_RAVEN) || + (adev->apu_flags & AMD_APU_IS_RAVEN2)) && + !soc15_need_reset_on_resume(adev)) return 0; switch (soc15_asic_reset_method(adev)) { @@ -1296,24 +1319,6 @@ static int soc15_common_suspend(void *handle) return soc15_common_hw_fini(adev); } -static bool soc15_need_reset_on_resume(struct amdgpu_device *adev) -{ - u32 sol_reg; - - sol_reg = RREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_81); - - /* Will reset for the following suspend abort cases. - * 1) Only reset limit on APU side, dGPU hasn't checked yet. - * 2) S3 suspend abort and TOS already launched. - */ - if (adev->flags & AMD_IS_APU && adev->in_s3 && - !adev->suspend_complete && - sol_reg) - return true; - - return false; -} - static int soc15_common_resume(void *handle) { struct amdgpu_device *adev = (struct amdgpu_device *)handle;