Skip to content

Commit a25bbc2

Browse files
committed
Merge branches 'x86-cpu-for-linus' and 'x86-fpu-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 cpu and fpu updates from Ingo Molnar: - math-emu fixes - CPUID updates - sanity-check RDRAND output to see whether the CPU at least pretends to produce random data - various unaligned-access across cachelines fixes in preparation of hardware level split-lock detection - fix MAXSMP constraints to not allow !CPUMASK_OFFSTACK kernels with larger than 512 NR_CPUS - misc FPU related cleanups * 'x86-cpu-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86/cpu: Align the x86_capability array to size of unsigned long x86/cpu: Align cpu_caps_cleared and cpu_caps_set to unsigned long x86/umip: Make the comments vendor-agnostic x86/Kconfig: Rename UMIP config parameter x86/Kconfig: Enforce limit of 512 CPUs with MAXSMP and no CPUMASK_OFFSTACK x86/cpufeatures: Add feature bit RDPRU on AMD x86/math-emu: Limit MATH_EMULATION to 486SX compatibles x86/math-emu: Check __copy_from_user() result x86/rdrand: Sanity-check RDRAND output * 'x86-fpu-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86/fpu: Use XFEATURE_FP/SSE enum values instead of hardcoded numbers x86/fpu: Shrink space allocated for xstate_comp_offsets x86/fpu: Update stale variable name in comment
3 parents 85fbf15 + db8c33f + 446e693 commit a25bbc2

File tree

16 files changed

+95
-49
lines changed

16 files changed

+95
-49
lines changed

arch/x86/Kconfig

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -970,8 +970,8 @@ config NR_CPUS_RANGE_END
970970
config NR_CPUS_RANGE_END
971971
int
972972
depends on X86_64
973-
default 8192 if SMP && ( MAXSMP || CPUMASK_OFFSTACK)
974-
default 512 if SMP && (!MAXSMP && !CPUMASK_OFFSTACK)
973+
default 8192 if SMP && CPUMASK_OFFSTACK
974+
default 512 if SMP && !CPUMASK_OFFSTACK
975975
default 1 if !SMP
976976

977977
config NR_CPUS_DEFAULT
@@ -1721,7 +1721,7 @@ config X86_RESERVE_LOW
17211721
config MATH_EMULATION
17221722
bool
17231723
depends on MODIFY_LDT_SYSCALL
1724-
prompt "Math emulation" if X86_32
1724+
prompt "Math emulation" if X86_32 && (M486SX || MELAN)
17251725
---help---
17261726
Linux can emulate a math coprocessor (used for floating point
17271727
operations) if you don't have one. 486DX and Pentium processors have
@@ -1850,16 +1850,16 @@ config X86_SMAP
18501850

18511851
If unsure, say Y.
18521852

1853-
config X86_INTEL_UMIP
1853+
config X86_UMIP
18541854
def_bool y
1855-
depends on CPU_SUP_INTEL
1856-
prompt "Intel User Mode Instruction Prevention" if EXPERT
1855+
depends on CPU_SUP_INTEL || CPU_SUP_AMD
1856+
prompt "User Mode Instruction Prevention" if EXPERT
18571857
---help---
1858-
The User Mode Instruction Prevention (UMIP) is a security
1859-
feature in newer Intel processors. If enabled, a general
1860-
protection fault is issued if the SGDT, SLDT, SIDT, SMSW
1861-
or STR instructions are executed in user mode. These instructions
1862-
unnecessarily expose information about the hardware state.
1858+
User Mode Instruction Prevention (UMIP) is a security feature in
1859+
some x86 processors. If enabled, a general protection fault is
1860+
issued if the SGDT, SLDT, SIDT, SMSW or STR instructions are
1861+
executed in user mode. These instructions unnecessarily expose
1862+
information about the hardware state.
18631863

18641864
The vast majority of applications do not use these instructions.
18651865
For the very few that do, software emulation is provided in

arch/x86/Kconfig.cpu

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,19 @@ choice
5050
See each option's help text for additional details. If you don't know
5151
what to do, choose "486".
5252

53+
config M486SX
54+
bool "486SX"
55+
depends on X86_32
56+
---help---
57+
Select this for an 486-class CPU without an FPU such as
58+
AMD/Cyrix/IBM/Intel SL/SLC/SLC2/SLC3/SX/SX2 and UMC U5S.
59+
5360
config M486
54-
bool "486"
61+
bool "486DX"
5562
depends on X86_32
5663
---help---
5764
Select this for an 486-class CPU such as AMD/Cyrix/IBM/Intel
58-
486DX/DX2/DX4 or SL/SLC/SLC2/SLC3/SX/SX2 and UMC U5D or U5S.
65+
486DX/DX2/DX4 and UMC U5D.
5966

6067
config M586
6168
bool "586/K5/5x86/6x86/6x86MX"
@@ -312,20 +319,20 @@ config X86_L1_CACHE_SHIFT
312319
int
313320
default "7" if MPENTIUM4 || MPSC
314321
default "6" if MK7 || MK8 || MPENTIUMM || MCORE2 || MATOM || MVIAC7 || X86_GENERIC || GENERIC_CPU
315-
default "4" if MELAN || M486 || MGEODEGX1
322+
default "4" if MELAN || M486SX || M486 || MGEODEGX1
316323
default "5" if MWINCHIP3D || MWINCHIPC6 || MCRUSOE || MEFFICEON || MCYRIXIII || MK6 || MPENTIUMIII || MPENTIUMII || M686 || M586MMX || M586TSC || M586 || MVIAC3_2 || MGEODE_LX
317324

318325
config X86_F00F_BUG
319326
def_bool y
320-
depends on M586MMX || M586TSC || M586 || M486
327+
depends on M586MMX || M586TSC || M586 || M486SX || M486
321328

322329
config X86_INVD_BUG
323330
def_bool y
324-
depends on M486
331+
depends on M486SX || M486
325332

326333
config X86_ALIGNMENT_16
327334
def_bool y
328-
depends on MWINCHIP3D || MWINCHIPC6 || MCYRIXIII || MELAN || MK6 || M586MMX || M586TSC || M586 || M486 || MVIAC3_2 || MGEODEGX1
335+
depends on MWINCHIP3D || MWINCHIPC6 || MCYRIXIII || MELAN || MK6 || M586MMX || M586TSC || M586 || M486SX || M486 || MVIAC3_2 || MGEODEGX1
329336

330337
config X86_INTEL_USERCOPY
331338
def_bool y
@@ -378,7 +385,7 @@ config X86_MINIMUM_CPU_FAMILY
378385

379386
config X86_DEBUGCTLMSR
380387
def_bool y
381-
depends on !(MK6 || MWINCHIPC6 || MWINCHIP3D || MCYRIXIII || M586MMX || M586TSC || M586 || M486) && !UML
388+
depends on !(MK6 || MWINCHIPC6 || MWINCHIP3D || MCYRIXIII || M586MMX || M586TSC || M586 || M486SX || M486) && !UML
382389

383390
menuconfig PROCESSOR_SELECT
384391
bool "Supported processor vendors" if EXPERT
@@ -402,7 +409,7 @@ config CPU_SUP_INTEL
402409
config CPU_SUP_CYRIX_32
403410
default y
404411
bool "Support Cyrix processors" if PROCESSOR_SELECT
405-
depends on M486 || M586 || M586TSC || M586MMX || (EXPERT && !64BIT)
412+
depends on M486SX || M486 || M586 || M586TSC || M586MMX || (EXPERT && !64BIT)
406413
---help---
407414
This enables detection, tunings and quirks for Cyrix processors
408415

@@ -470,7 +477,7 @@ config CPU_SUP_TRANSMETA_32
470477
config CPU_SUP_UMC_32
471478
default y
472479
bool "Support UMC processors" if PROCESSOR_SELECT
473-
depends on M486 || (EXPERT && !64BIT)
480+
depends on M486SX || M486 || (EXPERT && !64BIT)
474481
---help---
475482
This enables detection, tunings and quirks for UMC processors
476483

arch/x86/Makefile_32.cpu

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ else
1010
tune = $(call cc-option,-mcpu=$(1),$(2))
1111
endif
1212

13+
cflags-$(CONFIG_M486SX) += -march=i486
1314
cflags-$(CONFIG_M486) += -march=i486
1415
cflags-$(CONFIG_M586) += -march=i586
1516
cflags-$(CONFIG_M586TSC) += -march=i586

arch/x86/include/asm/cpufeatures.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,7 @@
292292
#define X86_FEATURE_CLZERO (13*32+ 0) /* CLZERO instruction */
293293
#define X86_FEATURE_IRPERF (13*32+ 1) /* Instructions Retired Count */
294294
#define X86_FEATURE_XSAVEERPTR (13*32+ 2) /* Always save/restore FP error pointers */
295+
#define X86_FEATURE_RDPRU (13*32+ 4) /* Read processor register at user level */
295296
#define X86_FEATURE_WBNOINVD (13*32+ 9) /* WBNOINVD instruction */
296297
#define X86_FEATURE_AMD_IBPB (13*32+12) /* "" Indirect Branch Prediction Barrier */
297298
#define X86_FEATURE_AMD_IBRS (13*32+14) /* "" Indirect Branch Restricted Speculation */

arch/x86/include/asm/disabled-features.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
# define DISABLE_SMAP (1<<(X86_FEATURE_SMAP & 31))
2323
#endif
2424

25-
#ifdef CONFIG_X86_INTEL_UMIP
25+
#ifdef CONFIG_X86_UMIP
2626
# define DISABLE_UMIP 0
2727
#else
2828
# define DISABLE_UMIP (1<<(X86_FEATURE_UMIP & 31))

arch/x86/include/asm/module.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ struct mod_arch_specific {
1515

1616
#ifdef CONFIG_X86_64
1717
/* X86_64 does not define MODULE_PROC_FAMILY */
18+
#elif defined CONFIG_M486SX
19+
#define MODULE_PROC_FAMILY "486SX "
1820
#elif defined CONFIG_M486
1921
#define MODULE_PROC_FAMILY "486 "
2022
#elif defined CONFIG_M586

arch/x86/include/asm/processor.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,15 @@ struct cpuinfo_x86 {
9393
__u32 extended_cpuid_level;
9494
/* Maximum supported CPUID level, -1=no CPUID: */
9595
int cpuid_level;
96-
__u32 x86_capability[NCAPINTS + NBUGINTS];
96+
/*
97+
* Align to size of unsigned long because the x86_capability array
98+
* is passed to bitops which require the alignment. Use unnamed
99+
* union to enforce the array is aligned to size of unsigned long.
100+
*/
101+
union {
102+
__u32 x86_capability[NCAPINTS + NBUGINTS];
103+
unsigned long x86_capability_alignment;
104+
};
97105
char x86_vendor_id[16];
98106
char x86_model_id[64];
99107
/* in KB - valid for CPUS which support this call: */

arch/x86/include/asm/umip.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
#include <linux/types.h>
55
#include <asm/ptrace.h>
66

7-
#ifdef CONFIG_X86_INTEL_UMIP
7+
#ifdef CONFIG_X86_UMIP
88
bool fixup_umip_exception(struct pt_regs *regs);
99
#else
1010
static inline bool fixup_umip_exception(struct pt_regs *regs) { return false; }
11-
#endif /* CONFIG_X86_INTEL_UMIP */
11+
#endif /* CONFIG_X86_UMIP */
1212
#endif /* _ASM_X86_UMIP_H */

arch/x86/kernel/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ obj-$(CONFIG_EFI) += sysfb_efi.o
134134
obj-$(CONFIG_PERF_EVENTS) += perf_regs.o
135135
obj-$(CONFIG_TRACING) += tracepoint.o
136136
obj-$(CONFIG_SCHED_MC_PRIO) += itmt.o
137-
obj-$(CONFIG_X86_INTEL_UMIP) += umip.o
137+
obj-$(CONFIG_X86_UMIP) += umip.o
138138

139139
obj-$(CONFIG_UNWINDER_ORC) += unwind_orc.o
140140
obj-$(CONFIG_UNWINDER_FRAME_POINTER) += unwind_frame.o

arch/x86/kernel/cpu/common.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -565,8 +565,9 @@ static const char *table_lookup_model(struct cpuinfo_x86 *c)
565565
return NULL; /* Not found */
566566
}
567567

568-
__u32 cpu_caps_cleared[NCAPINTS + NBUGINTS];
569-
__u32 cpu_caps_set[NCAPINTS + NBUGINTS];
568+
/* Aligned to unsigned long to avoid split lock in atomic bitmap ops */
569+
__u32 cpu_caps_cleared[NCAPINTS + NBUGINTS] __aligned(sizeof(unsigned long));
570+
__u32 cpu_caps_set[NCAPINTS + NBUGINTS] __aligned(sizeof(unsigned long));
570571

571572
void load_percpu_segment(int cpu)
572573
{

0 commit comments

Comments
 (0)