[PATCH] drm/amd/display: clean unnecessary braces
Clean unnecessary braces in dc/dcn32/dcn32_resource_helpers.c and dc/dcn32/dcn201_link_encoder.c Signed-off-by: Túlio Fernandes --- .../display/dc/dcn32/dcn32_resource_helpers.c| 16 +++- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/amd/display/dc/dcn32/dcn32_resource_helpers.c b/drivers/gpu/drm/amd/display/dc/dcn32/dcn32_resource_helpers.c index 87760600e154..e179dea148e7 100644 --- a/drivers/gpu/drm/amd/display/dc/dcn32/dcn32_resource_helpers.c +++ b/drivers/gpu/drm/amd/display/dc/dcn32/dcn32_resource_helpers.c @@ -110,14 +110,12 @@ uint32_t dcn32_helper_calculate_num_ways_for_subvp( struct dc_state *context) { if (context->bw_ctx.bw.dcn.mall_subvp_size_bytes > 0) { - if (dc->debug.force_subvp_num_ways) { + if (dc->debug.force_subvp_num_ways) return dc->debug.force_subvp_num_ways; - } else { + else return dcn32_helper_mall_bytes_to_ways(dc, context->bw_ctx.bw.dcn.mall_subvp_size_bytes); - } - } else { + } else return 0; - } } void dcn32_merge_pipes_for_subvp(struct dc *dc, @@ -250,9 +248,9 @@ bool dcn32_is_psr_capable(struct pipe_ctx *pipe) { bool psr_capable = false; - if (pipe->stream && pipe->stream->link->psr_settings.psr_version != DC_PSR_VERSION_UNSUPPORTED) { + if (pipe->stream && pipe->stream->link->psr_settings.psr_version != DC_PSR_VERSION_UNSUPPORTED) psr_capable = true; - } + return psr_capable; } @@ -278,9 +276,9 @@ static void override_det_for_subvp(struct dc *dc, struct dc_state *context, uint if (pipe_ctx->stream && pipe_ctx->plane_state && dc_state_get_pipe_subvp_type(context, pipe_ctx) != SUBVP_PHANTOM) { if (dcn32_allow_subvp_high_refresh_rate(dc, context, pipe_ctx)) { - if (pipe_ctx->stream->timing.v_addressable == 1080 && pipe_ctx->stream->timing.h_addressable == 1920) { + if (pipe_ctx->stream->timing.v_addressable == 1080 && pipe_ctx->stream->timing.h_addressable == 1920) fhd_count++; - } + subvp_high_refresh_count++; } } -- 2.34.1
Re: [PATCH v2 2/2] drm/tests/drm_buddy: add alloc_contiguous test
On Wed, Feb 14, 2024 at 06:48:53PM +0530, Arunpravin Paneer Selvam wrote: > From: Matthew Auld > > Sanity check DRM_BUDDY_CONTIGUOUS_ALLOCATION. > > v2: Fix checkpatch warnings. > > Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/3097 > Signed-off-by: Matthew Auld > Cc: Arunpravin Paneer Selvam > Cc: Limonciello > Cc: Christian König > Reviewed-by: Arunpravin Paneer Selvam > Signed-off-by: Arunpravin Paneer Selvam Building csky:allmodconfig ... failed Building openrisc:allmodconfig ... failed Building parisc:allmodconfig ... failed Building xtensa:allmodconfig ... failed [ and presumably all other 32-bit systems which enable this test ] -- Error log: ERROR: modpost: "__umoddi3" [drivers/gpu/drm/tests/drm_buddy_test.ko] undefined! ERROR: modpost: "__moddi3" [drivers/gpu/drm/tests/drm_buddy_test.ko] undefined! Guenter
Re: [PATCH] drm/amdgpu: add UTCL2 RAS poison query for gfx 9.4.3
On 2/18/2024 12:26 PM, Tao Zhou wrote: > Add help function to query and reset RAS UTCL2 poison status. > > Signed-off-by: Tao Zhou > --- > drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c | 14 ++ > 1 file changed, 14 insertions(+) > > diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c > b/drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c > index aace4594a603..de04006f8db1 100644 > --- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c > +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c > @@ -4329,10 +4329,24 @@ static int gfx_v9_4_3_ras_late_init(struct > amdgpu_device *adev, struct ras_commo > return r; > } > > +static bool gfx_v9_4_3_query_uctl2_poison_status(struct amdgpu_device *adev) > +{ > + u32 status = 0; > + struct amdgpu_vmhub *hub; > + > + hub = &adev->vmhub[AMDGPU_GFXHUB(0)]; This only take care of the first instance. What about others? Thanks, Lijo > + status = RREG32(hub->vm_l2_pro_fault_status); > + /* reset page fault status */ > + WREG32_P(hub->vm_l2_pro_fault_cntl, 1, ~1); > + > + return REG_GET_FIELD(status, VM_L2_PROTECTION_FAULT_STATUS, FED); > +} > + > struct amdgpu_gfx_ras gfx_v9_4_3_ras = { > .ras_block = { > .hw_ops = &gfx_v9_4_3_ras_ops, > .ras_late_init = &gfx_v9_4_3_ras_late_init, > }, > .enable_watchdog_timer = &gfx_v9_4_3_enable_watchdog_timer, > + .query_utcl2_poison_status = &gfx_v9_4_3_query_uctl2_poison_status, > };
[PATCH 1/2] drm/amdgpu: fix bank error type
fix bank error type issue. Fixes: ecee078c8d169 ("drm/amdgpu: implement RAS ACA driver framework") Signed-off-by: Yang Wang --- drivers/gpu/drm/amd/amdgpu/amdgpu_aca.c | 4 ++-- drivers/gpu/drm/amd/amdgpu/amdgpu_aca.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_aca.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_aca.c index 309e73bc5ee7..8c18dfb28030 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_aca.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_aca.c @@ -291,7 +291,7 @@ static int aca_log_errors(struct aca_handle *handle, enum aca_error_type type, if (!bank_error) return -ENOMEM; - bank_error->count[type] += report->count[type]; + bank_error->count += report->count[type]; return 0; } @@ -431,7 +431,7 @@ static int aca_log_aca_error_data(struct aca_bank_error *bank_error, enum aca_er if (type >= ACA_ERROR_TYPE_COUNT) return -EINVAL; - count = bank_error->count[type]; + count = bank_error->count; if (!count) return 0; diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_aca.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_aca.h index 2da50e095883..e650fed2e806 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_aca.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_aca.h @@ -123,7 +123,7 @@ struct aca_bank_report { struct aca_bank_error { struct list_head node; struct aca_bank_info info; - u64 count[ACA_ERROR_TYPE_COUNT]; + u64 count; }; struct aca_error { -- 2.34.1
[PATCH 2/2] drm/amdgpu: add new aca_smu_type support
Add new types to distinguish between ACA error type and smu mca type. e.g.: the ACA_ERROR_TYPE_DEFERRED is not matched any smu mca valid bank channel, so add new type 'aca_smu_type' to distinguish aca error type and smu mca type. Signed-off-by: Yang Wang --- drivers/gpu/drm/amd/amdgpu/amdgpu_aca.c | 27 ++- drivers/gpu/drm/amd/amdgpu/amdgpu_aca.h | 10 +-- .../drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c | 26 +- 3 files changed, 41 insertions(+), 22 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_aca.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_aca.c index 8c18dfb28030..72b7fe5d246a 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_aca.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_aca.c @@ -86,7 +86,7 @@ static void aca_banks_release(struct aca_banks *banks) } } -static int aca_smu_get_valid_aca_count(struct amdgpu_device *adev, enum aca_error_type type, u32 *count) +static int aca_smu_get_valid_aca_count(struct amdgpu_device *adev, enum aca_smu_type type, u32 *count) { struct amdgpu_aca *aca = &adev->aca; const struct aca_smu_funcs *smu_funcs = aca->smu_funcs; @@ -127,7 +127,7 @@ static void aca_smu_bank_dump(struct amdgpu_device *adev, int idx, int total, st idx + 1, total, aca_regs[i].name, bank->regs[aca_regs[i].reg_idx]); } -static int aca_smu_get_valid_aca_banks(struct amdgpu_device *adev, enum aca_error_type type, +static int aca_smu_get_valid_aca_banks(struct amdgpu_device *adev, enum aca_smu_type type, int start, int count, struct aca_banks *banks) { @@ -143,13 +143,12 @@ static int aca_smu_get_valid_aca_banks(struct amdgpu_device *adev, enum aca_erro return -EOPNOTSUPP; switch (type) { - case ACA_ERROR_TYPE_UE: + case ACA_SMU_TYPE_UE: max_count = smu_funcs->max_ue_bank_count; break; - case ACA_ERROR_TYPE_CE: + case ACA_SMU_TYPE_CE: max_count = smu_funcs->max_ce_bank_count; break; - case ACA_ERROR_TYPE_DEFERRED: default: return -EINVAL; } @@ -164,6 +163,8 @@ static int aca_smu_get_valid_aca_banks(struct amdgpu_device *adev, enum aca_erro if (ret) return ret; + bank.type = type; + aca_smu_bank_dump(adev, i, count, &bank); ret = aca_banks_add_bank(banks, &bank); @@ -383,6 +384,7 @@ static int aca_banks_update(struct amdgpu_device *adev, enum aca_error_type type { struct amdgpu_aca *aca = &adev->aca; struct aca_banks banks; + enum aca_smu_type smu_type; u32 count = 0; int ret; @@ -392,8 +394,19 @@ static int aca_banks_update(struct amdgpu_device *adev, enum aca_error_type type /* NOTE: pmfw is only support UE and CE */ if (type == ACA_ERROR_TYPE_DEFERRED) type = ACA_ERROR_TYPE_CE; + switch (type) { + case ACA_ERROR_TYPE_UE: + smu_type = ACA_SMU_TYPE_UE; + break; + case ACA_ERROR_TYPE_CE: + case ACA_ERROR_TYPE_DEFERRED: + smu_type = ACA_SMU_TYPE_CE; + break; + default: + return -EINVAL; + } - ret = aca_smu_get_valid_aca_count(adev, type, &count); + ret = aca_smu_get_valid_aca_count(adev, smu_type, &count); if (ret) return ret; @@ -402,7 +415,7 @@ static int aca_banks_update(struct amdgpu_device *adev, enum aca_error_type type aca_banks_init(&banks); - ret = aca_smu_get_valid_aca_banks(adev, type, 0, count, &banks); + ret = aca_smu_get_valid_aca_banks(adev, smu_type, 0, count, &banks); if (ret) goto err_release_banks; diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_aca.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_aca.h index e650fed2e806..0fc9e266e269 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_aca.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_aca.h @@ -99,7 +99,13 @@ enum aca_error_type { ACA_ERROR_TYPE_COUNT }; +enum aca_smu_type { + ACA_SMU_TYPE_UE, + ACA_SMU_TYPE_CE, +}; + struct aca_bank { + enum aca_smu_type type; u64 regs[ACA_MAX_REGS_COUNT]; }; @@ -167,8 +173,8 @@ struct aca_smu_funcs { int max_ue_bank_count; int max_ce_bank_count; int (*set_debug_mode)(struct amdgpu_device *adev, bool enable); - int (*get_valid_aca_count)(struct amdgpu_device *adev, enum aca_error_type type, u32 *count); - int (*get_valid_aca_bank)(struct amdgpu_device *adev, enum aca_error_type type, int idx, struct aca_bank *bank); + int (*get_valid_aca_count)(struct amdgpu_device *adev, enum aca_smu_type type, u32 *count); + int (*get_valid_aca_bank)(struct amdgpu_device *adev, enum aca_smu_type type, int idx, struct aca_bank *bank); }; struct
Re: [PATCH] drm/buddy: Modify duplicate list_splice_tail call
Hi Christian, On 2/16/2024 5:29 PM, Christian König wrote: Am 16.02.24 um 12:46 schrieb Arunpravin Paneer Selvam: On 2/16/2024 4:41 PM, Matthew Auld wrote: On 16/02/2024 10:00, Arunpravin Paneer Selvam wrote: Remove the duplicate list_splice_tail call when the total_allocated < size condition is true. Cc: # 6.7+ Fixes: 8746c6c9dfa3 ("drm/buddy: Fix alloc_range() error handling code") Reported-by: Bert Karwatzki Signed-off-by: Arunpravin Paneer Selvam --- drivers/gpu/drm/drm_buddy.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/drm_buddy.c b/drivers/gpu/drm/drm_buddy.c index c1a99bf4dffd..c4222b886db7 100644 --- a/drivers/gpu/drm/drm_buddy.c +++ b/drivers/gpu/drm/drm_buddy.c @@ -538,13 +538,13 @@ static int __alloc_range(struct drm_buddy *mm, list_add(&block->left->tmp_link, dfs); } while (1); - list_splice_tail(&allocated, blocks); - if (total_allocated < size) { err = -ENOSPC; goto err_free; } + list_splice_tail(&allocated, blocks); Sigh. Can we extend the unit test(s) to catch this? Sure, Let me check. In the meantime I'm going to push this one to drm-misc-fixes. Thank you! Regards, Christian. Regards, Arun. Reviewed-by: Matthew Auld + return 0; err_undo: base-commit: a64056bb5a3215bd31c8ce17d609ba0f4d5c55ea
[PATCH] drm/amdgpu: Drop redundant parameter in amdgpu_gfx_kiq_init_ring
Drop redundant parameters in function amdgpu_gfx_kiq_init_ring to simplify the code Signed-off-by: Ma Jun --- drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 6 +++--- drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h | 4 +--- drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 5 ++--- drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c | 5 ++--- drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 5 ++--- drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 5 ++--- drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c | 4 +--- 7 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 e114694d1131..4835d6d899e7 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c @@ -304,11 +304,11 @@ static int amdgpu_gfx_kiq_acquire(struct amdgpu_device *adev, return -EINVAL; } -int amdgpu_gfx_kiq_init_ring(struct amdgpu_device *adev, -struct amdgpu_ring *ring, -struct amdgpu_irq_src *irq, int xcc_id) +int amdgpu_gfx_kiq_init_ring(struct amdgpu_device *adev, int xcc_id) { struct amdgpu_kiq *kiq = &adev->gfx.kiq[xcc_id]; + struct amdgpu_irq_src *irq = &kiq->irq; + struct amdgpu_ring *ring = &kiq->ring; int r = 0; spin_lock_init(&kiq->ring_lock); diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h index f23bafec71c5..8fcf889ddce9 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h @@ -471,9 +471,7 @@ static inline u32 amdgpu_gfx_create_bitmask(u32 bit_width) void amdgpu_gfx_parse_disable_cu(unsigned *mask, unsigned max_se, unsigned max_sh); -int amdgpu_gfx_kiq_init_ring(struct amdgpu_device *adev, -struct amdgpu_ring *ring, -struct amdgpu_irq_src *irq, int xcc_id); +int amdgpu_gfx_kiq_init_ring(struct amdgpu_device *adev, int xcc_id); void amdgpu_gfx_kiq_free_ring(struct amdgpu_ring *ring); diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c index b02d63328f1c..691fa40e4e01 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c @@ -4490,7 +4490,7 @@ static int gfx_v10_0_compute_ring_init(struct amdgpu_device *adev, int ring_id, static int gfx_v10_0_sw_init(void *handle) { int i, j, k, r, ring_id = 0; - struct amdgpu_kiq *kiq; + int xcc_id = 0; struct amdgpu_device *adev = (struct amdgpu_device *)handle; switch (amdgpu_ip_version(adev, GC_HWIP, 0)) { @@ -4619,8 +4619,7 @@ static int gfx_v10_0_sw_init(void *handle) return r; } - kiq = &adev->gfx.kiq[0]; - r = amdgpu_gfx_kiq_init_ring(adev, &kiq->ring, &kiq->irq, 0); + r = amdgpu_gfx_kiq_init_ring(adev, xcc_id); if (r) return r; } diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c index 2fb1342d5bd9..9d8ec709cd52 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c @@ -1329,7 +1329,7 @@ static int gfx_v11_0_rlc_backdoor_autoload_enable(struct amdgpu_device *adev) static int gfx_v11_0_sw_init(void *handle) { int i, j, k, r, ring_id = 0; - struct amdgpu_kiq *kiq; + int xcc_id = 0; struct amdgpu_device *adev = (struct amdgpu_device *)handle; switch (amdgpu_ip_version(adev, GC_HWIP, 0)) { @@ -1454,8 +1454,7 @@ static int gfx_v11_0_sw_init(void *handle) return r; } - kiq = &adev->gfx.kiq[0]; - r = amdgpu_gfx_kiq_init_ring(adev, &kiq->ring, &kiq->irq, 0); + r = amdgpu_gfx_kiq_init_ring(adev, xcc_id); if (r) return r; } diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c index ea174b76ee70..b97ea62212b6 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c @@ -1900,8 +1900,8 @@ static void gfx_v8_0_sq_irq_work_func(struct work_struct *work); static int gfx_v8_0_sw_init(void *handle) { int i, j, k, r, ring_id; + int xcc_id = 0; struct amdgpu_ring *ring; - struct amdgpu_kiq *kiq; struct amdgpu_device *adev = (struct amdgpu_device *)handle; switch (adev->asic_type) { @@ -2022,8 +2022,7 @@ static int gfx_v8_0_sw_init(void *handle) return r; } - kiq = &adev->gfx.kiq[0]; - r = amdgpu_gfx_kiq_init_ring(adev, &kiq->ring, &kiq->irq, 0); + r = amdgpu_gfx_kiq_init_ring(adev, xcc_id); if (r) return r; diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c index 169d45268ef6..7669f82aa1da 10