Skip to content

Commit 7583e8f

Browse files
bulwahnbp3tk0v
authored andcommitted
x86/cpu: Remove X86_FEATURE_NAMES
While discussing to change the visibility of X86_FEATURE_NAMES (see Link) in order to remove CONFIG_EMBEDDED, Boris suggested to simply make the X86_FEATURE_NAMES functionality unconditional. As the need for really tiny kernel images has gone away and kernel images with !X86_FEATURE_NAMES are hardly tested, remove this config and the whole ifdeffery in the source code. Suggested-by: Borislav Petkov <[email protected]> Signed-off-by: Lukas Bulwahn <[email protected]> Signed-off-by: Borislav Petkov (AMD) <[email protected]> Link: https://lore.kernel.org/all/[email protected]/ Link: https://lore.kernel.org/r/[email protected]
1 parent 424e23f commit 7583e8f

File tree

7 files changed

+2
-40
lines changed

7 files changed

+2
-40
lines changed

arch/x86/Kconfig

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,6 @@ config X86
291291
select TRACE_IRQFLAGS_NMI_SUPPORT
292292
select USER_STACKTRACE_SUPPORT
293293
select HAVE_ARCH_KCSAN if X86_64
294-
select X86_FEATURE_NAMES if PROC_FS
295294
select PROC_PID_ARCH_STATUS if PROC_FS
296295
select HAVE_ARCH_NODE_DEV_GROUP if X86_SGX
297296
select FUNCTION_ALIGNMENT_16B if X86_64 || X86_ALIGNMENT_16
@@ -441,17 +440,6 @@ config SMP
441440

442441
If you don't know what to do here, say N.
443442

444-
config X86_FEATURE_NAMES
445-
bool
446-
default y
447-
help
448-
This option compiles in a table of x86 feature bits and corresponding
449-
names. This is required to support /proc/cpuinfo and a few kernel
450-
messages. You can disable this to save space, at the expense of
451-
making those few kernel messages show numeric feature bits instead.
452-
453-
If in doubt, say Y.
454-
455443
config X86_X2APIC
456444
bool "Support x2apic"
457445
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
@@ -1502,12 +1502,10 @@ static void __init cpu_parse_early_param(void)
15021502
if (!kstrtouint(opt, 10, &bit)) {
15031503
if (bit < NCAPINTS * 32) {
15041504

1505-
#ifdef CONFIG_X86_FEATURE_NAMES
15061505
/* empty-string, i.e., ""-defined feature flags */
15071506
if (!x86_cap_flags[bit])
15081507
pr_cont(" " X86_CAP_FMT_NUM, x86_cap_flag_num(bit));
15091508
else
1510-
#endif
15111509
pr_cont(" " X86_CAP_FMT, x86_cap_flag(bit));
15121510

15131511
setup_clear_cpu_cap(bit);
@@ -1520,7 +1518,6 @@ static void __init cpu_parse_early_param(void)
15201518
continue;
15211519
}
15221520

1523-
#ifdef CONFIG_X86_FEATURE_NAMES
15241521
for (bit = 0; bit < 32 * NCAPINTS; bit++) {
15251522
if (!x86_cap_flag(bit))
15261523
continue;
@@ -1537,7 +1534,6 @@ static void __init cpu_parse_early_param(void)
15371534

15381535
if (!found)
15391536
pr_cont(" (unknown: %s)", opt);
1540-
#endif
15411537
}
15421538
pr_cont("\n");
15431539

0 commit comments

Comments
 (0)