diff options
author | David S. Miller <davem@davemloft.net> | 2018-01-17 00:00:25 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-01-17 00:10:42 -0500 |
commit | c02b3741eb99a1ec733e6134c53ba59e43e19e97 (patch) | |
tree | ff7dd96c32dec2abe530e7101378443dabcb8962 /drivers/base/cpu.c | |
parent | 7018d1b3f20fb4308ed9bc577160cb8ffb79b62a (diff) | |
parent | 8cbab92dff778e516064c13113ca15d4869ec883 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Overlapping changes all over.
The mini-qdisc bits were a little bit tricky, however.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/base/cpu.c')
-rw-r--r-- | drivers/base/cpu.c | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c index 58a9b608d821..d99038487a0d 100644 --- a/drivers/base/cpu.c +++ b/drivers/base/cpu.c | |||
@@ -511,10 +511,58 @@ static void __init cpu_dev_register_generic(void) | |||
511 | #endif | 511 | #endif |
512 | } | 512 | } |
513 | 513 | ||
514 | #ifdef CONFIG_GENERIC_CPU_VULNERABILITIES | ||
515 | |||
516 | ssize_t __weak cpu_show_meltdown(struct device *dev, | ||
517 | struct device_attribute *attr, char *buf) | ||
518 | { | ||
519 | return sprintf(buf, "Not affected\n"); | ||
520 | } | ||
521 | |||
522 | ssize_t __weak cpu_show_spectre_v1(struct device *dev, | ||
523 | struct device_attribute *attr, char *buf) | ||
524 | { | ||
525 | return sprintf(buf, "Not affected\n"); | ||
526 | } | ||
527 | |||
528 | ssize_t __weak cpu_show_spectre_v2(struct device *dev, | ||
529 | struct device_attribute *attr, char *buf) | ||
530 | { | ||
531 | return sprintf(buf, "Not affected\n"); | ||
532 | } | ||
533 | |||
534 | static DEVICE_ATTR(meltdown, 0444, cpu_show_meltdown, NULL); | ||
535 | static DEVICE_ATTR(spectre_v1, 0444, cpu_show_spectre_v1, NULL); | ||
536 | static DEVICE_ATTR(spectre_v2, 0444, cpu_show_spectre_v2, NULL); | ||
537 | |||
538 | static struct attribute *cpu_root_vulnerabilities_attrs[] = { | ||
539 | &dev_attr_meltdown.attr, | ||
540 | &dev_attr_spectre_v1.attr, | ||
541 | &dev_attr_spectre_v2.attr, | ||
542 | NULL | ||
543 | }; | ||
544 | |||
545 | static const struct attribute_group cpu_root_vulnerabilities_group = { | ||
546 | .name = "vulnerabilities", | ||
547 | .attrs = cpu_root_vulnerabilities_attrs, | ||
548 | }; | ||
549 | |||
550 | static void __init cpu_register_vulnerabilities(void) | ||
551 | { | ||
552 | if (sysfs_create_group(&cpu_subsys.dev_root->kobj, | ||
553 | &cpu_root_vulnerabilities_group)) | ||
554 | pr_err("Unable to register CPU vulnerabilities\n"); | ||
555 | } | ||
556 | |||
557 | #else | ||
558 | static inline void cpu_register_vulnerabilities(void) { } | ||
559 | #endif | ||
560 | |||
514 | void __init cpu_dev_init(void) | 561 | void __init cpu_dev_init(void) |
515 | { | 562 | { |
516 | if (subsys_system_register(&cpu_subsys, cpu_root_attr_groups)) | 563 | if (subsys_system_register(&cpu_subsys, cpu_root_attr_groups)) |
517 | panic("Failed to register CPU subsystem"); | 564 | panic("Failed to register CPU subsystem"); |
518 | 565 | ||
519 | cpu_dev_register_generic(); | 566 | cpu_dev_register_generic(); |
567 | cpu_register_vulnerabilities(); | ||
520 | } | 568 | } |