diff options
-rw-r--r-- | arch/x86/Kconfig | 4 | ||||
-rw-r--r-- | arch/x86/include/asm/cpufeature.h | 7 | ||||
-rw-r--r-- | arch/x86/kernel/cpu/match.c | 42 | ||||
-rw-r--r-- | drivers/base/Kconfig | 5 | ||||
-rw-r--r-- | drivers/base/cpu.c | 10 | ||||
-rw-r--r-- | include/linux/cpu.h | 7 | ||||
-rw-r--r-- | scripts/mod/file2alias.c | 10 |
7 files changed, 16 insertions, 69 deletions
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 0af5250d914f..7fab7e0b1a72 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig | |||
@@ -127,6 +127,7 @@ config X86 | |||
127 | select HAVE_DEBUG_STACKOVERFLOW | 127 | select HAVE_DEBUG_STACKOVERFLOW |
128 | select HAVE_IRQ_EXIT_ON_IRQ_STACK if X86_64 | 128 | select HAVE_IRQ_EXIT_ON_IRQ_STACK if X86_64 |
129 | select HAVE_CC_STACKPROTECTOR | 129 | select HAVE_CC_STACKPROTECTOR |
130 | select GENERIC_CPU_AUTOPROBE | ||
130 | 131 | ||
131 | config INSTRUCTION_DECODER | 132 | config INSTRUCTION_DECODER |
132 | def_bool y | 133 | def_bool y |
@@ -195,9 +196,6 @@ config ARCH_HAS_CPU_RELAX | |||
195 | config ARCH_HAS_CACHE_LINE_SIZE | 196 | config ARCH_HAS_CACHE_LINE_SIZE |
196 | def_bool y | 197 | def_bool y |
197 | 198 | ||
198 | config ARCH_HAS_CPU_AUTOPROBE | ||
199 | def_bool y | ||
200 | |||
201 | config HAVE_SETUP_PER_CPU_AREA | 199 | config HAVE_SETUP_PER_CPU_AREA |
202 | def_bool y | 200 | def_bool y |
203 | 201 | ||
diff --git a/arch/x86/include/asm/cpufeature.h b/arch/x86/include/asm/cpufeature.h index e099f9502ace..d86dc3deea6a 100644 --- a/arch/x86/include/asm/cpufeature.h +++ b/arch/x86/include/asm/cpufeature.h | |||
@@ -541,6 +541,13 @@ static __always_inline __pure bool _static_cpu_has_safe(u16 bit) | |||
541 | #define static_cpu_has_bug(bit) static_cpu_has((bit)) | 541 | #define static_cpu_has_bug(bit) static_cpu_has((bit)) |
542 | #define boot_cpu_has_bug(bit) cpu_has_bug(&boot_cpu_data, (bit)) | 542 | #define boot_cpu_has_bug(bit) cpu_has_bug(&boot_cpu_data, (bit)) |
543 | 543 | ||
544 | #define MAX_CPU_FEATURES (NCAPINTS * 32) | ||
545 | #define cpu_have_feature boot_cpu_has | ||
546 | |||
547 | #define CPU_FEATURE_TYPEFMT "x86,ven%04Xfam%04Xmod%04X" | ||
548 | #define CPU_FEATURE_TYPEVAL boot_cpu_data.x86_vendor, boot_cpu_data.x86, \ | ||
549 | boot_cpu_data.x86_model | ||
550 | |||
544 | #endif /* defined(__KERNEL__) && !defined(__ASSEMBLY__) */ | 551 | #endif /* defined(__KERNEL__) && !defined(__ASSEMBLY__) */ |
545 | 552 | ||
546 | #endif /* _ASM_X86_CPUFEATURE_H */ | 553 | #endif /* _ASM_X86_CPUFEATURE_H */ |
diff --git a/arch/x86/kernel/cpu/match.c b/arch/x86/kernel/cpu/match.c index 36565373af87..afa9f0d487ea 100644 --- a/arch/x86/kernel/cpu/match.c +++ b/arch/x86/kernel/cpu/match.c | |||
@@ -47,45 +47,3 @@ const struct x86_cpu_id *x86_match_cpu(const struct x86_cpu_id *match) | |||
47 | return NULL; | 47 | return NULL; |
48 | } | 48 | } |
49 | EXPORT_SYMBOL(x86_match_cpu); | 49 | EXPORT_SYMBOL(x86_match_cpu); |
50 | |||
51 | ssize_t arch_print_cpu_modalias(struct device *dev, | ||
52 | struct device_attribute *attr, | ||
53 | char *bufptr) | ||
54 | { | ||
55 | int size = PAGE_SIZE; | ||
56 | int i, n; | ||
57 | char *buf = bufptr; | ||
58 | |||
59 | n = snprintf(buf, size, "x86cpu:vendor:%04X:family:%04X:" | ||
60 | "model:%04X:feature:", | ||
61 | boot_cpu_data.x86_vendor, | ||
62 | boot_cpu_data.x86, | ||
63 | boot_cpu_data.x86_model); | ||
64 | size -= n; | ||
65 | buf += n; | ||
66 | size -= 1; | ||
67 | for (i = 0; i < NCAPINTS*32; i++) { | ||
68 | if (boot_cpu_has(i)) { | ||
69 | n = snprintf(buf, size, ",%04X", i); | ||
70 | if (n >= size) { | ||
71 | WARN(1, "x86 features overflow page\n"); | ||
72 | break; | ||
73 | } | ||
74 | size -= n; | ||
75 | buf += n; | ||
76 | } | ||
77 | } | ||
78 | *buf++ = '\n'; | ||
79 | return buf - bufptr; | ||
80 | } | ||
81 | |||
82 | int arch_cpu_uevent(struct device *dev, struct kobj_uevent_env *env) | ||
83 | { | ||
84 | char *buf = kzalloc(PAGE_SIZE, GFP_KERNEL); | ||
85 | if (buf) { | ||
86 | arch_print_cpu_modalias(NULL, NULL, buf); | ||
87 | add_uevent_var(env, "MODALIAS=%s", buf); | ||
88 | kfree(buf); | ||
89 | } | ||
90 | return 0; | ||
91 | } | ||
diff --git a/drivers/base/Kconfig b/drivers/base/Kconfig index 3f0d3732df7f..8fa8deab6449 100644 --- a/drivers/base/Kconfig +++ b/drivers/base/Kconfig | |||
@@ -185,13 +185,8 @@ config GENERIC_CPU_DEVICES | |||
185 | bool | 185 | bool |
186 | default n | 186 | default n |
187 | 187 | ||
188 | config HAVE_CPU_AUTOPROBE | ||
189 | def_bool ARCH_HAS_CPU_AUTOPROBE | ||
190 | |||
191 | config GENERIC_CPU_AUTOPROBE | 188 | config GENERIC_CPU_AUTOPROBE |
192 | bool | 189 | bool |
193 | depends on !ARCH_HAS_CPU_AUTOPROBE | ||
194 | select HAVE_CPU_AUTOPROBE | ||
195 | 190 | ||
196 | config SOC_BUS | 191 | config SOC_BUS |
197 | bool | 192 | bool |
diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c index 8a38bf8c792f..006b1bc5297d 100644 --- a/drivers/base/cpu.c +++ b/drivers/base/cpu.c | |||
@@ -287,7 +287,6 @@ static void cpu_device_release(struct device *dev) | |||
287 | */ | 287 | */ |
288 | } | 288 | } |
289 | 289 | ||
290 | #ifdef CONFIG_HAVE_CPU_AUTOPROBE | ||
291 | #ifdef CONFIG_GENERIC_CPU_AUTOPROBE | 290 | #ifdef CONFIG_GENERIC_CPU_AUTOPROBE |
292 | static ssize_t print_cpu_modalias(struct device *dev, | 291 | static ssize_t print_cpu_modalias(struct device *dev, |
293 | struct device_attribute *attr, | 292 | struct device_attribute *attr, |
@@ -310,9 +309,6 @@ static ssize_t print_cpu_modalias(struct device *dev, | |||
310 | buf[n++] = '\n'; | 309 | buf[n++] = '\n'; |
311 | return n; | 310 | return n; |
312 | } | 311 | } |
313 | #else | ||
314 | #define print_cpu_modalias arch_print_cpu_modalias | ||
315 | #endif | ||
316 | 312 | ||
317 | static int cpu_uevent(struct device *dev, struct kobj_uevent_env *env) | 313 | static int cpu_uevent(struct device *dev, struct kobj_uevent_env *env) |
318 | { | 314 | { |
@@ -346,7 +342,7 @@ int register_cpu(struct cpu *cpu, int num) | |||
346 | cpu->dev.offline_disabled = !cpu->hotpluggable; | 342 | cpu->dev.offline_disabled = !cpu->hotpluggable; |
347 | cpu->dev.offline = !cpu_online(num); | 343 | cpu->dev.offline = !cpu_online(num); |
348 | cpu->dev.of_node = of_get_cpu_node(num, NULL); | 344 | cpu->dev.of_node = of_get_cpu_node(num, NULL); |
349 | #ifdef CONFIG_HAVE_CPU_AUTOPROBE | 345 | #ifdef CONFIG_GENERIC_CPU_AUTOPROBE |
350 | cpu->dev.bus->uevent = cpu_uevent; | 346 | cpu->dev.bus->uevent = cpu_uevent; |
351 | #endif | 347 | #endif |
352 | cpu->dev.groups = common_cpu_attr_groups; | 348 | cpu->dev.groups = common_cpu_attr_groups; |
@@ -370,7 +366,7 @@ struct device *get_cpu_device(unsigned cpu) | |||
370 | } | 366 | } |
371 | EXPORT_SYMBOL_GPL(get_cpu_device); | 367 | EXPORT_SYMBOL_GPL(get_cpu_device); |
372 | 368 | ||
373 | #ifdef CONFIG_HAVE_CPU_AUTOPROBE | 369 | #ifdef CONFIG_GENERIC_CPU_AUTOPROBE |
374 | static DEVICE_ATTR(modalias, 0444, print_cpu_modalias, NULL); | 370 | static DEVICE_ATTR(modalias, 0444, print_cpu_modalias, NULL); |
375 | #endif | 371 | #endif |
376 | 372 | ||
@@ -384,7 +380,7 @@ static struct attribute *cpu_root_attrs[] = { | |||
384 | &cpu_attrs[2].attr.attr, | 380 | &cpu_attrs[2].attr.attr, |
385 | &dev_attr_kernel_max.attr, | 381 | &dev_attr_kernel_max.attr, |
386 | &dev_attr_offline.attr, | 382 | &dev_attr_offline.attr, |
387 | #ifdef CONFIG_HAVE_CPU_AUTOPROBE | 383 | #ifdef CONFIG_GENERIC_CPU_AUTOPROBE |
388 | &dev_attr_modalias.attr, | 384 | &dev_attr_modalias.attr, |
389 | #endif | 385 | #endif |
390 | NULL | 386 | NULL |
diff --git a/include/linux/cpu.h b/include/linux/cpu.h index 03e235ad1bba..03e962e23eaf 100644 --- a/include/linux/cpu.h +++ b/include/linux/cpu.h | |||
@@ -46,13 +46,6 @@ extern ssize_t arch_cpu_release(const char *, size_t); | |||
46 | #endif | 46 | #endif |
47 | struct notifier_block; | 47 | struct notifier_block; |
48 | 48 | ||
49 | #ifdef CONFIG_ARCH_HAS_CPU_AUTOPROBE | ||
50 | extern int arch_cpu_uevent(struct device *dev, struct kobj_uevent_env *env); | ||
51 | extern ssize_t arch_print_cpu_modalias(struct device *dev, | ||
52 | struct device_attribute *attr, | ||
53 | char *bufptr); | ||
54 | #endif | ||
55 | |||
56 | /* | 49 | /* |
57 | * CPU notifier priorities. | 50 | * CPU notifier priorities. |
58 | */ | 51 | */ |
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c index 506146e5f4a8..25f6f5970552 100644 --- a/scripts/mod/file2alias.c +++ b/scripts/mod/file2alias.c | |||
@@ -1110,7 +1110,7 @@ static int do_amba_entry(const char *filename, | |||
1110 | } | 1110 | } |
1111 | ADD_TO_DEVTABLE("amba", amba_id, do_amba_entry); | 1111 | ADD_TO_DEVTABLE("amba", amba_id, do_amba_entry); |
1112 | 1112 | ||
1113 | /* LOOKS like x86cpu:vendor:VVVV:family:FFFF:model:MMMM:feature:*,FEAT,* | 1113 | /* LOOKS like cpu:type:x86,venVVVVfamFFFFmodMMMM:feature:*,FEAT,* |
1114 | * All fields are numbers. It would be nicer to use strings for vendor | 1114 | * All fields are numbers. It would be nicer to use strings for vendor |
1115 | * and feature, but getting those out of the build system here is too | 1115 | * and feature, but getting those out of the build system here is too |
1116 | * complicated. | 1116 | * complicated. |
@@ -1124,10 +1124,10 @@ static int do_x86cpu_entry(const char *filename, void *symval, | |||
1124 | DEF_FIELD(symval, x86_cpu_id, model); | 1124 | DEF_FIELD(symval, x86_cpu_id, model); |
1125 | DEF_FIELD(symval, x86_cpu_id, vendor); | 1125 | DEF_FIELD(symval, x86_cpu_id, vendor); |
1126 | 1126 | ||
1127 | strcpy(alias, "x86cpu:"); | 1127 | strcpy(alias, "cpu:type:x86,"); |
1128 | ADD(alias, "vendor:", vendor != X86_VENDOR_ANY, vendor); | 1128 | ADD(alias, "ven", vendor != X86_VENDOR_ANY, vendor); |
1129 | ADD(alias, ":family:", family != X86_FAMILY_ANY, family); | 1129 | ADD(alias, "fam", family != X86_FAMILY_ANY, family); |
1130 | ADD(alias, ":model:", model != X86_MODEL_ANY, model); | 1130 | ADD(alias, "mod", model != X86_MODEL_ANY, model); |
1131 | strcat(alias, ":feature:*"); | 1131 | strcat(alias, ":feature:*"); |
1132 | if (feature != X86_FEATURE_ANY) | 1132 | if (feature != X86_FEATURE_ANY) |
1133 | sprintf(alias + strlen(alias), "%04X*", feature); | 1133 | sprintf(alias + strlen(alias), "%04X*", feature); |