Skip to content

Commit 968e331

Browse files
author
CKI KWF Bot
committed
Merge: cpufreq/amd-pstate: updates to 6.17
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-10/-/merge_requests/1587 Description: updates for cpufreq/amd-pstate JIRA: https://issues.redhat.com/browse/RHEL-104550 The following commits have been excluded from the backport: c895ecd x86/msr: Rename 'wrmsrl_on_cpu()' to 'wrmsrq_on_cpu()' d7484ba x86/msr: Rename 'rdmsrl_on_cpu()' to 'rdmsrq_on_cpu()' 27a23a5 x86/msr: Rename 'wrmsrl_safe_on_cpu()' to 'wrmsrq_safe_on_cpu()' 5e404cb x86/msr: Rename 'rdmsrl_safe_on_cpu()' to 'rdmsrq_safe_on_cpu()' 78255eb x86/msr: Rename 'wrmsrl()' to 'wrmsrq()' c435e60 x86/msr: Rename 'rdmsrl()' to 'rdmsrq()' eaff6b6 cpufreq: Pass policy pointer to ->update_limits() Build Info: 69113174 Tested: Successful platform test results on AMD (amd-turin-volcano-06) system. Signed-off-by: Steve Best <sbest@redhat.com> Approved-by: Tony Camuso <tcamuso@redhat.com> Approved-by: Lenny Szubowicz <lszubowi@redhat.com> Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com> Merged-by: CKI GitLab Kmaint Pipeline Bot <26919896-cki-kmaint-pipeline-bot@users.noreply.gitlab.com>
2 parents bdd9fd0 + bb79370 commit 968e331

File tree

3 files changed

+33
-12
lines changed

3 files changed

+33
-12
lines changed

drivers/cpufreq/amd-pstate-ut.c

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -242,25 +242,30 @@ static int amd_pstate_set_mode(enum amd_pstate_mode mode)
242242
static int amd_pstate_ut_check_driver(u32 index)
243243
{
244244
enum amd_pstate_mode mode1, mode2 = AMD_PSTATE_DISABLE;
245+
enum amd_pstate_mode orig_mode = amd_pstate_get_status();
246+
int ret;
245247

246248
for (mode1 = AMD_PSTATE_DISABLE; mode1 < AMD_PSTATE_MAX; mode1++) {
247-
int ret = amd_pstate_set_mode(mode1);
249+
ret = amd_pstate_set_mode(mode1);
248250
if (ret)
249251
return ret;
250252
for (mode2 = AMD_PSTATE_DISABLE; mode2 < AMD_PSTATE_MAX; mode2++) {
251253
if (mode1 == mode2)
252254
continue;
253255
ret = amd_pstate_set_mode(mode2);
254-
if (ret) {
255-
pr_err("%s: failed to update status for %s->%s\n", __func__,
256-
amd_pstate_get_mode_string(mode1),
257-
amd_pstate_get_mode_string(mode2));
258-
return ret;
259-
}
256+
if (ret)
257+
goto out;
260258
}
261259
}
262260

263-
return 0;
261+
out:
262+
if (ret)
263+
pr_warn("%s: failed to update status for %s->%s: %d\n", __func__,
264+
amd_pstate_get_mode_string(mode1),
265+
amd_pstate_get_mode_string(mode2), ret);
266+
267+
amd_pstate_set_mode(orig_mode);
268+
return ret;
264269
}
265270

266271
static int __init amd_pstate_ut_init(void)

drivers/cpufreq/amd-pstate.c

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -826,6 +826,13 @@ static void amd_pstate_init_prefcore(struct amd_cpudata *cpudata)
826826
if (!amd_pstate_prefcore)
827827
return;
828828

829+
/* should use amd-hfi instead */
830+
if (cpu_feature_enabled(X86_FEATURE_AMD_WORKLOAD_CLASS) &&
831+
IS_ENABLED(CONFIG_AMD_HFI)) {
832+
amd_pstate_prefcore = false;
833+
return;
834+
}
835+
829836
cpudata->hw_prefcore = true;
830837

831838
/* Priorities must be initialized before ITMT support can be toggled on. */
@@ -1335,6 +1342,12 @@ static ssize_t amd_pstate_show_status(char *buf)
13351342
return sysfs_emit(buf, "%s\n", amd_pstate_mode_string[cppc_state]);
13361343
}
13371344

1345+
int amd_pstate_get_status(void)
1346+
{
1347+
return cppc_state;
1348+
}
1349+
EXPORT_SYMBOL_GPL(amd_pstate_get_status);
1350+
13381351
int amd_pstate_update_status(const char *buf, size_t size)
13391352
{
13401353
int mode_idx;
@@ -1544,13 +1557,15 @@ static void amd_pstate_epp_cpu_exit(struct cpufreq_policy *policy)
15441557
pr_debug("CPU %d exiting\n", policy->cpu);
15451558
}
15461559

1547-
static int amd_pstate_epp_update_limit(struct cpufreq_policy *policy)
1560+
static int amd_pstate_epp_update_limit(struct cpufreq_policy *policy, bool policy_change)
15481561
{
15491562
struct amd_cpudata *cpudata = policy->driver_data;
15501563
union perf_cached perf;
15511564
u8 epp;
15521565

1553-
if (policy->min != cpudata->min_limit_freq || policy->max != cpudata->max_limit_freq)
1566+
if (policy_change ||
1567+
policy->min != cpudata->min_limit_freq ||
1568+
policy->max != cpudata->max_limit_freq)
15541569
amd_pstate_update_min_max_limit(policy);
15551570

15561571
if (cpudata->policy == CPUFREQ_POLICY_PERFORMANCE)
@@ -1574,7 +1589,7 @@ static int amd_pstate_epp_set_policy(struct cpufreq_policy *policy)
15741589

15751590
cpudata->policy = policy->policy;
15761591

1577-
ret = amd_pstate_epp_update_limit(policy);
1592+
ret = amd_pstate_epp_update_limit(policy, true);
15781593
if (ret)
15791594
return ret;
15801595

@@ -1649,7 +1664,7 @@ static int amd_pstate_epp_resume(struct cpufreq_policy *policy)
16491664
int ret;
16501665

16511666
/* enable amd pstate from suspend state*/
1652-
ret = amd_pstate_epp_update_limit(policy);
1667+
ret = amd_pstate_epp_update_limit(policy, false);
16531668
if (ret)
16541669
return ret;
16551670

drivers/cpufreq/amd-pstate.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ enum amd_pstate_mode {
121121
AMD_PSTATE_MAX,
122122
};
123123
const char *amd_pstate_get_mode_string(enum amd_pstate_mode mode);
124+
int amd_pstate_get_status(void);
124125
int amd_pstate_update_status(const char *buf, size_t size);
125126

126127
#endif /* _LINUX_AMD_PSTATE_H */

0 commit comments

Comments
 (0)