Merge branch 'x86-topology-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
[sfrench/cifs-2.6.git] / arch / x86 / kernel / smpboot.c
index 1a19a5171949f4d6d644d3b9435a115571df0afb..f78801114ee1ce829837c5a1e3147cf119f6c1d0 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
  /*
  *     x86 SMP booting functions
  *
@@ -12,9 +13,6 @@
  *     Pentium Pro and Pentium-II/Xeon MP machines.
  *     Original development of Linux SMP code supported by Caldera.
  *
- *     This code is released under the GNU General Public License version 2 or
- *     later.
- *
  *     Fixes
  *             Felix Koop      :       NR_CPUS used properly
  *             Jose Renau      :       Handle single CPU case.
@@ -212,13 +210,19 @@ static int enable_start_cpu0;
  */
 static void notrace start_secondary(void *unused)
 {
+       unsigned long cr4 = __read_cr4();
+
        /*
         * Don't put *anything* except direct CPU state initialization
         * before cpu_init(), SMP booting is too fragile that we want to
         * limit the things done here to the most necessary things.
         */
        if (boot_cpu_has(X86_FEATURE_PCID))
-               __write_cr4(__read_cr4() | X86_CR4_PCIDE);
+               cr4 |= X86_CR4_PCIDE;
+       if (static_branch_likely(&cr_pinning))
+               cr4 |= cr4_pinned_bits;
+
+       __write_cr4(cr4);
 
 #ifdef CONFIG_X86_32
        /* switch away from the initial page table */