drm/amdgpu: Remove redundant poison consumption handler function
Subsystems (2)
PATCH v2 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.
Changed from V1:
Add handle poison consumption function for VCN2.6, VCN4.0, JPEG2.6 and JPEG4.0, return false when handle VCN/JPEGP poison consumption.
--- 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 | 8 +++----- drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h | 3 ++- drivers/gpu/drm/amd/amdgpu/gfx_v11_0_3.c | 12 +++++++++--- drivers/gpu/drm/amd/amdgpu/jpeg_v2_5.c | 9 +++++++++ drivers/gpu/drm/amd/amdgpu/jpeg_v4_0.c | 9 +++++++++ drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c | 9 +++++++++ drivers/gpu/drm/amd/amdgpu/vcn_v4_0.c | 9 +++++++++ 9 files changed, 50 insertions(+), 22 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 +3 -5
@@ -1668,7 +1668,7 @@ void amdgpu_ras_interrupt_fatal_error_handler(struct amdgpu_device *adev)static void amdgpu_ras_interrupt_poison_consumption_handler (struct ras_manager *obj,struct amdgpu_iv_entry *entry) { -bool poison_stat = false; +bool poison_stat = true;struct amdgpu_device *adev = obj->adev;struct amdgpu_ras_block_object *block_obj =amdgpu_ras_get_ras_block (adev, obj->head.block,0 );
@@ -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, };
drivers/gpu/drm/amd/amdgpu/jpeg_v2_5.c +9 -0
@@ -809,8 +809,17 @@ static bool jpeg_v2_6_query_ras_poison_status(struct amdgpu_device *adev)return !!poison_stat; } +static bool jpeg_v2_6_handle_poison_consumption (struct amdgpu_device *adev, +struct amdgpu_iv_entry *entry) +{ +/* TODO: reset IP engine instead of reset GPU */ + +return false; +} +const struct amdgpu_ras_block_hw_ops jpeg_v2_6_ras_hw_ops = { .query_poison_status = jpeg_v2_6_query_ras_poison_status, + .handle_poison_consumption = jpeg_v2_6_handle_poison_consumption, };static struct amdgpu_jpeg_ras jpeg_v2_6_ras = {
drivers/gpu/drm/amd/amdgpu/jpeg_v4_0.c +9 -0
@@ -818,8 +818,17 @@ static bool jpeg_v4_0_query_ras_poison_status(struct amdgpu_device *adev)return !!poison_stat; } +static bool jpeg_v4_0_handle_poison_consumption (struct amdgpu_device *adev, +struct amdgpu_iv_entry *entry) +{ +/* TODO: reset IP engine instead of reset GPU */ + +return false; +} +const struct amdgpu_ras_block_hw_ops jpeg_v4_0_ras_hw_ops = { .query_poison_status = jpeg_v4_0_query_ras_poison_status, + .handle_poison_consumption = jpeg_v4_0_handle_poison_consumption, };static struct amdgpu_jpeg_ras jpeg_v4_0_ras = {
drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c +9 -0
@@ -1974,8 +1974,17 @@ static bool vcn_v2_6_query_poison_status(struct amdgpu_device *adev)return !!poison_stat; } +static bool vcn_v2_6_handle_poison_consumption (struct amdgpu_device *adev, +struct amdgpu_iv_entry *entry) +{ +/* TODO: reset IP engine instead of reset GPU */ + +return false; +} +const struct amdgpu_ras_block_hw_ops vcn_v2_6_ras_hw_ops = { .query_poison_status = vcn_v2_6_query_poison_status, + .handle_poison_consumption = vcn_v2_6_handle_poison_consumption, };static struct amdgpu_vcn_ras vcn_v2_6_ras = {
drivers/gpu/drm/amd/amdgpu/vcn_v4_0.c +9 -0
@@ -2134,8 +2134,17 @@ static bool vcn_v4_0_query_ras_poison_status(struct amdgpu_device *adev)return !!poison_stat; } +static bool vcn_v4_0_handle_poison_consumption (struct amdgpu_device *adev, +struct amdgpu_iv_entry *entry) +{ +/* TODO: reset IP engine instead of reset GPU */ + +return false; +} +const struct amdgpu_ras_block_hw_ops vcn_v4_0_ras_hw_ops = { .query_poison_status = vcn_v4_0_query_ras_poison_status, + .handle_poison_consumption = vcn_v4_0_handle_poison_consumption, };static struct amdgpu_vcn_ras vcn_v4_0_ras = {
Signature · 1 line
2.25.1
[AMD Official Use Only - General]
Quoted 100 lines
-----Original Message-----
From: Stanley.Yang <[email protected]>
Sent: Monday, June 19, 2023 9:50 PM
To: [email protected]; Zhang, Hawking <[email protected]>; Zhou1, Tao <[email protected]>; Chai, Thomas <[email protected]>
Cc: Yang, Stanley <[email protected]>
Subject: [PATCH Review V2 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.Changed from V1:
Add handle poison consumption function for VCN2.6, VCN4.0, JPEG2.6 and JPEG4.0, return false when handle VCN/JPEGP poison consumption.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 | 8 +++----- drivers/gpu/drm/amd/amdgpu/amdgpu_ras.h | 3 ++- drivers/gpu/drm/amd/amdgpu/gfx_v11_0_3.c | 12 +++++++++--- drivers/gpu/drm/amd/amdgpu/jpeg_v2_5.c | 9 +++++++++ drivers/gpu/drm/amd/amdgpu/jpeg_v4_0.c | 9 +++++++++ drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c | 9 +++++++++ drivers/gpu/drm/amd/amdgpu/vcn_v4_0.c | 9 +++++++++ 9 files changed, 50 insertions(+), 22 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..9ce7c7537751100644drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +0
-0@@ -1668,7 +1668,7 @@ void amdgpu_ras_interrupt_fatal_error_handler(struct
amdgpu_device*adev) static void amdgpu_ras_interrupt_poison_consumption_handler(structras_manager*obj,
structamdgpu_iv_entry*entry)
{drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +1
-1-bool poison_stat = false; +bool poison_stat = true;struct amdgpu_device *adev = obj->adev;struct amdgpu_ras_block_object *block_obj = amdgpu_ras_get_ras_block(adev, obj->head.block, 0); @@ -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-
Quoted 6 lines
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,
+entry);
[Tao] !block_obj->hw_ops->handle_poison_consumption is allowed, we can add the following code to avoid adding handle_poison_consumption for vcn and jpeg.
else
poison_stat = false;
For the change in GFX, it's better for Thomas to take a look.
Quoted 167 lines
/* gpu reset is fallback for failed and default cases */drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +1
-1-if (poison_stat) { +if (poison_stat != true) { dev_info(adev->dev, "GPU reset for %s RAS poison consumptionis 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 +2
-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,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); }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,
};drivers/gpu/drm/amd/amdgpu/jpeg_v2_5.c +9
-0@@ -809,8 +809,17 @@ static bool jpeg_v2_6_query_ras_poison_status(struct amdgpu_device *adev)return !!poison_stat; } +static bool jpeg_v2_6_handle_poison_consumption (struct amdgpu_device *adev, +struct amdgpu_iv_entry *entry) +{ +/* TODO: reset IP engine instead of reset GPU */ + +return false; +} +const struct amdgpu_ras_block_hw_ops jpeg_v2_6_ras_hw_ops = { .query_poison_status = jpeg_v2_6_query_ras_poison_status, + .handle_poison_consumption = jpeg_v2_6_handle_poison_consumption, };static struct
amdgpu_jpeg_rasjpeg_v2_6_ras= { diff --gita/drivers/gpu/drm/amd/amdgpu/jpeg_v4_0.cb/drivers/gpu/drm/amd/amdgpu/jpeg_v4_0.c
indexa707d407fbd0..328e3de14e35100644drivers/gpu/drm/amd/amdgpu/jpeg_v4_0.c +9
-0@@ -818,8 +818,17 @@ static bool jpeg_v4_0_query_ras_poison_status(struct amdgpu_device *adev)return !!poison_stat; } +static bool jpeg_v4_0_handle_poison_consumption (struct amdgpu_device *adev, +struct amdgpu_iv_entry *entry) +{ +/* TODO: reset IP engine instead of reset GPU */ + +return false; +} +const struct amdgpu_ras_block_hw_ops jpeg_v4_0_ras_hw_ops = { .query_poison_status = jpeg_v4_0_query_ras_poison_status, + .handle_poison_consumption = jpeg_v4_0_handle_poison_consumption, };static struct
amdgpu_jpeg_rasjpeg_v4_0_ras= { diff --gita/drivers/gpu/drm/amd/amdgpu/vcn_v2_5.cb/drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c
indexbb1875f926f1..e6dbea441caa100644drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c +9
-0@@ -1974,8 +1974,17 @@ static bool vcn_v2_6_query_poison_status(struct amdgpu_device *adev)return !!poison_stat; } +static bool vcn_v2_6_handle_poison_consumption (struct amdgpu_device *adev, +struct amdgpu_iv_entry *entry) +{ +/* TODO: reset IP engine instead of reset GPU */ + +return false; +} +const struct amdgpu_ras_block_hw_ops vcn_v2_6_ras_hw_ops = { .query_poison_status = vcn_v2_6_query_poison_status, + .handle_poison_consumption = vcn_v2_6_handle_poison_consumption, };static struct
amdgpu_vcn_rasvcn_v2_6_ras= { diff --gita/drivers/gpu/drm/amd/amdgpu/vcn_v4_0.cb/drivers/gpu/drm/amd/amdgpu/vcn_v4_0.c
indexb48bb5212488..eb8625a6df92100644drivers/gpu/drm/amd/amdgpu/vcn_v4_0.c +9
-0@@ -2134,8 +2134,17 @@ static bool vcn_v4_0_query_ras_poison_status(struct amdgpu_device *adev)return !!poison_stat; } +static bool vcn_v4_0_handle_poison_consumption (struct amdgpu_device *adev, +struct amdgpu_iv_entry *entry) +{ +/* TODO: reset IP engine instead of reset GPU */ + +return false; +} +const struct amdgpu_ras_block_hw_ops vcn_v4_0_ras_hw_ops = { .query_poison_status = vcn_v4_0_query_ras_poison_status, + .handle_poison_consumption = vcn_v4_0_handle_poison_consumption, };static struct
amdgpu_vcn_rasvcn_v4_0_ras= {
--
2.25.1