Skip to contentSkip to conversation

x86/cpufeatures: Add feature bit RDPRU on AMD

PATCH Applied Babu Moger 2 participants 2 messages Oct 7, 2019 – Oct 8, 2019 x86

lore
Share & tools
lore

Babu Moger

author
#0 lore raw

PATCH 1/1 x86/cpufeatures: Add feature bit RDPRU on AMD

AMD Zen 2 introduces new RDPRU instruction which is used to give access to some processor registers that are typically only accessible when the privilege level is zero.

ECX is used as the implicit register to specify which register to read. RDPRU places the specified register’s value into EDX:EAX

For example, RDPRU instruction can be used to reading MPERF and APERF at user level.

Adding this to cpu feature definition, so it is visible in /proc/cpuinfo.

Details are available in AMD64 Architecture Programmer’s Manual.
https://www.amd.com/system/files/TechDocs/24594.pdf

---
 arch/x86/include/asm/cpufeatures.h |    1 +
 1 file changed, 1 insertion(+)
arch/x86/include/asm/cpufeatures.h +1 -0
index 0652d3e..5d2f1a7 100644
@@ -292,6 +292,7 @@
 #define X86_FEATURE_CLZERO		(13*32+ 0) /* CLZERO instruction */
 #define X86_FEATURE_IRPERF		(13*32+ 1) /* Instructions Retired Count */
 #define X86_FEATURE_XSAVEERPTR		(13*32+ 2) /* Always save/restore FP error pointers */
+#define X86_FEATURE_RDPRU		(13*32+ 4) /* read processor register at user level */
 #define X86_FEATURE_WBNOINVD		(13*32+ 9) /* WBNOINVD instruction */
 #define X86_FEATURE_AMD_IBPB		(13*32+12) /* "" Indirect Branch Prediction Barrier */
 #define X86_FEATURE_AMD_IBRS		(13*32+14) /* "" Indirect Branch Restricted Speculation */
merge bot Applied
#1 lore raw
The following commit has been merged into the x86/cpu branch of tip:

The following commit has been merged into the x86/cpu branch of tip:

Commit-ID:     9d40b85bb46a99bc95dad3a07787da93b0a018e9
Gitweb:        https://git.kernel.org/tip/9d40b85bb46a99bc95dad3a07787da93b0a018e9
Author:        Babu Moger <[email protected]>
AuthorDate:    Mon, 07 Oct 2019 15:48:39 -05:00
Committer:     Borislav Petkov <[email protected]>
CommitterDate: Tue, 08 Oct 2019 09:28:37 +02:00

x86/cpufeatures: Add feature bit RDPRU on AMD

AMD Zen 2 introduces a new RDPRU instruction which is used to give access to some processor registers that are typically only accessible when the privilege level is zero.

ECX is used as the implicit register to specify which register to read. RDPRU places the specified register’s value into EDX:EAX.

For example, the RDPRU instruction can be used to read MPERF and APERF at CPL > 0.

Add the feature bit so it is visible in /proc/cpuinfo.

Details are available in the AMD64 Architecture Programmer’s Manual:
https://www.amd.com/system/files/TechDocs/24594.pdf

Cc Aaron Lewis <[email protected]>
Cc Fenghua Yu <[email protected]>
Cc "H. Peter Anvin" <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Josh Poimboeuf <[email protected]>
Cc "Peter Zijlstra (Intel)" <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Thomas Hellstrom <[email protected]>
Cc x86-ml <[email protected]>
---
 arch/x86/include/asm/cpufeatures.h | 1 +
 1 file changed, 1 insertion(+)
arch/x86/include/asm/cpufeatures.h +1 -0
index 0652d3e..1db10a1 100644
@@ -292,6 +292,7 @@
 #define X86_FEATURE_CLZERO		(13*32+ 0) /* CLZERO instruction */
 #define X86_FEATURE_IRPERF		(13*32+ 1) /* Instructions Retired Count */
 #define X86_FEATURE_XSAVEERPTR		(13*32+ 2) /* Always save/restore FP error pointers */
+#define X86_FEATURE_RDPRU		(13*32+ 4) /* Read processor register at user level */
 #define X86_FEATURE_WBNOINVD		(13*32+ 9) /* WBNOINVD instruction */
 #define X86_FEATURE_AMD_IBPB		(13*32+12) /* "" Indirect Branch Prediction Barrier */
 #define X86_FEATURE_AMD_IBRS		(13*32+14) /* "" Indirect Branch Restricted Speculation */