drm/amdgpu: Add a check to avoid panic because of unexpected irqs
authorxinhui pan <xinhui.pan@amd.com>
Tue, 9 Apr 2019 08:53:08 +0000 (16:53 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 10 Apr 2019 18:49:40 +0000 (13:49 -0500)
IP initialize ras in late_init, because of the BUGs of PSP or any
other components, driver receives unexpected irqs. It is ok to add such
check anyway.

Signed-off-by: xinhui pan <xinhui.pan@amd.com>
Reviewed-by: Evan Quan <evan.quan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c

index 58f5b1015de191372f8cdf0d3bafca85fcf85006..107756dd1b256a34ed4266c1847638fb879adbc8 100644 (file)
@@ -4840,10 +4840,16 @@ static int gfx_v9_0_cp_ecc_error_irq(struct amdgpu_device *adev,
                                  struct amdgpu_irq_src *source,
                                  struct amdgpu_iv_entry *entry)
 {
+       struct ras_common_if *ras_if = adev->gfx.ras_if;
        struct ras_dispatch_if ih_data = {
-               .head = *adev->gfx.ras_if,
                .entry = entry,
        };
+
+       if (!ras_if)
+               return 0;
+
+       ih_data.head = *ras_if;
+
        DRM_ERROR("CP ECC ERROR IRQ\n");
        amdgpu_ras_interrupt_dispatch(adev, &ih_data);
        return 0;
index f7de53335804a271945d9cb3a1c0902ab9729ceb..3fd79e07944db131d0b6a2b8e9a004e8b44e0528 100644 (file)
@@ -248,10 +248,16 @@ static int gmc_v9_0_process_ecc_irq(struct amdgpu_device *adev,
                struct amdgpu_irq_src *source,
                struct amdgpu_iv_entry *entry)
 {
+       struct ras_common_if *ras_if = adev->gmc.ras_if;
        struct ras_dispatch_if ih_data = {
-               .head = *adev->gmc.ras_if,
                .entry = entry,
        };
+
+       if (!ras_if)
+               return 0;
+
+       ih_data.head = *ras_if;
+
        amdgpu_ras_interrupt_dispatch(adev, &ih_data);
        return 0;
 }
index 31d5b3fdd5cd5747442a40abae47bbb517012f8d..1ec60f54b992e628575a3dc3227197749ea18dd2 100644 (file)
@@ -1865,10 +1865,16 @@ static int sdma_v4_0_process_ecc_irq(struct amdgpu_device *adev,
                                      struct amdgpu_irq_src *source,
                                      struct amdgpu_iv_entry *entry)
 {
+       struct ras_common_if *ras_if = adev->sdma.ras_if;
        struct ras_dispatch_if ih_data = {
-               .head = *adev->sdma.ras_if,
                .entry = entry,
        };
+
+       if (!ras_if)
+               return 0;
+
+       ih_data.head = *ras_if;
+
        amdgpu_ras_interrupt_dispatch(adev, &ih_data);
        return 0;
 }