From: Hawking Zhang <[email protected]>

Query xgmi info from mmhub if available

Signed-off-by: Hawking Zhang <[email protected]>
Reviewed-by: Le Ma <[email protected]>
Reviewed-by: Feifei Xu <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index 8c0d54796155a..97a51429ab771 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -3876,9 +3876,21 @@ int amdgpu_device_init(struct amdgpu_device *adev,
        amdgpu_gmc_noretry_set(adev);
        /* Need to get xgmi info early to decide the reset behavior*/
        if (adev->gmc.xgmi.supported) {
-               r = adev->gfxhub.funcs->get_xgmi_info(adev);
-               if (r)
-                       return r;
+               if (adev->gfxhub.funcs &&
+                   adev->gfxhub.funcs->get_xgmi_info) {
+                       r = adev->gfxhub.funcs->get_xgmi_info(adev);
+                       if (r)
+                               return r;
+               }
+       }
+
+       if (adev->gmc.xgmi.connected_to_cpu) {
+               if (adev->mmhub.funcs &&
+                   adev->mmhub.funcs->get_xgmi_info) {
+                       r = adev->mmhub.funcs->get_xgmi_info(adev);
+                       if (r)
+                               return r;
+               }
        }
 
        /* enable PCIE atomic ops */
-- 
2.53.0

Reply via email to