Skip to content

Commit f48ab0a

Browse files
committed
Merge tag 'amd-drm-fixes-6.12-2024-11-16' of https://gitlab.freedesktop.org/agd5f/linux into drm-fixes
amd-drm-fixes-6.12-2024-11-16: amdgpu: - Revert a swsmu patch to fix a regression Signed-off-by: Dave Airlie <[email protected]> From: Alex Deucher <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
2 parents 21c1c6c + 44f392f commit f48ab0a

File tree

12 files changed

+36
-84
lines changed

12 files changed

+36
-84
lines changed

drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c

Lines changed: 14 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1259,33 +1259,26 @@ static int smu_sw_init(void *handle)
12591259
smu->watermarks_bitmap = 0;
12601260
smu->power_profile_mode = PP_SMC_POWER_PROFILE_BOOTUP_DEFAULT;
12611261
smu->default_power_profile_mode = PP_SMC_POWER_PROFILE_BOOTUP_DEFAULT;
1262-
smu->user_dpm_profile.user_workload_mask = 0;
12631262

12641263
atomic_set(&smu->smu_power.power_gate.vcn_gated, 1);
12651264
atomic_set(&smu->smu_power.power_gate.jpeg_gated, 1);
12661265
atomic_set(&smu->smu_power.power_gate.vpe_gated, 1);
12671266
atomic_set(&smu->smu_power.power_gate.umsch_mm_gated, 1);
12681267

1269-
smu->workload_priority[PP_SMC_POWER_PROFILE_BOOTUP_DEFAULT] = 0;
1270-
smu->workload_priority[PP_SMC_POWER_PROFILE_FULLSCREEN3D] = 1;
1271-
smu->workload_priority[PP_SMC_POWER_PROFILE_POWERSAVING] = 2;
1272-
smu->workload_priority[PP_SMC_POWER_PROFILE_VIDEO] = 3;
1273-
smu->workload_priority[PP_SMC_POWER_PROFILE_VR] = 4;
1274-
smu->workload_priority[PP_SMC_POWER_PROFILE_COMPUTE] = 5;
1275-
smu->workload_priority[PP_SMC_POWER_PROFILE_CUSTOM] = 6;
1268+
smu->workload_prority[PP_SMC_POWER_PROFILE_BOOTUP_DEFAULT] = 0;
1269+
smu->workload_prority[PP_SMC_POWER_PROFILE_FULLSCREEN3D] = 1;
1270+
smu->workload_prority[PP_SMC_POWER_PROFILE_POWERSAVING] = 2;
1271+
smu->workload_prority[PP_SMC_POWER_PROFILE_VIDEO] = 3;
1272+
smu->workload_prority[PP_SMC_POWER_PROFILE_VR] = 4;
1273+
smu->workload_prority[PP_SMC_POWER_PROFILE_COMPUTE] = 5;
1274+
smu->workload_prority[PP_SMC_POWER_PROFILE_CUSTOM] = 6;
12761275

12771276
if (smu->is_apu ||
1278-
!smu_is_workload_profile_available(smu, PP_SMC_POWER_PROFILE_FULLSCREEN3D)) {
1279-
smu->driver_workload_mask =
1280-
1 << smu->workload_priority[PP_SMC_POWER_PROFILE_BOOTUP_DEFAULT];
1281-
} else {
1282-
smu->driver_workload_mask =
1283-
1 << smu->workload_priority[PP_SMC_POWER_PROFILE_FULLSCREEN3D];
1284-
smu->default_power_profile_mode = PP_SMC_POWER_PROFILE_FULLSCREEN3D;
1285-
}
1277+
!smu_is_workload_profile_available(smu, PP_SMC_POWER_PROFILE_FULLSCREEN3D))
1278+
smu->workload_mask = 1 << smu->workload_prority[PP_SMC_POWER_PROFILE_BOOTUP_DEFAULT];
1279+
else
1280+
smu->workload_mask = 1 << smu->workload_prority[PP_SMC_POWER_PROFILE_FULLSCREEN3D];
12861281

1287-
smu->workload_mask = smu->driver_workload_mask |
1288-
smu->user_dpm_profile.user_workload_mask;
12891282
smu->workload_setting[0] = PP_SMC_POWER_PROFILE_BOOTUP_DEFAULT;
12901283
smu->workload_setting[1] = PP_SMC_POWER_PROFILE_FULLSCREEN3D;
12911284
smu->workload_setting[2] = PP_SMC_POWER_PROFILE_POWERSAVING;
@@ -2355,20 +2348,17 @@ static int smu_switch_power_profile(void *handle,
23552348
return -EINVAL;
23562349

23572350
if (!en) {
2358-
smu->driver_workload_mask &= ~(1 << smu->workload_priority[type]);
2351+
smu->workload_mask &= ~(1 << smu->workload_prority[type]);
23592352
index = fls(smu->workload_mask);
23602353
index = index > 0 && index <= WORKLOAD_POLICY_MAX ? index - 1 : 0;
23612354
workload[0] = smu->workload_setting[index];
23622355
} else {
2363-
smu->driver_workload_mask |= (1 << smu->workload_priority[type]);
2356+
smu->workload_mask |= (1 << smu->workload_prority[type]);
23642357
index = fls(smu->workload_mask);
23652358
index = index <= WORKLOAD_POLICY_MAX ? index - 1 : 0;
23662359
workload[0] = smu->workload_setting[index];
23672360
}
23682361

2369-
smu->workload_mask = smu->driver_workload_mask |
2370-
smu->user_dpm_profile.user_workload_mask;
2371-
23722362
if (smu_dpm_ctx->dpm_level != AMD_DPM_FORCED_LEVEL_MANUAL &&
23732363
smu_dpm_ctx->dpm_level != AMD_DPM_FORCED_LEVEL_PERF_DETERMINISM)
23742364
smu_bump_power_profile_mode(smu, workload, 0);
@@ -3059,23 +3049,12 @@ static int smu_set_power_profile_mode(void *handle,
30593049
uint32_t param_size)
30603050
{
30613051
struct smu_context *smu = handle;
3062-
int ret;
30633052

30643053
if (!smu->pm_enabled || !smu->adev->pm.dpm_enabled ||
30653054
!smu->ppt_funcs->set_power_profile_mode)
30663055
return -EOPNOTSUPP;
30673056

3068-
if (smu->user_dpm_profile.user_workload_mask &
3069-
(1 << smu->workload_priority[param[param_size]]))
3070-
return 0;
3071-
3072-
smu->user_dpm_profile.user_workload_mask =
3073-
(1 << smu->workload_priority[param[param_size]]);
3074-
smu->workload_mask = smu->user_dpm_profile.user_workload_mask |
3075-
smu->driver_workload_mask;
3076-
ret = smu_bump_power_profile_mode(smu, param, param_size);
3077-
3078-
return ret;
3057+
return smu_bump_power_profile_mode(smu, param, param_size);
30793058
}
30803059

30813060
static int smu_get_fan_control_mode(void *handle, u32 *fan_mode)

drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,6 @@ struct smu_user_dpm_profile {
240240
/* user clock state information */
241241
uint32_t clk_mask[SMU_CLK_COUNT];
242242
uint32_t clk_dependency;
243-
uint32_t user_workload_mask;
244243
};
245244

246245
#define SMU_TABLE_INIT(tables, table_id, s, a, d) \
@@ -558,8 +557,7 @@ struct smu_context {
558557
bool disable_uclk_switch;
559558

560559
uint32_t workload_mask;
561-
uint32_t driver_workload_mask;
562-
uint32_t workload_priority[WORKLOAD_POLICY_MAX];
560+
uint32_t workload_prority[WORKLOAD_POLICY_MAX];
563561
uint32_t workload_setting[WORKLOAD_POLICY_MAX];
564562
uint32_t power_profile_mode;
565563
uint32_t default_power_profile_mode;

drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_ppt.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1455,6 +1455,7 @@ static int arcturus_set_power_profile_mode(struct smu_context *smu,
14551455
return -EINVAL;
14561456
}
14571457

1458+
14581459
if ((profile_mode == PP_SMC_POWER_PROFILE_CUSTOM) &&
14591460
(smu->smc_fw_version >= 0x360d00)) {
14601461
if (size != 10)
@@ -1522,14 +1523,14 @@ static int arcturus_set_power_profile_mode(struct smu_context *smu,
15221523

15231524
ret = smu_cmn_send_smc_msg_with_param(smu,
15241525
SMU_MSG_SetWorkloadMask,
1525-
smu->workload_mask,
1526+
1 << workload_type,
15261527
NULL);
15271528
if (ret) {
15281529
dev_err(smu->adev->dev, "Fail to set workload type %d\n", workload_type);
15291530
return ret;
15301531
}
15311532

1532-
smu_cmn_assign_power_profile(smu);
1533+
smu->power_profile_mode = profile_mode;
15331534

15341535
return 0;
15351536
}

drivers/gpu/drm/amd/pm/swsmu/smu11/navi10_ppt.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2081,13 +2081,10 @@ static int navi10_set_power_profile_mode(struct smu_context *smu, long *input, u
20812081
smu->power_profile_mode);
20822082
if (workload_type < 0)
20832083
return -EINVAL;
2084-
20852084
ret = smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_SetWorkloadMask,
2086-
smu->workload_mask, NULL);
2085+
1 << workload_type, NULL);
20872086
if (ret)
20882087
dev_err(smu->adev->dev, "[%s] Failed to set work load mask!", __func__);
2089-
else
2090-
smu_cmn_assign_power_profile(smu);
20912088

20922089
return ret;
20932090
}

drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1786,13 +1786,10 @@ static int sienna_cichlid_set_power_profile_mode(struct smu_context *smu, long *
17861786
smu->power_profile_mode);
17871787
if (workload_type < 0)
17881788
return -EINVAL;
1789-
17901789
ret = smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_SetWorkloadMask,
1791-
smu->workload_mask, NULL);
1790+
1 << workload_type, NULL);
17921791
if (ret)
17931792
dev_err(smu->adev->dev, "[%s] Failed to set work load mask!", __func__);
1794-
else
1795-
smu_cmn_assign_power_profile(smu);
17961793

17971794
return ret;
17981795
}

drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1079,15 +1079,15 @@ static int vangogh_set_power_profile_mode(struct smu_context *smu, long *input,
10791079
}
10801080

10811081
ret = smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_ActiveProcessNotify,
1082-
smu->workload_mask,
1082+
1 << workload_type,
10831083
NULL);
10841084
if (ret) {
10851085
dev_err_once(smu->adev->dev, "Fail to set workload type %d\n",
10861086
workload_type);
10871087
return ret;
10881088
}
10891089

1090-
smu_cmn_assign_power_profile(smu);
1090+
smu->power_profile_mode = profile_mode;
10911091

10921092
return 0;
10931093
}

drivers/gpu/drm/amd/pm/swsmu/smu12/renoir_ppt.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -890,14 +890,14 @@ static int renoir_set_power_profile_mode(struct smu_context *smu, long *input, u
890890
}
891891

892892
ret = smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_ActiveProcessNotify,
893-
smu->workload_mask,
893+
1 << workload_type,
894894
NULL);
895895
if (ret) {
896896
dev_err_once(smu->adev->dev, "Fail to set workload type %d\n", workload_type);
897897
return ret;
898898
}
899899

900-
smu_cmn_assign_power_profile(smu);
900+
smu->power_profile_mode = profile_mode;
901901

902902
return 0;
903903
}

drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2485,7 +2485,7 @@ static int smu_v13_0_0_set_power_profile_mode(struct smu_context *smu,
24852485
DpmActivityMonitorCoeffInt_t *activity_monitor =
24862486
&(activity_monitor_external.DpmActivityMonitorCoeffInt);
24872487
int workload_type, ret = 0;
2488-
u32 workload_mask;
2488+
u32 workload_mask, selected_workload_mask;
24892489

24902490
smu->power_profile_mode = input[size];
24912491

@@ -2552,7 +2552,7 @@ static int smu_v13_0_0_set_power_profile_mode(struct smu_context *smu,
25522552
if (workload_type < 0)
25532553
return -EINVAL;
25542554

2555-
workload_mask = 1 << workload_type;
2555+
selected_workload_mask = workload_mask = 1 << workload_type;
25562556

25572557
/* Add optimizations for SMU13.0.0/10. Reuse the power saving profile */
25582558
if ((amdgpu_ip_version(smu->adev, MP1_HWIP, 0) == IP_VERSION(13, 0, 0) &&
@@ -2567,22 +2567,12 @@ static int smu_v13_0_0_set_power_profile_mode(struct smu_context *smu,
25672567
workload_mask |= 1 << workload_type;
25682568
}
25692569

2570-
smu->workload_mask |= workload_mask;
25712570
ret = smu_cmn_send_smc_msg_with_param(smu,
25722571
SMU_MSG_SetWorkloadMask,
2573-
smu->workload_mask,
2572+
workload_mask,
25742573
NULL);
2575-
if (!ret) {
2576-
smu_cmn_assign_power_profile(smu);
2577-
if (smu->power_profile_mode == PP_SMC_POWER_PROFILE_POWERSAVING) {
2578-
workload_type = smu_cmn_to_asic_specific_index(smu,
2579-
CMN2ASIC_MAPPING_WORKLOAD,
2580-
PP_SMC_POWER_PROFILE_FULLSCREEN3D);
2581-
smu->power_profile_mode = smu->workload_mask & (1 << workload_type)
2582-
? PP_SMC_POWER_PROFILE_FULLSCREEN3D
2583-
: PP_SMC_POWER_PROFILE_BOOTUP_DEFAULT;
2584-
}
2585-
}
2574+
if (!ret)
2575+
smu->workload_mask = selected_workload_mask;
25862576

25872577
return ret;
25882578
}

drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2499,14 +2499,13 @@ static int smu_v13_0_7_set_power_profile_mode(struct smu_context *smu, long *inp
24992499
smu->power_profile_mode);
25002500
if (workload_type < 0)
25012501
return -EINVAL;
2502-
25032502
ret = smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_SetWorkloadMask,
2504-
smu->workload_mask, NULL);
2503+
1 << workload_type, NULL);
25052504

25062505
if (ret)
25072506
dev_err(smu->adev->dev, "[%s] Failed to set work load mask!", __func__);
25082507
else
2509-
smu_cmn_assign_power_profile(smu);
2508+
smu->workload_mask = (1 << workload_type);
25102509

25112510
return ret;
25122511
}

drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1807,11 +1807,12 @@ static int smu_v14_0_2_set_power_profile_mode(struct smu_context *smu,
18071807
if (workload_type < 0)
18081808
return -EINVAL;
18091809

1810-
ret = smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_SetWorkloadMask,
1811-
smu->workload_mask, NULL);
1812-
1810+
ret = smu_cmn_send_smc_msg_with_param(smu,
1811+
SMU_MSG_SetWorkloadMask,
1812+
1 << workload_type,
1813+
NULL);
18131814
if (!ret)
1814-
smu_cmn_assign_power_profile(smu);
1815+
smu->workload_mask = 1 << workload_type;
18151816

18161817
return ret;
18171818
}

0 commit comments

Comments
 (0)