Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'x86-urgent-2024-05-25' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull x86 fixes from Ingo Molnar:

- Fix regressions of the new x86 CPU VFM (vendor/family/model)
enumeration/matching code

- Fix crash kernel detection on buggy firmware with
non-compliant ACPI MADT tables

- Address Kconfig warning

* tag 'x86-urgent-2024-05-25' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
x86/cpu: Fix x86_match_cpu() to match just X86_VENDOR_INTEL
crypto: x86/aes-xts - switch to new Intel CPU model defines
x86/topology: Handle bogus ACPI tables correctly
x86/kconfig: Select ARCH_WANT_FRAME_POINTERS again when UNWINDER_FRAME_POINTER=y

+68 -19
+1 -4
arch/x86/Kconfig.debug
··· 248 248 249 249 config UNWINDER_FRAME_POINTER 250 250 bool "Frame pointer unwinder" 251 + select ARCH_WANT_FRAME_POINTERS 251 252 select FRAME_POINTER 252 253 help 253 254 This option enables the frame pointer unwinder for unwinding kernel ··· 272 271 overhead. 273 272 274 273 endchoice 275 - 276 - config FRAME_POINTER 277 - depends on !UNWINDER_ORC && !UNWINDER_GUESS 278 - bool
+8 -8
arch/x86/crypto/aesni-intel_glue.c
··· 1223 1223 * implementation with ymm registers (256-bit vectors) will be used instead. 1224 1224 */ 1225 1225 static const struct x86_cpu_id zmm_exclusion_list[] = { 1226 - { .vendor = X86_VENDOR_INTEL, .family = 6, .model = INTEL_FAM6_SKYLAKE_X }, 1227 - { .vendor = X86_VENDOR_INTEL, .family = 6, .model = INTEL_FAM6_ICELAKE_X }, 1228 - { .vendor = X86_VENDOR_INTEL, .family = 6, .model = INTEL_FAM6_ICELAKE_D }, 1229 - { .vendor = X86_VENDOR_INTEL, .family = 6, .model = INTEL_FAM6_ICELAKE }, 1230 - { .vendor = X86_VENDOR_INTEL, .family = 6, .model = INTEL_FAM6_ICELAKE_L }, 1231 - { .vendor = X86_VENDOR_INTEL, .family = 6, .model = INTEL_FAM6_ICELAKE_NNPI }, 1232 - { .vendor = X86_VENDOR_INTEL, .family = 6, .model = INTEL_FAM6_TIGERLAKE_L }, 1233 - { .vendor = X86_VENDOR_INTEL, .family = 6, .model = INTEL_FAM6_TIGERLAKE }, 1226 + X86_MATCH_VFM(INTEL_SKYLAKE_X, 0), 1227 + X86_MATCH_VFM(INTEL_ICELAKE_X, 0), 1228 + X86_MATCH_VFM(INTEL_ICELAKE_D, 0), 1229 + X86_MATCH_VFM(INTEL_ICELAKE, 0), 1230 + X86_MATCH_VFM(INTEL_ICELAKE_L, 0), 1231 + X86_MATCH_VFM(INTEL_ICELAKE_NNPI, 0), 1232 + X86_MATCH_VFM(INTEL_TIGERLAKE_L, 0), 1233 + X86_MATCH_VFM(INTEL_TIGERLAKE, 0), 1234 1234 /* Allow Rocket Lake and later, and Sapphire Rapids and later. */ 1235 1235 /* Also allow AMD CPUs (starting with Zen 4, the first with AVX-512). */ 1236 1236 {},
+5
arch/x86/include/asm/cpu_device_id.h
··· 53 53 #define X86_CENTAUR_FAM6_C7_D 0xd 54 54 #define X86_CENTAUR_FAM6_NANO 0xf 55 55 56 + /* x86_cpu_id::flags */ 57 + #define X86_CPU_ID_FLAG_ENTRY_VALID BIT(0) 58 + 56 59 #define X86_STEPPINGS(mins, maxs) GENMASK(maxs, mins) 57 60 /** 58 61 * X86_MATCH_VENDOR_FAM_MODEL_STEPPINGS_FEATURE - Base macro for CPU matching ··· 82 79 .model = _model, \ 83 80 .steppings = _steppings, \ 84 81 .feature = _feature, \ 82 + .flags = X86_CPU_ID_FLAG_ENTRY_VALID, \ 85 83 .driver_data = (unsigned long) _data \ 86 84 } 87 85 ··· 93 89 .model = _model, \ 94 90 .steppings = _steppings, \ 95 91 .feature = _feature, \ 92 + .flags = X86_CPU_ID_FLAG_ENTRY_VALID, \ 96 93 .driver_data = (unsigned long) _data \ 97 94 } 98 95
+1 -3
arch/x86/kernel/cpu/match.c
··· 38 38 const struct x86_cpu_id *m; 39 39 struct cpuinfo_x86 *c = &boot_cpu_data; 40 40 41 - for (m = match; 42 - m->vendor | m->family | m->model | m->steppings | m->feature; 43 - m++) { 41 + for (m = match; m->flags & X86_CPU_ID_FLAG_ENTRY_VALID; m++) { 44 42 if (m->vendor != X86_VENDOR_ANY && c->x86_vendor != m->vendor) 45 43 continue; 46 44 if (m->family != X86_FAMILY_ANY && c->x86 != m->family)
+51 -4
arch/x86/kernel/cpu/topology.c
··· 128 128 129 129 static __init bool check_for_real_bsp(u32 apic_id) 130 130 { 131 + bool is_bsp = false, has_apic_base = boot_cpu_data.x86 >= 6; 132 + u64 msr; 133 + 131 134 /* 132 135 * There is no real good way to detect whether this a kdump() 133 136 * kernel, but except on the Voyager SMP monstrosity which is not ··· 147 144 if (topo_info.real_bsp_apic_id != BAD_APICID) 148 145 return false; 149 146 150 - if (apic_id == topo_info.boot_cpu_apic_id) { 151 - topo_info.real_bsp_apic_id = apic_id; 152 - return false; 147 + /* 148 + * Check whether the enumeration order is broken by evaluating the 149 + * BSP bit in the APICBASE MSR. If the CPU does not have the 150 + * APICBASE MSR then the BSP detection is not possible and the 151 + * kernel must rely on the firmware enumeration order. 152 + */ 153 + if (has_apic_base) { 154 + rdmsrl(MSR_IA32_APICBASE, msr); 155 + is_bsp = !!(msr & MSR_IA32_APICBASE_BSP); 153 156 } 154 157 155 - pr_warn("Boot CPU APIC ID not the first enumerated APIC ID: %x > %x\n", 158 + if (apic_id == topo_info.boot_cpu_apic_id) { 159 + /* 160 + * If the boot CPU has the APIC BSP bit set then the 161 + * firmware enumeration is agreeing. If the CPU does not 162 + * have the APICBASE MSR then the only choice is to trust 163 + * the enumeration order. 164 + */ 165 + if (is_bsp || !has_apic_base) { 166 + topo_info.real_bsp_apic_id = apic_id; 167 + return false; 168 + } 169 + /* 170 + * If the boot APIC is enumerated first, but the APICBASE 171 + * MSR does not have the BSP bit set, then there is no way 172 + * to discover the real BSP here. Assume a crash kernel and 173 + * limit the number of CPUs to 1 as an INIT to the real BSP 174 + * would reset the machine. 175 + */ 176 + pr_warn("Enumerated BSP APIC %x is not marked in APICBASE MSR\n", apic_id); 177 + pr_warn("Assuming crash kernel. Limiting to one CPU to prevent machine INIT\n"); 178 + set_nr_cpu_ids(1); 179 + goto fwbug; 180 + } 181 + 182 + pr_warn("Boot CPU APIC ID not the first enumerated APIC ID: %x != %x\n", 156 183 topo_info.boot_cpu_apic_id, apic_id); 184 + 185 + if (is_bsp) { 186 + /* 187 + * The boot CPU has the APIC BSP bit set. Use it and complain 188 + * about the broken firmware enumeration. 189 + */ 190 + topo_info.real_bsp_apic_id = topo_info.boot_cpu_apic_id; 191 + goto fwbug; 192 + } 193 + 157 194 pr_warn("Crash kernel detected. Disabling real BSP to prevent machine INIT\n"); 158 195 159 196 topo_info.real_bsp_apic_id = apic_id; 160 197 return true; 198 + 199 + fwbug: 200 + pr_warn(FW_BUG "APIC enumeration order not specification compliant\n"); 201 + return false; 161 202 } 162 203 163 204 static unsigned int topo_unit_count(u32 lvlid, enum x86_topology_domains at_level,
+2
include/linux/mod_devicetable.h
··· 690 690 __u16 model; 691 691 __u16 steppings; 692 692 __u16 feature; /* bit index */ 693 + /* Solely for kernel-internal use: DO NOT EXPORT to userspace! */ 694 + __u16 flags; 693 695 kernel_ulong_t driver_data; 694 696 }; 695 697