The function callback handle_poison_consumption and callback
function poison_consumption_handler are almost same to handle
poison consumption, remove poison_consumption_handler.

Signed-off-by: Stanley.Yang <stanley.y...@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c  |  9 ---------
 drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h  |  4 ----
 drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c  |  6 ++----
 drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h  |  3 ++-
 drivers/gpu/drm/amd/amdgpu/gfx_v11_0_3.c | 12 +++++++++---
 5 files changed, 13 insertions(+), 21 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
index a33d4bc34cee..c15dbdb2e0f9 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
@@ -840,15 +840,6 @@ int amdgpu_gfx_ras_sw_init(struct amdgpu_device *adev)
        return 0;
 }
 
-int amdgpu_gfx_poison_consumption_handler(struct amdgpu_device *adev,
-                                               struct amdgpu_iv_entry *entry)
-{
-       if (adev->gfx.ras && adev->gfx.ras->poison_consumption_handler)
-               return adev->gfx.ras->poison_consumption_handler(adev, entry);
-
-       return 0;
-}
-
 int amdgpu_gfx_process_ras_data_cb(struct amdgpu_device *adev,
                void *err_data,
                struct amdgpu_iv_entry *entry)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h
index d0c3f2955821..95b80bc8cdb9 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h
@@ -273,8 +273,6 @@ struct amdgpu_gfx_ras {
        int (*rlc_gc_fed_irq)(struct amdgpu_device *adev,
                                struct amdgpu_irq_src *source,
                                struct amdgpu_iv_entry *entry);
-       int (*poison_consumption_handler)(struct amdgpu_device *adev,
-                                               struct amdgpu_iv_entry *entry);
 };
 
 struct amdgpu_gfx_shadow_info {
@@ -538,8 +536,6 @@ int amdgpu_gfx_get_num_kcq(struct amdgpu_device *adev);
 void amdgpu_gfx_cp_init_microcode(struct amdgpu_device *adev, uint32_t 
ucode_id);
 
 int amdgpu_gfx_ras_sw_init(struct amdgpu_device *adev);
-int amdgpu_gfx_poison_consumption_handler(struct amdgpu_device *adev,
-                                               struct amdgpu_iv_entry *entry);
 
 bool amdgpu_gfx_is_master_xcc(struct amdgpu_device *adev, int xcc_id);
 int amdgpu_gfx_sysfs_init(struct amdgpu_device *adev);
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
index 5b6525d8dace..7be289473034 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
@@ -1694,15 +1694,13 @@ static void 
amdgpu_ras_interrupt_poison_consumption_handler(struct ras_manager *
        amdgpu_umc_poison_handler(adev, false);
 
        if (block_obj->hw_ops && block_obj->hw_ops->handle_poison_consumption)
-               poison_stat = 
block_obj->hw_ops->handle_poison_consumption(adev);
+               poison_stat = 
block_obj->hw_ops->handle_poison_consumption(adev, entry);
 
        /* gpu reset is fallback for failed and default cases */
-       if (poison_stat) {
+       if (poison_stat != true) {
                dev_info(adev->dev, "GPU reset for %s RAS poison consumption is 
issued!\n",
                                block_obj->ras_comm.name);
                amdgpu_ras_reset_gpu(adev);
-       } else {
-               amdgpu_gfx_poison_consumption_handler(adev, entry);
        }
 }
 
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h
index 46bf1889a9d7..03f3b3774b85 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h
@@ -564,7 +564,8 @@ struct amdgpu_ras_block_hw_ops {
        void (*reset_ras_error_count)(struct amdgpu_device *adev);
        void (*reset_ras_error_status)(struct amdgpu_device *adev);
        bool (*query_poison_status)(struct amdgpu_device *adev);
-       bool (*handle_poison_consumption)(struct amdgpu_device *adev);
+       bool (*handle_poison_consumption)(struct amdgpu_device *adev,
+                       struct amdgpu_iv_entry *entry);
 };
 
 /* work flow
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v11_0_3.c 
b/drivers/gpu/drm/amd/amdgpu/gfx_v11_0_3.c
index 26d6286d86c9..5b7eac547a05 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v11_0_3.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v11_0_3.c
@@ -78,7 +78,7 @@ static int gfx_v11_0_3_rlc_gc_fed_irq(struct amdgpu_device 
*adev,
        return 0;
 }
 
-static int gfx_v11_0_3_poison_consumption_handler(struct amdgpu_device *adev,
+static bool gfx_v11_0_3_handle_poison_consumption(struct amdgpu_device *adev,
                                        struct amdgpu_iv_entry *entry)
 {
        /* Workaround: when vmid and pasid are both zero, trigger gpu reset in 
KGD. */
@@ -99,10 +99,16 @@ static int gfx_v11_0_3_poison_consumption_handler(struct 
amdgpu_device *adev,
                amdgpu_ras_reset_gpu(adev);
        }
 
-       return 0;
+       return true;
 }
 
+struct amdgpu_ras_block_hw_ops gfx_v11_0_3_ras_ops = {
+       .handle_poison_consumption = gfx_v11_0_3_handle_poison_consumption,
+};
+
 struct amdgpu_gfx_ras gfx_v11_0_3_ras = {
+       .ras_block = {
+               .hw_ops = &gfx_v11_0_3_ras_ops,
+       },
        .rlc_gc_fed_irq = gfx_v11_0_3_rlc_gc_fed_irq,
-       .poison_consumption_handler = gfx_v11_0_3_poison_consumption_handler,
 };
-- 
2.25.1

Reply via email to