drm/amdgpu: Don't resume IOMMU after incomplete init
authorjsg <jsg@openbsd.org>
Tue, 28 Mar 2023 04:16:38 +0000 (04:16 +0000)
committerjsg <jsg@openbsd.org>
Tue, 28 Mar 2023 04:16:38 +0000 (04:16 +0000)
From Felix Kuehling
dab920478e2b53d1abcf9b929f8205233041d32a in linux-6.1.y/6.1.21
f3921a9a641483784448fb982b2eb738b383d9b9 in mainline linux

sys/dev/pci/drm/amd/amdkfd/kfd_device.c

index 65a1d4f..a75e1af 100644 (file)
@@ -59,6 +59,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)
@@ -634,7 +635,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))
@@ -782,6 +783,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;