amd-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/amdgpu: Don't resume IOMMU after incomplete init
@ 2023-03-14 17:53 Felix Kuehling
  2023-03-14 18:12 ` Alex Deucher
  0 siblings, 1 reply; 2+ messages in thread
From: Felix Kuehling @ 2023-03-14 17:53 UTC (permalink / raw)
  To: amd-gfx; +Cc: Linux regression tracking, Vasant Hegde, stable

Check kfd->init_complete in kgd2kfd_iommu_resume, consistent with other
kgd2kfd calls. This should fix IOMMU errors on resume from suspend when
KFD IOMMU initialization failed.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=217170
Link: https://gitlab.freedesktop.org/drm/amd/-/issues/2454
Cc: Vasant Hegde <vasant.hegde@amd.com>
Cc: Linux regression tracking (Thorsten Leemhuis) <regressions@leemhuis.info>
Cc: stable@vger.kernel.org
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
---
 drivers/gpu/drm/amd/amdkfd/kfd_device.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device.c b/drivers/gpu/drm/amd/amdkfd/kfd_device.c
index 521dfa88aad8..989c6aa2620b 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_device.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_device.c
@@ -60,6 +60,7 @@ static int kfd_gtt_sa_init(struct kfd_dev *kfd, unsigned int buf_size,
 				unsigned int chunk_size);
 static void kfd_gtt_sa_fini(struct kfd_dev *kfd);
 
+static int kfd_resume_iommu(struct kfd_dev *kfd);
 static int kfd_resume(struct kfd_dev *kfd);
 
 static void kfd_device_info_set_sdma_info(struct kfd_dev *kfd)
@@ -625,7 +626,7 @@ bool kgd2kfd_device_init(struct kfd_dev *kfd,
 
 	svm_migrate_init(kfd->adev);
 
-	if (kgd2kfd_resume_iommu(kfd))
+	if (kfd_resume_iommu(kfd))
 		goto device_iommu_error;
 
 	if (kfd_resume(kfd))
@@ -773,6 +774,14 @@ int kgd2kfd_resume(struct kfd_dev *kfd, bool run_pm)
 }
 
 int kgd2kfd_resume_iommu(struct kfd_dev *kfd)
+{
+	if (!kfd->init_complete)
+		return 0;
+
+	return kfd_resume_iommu(kfd);
+}
+
+static int kfd_resume_iommu(struct kfd_dev *kfd)
 {
 	int err = 0;
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] drm/amdgpu: Don't resume IOMMU after incomplete init
  2023-03-14 17:53 [PATCH] drm/amdgpu: Don't resume IOMMU after incomplete init Felix Kuehling
@ 2023-03-14 18:12 ` Alex Deucher
  0 siblings, 0 replies; 2+ messages in thread
From: Alex Deucher @ 2023-03-14 18:12 UTC (permalink / raw)
  To: Felix Kuehling; +Cc: stable, Linux regression tracking, Vasant Hegde, amd-gfx

On Tue, Mar 14, 2023 at 1:54 PM Felix Kuehling <Felix.Kuehling@amd.com> wrote:
>
> Check kfd->init_complete in kgd2kfd_iommu_resume, consistent with other
> kgd2kfd calls. This should fix IOMMU errors on resume from suspend when
> KFD IOMMU initialization failed.
>
> Link: https://bugzilla.kernel.org/show_bug.cgi?id=217170
> Link: https://gitlab.freedesktop.org/drm/amd/-/issues/2454
> Cc: Vasant Hegde <vasant.hegde@amd.com>
> Cc: Linux regression tracking (Thorsten Leemhuis) <regressions@leemhuis.info>
> Cc: stable@vger.kernel.org
> Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>

Acked-by: Alex Deucher <alexander.deucher@amd.com>

> ---
>  drivers/gpu/drm/amd/amdkfd/kfd_device.c | 11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device.c b/drivers/gpu/drm/amd/amdkfd/kfd_device.c
> index 521dfa88aad8..989c6aa2620b 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_device.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_device.c
> @@ -60,6 +60,7 @@ static int kfd_gtt_sa_init(struct kfd_dev *kfd, unsigned int buf_size,
>                                 unsigned int chunk_size);
>  static void kfd_gtt_sa_fini(struct kfd_dev *kfd);
>
> +static int kfd_resume_iommu(struct kfd_dev *kfd);
>  static int kfd_resume(struct kfd_dev *kfd);
>
>  static void kfd_device_info_set_sdma_info(struct kfd_dev *kfd)
> @@ -625,7 +626,7 @@ bool kgd2kfd_device_init(struct kfd_dev *kfd,
>
>         svm_migrate_init(kfd->adev);
>
> -       if (kgd2kfd_resume_iommu(kfd))
> +       if (kfd_resume_iommu(kfd))
>                 goto device_iommu_error;
>
>         if (kfd_resume(kfd))
> @@ -773,6 +774,14 @@ int kgd2kfd_resume(struct kfd_dev *kfd, bool run_pm)
>  }
>
>  int kgd2kfd_resume_iommu(struct kfd_dev *kfd)
> +{
> +       if (!kfd->init_complete)
> +               return 0;
> +
> +       return kfd_resume_iommu(kfd);
> +}
> +
> +static int kfd_resume_iommu(struct kfd_dev *kfd)
>  {
>         int err = 0;
>
> --
> 2.34.1
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-03-14 18:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-14 17:53 [PATCH] drm/amdgpu: Don't resume IOMMU after incomplete init Felix Kuehling
2023-03-14 18:12 ` Alex Deucher

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).