if (have_cpuid_p()) {
                cpu_detect(c);
                get_cpu_vendor(c);
+               intel_unlock_cpuid_leafs(c);
                get_cpu_cap(c);
                setup_force_cpu_cap(X86_FEATURE_CPUID);
                get_cpu_address_sizes(c);
        cpu_detect(c);
 
        get_cpu_vendor(c);
-
+       intel_unlock_cpuid_leafs(c);
        get_cpu_cap(c);
 
        get_cpu_address_sizes(c);
 
 
 extern void __init tsx_init(void);
 void tsx_ap_init(void);
+void intel_unlock_cpuid_leafs(struct cpuinfo_x86 *c);
 #else
 static inline void tsx_init(void) { }
 static inline void tsx_ap_init(void) { }
+static inline void intel_unlock_cpuid_leafs(struct cpuinfo_x86 *c) { }
 #endif /* CONFIG_CPU_SUP_INTEL */
 
 extern void init_spectral_chicken(struct cpuinfo_x86 *c);
 
        c->x86_phys_bits -= keyid_bits;
 }
 
+void intel_unlock_cpuid_leafs(struct cpuinfo_x86 *c)
+{
+       if (boot_cpu_data.x86_vendor != X86_VENDOR_INTEL)
+               return;
+
+       if (c->x86 < 6 || (c->x86 == 6 && c->x86_model < 0xd))
+               return;
+
+       /*
+        * The BIOS can have limited CPUID to leaf 2, which breaks feature
+        * enumeration. Unlock it and update the maximum leaf info.
+        */
+       if (msr_clear_bit(MSR_IA32_MISC_ENABLE, MSR_IA32_MISC_ENABLE_LIMIT_CPUID_BIT) > 0)
+               c->cpuid_level = cpuid_eax(0);
+}
+
 static void early_init_intel(struct cpuinfo_x86 *c)
 {
        u64 misc_enable;
 
-       /* Unmask CPUID levels if masked: */
-       if (c->x86 > 6 || (c->x86 == 6 && c->x86_model >= 0xd)) {
-               if (msr_clear_bit(MSR_IA32_MISC_ENABLE,
-                                 MSR_IA32_MISC_ENABLE_LIMIT_CPUID_BIT) > 0) {
-                       c->cpuid_level = cpuid_eax(0);
-                       get_cpu_cap(c);
-               }
-       }
-
        if ((c->x86 == 0xf && c->x86_model >= 0x03) ||
                (c->x86 == 0x6 && c->x86_model >= 0x0e))
                set_cpu_cap(c, X86_FEATURE_CONSTANT_TSC);