Skip to content

Commit 941d77c

Browse files
committed
Merge tag 'x86_cpu_for_v6.5' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 cpu updates from Borislav Petkov: - Compute the purposeful misalignment of zen_untrain_ret automatically and assert __x86_return_thunk's alignment so that future changes to the symbol macros do not accidentally break them. - Remove CONFIG_X86_FEATURE_NAMES Kconfig option as its existence is pointless * tag 'x86_cpu_for_v6.5' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86/retbleed: Add __x86_return_thunk alignment checks x86/cpu: Remove X86_FEATURE_NAMES x86/Kconfig: Make X86_FEATURE_NAMES non-configurable in prompt
2 parents 2c96136 + f220125 commit 941d77c

File tree

9 files changed

+7
-41
lines changed

9 files changed

+7
-41
lines changed

arch/x86/Kconfig

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,6 @@ config X86
294294
select TRACE_IRQFLAGS_NMI_SUPPORT
295295
select USER_STACKTRACE_SUPPORT
296296
select HAVE_ARCH_KCSAN if X86_64
297-
select X86_FEATURE_NAMES if PROC_FS
298297
select PROC_PID_ARCH_STATUS if PROC_FS
299298
select HAVE_ARCH_NODE_DEV_GROUP if X86_SGX
300299
select FUNCTION_ALIGNMENT_16B if X86_64 || X86_ALIGNMENT_16
@@ -444,17 +443,6 @@ config SMP
444443

445444
If you don't know what to do here, say N.
446445

447-
config X86_FEATURE_NAMES
448-
bool "Processor feature human-readable names" if EMBEDDED
449-
default y
450-
help
451-
This option compiles in a table of x86 feature bits and corresponding
452-
names. This is required to support /proc/cpuinfo and a few kernel
453-
messages. You can disable this to save space, at the expense of
454-
making those few kernel messages show numeric feature bits instead.
455-
456-
If in doubt, say Y.
457-
458446
config X86_X2APIC
459447
bool "Support x2apic"
460448
depends on X86_LOCAL_APIC && X86_64 && (IRQ_REMAP || HYPERVISOR_GUEST)

arch/x86/Kconfig.cpu

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ config IA32_FEAT_CTL
389389

390390
config X86_VMX_FEATURE_NAMES
391391
def_bool y
392-
depends on IA32_FEAT_CTL && X86_FEATURE_NAMES
392+
depends on IA32_FEAT_CTL
393393

394394
menuconfig PROCESSOR_SELECT
395395
bool "Supported processor vendors" if EXPERT

arch/x86/boot/Makefile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,12 @@ HOST_EXTRACFLAGS += -I$(srctree)/tools/include \
5555
-include include/generated/autoconf.h \
5656
-D__EXPORTED_HEADERS__
5757

58-
ifdef CONFIG_X86_FEATURE_NAMES
5958
$(obj)/cpu.o: $(obj)/cpustr.h
6059

6160
quiet_cmd_cpustr = CPUSTR $@
6261
cmd_cpustr = $(obj)/mkcpustr > $@
6362
$(obj)/cpustr.h: $(obj)/mkcpustr FORCE
6463
$(call if_changed,cpustr)
65-
endif
6664
targets += cpustr.h
6765

6866
# ---------------------------------------------------------------------------

arch/x86/boot/cpu.c

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@
1414
*/
1515

1616
#include "boot.h"
17-
#ifdef CONFIG_X86_FEATURE_NAMES
1817
#include "cpustr.h"
19-
#endif
2018

2119
static char *cpu_name(int level)
2220
{
@@ -35,7 +33,6 @@ static char *cpu_name(int level)
3533
static void show_cap_strs(u32 *err_flags)
3634
{
3735
int i, j;
38-
#ifdef CONFIG_X86_FEATURE_NAMES
3936
const unsigned char *msg_strs = (const unsigned char *)x86_cap_strs;
4037
for (i = 0; i < NCAPINTS; i++) {
4138
u32 e = err_flags[i];
@@ -58,16 +55,6 @@ static void show_cap_strs(u32 *err_flags)
5855
e >>= 1;
5956
}
6057
}
61-
#else
62-
for (i = 0; i < NCAPINTS; i++) {
63-
u32 e = err_flags[i];
64-
for (j = 0; j < 32; j++) {
65-
if (e & 1)
66-
printf("%d:%d ", i, j);
67-
e >>= 1;
68-
}
69-
}
70-
#endif
7158
}
7259

7360
int validate_cpu(void)

arch/x86/include/asm/cpufeature.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,10 @@ enum cpuid_leafs
3838
#define X86_CAP_FMT_NUM "%d:%d"
3939
#define x86_cap_flag_num(flag) ((flag) >> 5), ((flag) & 31)
4040

41-
#ifdef CONFIG_X86_FEATURE_NAMES
4241
extern const char * const x86_cap_flags[NCAPINTS*32];
4342
extern const char * const x86_power_flags[32];
4443
#define X86_CAP_FMT "%s"
4544
#define x86_cap_flag(flag) x86_cap_flags[flag]
46-
#else
47-
#define X86_CAP_FMT X86_CAP_FMT_NUM
48-
#define x86_cap_flag x86_cap_flag_num
49-
#endif
5045

5146
/*
5247
* In order to save room, we index into this array by doing

arch/x86/kernel/cpu/Makefile

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ obj-y += cpuid-deps.o
2727
obj-y += umwait.o
2828

2929
obj-$(CONFIG_PROC_FS) += proc.o
30-
obj-$(CONFIG_X86_FEATURE_NAMES) += capflags.o powerflags.o
30+
obj-y += capflags.o powerflags.o
3131

3232
obj-$(CONFIG_IA32_FEAT_CTL) += feat_ctl.o
3333
ifdef CONFIG_CPU_SUP_INTEL
@@ -54,7 +54,6 @@ obj-$(CONFIG_X86_LOCAL_APIC) += perfctr-watchdog.o
5454
obj-$(CONFIG_HYPERVISOR_GUEST) += vmware.o hypervisor.o mshyperv.o
5555
obj-$(CONFIG_ACRN_GUEST) += acrn.o
5656

57-
ifdef CONFIG_X86_FEATURE_NAMES
5857
quiet_cmd_mkcapflags = MKCAP $@
5958
cmd_mkcapflags = $(CONFIG_SHELL) $(srctree)/$(src)/mkcapflags.sh $@ $^
6059

@@ -63,5 +62,4 @@ vmxfeature = $(src)/../../include/asm/vmxfeatures.h
6362

6463
$(obj)/capflags.c: $(cpufeature) $(vmxfeature) $(src)/mkcapflags.sh FORCE
6564
$(call if_changed,mkcapflags)
66-
endif
6765
targets += capflags.c

arch/x86/kernel/cpu/common.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1489,12 +1489,10 @@ static void __init cpu_parse_early_param(void)
14891489
if (!kstrtouint(opt, 10, &bit)) {
14901490
if (bit < NCAPINTS * 32) {
14911491

1492-
#ifdef CONFIG_X86_FEATURE_NAMES
14931492
/* empty-string, i.e., ""-defined feature flags */
14941493
if (!x86_cap_flags[bit])
14951494
pr_cont(" " X86_CAP_FMT_NUM, x86_cap_flag_num(bit));
14961495
else
1497-
#endif
14981496
pr_cont(" " X86_CAP_FMT, x86_cap_flag(bit));
14991497

15001498
setup_clear_cpu_cap(bit);
@@ -1507,7 +1505,6 @@ static void __init cpu_parse_early_param(void)
15071505
continue;
15081506
}
15091507

1510-
#ifdef CONFIG_X86_FEATURE_NAMES
15111508
for (bit = 0; bit < 32 * NCAPINTS; bit++) {
15121509
if (!x86_cap_flag(bit))
15131510
continue;
@@ -1524,7 +1521,6 @@ static void __init cpu_parse_early_param(void)
15241521

15251522
if (!found)
15261523
pr_cont(" (unknown: %s)", opt);
1527-
#endif
15281524
}
15291525
pr_cont("\n");
15301526

arch/x86/kernel/vmlinux.lds.S

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -508,4 +508,8 @@ INIT_PER_CPU(irq_stack_backing_store);
508508
"fixed_percpu_data is not at start of per-cpu area");
509509
#endif
510510

511+
#ifdef CONFIG_RETHUNK
512+
. = ASSERT((__x86_return_thunk & 0x3f) == 0, "__x86_return_thunk not cacheline-aligned");
513+
#endif
514+
511515
#endif /* CONFIG_X86_64 */

arch/x86/lib/retpoline.S

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ SYM_CODE_END(__x86_indirect_jump_thunk_array)
143143
* from re-poisioning the BTB prediction.
144144
*/
145145
.align 64
146-
.skip 63, 0xcc
146+
.skip 64 - (__x86_return_thunk - zen_untrain_ret), 0xcc
147147
SYM_START(zen_untrain_ret, SYM_L_GLOBAL, SYM_A_NONE)
148148
ANNOTATE_NOENDBR
149149
/*

0 commit comments

Comments
 (0)