Skip to content

Commit c3d06a3

Browse files
committed
Revert "drm/amd/pm: correct the workload setting"
This reverts commit 74e1006. This causes a regression in the workload selection. A more extensive fix is being worked on. For now, revert. This came back after a merge in 6.13-rc1, so revert again. Link: https://gitlab.freedesktop.org/drm/amd/-/issues/3618 Fixes: 74e1006 ("drm/amd/pm: correct the workload setting") Signed-off-by: Alex Deucher <[email protected]> (cherry picked from commit 44f392f)
1 parent f3bb57b commit c3d06a3

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
@@ -1261,33 +1261,26 @@ static int smu_sw_init(struct amdgpu_ip_block *ip_block)
12611261
smu->watermarks_bitmap = 0;
12621262
smu->power_profile_mode = PP_SMC_POWER_PROFILE_BOOTUP_DEFAULT;
12631263
smu->default_power_profile_mode = PP_SMC_POWER_PROFILE_BOOTUP_DEFAULT;
1264-
smu->user_dpm_profile.user_workload_mask = 0;
12651264

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

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

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

1289-
smu->workload_mask = smu->driver_workload_mask |
1290-
smu->user_dpm_profile.user_workload_mask;
12911284
smu->workload_setting[0] = PP_SMC_POWER_PROFILE_BOOTUP_DEFAULT;
12921285
smu->workload_setting[1] = PP_SMC_POWER_PROFILE_FULLSCREEN3D;
12931286
smu->workload_setting[2] = PP_SMC_POWER_PROFILE_POWERSAVING;
@@ -2366,20 +2359,17 @@ static int smu_switch_power_profile(void *handle,
23662359
return -EINVAL;
23672360

23682361
if (!en) {
2369-
smu->driver_workload_mask &= ~(1 << smu->workload_priority[type]);
2362+
smu->workload_mask &= ~(1 << smu->workload_prority[type]);
23702363
index = fls(smu->workload_mask);
23712364
index = index > 0 && index <= WORKLOAD_POLICY_MAX ? index - 1 : 0;
23722365
workload[0] = smu->workload_setting[index];
23732366
} else {
2374-
smu->driver_workload_mask |= (1 << smu->workload_priority[type]);
2367+
smu->workload_mask |= (1 << smu->workload_prority[type]);
23752368
index = fls(smu->workload_mask);
23762369
index = index <= WORKLOAD_POLICY_MAX ? index - 1 : 0;
23772370
workload[0] = smu->workload_setting[index];
23782371
}
23792372

2380-
smu->workload_mask = smu->driver_workload_mask |
2381-
smu->user_dpm_profile.user_workload_mask;
2382-
23832373
if (smu_dpm_ctx->dpm_level != AMD_DPM_FORCED_LEVEL_MANUAL &&
23842374
smu_dpm_ctx->dpm_level != AMD_DPM_FORCED_LEVEL_PERF_DETERMINISM)
23852375
smu_bump_power_profile_mode(smu, workload, 0);
@@ -3074,23 +3064,12 @@ static int smu_set_power_profile_mode(void *handle,
30743064
uint32_t param_size)
30753065
{
30763066
struct smu_context *smu = handle;
3077-
int ret;
30783067

30793068
if (!smu->pm_enabled || !smu->adev->pm.dpm_enabled ||
30803069
!smu->ppt_funcs->set_power_profile_mode)
30813070
return -EOPNOTSUPP;
30823071

3083-
if (smu->user_dpm_profile.user_workload_mask &
3084-
(1 << smu->workload_priority[param[param_size]]))
3085-
return 0;
3086-
3087-
smu->user_dpm_profile.user_workload_mask =
3088-
(1 << smu->workload_priority[param[param_size]]);
3089-
smu->workload_mask = smu->user_dpm_profile.user_workload_mask |
3090-
smu->driver_workload_mask;
3091-
ret = smu_bump_power_profile_mode(smu, param, param_size);
3092-
3093-
return ret;
3072+
return smu_bump_power_profile_mode(smu, param, param_size);
30943073
}
30953074

30963075
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
@@ -1459,6 +1459,7 @@ static int arcturus_set_power_profile_mode(struct smu_context *smu,
14591459
return -EINVAL;
14601460
}
14611461

1462+
14621463
if ((profile_mode == PP_SMC_POWER_PROFILE_CUSTOM) &&
14631464
(smu->smc_fw_version >= 0x360d00)) {
14641465
if (size != 10)
@@ -1526,14 +1527,14 @@ static int arcturus_set_power_profile_mode(struct smu_context *smu,
15261527

15271528
ret = smu_cmn_send_smc_msg_with_param(smu,
15281529
SMU_MSG_SetWorkloadMask,
1529-
smu->workload_mask,
1530+
1 << workload_type,
15301531
NULL);
15311532
if (ret) {
15321533
dev_err(smu->adev->dev, "Fail to set workload type %d\n", workload_type);
15331534
return ret;
15341535
}
15351536

1536-
smu_cmn_assign_power_profile(smu);
1537+
smu->power_profile_mode = profile_mode;
15371538

15381539
return 0;
15391540
}

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2083,13 +2083,10 @@ static int navi10_set_power_profile_mode(struct smu_context *smu, long *input, u
20832083
smu->power_profile_mode);
20842084
if (workload_type < 0)
20852085
return -EINVAL;
2086-
20872086
ret = smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_SetWorkloadMask,
2088-
smu->workload_mask, NULL);
2087+
1 << workload_type, NULL);
20892088
if (ret)
20902089
dev_err(smu->adev->dev, "[%s] Failed to set work load mask!", __func__);
2091-
else
2092-
smu_cmn_assign_power_profile(smu);
20932090

20942091
return ret;
20952092
}

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
@@ -1788,13 +1788,10 @@ static int sienna_cichlid_set_power_profile_mode(struct smu_context *smu, long *
17881788
smu->power_profile_mode);
17891789
if (workload_type < 0)
17901790
return -EINVAL;
1791-
17921791
ret = smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_SetWorkloadMask,
1793-
smu->workload_mask, NULL);
1792+
1 << workload_type, NULL);
17941793
if (ret)
17951794
dev_err(smu->adev->dev, "[%s] Failed to set work load mask!", __func__);
1796-
else
1797-
smu_cmn_assign_power_profile(smu);
17981795

17991796
return ret;
18001797
}

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

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

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

1092-
smu_cmn_assign_power_profile(smu);
1092+
smu->power_profile_mode = profile_mode;
10931093

10941094
return 0;
10951095
}

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

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

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

902-
smu_cmn_assign_power_profile(smu);
902+
smu->power_profile_mode = profile_mode;
903903

904904
return 0;
905905
}

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
@@ -2579,7 +2579,7 @@ static int smu_v13_0_0_set_power_profile_mode(struct smu_context *smu,
25792579
DpmActivityMonitorCoeffInt_t *activity_monitor =
25802580
&(activity_monitor_external.DpmActivityMonitorCoeffInt);
25812581
int workload_type, ret = 0;
2582-
u32 workload_mask;
2582+
u32 workload_mask, selected_workload_mask;
25832583

25842584
smu->power_profile_mode = input[size];
25852585

@@ -2646,7 +2646,7 @@ static int smu_v13_0_0_set_power_profile_mode(struct smu_context *smu,
26462646
if (workload_type < 0)
26472647
return -EINVAL;
26482648

2649-
workload_mask = 1 << workload_type;
2649+
selected_workload_mask = workload_mask = 1 << workload_type;
26502650

26512651
/* Add optimizations for SMU13.0.0/10. Reuse the power saving profile */
26522652
if ((amdgpu_ip_version(smu->adev, MP1_HWIP, 0) == IP_VERSION(13, 0, 0) &&
@@ -2661,22 +2661,12 @@ static int smu_v13_0_0_set_power_profile_mode(struct smu_context *smu,
26612661
workload_mask |= 1 << workload_type;
26622662
}
26632663

2664-
smu->workload_mask |= workload_mask;
26652664
ret = smu_cmn_send_smc_msg_with_param(smu,
26662665
SMU_MSG_SetWorkloadMask,
2667-
smu->workload_mask,
2666+
workload_mask,
26682667
NULL);
2669-
if (!ret) {
2670-
smu_cmn_assign_power_profile(smu);
2671-
if (smu->power_profile_mode == PP_SMC_POWER_PROFILE_POWERSAVING) {
2672-
workload_type = smu_cmn_to_asic_specific_index(smu,
2673-
CMN2ASIC_MAPPING_WORKLOAD,
2674-
PP_SMC_POWER_PROFILE_FULLSCREEN3D);
2675-
smu->power_profile_mode = smu->workload_mask & (1 << workload_type)
2676-
? PP_SMC_POWER_PROFILE_FULLSCREEN3D
2677-
: PP_SMC_POWER_PROFILE_BOOTUP_DEFAULT;
2678-
}
2679-
}
2668+
if (!ret)
2669+
smu->workload_mask = selected_workload_mask;
26802670

26812671
return ret;
26822672
}

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
@@ -2595,14 +2595,13 @@ static int smu_v13_0_7_set_power_profile_mode(struct smu_context *smu, long *inp
25952595
smu->power_profile_mode);
25962596
if (workload_type < 0)
25972597
return -EINVAL;
2598-
25992598
ret = smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_SetWorkloadMask,
2600-
smu->workload_mask, NULL);
2599+
1 << workload_type, NULL);
26012600

26022601
if (ret)
26032602
dev_err(smu->adev->dev, "[%s] Failed to set work load mask!", __func__);
26042603
else
2605-
smu_cmn_assign_power_profile(smu);
2604+
smu->workload_mask = (1 << workload_type);
26062605

26072606
return ret;
26082607
}

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
@@ -1817,11 +1817,12 @@ static int smu_v14_0_2_set_power_profile_mode(struct smu_context *smu,
18171817
if (workload_type < 0)
18181818
return -EINVAL;
18191819

1820-
ret = smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_SetWorkloadMask,
1821-
smu->workload_mask, NULL);
1822-
1820+
ret = smu_cmn_send_smc_msg_with_param(smu,
1821+
SMU_MSG_SetWorkloadMask,
1822+
1 << workload_type,
1823+
NULL);
18231824
if (!ret)
1824-
smu_cmn_assign_power_profile(smu);
1825+
smu->workload_mask = 1 << workload_type;
18251826

18261827
return ret;
18271828
}

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

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1144,14 +1144,6 @@ int smu_cmn_set_mp1_state(struct smu_context *smu,
11441144
return ret;
11451145
}
11461146

1147-
void smu_cmn_assign_power_profile(struct smu_context *smu)
1148-
{
1149-
uint32_t index;
1150-
index = fls(smu->workload_mask);
1151-
index = index > 0 && index <= WORKLOAD_POLICY_MAX ? index - 1 : 0;
1152-
smu->power_profile_mode = smu->workload_setting[index];
1153-
}
1154-
11551147
bool smu_cmn_is_audio_func_enabled(struct amdgpu_device *adev)
11561148
{
11571149
struct pci_dev *p = NULL;

drivers/gpu/drm/amd/pm/swsmu/smu_cmn.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,6 @@ void smu_cmn_init_soft_gpu_metrics(void *table, uint8_t frev, uint8_t crev);
130130
int smu_cmn_set_mp1_state(struct smu_context *smu,
131131
enum pp_mp1_state mp1_state);
132132

133-
void smu_cmn_assign_power_profile(struct smu_context *smu);
134-
135133
/*
136134
* Helper function to make sysfs_emit_at() happy. Align buf to
137135
* the current page boundary and record the offset.

0 commit comments

Comments
 (0)