Merge tag 'x86_urgent_for_v5.16_rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull x86 fixes from Borislav Petkov:

- Add the model number of a new, Raptor Lake CPU, to intel-family.h

- Do not log spurious corrected MCEs on SKL too, due to an erratum

- Clarify the path of paravirt ops patches upstream

- Add an optimization to avoid writing out AMX components to sigframes
when former are in init state

* tag 'x86_urgent_for_v5.16_rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
x86/cpu: Add Raptor Lake to Intel family
x86/mce: Add errata workaround for Skylake SKX37
MAINTAINERS: Add some information to PARAVIRT_OPS entry
x86/fpu: Optimize out sigframe xfeatures when in init state

+71 -4
+9
Documentation/x86/xstate.rst
··· 63 the handler allocates a larger xstate buffer for the task so the large 64 state can be context switched. In the unlikely cases that the allocation 65 fails, the kernel sends SIGSEGV.
··· 63 the handler allocates a larger xstate buffer for the task so the large 64 state can be context switched. In the unlikely cases that the allocation 65 fails, the kernel sends SIGSEGV. 66 + 67 + Dynamic features in signal frames 68 + --------------------------------- 69 + 70 + Dynamcally enabled features are not written to the signal frame upon signal 71 + entry if the feature is in its initial configuration. This differs from 72 + non-dynamic features which are always written regardless of their 73 + configuration. Signal handlers can examine the XSAVE buffer's XSTATE_BV 74 + field to determine if a features was written.
+2
MAINTAINERS
··· 14412 M: Deep Shah <sdeep@vmware.com> 14413 M: "VMware, Inc." <pv-drivers@vmware.com> 14414 L: virtualization@lists.linux-foundation.org 14415 S: Supported 14416 F: Documentation/virt/paravirt_ops.rst 14417 F: arch/*/include/asm/paravirt*.h 14418 F: arch/*/kernel/paravirt*
··· 14412 M: Deep Shah <sdeep@vmware.com> 14413 M: "VMware, Inc." <pv-drivers@vmware.com> 14414 L: virtualization@lists.linux-foundation.org 14415 + L: x86@kernel.org 14416 S: Supported 14417 + T: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86/core 14418 F: Documentation/virt/paravirt_ops.rst 14419 F: arch/*/include/asm/paravirt*.h 14420 F: arch/*/kernel/paravirt*
+12
arch/x86/include/asm/fpu/xcr.h
··· 3 #define _ASM_X86_FPU_XCR_H 4 5 #define XCR_XFEATURE_ENABLED_MASK 0x00000000 6 7 static inline u64 xgetbv(u32 index) 8 { ··· 19 u32 edx = value >> 32; 20 21 asm volatile("xsetbv" :: "a" (eax), "d" (edx), "c" (index)); 22 } 23 24 #endif /* _ASM_X86_FPU_XCR_H */
··· 3 #define _ASM_X86_FPU_XCR_H 4 5 #define XCR_XFEATURE_ENABLED_MASK 0x00000000 6 + #define XCR_XFEATURE_IN_USE_MASK 0x00000001 7 8 static inline u64 xgetbv(u32 index) 9 { ··· 18 u32 edx = value >> 32; 19 20 asm volatile("xsetbv" :: "a" (eax), "d" (edx), "c" (index)); 21 + } 22 + 23 + /* 24 + * Return a mask of xfeatures which are currently being tracked 25 + * by the processor as being in the initial configuration. 26 + * 27 + * Callers should check X86_FEATURE_XGETBV1. 28 + */ 29 + static inline u64 xfeatures_in_use(void) 30 + { 31 + return xgetbv(XCR_XFEATURE_IN_USE_MASK); 32 } 33 34 #endif /* _ASM_X86_FPU_XCR_H */
+7
arch/x86/include/asm/fpu/xstate.h
··· 92 #define XFEATURE_MASK_FPSTATE (XFEATURE_MASK_USER_RESTORE | \ 93 XFEATURE_MASK_SUPERVISOR_SUPPORTED) 94 95 extern u64 xstate_fx_sw_bytes[USER_XSTATE_FX_SW_WORDS]; 96 97 extern void __init update_regset_xstate_info(unsigned int size,
··· 92 #define XFEATURE_MASK_FPSTATE (XFEATURE_MASK_USER_RESTORE | \ 93 XFEATURE_MASK_SUPERVISOR_SUPPORTED) 94 95 + /* 96 + * Features in this mask have space allocated in the signal frame, but may not 97 + * have that space initialized when the feature is in its init state. 98 + */ 99 + #define XFEATURE_MASK_SIGFRAME_INITOPT (XFEATURE_MASK_XTILE | \ 100 + XFEATURE_MASK_USER_DYNAMIC) 101 + 102 extern u64 xstate_fx_sw_bytes[USER_XSTATE_FX_SW_WORDS]; 103 104 extern void __init update_regset_xstate_info(unsigned int size,
+2
arch/x86/include/asm/intel-family.h
··· 108 #define INTEL_FAM6_ALDERLAKE 0x97 /* Golden Cove / Gracemont */ 109 #define INTEL_FAM6_ALDERLAKE_L 0x9A /* Golden Cove / Gracemont */ 110 111 /* "Small Core" Processors (Atom) */ 112 113 #define INTEL_FAM6_ATOM_BONNELL 0x1C /* Diamondville, Pineview */
··· 108 #define INTEL_FAM6_ALDERLAKE 0x97 /* Golden Cove / Gracemont */ 109 #define INTEL_FAM6_ALDERLAKE_L 0x9A /* Golden Cove / Gracemont */ 110 111 + #define INTEL_FAM6_RAPTOR_LAKE 0xB7 112 + 113 /* "Small Core" Processors (Atom) */ 114 115 #define INTEL_FAM6_ATOM_BONNELL 0x1C /* Diamondville, Pineview */
+1
arch/x86/kernel/cpu/cpuid-deps.c
··· 76 { X86_FEATURE_SGX1, X86_FEATURE_SGX }, 77 { X86_FEATURE_SGX2, X86_FEATURE_SGX1 }, 78 { X86_FEATURE_XFD, X86_FEATURE_XSAVES }, 79 { X86_FEATURE_AMX_TILE, X86_FEATURE_XFD }, 80 {} 81 };
··· 76 { X86_FEATURE_SGX1, X86_FEATURE_SGX }, 77 { X86_FEATURE_SGX2, X86_FEATURE_SGX1 }, 78 { X86_FEATURE_XFD, X86_FEATURE_XSAVES }, 79 + { X86_FEATURE_XFD, X86_FEATURE_XGETBV1 }, 80 { X86_FEATURE_AMX_TILE, X86_FEATURE_XFD }, 81 {} 82 };
+3 -2
arch/x86/kernel/cpu/mce/intel.c
··· 547 { 548 struct cpuinfo_x86 *c = &boot_cpu_data; 549 550 - /* MCE errata HSD131, HSM142, HSW131, BDM48, and HSM142 */ 551 if ((c->x86 == 6) && 552 ((c->x86_model == INTEL_FAM6_HASWELL) || 553 (c->x86_model == INTEL_FAM6_HASWELL_L) || 554 (c->x86_model == INTEL_FAM6_BROADWELL) || 555 - (c->x86_model == INTEL_FAM6_HASWELL_G)) && 556 (m->bank == 0) && 557 ((m->status & 0xa0000000ffffffff) == 0x80000000000f0005)) 558 return true;
··· 547 { 548 struct cpuinfo_x86 *c = &boot_cpu_data; 549 550 + /* MCE errata HSD131, HSM142, HSW131, BDM48, HSM142 and SKX37 */ 551 if ((c->x86 == 6) && 552 ((c->x86_model == INTEL_FAM6_HASWELL) || 553 (c->x86_model == INTEL_FAM6_HASWELL_L) || 554 (c->x86_model == INTEL_FAM6_BROADWELL) || 555 + (c->x86_model == INTEL_FAM6_HASWELL_G) || 556 + (c->x86_model == INTEL_FAM6_SKYLAKE_X)) && 557 (m->bank == 0) && 558 ((m->status & 0xa0000000ffffffff) == 0x80000000000f0005)) 559 return true;
+35 -2
arch/x86/kernel/fpu/xstate.h
··· 4 5 #include <asm/cpufeature.h> 6 #include <asm/fpu/xstate.h> 7 8 #ifdef CONFIG_X86_64 9 DECLARE_PER_CPU(u64, xfd_state); ··· 200 } 201 202 /* 203 * Save xstate to user space xsave area. 204 * 205 * We don't use modified optimization because xrstor/xrstors might track ··· 247 */ 248 struct fpstate *fpstate = current->thread.fpu.fpstate; 249 u64 mask = fpstate->user_xfeatures; 250 - u32 lmask = mask; 251 - u32 hmask = mask >> 32; 252 int err; 253 254 xfd_validate_state(fpstate, mask, false); 255 256 stac();
··· 4 5 #include <asm/cpufeature.h> 6 #include <asm/fpu/xstate.h> 7 + #include <asm/fpu/xcr.h> 8 9 #ifdef CONFIG_X86_64 10 DECLARE_PER_CPU(u64, xfd_state); ··· 199 } 200 201 /* 202 + * XSAVE itself always writes all requested xfeatures. Removing features 203 + * from the request bitmap reduces the features which are written. 204 + * Generate a mask of features which must be written to a sigframe. The 205 + * unset features can be optimized away and not written. 206 + * 207 + * This optimization is user-visible. Only use for states where 208 + * uninitialized sigframe contents are tolerable, like dynamic features. 209 + * 210 + * Users of buffers produced with this optimization must check XSTATE_BV 211 + * to determine which features have been optimized out. 212 + */ 213 + static inline u64 xfeatures_need_sigframe_write(void) 214 + { 215 + u64 xfeaures_to_write; 216 + 217 + /* In-use features must be written: */ 218 + xfeaures_to_write = xfeatures_in_use(); 219 + 220 + /* Also write all non-optimizable sigframe features: */ 221 + xfeaures_to_write |= XFEATURE_MASK_USER_SUPPORTED & 222 + ~XFEATURE_MASK_SIGFRAME_INITOPT; 223 + 224 + return xfeaures_to_write; 225 + } 226 + 227 + /* 228 * Save xstate to user space xsave area. 229 * 230 * We don't use modified optimization because xrstor/xrstors might track ··· 220 */ 221 struct fpstate *fpstate = current->thread.fpu.fpstate; 222 u64 mask = fpstate->user_xfeatures; 223 + u32 lmask; 224 + u32 hmask; 225 int err; 226 227 + /* Optimize away writing unnecessary xfeatures: */ 228 + if (fpu_state_size_dynamic()) 229 + mask &= xfeatures_need_sigframe_write(); 230 + 231 + lmask = mask; 232 + hmask = mask >> 32; 233 xfd_validate_state(fpstate, mask, false); 234 235 stac();