drm/amdgpu/pm: Fix the null pointer dereference for smu7
Subsystems (3)
PATCH 1/5 drm/amdgpu/pm: Fix the null pointer dereference for smu7
optimize the code to avoid pass a null pointer (hwmgr->backend) to function smu7_update_edc_leakage_table.
--- .../drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c | 50 +++++++++---------- 1 file changed, 24 insertions(+), 26 deletions(-)
drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c +24 -26
@@ -2957,6 +2957,7 @@ static int smu7_update_edc_leakage_table(struct pp_hwmgr *hwmgr)static int smu7_hwmgr_backend_init (struct pp_hwmgr *hwmgr) { +struct amdgpu_device *adev = hwmgr->adev;struct smu7_hwmgr *data;int result =0 ;
@@ -2993,40 +2994,37 @@ static int smu7_hwmgr_backend_init(struct pp_hwmgr *hwmgr)/* Initalize Dynamic State Adjustment Rule Settings */ result =phm_initializa_dynamic_state_adjustment_rule_settings (hwmgr); -if (0 == result) { -struct amdgpu_device *adev = hwmgr->adev; +if (result) + goto fail; - data->is_tlu_enabled = false; + data->is_tlu_enabled = false; - hwmgr->platform_descriptor.hardwareActivityPerformanceLevels = + hwmgr->platform_descriptor.hardwareActivityPerformanceLevels =SMU7_MAX_HARDWARE_POWERLEVELS ; - hwmgr->platform_descriptor.hardwarePerformanceLevels =2 ; - hwmgr->platform_descriptor.minimumClocksReductionPercentage =50 ; + hwmgr->platform_descriptor.hardwarePerformanceLevels =2 ; + hwmgr->platform_descriptor.minimumClocksReductionPercentage =50 ; - data->pcie_gen_cap = adev->pm.pcie_gen_mask; -if (data->pcie_gen_cap &CAIL_PCIE_LINK_SPEED_SUPPORT_GEN3 ) - data->pcie_spc_cap =20 ; -else - data->pcie_spc_cap =16 ; - data->pcie_lane_cap = adev->pm.pcie_mlw_mask; - - hwmgr->platform_descriptor.vbiosInterruptId =0x20000400 ;/* IRQ_SOURCE1_SW_INT */ -/* The true clock step depends on the frequency, typically 4.5 or 9 MHz. Here we use 5. */ - hwmgr->platform_descriptor.clockStep.engineClock =500 ; - hwmgr->platform_descriptor.clockStep.memoryClock =500 ; -smu7_thermal_parameter_init (hwmgr); - }else { -/* Ignore return value in here, we are cleaning up a mess. */ -smu7_hwmgr_backend_fini (hwmgr); - } + data->pcie_gen_cap = adev->pm.pcie_gen_mask; +if (data->pcie_gen_cap &CAIL_PCIE_LINK_SPEED_SUPPORT_GEN3 ) + data->pcie_spc_cap =20 ; +else + data->pcie_spc_cap =16 ; + data->pcie_lane_cap = adev->pm.pcie_mlw_mask; + + hwmgr->platform_descriptor.vbiosInterruptId =0x20000400 ;/* IRQ_SOURCE1_SW_INT */ +/* The true clock step depends on the frequency, typically 4.5 or 9 MHz. Here we use 5. */ + hwmgr->platform_descriptor.clockStep.engineClock =500 ; + hwmgr->platform_descriptor.clockStep.memoryClock =500 ; +smu7_thermal_parameter_init (hwmgr); result =smu7_update_edc_leakage_table (hwmgr); -if (result) { -smu7_hwmgr_backend_fini (hwmgr); -return result; - } +if (result) + goto fail;return 0 ; +fail: +smu7_hwmgr_backend_fini (hwmgr); +return result; }static int smu7_force_dpm_highest (struct pp_hwmgr *hwmgr)
Signature · 1 line
2.34.1
PATCH 2/5 drm/amdgpu: Fix the null pointer dereference to ras_manager
Check ras_manager before using it
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +7 -2
@@ -2172,12 +2172,17 @@ static void amdgpu_ras_interrupt_process_handler(struct work_struct *work)int amdgpu_ras_interrupt_dispatch (struct amdgpu_device *adev,struct ras_dispatch_if *info) { -struct ras_manager *obj =amdgpu_ras_find_obj (adev, &info->head); -struct ras_ih_data *data = &obj->ih_data; +struct ras_manager *obj; +struct ras_ih_data *data; + obj =amdgpu_ras_find_obj (adev, &info->head);if (!obj)return -EINVAL ; + data = &obj->ih_data; +if (!data) +return -EINVAL ; +if (data->inuse ==0 )return 0 ;
Signature · 1 line
2.34.1
Re: [PATCH 2/5] drm/amdgpu: Fix the null pointer dereference to ras_manager
Quoted 17 lines · Ma Jun
Check
ras_managerbefore using itSigned-off-by Ma Jun <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +0
-2@@ -2172,12 +2172,17 @@ static void amdgpu_ras_interrupt_process_handler(struct work_struct *work)int amdgpu_ras_interrupt_dispatch (struct amdgpu_device *adev,struct ras_dispatch_if *info) { -struct ras_manager *obj =amdgpu_ras_find_obj (adev, &info->head); -struct ras_ih_data *data = &obj->ih_data;
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c static void amdgpu_ras_interrupt_process_handler(struct work_struct *work) · line 2184
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +6
-0+struct ras_manager *obj; +struct ras_ih_data *data; + obj =amdgpu_ras_find_obj (adev, &info->head);if (!obj)return -EINVAL ; + data = &obj->ih_data; +if (!data) +return -EINVAL ;
This check is not needed. ih_data is declared as below in ras_manager.
struct ras_ih_data ih_data;
Thanks,
Lijo
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +1
-0+if (data->inuse ==0 )return 0 ;
PATCH 3/5 drm/amdgpu: Fix null pointer dereference to aca_handle
In reply to Ma JunCheck handle pointer before using it
--- drivers/gpu/drm/amd/amdgpu/amdgpu_aca.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_aca.c +5 -1
@@ -279,7 +279,7 @@ static struct aca_bank_error *get_bank_error(struct aca_error *aerr, struct aca_int aca_error_cache_log_bank_error (struct aca_handle *handle,struct aca_bank_info *info,enum aca_error_type type,u64 count) { -struct aca_error_cache *error_cache = &handle->error_cache; +struct aca_error_cache *error_cache;struct aca_bank_error *bank_error;struct aca_error *aerr;
@@ -289,6 +289,10 @@ int aca_error_cache_log_bank_error(struct aca_handle *handle, struct aca_bank_inif (!count)return 0 ; + error_cache = &handle->error_cache; +if (!error_cache) +return -EINVAL ; + aerr = &error_cache->errors[type]; bank_error =get_bank_error (aerr, info);if (!bank_error)
Signature · 1 line
2.34.1
Re: [PATCH 3/5] drm/amdgpu: Fix null pointer dereference to aca_handle
Quoted 21 lines · Ma Jun
Check handle pointer before using it
Signed-off-by Ma Jun <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_aca.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_aca.c +1
-1@@ -279,7 +279,7 @@ static struct aca_bank_error *get_bank_error(struct aca_error *aerr, struct aca_int aca_error_cache_log_bank_error (struct aca_handle *handle,struct aca_bank_info *info,enum aca_error_type type,u64 count) { -struct aca_error_cache *error_cache = &handle->error_cache; +struct aca_error_cache *error_cache;struct aca_bank_error *bank_error;struct aca_error *aerr;
drivers/gpu/drm/amd/amdgpu/amdgpu_aca.c int aca_error_cache_log_bank_error(struct aca_handle *handle, struct aca_bank_in · line 294
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_aca.c +3
-0@@ -289,6 +289,10 @@ int aca_error_cache_log_bank_error(struct aca_handle *handle, struct aca_bank_inif (!count)return 0 ; + error_cache = &handle->error_cache; +if (!error_cache) +return -EINVAL ;
Similar as in patch 2. error_cache is not a pointer variable.
struct aca_error_cache error_cache;
Thanks,
Lijo
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_aca.c +1
-0+ aerr = &error_cache->errors[type]; bank_error =get_bank_error (aerr, info);if (!bank_error)
RE: [PATCH 3/5] drm/amdgpu: Fix null pointer dereference to aca_handle
In reply to Ma Jun[AMD Official Use Only - AMD Internal Distribution Only]
-----Original Message-----
From: Ma, Jun <[email protected]>
Sent: Monday, May 13, 2024 4:56 PM
To: [email protected]
Cc: Feng, Kenneth <[email protected]>; Deucher, Alexander <[email protected]>; Wang, Yang(Kevin) <[email protected]>; Koenig, Christian <[email protected]>; Ma, Jun <[email protected]>
Subject: [PATCH 3/5] drm/amdgpu: Fix null pointer dereference to aca_handle
Check handle pointer before using it
--- drivers/gpu/drm/amd/amdgpu/amdgpu_aca.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_aca.c +2 -1
@@ -279,7 +279,7 @@ static struct aca_bank_error *get_bank_error(struct aca_error *aerr, struct aca_ int aca_error_cache_log_bank_error(struct aca_handle *handle, struct aca_bank_info *info, enum aca_error_type type, u64 count) { -struct aca_error_cache *error_cache = &handle->error_cache; +struct aca_error_cache *error_cache;struct aca_bank_error *bank_error;struct aca_error *aerr;
@@ -289,6 +289,10 @@ int aca_error_cache_log_bank_error(struct aca_handle *handle, struct aca_bank_inif (!count)return 0 ; + error_cache = &handle->error_cache;
[Kevin]:
The above code is always return non-0 value, right?
Best Regards,
Kevin
+ if (!error_cache)
+ return -EINVAL;
+
aerr = &error_cache->errors[type];
bank_error = get_bank_error(aerr, info);
if (!bank_error)--
2.34.1
Re: [PATCH 3/5] drm/amdgpu: Fix null pointer dereference to aca_handle
Hi Lijo & Kevin, thanks for review, will drop this patch
Regards,
Ma Jun
Quoted 46 lines · Yang(Kevin)
[AMD Official Use Only - AMD Internal Distribution Only]
-----Original Message-----
From: Ma, Jun <[email protected]>
Sent: Monday, May 13, 2024 4:56 PM
To: [email protected]
Cc: Feng, Kenneth <[email protected]>; Deucher, Alexander <[email protected]>; Wang, Yang(Kevin) <[email protected]>; Koenig, Christian <[email protected]>; Ma, Jun <[email protected]>
Subject: [PATCH 3/5] drm/amdgpu: Fix null pointer dereference toaca_handleCheck handle pointer before using it
Signed-off-by Ma Jun <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_aca.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_aca.c +2
-1@@ -279,7 +279,7 @@ static struct aca_bank_error *get_bank_error(struct aca_error *aerr, struct aca_ int aca_error_cache_log_bank_error(struct aca_handle *handle, struct aca_bank_info *info, enum aca_error_type type, u64 count) { -struct aca_error_cache *error_cache = &handle->error_cache; +struct aca_error_cache *error_cache;struct aca_bank_error *bank_error;struct aca_error *aerr;@@ -289,6 +289,10 @@ int aca_error_cache_log_bank_error(struct aca_handle *handle, struct aca_bank_inif (!count)return 0 ; + error_cache = &handle->error_cache;[Kevin]:
The above code is always return non-0 value, right?Best Regards,
Kevindrivers/gpu/drm/amd/amdgpu/amdgpu_aca.c +3
-1+if (!error_cache) +return -EINVAL ; + aerr = &error_cache->errors[type]; bank_error =get_bank_error (aerr, info);if (!bank_error) --2.34.1
Re: [PATCH 3/5] drm/amdgpu: Fix null pointer dereference to aca_handle
Quoted 2 lines · Jun
Hi Lijo & Kevin, thanks for review, will drop this patch
In the original function below check is there.
if (!handle || !info || type >= ACA_ERROR_TYPE_COUNT)
return -EINVAL;So moving this to a later stage is still valid.
struct aca_error_cache *error_cache = &handle->error_cache;
Further NULL check of error_cache is not required.
Thanks,
Lijo
Quoted 50 lines
Regards,
Ma JunQuoted 46 lines · Yang(Kevin)
[AMD Official Use Only - AMD Internal Distribution Only]
-----Original Message-----
From: Ma, Jun <[email protected]>
Sent: Monday, May 13, 2024 4:56 PM
To: [email protected]
Cc: Feng, Kenneth <[email protected]>; Deucher, Alexander <[email protected]>; Wang, Yang(Kevin) <[email protected]>; Koenig, Christian <[email protected]>; Ma, Jun <[email protected]>
Subject: [PATCH 3/5] drm/amdgpu: Fix null pointer dereference toaca_handleCheck handle pointer before using it
Signed-off-by Ma Jun <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_aca.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_aca.c +2
-1@@ -279,7 +279,7 @@ static struct aca_bank_error *get_bank_error(struct aca_error *aerr, struct aca_ int aca_error_cache_log_bank_error(struct aca_handle *handle, struct aca_bank_info *info, enum aca_error_type type, u64 count) { -struct aca_error_cache *error_cache = &handle->error_cache; +struct aca_error_cache *error_cache;struct aca_bank_error *bank_error;struct aca_error *aerr;@@ -289,6 +289,10 @@ int aca_error_cache_log_bank_error(struct aca_handle *handle, struct aca_bank_inif (!count)return 0 ; + error_cache = &handle->error_cache;[Kevin]:
The above code is always return non-0 value, right?Best Regards,
Kevindrivers/gpu/drm/amd/amdgpu/amdgpu_aca.c +3
-1+if (!error_cache) +return -EINVAL ; + aerr = &error_cache->errors[type]; bank_error =get_bank_error (aerr, info);if (!bank_error) --2.34.1
PATCH 4/5 drm/amdgpu: Fix null pointer dereference to bo
In reply to Ma JunCheck bo before using it
--- drivers/gpu/drm/amd/amdgpu/gmc_v12_0.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/gmc_v12_0.c +11 -5
@@ -497,9 +497,8 @@ static void gmc_v12_0_get_vm_pte(struct amdgpu_device *adev, uint64_t *flags) {struct amdgpu_bo *bo = mapping->bo_va->base.bo; -struct amdgpu_device *bo_adev =amdgpu_ttm_adev (bo->tbo.bdev); -bool coherent = bo->flags &AMDGPU_GEM_CREATE_COHERENT ; -bool is_system = bo->tbo.resource->mem_type ==TTM_PL_SYSTEM ; +struct amdgpu_device *bo_adev; +bool coherent, is_system; *flags &= ~AMDGPU_PTE_EXECUTABLE ;
@@ -515,13 +514,20 @@ static void gmc_v12_0_get_vm_pte(struct amdgpu_device *adev, *flags &= ~AMDGPU_PTE_VALID ; } -if (bo && bo->flags & (AMDGPU_GEM_CREATE_COHERENT | +if (!bo) +return ; + +if (bo->flags & (AMDGPU_GEM_CREATE_COHERENT |AMDGPU_GEM_CREATE_UNCACHED )) *flags = (*flags & ~AMDGPU_PTE_MTYPE_GFX12_MASK ) |AMDGPU_PTE_MTYPE_GFX12 (MTYPE_UC ); + bo_adev =amdgpu_ttm_adev (bo->tbo.bdev); + coherent = bo->flags &AMDGPU_GEM_CREATE_COHERENT ; + is_system = bo->tbo.resource->mem_type ==TTM_PL_SYSTEM ; +/* WA for HW bug */ -if ((bo && is_system) || ((bo_adev != adev) && coherent)) +if (is_system || ((bo_adev != adev) && coherent)) *flags |=AMDGPU_PTE_MTYPE_GFX12 (MTYPE_NC ); }
Signature · 1 line
2.34.1
Re: [PATCH 4/5] drm/amdgpu: Fix null pointer dereference to bo
Am 13.05.24 um 10:56 schrieb Ma Jun:
Quoted 3 lines
Check bo before using it
Signed-off-by Ma Jun <[email protected]>
Quoted 43 lines
--- drivers/gpu/drm/amd/amdgpu/gmc_v12_0.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-)drivers/gpu/drm/amd/amdgpu/gmc_v12_0.c +11
-5@@ -497,9 +497,8 @@ static void gmc_v12_0_get_vm_pte(struct amdgpu_device *adev, uint64_t *flags) {struct amdgpu_bo *bo = mapping->bo_va->base.bo; -struct amdgpu_device *bo_adev =amdgpu_ttm_adev (bo->tbo.bdev); -bool coherent = bo->flags &AMDGPU_GEM_CREATE_COHERENT ; -bool is_system = bo->tbo.resource->mem_type ==TTM_PL_SYSTEM ; +struct amdgpu_device *bo_adev; +bool coherent, is_system; *flags &= ~AMDGPU_PTE_EXECUTABLE ;@@ -515,13 +514,20 @@ static void gmc_v12_0_get_vm_pte(struct amdgpu_device *adev, *flags &= ~AMDGPU_PTE_VALID ; } -if (bo && bo->flags & (AMDGPU_GEM_CREATE_COHERENT | +if (!bo) +return ; + +if (bo->flags & (AMDGPU_GEM_CREATE_COHERENT |AMDGPU_GEM_CREATE_UNCACHED )) *flags = (*flags & ~AMDGPU_PTE_MTYPE_GFX12_MASK ) |AMDGPU_PTE_MTYPE_GFX12 (MTYPE_UC ); + bo_adev =amdgpu_ttm_adev (bo->tbo.bdev); + coherent = bo->flags &AMDGPU_GEM_CREATE_COHERENT ; + is_system = bo->tbo.resource->mem_type ==TTM_PL_SYSTEM ; +/* WA for HW bug */ -if ((bo && is_system) || ((bo_adev != adev) && coherent)) +if (is_system || ((bo_adev != adev) && coherent)) *flags |=AMDGPU_PTE_MTYPE_GFX12 (MTYPE_NC ); }
PATCH 5/5 drm/amdgpu: Remove dead code in amdgpu_ras_add_mca_err_addr
In reply to Ma JunRemove dead code in amdgpu_ras_add_mca_err_addr
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 13 ------------- 1 file changed, 13 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +0 -13
@@ -4292,21 +4292,8 @@ static struct ras_err_info *amdgpu_ras_error_get_info(struct ras_err_data *err_dvoid amdgpu_ras_add_mca_err_addr (struct ras_err_info *err_info,struct ras_err_addr *err_addr) { -struct ras_err_addr *mca_err_addr; -/* This function will be retired. */ return ; - mca_err_addr =kzalloc (sizeof (*mca_err_addr),GFP_KERNEL ); -if (!mca_err_addr) -return ; - -INIT_LIST_HEAD (&mca_err_addr->node); - - mca_err_addr->err_status = err_addr->err_status; - mca_err_addr->err_ipid = err_addr->err_ipid; - mca_err_addr->err_addr = err_addr->err_addr; - -list_add_tail (&mca_err_addr->node, &err_info->err_addr_list); }void amdgpu_ras_del_mca_err_addr (struct ras_err_info *err_info,struct ras_err_addr *mca_err_addr)
Signature · 1 line
2.34.1
RE: [PATCH 5/5] drm/amdgpu: Remove dead code in amdgpu_ras_add_mca_err_addr
[AMD Official Use Only - AMD Internal Distribution Only]
-----------------
Best Regards,
Thomas
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Ma Jun
Sent: Monday, May 13, 2024 4:56 PM
To: [email protected]
Cc: Feng, Kenneth <[email protected]>; Deucher, Alexander <[email protected]>; Wang, Yang(Kevin) <[email protected]>; Koenig, Christian <[email protected]>; Ma, Jun <[email protected]>
Subject: [PATCH 5/5] drm/amdgpu: Remove dead code in amdgpu_ras_add_mca_err_addr
Remove dead code in amdgpu_ras_add_mca_err_addr
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 13 ------------- 1 file changed, 13 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +0 -14
@@ -4292,21 +4292,8 @@ static struct ras_err_info *amdgpu_ras_error_get_info(struct ras_err_data *err_dvoid amdgpu_ras_add_mca_err_addr (struct ras_err_info *err_info,struct ras_err_addr *err_addr) { -struct ras_err_addr *mca_err_addr; -/* This function will be retired. */ return ; - mca_err_addr =kzalloc (sizeof (*mca_err_addr),GFP_KERNEL ); -if (!mca_err_addr) -return ; - -INIT_LIST_HEAD (&mca_err_addr->node); - - mca_err_addr->err_status = err_addr->err_status; - mca_err_addr->err_ipid = err_addr->err_ipid; - mca_err_addr->err_addr = err_addr->err_addr; - -list_add_tail (&mca_err_addr->node, &err_info->err_addr_list); }void amdgpu_ras_del_mca_err_addr (struct ras_err_info *err_info,struct ras_err_addr *mca_err_addr) --
2.34.1
[AMD Official Use Only - AMD Internal Distribution Only]
Best Regards,
Kevin
-----Original Message-----
From: Ma, Jun <[email protected]>
Sent: Monday, May 13, 2024 4:56 PM
To: [email protected]
Cc: Feng, Kenneth <[email protected]>; Deucher, Alexander <[email protected]>; Wang, Yang(Kevin) <[email protected]>; Koenig, Christian <[email protected]>; Ma, Jun <[email protected]>
Subject: [PATCH 1/5] drm/amdgpu/pm: Fix the null pointer dereference for smu7
optimize the code to avoid pass a null pointer (hwmgr->backend) to function smu7_update_edc_leakage_table.
--- .../drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c | 50 +++++++++---------- 1 file changed, 24 insertions(+), 26 deletions(-)
drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c +24 -26
@@ -2957,6 +2957,7 @@ static int smu7_update_edc_leakage_table(struct pp_hwmgr *hwmgr)static int smu7_hwmgr_backend_init (struct pp_hwmgr *hwmgr) { +struct amdgpu_device *adev = hwmgr->adev;struct smu7_hwmgr *data;int result =0 ;
@@ -2993,40 +2994,37 @@ static int smu7_hwmgr_backend_init(struct pp_hwmgr *hwmgr)/* Initalize Dynamic State Adjustment Rule Settings */ result =phm_initializa_dynamic_state_adjustment_rule_settings (hwmgr); -if (0 == result) { -struct amdgpu_device *adev = hwmgr->adev; +if (result) + goto fail; - data->is_tlu_enabled = false; + data->is_tlu_enabled = false; - hwmgr->platform_descriptor.hardwareActivityPerformanceLevels = + hwmgr->platform_descriptor.hardwareActivityPerformanceLevels =SMU7_MAX_HARDWARE_POWERLEVELS ; - hwmgr->platform_descriptor.hardwarePerformanceLevels =2 ; - hwmgr->platform_descriptor.minimumClocksReductionPercentage =50 ; + hwmgr->platform_descriptor.hardwarePerformanceLevels =2 ; + hwmgr->platform_descriptor.minimumClocksReductionPercentage =50 ; - data->pcie_gen_cap = adev->pm.pcie_gen_mask; -if (data->pcie_gen_cap &CAIL_PCIE_LINK_SPEED_SUPPORT_GEN3 ) - data->pcie_spc_cap =20 ; -else - data->pcie_spc_cap =16 ; - data->pcie_lane_cap = adev->pm.pcie_mlw_mask; - - hwmgr->platform_descriptor.vbiosInterruptId =0x20000400 ;/* IRQ_SOURCE1_SW_INT */ -/* The true clock step depends on the frequency, typically 4.5 or 9 MHz. Here we use 5. */ - hwmgr->platform_descriptor.clockStep.engineClock =500 ; - hwmgr->platform_descriptor.clockStep.memoryClock =500 ; -smu7_thermal_parameter_init (hwmgr); - }else { -/* Ignore return value in here, we are cleaning up a mess. */ -smu7_hwmgr_backend_fini (hwmgr); - } + data->pcie_gen_cap = adev->pm.pcie_gen_mask; +if (data->pcie_gen_cap &CAIL_PCIE_LINK_SPEED_SUPPORT_GEN3 ) + data->pcie_spc_cap =20 ; +else + data->pcie_spc_cap =16 ; + data->pcie_lane_cap = adev->pm.pcie_mlw_mask; + + hwmgr->platform_descriptor.vbiosInterruptId =0x20000400 ;/* IRQ_SOURCE1_SW_INT */ +/* The true clock step depends on the frequency, typically 4.5 or 9 MHz. Here we use 5. */ + hwmgr->platform_descriptor.clockStep.engineClock =500 ; + hwmgr->platform_descriptor.clockStep.memoryClock =500 ; +smu7_thermal_parameter_init (hwmgr); result =smu7_update_edc_leakage_table (hwmgr); -if (result) { -smu7_hwmgr_backend_fini (hwmgr); -return result; - } +if (result) + goto fail;return 0 ; +fail: +smu7_hwmgr_backend_fini (hwmgr); +return result; }static int smu7_force_dpm_highest (struct pp_hwmgr *hwmgr)
--
2.34.1