From: Huang Rui <ray.huang@amd.com>
To: "Borislav Petkov" <bp@suse.de>,
"Peter Zijlstra" <peterz@infradead.org>,
"Ingo Molnar" <mingo@kernel.org>,
"Andy Lutomirski" <luto@amacapital.net>,
"Thomas Gleixner" <tglx@linutronix.de>,
"Robert Richter" <rric@kernel.org>,
"Jacob Shin" <jacob.w.shin@gmail.com>,
"John Stultz" <john.stultz@linaro.org>,
"Frédéric Weisbecker" <fweisbec@gmail.com>
Cc: <linux-kernel@vger.kernel.org>, <spg_linux_kernel@amd.com>,
<x86@kernel.org>, Guenter Roeck <linux@roeck-us.net>,
Andreas Herrmann <herrmann.der.user@googlemail.com>,
Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>,
Aravind Gopalakrishnan <Aravind.Gopalakrishnan@amd.com>,
Borislav Petkov <bp@alien8.de>,
"Fengguang Wu" <fengguang.wu@intel.com>,
Aaron Lu <aaron.lu@intel.com>, Huang Rui <ray.huang@amd.com>
Subject: [PATCH v2 3/5] x86/cpufeature: add AMD Accumulated Power Mechanism feature flag
Date: Thu, 14 Jan 2016 10:50:06 +0800 [thread overview]
Message-ID: <1452739808-11871-4-git-send-email-ray.huang@amd.com> (raw)
In-Reply-To: <1452739808-11871-1-git-send-email-ray.huang@amd.com>
AMD CPU family 15h model 0x60 introduces accumulated power mechanism.
It is used to report the processor power consumption and indicated by
CPUID Fn8000_0007_EDX[12].
Signed-off-by: Huang Rui <ray.huang@amd.com>
---
arch/x86/include/asm/cpufeature.h | 2 +-
arch/x86/kernel/cpu/amd.c | 4 ++++
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/arch/x86/include/asm/cpufeature.h b/arch/x86/include/asm/cpufeature.h
index f7ba9fb..0adce8f 100644
--- a/arch/x86/include/asm/cpufeature.h
+++ b/arch/x86/include/asm/cpufeature.h
@@ -85,7 +85,7 @@
#define X86_FEATURE_P4 ( 3*32+ 7) /* "" P4 */
#define X86_FEATURE_CONSTANT_TSC ( 3*32+ 8) /* TSC ticks at a constant rate */
#define X86_FEATURE_UP ( 3*32+ 9) /* smp kernel running on up */
-/* free, was #define X86_FEATURE_FXSAVE_LEAK ( 3*32+10) * "" FXSAVE leaks FOP/FIP/FOP */
+#define X86_FEATURE_ACC_POWER ( 3*32+10) /* AMD Accumulated Power Mechanism */
#define X86_FEATURE_ARCH_PERFMON ( 3*32+11) /* Intel Architectural PerfMon */
#define X86_FEATURE_PEBS ( 3*32+12) /* Precise-Event Based Sampling */
#define X86_FEATURE_BTS ( 3*32+13) /* Branch Trace Store */
diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
index d6e320f..97d4ce2 100644
--- a/arch/x86/kernel/cpu/amd.c
+++ b/arch/x86/kernel/cpu/amd.c
@@ -559,6 +559,10 @@ static void early_init_amd(struct cpuinfo_x86 *c)
set_sched_clock_stable();
}
+ /* Bit 12 of 8000_0007 edx is accumulated power mechanism. */
+ if (c->x86_power & BIT(12))
+ set_cpu_cap(c, X86_FEATURE_ACC_POWER);
+
#ifdef CONFIG_X86_64
set_cpu_cap(c, X86_FEATURE_SYSCALL32);
#else
--
1.9.1
next prev parent reply other threads:[~2016-01-14 2:52 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-14 2:50 [PATCH v2 0/5] perf/x86/power: Introduce AMD accumlated power reporting mechanism Huang Rui
2016-01-14 2:50 ` [PATCH v2 1/5] x86/amd: move nodes_per_socket into bsp_init_amd Huang Rui
2016-03-21 9:54 ` [tip:perf/urgent] perf/x86/amd: Move nodes_per_socket into bsp_init_amd() tip-bot for Huang Rui
2016-01-14 2:50 ` [PATCH v2 2/5] x86/amd: add accessor for number of cores per compute unit Huang Rui
2016-01-14 2:50 ` Huang Rui [this message]
2016-03-21 9:55 ` [tip:perf/urgent] x86/cpufeature, perf/x86: Add AMD Accumulated Power Mechanism feature flag tip-bot for Huang Rui
2016-01-14 2:50 ` [PATCH v2 4/5] perf/x86: Move events_sysfs_show outside CPU_SUP_INTEL Huang Rui
2016-01-14 2:50 ` [PATCH v2 5/5] perf/x86/amd/power: Add AMD accumulated power reporting mechanism Huang Rui
2016-01-19 12:12 ` Peter Zijlstra
2016-01-20 4:48 ` Huang Rui
2016-01-20 9:22 ` Peter Zijlstra
2016-01-21 7:04 ` Huang Rui
2016-01-21 9:02 ` Peter Zijlstra
2016-01-21 14:42 ` Huang Rui
2016-01-21 15:10 ` Peter Zijlstra
2016-01-21 15:24 ` Huang Rui
2016-01-21 15:51 ` Peter Zijlstra
2016-01-21 16:59 ` Borislav Petkov
2016-01-22 8:04 ` Huang Rui
2016-01-22 17:51 ` Borislav Petkov
2016-01-14 6:01 ` [PATCH v2 0/5] perf/x86/power: Introduce AMD accumlated " Borislav Petkov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1452739808-11871-4-git-send-email-ray.huang@amd.com \
--to=ray.huang@amd.com \
--cc=Aravind.Gopalakrishnan@amd.com \
--cc=aaron.lu@intel.com \
--cc=bp@alien8.de \
--cc=bp@suse.de \
--cc=fengguang.wu@intel.com \
--cc=fweisbec@gmail.com \
--cc=herrmann.der.user@googlemail.com \
--cc=jacob.w.shin@gmail.com \
--cc=john.stultz@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=luto@amacapital.net \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=rric@kernel.org \
--cc=spg_linux_kernel@amd.com \
--cc=suravee.suthikulpanit@amd.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome