drm/amdgpu: implement common gmc_ras_late_init
authorTao Zhou <tao.zhou1@amd.com>
Wed, 18 Sep 2019 10:31:07 +0000 (18:31 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 3 Oct 2019 14:11:03 +0000 (09:11 -0500)
common gmc_ecc_late_init can be shared among all generations of gmc

v2: rename gmc_ecc_late_init to gmc_ras_late_init

Signed-off-by: Tao Zhou <tao.zhou1@amd.com>
Reviewed-by: Guchun Chen <guchun.chen@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c

index bf3c4bc793e2a898b39c30ba5d84c1a9ab9c032f..a12f33c0f5df0d15e4295f8a6f072c5a03ad0c9a 100644 (file)
@@ -308,6 +308,25 @@ bool amdgpu_gmc_filter_faults(struct amdgpu_device *adev, uint64_t addr,
        return false;
 }
 
+int amdgpu_gmc_ras_late_init(struct amdgpu_device *adev)
+{
+       int r;
+
+       if (adev->umc.funcs && adev->umc.funcs->ras_late_init) {
+               r = adev->umc.funcs->ras_late_init(adev);
+               if (r)
+                       return r;
+       }
+
+       if (adev->mmhub.funcs && adev->mmhub.funcs->ras_late_init) {
+               r = adev->mmhub.funcs->ras_late_init(adev);
+               if (r)
+                       return r;
+       }
+
+       return amdgpu_xgmi_ras_late_init(adev);
+}
+
 void amdgpu_gmc_ras_fini(struct amdgpu_device *adev)
 {
        amdgpu_umc_ras_fini(adev);
index 41edd86efe73a1cb60dfc1827ced2baf6e276d38..d591b375d1df4dfc433220466e58986e09626e80 100644 (file)
@@ -233,6 +233,7 @@ void amdgpu_gmc_agp_location(struct amdgpu_device *adev,
                             struct amdgpu_gmc *mc);
 bool amdgpu_gmc_filter_faults(struct amdgpu_device *adev, uint64_t addr,
                              uint16_t pasid, uint64_t timestamp);
+int amdgpu_gmc_ras_late_init(struct amdgpu_device *adev);
 void amdgpu_gmc_ras_fini(struct amdgpu_device *adev);
 
 #endif
index bf7929499f0a85ef0ec39f166f4e0828e33a9581..2d566fe101490d143e85a52f1fdb3757b10ad141 100644 (file)
@@ -736,26 +736,6 @@ static int gmc_v9_0_allocate_vm_inv_eng(struct amdgpu_device *adev)
        return 0;
 }
 
-static int gmc_v9_0_ecc_late_init(void *handle)
-{
-       int r;
-       struct amdgpu_device *adev = (struct amdgpu_device *)handle;
-
-       if (adev->umc.funcs && adev->umc.funcs->ras_late_init) {
-               r = adev->umc.funcs->ras_late_init(adev);
-               if (r)
-                       return r;
-       }
-
-       if (adev->mmhub.funcs && adev->mmhub.funcs->ras_late_init) {
-               r = adev->mmhub.funcs->ras_late_init(adev);
-               if (r)
-                       return r;
-       }
-
-       return amdgpu_xgmi_ras_late_init(adev);
-}
-
 static int gmc_v9_0_late_init(void *handle)
 {
        struct amdgpu_device *adev = (struct amdgpu_device *)handle;
@@ -793,7 +773,7 @@ static int gmc_v9_0_late_init(void *handle)
                }
        }
 
-       r = gmc_v9_0_ecc_late_init(handle);
+       r = amdgpu_gmc_ras_late_init(adev);
        if (r)
                return r;