drm/amdgpu: add a xgmi supported flag
authorAlex Deucher <alexander.deucher@amd.com>
Fri, 30 Nov 2018 20:29:43 +0000 (15:29 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 3 Dec 2018 16:14:39 +0000 (11:14 -0500)
Use this to track whether an asic supports xgmi rather than
checking the asic type everywhere.

Reviewed-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
drivers/gpu/drm/amd/amdgpu/soc15.c

index 8c57924..81e6070 100644 (file)
@@ -99,6 +99,7 @@ struct amdgpu_xgmi {
        unsigned num_physical_nodes;
        /* gpu list in the same hive */
        struct list_head head;
+       bool supported;
 };
 
 struct amdgpu_gmc {
index fb37e69..f8c86d0 100644 (file)
@@ -94,9 +94,9 @@ int amdgpu_xgmi_add_device(struct amdgpu_device *adev)
 
        int count = 0, ret = -EINVAL;
 
-       if ((adev->asic_type < CHIP_VEGA20) ||
-               (adev->flags & AMD_IS_APU) )
+       if (!adev->gmc.xgmi.supported)
                return 0;
+
        adev->gmc.xgmi.node_id = psp_xgmi_get_node_id(&adev->psp);
        adev->gmc.xgmi.hive_id = psp_xgmi_get_hive_id(&adev->psp);
 
index 3a4e5d8..ed3145b 100644 (file)
@@ -934,7 +934,7 @@ static int gmc_v9_0_sw_init(void *handle)
        }
        adev->need_swiotlb = drm_get_max_iomem() > ((u64)1 << dma_bits);
 
-       if (adev->asic_type == CHIP_VEGA20) {
+       if (adev->gmc.xgmi.supported) {
                r = gfxhub_v1_1_get_xgmi_info(adev);
                if (r)
                        return r;
index b318950..f2cd87d 100644 (file)
@@ -500,6 +500,9 @@ int soc15_set_ip_blocks(struct amdgpu_device *adev)
                return -EINVAL;
        }
 
+       if (adev->asic_type == CHIP_VEGA20)
+               adev->gmc.xgmi.supported = true;
+
        if (adev->flags & AMD_IS_APU)
                adev->nbio_funcs = &nbio_v7_0_funcs;
        else if (adev->asic_type == CHIP_VEGA20)