[PATCH] drm/amdgpu/pm: Drop hard-code value of usTMax

2024-05-13 Thread Ma Jun
Drop hard-code value of nsTmax because we read this value from fantable below. Signed-off-by: Ma Jun --- drivers/gpu/drm/amd/pm/powerplay/hwmgr/process_pptables_v1_0.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/process_pptables_v1_0.c b/drivers

[PATCH v2] drm/amdgpu: Fix the null pointer dereference to ras_manager

2024-05-13 Thread Ma Jun
Check ras_manager before using it Signed-off-by: Ma Jun --- drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c index 925ec65ac5ed..2bcf5c3b5d70

Re: [PATCH 3/5] drm/amdgpu: Fix null pointer dereference to aca_handle

2024-05-13 Thread Ma, Jun
Hi Lijo & Kevin, thanks for review, will drop this patch Regards, Ma Jun On 5/14/2024 7:13 AM, Wang, Yang(Kevin) wrote: > [AMD Official Use Only - AMD Internal Distribution Only] > > -Original Message----- > From: Ma, Jun > Sent: Monday, May 13, 2024 4:

[PATCH 4/5] drm/amdgpu: Fix null pointer dereference to bo

2024-05-13 Thread Ma Jun
Check bo before using it Signed-off-by: Ma Jun --- drivers/gpu/drm/amd/amdgpu/gmc_v12_0.c | 16 +++- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v12_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v12_0.c index 2b7b67916c1d..8269fd6828bf

[PATCH 5/5] drm/amdgpu: Remove dead code in amdgpu_ras_add_mca_err_addr

2024-05-13 Thread Ma Jun
Remove dead code in amdgpu_ras_add_mca_err_addr Signed-off-by: Ma Jun --- drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 13 - 1 file changed, 13 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c index 6da02a209890..0cf67923c0fc

[PATCH 3/5] drm/amdgpu: Fix null pointer dereference to aca_handle

2024-05-13 Thread Ma Jun
Check handle pointer before using it Signed-off-by: Ma Jun --- drivers/gpu/drm/amd/amdgpu/amdgpu_aca.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_aca.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_aca.c index 28febf33fb1b..e969a7d77b4d

[PATCH 2/5] drm/amdgpu: Fix the null pointer dereference to ras_manager

2024-05-13 Thread Ma Jun
Check ras_manager before using it Signed-off-by: Ma Jun --- drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c index 1dd13ed3b7b5..6da02a209890

[PATCH 1/5] drm/amdgpu/pm: Fix the null pointer dereference for smu7

2024-05-13 Thread Ma Jun
optimize the code to avoid pass a null pointer (hwmgr->backend) to function smu7_update_edc_leakage_table. Signed-off-by: Ma Jun --- .../drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c | 50 +-- 1 file changed, 24 insertions(+), 26 deletions(-) diff --git a/drivers/gpu/drm/amd

[PATCH 3/3] drm/amdgpu/pm: Fix the null pointer dereference in apply_state_adjust_rules

2024-05-10 Thread Ma Jun
Check the pointer value to fix potential null pointer dereference Signed-off-by: Ma Jun --- .../gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c| 7 +-- .../gpu/drm/amd/pm/powerplay/hwmgr/smu8_hwmgr.c| 14 -- .../gpu/drm/amd/pm/powerplay/hwmgr/vega10_hwmgr.c | 7 +-- 3

[PATCH 2/3] drm/amdgpu/pm: Fix the null pointer dereference to pcurrent

2024-05-10 Thread Ma Jun
Check pcurrent pointer before using it to fix the null pointer dereference Signed-off-by: Ma Jun --- drivers/gpu/drm/amd/pm/powerplay/hwmgr/pp_psm.c | 12 +--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/pp_psm.c b/drivers/gpu

[PATCH 1/3] drm/amdgpu/pm: Drop redundant setting code for pcie lanes

2024-05-10 Thread Ma Jun
Drop redundant setting code for pcie.lanes. It overwrites the value get from pptable Signed-off-by: Ma Jun --- drivers/gpu/drm/amd/pm/powerplay/hwmgr/processpptables.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/processpptables.c b/drivers/gpu

Re: [PATCH 1/2] drm/amdgpu/pm: Check input value for power profile setting on smu13 and smu14

2024-05-09 Thread Ma, Jun
On 5/10/2024 9:41 AM, Wang, Yang(Kevin) wrote: > [AMD Official Use Only - General] > > Ok, I miss this patch #2. > > And please merge swsmu parts in patch#1 to patch#2. (patch #1 : powerplay, > patch #2: swsmu) Thanks, will fix this when push. Regards, Ma Jun > >

Re: [PATCH 1/2] drm/amdgpu/pm: Check input value for power profile setting on smu13 and smu14

2024-05-09 Thread Ma, Jun
On 5/9/2024 9:01 PM, Wang, Yang(Kevin) wrote: > [AMD Official Use Only - General] > > please fix similar issues in other xxx_ppt.c file together? e. g: > navi10_ppt.c, etc > Fix codes for navi10,vega20, etc. are in the patch 2 of this serial. Regards, Ma Jun > Bes

[PATCH 2/2] drm/amdgpu/pm: Check input value for CUSTOM profile mode setting on legacy SOCs

2024-05-09 Thread Ma Jun
Check the input value for CUSTOM profile mode setting on legacy SOCs. Otherwise it may cause out-of-bouds read error. Signed-off-by: Ma Jun --- drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c | 2 +- drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega20_hwmgr.c | 8 ++-- drivers/gpu/drm

[PATCH 1/2] drm/amdgpu/pm: Check input value for power profile setting on smu13 and smu14

2024-05-09 Thread Ma Jun
Check the input value for CUSTOM profile mode setting on smu13 and smu14. Otherwise it may cause out-of-bouds read error. Signed-off-by: Ma Jun --- drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c | 5 + drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c | 4 drivers/gpu/drm/amd

[PATCH] drm/amdgpu/pm: Fix code alignment issue

2024-05-09 Thread Ma Jun
Fix code alignment issue Signed-off-by: Ma Jun Reported-by: Yang Wang --- drivers/gpu/drm/amd/pm/amdgpu_pm.c | 4 ++-- drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/amd/pm

[PATCH] drm/amdgpu: Fix out-of-bounds read of df_v1_7_channel_number

2024-05-06 Thread Ma Jun
Check the fb_channel_number range to avoid the array out-of-bounds read error Signed-off-by: Ma Jun --- drivers/gpu/drm/amd/amdgpu/df_v1_7.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/amd/amdgpu/df_v1_7.c b/drivers/gpu/drm/amd/amdgpu/df_v1_7.c index 5dfab802

[PATCH 2/2] drm/amdgpu/pm: Fix the param type of set_power_profile_mode

2024-05-06 Thread Ma Jun
adjacent memory locations" Signed-off-by: Ma Jun --- drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c | 8 drivers/gpu/drm/amd/pm/powerplay/hwmgr/pp_psm.c | 8 drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c| 16 3 files changed, 16 insertions(+), 16 deleti

[PATCH 1/2] drm/amdgpu: Fix uninitialized variable warning in amdgpu_info_ioctl

2024-05-06 Thread Ma Jun
Check the return value of amdgpu_xcp_get_inst_details, otherwise we may use an uninitialized variable inst_mask Signed-off-by: Ma Jun --- drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 11 +-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu

[PATCH v2] drm/amdgpu: Fix out-of-bounds write warning

2024-05-05 Thread Ma Jun
Check the ring type value to fix the out-of-bounds write warning Signed-off-by: Ma Jun Suggested-by: Christian König --- drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c b/drivers/gpu/drm/amd

Re: [PATCH v3] drm/amdgpu: Fix the uninitialized variable warning

2024-04-29 Thread Ma, Jun
ping ... On 4/26/2024 5:37 PM, Ma Jun wrote: > Check the user input and phy_id value range to fix > "Using uninitialized value phy_id" > > Signed-off-by: Ma Jun > --- > drivers/gpu/drm/amd/amdgpu/amdgpu_securedisplay.c | 4 > 1 file changed, 4 insertions(+

[PATCH v2 2/2] drm/amdgpu/pm: Fix uninitialized variable warning

2024-04-29 Thread Ma Jun
Check return value of smum_send_msg_to_smc to fix uninitialized variable varning Signed-off-by: Ma Jun --- .../drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.c | 21 + .../drm/amd/pm/powerplay/hwmgr/vega12_hwmgr.c | 20 .../drm/amd/pm/powerplay/hwmgr/vega20_hwmgr.c

[PATCH v2 1/2] drm/amdgpu/pm: Fix uninitialized variable agc_btc_response

2024-04-29 Thread Ma Jun
Assign an default value to agc_btc_response in failed case Signed-off-by: Ma Jun --- drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_hwmgr.c | 9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_hwmgr.c b/drivers/gpu/drm/amd/pm

Re: [PATCH 2/2] drm/amdgpu/pm: Fix uninitialized variable warning

2024-04-28 Thread Ma, Jun
On 4/28/2024 10:18 PM, Alex Deucher wrote: > On Sun, Apr 28, 2024 at 7:12 AM Ma Jun wrote: >> >> Check return value of smum_send_msg_to_smc to fix >> uninitialized variable varning >> >> Signed-off-by: Ma Jun >> --- >> .../d

[PATCH 2/2] drm/amdgpu/pm: Fix uninitialized variable warning

2024-04-28 Thread Ma Jun
Check return value of smum_send_msg_to_smc to fix uninitialized variable varning Signed-off-by: Ma Jun --- .../drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.c | 21 ++- .../drm/amd/pm/powerplay/hwmgr/vega10_hwmgr.c | 8 +-- .../drm/amd/pm/powerplay/hwmgr/vega12_hwmgr.c | 6

[PATCH 1/2] drm/amdgpu/pm: Fix uninitialized variable agc_btc_response

2024-04-28 Thread Ma Jun
Assign an default value to agc_btc_response in failed case Signed-off-by: Ma Jun --- drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_hwmgr.c | 9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_hwmgr.c b/drivers/gpu/drm/amd/pm

[PATCH v3] drm/amdgpu: Fix the uninitialized variable warning

2024-04-26 Thread Ma Jun
Check the user input and phy_id value range to fix "Using uninitialized value phy_id" Signed-off-by: Ma Jun --- drivers/gpu/drm/amd/amdgpu/amdgpu_securedisplay.c | 4 1 file changed, 4 insertions(+) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_securedisplay.c b/drivers/g

[PATCH] drm/amdgpu/pm: Check the return value of smum_send_msg_to_smc

2024-04-26 Thread Ma Jun
Check the return value of smum_send_msg_to_smc, otherwise we might use an uninitialized variable "now" Signed-off-by: Ma Jun --- drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu10_hwmgr.c | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/amd/pm

Re: [PATCH] drm/amdgpu: Fix out-of-bounds write warning

2024-04-25 Thread Ma, Jun
On 4/25/2024 8:39 PM, Christian König wrote: > > > Am 25.04.24 um 12:00 schrieb Ma Jun: >> Check the ring type value to fix the out-of-bounds >> write warning >> >> Signed-off-by: Ma Jun >> --- >> drivers/gpu/drm/amd/amdgpu/amdgpu_ring.

Re: [PATCH v2 2/2] drm/amdgpu: Fix the uninitialized variable warning

2024-04-25 Thread Ma, Jun
On 4/25/2024 6:10 PM, Lazar, Lijo wrote: > > > On 4/25/2024 3:30 PM, Ma Jun wrote: >> Initialize the phy_id to 0 to fix the warning of >> "Using uninitialized value phy_id" >> >> Signed-off-by: Ma Jun >> --- >> drivers/gpu/drm/amd/amdg

[PATCH] drm/amdgpu: Fix out-of-bounds write warning

2024-04-25 Thread Ma Jun
Check the ring type value to fix the out-of-bounds write warning Signed-off-by: Ma Jun --- drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c | 5 + 1 file changed, 5 insertions(+) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c index 06f0a6534a94

[PATCH v2 2/2] drm/amdgpu: Fix the uninitialized variable warning

2024-04-25 Thread Ma Jun
Initialize the phy_id to 0 to fix the warning of "Using uninitialized value phy_id" Signed-off-by: Ma Jun --- drivers/gpu/drm/amd/amdgpu/amdgpu_securedisplay.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_securedisplay.c

[PATCH v2 1/2] drm/amdgpu: Fix uninitialized variable warning in amdgpu_afmt_acr

2024-04-25 Thread Ma Jun
Assign value to clock to fix the warning below: "Using uninitialized value res. Field res.clock is uninitialized" Signed-off-by: Ma Jun --- drivers/gpu/drm/amd/amdgpu/amdgpu_afmt.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_afmt.c b/drive

[PATCH 3/3] drm/amdgpu: Fix the uninitialized variable warning

2024-04-24 Thread Ma Jun
Initialize the phy_id to 0 to fix the warning of "Using uninitialized value phy_id" Signed-off-by: Ma Jun --- drivers/gpu/drm/amd/amdgpu/amdgpu_securedisplay.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_securedisplay.c b/d

[PATCH 2/3] drm/amdgpu: Initialize timestamp for some legacy SOCs

2024-04-24 Thread Ma Jun
Initialize the interrupt timestamp for some legacy SOCs to fix the coverity issue "Uninitialized scalar variable" Signed-off-by: Ma Jun Suggested-by: Christian König --- drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c | 8 1 file changed, 8 insertions(+) diff --git a/drivers/g

[PATCH 1/3] drm/amdgpu: Fix uninitialized variable warning in amdgpu_afmt_acr

2024-04-24 Thread Ma Jun
Assign value to clock to fix the warning below: "Using uninitialized value res. Field res.clock is uninitialized" Signed-off-by: Ma Jun --- drivers/gpu/drm/amd/amdgpu/amdgpu_afmt.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu

Re: [PATCH 3/3] drm/amdgpu: Fix Uninitialized scalar variable warning

2024-04-22 Thread Ma, Jun
On 4/22/2024 7:25 PM, Christian König wrote: > Am 22.04.24 um 11:49 schrieb Ma Jun: >> Initialize the variables which were not initialized >> to fix the coverity issue "Uninitialized scalar variable" > > Feel free to add my Acked-by to the first two patches, b

[PATCH 2/3] drm/amdgpu: Fix uninitialized variable warnings

2024-04-22 Thread Ma Jun
return 0 to avoid returning an uninitialized variable r Signed-off-by: Ma Jun --- drivers/gpu/drm/amd/amdgpu/aldebaran.c | 2 +- drivers/gpu/drm/amd/amdgpu/sienna_cichlid.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/aldebaran.c b

[PATCH 3/3] drm/amdgpu: Fix Uninitialized scalar variable warning

2024-04-22 Thread Ma Jun
Initialize the variables which were not initialized to fix the coverity issue "Uninitialized scalar variable" Signed-off-by: Ma Jun --- drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_xcp.c | 2 +- 3 fil

[PATCH 1/3] drm/amdgpu: Fix the out-of-bounds read warning

2024-04-22 Thread Ma Jun
Use '<' instead of '<=' to fix the out-of-bounds read error Signed-off-by: Ma Jun --- drivers/gpu/drm/amd/amdgpu/mes_v11_0.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c b/drivers/gpu/drm/amd/amdgpu/mes_

Re: [PATCH] drm/amdgpu/pm: Remove gpu_od if it's an empty directory

2024-04-17 Thread Ma, Jun
On 4/17/2024 7:52 PM, Lazar, Lijo wrote: > > > On 4/17/2024 11:23 AM, Ma Jun wrote: >> gpu_od should be removed if it's an empty directory >> >> Signed-off-by: Ma Jun >> Reported-by: Yang Wang >> --- >> drivers/gpu/drm/amd/pm/amdgpu

[PATCH] drm/amdgpu/pm: Print od status info

2024-04-17 Thread Ma Jun
Print the od status info if it's not supported. Signed-off-by: Ma Jun --- drivers/gpu/drm/amd/pm/amdgpu_pm.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/amd/pm/amdgpu_pm.c b/drivers/gpu/drm/amd/pm/amdgpu_pm.c index 5bc1cd4993e8..a20e03e69d38 100644 --- a/driver

[PATCH] drm/amdgpu/pm: Remove gpu_od if it's an empty directory

2024-04-16 Thread Ma Jun
gpu_od should be removed if it's an empty directory Signed-off-by: Ma Jun Reported-by: Yang Wang --- drivers/gpu/drm/amd/pm/amdgpu_pm.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/drivers/gpu/drm/amd/pm/amdgpu_pm.c b/drivers/gpu/drm/amd/pm/amdgpu_pm.c index a20e03e

Re: [PATCH v2] drm/amdgpu: refactoring the runtime pm mode detection code

2024-04-14 Thread Ma, Jun
ping... Regards, Ma Jun On 4/3/2024 10:57 AM, Ma Jun wrote: > refactor the code of runtime pm mode detection to support > amdgpu_runtime_pm =2 and 1 two cases > > Signed-off-by: Ma Jun > Reviewed-by: Yang Wang > --- > v1->v2: > - Fix logic and output info (Lijo

[PATCH v2] drm/amdgpu: refactoring the runtime pm mode detection code

2024-04-02 Thread Ma Jun
refactor the code of runtime pm mode detection to support amdgpu_runtime_pm =2 and 1 two cases Signed-off-by: Ma Jun Reviewed-by: Yang Wang --- v1->v2: - Fix logic and output info (Lijo) - Fix code style (Kevin) --- drivers/gpu/drm/amd/amdgpu/amdgpu.h| 1 + drivers/gpu/drm/amd/amd

[PATCH v2] drm/amdgpu: Fix discovery initialization failure during pci rescan

2024-04-02 Thread Ma Jun
Waiting for system ready to fix the discovery initialization failure issue. This failure usually occurs when dGPU is removed and then rescanned via command line. It's caused by following two errors: [1] vram size is 0 [2] wrong binary signature Signed-off-by: Ma Jun --- drivers/gpu/dr

Re: [PATCH] drm/amdgpu: Fix discovery initialization failure during pci rescan

2024-04-02 Thread Ma, Jun
On 4/1/2024 8:24 PM, Christian König wrote: > Am 01.04.24 um 12:18 schrieb Ma Jun: >> Waiting for system ready to fix the discovery initialization >> failure issue. This failure usually occurs when dGPU is >> removed and then rescanned via command line. >> It'

Re: [PATCH] drm/amdgpu: refactoring the runtime pm mode detection code

2024-04-01 Thread Ma, Jun
ping... Regards, Ma Jun On 3/29/2024 4:28 PM, Ma Jun wrote: > refactor the code of runtime pm mode detection to support > amdgpu_runtime_pm =2 and 1 two cases > > Signed-off-by: Ma Jun > --- > drivers/gpu/drm/amd/amdgpu/amdgpu.h| 1 + > drivers/gpu/drm/amd/amdgpu

[PATCH] drm/amdgpu: Fix discovery initialization failure during pci rescan

2024-04-01 Thread Ma Jun
Waiting for system ready to fix the discovery initialization failure issue. This failure usually occurs when dGPU is removed and then rescanned via command line. It's caused by following two errors: [1] vram size is 0 [2] wrong binary signature Signed-off-by: Ma Jun --- drivers/gpu/dr

[PATCH] drm/amdgpu: refactoring the runtime pm mode detection code

2024-03-29 Thread Ma Jun
refactor the code of runtime pm mode detection to support amdgpu_runtime_pm =2 and 1 two cases Signed-off-by: Ma Jun --- drivers/gpu/drm/amd/amdgpu/amdgpu.h| 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 68 ++ drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c| 48

[PATCH v3 5/5] drm/amdgpu/pm: Check AMDGPU_RUNPM_BAMACO when setting baco state

2024-03-27 Thread Ma Jun
Check AMDGPU_RUNPM_BAMACO intead of amdgpu_runtime_pm when setting baco state. Signed-off-by: Ma Jun --- drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c | 2 +- drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c | 5 ++--- drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0.c | 2 +- 3 files changed, 4

[PATCH v3 4/5] drm/amdgpu: Add support for BAMACO mode checking

2024-03-27 Thread Ma Jun
Optimize the code to add support for BAMACO mode checking Signed-off-by: Ma Jun --- v1->v2: - Fix the errors in BAMACO mode usage (Lijo) - Drop the refactoring of runtime pm mode check --- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 6 -- drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c |

[PATCH v3 1/5] drm/amdgpu: Add a new runtime mode definition

2024-03-27 Thread Ma Jun
Add a new runtime pm mode AMDGPU_RUNPM_BAMACO and related macro definition Signed-off-by: Ma Jun --- drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h | 4 1 file changed, 4 insertions(+) diff --git a/drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h b/drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h index

[PATCH v3 3/5] drm/amdgpu/pm: Add support for MACO flag checking

2024-03-27 Thread Ma Jun
Add support for MACO flag checking. MACO mode only works if BACO is supported. Signed-off-by: Ma Jun --- drivers/gpu/drm/amd/amdgpu/amdgpu.h| 4 ++-- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 8 +--- drivers/gpu/drm/amd/amdgpu/cik.c | 4

[PATCH v3 2/5] drm/amdgpu/pm: Change the member function name in pp_hwmgr_func and pptable_funcs

2024-03-27 Thread Ma Jun
Use a unified and more explicit name get_bamaco_support to replace is_baco_support and get_asic_baco_capability Signed-off-by: Ma Jun Suggested-by: Lijo Lazar --- v2->v3: - Change the function name (lijo) --- drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c| 4 ++-- drivers/gpu/drm/

[PATCH v2 4/5] drm/amdgpu: Add support for BAMACO mode checking

2024-03-27 Thread Ma Jun
Optimize the code to add support for BAMACO mode checking Signed-off-by: Ma Jun --- v1->v2: - Fix the errors in BAMACO mode usage (Lijo) - Drop the refactoring of runtime pm mode check --- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 6 -- drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c |

[PATCH v2 5/5] drm/amdgpu/pm: Check AMDGPU_RUNPM_BAMACO when setting baco state

2024-03-27 Thread Ma Jun
Check AMDGPU_RUNPM_BAMACO intead of amdgpu_runtime_pm when setting baco state. Signed-off-by: Ma Jun --- drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c | 2 +- drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c | 5 ++--- drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0.c | 2 +- 3 files changed, 4

[PATCH v2 3/5] drm/amdgpu/pm: Add support for MACO flag checking

2024-03-27 Thread Ma Jun
Add support for MACO flag checking. MACO mode only works if BACO is supported. Signed-off-by: Ma Jun --- drivers/gpu/drm/amd/amdgpu/amdgpu.h| 4 ++-- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 8 +--- drivers/gpu/drm/amd/amdgpu/cik.c | 4

[PATCH v2 2/5] drm/amdgpu/pm: Change the member function name of pp_hwmgr_func

2024-03-27 Thread Ma Jun
Change the member function name of pp_hwmgr_func to keep consistent with the function in pptable_funcs Signed-off-by: Ma Jun --- drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c | 4 ++-- drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_baco.c| 2 +- drivers/gpu/drm/amd/pm/powerplay/hwmgr

[PATCH v2 1/5] drm/amdgpu: Add a new runtime mode definition

2024-03-27 Thread Ma Jun
Add a new runtime pm mode AMDGPU_RUNPM_BAMACO and related macro definition Signed-off-by: Ma Jun --- drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h | 4 1 file changed, 4 insertions(+) diff --git a/drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h b/drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h index

Re: [PATCH] drm/amdgpu: make amdgpu device attr_update() function more efficient

2024-03-26 Thread Ma, Jun
Reviewed-by: Ma Jun On 3/26/2024 5:02 PM, Yang Wang wrote: > add a new enumeration type to identify device attribute node, > this method is relatively more efficient compared with 'strcmp' in > update_attr() function. > > Signed-off-by: Yang Wang > --- > dri

Re: [PATCH 4/5] drm/amdgpu: Add support for BAMACO mode checking

2024-03-26 Thread Ma, Jun
On 3/26/2024 5:34 PM, Lazar, Lijo wrote: > > > On 3/26/2024 2:59 PM, Lazar, Lijo wrote: >> >> >> On 3/25/2024 3:45 PM, Ma Jun wrote: >>> Optimize the code to add support for BAMACO mode checking >>> >>> Signed-off-by: Ma Jun >

Re: [PATCH 4/5] drm/amdgpu: Add support for BAMACO mode checking

2024-03-26 Thread Ma, Jun
On 3/26/2024 5:29 PM, Lazar, Lijo wrote: > > > On 3/25/2024 3:45 PM, Ma Jun wrote: >> Optimize the code to add support for BAMACO mode checking >> >> Signed-off-by: Ma Jun >> --- >> drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 4 +- >>

[PATCH] drm/amdgpu: Change the parameter of amdgpu_discovery_verify_binary_signature

2024-03-26 Thread Ma Jun
Use struct binary_header directly as parameter of amdgpu_discovery_verify_binary_signature() Signed-off-by: Ma Jun --- drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 11 --- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c b

[PATCH 3/5] drm/amdgpu/pm: Add support for MACO flag checking

2024-03-25 Thread Ma Jun
Add support for MACO flag checking. MACO mode only works if BACO is supported. Signed-off-by: Ma Jun --- drivers/gpu/drm/amd/amdgpu/amdgpu.h| 4 ++-- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 2 +- drivers/gpu/drm/amd/amdgpu/cik.c | 4

[PATCH 5/5] drm/amdgpu/pm: Check AMDGPU_RUNPM_BAMACO when setting baco state

2024-03-25 Thread Ma Jun
Check AMDGPU_RUNPM_BAMACO intead of amdgpu_runtime_pm when setting baco state. Signed-off-by: Ma Jun --- drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c | 2 +- drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c | 5 ++--- drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0.c | 2 +- 3 files changed, 4

[PATCH 4/5] drm/amdgpu: Add support for BAMACO mode checking

2024-03-25 Thread Ma Jun
Optimize the code to add support for BAMACO mode checking Signed-off-by: Ma Jun --- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 4 +- drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 74 +++-- drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 4 +- 3 files changed, 50 insertions(+), 32

[PATCH 2/5] drm/amdgpu/pm: Change the member function name of pp_hwmgr_func

2024-03-25 Thread Ma Jun
Change the member function name of pp_hwmgr_func to keep consistent with the function in pptable_funcs Signed-off-by: Ma Jun --- drivers/gpu/drm/amd/pm/powerplay/amd_powerplay.c | 4 ++-- drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_baco.c| 2 +- drivers/gpu/drm/amd/pm/powerplay/hwmgr

[PATCH 1/5] drm/amdgpu: Add a new runtime mode definition

2024-03-25 Thread Ma Jun
Add a new runtime pm mode AMDGPU_RUNPM_BAMACO and related macro definition Signed-off-by: Ma Jun --- drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h | 4 1 file changed, 4 insertions(+) diff --git a/drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h b/drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h index

Re: [PATCH] drm/amdgpu: Fix the runtime pm mode error

2024-03-20 Thread Ma, Jun
On 3/20/2024 9:38 PM, Lazar, Lijo wrote: > > > On 3/20/2024 6:54 PM, Alex Deucher wrote: >> On Wed, Mar 20, 2024 at 6:17 AM Ma Jun wrote: >>> >>> Because of the logic error, Arcturus and vega20 currently >>> use the AMDGPU_RUNPM_NONE for runtime pm

Re: [PATCH] drm/amdgpu: Fix the runtime pm mode error

2024-03-20 Thread Ma, Jun
On 3/20/2024 9:24 PM, Alex Deucher wrote: > On Wed, Mar 20, 2024 at 6:17 AM Ma Jun wrote: >> >> Because of the logic error, Arcturus and vega20 currently >> use the AMDGPU_RUNPM_NONE for runtime pm even though they >> support BACO. So, the code is optimized to fix t

[PATCH] drm/amdgpu: Fix the runtime pm mode error

2024-03-20 Thread Ma Jun
Because of the logic error, Arcturus and vega20 currently use the AMDGPU_RUNPM_NONE for runtime pm even though they support BACO. So, the code is optimized to fix this error. Signed-off-by: Ma Jun --- drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 56 - 1 file changed, 27

[PATCH] drm/amdgpu/pm: Don't use OD table on Arcturus

2024-03-19 Thread Ma Jun
OD is not supported on Arcturus, so the OD table should not be used. Signed-off-by: Ma Jun --- .../gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c | 33 +++ 1 file changed, 5 insertions(+), 28 deletions(-) diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c b/drivers/gpu

Re: [PATCH] Revert "drm/amd/amdgpu: Fix potential ioremap() memory leaks in amdgpu_device_init()"

2024-03-19 Thread Ma, Jun
Thanks, I will fix it when push to the next branch Regards, Ma Jun On 3/19/2024 4:22 PM, Christian König wrote: > Am 19.03.24 um 09:07 schrieb Ma Jun: >> This patch causes the following iounmap erorr and calltrace >> iounmap: bad address d0b3631f > >&g

[PATCH] Revert "drm/amd/amdgpu: Fix potential ioremap() memory leaks in amdgpu_device_init()"

2024-03-19 Thread Ma Jun
This patch causes the following iounmap erorr and calltrace iounmap: bad address d0b3631f So just revert it and amdgpu_device_fini_sw() will cleanup the rmmio mapping. This reverts commit 923f7a82d2e12a99744a940954f3829ab18a9dc7. --- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 16 ++

Re: [PATCH] drm/amdgpu: Fix the iounmap error of rmmio

2024-03-17 Thread Ma, Jun
Hi Christian, On 3/15/2024 3:16 PM, Christian König wrote: > Am 15.03.24 um 06:17 schrieb Ma Jun: >> Setting the rmmio pointer to NULL to fix the following >> iounmap error and calltrace. >> iounmap: bad address d0b3631f >> >> Fixes: 923f7a82d2e1 ("

[PATCH] drm/amdgpu: Fix the iounmap error of rmmio

2024-03-14 Thread Ma Jun
Setting the rmmio pointer to NULL to fix the following iounmap error and calltrace. iounmap: bad address d0b3631f Fixes: 923f7a82d2e1 ("drm/amd/amdgpu: Fix potential ioremap() memory leaks in amdgpu_device_init()") Signed-off-by: Ma Jun --- drivers/gpu/drm/amd/amdgpu/amdgp

[PATCH 2/2] drm/amdgpu/pm: Check the validity of overdiver power limit

2024-03-13 Thread Ma Jun
Check the validity of overdriver power limit before using it. Signed-off-by: Ma Jun Suggested-by: Lazar Lijo Suggested-by: Alex Deucher --- .../gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c | 11 + .../gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c | 9 .../amd/pm/swsmu/smu11

[PATCH 1/2] drm/amdgpu/pm: Fix NULL pointer dereference when get power limit

2024-03-13 Thread Ma Jun
Because powerplay_table initialization is skipped under sriov case, We check and set default lower and upper OD value if powerplay_table is NULL. Fixes: 7968e9748fbb ("drm/amdgpu/pm: Fix the power1_min_cap value") Signed-off-by: Ma Jun Reported-by: Yin Zhenguo Suggested-by:

Re: [PATCH] drm/amdgpu/pm: Fix the ppfeature value

2024-03-12 Thread Ma, Jun
On 3/12/2024 8:57 PM, Lazar, Lijo wrote: > > > On 3/12/2024 4:29 PM, Ma Jun wrote: >> Sometimes user may want to enable the od feature >> by setting ppfeaturemask when loading amdgpu driver. >> However,not all Asics support this feature. >> So we need to rest

[PATCH] drm/amdgpu/pm: Fix the ppfeature value

2024-03-12 Thread Ma Jun
Sometimes user may want to enable the od feature by setting ppfeaturemask when loading amdgpu driver. However,not all Asics support this feature. So we need to restore the ppfeature value and print a warning info. Signed-off-by: Ma Jun --- drivers/gpu/drm/amd/pm/amdgpu_dpm.c | 15

Re: [PATCH v2] drm/amdgpu/pm: Fix NULL pointer dereference when get power limit

2024-03-10 Thread Ma, Jun
On 3/8/2024 10:00 PM, Lazar, Lijo wrote: > > > On 3/8/2024 3:21 PM, Ma Jun wrote: >> Because powerplay_table initialization is skipped under >> sriov case, We set default lower and upper OD value to >> avoid NULL pointer issue. >> >> Also, It's nece

[PATCH v2] drm/amdgpu/pm: Fix NULL pointer dereference when get power limit

2024-03-08 Thread Ma Jun
m: Fix the power1_min_cap value") Signed-off-by: Ma Jun Reported-by: Yin Zhenguo --- v1->v2: Check the od capability (Alex, Lijo) --- .../gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c | 18 ++- .../gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c | 18 ++- .../amd/pm/swsmu/smu11/sienna_ci

Re: [PATCH] drm/amdgpu/pm: Fix NULL pointer dereference when set/get power limit

2024-03-06 Thread Ma, Jun
Hi Lijo, On 3/6/2024 7:16 PM, Lazar, Lijo wrote: > > > On 3/6/2024 3:56 PM, Ma Jun wrote: >> Because powerplay_table initialization is skipped under >> sriov case, We set default lower and upper OD value to >> avoid NULL pointer issue. > > pp_od_clk_voltage is

[PATCH] drm/amdgpu/pm: Fix NULL pointer dereference when set/get power limit

2024-03-06 Thread Ma Jun
Because powerplay_table initialization is skipped under sriov case, We set default lower and upper OD value to avoid NULL pointer issue. Fixes: 7968e9748fbb ("drm/amdgpu/pm: Fix the power1_min_cap value") Signed-off-by: Ma Jun Reported-by: Yin Zhenguo --- .../gpu/drm/amd/pm/s

Re: [PATCH] drm/amdgpu/pm: Fix the error of pwm1_enable setting

2024-03-03 Thread Ma, Jun
On 3/1/2024 5:41 PM, Lazar, Lijo wrote: > > > On 3/1/2024 1:15 PM, Ma Jun wrote: >> Fix the pwm_mode value error which used for >> pwm1_enable setting >> >> Signed-off-by: Ma Jun >> --- >> drivers/gpu/drm/amd/pm/amdgpu_pm.c | 12 +++- >

[PATCH] drm/amdgpu/pm: Fix the error of pwm1_enable setting

2024-02-29 Thread Ma Jun
Fix the pwm_mode value error which used for pwm1_enable setting Signed-off-by: Ma Jun --- drivers/gpu/drm/amd/pm/amdgpu_pm.c | 12 +++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/pm/amdgpu_pm.c b/drivers/gpu/drm/amd/pm/amdgpu_pm.c index

Re: [PATCH v2] drm/amgpu: Check return value of amdgpu_device_baco_enter/exit

2024-02-29 Thread Ma, Jun
Hi Lijo, On 2/29/2024 3:33 PM, Lazar, Lijo wrote: > > > On 2/29/2024 11:49 AM, Ma Jun wrote: >> Check return value of amdgpu_device_baco_enter/exit and print >> warning message because these errors may cause runtime resume failure >> >> Signed-off-by: Ma Ju

[PATCH v2] drm/amgpu: Check return value of amdgpu_device_baco_enter/exit

2024-02-28 Thread Ma Jun
Check return value of amdgpu_device_baco_enter/exit and print warning message because these errors may cause runtime resume failure Signed-off-by: Ma Jun --- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 29 -- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a

Re: [PATCH 2/2] drm/amgpu: Check return value of amdgpu_device_baco_enter/exit

2024-02-28 Thread Ma, Jun
On 2/28/2024 7:58 PM, Lazar, Lijo wrote: > > > On 2/28/2024 5:14 PM, Ma Jun wrote: >> Check return value of amdgpu_device_baco_enter/exit and print >> warning message because these errors may cause runtime resume failure >> >> Signed-off-by: Ma Jun >

[PATCH 1/2] drm/amdgpu: Use rpm_mode flag instead of checking it again for rpm

2024-02-28 Thread Ma Jun
Because the rpm_mode flag is already set when the driver is initialized, we use it directly for runtime suspend/resume instead of checking it again Signed-off-by: Ma Jun --- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 24 1 file changed, 12 insertions(+), 12 deletions

[PATCH 2/2] drm/amgpu: Check return value of amdgpu_device_baco_enter/exit

2024-02-28 Thread Ma Jun
Check return value of amdgpu_device_baco_enter/exit and print warning message because these errors may cause runtime resume failure Signed-off-by: Ma Jun --- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/amd

[PATCH] drm/amdgpu/pm: Fix the power1_min_cap value

2024-02-23 Thread Ma Jun
It's unreasonable to use 0 as the power1_min_cap when OD is disabled. So, use the same lower limit as the value used when OD is enabled. Signed-off-by: Ma Jun --- drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c | 9 - drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c

[PATCH] drm/amdgpu: Fix the runtime resume failure issue

2024-02-21 Thread Ma Jun
Don't set power state flag when system enter runtime suspend, or it may cause runtime resume failure issue. Signed-off-by: Ma Jun --- drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c b/drivers/gpu/dr

[PATCH] drm/amdgpu: Drop redundant parameter in amdgpu_gfx_kiq_init_ring

2024-02-18 Thread Ma Jun
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

[PATCH] drm/amdgpu/pm: Use inline function for IP version check

2024-01-30 Thread Ma Jun
Use existing inline function for IP version check. Signed-off-by: Ma Jun --- drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu13

Re: [PATCH] drm/amdgpu: Fix the warning info in mode1 reset

2024-01-29 Thread Ma, Jun
Reviewed-by: Ma Jun Regards, Ma Jun On 1/29/2024 11:33 PM, Deucher, Alexander wrote: > [AMD Official Use Only - General] > >

[PATCH] drm/amdgpu: Fix the logic error when init mec fw

2024-01-28 Thread Ma Jun
Remove redundant code to fix the logic error and potential null pointer dereference if gfx.mec2_fw is null. Signed-off-by: Ma Jun --- drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c b/drivers/gpu/drm/amd/amdgpu

[PATCH v3] drm/amdgpu/pm: Use macro definitions in the smu IH process function

2024-01-25 Thread Ma Jun
Replace the hard-coded numbers with macro definition Signed-off-by: Ma Jun --- v3: - Add new SMU_IH_INTERRUPT_* macros for smu, keeping the original macro definitions in sync with pmfw (kevin) --- drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c | 10 +- drivers/gpu/drm/amd/pm/swsmu/smu13

Re: [PATCH v2 2/2] drm/amdgpu/pm: Use macro definitions in the smu IH process function

2024-01-24 Thread Ma, Jun
fw. > In general, we do need to follow the above rules. But smu_v13_0_irq_process() is a common function used by other asics. Defining these macros in the corresponding smu driver_if.h will cause the compile error. Regards, Ma Jun > Best Regards, > Kevin > > -Original Message-

  1   2   3   >