Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'pm-6.10-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull power management fixes from Rafael Wysocki:
"These fix the intel_pstate and amd-pstate cpufreq drivers and the
cpupower utility.

Specifics:

- Fix a recently introduced unchecked HWP MSR access in the
intel_pstate driver (Srinivas Pandruvada)

- Add missing conversion from MHz to KHz to amd_pstate_set_boost() to
address sysfs inteface inconsistency and fix P-state frequency
reporting on AMD Family 1Ah CPUs in the cpupower utility (Dhananjay
Ugwekar)

- Get rid of an excess global header file used by the amd-pstate
cpufreq driver (Arnd Bergmann)"

* tag 'pm-6.10-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
cpufreq: intel_pstate: Fix unchecked HWP MSR access
cpufreq: amd-pstate: Fix the inconsistency in max frequency units
cpufreq: amd-pstate: remove global header file
tools/power/cpupower: Fix Pstate frequency reporting on AMD Family 1Ah CPUs

+61 -41
-1
MAINTAINERS
··· 1107 1107 S: Supported 1108 1108 F: Documentation/admin-guide/pm/amd-pstate.rst 1109 1109 F: drivers/cpufreq/amd-pstate* 1110 - F: include/linux/amd-pstate.h 1111 1110 F: tools/power/x86/amd_pstate_tracer/amd_pstate_trace.py 1112 1111 1113 1112 AMD PTDMA DRIVER
+2 -1
drivers/cpufreq/amd-pstate-ut.c
··· 26 26 #include <linux/module.h> 27 27 #include <linux/moduleparam.h> 28 28 #include <linux/fs.h> 29 - #include <linux/amd-pstate.h> 30 29 31 30 #include <acpi/cppc_acpi.h> 31 + 32 + #include "amd-pstate.h" 32 33 33 34 /* 34 35 * Abbreviations:
+34 -2
drivers/cpufreq/amd-pstate.c
··· 36 36 #include <linux/delay.h> 37 37 #include <linux/uaccess.h> 38 38 #include <linux/static_call.h> 39 - #include <linux/amd-pstate.h> 40 39 #include <linux/topology.h> 41 40 42 41 #include <acpi/processor.h> ··· 45 46 #include <asm/processor.h> 46 47 #include <asm/cpufeature.h> 47 48 #include <asm/cpu_device_id.h> 49 + 50 + #include "amd-pstate.h" 48 51 #include "amd-pstate-trace.h" 49 52 50 53 #define AMD_PSTATE_TRANSITION_LATENCY 20000 51 54 #define AMD_PSTATE_TRANSITION_DELAY 1000 52 55 #define CPPC_HIGHEST_PERF_PERFORMANCE 196 53 56 #define CPPC_HIGHEST_PERF_DEFAULT 166 57 + 58 + #define AMD_CPPC_EPP_PERFORMANCE 0x00 59 + #define AMD_CPPC_EPP_BALANCE_PERFORMANCE 0x80 60 + #define AMD_CPPC_EPP_BALANCE_POWERSAVE 0xBF 61 + #define AMD_CPPC_EPP_POWERSAVE 0xFF 62 + 63 + /* 64 + * enum amd_pstate_mode - driver working mode of amd pstate 65 + */ 66 + enum amd_pstate_mode { 67 + AMD_PSTATE_UNDEFINED = 0, 68 + AMD_PSTATE_DISABLE, 69 + AMD_PSTATE_PASSIVE, 70 + AMD_PSTATE_ACTIVE, 71 + AMD_PSTATE_GUIDED, 72 + AMD_PSTATE_MAX, 73 + }; 74 + 75 + static const char * const amd_pstate_mode_string[] = { 76 + [AMD_PSTATE_UNDEFINED] = "undefined", 77 + [AMD_PSTATE_DISABLE] = "disable", 78 + [AMD_PSTATE_PASSIVE] = "passive", 79 + [AMD_PSTATE_ACTIVE] = "active", 80 + [AMD_PSTATE_GUIDED] = "guided", 81 + NULL, 82 + }; 83 + 84 + struct quirk_entry { 85 + u32 nominal_freq; 86 + u32 lowest_freq; 87 + }; 54 88 55 89 /* 56 90 * TODO: We need more time to fine tune processors with shared memory solution ··· 701 669 if (state) 702 670 policy->cpuinfo.max_freq = cpudata->max_freq; 703 671 else 704 - policy->cpuinfo.max_freq = cpudata->nominal_freq; 672 + policy->cpuinfo.max_freq = cpudata->nominal_freq * 1000; 705 673 706 674 policy->max = policy->cpuinfo.max_freq; 707 675
+2 -1
drivers/cpufreq/intel_pstate.c
··· 1153 1153 static void __intel_pstate_update_max_freq(struct cpudata *cpudata, 1154 1154 struct cpufreq_policy *policy) 1155 1155 { 1156 - intel_pstate_get_hwp_cap(cpudata); 1156 + if (hwp_active) 1157 + intel_pstate_get_hwp_cap(cpudata); 1157 1158 1158 1159 policy->cpuinfo.max_freq = READ_ONCE(global.no_turbo) ? 1159 1160 cpudata->pstate.max_freq : cpudata->pstate.turbo_freq;
-33
include/linux/amd-pstate.h drivers/cpufreq/amd-pstate.h
··· 1 1 /* SPDX-License-Identifier: GPL-2.0-only */ 2 2 /* 3 - * linux/include/linux/amd-pstate.h 4 - * 5 3 * Copyright (C) 2022 Advanced Micro Devices, Inc. 6 4 * 7 5 * Author: Meng Li <li.meng@amd.com> ··· 9 11 #define _LINUX_AMD_PSTATE_H 10 12 11 13 #include <linux/pm_qos.h> 12 - 13 - #define AMD_CPPC_EPP_PERFORMANCE 0x00 14 - #define AMD_CPPC_EPP_BALANCE_PERFORMANCE 0x80 15 - #define AMD_CPPC_EPP_BALANCE_POWERSAVE 0xBF 16 - #define AMD_CPPC_EPP_POWERSAVE 0xFF 17 14 18 15 /********************************************************************* 19 16 * AMD P-state INTERFACE * ··· 99 106 u32 policy; 100 107 u64 cppc_cap1_cached; 101 108 bool suspended; 102 - }; 103 - 104 - /* 105 - * enum amd_pstate_mode - driver working mode of amd pstate 106 - */ 107 - enum amd_pstate_mode { 108 - AMD_PSTATE_UNDEFINED = 0, 109 - AMD_PSTATE_DISABLE, 110 - AMD_PSTATE_PASSIVE, 111 - AMD_PSTATE_ACTIVE, 112 - AMD_PSTATE_GUIDED, 113 - AMD_PSTATE_MAX, 114 - }; 115 - 116 - static const char * const amd_pstate_mode_string[] = { 117 - [AMD_PSTATE_UNDEFINED] = "undefined", 118 - [AMD_PSTATE_DISABLE] = "disable", 119 - [AMD_PSTATE_PASSIVE] = "passive", 120 - [AMD_PSTATE_ACTIVE] = "active", 121 - [AMD_PSTATE_GUIDED] = "guided", 122 - NULL, 123 - }; 124 - 125 - struct quirk_entry { 126 - u32 nominal_freq; 127 - u32 lowest_freq; 128 109 }; 129 110 130 111 #endif /* _LINUX_AMD_PSTATE_H */
+23 -3
tools/power/cpupower/utils/helpers/amd.c
··· 41 41 unsigned res1:31; 42 42 unsigned en:1; 43 43 } pstatedef; 44 + /* since fam 1Ah: */ 45 + struct { 46 + unsigned fid:12; 47 + unsigned res1:2; 48 + unsigned vid:8; 49 + unsigned iddval:8; 50 + unsigned idddiv:2; 51 + unsigned res2:31; 52 + unsigned en:1; 53 + } pstatedef2; 44 54 unsigned long long val; 45 55 }; 46 56 47 57 static int get_did(union core_pstate pstate) 48 58 { 49 59 int t; 60 + 61 + /* Fam 1Ah onward do not use did */ 62 + if (cpupower_cpu_info.family >= 0x1A) 63 + return 0; 50 64 51 65 if (cpupower_cpu_info.caps & CPUPOWER_CAP_AMD_PSTATEDEF) 52 66 t = pstate.pstatedef.did; ··· 75 61 static int get_cof(union core_pstate pstate) 76 62 { 77 63 int t; 78 - int fid, did, cof; 64 + int fid, did, cof = 0; 79 65 80 66 did = get_did(pstate); 81 67 if (cpupower_cpu_info.caps & CPUPOWER_CAP_AMD_PSTATEDEF) { 82 - fid = pstate.pstatedef.fid; 83 - cof = 200 * fid / did; 68 + if (cpupower_cpu_info.family >= 0x1A) { 69 + fid = pstate.pstatedef2.fid; 70 + if (fid > 0x0f) 71 + cof = (fid * 5); 72 + } else { 73 + fid = pstate.pstatedef.fid; 74 + cof = 200 * fid / did; 75 + } 84 76 } else { 85 77 t = 0x10; 86 78 fid = pstate.pstate.fid;