diff options
-rw-r--r-- | arch/x86/Kconfig | 12 | ||||
-rw-r--r-- | arch/x86/boot/Makefile | 7 | ||||
-rw-r--r-- | arch/x86/boot/cpu.c | 68 | ||||
-rw-r--r-- | arch/x86/include/asm/cpufeature.h | 7 | ||||
-rw-r--r-- | arch/x86/kernel/cpu/Makefile | 5 | ||||
-rw-r--r-- | arch/x86/kernel/cpu/common.c | 4 |
6 files changed, 71 insertions, 32 deletions
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 5d0bf1aa9dcb..a11f27c4266a 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig | |||
@@ -136,6 +136,7 @@ config X86 | |||
136 | select HAVE_ACPI_APEI if ACPI | 136 | select HAVE_ACPI_APEI if ACPI |
137 | select HAVE_ACPI_APEI_NMI if ACPI | 137 | select HAVE_ACPI_APEI_NMI if ACPI |
138 | select ACPI_LEGACY_TABLES_LOOKUP if ACPI | 138 | select ACPI_LEGACY_TABLES_LOOKUP if ACPI |
139 | select X86_FEATURE_NAMES if PROC_FS | ||
139 | 140 | ||
140 | config INSTRUCTION_DECODER | 141 | config INSTRUCTION_DECODER |
141 | def_bool y | 142 | def_bool y |
@@ -313,6 +314,17 @@ config SMP | |||
313 | 314 | ||
314 | If you don't know what to do here, say N. | 315 | If you don't know what to do here, say N. |
315 | 316 | ||
317 | config X86_FEATURE_NAMES | ||
318 | bool "Processor feature human-readable names" if EMBEDDED | ||
319 | default y | ||
320 | ---help--- | ||
321 | This option compiles in a table of x86 feature bits and corresponding | ||
322 | names. This is required to support /proc/cpuinfo and a few kernel | ||
323 | messages. You can disable this to save space, at the expense of | ||
324 | making those few kernel messages show numeric feature bits instead. | ||
325 | |||
326 | If in doubt, say Y. | ||
327 | |||
316 | config X86_X2APIC | 328 | config X86_X2APIC |
317 | bool "Support x2apic" | 329 | bool "Support x2apic" |
318 | depends on X86_LOCAL_APIC && X86_64 && IRQ_REMAP | 330 | depends on X86_LOCAL_APIC && X86_64 && IRQ_REMAP |
diff --git a/arch/x86/boot/Makefile b/arch/x86/boot/Makefile index dbe8dd2fe247..5b016e2498f3 100644 --- a/arch/x86/boot/Makefile +++ b/arch/x86/boot/Makefile | |||
@@ -35,19 +35,22 @@ setup-y += video-vesa.o | |||
35 | setup-y += video-bios.o | 35 | setup-y += video-bios.o |
36 | 36 | ||
37 | targets += $(setup-y) | 37 | targets += $(setup-y) |
38 | hostprogs-y := mkcpustr tools/build | 38 | hostprogs-y := tools/build |
39 | hostprogs-$(CONFIG_X86_FEATURE_NAMES) += mkcpustr | ||
39 | 40 | ||
40 | HOST_EXTRACFLAGS += -I$(srctree)/tools/include \ | 41 | HOST_EXTRACFLAGS += -I$(srctree)/tools/include \ |
41 | -include include/generated/autoconf.h \ | 42 | -include include/generated/autoconf.h \ |
42 | -D__EXPORTED_HEADERS__ | 43 | -D__EXPORTED_HEADERS__ |
43 | 44 | ||
45 | ifdef CONFIG_X86_FEATURE_NAMES | ||
44 | $(obj)/cpu.o: $(obj)/cpustr.h | 46 | $(obj)/cpu.o: $(obj)/cpustr.h |
45 | 47 | ||
46 | quiet_cmd_cpustr = CPUSTR $@ | 48 | quiet_cmd_cpustr = CPUSTR $@ |
47 | cmd_cpustr = $(obj)/mkcpustr > $@ | 49 | cmd_cpustr = $(obj)/mkcpustr > $@ |
48 | targets += cpustr.h | 50 | targets += cpustr.h |
49 | $(obj)/cpustr.h: $(obj)/mkcpustr FORCE | 51 | $(obj)/cpustr.h: $(obj)/mkcpustr FORCE |
50 | $(call if_changed,cpustr) | 52 | $(call if_changed,cpustr) |
53 | endif | ||
51 | 54 | ||
52 | # --------------------------------------------------------------------------- | 55 | # --------------------------------------------------------------------------- |
53 | 56 | ||
diff --git a/arch/x86/boot/cpu.c b/arch/x86/boot/cpu.c index 6ec6bb6e9957..29207f69ae8c 100644 --- a/arch/x86/boot/cpu.c +++ b/arch/x86/boot/cpu.c | |||
@@ -16,7 +16,9 @@ | |||
16 | */ | 16 | */ |
17 | 17 | ||
18 | #include "boot.h" | 18 | #include "boot.h" |
19 | #ifdef CONFIG_X86_FEATURE_NAMES | ||
19 | #include "cpustr.h" | 20 | #include "cpustr.h" |
21 | #endif | ||
20 | 22 | ||
21 | static char *cpu_name(int level) | 23 | static char *cpu_name(int level) |
22 | { | 24 | { |
@@ -32,11 +34,48 @@ static char *cpu_name(int level) | |||
32 | } | 34 | } |
33 | } | 35 | } |
34 | 36 | ||
37 | static void show_cap_strs(u32 *err_flags) | ||
38 | { | ||
39 | int i, j; | ||
40 | #ifdef CONFIG_X86_FEATURE_NAMES | ||
41 | const unsigned char *msg_strs = (const unsigned char *)x86_cap_strs; | ||
42 | for (i = 0; i < NCAPINTS; i++) { | ||
43 | u32 e = err_flags[i]; | ||
44 | for (j = 0; j < 32; j++) { | ||
45 | if (msg_strs[0] < i || | ||
46 | (msg_strs[0] == i && msg_strs[1] < j)) { | ||
47 | /* Skip to the next string */ | ||
48 | msg_strs += 2; | ||
49 | while (*msg_strs++) | ||
50 | ; | ||
51 | } | ||
52 | if (e & 1) { | ||
53 | if (msg_strs[0] == i && | ||
54 | msg_strs[1] == j && | ||
55 | msg_strs[2]) | ||
56 | printf("%s ", msg_strs+2); | ||
57 | else | ||
58 | printf("%d:%d ", i, j); | ||
59 | } | ||
60 | e >>= 1; | ||
61 | } | ||
62 | } | ||
63 | #else | ||
64 | for (i = 0; i < NCAPINTS; i++) { | ||
65 | u32 e = err_flags[i]; | ||
66 | for (j = 0; j < 32; j++) { | ||
67 | if (e & 1) | ||
68 | printf("%d:%d ", i, j); | ||
69 | e >>= 1; | ||
70 | } | ||
71 | } | ||
72 | #endif | ||
73 | } | ||
74 | |||
35 | int validate_cpu(void) | 75 | int validate_cpu(void) |
36 | { | 76 | { |
37 | u32 *err_flags; | 77 | u32 *err_flags; |
38 | int cpu_level, req_level; | 78 | int cpu_level, req_level; |
39 | const unsigned char *msg_strs; | ||
40 | 79 | ||
41 | check_cpu(&cpu_level, &req_level, &err_flags); | 80 | check_cpu(&cpu_level, &req_level, &err_flags); |
42 | 81 | ||
@@ -49,34 +88,9 @@ int validate_cpu(void) | |||
49 | } | 88 | } |
50 | 89 | ||
51 | if (err_flags) { | 90 | if (err_flags) { |
52 | int i, j; | ||
53 | puts("This kernel requires the following features " | 91 | puts("This kernel requires the following features " |
54 | "not present on the CPU:\n"); | 92 | "not present on the CPU:\n"); |
55 | 93 | show_cap_strs(err_flags); | |
56 | msg_strs = (const unsigned char *)x86_cap_strs; | ||
57 | |||
58 | for (i = 0; i < NCAPINTS; i++) { | ||
59 | u32 e = err_flags[i]; | ||
60 | |||
61 | for (j = 0; j < 32; j++) { | ||
62 | if (msg_strs[0] < i || | ||
63 | (msg_strs[0] == i && msg_strs[1] < j)) { | ||
64 | /* Skip to the next string */ | ||
65 | msg_strs += 2; | ||
66 | while (*msg_strs++) | ||
67 | ; | ||
68 | } | ||
69 | if (e & 1) { | ||
70 | if (msg_strs[0] == i && | ||
71 | msg_strs[1] == j && | ||
72 | msg_strs[2]) | ||
73 | printf("%s ", msg_strs+2); | ||
74 | else | ||
75 | printf("%d:%d ", i, j); | ||
76 | } | ||
77 | e >>= 1; | ||
78 | } | ||
79 | } | ||
80 | putchar('\n'); | 94 | putchar('\n'); |
81 | return -1; | 95 | return -1; |
82 | } else { | 96 | } else { |
diff --git a/arch/x86/include/asm/cpufeature.h b/arch/x86/include/asm/cpufeature.h index bb9b258d60e7..516903b98e06 100644 --- a/arch/x86/include/asm/cpufeature.h +++ b/arch/x86/include/asm/cpufeature.h | |||
@@ -250,8 +250,15 @@ | |||
250 | #include <asm/asm.h> | 250 | #include <asm/asm.h> |
251 | #include <linux/bitops.h> | 251 | #include <linux/bitops.h> |
252 | 252 | ||
253 | #ifdef CONFIG_X86_FEATURE_NAMES | ||
253 | extern const char * const x86_cap_flags[NCAPINTS*32]; | 254 | extern const char * const x86_cap_flags[NCAPINTS*32]; |
254 | extern const char * const x86_power_flags[32]; | 255 | extern const char * const x86_power_flags[32]; |
256 | #define X86_CAP_FMT "%s" | ||
257 | #define x86_cap_flag(flag) x86_cap_flags[flag] | ||
258 | #else | ||
259 | #define X86_CAP_FMT "%d:%d" | ||
260 | #define x86_cap_flag(flag) ((flag) >> 5), ((flag) & 31) | ||
261 | #endif | ||
255 | 262 | ||
256 | /* | 263 | /* |
257 | * In order to save room, we index into this array by doing | 264 | * In order to save room, we index into this array by doing |
diff --git a/arch/x86/kernel/cpu/Makefile b/arch/x86/kernel/cpu/Makefile index 64038d842c57..77dcab277710 100644 --- a/arch/x86/kernel/cpu/Makefile +++ b/arch/x86/kernel/cpu/Makefile | |||
@@ -13,11 +13,12 @@ nostackp := $(call cc-option, -fno-stack-protector) | |||
13 | CFLAGS_common.o := $(nostackp) | 13 | CFLAGS_common.o := $(nostackp) |
14 | 14 | ||
15 | obj-y := intel_cacheinfo.o scattered.o topology.o | 15 | obj-y := intel_cacheinfo.o scattered.o topology.o |
16 | obj-y += capflags.o powerflags.o common.o | 16 | obj-y += common.o |
17 | obj-y += rdrand.o | 17 | obj-y += rdrand.o |
18 | obj-y += match.o | 18 | obj-y += match.o |
19 | 19 | ||
20 | obj-$(CONFIG_PROC_FS) += proc.o | 20 | obj-$(CONFIG_PROC_FS) += proc.o |
21 | obj-$(CONFIG_X86_FEATURE_NAMES) += capflags.o powerflags.o | ||
21 | 22 | ||
22 | obj-$(CONFIG_X86_32) += bugs.o | 23 | obj-$(CONFIG_X86_32) += bugs.o |
23 | obj-$(CONFIG_X86_64) += bugs_64.o | 24 | obj-$(CONFIG_X86_64) += bugs_64.o |
@@ -50,6 +51,7 @@ obj-$(CONFIG_X86_LOCAL_APIC) += perfctr-watchdog.o perf_event_amd_ibs.o | |||
50 | 51 | ||
51 | obj-$(CONFIG_HYPERVISOR_GUEST) += vmware.o hypervisor.o mshyperv.o | 52 | obj-$(CONFIG_HYPERVISOR_GUEST) += vmware.o hypervisor.o mshyperv.o |
52 | 53 | ||
54 | ifdef CONFIG_X86_FEATURE_NAMES | ||
53 | quiet_cmd_mkcapflags = MKCAP $@ | 55 | quiet_cmd_mkcapflags = MKCAP $@ |
54 | cmd_mkcapflags = $(CONFIG_SHELL) $(srctree)/$(src)/mkcapflags.sh $< $@ | 56 | cmd_mkcapflags = $(CONFIG_SHELL) $(srctree)/$(src)/mkcapflags.sh $< $@ |
55 | 57 | ||
@@ -58,3 +60,4 @@ cpufeature = $(src)/../../include/asm/cpufeature.h | |||
58 | targets += capflags.c | 60 | targets += capflags.c |
59 | $(obj)/capflags.c: $(cpufeature) $(src)/mkcapflags.sh FORCE | 61 | $(obj)/capflags.c: $(cpufeature) $(src)/mkcapflags.sh FORCE |
60 | $(call if_changed,mkcapflags) | 62 | $(call if_changed,mkcapflags) |
63 | endif | ||
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c index e4ab2b42bd6f..c649f236e288 100644 --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c | |||
@@ -346,8 +346,8 @@ static void filter_cpuid_features(struct cpuinfo_x86 *c, bool warn) | |||
346 | continue; | 346 | continue; |
347 | 347 | ||
348 | printk(KERN_WARNING | 348 | printk(KERN_WARNING |
349 | "CPU: CPU feature %s disabled, no CPUID level 0x%x\n", | 349 | "CPU: CPU feature " X86_CAP_FMT " disabled, no CPUID level 0x%x\n", |
350 | x86_cap_flags[df->feature], df->level); | 350 | x86_cap_flag(df->feature), df->level); |
351 | } | 351 | } |
352 | } | 352 | } |
353 | 353 | ||