drm/amdgpu: fix dereference after null check
Subsystems (3)
PATCH 1/22 drm/amdgpu: fix dereference after null check
check the pointer hive before use.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -1
@@ -5725,7 +5725,7 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev,* to put adev in the 1st position. */ INIT_LIST_HEAD (&device_list); -if (!amdgpu_sriov_vf (adev) && (adev->gmc.xgmi.num_physical_nodes >1 )) { +if (!amdgpu_sriov_vf (adev) && (adev->gmc.xgmi.num_physical_nodes >1 ) && hive) {list_for_each_entry (tmp_adev, &hive->device_list, gmc.xgmi.head) {list_add_tail (&tmp_adev->reset_list, &device_list);if (adev->shutdown)
Signature · 1 line
2.25.1
PATCH 2/22 drm/amdgpu: the warning dereferencing obj for nbio_v7_4
if ras_manager obj null, don't print NBIO err data
--- drivers/gpu/drm/amd/amdgpu/nbio_v7_4.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/nbio_v7_4.c +1 -1
@@ -383,7 +383,7 @@ static void nbio_v7_4_handle_ras_controller_intr_no_bifring(struct amdgpu_deviceelse WREG32_SOC15 (NBIO ,0 , mmBIF_DOORBELL_INT_CNTL, bif_doorbell_intr_cntl); -if (!ras->disable_ras_err_cnt_harvest) { +if (!ras->disable_ras_err_cnt_harvest && obj) {/* * clear error status after ras_controller_intr * according to hw team and count ue number
Signature · 1 line
2.25.1
RE: [PATCH 02/22] drm/amdgpu: the warning dereferencing obj for nbio_v7_4
[AMD Official Use Only - AMD Internal Distribution Only]
Ping ...
-----Original Message-----
From: Jesse Zhang <[email protected]>
Sent: Friday, May 10, 2024 10:50 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Huang, Tim <[email protected]>; Zhang, Jesse(Jie) <[email protected]>; Zhang, Jesse(Jie) <[email protected]>
Subject: [PATCH 02/22] drm/amdgpu: the warning dereferencing obj for nbio_v7_4
if ras_manager obj null, don't print NBIO err data
--- drivers/gpu/drm/amd/amdgpu/nbio_v7_4.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/nbio_v7_4.c +1 -1
@@ -383,7 +383,7 @@ static void nbio_v7_4_handle_ras_controller_intr_no_bifring(struct amdgpu_deviceelse WREG32_SOC15 (NBIO ,0 , mmBIF_DOORBELL_INT_CNTL, bif_doorbell_intr_cntl); -if (!ras->disable_ras_err_cnt_harvest) { +if (!ras->disable_ras_err_cnt_harvest && obj) {/* * clear error status after ras_controller_intr * according to hw team and count ue number
--
2.25.1
RE: [PATCH 02/22] drm/amdgpu: the warning dereferencing obj for nbio_v7_4
[AMD Official Use Only - AMD Internal Distribution Only]
Hi Jesse,
Quoted 43 lines
-----Original Message-----
From: Zhang, Jesse(Jie) <[email protected]>
Sent: Monday, May 13, 2024 10:18 AM
To: Zhang, Jesse(Jie) <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Huang, Tim <[email protected]>
Subject: RE: [PATCH 02/22] drm/amdgpu: the warning dereferencing obj fornbio_v7_4[AMD Official Use Only - AMD Internal Distribution Only]
Ping ...
-----Original Message-----
From: Jesse Zhang <[email protected]>
Sent: Friday, May 10, 2024 10:50 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Huang, Tim <[email protected]>; Zhang, Jesse(Jie) <[email protected]>; Zhang, Jesse(Jie) <[email protected]>
Subject: [PATCH 02/22] drm/amdgpu: the warning dereferencing obj fornbio_v7_4if
ras_managerobj null, don't print NBIO err dataSigned-off-by Jesse Zhang <[email protected]>--- drivers/gpu/drm/amd/amdgpu/nbio_v7_4.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/nbio_v7_4.c +0
-0@@ -383,7 +383,7 @@ static voidnbio_v7_4_handle_ras_controller_intr_no_bifring(struct
amdgpu_deviceelse WREG32_SOC15(NBIO, 0,
mmBIF_DOORBELL_INT_CNTL,bif_doorbell_intr_cntl);
drivers/gpu/drm/amd/amdgpu/nbio_v7_4.c static void nbio_v7_4_handle_ras_controller_intr_no_bifring(struct amdgpu_device · line 386
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/nbio_v7_4.c +1
-1-if (!ras->disable_ras_err_cnt_harvest) { +if (!ras->disable_ras_err_cnt_harvest && obj) {
We may need to check the ras pointer as well? Such as change to " if (ras && !ras->disable_ras_err_cnt_harvest && obj) {"
Tim Huang
Quoted 6 lines
/*
* clear error status afterras_controller_intr
* according to hw team and count ue number
--
2.25.1
RE: [PATCH 02/22] drm/amdgpu: the warning dereferencing obj for nbio_v7_4
[AMD Official Use Only - AMD Internal Distribution Only]
Hi Tim
-----Original Message-----
From: Huang, Tim <[email protected]>
Sent: Monday, May 13, 2024 12:23 PM
To: Zhang, Jesse(Jie) <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>
Subject: RE: [PATCH 02/22] drm/amdgpu: the warning dereferencing obj for nbio_v7_4
[AMD Official Use Only - AMD Internal Distribution Only]
Hi Jesse,
Quoted 44 lines
-----Original Message-----
From: Zhang, Jesse(Jie) <[email protected]>
Sent: Monday, May 13, 2024 10:18 AM
To: Zhang, Jesse(Jie) <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Huang, Tim <[email protected]>
Subject: RE: [PATCH 02/22] drm/amdgpu: the warning dereferencing obj fornbio_v7_4[AMD Official Use Only - AMD Internal Distribution Only]
Ping ...
-----Original Message-----
From: Jesse Zhang <[email protected]>
Sent: Friday, May 10, 2024 10:50 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Huang, Tim <[email protected]>; Zhang, Jesse(Jie) <[email protected]>; Zhang, Jesse(Jie) <[email protected]>
Subject: [PATCH 02/22] drm/amdgpu: the warning dereferencing obj fornbio_v7_4if
ras_managerobj null, don't print NBIO err dataSigned-off-by Jesse Zhang <[email protected]>--- drivers/gpu/drm/amd/amdgpu/nbio_v7_4.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/nbio_v7_4.c +0
-0@@ -383,7 +383,7 @@ static voidnbio_v7_4_handle_ras_controller_intr_no_bifring(struct
amdgpu_deviceelse WREG32_SOC15(NBIO, 0, mmBIF_DOORBELL_INT_CNTL,
bif_doorbell_intr_cntl);
drivers/gpu/drm/amd/amdgpu/nbio_v7_4.c static void nbio_v7_4_handle_ras_controller_intr_no_bifring(struct amdgpu_device · line 386
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/nbio_v7_4.c +1
-1-if (!ras->disable_ras_err_cnt_harvest) { +if (!ras->disable_ras_err_cnt_harvest && obj) {
We may need to check the ras pointer as well? Such as change to " if (ras && !ras->disable_ras_err_cnt_harvest && obj) {"
[Zhang, Jesse(Jie)] Thanks, will update the patch . Tim Huang
Quoted 6 lines
/*
* clear error status afterras_controller_intr
* according to hw team and count ue number
--
2.25.1
PATCH 3/22 drm/amdgpu: fix the waring dereferencing hive
In reply to Jesse ZhangCheck the amdgpu_hive_info *hive that maybe is NULL.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +3 -0
@@ -1362,6 +1362,9 @@ static void psp_xgmi_reflect_topology_info(struct psp_context *psp,uint8_t dst_num_links = node_info.num_links; hive =amdgpu_get_xgmi_hive (psp->adev); +if (WARN_ON (!hive)) +return ; +list_for_each_entry (mirror_adev, &hive->device_list, gmc.xgmi.head) {struct psp_xgmi_topology_info *mirror_top_info;int j;
Signature · 1 line
2.25.1
RE: [PATCH 03/22] drm/amdgpu: fix the waring dereferencing hive
[AMD Official Use Only - General]
This patch is,
Quoted 36 lines
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Jesse Zhang
Sent: Friday, May 10, 2024 10:50 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Huang, Tim <[email protected]>; Zhang, Jesse(Jie) <[email protected]>; Zhang, Jesse(Jie) <[email protected]>
Subject: [PATCH 03/22] drm/amdgpu: fix the waring dereferencing hiveCheck the
amdgpu_hive_info*hive that maybe is NULL.Signed-off-by Jesse Zhang <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 3 +++ 1 file changed, 3 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +3
-0@@ -1362,6 +1362,9 @@ static void psp_xgmi_reflect_topology_info(structpsp_context *psp, uint8_t dst_num_links = node_info.num_links; hive =amdgpu_get_xgmi_hive (psp->adev); +if (WARN_ON (!hive)) +return ; +list_for_each_entry (mirror_adev, &hive->device_list, gmc.xgmi.head) {struct psp_xgmi_topology_info *mirror_top_info;int j;--
2.25.1
PATCH 4/22 drm/amd: fix the warning unchecking return vaule for sdma_v7
In reply to Jesse Zhangcheck ring allocate success before emit preempt ib
--- drivers/gpu/drm/amd/amdgpu/sdma_v7_0.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/sdma_v7_0.c +5 -1
@@ -1347,7 +1347,11 @@ static int sdma_v7_0_ring_preempt_ib(struct amdgpu_ring *ring)/* emit the trailing fence */ ring->trail_seq +=1 ; -amdgpu_ring_alloc (ring,10 ); + r =amdgpu_ring_alloc (ring,10 ); +if (r) { +DRM_ERROR ("ring %d failed to be allocated \n" , ring->idx); +return r; + }sdma_v7_0_ring_emit_fence (ring, ring->trail_fence_gpu_addr, ring->trail_seq,0 );amdgpu_ring_commit (ring);
Signature · 1 line
2.25.1
RE: [PATCH 04/22] drm/amd: fix the warning unchecking return vaule for sdma_v7
[AMD Official Use Only - General]
This patch is,
Quoted 40 lines
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Jesse Zhang
Sent: Friday, May 10, 2024 10:50 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Huang, Tim <[email protected]>; Zhang, Jesse(Jie) <[email protected]>; Zhang, Jesse(Jie) <[email protected]>
Subject: [PATCH 04/22] drm/amd: fix the warning unchecking return vaule forsdma_v7check ring allocate success before emit preempt ib
Signed-off-by Jesse Zhang <[email protected]>--- drivers/gpu/drm/amd/amdgpu/sdma_v7_0.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/sdma_v7_0.c +5
-1@@ -1347,7 +1347,11 @@ static int sdma_v7_0_ring_preempt_ib(struct amdgpu_ring *ring)/* emit the trailing fence */ ring->trail_seq += 1; -amdgpu_ring_alloc (ring,10 ); + r =amdgpu_ring_alloc (ring,10 ); +if (r) { +DRM_ERROR ("ring %d failed to be allocated \n" , ring->idx); +return r; + }sdma_v7_0_ring_emit_fence (ring, ring->trail_fence_gpu_addr, ring->trail_seq,0 );amdgpu_ring_commit(ring);--
2.25.1
PATCH 5/22 drm/amd/pm: check specific index for aldebaran
In reply to Jesse ZhangCheck for specific indexes that may be invalid values.
--- drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +2 -1
@@ -1886,7 +1886,8 @@ static int aldebaran_mode2_reset(struct smu_context *smu) index =smu_cmn_to_asic_specific_index (smu,CMN2ASIC_MAPPING_MSG , SMU_MSG_GfxDeviceDriverReset); - +if (index <0 ) +return -EINVAL ;mutex_lock (&smu->message_lock);if (smu->smc_fw_version >=0x00441400 ) { ret =smu_cmn_send_msg_without_waiting (smu, (uint16_t )index,SMU_RESET_MODE_2 );
Signature · 1 line
2.25.1
RE: [PATCH 05/22] drm/amd/pm: check specific index for aldebaran
[AMD Official Use Only - General]
Best Regards,
Kevin
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Jesse Zhang
Sent: Friday, May 10, 2024 10:50 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Huang, Tim <[email protected]>; Zhang, Jesse(Jie) <[email protected]>; Zhang, Jesse(Jie) <[email protected]>
Subject: [PATCH 05/22] drm/amd/pm: check specific index for aldebaran
Check for specific indexes that may be invalid values.
--- drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +2 -1
@@ -1886,7 +1886,8 @@ static int aldebaran_mode2_reset(struct smu_context *smu) index =smu_cmn_to_asic_specific_index (smu,CMN2ASIC_MAPPING_MSG , SMU_MSG_GfxDeviceDriverReset); - +if (index <0 ) +return -EINVAL ;
[Kevin]:
Better to add a new blank line here.
Best Regards,
Kevin
mutex_lock(&smu->message_lock);
if (smu->smc_fw_version >= 0x00441400) {
ret = smu_cmn_send_msg_without_waiting(smu, (uint16_t)index, SMU_RESET_MODE_2);--
2.25.1
RE: [PATCH 05/22] drm/amd/pm: check specific index for aldebaran
In reply to Jesse Zhang[AMD Official Use Only - General]
This patch is,
Quoted 38 lines
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Jesse Zhang
Sent: Friday, May 10, 2024 10:50 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Huang, Tim <[email protected]>; Zhang, Jesse(Jie) <[email protected]>; Zhang, Jesse(Jie) <[email protected]>
Subject: [PATCH 05/22] drm/amd/pm: check specific index for aldebaranCheck for specific indexes that may be invalid values.
Signed-off-by Jesse Zhang <[email protected]>--- drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +2
-1@@ -1886,7 +1886,8 @@ static int aldebaran_mode2_reset(struct smu_context *smu) index =smu_cmn_to_asic_specific_index (smu,CMN2ASIC_MAPPING_MSG , SMU_MSG_GfxDeviceDriverReset); - +if (index <0 ) +return -EINVAL ;mutex_lock (&smu->message_lock);if (
smu->smc_fw_version>=0x00441400) {
ret = smu_cmn_send_msg_without_waiting(smu, (uint16_t)index,SMU_RESET_MODE_2);
--
2.25.1
Re: [PATCH 05/22] drm/amd/pm: check specific index for aldebaran
In reply to Jesse ZhangQuoted 12 lines · Jesse Zhang
Check for specific indexes that may be invalid values.
Signed-off-by Jesse Zhang <[email protected]>--- drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +0
-0
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c static int aldebaran_mode2_reset(struct smu_context *smu) · line 1890
Quoted 6 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +2
-1@@ -1886,7 +1886,8 @@ static int aldebaran_mode2_reset(struct smu_context *smu) index =smu_cmn_to_asic_specific_index (smu,CMN2ASIC_MAPPING_MSG , SMU_MSG_GfxDeviceDriverReset); - +if (index <0 ) +return -EINVAL ;
To avoid warning problems, drop index and use PPSMC_MSG_GfxDriverReset instead of index.
Thanks,
Lijo
Quoted 3 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +0
-0mutex_lock (&smu->message_lock);if (smu->smc_fw_version >=0x00441400 ) { ret =smu_cmn_send_msg_without_waiting (smu, (uint16_t )index,SMU_RESET_MODE_2 );
PATCH 6/22 drm/amd/pm: check the return of send smc msg for sienna_cichild
In reply to Jesse ZhangSet smu work laod mask may fail, so check return.
--- drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +3 -1
@@ -1782,8 +1782,10 @@ static int sienna_cichlid_set_power_profile_mode(struct smu_context *smu, long * smu->power_profile_mode);if (workload_type <0 )return -EINVAL ; -smu_cmn_send_smc_msg_with_param (smu, SMU_MSG_SetWorkloadMask, + ret =smu_cmn_send_smc_msg_with_param (smu, SMU_MSG_SetWorkloadMask,1 << workload_type,NULL ); +if (ret) +dev_err (smu->adev->dev,"[%s] Failed to set work load mask!" , __func__);return ret; }
Signature · 1 line
2.25.1
RE: [PATCH 06/22] drm/amd/pm: check the return of send smc msg for sienna_cichild
[AMD Official Use Only - General]
This patch is,
Quoted 42 lines
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Jesse Zhang
Sent: Friday, May 10, 2024 10:50 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Huang, Tim <[email protected]>; Zhang, Jesse(Jie) <[email protected]>; Zhang, Jesse(Jie) <[email protected]>
Subject: [PATCH 06/22] drm/amd/pm: check the return of send smc msg forsienna_cichildSet smu work laod mask may fail, so check return.
Signed-off-by Jesse Zhang <[email protected]>--- drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +0
-0@@ -1782,8 +1782,10 @@ static intsienna_cichlid_set_power_profile_mode(struct
smu_context*smu, long *smu->power_profile_mode); if (workload_type < 0) return -EINVAL;- smu_cmn_send_smc_msg_with_param(smu,
SMU_MSG_SetWorkloadMask,
+ ret = smu_cmn_send_smc_msg_with_param(smu,SMU_MSG_SetWorkloadMask,1 << workload_type, NULL);drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +2
-0+if (ret) + dev_err(smu->adev->dev, "[%s] Failed to set work load mask!",
__func__);return ret;}
--
2.25.1
PATCH 7/22 drm/amd/pm: check the return of send smc msg for navi10
In reply to Jesse ZhangSet smu work laod mask may fail, so check return.
--- drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c +4 -2
@@ -2081,9 +2081,11 @@ static int navi10_set_power_profile_mode(struct smu_context *smu, long *input, u smu->power_profile_mode);if (workload_type <0 )return -EINVAL ; -smu_cmn_send_smc_msg_with_param (smu, SMU_MSG_SetWorkloadMask, + ret =smu_cmn_send_smc_msg_with_param (smu, SMU_MSG_SetWorkloadMask,1 << workload_type,NULL ); - +if (ret) +dev_err (smu->adev->dev,"[%s] Failed to set work load mask!" , __func__); +return ret; }
Signature · 1 line
2.25.1
RE: [PATCH 07/22] drm/amd/pm: check the return of send smc msg for navi10
[AMD Official Use Only - General]
This patch is,
Quoted 42 lines
-----Original Message-----
From: Jesse Zhang <[email protected]>
Sent: Friday, May 10, 2024 10:50 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Huang, Tim <[email protected]>; Zhang, Jesse(Jie) <[email protected]>; Zhang, Jesse(Jie) <[email protected]>
Subject: [PATCH 07/22] drm/amd/pm: check the return of send smc msg for navi10Set smu work laod mask may fail, so check return.
Signed-off-by Jesse Zhang <[email protected]>--- drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c +0
-0@@ -2081,9 +2081,11 @@ static int navi10_set_power_profile_mode(struct
smu_context*smu, long *input, usmu->power_profile_mode); if (workload_type < 0) return -EINVAL;- smu_cmn_send_smc_msg_with_param(smu,
SMU_MSG_SetWorkloadMask,
+ ret = smu_cmn_send_smc_msg_with_param(smu,SMU_MSG_SetWorkloadMask,1 << workload_type, NULL);drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c +2
-1- +if (ret) + dev_err(smu->adev->dev, "[%s] Failed to set work load mask!",
__func__);
+return ret;}
--
2.25.1
PATCH 8/22 drm/amd/pm: check the return of send smc msg for smu_v13
In reply to Jesse ZhangSet smu work laod mask may fail, so check return.
--- drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c +3 -1
@@ -2495,8 +2495,10 @@ static int smu_v13_0_7_set_power_profile_mode(struct smu_context *smu, long *inp smu->power_profile_mode);if (workload_type <0 )return -EINVAL ; -smu_cmn_send_smc_msg_with_param (smu, SMU_MSG_SetWorkloadMask, + ret =smu_cmn_send_smc_msg_with_param (smu, SMU_MSG_SetWorkloadMask,1 << workload_type,NULL ); +if (ret) +dev_err (smu->adev->dev,"[%s] Failed to set work load mask!" , __func__);return ret; }
Signature · 1 line
2.25.1
RE: [PATCH 08/22] drm/amd/pm: check the return of send smc msg for smu_v13
[AMD Official Use Only - General]
This patch is,
Quoted 42 lines
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Jesse Zhang
Sent: Friday, May 10, 2024 10:50 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Huang, Tim <[email protected]>; Zhang, Jesse(Jie) <[email protected]>; Zhang, Jesse(Jie) <[email protected]>
Subject: [PATCH 08/22] drm/amd/pm: check the return of send smc msg forsmu_v13Set smu work laod mask may fail, so check return.
Signed-off-by Jesse Zhang <[email protected]>--- drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c +0
-0@@ -2495,8 +2495,10 @@ static intsmu_v13_0_7_set_power_profile_mode(struct
smu_context*smu, long *inpsmu->power_profile_mode); if (workload_type < 0) return -EINVAL;- smu_cmn_send_smc_msg_with_param(smu,
SMU_MSG_SetWorkloadMask,
+ ret = smu_cmn_send_smc_msg_with_param(smu,SMU_MSG_SetWorkloadMask,1 << workload_type, NULL);drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c +2
-0+if (ret) + dev_err(smu->adev->dev, "[%s] Failed to set work load mask!",
__func__);return ret;}
--
2.25.1
PATCH 9/22 drm/amd/pm: check specific index for smu13
In reply to Jesse ZhangCheck for specific indexes that may be invalid values.
--- drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c +2 -0
@@ -2336,6 +2336,8 @@ static int smu_v13_0_6_mode2_reset(struct smu_context *smu) index =smu_cmn_to_asic_specific_index (smu,CMN2ASIC_MAPPING_MSG , SMU_MSG_GfxDeviceDriverReset); +if (index <0 ) + ret = -EINVAL ;mutex_lock (&smu->message_lock);
Signature · 1 line
2.25.1
RE: [PATCH 09/22] drm/amd/pm: check specific index for smu13
[AMD Official Use Only - General]
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Jesse Zhang
Sent: Friday, May 10, 2024 10:50 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Huang, Tim <[email protected]>; Zhang, Jesse(Jie) <[email protected]>; Zhang, Jesse(Jie) <[email protected]>
Subject: [PATCH 09/22] drm/amd/pm: check specific index for smu13
Check for specific indexes that may be invalid values.
--- drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c +2 -0
@@ -2336,6 +2336,8 @@ static int smu_v13_0_6_mode2_reset(struct smu_context *smu) index =smu_cmn_to_asic_specific_index (smu,CMN2ASIC_MAPPING_MSG , SMU_MSG_GfxDeviceDriverReset); +if (index <0 ) + ret = -EINVAL ;mutex_lock (&smu->message_lock);
--
2.25.1
RE: [PATCH 09/22] drm/amd/pm: check specific index for smu13
In reply to Jesse Zhang[AMD Official Use Only - General]
Hi Jesse,
Quoted 24 lines
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Jesse Zhang
Sent: Friday, May 10, 2024 10:50 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Huang, Tim <[email protected]>; Zhang, Jesse(Jie) <[email protected]>; Zhang, Jesse(Jie) <[email protected]>
Subject: [PATCH 09/22] drm/amd/pm: check specific index for smu13Check for specific indexes that may be invalid values.
Signed-off-by Jesse Zhang <[email protected]>--- drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c | 2 ++ 1 file changed, 2 insertions(+)drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c +0
-0
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c static int smu_v13_0_6_mode2_reset(struct · line 2342
Quoted 7 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c +2
-0@@ -2336,6 +2336,8 @@ static int smu_v13_0_6_mode2_reset(struct smu_context *smu) index =smu_cmn_to_asic_specific_index (smu,CMN2ASIC_MAPPING_MSG , SMU_MSG_GfxDeviceDriverReset); +if (index <0 ) + ret = -EINVAL ;
We should need to return the index here?
Tim
Quoted 5 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c +0
-1mutex_lock (&smu->message_lock); --2.25.1
RE: [PATCH 09/22] drm/amd/pm: check specific index for smu13
[AMD Official Use Only - General]
HI Tim
-----Original Message-----
From: Huang, Tim <[email protected]>
Sent: Friday, May 10, 2024 2:37 PM
To: Zhang, Jesse(Jie) <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Zhang, Jesse(Jie) <[email protected]>; Zhang, Jesse(Jie) <[email protected]>
Subject: RE: [PATCH 09/22] drm/amd/pm: check specific index for smu13
[AMD Official Use Only - General]
Hi Jesse,
Quoted 24 lines
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Jesse Zhang
Sent: Friday, May 10, 2024 10:50 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Huang, Tim <[email protected]>; Zhang, Jesse(Jie) <[email protected]>; Zhang, Jesse(Jie) <[email protected]>
Subject: [PATCH 09/22] drm/amd/pm: check specific index for smu13Check for specific indexes that may be invalid values.
Signed-off-by Jesse Zhang <[email protected]>--- drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c | 2 ++ 1 file changed, 2 insertions(+)drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c +0
-0
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c static int smu_v13_0_6_mode2_reset(struct · line 2343
Quoted 8 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c +2
-0@@ -2336,6 +2336,8 @@ static int smu_v13_0_6_mode2_reset(struct smu_context *smu) index =smu_cmn_to_asic_specific_index (smu,CMN2ASIC_MAPPING_MSG , SMU_MSG_GfxDeviceDriverReset); +if (index <0 ) + ret = -EINVAL ;
We should need to return the index here?
[Zhang, Jesse(Jie)] Thanks Tim. Yes, I will another patch for it .
Tim
Quoted 5 lines
mutex_lock(&smu->message_lock);--
2.25.1
Re: [PATCH 09/22] drm/amd/pm: check specific index for smu13
In reply to Jesse ZhangQuoted 12 lines · Jesse Zhang
Check for specific indexes that may be invalid values.
Signed-off-by Jesse Zhang <[email protected]>--- drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c | 2 ++ 1 file changed, 2 insertions(+)drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c +0
-0
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c static int smu_v13_0_6_mode2_reset(struct smu_context *smu) · line 2341
Quoted 6 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c +2
-0@@ -2336,6 +2336,8 @@ static int smu_v13_0_6_mode2_reset(struct smu_context *smu) index =smu_cmn_to_asic_specific_index (smu,CMN2ASIC_MAPPING_MSG , SMU_MSG_GfxDeviceDriverReset); +if (index <0 ) + ret = -EINVAL ;
This check is unnecessary. This is IP specific logic and the index is expected to exist.
See this entry in smu_v13_0_6_message_map
MSG_MAP(GfxDeviceDriverReset, PPSMC_MSG_GfxDriverReset,
SMU_MSG_RAS_PRI),
Thanks,
Lijo
Quoted 2 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c +0
-0mutex_lock (&smu->message_lock);
Re: [PATCH 09/22] drm/amd/pm: check specific index for smu13
Quoted 16 lines · Lijo
Quoted 13 lines · Jesse Zhang
Check for specific indexes that may be invalid values.
Signed-off-by Jesse Zhang <[email protected]>--- drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c | 2 ++ 1 file changed, 2 insertions(+)drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c +0
-0@@ -2336,6 +2336,8 @@ static int smu_v13_0_6_mode2_reset(struct smu_context *smu)
Quoted 9 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c static int smu_v13_0_6_mode2_reset(struct smu_context *smu) · line 2341
Quoted 5 lines
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c +2
-0index =smu_cmn_to_asic_specific_index (smu,CMN2ASIC_MAPPING_MSG , SMU_MSG_GfxDeviceDriverReset); +if (index <0 ) + ret = -EINVAL ;This check is unnecessary. This is IP specific logic and the index is expected to exist.
If you are seeing a warning problem because of this, drop index and use PPSMC_MSG_GfxDriverReset directly.
Thanks,
Lijo
Quoted 10 lines
See this entry in
smu_v13_0_6_message_mapMSG_MAP(GfxDeviceDriverReset,
PPSMC_MSG_GfxDriverReset,SMU_MSG_RAS_PRI),Quoted 1 line
Thanks,
LijoQuoted 2 lines
mutex_lock(&smu->message_lock);
PATCH 10/22 drm/amdgpu: remove structurally dead code
In reply to Jesse ZhangThis code cannot be reached: return "UNKNOWN";.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h | 2 -- 1 file changed, 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h +0 -2
@@ -554,8 +554,6 @@ static inline const char *amdgpu_gfx_compute_mode_desc(int mode)default : return "UNKNOWN"; } - -return "UNKNOWN" ; }#endif
Signature · 1 line
2.25.1
RE: [PATCH 10/22] drm/amdgpu: remove structurally dead code
[AMD Official Use Only - General]
This patch is,
Quoted 35 lines
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Jesse Zhang
Sent: Friday, May 10, 2024 10:50 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Huang, Tim <[email protected]>; Zhang, Jesse(Jie) <[email protected]>; Zhang, Jesse(Jie) <[email protected]>
Subject: [PATCH 10/22] drm/amdgpu: remove structurally dead codeThis code cannot be reached: return "UNKNOWN";.
Signed-off-by Jesse Zhang <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h | 2 -- 1 file changed, 2 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h +0
-2@@ -554,8 +554,6 @@ static inline const char *amdgpu_gfx_compute_mode_desc(int mode)default :return "UNKNOWN" ; } - -return "UNKNOWN" ; }#endif
--
2.25.1
PATCH 11/22 drm/amdgpu: remove structurally dead code for amd_gmc
In reply to Jesse ZhangThis code cannot be reached: return sysfs_emit(buf, "UNK....)
--- drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c | 2 -- 1 file changed, 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c +0 -2
@@ -1148,8 +1148,6 @@ static ssize_t current_memory_partition_show(default :return sysfs_emit (buf,"UNKNOWN\n" ); } - -return sysfs_emit (buf,"UNKNOWN\n" ); }static DEVICE_ATTR_RO (current_memory_partition);
Signature · 1 line
2.25.1
RE: [PATCH 11/22] drm/amdgpu: remove structurally dead code for amd_gmc
[AMD Official Use Only - General]
This patch is,
Quoted 34 lines
-----Original Message-----
From: Jesse Zhang <[email protected]>
Sent: Friday, May 10, 2024 10:50 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Huang, Tim <[email protected]>; Zhang, Jesse(Jie) <[email protected]>; Zhang, Jesse(Jie) <[email protected]>
Subject: [PATCH 11/22] drm/amdgpu: remove structurally dead code foramd_gmcThis code cannot be reached: return
sysfs_emit(buf, "UNK....)Signed-off-by Jesse Zhang <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c | 2 -- 1 file changed, 2 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c +0
-3@@ -1148,8 +1148,6 @@ static ssize_t current_memory_partition_show(default :return sysfs_emit (buf,"UNKNOWN\n" ); } - -return sysfs_emit (buf,"UNKNOWN\n" ); }static DEVICE_ATTR_RO (current_memory_partition); --2.25.1
PATCH 12/22 drm/amd/pm: remove logically dead code
In reply to Jesse ZhangExecution cannot reach this statement: case POWER_STATE_TYPE_BALAN.
--- drivers/gpu/drm/amd/pm/legacy-dpm/legacy_dpm.c | 9 --------- 1 file changed, 9 deletions(-)
drivers/gpu/drm/amd/pm/legacy-dpm/legacy_dpm.c +0 -9
@@ -831,15 +831,6 @@ static struct amdgpu_ps *amdgpu_dpm_pick_power_state(struct amdgpu_device *adev,return ps; }break ; -case POWER_STATE_TYPE_BALANCED : -if (ui_class ==ATOM_PPLIB_CLASSIFICATION_UI_BALANCED ) { -if (ps->caps &ATOM_PPLIB_SINGLE_DISPLAY_ONLY ) { -if (single_display) -return ps; - }else -return ps; - } -break ;case POWER_STATE_TYPE_PERFORMANCE :if (ui_class ==ATOM_PPLIB_CLASSIFICATION_UI_PERFORMANCE ) {if (ps->caps &ATOM_PPLIB_SINGLE_DISPLAY_ONLY ) {
Signature · 1 line
2.25.1
RE: [PATCH 12/22] drm/amd/pm: remove logically dead code
[AMD Official Use Only - AMD Internal Distribution Only]
Ping ...
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Jesse Zhang
Sent: Friday, May 10, 2024 10:50 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Huang, Tim <[email protected]>; Zhang, Jesse(Jie) <[email protected]>; Zhang, Jesse(Jie) <[email protected]>
Subject: [PATCH 12/22] drm/amd/pm: remove logically dead code
Execution cannot reach this statement: case POWER_STATE_TYPE_BALAN.
--- drivers/gpu/drm/amd/pm/legacy-dpm/legacy_dpm.c | 9 --------- 1 file changed, 9 deletions(-)
drivers/gpu/drm/amd/pm/legacy-dpm/legacy_dpm.c +0 -9
@@ -831,15 +831,6 @@ static struct amdgpu_ps *amdgpu_dpm_pick_power_state(struct amdgpu_device *adev,return ps; }break ; -case POWER_STATE_TYPE_BALANCED : -if (ui_class ==ATOM_PPLIB_CLASSIFICATION_UI_BALANCED ) { -if (ps->caps &ATOM_PPLIB_SINGLE_DISPLAY_ONLY ) { -if (single_display) -return ps; - }else -return ps; - } -break ;case POWER_STATE_TYPE_PERFORMANCE :if (ui_class ==ATOM_PPLIB_CLASSIFICATION_UI_PERFORMANCE ) {if (ps->caps &ATOM_PPLIB_SINGLE_DISPLAY_ONLY ) {
--
2.25.1
Wang, Yang(Kevin)
Acked-byRE: [PATCH 12/22] drm/amd/pm: remove logically dead code
[AMD Official Use Only - AMD Internal Distribution Only]
Best Regards,
Kevin
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Zhang, Jesse(Jie)
Sent: Monday, May 13, 2024 10:19 AM
To: Zhang, Jesse(Jie) <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Huang, Tim <[email protected]>
Subject: RE: [PATCH 12/22] drm/amd/pm: remove logically dead code
[AMD Official Use Only - AMD Internal Distribution Only]
[AMD Official Use Only - AMD Internal Distribution Only]
Ping ...
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Jesse Zhang
Sent: Friday, May 10, 2024 10:50 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Huang, Tim <[email protected]>; Zhang, Jesse(Jie) <[email protected]>; Zhang, Jesse(Jie) <[email protected]>
Subject: [PATCH 12/22] drm/amd/pm: remove logically dead code
Execution cannot reach this statement: case POWER_STATE_TYPE_BALAN.
--- drivers/gpu/drm/amd/pm/legacy-dpm/legacy_dpm.c | 9 --------- 1 file changed, 9 deletions(-)
drivers/gpu/drm/amd/pm/legacy-dpm/legacy_dpm.c +0 -9
@@ -831,15 +831,6 @@ static struct amdgpu_ps *amdgpu_dpm_pick_power_state(struct amdgpu_device *adev,return ps; }break ; -case POWER_STATE_TYPE_BALANCED : -if (ui_class ==ATOM_PPLIB_CLASSIFICATION_UI_BALANCED ) { -if (ps->caps &ATOM_PPLIB_SINGLE_DISPLAY_ONLY ) { -if (single_display) -return ps; - }else -return ps; - } -break ;case POWER_STATE_TYPE_PERFORMANCE :if (ui_class ==ATOM_PPLIB_CLASSIFICATION_UI_PERFORMANCE ) {if (ps->caps &ATOM_PPLIB_SINGLE_DISPLAY_ONLY ) {
--
2.25.1
PATCH 13/22 drm/amd/pm: remove logically dead code for renoir
In reply to Jesse ZhangThe switch governing value clk_type cannot be SMU_GFXCLK and SMU_SCLK.
--- drivers/gpu/drm/amd/pm/swsmu/smu12/renoir_ppt.c | 2 -- 1 file changed, 2 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/smu12/renoir_ppt.c +0 -2
@@ -585,8 +585,6 @@ static int renoir_print_clk_levels(struct smu_context *smu, }switch (clk_type) { -case SMU_GFXCLK : -case SMU_SCLK :case SMU_SOCCLK :case SMU_MCLK :case SMU_DCEFCLK :
Signature · 1 line
2.25.1
RE: [PATCH 13/22] drm/amd/pm: remove logically dead code for renoir
[AMD Official Use Only - General]
Please add following information into commit message.
Best Regards,
Kevin
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Jesse Zhang
Sent: Friday, May 10, 2024 10:50 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Huang, Tim <[email protected]>; Zhang, Jesse(Jie) <[email protected]>; Zhang, Jesse(Jie) <[email protected]>
Subject: [PATCH 13/22] drm/amd/pm: remove logically dead code for renoir
The switch governing value clk_type cannot be SMU_GFXCLK and SMU_SCLK.
--- drivers/gpu/drm/amd/pm/swsmu/smu12/renoir_ppt.c | 2 -- 1 file changed, 2 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/smu12/renoir_ppt.c +0 -2
@@ -585,8 +585,6 @@ static int renoir_print_clk_levels(struct smu_context *smu, }switch (clk_type) { -case SMU_GFXCLK : -case SMU_SCLK :case SMU_SOCCLK :case SMU_MCLK :case SMU_DCEFCLK :
--
2.25.1
PATCH 14/22 drm/amdgu: remove unused code
In reply to Jesse ZhangThe same code is executed when the condition err is true or false, because the code in the if-then branch and after the if statement is identical
--- drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c | 2 -- 1 file changed, 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +0 -2
@@ -963,8 +963,6 @@ static int gfx_v7_0_init_microcode(struct amdgpu_device *adev)snprintf (fw_name,sizeof (fw_name),"amdgpu/%s_rlc.bin" , chip_name); err =amdgpu_ucode_request (adev, &adev->gfx.rlc_fw, fw_name); -if (err) - goto out; out:if (err) {pr_err ("gfx7: Failed to load firmware \"%s\"\n" , fw_name);
Signature · 1 line
2.25.1
RE: [PATCH 14/22] drm/amdgu: remove unused code
[AMD Official Use Only - General]
This patch is,
Quoted 36 lines
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Jesse Zhang
Sent: Friday, May 10, 2024 10:51 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Huang, Tim <[email protected]>; Zhang, Jesse(Jie) <[email protected]>; Zhang, Jesse(Jie) <[email protected]>
Subject: [PATCH 14/22] drm/amdgu: remove unused codeThe same code is executed when the condition err is true or false, because the code in the if-then branch and after the if statement is identical
Signed-off-by Jesse Zhang <[email protected]>--- drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c | 2 -- 1 file changed, 2 deletions(-)drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +0
-2@@ -963,8 +963,6 @@ static int gfx_v7_0_init_microcode(struct amdgpu_device *adev) snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_rlc.bin", chip_name); err =amdgpu_ucode_request (adev, &adev->gfx.rlc_fw, fw_name); -if (err) - goto out; out:if (err) {pr_err("gfx7: Failed to load firmware \"%s\"\n", fw_name);--
2.25.1
PATCH 15/22 drm/amd/pm: fix enum feature compared against 0
In reply to Jesse ZhangThis less-than-zero comparison of an unsigned value is never true. feature < 0U
--- drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c +1 -1
@@ -760,7 +760,7 @@ static const char *__smu_feature_names[] = {static const char *smu_get_feature_name (struct smu_context *smu,enum smu_feature_mask feature) { -if (feature <0 || feature >=SMU_FEATURE_COUNT ) +if (feature >=SMU_FEATURE_COUNT )return "unknown smu feature" ;return __smu_feature_names[feature]; }
Signature · 1 line
2.25.1
RE: [PATCH 15/22] drm/amd/pm: fix enum feature compared against 0
[AMD Official Use Only - General]
Best Regards,
Kevin
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Jesse Zhang
Sent: Friday, May 10, 2024 10:51 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Huang, Tim <[email protected]>; Zhang, Jesse(Jie) <[email protected]>; Zhang, Jesse(Jie) <[email protected]>
Subject: [PATCH 15/22] drm/amd/pm: fix enum feature compared against 0
This less-than-zero comparison of an unsigned value is never true. feature < 0U
--- drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c +1 -2
@@ -760,7 +760,7 @@ static const char *__smu_feature_names[] = { static const char *smu_get_feature_name(struct smu_context *smu, enum smu_feature_mask feature) { -if (feature <0 || feature >=SMU_FEATURE_COUNT ) +if (feature >=SMU_FEATURE_COUNT )return "unknown smu feature" ;return __smu_feature_names[feature]; } --
2.25.1
RE: [PATCH 15/22] drm/amd/pm: fix enum feature compared against 0
In reply to Jesse Zhang[AMD Official Use Only - General]
This patch is,
Quoted 34 lines
-----Original Message-----
From: Jesse Zhang <[email protected]>
Sent: Friday, May 10, 2024 10:51 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Huang, Tim <[email protected]>; Zhang, Jesse(Jie) <[email protected]>; Zhang, Jesse(Jie) <[email protected]>
Subject: [PATCH 15/22] drm/amd/pm: fix enum feature compared against 0This less-than-zero comparison of an unsigned value is never true. feature < 0U
Signed-off-by Jesse Zhang <[email protected]>--- drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c +1
-2@@ -760,7 +760,7 @@ static const char *__smu_feature_names[] = {static const char *smu_get_feature_name (struct smu_context *smu,enum smu_feature_mask feature) { -if (feature <0 || feature >=SMU_FEATURE_COUNT ) +if (feature >=SMU_FEATURE_COUNT )return "unknown smu feature" ;return __smu_feature_names[feature]; } --2.25.1
PATCH 16/22 drm/amd/pm: fix enum type compared against 0
In reply to Jesse ZhangThis less-than-zero comparison of an unsigned value is never true. type < 0U
--- drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c +1 -1
@@ -56,7 +56,7 @@ static const char * const __smu_message_names[] = {static const char *smu_get_message_name (struct smu_context *smu,enum smu_message_type type) { -if (type <0 || type >=SMU_MSG_MAX_COUNT ) +if (type >=SMU_MSG_MAX_COUNT )return "unknown smu message" ;return __smu_message_names[type];
Signature · 1 line
2.25.1
RE: [PATCH 16/22] drm/amd/pm: fix enum type compared against 0
[AMD Official Use Only - General]
This patch is,
Quoted 34 lines
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Jesse Zhang
Sent: Friday, May 10, 2024 10:51 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Huang, Tim <[email protected]>; Zhang, Jesse(Jie) <[email protected]>; Zhang, Jesse(Jie) <[email protected]>
Subject: [PATCH 16/22] drm/amd/pm: fix enum type compared against 0This less-than-zero comparison of an unsigned value is never true. type < 0U
Signed-off-by Jesse Zhang <[email protected]>--- drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c +1
-2@@ -56,7 +56,7 @@ static const char * const __smu_message_names[] = {static const char *smu_get_message_name (struct smu_context *smu,enum smu_message_type type) { -if (type <0 || type >=SMU_MSG_MAX_COUNT ) +if (type >=SMU_MSG_MAX_COUNT )return "unknown smu message" ;return __smu_message_names[type]; --2.25.1
PATCH 17/22 drm/amdgpu: fix the warning bad bit shift operation for aca_error_type type
In reply to Jesse ZhangFilter invalid aca error types before performing a shift operation.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_aca.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_aca.c +1 -1
@@ -534,7 +534,7 @@ int amdgpu_aca_get_error_data(struct amdgpu_device *adev, struct aca_handle *hanif (aca_handle_is_valid (handle))return -EOPNOTSUPP ; -if (!(BIT (type) & handle->mask)) +if ((type <0 ) || (!(BIT (type) & handle->mask)))return 0 ;return __aca_get_error_data (adev, handle, type, err_data, qctx);
Signature · 1 line
2.25.1
RE: [PATCH 17/22] drm/amdgpu: fix the warning bad bit shift operation for aca_error_type type
[AMD Official Use Only - AMD Internal Distribution Only]
Ping ...
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Jesse Zhang
Sent: Friday, May 10, 2024 10:51 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Huang, Tim <[email protected]>; Zhang, Jesse(Jie) <[email protected]>; Zhang, Jesse(Jie) <[email protected]>
Subject: [PATCH 17/22] drm/amdgpu: fix the warning bad bit shift operation for aca_error_type type
Filter invalid aca error types before performing a shift operation.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_aca.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_aca.c +1 -1
@@ -534,7 +534,7 @@ int amdgpu_aca_get_error_data(struct amdgpu_device *adev, struct aca_handle *hanif (aca_handle_is_valid (handle))return -EOPNOTSUPP ; -if (!(BIT (type) & handle->mask)) +if ((type <0 ) || (!(BIT (type) & handle->mask)))return 0 ;return __aca_get_error_data (adev, handle, type, err_data, qctx);
--
2.25.1
Wang, Yang(Kevin)
Reviewed-byRE: [PATCH 17/22] drm/amdgpu: fix the warning bad bit shift operation for aca_error_type type
[AMD Official Use Only - AMD Internal Distribution Only]
Best Regards,
Kevin
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Zhang, Jesse(Jie)
Sent: Monday, May 13, 2024 10:19 AM
To: Zhang, Jesse(Jie) <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Huang, Tim <[email protected]>
Subject: RE: [PATCH 17/22] drm/amdgpu: fix the warning bad bit shift operation for aca_error_type type
[AMD Official Use Only - AMD Internal Distribution Only]
[AMD Official Use Only - AMD Internal Distribution Only]
Ping ...
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Jesse Zhang
Sent: Friday, May 10, 2024 10:51 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Huang, Tim <[email protected]>; Zhang, Jesse(Jie) <[email protected]>; Zhang, Jesse(Jie) <[email protected]>
Subject: [PATCH 17/22] drm/amdgpu: fix the warning bad bit shift operation for aca_error_type type
Filter invalid aca error types before performing a shift operation.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_aca.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_aca.c +1 -1
@@ -534,7 +534,7 @@ int amdgpu_aca_get_error_data(struct amdgpu_device *adev, struct aca_handle *hanif (aca_handle_is_valid (handle))return -EOPNOTSUPP ; -if (!(BIT (type) & handle->mask)) +if ((type <0 ) || (!(BIT (type) & handle->mask)))return 0 ;return __aca_get_error_data (adev, handle, type, err_data, qctx);
--
2.25.1
PATCH 18/22 drm/amd/pm: check negtive return for table entries
In reply to Jesse ZhangFunction hwmgr->hwmgr_func->get_num_of_pp_table_entries(hwmgr) returns a negative number
--- drivers/gpu/drm/amd/pm/powerplay/hwmgr/pp_psm.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/pm/powerplay/hwmgr/pp_psm.c +2 -3
@@ -30,9 +30,8 @@ int psm_init_power_state_table(struct pp_hwmgr *hwmgr) {int result;unsigned int i; -unsigned int table_entries;struct pp_power_state *state; -int size; +int size, table_entries;if (hwmgr->hwmgr_func->get_num_of_pp_table_entries ==NULL )return 0 ;
@@ -45,7 +44,7 @@ int psm_init_power_state_table(struct pp_hwmgr *hwmgr) hwmgr->ps_size = size = hwmgr->hwmgr_func->get_power_state_size (hwmgr) +sizeof (struct pp_power_state ); -if (table_entries ==0 || size ==0 ) { +if (table_entries <=0 || size ==0 ) {pr_warn ("Please check whether power state management is supported on this asic\n" );return 0 ; }
Signature · 1 line
2.25.1
RE: [PATCH 18/22] drm/amd/pm: check negtive return for table entries
[AMD Official Use Only - AMD Internal Distribution Only]
Ping ...
-----Original Message-----
From: Jesse Zhang <[email protected]>
Sent: Friday, May 10, 2024 10:51 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Huang, Tim <[email protected]>; Zhang, Jesse(Jie) <[email protected]>; Zhang, Jesse(Jie) <[email protected]>
Subject: [PATCH 18/22] drm/amd/pm: check negtive return for table entries
Function hwmgr->hwmgr_func->get_num_of_pp_table_entries(hwmgr) returns a negative number
--- drivers/gpu/drm/amd/pm/powerplay/hwmgr/pp_psm.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/pm/powerplay/hwmgr/pp_psm.c +2 -3
@@ -30,9 +30,8 @@ int psm_init_power_state_table(struct pp_hwmgr *hwmgr) {int result;unsigned int i; -unsigned int table_entries;struct pp_power_state *state; -int size; +int size, table_entries;if (hwmgr->hwmgr_func->get_num_of_pp_table_entries ==NULL )return 0 ;
@@ -45,7 +44,7 @@ int psm_init_power_state_table(struct pp_hwmgr *hwmgr) hwmgr->ps_size = size = hwmgr->hwmgr_func->get_power_state_size (hwmgr) +sizeof (struct pp_power_state ); -if (table_entries ==0 || size ==0 ) { +if (table_entries <=0 || size ==0 ) {pr_warn ("Please check whether power state management is supported on this asic\n" );return 0 ; }
--
2.25.1
RE: [PATCH 18/22] drm/amd/pm: check negtive return for table entries
[AMD Official Use Only - AMD Internal Distribution Only]
Hi Jesse,
Quoted 59 lines
-----Original Message-----
From: Zhang, Jesse(Jie) <[email protected]>
Sent: Monday, May 13, 2024 10:19 AM
To: Zhang, Jesse(Jie) <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Huang, Tim <[email protected]>
Subject: RE: [PATCH 18/22] drm/amd/pm: check negtive return for table entries[AMD Official Use Only - AMD Internal Distribution Only]
Ping ...
-----Original Message-----
From: Jesse Zhang <[email protected]>
Sent: Friday, May 10, 2024 10:51 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Huang, Tim <[email protected]>; Zhang, Jesse(Jie) <[email protected]>; Zhang, Jesse(Jie) <[email protected]>
Subject: [PATCH 18/22] drm/amd/pm: check negtive return for table entriesFunction
hwmgr->hwmgr_func->get_num_of_pp_table_entries(hwmgr)returns a negative numberSigned-off-by Jesse Zhang <[email protected]>--- drivers/gpu/drm/amd/pm/powerplay/hwmgr/pp_psm.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)drivers/gpu/drm/amd/pm/powerplay/hwmgr/pp_psm.c +1
-2@@ -30,9 +30,8 @@ int psm_init_power_state_table(struct pp_hwmgr *hwmgr) {int result;unsigned int i; -unsigned int table_entries;struct pp_power_state *state; -int size; +int size, table_entries;if (hwmgr->hwmgr_func->get_num_of_pp_table_entries ==NULL )return 0 ;@@ -45,7 +44,7 @@ int psm_init_power_state_table(struct pp_hwmgr *hwmgr) hwmgr->ps_size = size =
hwmgr->hwmgr_func->get_power_state_size(hwmgr)+
sizeof(structpp_power_state);drivers/gpu/drm/amd/pm/powerplay/hwmgr/pp_psm.c +1
-1-if (table_entries ==0 || size ==0 ) { +if (table_entries <=0 || size ==0 ) { pr_warn("Please check whether power statemanagement is supported on this asic\n");
Quoted 2 lines
return 0;
}We should need to check this before set the hwmgr->num_ps and hwmgr->ps_size, otherwise we may have incorrect hwmgr->num_ps if meet the condition table_entries < 0.
Tim Huang
Quoted 3 lines
--
2.25.1
PATCH 19/22 drm/amdgpu: Fix the warning division or modulo by zero for the variable num_xcc_per_xcp
In reply to Jesse ZhangDividing expression num_xcc_per_xcp which may be zero has undefined behavior.
--- drivers/gpu/drm/amd/amdgpu/aqua_vanjaram.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/amdgpu/aqua_vanjaram.c +3 -0
@@ -522,6 +522,9 @@ static int aqua_vanjaram_switch_partition_mode(struct amdgpu_xcp_mgr *xcp_mgr, goto unlock; num_xcc_per_xcp =__aqua_vanjaram_get_xcc_per_xcp (xcp_mgr, mode); +if (!num_xcc_per_xcp) + goto unlock; +if (adev->gfx.funcs->switch_partition_mode) adev->gfx.funcs->switch_partition_mode (xcp_mgr->adev, num_xcc_per_xcp);
Signature · 1 line
2.25.1
RE: [PATCH 19/22] drm/amdgpu: Fix the warning division or modulo by zero for the variable num_xcc_per_xcp
[AMD Official Use Only - General]
This patch is,
Quoted 39 lines
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Jesse Zhang
Sent: Friday, May 10, 2024 10:51 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Huang, Tim <[email protected]>; Zhang, Jesse(Jie) <[email protected]>; Zhang, Jesse(Jie) <[email protected]>
Subject: [PATCH 19/22] drm/amdgpu: Fix the warning division or modulo by zero for the variablenum_xcc_per_xcpDividing expression
num_xcc_per_xcpwhich may be zero has undefined behavior.Signed-off-by Jesse Zhang <[email protected]>--- drivers/gpu/drm/amd/amdgpu/aqua_vanjaram.c | 3 +++ 1 file changed, 3 insertions(+)drivers/gpu/drm/amd/amdgpu/aqua_vanjaram.c +3
-0@@ -522,6 +522,9 @@ static int aqua_vanjaram_switch_partition_mode(struct amdgpu_xcp_mgr *xcp_mgr, goto unlock; num_xcc_per_xcp =__aqua_vanjaram_get_xcc_per_xcp (xcp_mgr, mode); +if (!num_xcc_per_xcp) + goto unlock; +if (adev->gfx.funcs->switch_partition_mode)adev->gfx.funcs->switch_partition_mode(xcp_mgr->adev, num_xcc_per_xcp);--
2.25.1
Re: [PATCH 19/22] drm/amdgpu: Fix the warning division or modulo by zero for the variable num_xcc_per_xcp
In reply to Jesse ZhangQuoted 12 lines · Jesse Zhang
Dividing expression
num_xcc_per_xcpwhich may be zero has undefined behavior.Signed-off-by Jesse Zhang <[email protected]>--- drivers/gpu/drm/amd/amdgpu/aqua_vanjaram.c | 3 +++ 1 file changed, 3 insertions(+)drivers/gpu/drm/amd/amdgpu/aqua_vanjaram.c +0
-0
drivers/gpu/drm/amd/amdgpu/aqua_vanjaram.c static int aqua_vanjaram_switch_partition_mode(struct amdgpu_xcp_mgr *xcp_mgr, · line 527
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/aqua_vanjaram.c +3
-0@@ -522,6 +522,9 @@ static int aqua_vanjaram_switch_partition_mode(struct amdgpu_xcp_mgr *xcp_mgr, goto unlock; num_xcc_per_xcp =__aqua_vanjaram_get_xcc_per_xcp (xcp_mgr, mode); +if (!num_xcc_per_xcp) + goto unlock; +
This won't happen as the mode is validated before and for each valid mode a non-zero num_xcc_per_xcp is expected. To satisfy the warning-checker, before going to unlock use a proper 'ret' value also (otherwise it will look odd).
Thanks,
Lijo
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/aqua_vanjaram.c +0
-0if (adev->gfx.funcs->switch_partition_mode) adev->gfx.funcs->switch_partition_mode (xcp_mgr->adev, num_xcc_per_xcp);
RE: [PATCH 19/22] drm/amdgpu: Fix the warning division or modulo by zero for the variable num_xcc_per_xcp
[AMD Official Use Only - General]
Hi Lijo,
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Lazar, Lijo
Sent: Friday, May 10, 2024 3:16 PM
To: [email protected]
Subject: Re: [PATCH 19/22] drm/amdgpu: Fix the warning division or modulo by zero for the variable num_xcc_per_xcp
Quoted 13 lines · Jesse Zhang
Dividing expression
num_xcc_per_xcpwhich may be zero has undefined behavior.Signed-off-by Jesse Zhang <[email protected]>--- drivers/gpu/drm/amd/amdgpu/aqua_vanjaram.c | 3 +++ 1 file changed, 3 insertions(+)drivers/gpu/drm/amd/amdgpu/aqua_vanjaram.c +0
-0
drivers/gpu/drm/amd/amdgpu/aqua_vanjaram.c static int aqua_vanjaram_switch_partition_mode(struct amdgpu_xcp_mgr *xcp_mgr, · line 527
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/aqua_vanjaram.c +3
-0@@ -522,6 +522,9 @@ static int aqua_vanjaram_switch_partition_mode(struct amdgpu_xcp_mgr *xcp_mgr, goto unlock; num_xcc_per_xcp =__aqua_vanjaram_get_xcc_per_xcp (xcp_mgr, mode); +if (!num_xcc_per_xcp) + goto unlock; +
This won't happen as the mode is validated before and for each valid mode a non-zero num_xcc_per_xcp is expected. To satisfy the warning-checker, before going to unlock use a proper 'ret' value also (otherwise it will look odd).
[Zhang, Jesse(Jie)] Is that possible?
When the initialization mode is AMDGPU_AUTO_COMPUTE_PARTITION_MODE, and get AMDGPU_UNKNOWN_COMPUTE_PARTITION_MODE through __aqua_vanjaram_get_auto_mode.
If so, it will skip the valid mode function (__aqua_vanjaram_is_valid_mode).
Thanks
Jesse
Thanks,
Lijo
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/aqua_vanjaram.c +0
-0if (adev->gfx.funcs->switch_partition_mode) adev->gfx.funcs->switch_partition_mode (xcp_mgr->adev, num_xcc_per_xcp);
Re: [PATCH 19/22] drm/amdgpu: Fix the warning division or modulo by zero for the variable num_xcc_per_xcp
Quoted 35 lines · Jesse(Jie)
[AMD Official Use Only - General]
Hi Lijo,
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Lazar, Lijo
Sent: Friday, May 10, 2024 3:16 PM
To: [email protected]
Subject: Re: [PATCH 19/22] drm/amdgpu: Fix the warning division or modulo by zero for the variablenum_xcc_per_xcpQuoted 13 lines · Jesse Zhang
Dividing expression
num_xcc_per_xcpwhich may be zero has undefined behavior.Signed-off-by Jesse Zhang <[email protected]>--- drivers/gpu/drm/amd/amdgpu/aqua_vanjaram.c | 3 +++ 1 file changed, 3 insertions(+)drivers/gpu/drm/amd/amdgpu/aqua_vanjaram.c +0
-0drivers/gpu/drm/amd/amdgpu/aqua_vanjaram.c static int aqua_vanjaram_switch_partition_mode(struct amdgpu_xcp_mgr *xcp_mgr, · line 527
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/aqua_vanjaram.c +3
-0@@ -522,6 +522,9 @@ static int aqua_vanjaram_switch_partition_mode(struct amdgpu_xcp_mgr *xcp_mgr, goto unlock; num_xcc_per_xcp =__aqua_vanjaram_get_xcc_per_xcp (xcp_mgr, mode); +if (!num_xcc_per_xcp) + goto unlock; +This won't happen as the mode is validated before and for each valid mode a non-zero
num_xcc_per_xcpis expected. To satisfy the warning-checker, before going to unlock use a proper 'ret' value also (otherwise it will look odd).
Quoted 6 lines
[Zhang, Jesse(Jie)] Is that possible?
When the initialization mode isAMDGPU_AUTO_COMPUTE_PARTITION_MODE, and getAMDGPU_UNKNOWN_COMPUTE_PARTITION_MODEthrough__aqua_vanjaram_get_auto_mode.If so, it will skip the valid mode function (
__aqua_vanjaram_is_valid_mode).
Yes, that is possible. If auto detection cannot figure out a valid mode, then it needs to return an error from there without proceeding further. That is a better fix.
Thanks,
Lijo
Quoted 10 lines
Thanks
JesseThanks,
LijoQuoted 3 lines
drivers/gpu/drm/amd/amdgpu/aqua_vanjaram.c +0
-0if (adev->gfx.funcs->switch_partition_mode) adev->gfx.funcs->switch_partition_mode (xcp_mgr->adev, num_xcc_per_xcp);
PATCH 20/22 drm/amd/pm: fix get dpm level count for smu13
In reply to Jesse ZhangFor invalid clk types, return -EINVAL to check the return.
--- drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_5_ppt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_5_ppt.c +1 -1
@@ -643,7 +643,7 @@ static int smu_v13_0_5_get_dpm_level_count(struct smu_context *smu, *count = clk_table->NumDfPstatesEnabled;break ;default : -break ; +return -EINVAL ; }return 0 ;
Signature · 1 line
2.25.1
RE: [PATCH 20/22] drm/amd/pm: fix get dpm level count for smu13
[AMD Official Use Only - General]
Best Regards,
Yifan
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Jesse Zhang
Sent: Friday, May 10, 2024 10:51 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Huang, Tim <[email protected]>; Zhang, Jesse(Jie) <[email protected]>; Zhang, Jesse(Jie) <[email protected]>
Subject: [PATCH 20/22] drm/amd/pm: fix get dpm level count for smu13
For invalid clk types, return -EINVAL to check the return.
--- drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_5_ppt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_5_ppt.c +1 -1
@@ -643,7 +643,7 @@ static int smu_v13_0_5_get_dpm_level_count(struct smu_context *smu, *count = clk_table->NumDfPstatesEnabled;break ;default : -break ; +return -EINVAL ; }return 0 ;
--
2.25.1
PATCH 21/22 drm/amd/pm: fix get dpm level count for yello carp
In reply to Jesse ZhangFor invalid clk types, return -EINVAL to check the return.
--- drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c +1 -1
@@ -777,7 +777,7 @@ static int yellow_carp_get_dpm_level_count(struct smu_context *smu, *count = clk_table->NumDfPstatesEnabled;break ;default : -break ; +return -EINVAL ; }return 0 ;
Signature · 1 line
2.25.1
RE: [PATCH 21/22] drm/amd/pm: fix get dpm level count for yello carp
[AMD Official Use Only - General]
Best Regards,
Yifan
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Jesse Zhang
Sent: Friday, May 10, 2024 10:51 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Huang, Tim <[email protected]>; Zhang, Jesse(Jie) <[email protected]>
Subject: [PATCH 21/22] drm/amd/pm: fix get dpm level count for yello carp
For invalid clk types, return -EINVAL to check the return.
--- drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c +1 -1
@@ -777,7 +777,7 @@ static int yellow_carp_get_dpm_level_count(struct smu_context *smu, *count = clk_table->NumDfPstatesEnabled;break ;default : -break ; +return -EINVAL ; }return 0 ;
--
2.25.1
PATCH 22/22 drm/amdgpu: clear the warning unsigned compared against 0 for xcp_id
In reply to Jesse ZhangThis greater-than-or-equal-to-zero comparison of an unsigned value is always true. fpriv->xcp_id >= 0U
--- drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +1 -1
@@ -618,7 +618,7 @@ int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)return -EINVAL ;if (adev->xcp_mgr && adev->xcp_mgr->num_xcps >0 && - fpriv->xcp_id >=0 && fpriv->xcp_id < adev->xcp_mgr->num_xcps) { + fpriv->xcp_id < adev->xcp_mgr->num_xcps) { xcp = &adev->xcp_mgr->xcp[fpriv->xcp_id];switch (type) {case AMD_IP_BLOCK_TYPE_GFX :
Signature · 1 line
2.25.1
RE: [PATCH 22/22] drm/amdgpu: clear the warning unsigned compared against 0 for xcp_id
[AMD Official Use Only - General]
This patch is,
Quoted 37 lines
-----Original Message-----
From: Jesse Zhang <[email protected]>
Sent: Friday, May 10, 2024 10:51 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Huang, Tim <[email protected]>; Zhang, Jesse(Jie) <[email protected]>; Zhang, Jesse(Jie) <[email protected]>
Subject: [PATCH 22/22] drm/amdgpu: clear the warning unsigned compared against 0 forxcp_idThis greater-than-or-equal-to-zero comparison of an unsigned value is always true.
fpriv->xcp_id>= 0USigned-off-by Jesse Zhang <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +1
-1@@ -618,7 +618,7 @@ int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)return -EINVAL ;if (adev->xcp_mgr && adev->xcp_mgr->num_xcps >0 && - fpriv->xcp_id >=0 && fpriv->xcp_id < adev->xcp_mgr->num_xcps) { + fpriv->xcp_id < adev->xcp_mgr->num_xcps) { xcp = &adev->xcp_mgr->xcp[fpriv->xcp_id];switch (type) { case AMD_IP_BLOCK_TYPE_GFX:--
2.25.1
[AMD Official Use Only - General]
Quoted 38 lines
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Jesse Zhang
Sent: Friday, May 10, 2024 10:50 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Huang, Tim <[email protected]>; Zhang, Jesse(Jie) <[email protected]>; Zhang, Jesse(Jie) <[email protected]>
Subject: [PATCH 01/22] drm/amdgpu: fix dereference after null checkcheck the pointer hive before use.
Signed-off-by Jesse Zhang <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1
-1@@ -5725,7 +5725,7 @@ int amdgpu_device_gpu_recover(structamdgpu_device *adev, * to put adev in the 1st position. */ INIT_LIST_HEAD (&device_list); -if (!amdgpu_sriov_vf (adev) && (adev->gmc.xgmi.num_physical_nodes > 1)) { +if (!amdgpu_sriov_vf (adev) && (adev->gmc.xgmi.num_physical_nodes >1 ) && hive) {list_for_each_entry(tmp_adev, &hive->device_list, gmc.xgmi.head) { list_add_tail(&tmp_adev->reset_list, &device_list); if (adev->shutdown)--
2.25.1
Am 10.05.24 um 04:50 schrieb Jesse Zhang:
Quoted 12 lines
check the pointer hive before use.
Signed-off-by Jesse Zhang <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-0
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c int amdgpu_device_gpu_recover(struct amdgpu_device *adev, · line 5728
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1
-1@@ -5725,7 +5725,7 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev,* to put adev in the 1st position. */ INIT_LIST_HEAD (&device_list); -if (!amdgpu_sriov_vf (adev) && (adev->gmc.xgmi.num_physical_nodes >1 )) { +if (!amdgpu_sriov_vf (adev) && (adev->gmc.xgmi.num_physical_nodes >1 ) && hive) {
That solution looks not optimal to me.
Checking adev->gmc.xgmi.num_physical_nodes > 1 already makes sure that hive shouldn't be NULL.
If automated checkers complain about that we should probably drop the adev->gmc.xgmi.num_physical_nodes > 1 check and check for hive instead.
Regards,
Christian.
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-0list_for_each_entry (tmp_adev, &hive->device_list, gmc.xgmi.head) {list_add_tail (&tmp_adev->reset_list, &device_list);if (adev->shutdown)
[AMD Official Use Only - AMD Internal Distribution Only]
Hi Christian,
-----Original Message-----
From: Christian König <[email protected]>
Sent: Monday, May 13, 2024 7:41 PM
To: Zhang, Jesse(Jie) <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Huang, Tim <[email protected]>
Subject: Re: [PATCH 01/22] drm/amdgpu: fix dereference after null check
Am 10.05.24 um 04:50 schrieb Jesse Zhang:
Quoted 13 lines
check the pointer hive before use.
Signed-off-by Jesse Zhang <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-0
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c int amdgpu_device_gpu_recover(struct amdgpu_device *adev, · line 5729
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +2
-1@@ -5725,7 +5725,7 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev,* to put adev in the 1st position. */ INIT_LIST_HEAD (&device_list); -if (!amdgpu_sriov_vf (adev) && (adev->gmc.xgmi.num_physical_nodes >1 )) { +if (!amdgpu_sriov_vf (adev) && (adev->gmc.xgmi.num_physical_nodes > +1 ) && hive) {
That solution looks not optimal to me.
Checking adev->gmc.xgmi.num_physical_nodes > 1 already makes sure that hive shouldn't be NULL.
If automated checkers complain about that we should probably drop the adev->gmc.xgmi.num_physical_nodes > 1 check and check for hive instead.
[Zhang, Jesse(Jie)]
gmc.xgmi.num_physical_nodes is obtained by reading register GCMC_VM_XGMI_LFB_CNTL. But getting hive may fail because of no memory (NOMEM),
or the kobject of xgmi hive cannot be initialized in the function amdgpu_get_xgmi_hive. Is (adev->gmc.xgmi.num_physical_nodes > 1) equivalent to (!hive) here?
Regards
Jesse
Regards,
Christian.
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-0list_for_each_entry (tmp_adev, &hive->device_list, gmc.xgmi.head) {list_add_tail (&tmp_adev->reset_list, &device_list);if (adev->shutdown)