x86/cpufeatures: Add FEATURE_ZEN
authorThomas Gleixner <tglx@linutronix.de>
Thu, 10 May 2018 14:26:00 +0000 (16:26 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 22 May 2018 14:58:03 +0000 (16:58 +0200)
commit d1035d971829dcf80e8686ccde26f94b0a069472 upstream

Add a ZEN feature bit so family-dependent static_cpu_has() optimizations
can be built for ZEN.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Borislav Petkov <bp@suse.de>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/x86/include/asm/cpufeatures.h
arch/x86/kernel/cpu/amd.c

index d071767ed80db57d641efb36f45bd580255a7b27..ec87b8caa9b921e04735dffae880dfa8ae4490b5 100644 (file)
 #define X86_FEATURE_IBRS       ( 7*32+25) /* Indirect Branch Restricted Speculation */
 #define X86_FEATURE_IBPB       ( 7*32+26) /* Indirect Branch Prediction Barrier */
 #define X86_FEATURE_STIBP      ( 7*32+27) /* Single Thread Indirect Branch Predictors */
+#define X86_FEATURE_ZEN                ( 7*32+28) /* "" CPU is AMD family 0x17 (Zen) */
+
 
 /* Virtualization flags: Linux defined, word 8 */
 #define X86_FEATURE_TPR_SHADOW  ( 8*32+ 0) /* Intel TPR Shadow */
index 21367b51c2f30c714118951b3dfae0d6acd5880e..4c2be99fa0fb700324f9b59d4f9ac0a721c4552e 100644 (file)
@@ -751,6 +751,7 @@ static void init_amd_bd(struct cpuinfo_x86 *c)
 
 static void init_amd_zn(struct cpuinfo_x86 *c)
 {
+       set_cpu_cap(c, X86_FEATURE_ZEN);
        /*
         * Fix erratum 1076: CPB feature bit not being set in CPUID. It affects
         * all up to and including B1.