drm/amdgpu: Remove redundant poison consumption handler function
Subsystems (2)
PATCH 1/1 drm/amdgpu: Remove redundant poison consumption handler function
The function callback handle_poison_consumption and callback function poison_consumption_handler are almost same to handle poison consumption, remove poison_consumption_handler.
--- 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(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +0 -9
@@ -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)
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h +0 -4
@@ -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);
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +2 -4
@@ -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); } }
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h +2 -1
@@ -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
drivers/gpu/drm/amd/amdgpu/gfx_v11_0_3.c +9 -3
@@ -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, };
Signature · 1 line
2.25.1
[AMD Official Use Only - General]
Please ignore this patch, I will send V2.
Regards,
Stanley
Quoted 159 lines
-----Original Message-----
From: Stanley.Yang <[email protected]>
Sent: Monday, June 19, 2023 4:24 PM
To: [email protected]; Zhang, Hawking <[email protected]>; Zhou1, Tao <[email protected]>; Chai, Thomas <[email protected]>
Cc: Yang, Stanley <[email protected]>
Subject: [PATCH Review 1/1] drm/amdgpu: Remove redundant poison consumption handler functionThe function callback
handle_poison_consumptionand callback functionpoison_consumption_handlerare almost same to handle poison consumption, removepoison_consumption_handler.Signed-off-by Stanley.Yang <[email protected]>--- 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(-)drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +0
-9@@ -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,
structamdgpu_iv_entry*entry)drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h +0
-2@@ -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{drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h +0
-1@@ -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 --gita/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.cb/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
index5b6525d8dace..7be289473034100644drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +0
-0@@ -1694,15 +1694,13 @@ static voidamdgpu_ras_interrupt_poison_consumption_handler(struct
ras_manager*amdgpu_umc_poison_handler(adev, false); if (block_obj->hw_ops && block_obj->hw_ops-Quoted 1 line
handle_poison_consumption)-
poison_stat= block_obj->hw_ops-Quoted 1 line
handle_poison_consumption(adev);+
poison_stat= block_obj->hw_ops-Quoted 1 line
handle_poison_consumption(adev,
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +2
-1+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 poisonconsumption is issued!\n",
block_obj->ras_comm.name); amdgpu_ras_reset_gpu(adev);drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +0
-2- }else { -amdgpu_gfx_poison_consumption_handler (adev, entry); } }drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h +2
-1@@ -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 drivers/gpu/drm/amd/amdgpu/gfx_v11_0_3.c +1
-1@@ -78,7 +78,7 @@ static int gfx_v11_0_3_rlc_gc_fed_irq(structamdgpu_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,
structamdgpu_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); }drivers/gpu/drm/amd/amdgpu/gfx_v11_0_3.c +3
-1-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,drivers/gpu/drm/amd/amdgpu/gfx_v11_0_3.c +5
-1+}; +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