mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-12-27 13:30:45 -05:00
tools/power x86_energy_perf_policy: Enhance HWP enable
On enabling HWP, preserve the reserved bits in MSR_PM_ENABLE. Also, skip writing the MSR_PM_ENABLE if HWP is already enabled. Signed-off-by: Len Brown <len.brown@intel.com>
This commit is contained in:
@@ -1166,13 +1166,18 @@ int update_hwp_request_pkg(int pkg)
|
||||
|
||||
int enable_hwp_on_cpu(int cpu)
|
||||
{
|
||||
unsigned long long msr;
|
||||
unsigned long long old_msr, new_msr;
|
||||
|
||||
get_msr(cpu, MSR_PM_ENABLE, &msr);
|
||||
put_msr(cpu, MSR_PM_ENABLE, 1);
|
||||
get_msr(cpu, MSR_PM_ENABLE, &old_msr);
|
||||
|
||||
if (old_msr & 1)
|
||||
return 0; /* already enabled */
|
||||
|
||||
new_msr = old_msr | 1;
|
||||
put_msr(cpu, MSR_PM_ENABLE, new_msr);
|
||||
|
||||
if (verbose)
|
||||
printf("cpu%d: MSR_PM_ENABLE old: %d new: %d\n", cpu, (unsigned int) msr, 1);
|
||||
printf("cpu%d: MSR_PM_ENABLE old: %llX new: %llX\n", cpu, old_msr, new_msr);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user