* [PATCH AUTOSEL 5.15 3/5] drm/amdgpu: Enable gpu reset for S3 abort cases on Raven series [not found] <20240311151424.318621-1-sashal@kernel.org> @ 2024-03-11 15:14 ` Sasha Levin 2024-03-13 20:03 ` Felix Kuehling 0 siblings, 1 reply; 4+ messages in thread From: Sasha Levin @ 2024-03-11 15:14 UTC (permalink / raw) To: linux-kernel, stable Cc: Prike Liang, Alex Deucher, Sasha Levin, christian.koenig, Xinhui.Pan, airlied, daniel, Hawking.Zhang, lijo.lazar, le.ma, James.Zhu, shane.xiao, sonny.jiang, amd-gfx, dri-devel From: Prike Liang <Prike.Liang@amd.com> [ Upstream commit c671ec01311b4744b377f98b0b4c6d033fe569b3 ] Currently, GPU resets can now be performed successfully on the Raven series. While GPU reset is required for the S3 suspend abort case. So now can enable gpu reset for S3 abort cases on the Raven series. Signed-off-by: Prike Liang <Prike.Liang@amd.com> Acked-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Sasha Levin <sashal@kernel.org> --- drivers/gpu/drm/amd/amdgpu/soc15.c | 45 +++++++++++++++++------------- 1 file changed, 25 insertions(+), 20 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/soc15.c b/drivers/gpu/drm/amd/amdgpu/soc15.c index 6a3486f52d698..ef5b3eedc8615 100644 --- a/drivers/gpu/drm/amd/amdgpu/soc15.c +++ b/drivers/gpu/drm/amd/amdgpu/soc15.c @@ -605,11 +605,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)) { @@ -1490,24 +1513,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; -- 2.43.0 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH AUTOSEL 5.15 3/5] drm/amdgpu: Enable gpu reset for S3 abort cases on Raven series 2024-03-11 15:14 ` [PATCH AUTOSEL 5.15 3/5] drm/amdgpu: Enable gpu reset for S3 abort cases on Raven series Sasha Levin @ 2024-03-13 20:03 ` Felix Kuehling 2024-03-13 20:46 ` Alex Deucher 0 siblings, 1 reply; 4+ messages in thread From: Felix Kuehling @ 2024-03-13 20:03 UTC (permalink / raw) To: Sasha Levin, linux-kernel, stable Cc: Prike Liang, Alex Deucher, christian.koenig, Xinhui.Pan, airlied, daniel, Hawking.Zhang, lijo.lazar, le.ma, James.Zhu, shane.xiao, sonny.jiang, amd-gfx, dri-devel On 2024-03-11 11:14, Sasha Levin wrote: > From: Prike Liang <Prike.Liang@amd.com> > > [ Upstream commit c671ec01311b4744b377f98b0b4c6d033fe569b3 ] > > Currently, GPU resets can now be performed successfully on the Raven > series. While GPU reset is required for the S3 suspend abort case. > So now can enable gpu reset for S3 abort cases on the Raven series. This looks suspicious to me. I'm not sure what conditions made the GPU reset successful. But unless all the changes involved were also backported, this should probably not be applied to older kernel branches. I'm speculating it may be related to the removal of AMD IOMMUv2. Regards, Felix > > Signed-off-by: Prike Liang <Prike.Liang@amd.com> > Acked-by: Alex Deucher <alexander.deucher@amd.com> > Signed-off-by: Alex Deucher <alexander.deucher@amd.com> > Signed-off-by: Sasha Levin <sashal@kernel.org> > --- > drivers/gpu/drm/amd/amdgpu/soc15.c | 45 +++++++++++++++++------------- > 1 file changed, 25 insertions(+), 20 deletions(-) > > diff --git a/drivers/gpu/drm/amd/amdgpu/soc15.c b/drivers/gpu/drm/amd/amdgpu/soc15.c > index 6a3486f52d698..ef5b3eedc8615 100644 > --- a/drivers/gpu/drm/amd/amdgpu/soc15.c > +++ b/drivers/gpu/drm/amd/amdgpu/soc15.c > @@ -605,11 +605,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)) { > @@ -1490,24 +1513,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; ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH AUTOSEL 5.15 3/5] drm/amdgpu: Enable gpu reset for S3 abort cases on Raven series 2024-03-13 20:03 ` Felix Kuehling @ 2024-03-13 20:46 ` Alex Deucher 2024-03-14 3:00 ` Liang, Prike 0 siblings, 1 reply; 4+ messages in thread From: Alex Deucher @ 2024-03-13 20:46 UTC (permalink / raw) To: Felix Kuehling Cc: Sasha Levin, linux-kernel, stable, Prike Liang, Alex Deucher, christian.koenig, Xinhui.Pan, airlied, daniel, Hawking.Zhang, lijo.lazar, le.ma, James.Zhu, shane.xiao, sonny.jiang, amd-gfx, dri-devel On Wed, Mar 13, 2024 at 4:12 PM Felix Kuehling <felix.kuehling@amd.com> wrote: > > On 2024-03-11 11:14, Sasha Levin wrote: > > From: Prike Liang <Prike.Liang@amd.com> > > > > [ Upstream commit c671ec01311b4744b377f98b0b4c6d033fe569b3 ] > > > > Currently, GPU resets can now be performed successfully on the Raven > > series. While GPU reset is required for the S3 suspend abort case. > > So now can enable gpu reset for S3 abort cases on the Raven series. > > This looks suspicious to me. I'm not sure what conditions made the GPU > reset successful. But unless all the changes involved were also > backported, this should probably not be applied to older kernel > branches. I'm speculating it may be related to the removal of AMD IOMMUv2. > We should get confirmation from Prike, but I think he tested this on older kernels as well. Alex > Regards, > Felix > > > > > > Signed-off-by: Prike Liang <Prike.Liang@amd.com> > > Acked-by: Alex Deucher <alexander.deucher@amd.com> > > Signed-off-by: Alex Deucher <alexander.deucher@amd.com> > > Signed-off-by: Sasha Levin <sashal@kernel.org> > > --- > > drivers/gpu/drm/amd/amdgpu/soc15.c | 45 +++++++++++++++++------------- > > 1 file changed, 25 insertions(+), 20 deletions(-) > > > > diff --git a/drivers/gpu/drm/amd/amdgpu/soc15.c b/drivers/gpu/drm/amd/amdgpu/soc15.c > > index 6a3486f52d698..ef5b3eedc8615 100644 > > --- a/drivers/gpu/drm/amd/amdgpu/soc15.c > > +++ b/drivers/gpu/drm/amd/amdgpu/soc15.c > > @@ -605,11 +605,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)) { > > @@ -1490,24 +1513,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; ^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [PATCH AUTOSEL 5.15 3/5] drm/amdgpu: Enable gpu reset for S3 abort cases on Raven series 2024-03-13 20:46 ` Alex Deucher @ 2024-03-14 3:00 ` Liang, Prike 0 siblings, 0 replies; 4+ messages in thread From: Liang, Prike @ 2024-03-14 3:00 UTC (permalink / raw) To: Alex Deucher, Kuehling, Felix Cc: Sasha Levin, linux-kernel@vger.kernel.org, stable@vger.kernel.org, Deucher, Alexander, Koenig, Christian, Pan, Xinhui, airlied@gmail.com, daniel@ffwll.ch, Zhang, Hawking, Lazar, Lijo, Ma, Le, Zhu, James, Xiao, Shane, Jiang, Sonny, amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org [AMD Official Use Only - General] > From: Alex Deucher <alexdeucher@gmail.com> > Sent: Thursday, March 14, 2024 4:46 AM > To: Kuehling, Felix <Felix.Kuehling@amd.com> > Cc: Sasha Levin <sashal@kernel.org>; linux-kernel@vger.kernel.org; > stable@vger.kernel.org; Liang, Prike <Prike.Liang@amd.com>; Deucher, > Alexander <Alexander.Deucher@amd.com>; Koenig, Christian > <Christian.Koenig@amd.com>; Pan, Xinhui <Xinhui.Pan@amd.com>; > airlied@gmail.com; daniel@ffwll.ch; Zhang, Hawking > <Hawking.Zhang@amd.com>; Lazar, Lijo <Lijo.Lazar@amd.com>; Ma, Le > <Le.Ma@amd.com>; Zhu, James <James.Zhu@amd.com>; Xiao, Shane > <shane.xiao@amd.com>; Jiang, Sonny <Sonny.Jiang@amd.com>; amd- > gfx@lists.freedesktop.org; dri-devel@lists.freedesktop.org > Subject: Re: [PATCH AUTOSEL 5.15 3/5] drm/amdgpu: Enable gpu reset for S3 > abort cases on Raven series > > On Wed, Mar 13, 2024 at 4:12 PM Felix Kuehling <felix.kuehling@amd.com> > wrote: > > > > On 2024-03-11 11:14, Sasha Levin wrote: > > > From: Prike Liang <Prike.Liang@amd.com> > > > > > > [ Upstream commit c671ec01311b4744b377f98b0b4c6d033fe569b3 ] > > > > > > Currently, GPU resets can now be performed successfully on the Raven > > > series. While GPU reset is required for the S3 suspend abort case. > > > So now can enable gpu reset for S3 abort cases on the Raven series. > > > > This looks suspicious to me. I'm not sure what conditions made the GPU > > reset successful. But unless all the changes involved were also > > backported, this should probably not be applied to older kernel > > branches. I'm speculating it may be related to the removal of AMD > IOMMUv2. > > > > We should get confirmation from Prike, but I think he tested this on older > kernels as well. > > Alex > > > Regards, > > Felix > > The Raven/Raven2 series GPU reset function was enabled in some older kernel versions such as 5.5 but filtered out in more recent kernel driver versions. Therefore, this patch only applies to the latest kernel version, and it should be safe without affecting other cases by enabling the Raven GPU reset only on the S3 suspend abort case. From the Chrome kernel log indicating that the AMD IOMMUv2 driver is loaded, and with this patch triggering the GPU reset before the AMDGPU device reinitialization, it can effectively handle the S3 suspend abort resume problem on the Raven series. Was the Raven GPU reset previously disabled due to the AMD IOMMUv2 driver? If so, based on the Chromebook's verification result, the Raven series GPU reset can probably be enabled with IOMMUv2 for other cases as well. Thanks, Prike > > > > > > > > Signed-off-by: Prike Liang <Prike.Liang@amd.com> > > > Acked-by: Alex Deucher <alexander.deucher@amd.com> > > > Signed-off-by: Alex Deucher <alexander.deucher@amd.com> > > > Signed-off-by: Sasha Levin <sashal@kernel.org> > > > --- > > > drivers/gpu/drm/amd/amdgpu/soc15.c | 45 +++++++++++++++++---------- > --- > > > 1 file changed, 25 insertions(+), 20 deletions(-) > > > > > > diff --git a/drivers/gpu/drm/amd/amdgpu/soc15.c > > > b/drivers/gpu/drm/amd/amdgpu/soc15.c > > > index 6a3486f52d698..ef5b3eedc8615 100644 > > > --- a/drivers/gpu/drm/amd/amdgpu/soc15.c > > > +++ b/drivers/gpu/drm/amd/amdgpu/soc15.c > > > @@ -605,11 +605,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)) { @@ -1490,24 +1513,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; ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-03-14 3:00 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20240311151424.318621-1-sashal@kernel.org>
2024-03-11 15:14 ` [PATCH AUTOSEL 5.15 3/5] drm/amdgpu: Enable gpu reset for S3 abort cases on Raven series Sasha Levin
2024-03-13 20:03 ` Felix Kuehling
2024-03-13 20:46 ` Alex Deucher
2024-03-14 3:00 ` Liang, Prike
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox