mirror of
https://github.com/linux-msm/laptops-kernel.git
synced 2026-08-13 14:19:53 -07:00
Merge back cpufreq material for 6.16
This commit is contained in:
@@ -808,19 +808,16 @@ static void amd_pstate_init_prefcore(struct amd_cpudata *cpudata)
|
||||
sched_set_itmt_core_prio((int)READ_ONCE(cpudata->prefcore_ranking), cpudata->cpu);
|
||||
}
|
||||
|
||||
static void amd_pstate_update_limits(unsigned int cpu)
|
||||
static void amd_pstate_update_limits(struct cpufreq_policy *policy)
|
||||
{
|
||||
struct cpufreq_policy *policy __free(put_cpufreq_policy) = cpufreq_cpu_get(cpu);
|
||||
struct amd_cpudata *cpudata;
|
||||
u32 prev_high = 0, cur_high = 0;
|
||||
bool highest_perf_changed = false;
|
||||
unsigned int cpu = policy->cpu;
|
||||
|
||||
if (!amd_pstate_prefcore)
|
||||
return;
|
||||
|
||||
if (!policy)
|
||||
return;
|
||||
|
||||
if (amd_get_highest_perf(cpu, &cur_high))
|
||||
return;
|
||||
|
||||
|
||||
+188
-250
File diff suppressed because it is too large
Load Diff
@@ -1356,9 +1356,11 @@ static void intel_pstate_update_policies(void)
|
||||
cpufreq_update_policy(cpu);
|
||||
}
|
||||
|
||||
static void __intel_pstate_update_max_freq(struct cpudata *cpudata,
|
||||
struct cpufreq_policy *policy)
|
||||
static void __intel_pstate_update_max_freq(struct cpufreq_policy *policy,
|
||||
struct cpudata *cpudata)
|
||||
{
|
||||
guard(cpufreq_policy_write)(policy);
|
||||
|
||||
if (hwp_active)
|
||||
intel_pstate_get_hwp_cap(cpudata);
|
||||
|
||||
@@ -1368,42 +1370,34 @@ static void __intel_pstate_update_max_freq(struct cpudata *cpudata,
|
||||
refresh_frequency_limits(policy);
|
||||
}
|
||||
|
||||
static void intel_pstate_update_limits(unsigned int cpu)
|
||||
static bool intel_pstate_update_max_freq(struct cpudata *cpudata)
|
||||
{
|
||||
struct cpufreq_policy *policy = cpufreq_cpu_acquire(cpu);
|
||||
struct cpudata *cpudata;
|
||||
struct cpufreq_policy *policy __free(put_cpufreq_policy);
|
||||
|
||||
policy = cpufreq_cpu_get(cpudata->cpu);
|
||||
if (!policy)
|
||||
return;
|
||||
return false;
|
||||
|
||||
cpudata = all_cpu_data[cpu];
|
||||
__intel_pstate_update_max_freq(policy, cpudata);
|
||||
|
||||
__intel_pstate_update_max_freq(cpudata, policy);
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Prevent the driver from being unregistered now. */
|
||||
mutex_lock(&intel_pstate_driver_lock);
|
||||
static void intel_pstate_update_limits(struct cpufreq_policy *policy)
|
||||
{
|
||||
struct cpudata *cpudata = all_cpu_data[policy->cpu];
|
||||
|
||||
cpufreq_cpu_release(policy);
|
||||
__intel_pstate_update_max_freq(policy, cpudata);
|
||||
|
||||
hybrid_update_capacity(cpudata);
|
||||
|
||||
mutex_unlock(&intel_pstate_driver_lock);
|
||||
}
|
||||
|
||||
static void intel_pstate_update_limits_for_all(void)
|
||||
{
|
||||
int cpu;
|
||||
|
||||
for_each_possible_cpu(cpu) {
|
||||
struct cpufreq_policy *policy = cpufreq_cpu_acquire(cpu);
|
||||
|
||||
if (!policy)
|
||||
continue;
|
||||
|
||||
__intel_pstate_update_max_freq(all_cpu_data[cpu], policy);
|
||||
|
||||
cpufreq_cpu_release(policy);
|
||||
}
|
||||
for_each_possible_cpu(cpu)
|
||||
intel_pstate_update_max_freq(all_cpu_data[cpu]);
|
||||
|
||||
mutex_lock(&hybrid_capacity_lock);
|
||||
|
||||
@@ -1843,13 +1837,8 @@ static void intel_pstate_notify_work(struct work_struct *work)
|
||||
{
|
||||
struct cpudata *cpudata =
|
||||
container_of(to_delayed_work(work), struct cpudata, hwp_notify_work);
|
||||
struct cpufreq_policy *policy = cpufreq_cpu_acquire(cpudata->cpu);
|
||||
|
||||
if (policy) {
|
||||
__intel_pstate_update_max_freq(cpudata, policy);
|
||||
|
||||
cpufreq_cpu_release(policy);
|
||||
|
||||
if (intel_pstate_update_max_freq(cpudata)) {
|
||||
/*
|
||||
* The driver will not be unregistered while this function is
|
||||
* running, so update the capacity without acquiring the driver
|
||||
|
||||
@@ -170,6 +170,12 @@ struct cpufreq_policy {
|
||||
struct notifier_block nb_max;
|
||||
};
|
||||
|
||||
DEFINE_GUARD(cpufreq_policy_write, struct cpufreq_policy *,
|
||||
down_write(&_T->rwsem), up_write(&_T->rwsem))
|
||||
|
||||
DEFINE_GUARD(cpufreq_policy_read, struct cpufreq_policy *,
|
||||
down_read(&_T->rwsem), up_read(&_T->rwsem))
|
||||
|
||||
/*
|
||||
* Used for passing new cpufreq policy data to the cpufreq driver's ->verify()
|
||||
* callback for sanitization. That callback is only expected to modify the min
|
||||
@@ -235,9 +241,6 @@ void disable_cpufreq(void);
|
||||
|
||||
u64 get_cpu_idle_time(unsigned int cpu, u64 *wall, int io_busy);
|
||||
|
||||
struct cpufreq_policy *cpufreq_cpu_acquire(unsigned int cpu);
|
||||
void cpufreq_cpu_release(struct cpufreq_policy *policy);
|
||||
int cpufreq_get_policy(struct cpufreq_policy *policy, unsigned int cpu);
|
||||
void refresh_frequency_limits(struct cpufreq_policy *policy);
|
||||
void cpufreq_update_policy(unsigned int cpu);
|
||||
void cpufreq_update_limits(unsigned int cpu);
|
||||
@@ -395,7 +398,7 @@ struct cpufreq_driver {
|
||||
unsigned int (*get)(unsigned int cpu);
|
||||
|
||||
/* Called to update policy limits on firmware notifications. */
|
||||
void (*update_limits)(unsigned int cpu);
|
||||
void (*update_limits)(struct cpufreq_policy *policy);
|
||||
|
||||
/* optional */
|
||||
int (*bios_limit)(int cpu, unsigned int *limit);
|
||||
|
||||
Reference in New Issue
Block a user