<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body>
    <div class="moz-cite-prefix">
      <pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Reviewed-by:<span style=" color:#c0c0c0;"> </span>James<span style=" color:#c0c0c0;"> </span>Zhu<span style=" color:#c0c0c0;"> </span><a class="moz-txt-link-rfc2396E" href="mailto:James.Zhu@amd.com"><James.Zhu@amd.com></a><span style=" color:#c0c0c0;"> </span><span style=" color:#ff9d04;">for</span><span style=" color:#c0c0c0;"> </span>the<span style=" color:#c0c0c0;"> </span>series.<span style=" color:#c0c0c0;"> 

</span></pre>
      <style type="text/css">p, li { white-space: pre-wrap; }</style></div>
    <blockquote type="cite" cite="mid:20211013061604.3404343-1-yifan1.zhang@amd.com">
      <pre class="moz-quote-pre" wrap="">When IOMMU disabled in sbios and kfd in iommuv2 path, iommuv2
init will fail. But this failure should not block amdgpu driver init.

Reported-by: youling <a class="moz-txt-link-rfc2396E" href="mailto:youling257@gmail.com"><youling257@gmail.com></a>
Tested-by: youling <a class="moz-txt-link-rfc2396E" href="mailto:youling257@gmail.com"><youling257@gmail.com></a>
Signed-off-by: Yifan Zhang <a class="moz-txt-link-rfc2396E" href="mailto:yifan1.zhang@amd.com"><yifan1.zhang@amd.com></a>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 4 ----
 drivers/gpu/drm/amd/amdkfd/kfd_device.c    | 3 +++
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index 52b24334a19e..ef467216ff8a 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -2397,10 +2397,6 @@ static int amdgpu_device_ip_init(struct amdgpu_device *adev)
        if (!adev->gmc.xgmi.pending_reset)
                amdgpu_amdkfd_device_init(adev);
 
-       r = amdgpu_amdkfd_resume_iommu(adev);
-       if (r)
-               goto init_failed;
-
        amdgpu_fru_get_product_info(adev);
 
 init_failed:
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device.c b/drivers/gpu/drm/amd/amdkfd/kfd_device.c
index 064d42acd54e..08eedbc6699d 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_device.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_device.c
@@ -1029,6 +1029,9 @@ bool kgd2kfd_device_init(struct kfd_dev *kfd,
 
        svm_migrate_init((struct amdgpu_device *)kfd->kgd);
 
+       if(kgd2kfd_resume_iommu(kfd))
+               goto device_iommu_error;
+
        if (kfd_resume(kfd))
                goto kfd_resume_error;
 
</pre>
    </blockquote>
  </body>
</html>