diff options
author | Andrew Cooper <andrew.cooper3@citrix.com> | 2021-05-14 15:59:20 +0200 |
---|---|---|
committer | Borislav Petkov <bp@suse.de> | 2021-06-01 21:10:33 +0200 |
commit | cbcddaa33d7e11a053cb80a4a635c023b4f8b906 (patch) | |
tree | 9bd52ba379d2970f2d3045cf9c3bf0e82226f57f /arch/x86/kernel/cpu/amd.c | |
parent | x86/cstate: Allow ACPI C1 FFH MWAIT use on Hygon systems (diff) | |
download | linux-cbcddaa33d7e11a053cb80a4a635c023b4f8b906.tar.xz linux-cbcddaa33d7e11a053cb80a4a635c023b4f8b906.zip |
perf/x86/rapl: Use CPUID bit on AMD and Hygon parts
AMD and Hygon CPUs have a CPUID bit for RAPL. Drop the fam17h suffix as
it is stale already.
Make use of this instead of a model check to work more nicely in virtual
environments where RAPL typically isn't available.
[ bp: drop the ../cpu/powerflags.c hunk which is superfluous as the
"rapl" bit name appears already in flags. ]
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Link: https://lkml.kernel.org/r/20210514135920.16093-1-andrew.cooper3@citrix.com
Diffstat (limited to 'arch/x86/kernel/cpu/amd.c')
-rw-r--r-- | arch/x86/kernel/cpu/amd.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c index 2d11384dc9ab..da57b96fafbe 100644 --- a/arch/x86/kernel/cpu/amd.c +++ b/arch/x86/kernel/cpu/amd.c @@ -646,6 +646,10 @@ static void early_init_amd(struct cpuinfo_x86 *c) if (c->x86_power & BIT(12)) set_cpu_cap(c, X86_FEATURE_ACC_POWER); + /* Bit 14 indicates the Runtime Average Power Limit interface. */ + if (c->x86_power & BIT(14)) + set_cpu_cap(c, X86_FEATURE_RAPL); + #ifdef CONFIG_X86_64 set_cpu_cap(c, X86_FEATURE_SYSCALL32); #else |