Reviewed-by: Hawking Zhang <hawking.zh...@amd.com>

Regards,
Hawking
-----Original Message-----
From: Pan, Xinhui <xinhui....@amd.com> 
Sent: 2019年3月7日 11:35
To: amd-gfx@lists.freedesktop.org
Cc: Zhang, Hawking <hawking.zh...@amd.com>; Xu, Feifei <feifei...@amd.com>; 
Deucher, Alexander <alexander.deuc...@amd.com>
Subject: [PATCH] drm/amdgpu: handle ras resume

Suspend will put irq, so resume need get irq back.
And in the same time, skip other ras initialization.

Signed-off-by: xinhui pan <xinhui....@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c  | 5 ++++-  
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c  | 5 ++++-  
drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c | 6 +++++-
 3 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c 
b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
index dcdd53a701bf..3fb72bf420e0 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
@@ -3553,6 +3553,9 @@ static int gfx_v9_0_ecc_late_init(void *handle)
                return 0;
        }
 
+       if (*ras_if)
+               goto resume;
+
        *ras_if = kmalloc(sizeof(**ras_if), GFP_KERNEL);
        if (!*ras_if)
                return -ENOMEM;
@@ -3577,7 +3580,7 @@ static int gfx_v9_0_ecc_late_init(void *handle)
        r = amdgpu_ras_sysfs_create(adev, &fs_info);
        if (r)
                goto sysfs;
-
+resume:
        r = amdgpu_irq_get(adev, &adev->gfx.cp_ecc_error_irq, 0);
        if (r)
                goto irq;
diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c 
b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
index 84904bd680df..df05563babfd 100644
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
@@ -927,6 +927,9 @@ static int gmc_v9_0_ecc_late_init(void *handle)
                amdgpu_ras_feature_enable(adev, &ras_block, 0);
                return 0;
        }
+       /* handle resume path. */
+       if (*ras_if)
+               goto resume;
 
        *ras_if = kmalloc(sizeof(**ras_if), GFP_KERNEL);
        if (!*ras_if)
@@ -952,7 +955,7 @@ static int gmc_v9_0_ecc_late_init(void *handle)
        r = amdgpu_ras_sysfs_create(adev, &fs_info);
        if (r)
                goto sysfs;
-
+resume:
        r = amdgpu_irq_get(adev, &adev->gmc.ecc_irq, 0);
        if (r)
                goto irq;
diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c 
b/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
index 84db1f4725f7..3ac5abe937f4 100644
--- a/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
@@ -1522,6 +1522,10 @@ static int sdma_v4_0_late_init(void *handle)
                return 0;
        }
 
+       /* handle resume path. */
+       if (*ras_if)
+               goto resume;
+
        *ras_if = kmalloc(sizeof(**ras_if), GFP_KERNEL);
        if (!*ras_if)
                return -ENOMEM;
@@ -1546,7 +1550,7 @@ static int sdma_v4_0_late_init(void *handle)
        r = amdgpu_ras_sysfs_create(adev, &fs_info);
        if (r)
                goto sysfs;
-
+resume:
        r = amdgpu_irq_get(adev, &adev->sdma.ecc_irq, AMDGPU_SDMA_IRQ_ECC0);
        if (r)
                goto irq;
--
2.17.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Reply via email to