cpu.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * CPU subsystem support
  4. */
  5. #include <linux/kernel.h>
  6. #include <linux/module.h>
  7. #include <linux/init.h>
  8. #include <linux/sched.h>
  9. #include <linux/cpu.h>
  10. #include <linux/topology.h>
  11. #include <linux/device.h>
  12. #include <linux/node.h>
  13. #include <linux/gfp.h>
  14. #include <linux/slab.h>
  15. #include <linux/percpu.h>
  16. #include <linux/acpi.h>
  17. #include <linux/of.h>
  18. #include <linux/cpufeature.h>
  19. #include <linux/tick.h>
  20. #include <linux/pm_qos.h>
  21. #include <linux/sched/isolation.h>
  22. #include "base.h"
  23. static DEFINE_PER_CPU(struct device *, cpu_sys_devices);
  24. static int cpu_subsys_match(struct device *dev, struct device_driver *drv)
  25. {
  26. /* ACPI style match is the only one that may succeed. */
  27. if (acpi_driver_match_device(dev, drv))
  28. return 1;
  29. return 0;
  30. }
  31. #ifdef CONFIG_HOTPLUG_CPU
  32. static void change_cpu_under_node(struct cpu *cpu,
  33. unsigned int from_nid, unsigned int to_nid)
  34. {
  35. int cpuid = cpu->dev.id;
  36. unregister_cpu_under_node(cpuid, from_nid);
  37. register_cpu_under_node(cpuid, to_nid);
  38. cpu->node_id = to_nid;
  39. }
  40. static int cpu_subsys_online(struct device *dev)
  41. {
  42. struct cpu *cpu = container_of(dev, struct cpu, dev);
  43. int cpuid = dev->id;
  44. int from_nid, to_nid;
  45. int ret;
  46. from_nid = cpu_to_node(cpuid);
  47. if (from_nid == NUMA_NO_NODE)
  48. return -ENODEV;
  49. ret = cpu_device_up(dev);
  50. /*
  51. * When hot adding memory to memoryless node and enabling a cpu
  52. * on the node, node number of the cpu may internally change.
  53. */
  54. to_nid = cpu_to_node(cpuid);
  55. if (from_nid != to_nid)
  56. change_cpu_under_node(cpu, from_nid, to_nid);
  57. return ret;
  58. }
  59. static int cpu_subsys_offline(struct device *dev)
  60. {
  61. return cpu_device_down(dev);
  62. }
  63. void unregister_cpu(struct cpu *cpu)
  64. {
  65. int logical_cpu = cpu->dev.id;
  66. unregister_cpu_under_node(logical_cpu, cpu_to_node(logical_cpu));
  67. device_unregister(&cpu->dev);
  68. per_cpu(cpu_sys_devices, logical_cpu) = NULL;
  69. return;
  70. }
  71. #ifdef CONFIG_ARCH_CPU_PROBE_RELEASE
  72. static ssize_t cpu_probe_store(struct device *dev,
  73. struct device_attribute *attr,
  74. const char *buf,
  75. size_t count)
  76. {
  77. ssize_t cnt;
  78. int ret;
  79. ret = lock_device_hotplug_sysfs();
  80. if (ret)
  81. return ret;
  82. cnt = arch_cpu_probe(buf, count);
  83. unlock_device_hotplug();
  84. return cnt;
  85. }
  86. static ssize_t cpu_release_store(struct device *dev,
  87. struct device_attribute *attr,
  88. const char *buf,
  89. size_t count)
  90. {
  91. ssize_t cnt;
  92. int ret;
  93. ret = lock_device_hotplug_sysfs();
  94. if (ret)
  95. return ret;
  96. cnt = arch_cpu_release(buf, count);
  97. unlock_device_hotplug();
  98. return cnt;
  99. }
  100. static DEVICE_ATTR(probe, S_IWUSR, NULL, cpu_probe_store);
  101. static DEVICE_ATTR(release, S_IWUSR, NULL, cpu_release_store);
  102. #endif /* CONFIG_ARCH_CPU_PROBE_RELEASE */
  103. #endif /* CONFIG_HOTPLUG_CPU */
  104. struct bus_type cpu_subsys = {
  105. .name = "cpu",
  106. .dev_name = "cpu",
  107. .match = cpu_subsys_match,
  108. #ifdef CONFIG_HOTPLUG_CPU
  109. .online = cpu_subsys_online,
  110. .offline = cpu_subsys_offline,
  111. #endif
  112. };
  113. EXPORT_SYMBOL_GPL(cpu_subsys);
  114. #ifdef CONFIG_KEXEC
  115. #include <linux/kexec.h>
  116. static ssize_t crash_notes_show(struct device *dev,
  117. struct device_attribute *attr,
  118. char *buf)
  119. {
  120. struct cpu *cpu = container_of(dev, struct cpu, dev);
  121. unsigned long long addr;
  122. int cpunum;
  123. cpunum = cpu->dev.id;
  124. /*
  125. * Might be reading other cpu's data based on which cpu read thread
  126. * has been scheduled. But cpu data (memory) is allocated once during
  127. * boot up and this data does not change there after. Hence this
  128. * operation should be safe. No locking required.
  129. */
  130. addr = per_cpu_ptr_to_phys(per_cpu_ptr(crash_notes, cpunum));
  131. return sysfs_emit(buf, "%llx\n", addr);
  132. }
  133. static DEVICE_ATTR_ADMIN_RO(crash_notes);
  134. static ssize_t crash_notes_size_show(struct device *dev,
  135. struct device_attribute *attr,
  136. char *buf)
  137. {
  138. return sysfs_emit(buf, "%zu\n", sizeof(note_buf_t));
  139. }
  140. static DEVICE_ATTR_ADMIN_RO(crash_notes_size);
  141. static struct attribute *crash_note_cpu_attrs[] = {
  142. &dev_attr_crash_notes.attr,
  143. &dev_attr_crash_notes_size.attr,
  144. NULL
  145. };
  146. static const struct attribute_group crash_note_cpu_attr_group = {
  147. .attrs = crash_note_cpu_attrs,
  148. };
  149. #endif
  150. static const struct attribute_group *common_cpu_attr_groups[] = {
  151. #ifdef CONFIG_KEXEC
  152. &crash_note_cpu_attr_group,
  153. #endif
  154. NULL
  155. };
  156. static const struct attribute_group *hotplugable_cpu_attr_groups[] = {
  157. #ifdef CONFIG_KEXEC
  158. &crash_note_cpu_attr_group,
  159. #endif
  160. NULL
  161. };
  162. /*
  163. * Print cpu online, possible, present, and system maps
  164. */
  165. struct cpu_attr {
  166. struct device_attribute attr;
  167. const struct cpumask *const map;
  168. };
  169. static ssize_t show_cpus_attr(struct device *dev,
  170. struct device_attribute *attr,
  171. char *buf)
  172. {
  173. struct cpu_attr *ca = container_of(attr, struct cpu_attr, attr);
  174. return cpumap_print_to_pagebuf(true, buf, ca->map);
  175. }
  176. #define _CPU_ATTR(name, map) \
  177. { __ATTR(name, 0444, show_cpus_attr, NULL), map }
  178. /* Keep in sync with cpu_subsys_attrs */
  179. static struct cpu_attr cpu_attrs[] = {
  180. _CPU_ATTR(online, &__cpu_online_mask),
  181. _CPU_ATTR(possible, &__cpu_possible_mask),
  182. _CPU_ATTR(present, &__cpu_present_mask),
  183. };
  184. /*
  185. * Print values for NR_CPUS and offlined cpus
  186. */
  187. static ssize_t print_cpus_kernel_max(struct device *dev,
  188. struct device_attribute *attr, char *buf)
  189. {
  190. return sysfs_emit(buf, "%d\n", NR_CPUS - 1);
  191. }
  192. static DEVICE_ATTR(kernel_max, 0444, print_cpus_kernel_max, NULL);
  193. /* arch-optional setting to enable display of offline cpus >= nr_cpu_ids */
  194. unsigned int total_cpus;
  195. static ssize_t print_cpus_offline(struct device *dev,
  196. struct device_attribute *attr, char *buf)
  197. {
  198. int len = 0;
  199. cpumask_var_t offline;
  200. /* display offline cpus < nr_cpu_ids */
  201. if (!alloc_cpumask_var(&offline, GFP_KERNEL))
  202. return -ENOMEM;
  203. cpumask_andnot(offline, cpu_possible_mask, cpu_online_mask);
  204. len += sysfs_emit_at(buf, len, "%*pbl", cpumask_pr_args(offline));
  205. free_cpumask_var(offline);
  206. /* display offline cpus >= nr_cpu_ids */
  207. if (total_cpus && nr_cpu_ids < total_cpus) {
  208. len += sysfs_emit_at(buf, len, ",");
  209. if (nr_cpu_ids == total_cpus-1)
  210. len += sysfs_emit_at(buf, len, "%u", nr_cpu_ids);
  211. else
  212. len += sysfs_emit_at(buf, len, "%u-%d",
  213. nr_cpu_ids, total_cpus - 1);
  214. }
  215. len += sysfs_emit_at(buf, len, "\n");
  216. return len;
  217. }
  218. static DEVICE_ATTR(offline, 0444, print_cpus_offline, NULL);
  219. static ssize_t print_cpus_isolated(struct device *dev,
  220. struct device_attribute *attr, char *buf)
  221. {
  222. int len;
  223. cpumask_var_t isolated;
  224. if (!alloc_cpumask_var(&isolated, GFP_KERNEL))
  225. return -ENOMEM;
  226. cpumask_andnot(isolated, cpu_possible_mask,
  227. housekeeping_cpumask(HK_TYPE_DOMAIN));
  228. len = sysfs_emit(buf, "%*pbl\n", cpumask_pr_args(isolated));
  229. free_cpumask_var(isolated);
  230. return len;
  231. }
  232. static DEVICE_ATTR(isolated, 0444, print_cpus_isolated, NULL);
  233. #ifdef CONFIG_NO_HZ_FULL
  234. static ssize_t print_cpus_nohz_full(struct device *dev,
  235. struct device_attribute *attr, char *buf)
  236. {
  237. return sysfs_emit(buf, "%*pbl\n", cpumask_pr_args(tick_nohz_full_mask));
  238. }
  239. static DEVICE_ATTR(nohz_full, 0444, print_cpus_nohz_full, NULL);
  240. #endif
  241. static void cpu_device_release(struct device *dev)
  242. {
  243. /*
  244. * This is an empty function to prevent the driver core from spitting a
  245. * warning at us. Yes, I know this is directly opposite of what the
  246. * documentation for the driver core and kobjects say, and the author
  247. * of this code has already been publically ridiculed for doing
  248. * something as foolish as this. However, at this point in time, it is
  249. * the only way to handle the issue of statically allocated cpu
  250. * devices. The different architectures will have their cpu device
  251. * code reworked to properly handle this in the near future, so this
  252. * function will then be changed to correctly free up the memory held
  253. * by the cpu device.
  254. *
  255. * Never copy this way of doing things, or you too will be made fun of
  256. * on the linux-kernel list, you have been warned.
  257. */
  258. }
  259. #ifdef CONFIG_GENERIC_CPU_AUTOPROBE
  260. static ssize_t print_cpu_modalias(struct device *dev,
  261. struct device_attribute *attr,
  262. char *buf)
  263. {
  264. int len = 0;
  265. u32 i;
  266. len += sysfs_emit_at(buf, len,
  267. "cpu:type:" CPU_FEATURE_TYPEFMT ":feature:",
  268. CPU_FEATURE_TYPEVAL);
  269. for (i = 0; i < MAX_CPU_FEATURES; i++)
  270. if (cpu_have_feature(i)) {
  271. if (len + sizeof(",XXXX\n") >= PAGE_SIZE) {
  272. WARN(1, "CPU features overflow page\n");
  273. break;
  274. }
  275. len += sysfs_emit_at(buf, len, ",%04X", i);
  276. }
  277. len += sysfs_emit_at(buf, len, "\n");
  278. return len;
  279. }
  280. static int cpu_uevent(struct device *dev, struct kobj_uevent_env *env)
  281. {
  282. char *buf = kzalloc(PAGE_SIZE, GFP_KERNEL);
  283. if (buf) {
  284. print_cpu_modalias(NULL, NULL, buf);
  285. add_uevent_var(env, "MODALIAS=%s", buf);
  286. kfree(buf);
  287. }
  288. return 0;
  289. }
  290. #endif
  291. /*
  292. * register_cpu - Setup a sysfs device for a CPU.
  293. * @cpu - cpu->hotpluggable field set to 1 will generate a control file in
  294. * sysfs for this CPU.
  295. * @num - CPU number to use when creating the device.
  296. *
  297. * Initialize and register the CPU device.
  298. */
  299. int register_cpu(struct cpu *cpu, int num)
  300. {
  301. int error;
  302. cpu->node_id = cpu_to_node(num);
  303. memset(&cpu->dev, 0x00, sizeof(struct device));
  304. cpu->dev.id = num;
  305. cpu->dev.bus = &cpu_subsys;
  306. cpu->dev.release = cpu_device_release;
  307. cpu->dev.offline_disabled = !cpu->hotpluggable;
  308. cpu->dev.offline = !cpu_online(num);
  309. cpu->dev.of_node = of_get_cpu_node(num, NULL);
  310. #ifdef CONFIG_GENERIC_CPU_AUTOPROBE
  311. cpu->dev.bus->uevent = cpu_uevent;
  312. #endif
  313. cpu->dev.groups = common_cpu_attr_groups;
  314. if (cpu->hotpluggable)
  315. cpu->dev.groups = hotplugable_cpu_attr_groups;
  316. error = device_register(&cpu->dev);
  317. if (error) {
  318. put_device(&cpu->dev);
  319. return error;
  320. }
  321. per_cpu(cpu_sys_devices, num) = &cpu->dev;
  322. register_cpu_under_node(num, cpu_to_node(num));
  323. dev_pm_qos_expose_latency_limit(&cpu->dev,
  324. PM_QOS_RESUME_LATENCY_NO_CONSTRAINT);
  325. return 0;
  326. }
  327. struct device *get_cpu_device(unsigned int cpu)
  328. {
  329. if (cpu < nr_cpu_ids && cpu_possible(cpu))
  330. return per_cpu(cpu_sys_devices, cpu);
  331. else
  332. return NULL;
  333. }
  334. EXPORT_SYMBOL_GPL(get_cpu_device);
  335. static void device_create_release(struct device *dev)
  336. {
  337. kfree(dev);
  338. }
  339. __printf(4, 0)
  340. static struct device *
  341. __cpu_device_create(struct device *parent, void *drvdata,
  342. const struct attribute_group **groups,
  343. const char *fmt, va_list args)
  344. {
  345. struct device *dev = NULL;
  346. int retval = -ENOMEM;
  347. dev = kzalloc(sizeof(*dev), GFP_KERNEL);
  348. if (!dev)
  349. goto error;
  350. device_initialize(dev);
  351. dev->parent = parent;
  352. dev->groups = groups;
  353. dev->release = device_create_release;
  354. device_set_pm_not_required(dev);
  355. dev_set_drvdata(dev, drvdata);
  356. retval = kobject_set_name_vargs(&dev->kobj, fmt, args);
  357. if (retval)
  358. goto error;
  359. retval = device_add(dev);
  360. if (retval)
  361. goto error;
  362. return dev;
  363. error:
  364. put_device(dev);
  365. return ERR_PTR(retval);
  366. }
  367. struct device *cpu_device_create(struct device *parent, void *drvdata,
  368. const struct attribute_group **groups,
  369. const char *fmt, ...)
  370. {
  371. va_list vargs;
  372. struct device *dev;
  373. va_start(vargs, fmt);
  374. dev = __cpu_device_create(parent, drvdata, groups, fmt, vargs);
  375. va_end(vargs);
  376. return dev;
  377. }
  378. EXPORT_SYMBOL_GPL(cpu_device_create);
  379. #ifdef CONFIG_GENERIC_CPU_AUTOPROBE
  380. static DEVICE_ATTR(modalias, 0444, print_cpu_modalias, NULL);
  381. #endif
  382. static struct attribute *cpu_root_attrs[] = {
  383. #ifdef CONFIG_ARCH_CPU_PROBE_RELEASE
  384. &dev_attr_probe.attr,
  385. &dev_attr_release.attr,
  386. #endif
  387. &cpu_attrs[0].attr.attr,
  388. &cpu_attrs[1].attr.attr,
  389. &cpu_attrs[2].attr.attr,
  390. &dev_attr_kernel_max.attr,
  391. &dev_attr_offline.attr,
  392. &dev_attr_isolated.attr,
  393. #ifdef CONFIG_NO_HZ_FULL
  394. &dev_attr_nohz_full.attr,
  395. #endif
  396. #ifdef CONFIG_GENERIC_CPU_AUTOPROBE
  397. &dev_attr_modalias.attr,
  398. #endif
  399. NULL
  400. };
  401. static const struct attribute_group cpu_root_attr_group = {
  402. .attrs = cpu_root_attrs,
  403. };
  404. static const struct attribute_group *cpu_root_attr_groups[] = {
  405. &cpu_root_attr_group,
  406. NULL,
  407. };
  408. bool cpu_is_hotpluggable(unsigned int cpu)
  409. {
  410. struct device *dev = get_cpu_device(cpu);
  411. return dev && container_of(dev, struct cpu, dev)->hotpluggable
  412. && tick_nohz_cpu_hotpluggable(cpu);
  413. }
  414. EXPORT_SYMBOL_GPL(cpu_is_hotpluggable);
  415. #ifdef CONFIG_GENERIC_CPU_DEVICES
  416. static DEFINE_PER_CPU(struct cpu, cpu_devices);
  417. #endif
  418. static void __init cpu_dev_register_generic(void)
  419. {
  420. #ifdef CONFIG_GENERIC_CPU_DEVICES
  421. int i;
  422. for_each_possible_cpu(i) {
  423. if (register_cpu(&per_cpu(cpu_devices, i), i))
  424. panic("Failed to register CPU device");
  425. }
  426. #endif
  427. }
  428. #ifdef CONFIG_GENERIC_CPU_VULNERABILITIES
  429. ssize_t __weak cpu_show_meltdown(struct device *dev,
  430. struct device_attribute *attr, char *buf)
  431. {
  432. return sysfs_emit(buf, "Not affected\n");
  433. }
  434. ssize_t __weak cpu_show_spectre_v1(struct device *dev,
  435. struct device_attribute *attr, char *buf)
  436. {
  437. return sysfs_emit(buf, "Not affected\n");
  438. }
  439. ssize_t __weak cpu_show_spectre_v2(struct device *dev,
  440. struct device_attribute *attr, char *buf)
  441. {
  442. return sysfs_emit(buf, "Not affected\n");
  443. }
  444. ssize_t __weak cpu_show_spec_store_bypass(struct device *dev,
  445. struct device_attribute *attr, char *buf)
  446. {
  447. return sysfs_emit(buf, "Not affected\n");
  448. }
  449. ssize_t __weak cpu_show_l1tf(struct device *dev,
  450. struct device_attribute *attr, char *buf)
  451. {
  452. return sysfs_emit(buf, "Not affected\n");
  453. }
  454. ssize_t __weak cpu_show_mds(struct device *dev,
  455. struct device_attribute *attr, char *buf)
  456. {
  457. return sysfs_emit(buf, "Not affected\n");
  458. }
  459. ssize_t __weak cpu_show_tsx_async_abort(struct device *dev,
  460. struct device_attribute *attr,
  461. char *buf)
  462. {
  463. return sysfs_emit(buf, "Not affected\n");
  464. }
  465. ssize_t __weak cpu_show_itlb_multihit(struct device *dev,
  466. struct device_attribute *attr, char *buf)
  467. {
  468. return sysfs_emit(buf, "Not affected\n");
  469. }
  470. ssize_t __weak cpu_show_srbds(struct device *dev,
  471. struct device_attribute *attr, char *buf)
  472. {
  473. return sysfs_emit(buf, "Not affected\n");
  474. }
  475. ssize_t __weak cpu_show_mmio_stale_data(struct device *dev,
  476. struct device_attribute *attr, char *buf)
  477. {
  478. return sysfs_emit(buf, "Not affected\n");
  479. }
  480. ssize_t __weak cpu_show_retbleed(struct device *dev,
  481. struct device_attribute *attr, char *buf)
  482. {
  483. return sysfs_emit(buf, "Not affected\n");
  484. }
  485. ssize_t __weak cpu_show_gds(struct device *dev,
  486. struct device_attribute *attr, char *buf)
  487. {
  488. return sysfs_emit(buf, "Not affected\n");
  489. }
  490. ssize_t __weak cpu_show_spec_rstack_overflow(struct device *dev,
  491. struct device_attribute *attr, char *buf)
  492. {
  493. return sysfs_emit(buf, "Not affected\n");
  494. }
  495. static DEVICE_ATTR(meltdown, 0444, cpu_show_meltdown, NULL);
  496. static DEVICE_ATTR(spectre_v1, 0444, cpu_show_spectre_v1, NULL);
  497. static DEVICE_ATTR(spectre_v2, 0444, cpu_show_spectre_v2, NULL);
  498. static DEVICE_ATTR(spec_store_bypass, 0444, cpu_show_spec_store_bypass, NULL);
  499. static DEVICE_ATTR(l1tf, 0444, cpu_show_l1tf, NULL);
  500. static DEVICE_ATTR(mds, 0444, cpu_show_mds, NULL);
  501. static DEVICE_ATTR(tsx_async_abort, 0444, cpu_show_tsx_async_abort, NULL);
  502. static DEVICE_ATTR(itlb_multihit, 0444, cpu_show_itlb_multihit, NULL);
  503. static DEVICE_ATTR(srbds, 0444, cpu_show_srbds, NULL);
  504. static DEVICE_ATTR(mmio_stale_data, 0444, cpu_show_mmio_stale_data, NULL);
  505. static DEVICE_ATTR(retbleed, 0444, cpu_show_retbleed, NULL);
  506. static DEVICE_ATTR(gather_data_sampling, 0444, cpu_show_gds, NULL);
  507. static DEVICE_ATTR(spec_rstack_overflow, 0444, cpu_show_spec_rstack_overflow, NULL);
  508. static struct attribute *cpu_root_vulnerabilities_attrs[] = {
  509. &dev_attr_meltdown.attr,
  510. &dev_attr_spectre_v1.attr,
  511. &dev_attr_spectre_v2.attr,
  512. &dev_attr_spec_store_bypass.attr,
  513. &dev_attr_l1tf.attr,
  514. &dev_attr_mds.attr,
  515. &dev_attr_tsx_async_abort.attr,
  516. &dev_attr_itlb_multihit.attr,
  517. &dev_attr_srbds.attr,
  518. &dev_attr_mmio_stale_data.attr,
  519. &dev_attr_retbleed.attr,
  520. &dev_attr_gather_data_sampling.attr,
  521. &dev_attr_spec_rstack_overflow.attr,
  522. NULL
  523. };
  524. static const struct attribute_group cpu_root_vulnerabilities_group = {
  525. .name = "vulnerabilities",
  526. .attrs = cpu_root_vulnerabilities_attrs,
  527. };
  528. static void __init cpu_register_vulnerabilities(void)
  529. {
  530. if (sysfs_create_group(&cpu_subsys.dev_root->kobj,
  531. &cpu_root_vulnerabilities_group))
  532. pr_err("Unable to register CPU vulnerabilities\n");
  533. }
  534. #else
  535. static inline void cpu_register_vulnerabilities(void) { }
  536. #endif
  537. void __init cpu_dev_init(void)
  538. {
  539. if (subsys_system_register(&cpu_subsys, cpu_root_attr_groups))
  540. panic("Failed to register CPU subsystem");
  541. cpu_dev_register_generic();
  542. cpu_register_vulnerabilities();
  543. }