CPPC stable backports
cover CPPC stable backports
Hi Sasha, Greg,
Please apply these CPPC backports to 7.3.y.
Base: d50d994bffa3c7c6db2d8bc4c5f0c55e3f46b0cd (linux-7.3.y)
The final series passed plain git am onto this base, affected-code builds, full native builds and boot/runtime tests on AMD Ryzen 5 7430U and Orion arm64. Runtime coverage included FFH validation, feedback counters, governor and limit writes, and CPU hotplug. Extracted-function tests covered malformed fields and error paths.
Christian
Christian Loehle (3):
ACPI: CPPC: Validate FFH register fields before hardware access
cpufreq: CPPC: Select the frequency-invariance callback per CPU
ACPI: CPPC: Accept requests to retain immutable autonomous selection
PATCH 1/3 ACPI: CPPC: Validate FFH register fields before hardware access
commit 6b016c5c96448c0a5f09328d37f66562d154a5e5 upstream.
The x86 CPPC FFH accessors construct masks and shift values using the firmware's Bit Width and Bit Offset without checking that the field fits in an MSR. A zero-width field or a field extending beyond bit 63 can therefore cause an invalid shift. The safe MSR accessors only handle an access fault, not invalid field arithmetic after a successful read.
Also, the 64-bit GAS address is implicitly narrowed to the 32-bit MSR number. A descriptor with nonzero upper address bits can access a different MSR from the one described by firmware.
The arm64 AMU counter readers have the same unchecked field arithmetic. Validate the field bounds before reading a counter, including both descriptors in the paired counter path.
Dispatch FFH accesses before decoding the GAS Access Size in the common read and write paths. Otherwise, a large access_width can trigger an invalid shift in GET_BIT_WIDTH() before the architecture validates its register. That field has architecture-specific FFH semantics and is not needed by the generic memory/port accessor on this path.
Validate x86 MSR addresses and share the field-bounds checks between related accessors within each architecture.
--- arch/arm64/kernel/topology.c | 12 +++++++++++- arch/x86/kernel/acpi/cppc.c | 15 +++++++++++++++ drivers/acpi/cppc_acpi.c | 10 ++++++---- 3 files changed, 32 insertions(+), 5 deletions(-)
arch/arm64/kernel/topology.c +11 -1
@@ -470,6 +470,12 @@ static void amu_read_core_const_ctrs(void *val)cpu_read_corecnt (&ctrs->corecnt); } +static bool cpc_ffh_reg_valid (const struct cpc_reg *reg) +{ +return reg->bit_width && reg->bit_width <=64 && + reg->bit_offset <=64 - reg->bit_width; +} +static u64 cpc_ffh_extract_bits (const struct cpc_reg *reg,u64 val) { val &= GENMASK_ULL(reg->bit_offset + reg->bit_width - 1,
@@ -506,7 +512,8 @@ int cpc_read_ffh_fb_ctrs(int cpu, struct cpc_reg *reg1, u64 *val1,struct amu_ffh_ctrs ctrs;int ret; -if (!is_amu_ctr_reg (reg1) || !is_amu_ctr_reg (reg2)) +if (!is_amu_ctr_reg (reg1) || !is_amu_ctr_reg (reg2) || + !cpc_ffh_reg_valid (reg1) || !cpc_ffh_reg_valid (reg2))return -EINVAL ; ret =counters_read_on_cpu (cpu, amu_read_core_const_ctrs, &ctrs);
@@ -530,6 +537,9 @@ int cpc_read_ffh(int cpu, struct cpc_reg *reg, u64 *val) {int ret = -EOPNOTSUPP ; +if (!cpc_ffh_reg_valid (reg)) +return -EINVAL ; +switch ((u64 )reg->address) {case CPC_FFH_CTR_CORE : ret =counters_read_on_cpu (cpu, cpu_read_corecnt, val);
arch/x86/kernel/acpi/cppc.c +15 -0
@@ -6,6 +6,8 @@#include <linux/bitfield.h> +#include <linux/limits.h> +#include <acpi/cppc_acpi.h> #include <asm/msr.h> #include <asm/processor.h>
@@ -45,10 +47,20 @@ bool cpc_ffh_supported(void)return true; } +static bool cpc_ffh_reg_valid (const struct cpc_reg *reg) +{ +return reg->address <=U32_MAX && reg->bit_width && + reg->bit_width <=64 && + reg->bit_offset <=64 - reg->bit_width; +} +int cpc_read_ffh (int cpunum,struct cpc_reg *reg,u64 *val) {int err; +if (!cpc_ffh_reg_valid (reg)) +return -EINVAL ; + err =rdmsrq_safe_on_cpu (cpunum, reg->address, val);if (!err) { u64 mask = GENMASK_ULL(reg->bit_offset + reg->bit_width - 1,
@@ -65,6 +77,9 @@ int cpc_write_ffh(int cpunum, struct cpc_reg *reg, u64 val)u64 rd_val;int err; +if (!cpc_ffh_reg_valid (reg)) +return -EINVAL ; + err =rdmsrq_safe_on_cpu (cpunum, reg->address, &rd_val);if (!err) { u64 mask = GENMASK_ULL(reg->bit_offset + reg->bit_width - 1,
drivers/acpi/cppc_acpi.c +6 -4
@@ -1133,6 +1133,9 @@ static int cpc_read(int cpu, struct cpc_register_resource *reg_res, u64 *val) } *val =0 ; +if (reg->space_id ==ACPI_ADR_SPACE_FIXED_HARDWARE ) +return cpc_read_ffh (cpu, reg, val); + size =GET_BIT_WIDTH (reg); if (IS_ENABLED(CONFIG_HAS_IOPORT) &&
@@ -1160,8 +1163,6 @@ static int cpc_read(int cpu, struct cpc_register_resource *reg_res, u64 *val) }else if (reg->space_id ==ACPI_ADR_SPACE_SYSTEM_MEMORY ) vaddr = reg_res->sys_mem_vaddr; -else if (reg->space_id ==ACPI_ADR_SPACE_FIXED_HARDWARE ) -return cpc_read_ffh (cpu, reg, val);else return acpi_os_read_memory ((acpi_physical_address )reg->address, val, size);
@@ -1208,6 +1209,9 @@ static int cpc_write(int cpu, struct cpc_register_resource *reg_res, u64 val)unsigned long flags;bool locked = false; +if (reg->space_id ==ACPI_ADR_SPACE_FIXED_HARDWARE ) +return cpc_write_ffh (cpu, reg, val); + size =GET_BIT_WIDTH (reg); if (IS_ENABLED(CONFIG_HAS_IOPORT) &&
@@ -1233,8 +1237,6 @@ static int cpc_write(int cpu, struct cpc_register_resource *reg_res, u64 val) }else if (reg->space_id ==ACPI_ADR_SPACE_SYSTEM_MEMORY ) vaddr = reg_res->sys_mem_vaddr; -else if (reg->space_id ==ACPI_ADR_SPACE_FIXED_HARDWARE ) -return cpc_write_ffh (cpu, reg, val);else return acpi_os_write_memory ((acpi_physical_address )reg->address, val, size);
PATCH 2/3 cpufreq: CPPC: Select the frequency-invariance callback per CPU
In reply to Christian Loehlecommit 21e018235d99bc86249b034c06646df8757b2852 upstream.
cppc_cpufreq_cpu_fie_init() initializes deferred work only for CPUs whose feedback counters use PCC. However, if any CPU in a shared policy uses PCC, it installs the PCC tick callback for the entire policy. With FIE enabled, a non-PCC CPU then queues an uninitialized irq_work and can call a NULL function pointer when that work runs.
Choose the frequency-invariance callback separately for each CPU using the recorded work-initialization state. Processor removal can unpublish the CPC descriptor before callback registration, so querying its counter transport again can incorrectly select direct reads for a PCC CPU.
Register the callbacks after all counter initialization has completed, so a failed initial read for an online CPU cannot leave a partially registered policy. PCC CPUs use their initialized deferred work, while non-PCC CPUs read their own counters directly from the tick.
---
Includes work-state tracking and the NULL-descriptor check from 27954e29d7de66e65ef1be4ce5a50505066c9bb6. Apply before patch 3.
drivers/acpi/cppc_acpi.c | 3 +++ drivers/cpufreq/cppc_cpufreq.c | 21 +++++++++++++++------ 2 files changed, 18 insertions(+), 6 deletions(-)
drivers/acpi/cppc_acpi.c +3 -0
@@ -1615,6 +1615,9 @@ bool cppc_perf_ctrs_in_pcc_cpu(unsigned int cpu) {struct cpc_desc *cpc_desc =per_cpu (cpc_desc_ptr, cpu); +if (!cpc_desc) +return false; +return CPC_IN_PCC (&cpc_desc->cpc_regs[DELIVERED_CTR ]) ||CPC_IN_PCC (&cpc_desc->cpc_regs[REFERENCE_CTR ]) ||CPC_IN_PCC (&cpc_desc->cpc_regs[CTR_WRAP_TIME ]);
drivers/cpufreq/cppc_cpufreq.c +15 -6
@@ -41,6 +41,7 @@ MODULE_PARM_DESC(fie_disabled, "Disable Frequency Invariance Engine (FIE)");/* Frequency invariance support */ struct cppc_freq_invariance {int cpu; +bool pcc_work_initialized;struct irq_work irq_work;struct kthread_work work;struct cppc_perf_fb_ctrs prev_perf_fb_ctrs;
@@ -149,7 +150,7 @@ static struct scale_freq_data cppc_sftd_pcc = {static void cppc_cpufreq_cpu_fie_init (struct cpufreq_policy *policy) { -struct scale_freq_data *sftd = &cppc_sftd; +struct scale_freq_data *sftd;struct cppc_freq_invariance *cppc_fi;int cpu, ret;
@@ -163,7 +164,7 @@ static void cppc_cpufreq_cpu_fie_init(struct cpufreq_policy *policy)if (cppc_perf_ctrs_in_pcc_cpu (cpu)) {kthread_init_work (&cppc_fi->work, cppc_scale_freq_workfn);init_irq_work (&cppc_fi->irq_work, cppc_irq_work); - sftd = &cppc_sftd_pcc; + cppc_fi->pcc_work_initialized = true; } ret =cppc_get_perf_ctrs (cpu, &cppc_fi->prev_perf_fb_ctrs);
@@ -179,8 +180,15 @@ static void cppc_cpufreq_cpu_fie_init(struct cpufreq_policy *policy) } } -/* Register for freq-invariance */ -topology_set_scale_freq_source (sftd, policy->cpus); +/* A shared policy may contain both PCC and non-PCC counters. */ +for_each_cpu (cpu, policy->cpus) { + cppc_fi = &per_cpu (cppc_freq_inv, cpu); +if (cppc_fi->pcc_work_initialized) + sftd = &cppc_sftd_pcc; +else + sftd = &cppc_sftd; +topology_set_scale_freq_source (sftd,cpumask_of (cpu)); + } }/*
@@ -203,11 +211,12 @@ static void cppc_cpufreq_cpu_fie_exit(struct cpufreq_policy *policy)topology_clear_scale_freq_source (SCALE_FREQ_SOURCE_CPPC , policy->related_cpus);for_each_cpu (cpu, policy->related_cpus) { -if (!cppc_perf_ctrs_in_pcc_cpu (cpu)) -continue ; cppc_fi = &per_cpu (cppc_freq_inv, cpu); +if (!cppc_fi->pcc_work_initialized) +continue ;irq_work_sync (&cppc_fi->irq_work);kthread_cancel_work_sync (&cppc_fi->work); + cppc_fi->pcc_work_initialized = false; } }
Sasha Levin
maintainerRe: [PATCH 7.3 2/3] cpufreq: CPPC: Select the frequency-invariance callback per CPU
Quoted 3 lines
commit
21e018235d99bc86249b034c06646df8757b2852upstream.cppc_cpufreq_cpu_fie_init()initializes deferred work only for CPUs whose feedback counters use PCC.
Patches 1 and 3 are queued for 7.3.
This one doesn't apply to the current 7.3 queue: 995e7d468070 ("cpufreq: CPPC:
Create the FIE worker before enabling PCC callbacks") adds cppc_fie_kworker_init() in the PCC branch of cppc_cpufreq_cpu_fie_init(). Please rebase it on the queue and resend.
Signature · 2 lines
Thanks, Sasha
PATCH 1/1 cpufreq: CPPC: Select the frequency-invariance callback, per CPU
commit 21e018235d99bc86249b034c06646df8757b2852 upstream.
cppc_cpufreq_cpu_fie_init() initializes deferred work only for CPUs whose feedback counters use PCC. However, if any CPU in a shared policy uses PCC, it installs the PCC tick callback for the entire policy. With FIE enabled, a non-PCC CPU then queues an uninitialized irq_work and can call a NULL function pointer when that work runs.
Choose the frequency-invariance callback separately for each CPU using the recorded work-initialization state. Processor removal can unpublish the CPC descriptor before callback registration, so querying its counter transport again can incorrectly select direct reads for a PCC CPU.
Register the callbacks after all counter initialization has completed, so a failed initial read for an online CPU cannot leave a partially registered policy. PCC CPUs use their initialized deferred work, while non-PCC CPUs read their own counters directly from the tick.
---
Rebased on 89b37c05e36a (upstream 995e7d468070) and the queued patches. Includes the work-state and NULL-descriptor prerequisites from 27954e29d7de.
drivers/acpi/cppc_acpi.c | 3 +++ drivers/cpufreq/cppc_cpufreq.c | 21 +++++++++++++++------ 2 files changed, 18 insertions(+), 6 deletions(-)
drivers/acpi/cppc_acpi.c +3 -0
@@ -1633,6 +1633,9 @@ bool cppc_perf_ctrs_in_pcc_cpu(unsigned int cpu) {struct cpc_desc *cpc_desc =per_cpu (cpc_desc_ptr, cpu); +if (!cpc_desc) +return false; +return CPC_IN_PCC (&cpc_desc->cpc_regs[DELIVERED_CTR ]) ||CPC_IN_PCC (&cpc_desc->cpc_regs[REFERENCE_CTR ]) ||CPC_IN_PCC (&cpc_desc->cpc_regs[CTR_WRAP_TIME ]);
drivers/cpufreq/cppc_cpufreq.c +15 -6
@@ -42,6 +42,7 @@ MODULE_PARM_DESC(fie_disabled, "Disable Frequency Invariance Engine (FIE)");/* Frequency invariance support */ struct cppc_freq_invariance {int cpu; +bool pcc_work_initialized;struct irq_work irq_work;struct kthread_work work;struct cppc_perf_fb_ctrs prev_perf_fb_ctrs;
@@ -152,7 +153,7 @@ static struct scale_freq_data cppc_sftd_pcc = {static void cppc_cpufreq_cpu_fie_init (struct cpufreq_policy *policy) { -struct scale_freq_data *sftd = &cppc_sftd; +struct scale_freq_data *sftd;struct cppc_freq_invariance *cppc_fi;int cpu, ret;
@@ -169,7 +170,7 @@ static void cppc_cpufreq_cpu_fie_init(struct cpufreq_policy *policy)kthread_init_work (&cppc_fi->work, cppc_scale_freq_workfn);init_irq_work (&cppc_fi->irq_work, cppc_irq_work); - sftd = &cppc_sftd_pcc; + cppc_fi->pcc_work_initialized = true; } ret =cppc_get_perf_ctrs (cpu, &cppc_fi->prev_perf_fb_ctrs);
@@ -185,8 +186,15 @@ static void cppc_cpufreq_cpu_fie_init(struct cpufreq_policy *policy) } } -/* Register for freq-invariance */ -topology_set_scale_freq_source (sftd, policy->cpus); +/* A shared policy may contain both PCC and non-PCC counters. */ +for_each_cpu (cpu, policy->cpus) { + cppc_fi = &per_cpu (cppc_freq_inv, cpu); +if (cppc_fi->pcc_work_initialized) + sftd = &cppc_sftd_pcc; +else + sftd = &cppc_sftd; +topology_set_scale_freq_source (sftd,cpumask_of (cpu)); + } }/*
@@ -209,11 +217,12 @@ static void cppc_cpufreq_cpu_fie_exit(struct cpufreq_policy *policy)topology_clear_scale_freq_source (SCALE_FREQ_SOURCE_CPPC , policy->related_cpus);for_each_cpu (cpu, policy->related_cpus) { -if (!cppc_perf_ctrs_in_pcc_cpu (cpu)) -continue ; cppc_fi = &per_cpu (cppc_freq_inv, cpu); +if (!cppc_fi->pcc_work_initialized) +continue ;irq_work_sync (&cppc_fi->irq_work);kthread_cancel_work_sync (&cppc_fi->work); + cppc_fi->pcc_work_initialized = false; } }
Signature · 1 line
2.34.1
Re: [PATCH 7.3] cpufreq: CPPC: Select the frequency-invariance callback, per CPU
Quoted 1 line
cpufreq: CPPC: Select the frequency-invariance callback, per CPU
Queued for 7.3, thanks.
Signature · 2 lines
Thanks, Sasha
PATCH 3/3 ACPI: CPPC: Accept requests to retain immutable autonomous selection
In reply to Christian Loehlecommit 4bcc60d326c5acaa28c5913259decb22a33a83a1 upstream.
ACPI permits Autonomous Selection Enable to be Integer 1 when the platform always selects performance autonomously. cppc_get_auto_sel() returns that value, but cppc_set_auto_sel() rejects the Integer even when asked to keep autonomous selection enabled. AMD shared-memory initialization consequently fails in active or guided mode after successfully reading the capability.
Accept a request to keep this immutable field enabled without issuing a register access. Expose the immutable encoding to callers, separately from the current value of a writable register.
Before an AMD shared-memory transition to passive mode, reject immutable autonomous selection on any present CPU. Otherwise a guided-to-passive transition ignores the failed disable and reports the wrong mode, while active-to-passive unregisters the working driver before passive policy initialization fails. Check under the driver mode lock before invoking either transition, including known offline CPUs.
Serialize this capability query with descriptor publication and removal. ACPI processor removal drops the descriptor before taking the CPU hotplug write lock, so the caller's cpus_read_lock() alone cannot protect the lookup. Unpublish under the same mutex before releasing a descriptor, including when adding its kobject fails.
The cppc-cpufreq auto_select attribute can also request one while autonomous selection is already enabled. If the subsequent bounds update fails, its rollback requests zero and clears the cached mode regardless of the previous state. For an immutable field the disable request fails, leaving the cached mode wrong. Save and restore the previous mode instead. This also avoids disabling an already-enabled writable control on that error path.
--- drivers/acpi/cppc_acpi.c | 48 ++++++++++++++++++++++++++++++++-- drivers/cpufreq/amd-pstate.c | 25 ++++++++++++++---- drivers/cpufreq/cppc_cpufreq.c | 5 ++-- include/acpi/cppc_acpi.h | 6 +++++ 4 files changed, 75 insertions(+), 9 deletions(-)
drivers/acpi/cppc_acpi.c +46 -2
@@ -36,6 +36,7 @@#include <linux/delay.h> #include <linux/iopoll.h> #include <linux/ktime.h> +#include <linux/mutex.h> #include <linux/rwsem.h> #include <linux/wait.h> #include <linux/topology.h>
@@ -93,6 +94,16 @@ static DEFINE_PER_CPU(int, cpu_pcc_subspace_idx);*/ static DEFINE_PER_CPU(struct cpc_desc *, cpc_desc_ptr); +/* Protect immutable capability queries against descriptor removal. */ +static DEFINE_MUTEX (cpc_desc_lock); + +static void cpc_set_desc (unsigned int cpu,struct cpc_desc *desc) +{ +mutex_lock (&cpc_desc_lock); +per_cpu (cpc_desc_ptr, cpu) = desc; +mutex_unlock (&cpc_desc_lock); +} +/* pcc mapped address + header size + offset within PCC subspace */ #define GET_PCC_VADDR (offs, pcc_ss_id) (pcc_data[pcc_ss_id]->pcc_channel->shmem + \ 0x8 + (offs))
@@ -999,12 +1010,12 @@ int acpi_cppc_processor_probe(struct acpi_processor *pr) }/* Plug PSD data into this CPU's CPC descriptor. */ -per_cpu (cpc_desc_ptr, pr->id) = cpc_ptr; +cpc_set_desc (pr->id, cpc_ptr); ret =kobject_init_and_add (&cpc_ptr->kobj, &cppc_ktype, &cpu_dev->kobj,"acpi_cppc" );if (ret) { -per_cpu (cpc_desc_ptr, pr->id) =NULL ; +cpc_set_desc (pr->id,NULL );kobject_put (&cpc_ptr->kobj); goto out_free; }
@@ -1056,6 +1067,8 @@ void acpi_cppc_processor_exit(struct acpi_processor *pr)if (!cpc_ptr)return ; +cpc_set_desc (pr->id,NULL ); +/* Free all the mapped sys mem areas for this CPU */ for (i =2 ; i < cpc_ptr->num_entries; i++) { addr = cpc_ptr->cpc_regs[i-2 ].sys_mem_vaddr;
@@ -1402,6 +1415,11 @@ static int cppc_set_reg_val(int cpu, enum cppc_regs reg_idx, u64 val) reg = &cpc_desc->cpc_regs[reg_idx]; +/* Integer 1 describes autonomous selection that is always enabled. */ +if (reg_idx ==AUTO_SEL_ENABLE && reg->type ==ACPI_TYPE_INTEGER && + reg->cpc_entry.int_value ==1 ) +return val ==1 ?0 : -EOPNOTSUPP ; +/* if a register is writeable, it must be a buffer and not null */ if ((reg->type !=ACPI_TYPE_BUFFER ) ||IS_NULL_REG (®->cpc_entry.reg)) {pr_debug ("CPC register is not supported\n" );
@@ -1929,6 +1947,32 @@ int cppc_get_auto_sel(int cpu, bool *enable) }EXPORT_SYMBOL_GPL (cppc_get_auto_sel); +/** +* cppc_auto_sel_is_immutable - Check for always-enabled autonomous selection. +* @cpu: CPU whose _CPC descriptor to check. +* +* Context: Process context. +* Return: true for Integer 1, false for a register or an absent descriptor. +*/ +bool cppc_auto_sel_is_immutable (int cpu) +{ +struct cpc_desc *cpc_desc; +struct cpc_register_resource *reg; +bool immutable = false; + +mutex_lock (&cpc_desc_lock); + cpc_desc =per_cpu (cpc_desc_ptr, cpu); +if (cpc_desc) { + reg = &cpc_desc->cpc_regs[AUTO_SEL_ENABLE ]; + immutable = reg->type ==ACPI_TYPE_INTEGER && + reg->cpc_entry.int_value ==1 ; + } +mutex_unlock (&cpc_desc_lock); + +return immutable; +} +EXPORT_SYMBOL_GPL (cppc_auto_sel_is_immutable); +/** * cppc_set_auto_sel - Write autonomous selection register. * @cpu : CPU to which to write register.
drivers/cpufreq/amd-pstate.c +20 -5
@@ -1794,7 +1794,7 @@ EXPORT_SYMBOL_FOR_PSTATE_UT(amd_pstate_get_status);int amd_pstate_update_status (const char *buf,size_t size) { -int mode_idx; +int cpu, mode_idx, ret =0 ;if (size >strlen ("passive" ) || size <strlen ("active" ))return -EINVAL ;
@@ -1803,12 +1803,27 @@ int amd_pstate_update_status(const char *buf, size_t size)if (mode_idx <0 )return mode_idx; -if (mode_state_machine[cppc_state][mode_idx]) { -guard (mutex)(&amd_pstate_driver_lock); -return mode_state_machine[cppc_state][mode_idx](mode_idx); +guard (mutex)(&amd_pstate_driver_lock); + +if (!mode_state_machine[cppc_state][mode_idx]) +return 0 ; + +if (mode_idx ==AMD_PSTATE_PASSIVE && + !cpu_feature_enabled (X86_FEATURE_CPPC )) { +cpus_read_lock (); +/* Check offline CPUs too, before changing or removing the driver. */ +for_each_present_cpu (cpu) { +if (cppc_auto_sel_is_immutable (cpu)) { + ret = -EOPNOTSUPP ; +break ; + } + } +cpus_read_unlock (); +if (ret) +return ret; } -return 0 ; +return mode_state_machine[cppc_state][mode_idx](mode_idx); }EXPORT_SYMBOL_FOR_PSTATE_UT (amd_pstate_update_status);
drivers/cpufreq/cppc_cpufreq.c +3 -2
@@ -892,6 +892,7 @@ static ssize_t store_auto_select(struct cpufreq_policy *policy, const char *buf, size_t count) {struct cppc_cpudata *cpu_data = policy->driver_data; +bool old_auto_sel = cpu_data->perf_ctrls.auto_sel;bool val;int ret;
@@ -920,8 +921,8 @@ static ssize_t store_auto_select(struct cpufreq_policy *policy,if (ret) { cpu_data->perf_ctrls.min_perf = old_min_perf; cpu_data->perf_ctrls.max_perf = old_max_perf; -cppc_set_auto_sel (policy->cpu, false); - cpu_data->perf_ctrls.auto_sel = false; +cppc_set_auto_sel (policy->cpu, old_auto_sel); + cpu_data->perf_ctrls.auto_sel = old_auto_sel;return ret; } }
include/acpi/cppc_acpi.h +6 -0
@@ -188,6 +188,7 @@ extern int cppc_set_epp(int cpu, u64 epp_val);extern int cppc_get_auto_act_window (int cpu,u64 *auto_act_window);extern int cppc_set_auto_act_window (int cpu,u64 auto_act_window);extern int cppc_get_auto_sel (int cpu,bool *enable); +bool cppc_auto_sel_is_immutable (int cpu);extern int cppc_set_auto_sel (int cpu,bool enable);extern int cppc_get_perf_limited (int cpu,u64 *perf_limited);extern int cppc_set_perf_limited (int cpu,u64 bits_to_clear);
@@ -289,6 +290,11 @@ static inline int cppc_get_auto_sel(int cpu, bool *enable) {return -EOPNOTSUPP ; } +static inline bool cppc_auto_sel_is_immutable (int cpu) +{ +return false; +} +static inline int cppc_set_auto_sel (int cpu,bool enable) {return -EOPNOTSUPP ;