From: Thomas Gleixner Date: Tue, 5 Jun 2018 22:57:38 +0000 (+0200) Subject: x86/cpu/AMD: Evaluate smp_num_siblings early X-Git-Tag: v4.1.12-124.31.3~651 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=a4813e96d68c4617601be2f4eadfaea9b9ebbe30;p=users%2Fjedix%2Flinux-maple.git x86/cpu/AMD: Evaluate smp_num_siblings early To support force disabling of SMT it's required to know the number of thread siblings early. amd_get_topology() cannot be called before the APIC driver is selected, so split out the part which initializes smp_num_siblings and invoke it from amd_early_init(). Signed-off-by: Thomas Gleixner Acked-by: Ingo Molnar Orabug: 28220674 CVE: CVE-2018-3620 (cherry picked from commit 1e1d7e25fd759eddf96d8ab39d0a90a1979b2d8c) Signed-off-by: Mihai Carabas Reviewed-by: Darren Kenny Reviewed-by: Boris Ostrovsky Conflicts: arch/x86/kernel/cpu/amd.c Contextual --- diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c index eaa846fa2733..199809d443a8 100644 --- a/arch/x86/kernel/cpu/amd.c +++ b/arch/x86/kernel/cpu/amd.c @@ -283,6 +283,16 @@ static int nearby_node(int apicid) } #endif +static void amd_get_topology_early(struct cpuinfo_x86 *c) +{ + if (boot_cpu_has(X86_FEATURE_TOPOEXT)) { + u32 eax, ebx, ecx, edx; + + cpuid(0x8000001e, &eax, &ebx, &ecx, &edx); + smp_num_siblings = ((ebx >> 8) & 0xff) + 1; + } +} + /* * Fixup core topology information for * (1) AMD multi-node processors @@ -560,6 +570,8 @@ static void early_init_amd(struct cpuinfo_x86 *c) /* F16h erratum 793, CVE-2013-6885 */ if (c->x86 == 0x16 && c->x86_model <= 0xf) msr_set_bit(MSR_AMD64_LS_CFG, 15); + + amd_get_topology_early(c); } static const int amd_erratum_383[];