x86/CPU/AMD: Set the CPB bit unconditionally on F17h
authorJiaxun Yang <jiaxun.yang@flygoat.com>
Tue, 20 Nov 2018 03:00:18 +0000 (11:00 +0800)
committerBorislav Petkov <bp@suse.de>
Fri, 18 Jan 2019 15:44:03 +0000 (16:44 +0100)
Some F17h models do not have CPB set in CPUID even though the CPU
supports it. Set the feature bit unconditionally on all F17h.

 [ bp: Rewrite commit message and patch. ]

Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Acked-by: Tom Lendacky <thomas.lendacky@amd.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Sherry Hurwitz <sherry.hurwitz@amd.com>
Cc: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: x86-ml <x86@kernel.org>
Link: https://lkml.kernel.org/r/20181120030018.5185-1-jiaxun.yang@flygoat.com
arch/x86/kernel/cpu/amd.c

index 69f6bbb..01004bf 100644 (file)
@@ -819,11 +819,9 @@ 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.
-        */
-       if (c->x86_model <= 1 && c->x86_stepping <= 1)
+
+       /* Fix erratum 1076: CPB feature bit not being set in CPUID. */
+       if (!cpu_has(c, X86_FEATURE_CPB))
                set_cpu_cap(c, X86_FEATURE_CPB);
 }