From: jsg Date: Tue, 28 Mar 2023 04:16:38 +0000 (+0000) Subject: drm/amdgpu: Don't resume IOMMU after incomplete init X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=97e678565b45080d7d87d30e3da624b2df9b81f1;p=openbsd drm/amdgpu: Don't resume IOMMU after incomplete init From Felix Kuehling dab920478e2b53d1abcf9b929f8205233041d32a in linux-6.1.y/6.1.21 f3921a9a641483784448fb982b2eb738b383d9b9 in mainline linux --- diff --git a/sys/dev/pci/drm/amd/amdkfd/kfd_device.c b/sys/dev/pci/drm/amd/amdkfd/kfd_device.c index 65a1d4f9004..a75e1af7736 100644 --- a/sys/dev/pci/drm/amd/amdkfd/kfd_device.c +++ b/sys/dev/pci/drm/amd/amdkfd/kfd_device.c @@ -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;