sysfs.c 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. #include <linux/device.h>
  3. #include <linux/cpu.h>
  4. #include <linux/smp.h>
  5. #include <linux/percpu.h>
  6. #include <linux/init.h>
  7. #include <linux/sched.h>
  8. #include <linux/export.h>
  9. #include <linux/nodemask.h>
  10. #include <linux/cpumask.h>
  11. #include <linux/notifier.h>
  12. #include <linux/of.h>
  13. #include <asm/current.h>
  14. #include <asm/processor.h>
  15. #include <asm/cputable.h>
  16. #include <asm/hvcall.h>
  17. #include <asm/machdep.h>
  18. #include <asm/smp.h>
  19. #include <asm/pmc.h>
  20. #include <asm/firmware.h>
  21. #include <asm/idle.h>
  22. #include <asm/svm.h>
  23. #include "cacheinfo.h"
  24. #include "setup.h"
  25. #ifdef CONFIG_PPC64
  26. #include <asm/paca.h>
  27. #include <asm/lppaca.h>
  28. #endif
  29. static DEFINE_PER_CPU(struct cpu, cpu_devices);
  30. #ifdef CONFIG_PPC64
  31. /*
  32. * Snooze delay has not been hooked up since 3fa8cad82b94 ("powerpc/pseries/cpuidle:
  33. * smt-snooze-delay cleanup.") and has been broken even longer. As was foretold in
  34. * 2014:
  35. *
  36. * "ppc64_util currently utilises it. Once we fix ppc64_util, propose to clean
  37. * up the kernel code."
  38. *
  39. * powerpc-utils stopped using it as of 1.3.8. At some point in the future this
  40. * code should be removed.
  41. */
  42. static ssize_t store_smt_snooze_delay(struct device *dev,
  43. struct device_attribute *attr,
  44. const char *buf,
  45. size_t count)
  46. {
  47. pr_warn_once("%s (%d) stored to unsupported smt_snooze_delay, which has no effect.\n",
  48. current->comm, current->pid);
  49. return count;
  50. }
  51. static ssize_t show_smt_snooze_delay(struct device *dev,
  52. struct device_attribute *attr,
  53. char *buf)
  54. {
  55. pr_warn_once("%s (%d) read from unsupported smt_snooze_delay\n",
  56. current->comm, current->pid);
  57. return sprintf(buf, "100\n");
  58. }
  59. static DEVICE_ATTR(smt_snooze_delay, 0644, show_smt_snooze_delay,
  60. store_smt_snooze_delay);
  61. static int __init setup_smt_snooze_delay(char *str)
  62. {
  63. if (!cpu_has_feature(CPU_FTR_SMT))
  64. return 1;
  65. pr_warn("smt-snooze-delay command line option has no effect\n");
  66. return 1;
  67. }
  68. __setup("smt-snooze-delay=", setup_smt_snooze_delay);
  69. #endif /* CONFIG_PPC64 */
  70. #define __SYSFS_SPRSETUP_READ_WRITE(NAME, ADDRESS, EXTRA) \
  71. static void read_##NAME(void *val) \
  72. { \
  73. *(unsigned long *)val = mfspr(ADDRESS); \
  74. } \
  75. static void write_##NAME(void *val) \
  76. { \
  77. EXTRA; \
  78. mtspr(ADDRESS, *(unsigned long *)val); \
  79. }
  80. #define __SYSFS_SPRSETUP_SHOW_STORE(NAME) \
  81. static ssize_t show_##NAME(struct device *dev, \
  82. struct device_attribute *attr, \
  83. char *buf) \
  84. { \
  85. struct cpu *cpu = container_of(dev, struct cpu, dev); \
  86. unsigned long val; \
  87. smp_call_function_single(cpu->dev.id, read_##NAME, &val, 1); \
  88. return sprintf(buf, "%lx\n", val); \
  89. } \
  90. static ssize_t __used \
  91. store_##NAME(struct device *dev, struct device_attribute *attr, \
  92. const char *buf, size_t count) \
  93. { \
  94. struct cpu *cpu = container_of(dev, struct cpu, dev); \
  95. unsigned long val; \
  96. int ret = sscanf(buf, "%lx", &val); \
  97. if (ret != 1) \
  98. return -EINVAL; \
  99. smp_call_function_single(cpu->dev.id, write_##NAME, &val, 1); \
  100. return count; \
  101. }
  102. #define SYSFS_PMCSETUP(NAME, ADDRESS) \
  103. __SYSFS_SPRSETUP_READ_WRITE(NAME, ADDRESS, ppc_enable_pmcs()) \
  104. __SYSFS_SPRSETUP_SHOW_STORE(NAME)
  105. #define SYSFS_SPRSETUP(NAME, ADDRESS) \
  106. __SYSFS_SPRSETUP_READ_WRITE(NAME, ADDRESS, ) \
  107. __SYSFS_SPRSETUP_SHOW_STORE(NAME)
  108. #define SYSFS_SPRSETUP_SHOW_STORE(NAME) \
  109. __SYSFS_SPRSETUP_SHOW_STORE(NAME)
  110. #ifdef CONFIG_PPC64
  111. /*
  112. * This is the system wide DSCR register default value. Any
  113. * change to this default value through the sysfs interface
  114. * will update all per cpu DSCR default values across the
  115. * system stored in their respective PACA structures.
  116. */
  117. static unsigned long dscr_default;
  118. /**
  119. * read_dscr() - Fetch the cpu specific DSCR default
  120. * @val: Returned cpu specific DSCR default value
  121. *
  122. * This function returns the per cpu DSCR default value
  123. * for any cpu which is contained in its PACA structure.
  124. */
  125. static void read_dscr(void *val)
  126. {
  127. *(unsigned long *)val = get_paca()->dscr_default;
  128. }
  129. /**
  130. * write_dscr() - Update the cpu specific DSCR default
  131. * @val: New cpu specific DSCR default value to update
  132. *
  133. * This function updates the per cpu DSCR default value
  134. * for any cpu which is contained in its PACA structure.
  135. */
  136. static void write_dscr(void *val)
  137. {
  138. get_paca()->dscr_default = *(unsigned long *)val;
  139. if (!current->thread.dscr_inherit) {
  140. current->thread.dscr = *(unsigned long *)val;
  141. mtspr(SPRN_DSCR, *(unsigned long *)val);
  142. }
  143. }
  144. SYSFS_SPRSETUP_SHOW_STORE(dscr);
  145. static DEVICE_ATTR(dscr, 0600, show_dscr, store_dscr);
  146. static void add_write_permission_dev_attr(struct device_attribute *attr)
  147. {
  148. attr->attr.mode |= 0200;
  149. }
  150. /**
  151. * show_dscr_default() - Fetch the system wide DSCR default
  152. * @dev: Device structure
  153. * @attr: Device attribute structure
  154. * @buf: Interface buffer
  155. *
  156. * This function returns the system wide DSCR default value.
  157. */
  158. static ssize_t show_dscr_default(struct device *dev,
  159. struct device_attribute *attr, char *buf)
  160. {
  161. return sprintf(buf, "%lx\n", dscr_default);
  162. }
  163. /**
  164. * store_dscr_default() - Update the system wide DSCR default
  165. * @dev: Device structure
  166. * @attr: Device attribute structure
  167. * @buf: Interface buffer
  168. * @count: Size of the update
  169. *
  170. * This function updates the system wide DSCR default value.
  171. */
  172. static ssize_t __used store_dscr_default(struct device *dev,
  173. struct device_attribute *attr, const char *buf,
  174. size_t count)
  175. {
  176. unsigned long val;
  177. int ret = 0;
  178. ret = sscanf(buf, "%lx", &val);
  179. if (ret != 1)
  180. return -EINVAL;
  181. dscr_default = val;
  182. on_each_cpu(write_dscr, &val, 1);
  183. return count;
  184. }
  185. static DEVICE_ATTR(dscr_default, 0600,
  186. show_dscr_default, store_dscr_default);
  187. static void __init sysfs_create_dscr_default(void)
  188. {
  189. if (cpu_has_feature(CPU_FTR_DSCR)) {
  190. struct device *dev_root;
  191. int cpu;
  192. dscr_default = spr_default_dscr;
  193. for_each_possible_cpu(cpu)
  194. paca_ptrs[cpu]->dscr_default = dscr_default;
  195. dev_root = bus_get_dev_root(&cpu_subsys);
  196. if (dev_root) {
  197. device_create_file(dev_root, &dev_attr_dscr_default);
  198. put_device(dev_root);
  199. }
  200. }
  201. }
  202. #endif /* CONFIG_PPC64 */
  203. #ifdef CONFIG_PPC_E500
  204. #define MAX_BIT 63
  205. static u64 pw20_wt;
  206. static u64 altivec_idle_wt;
  207. static unsigned int get_idle_ticks_bit(u64 ns)
  208. {
  209. u64 cycle;
  210. if (ns >= 10000)
  211. cycle = div_u64(ns + 500, 1000) * tb_ticks_per_usec;
  212. else
  213. cycle = div_u64(ns * tb_ticks_per_usec, 1000);
  214. if (!cycle)
  215. return 0;
  216. return ilog2(cycle);
  217. }
  218. static void do_show_pwrmgtcr0(void *val)
  219. {
  220. u32 *value = val;
  221. *value = mfspr(SPRN_PWRMGTCR0);
  222. }
  223. static ssize_t show_pw20_state(struct device *dev,
  224. struct device_attribute *attr, char *buf)
  225. {
  226. u32 value;
  227. unsigned int cpu = dev->id;
  228. smp_call_function_single(cpu, do_show_pwrmgtcr0, &value, 1);
  229. value &= PWRMGTCR0_PW20_WAIT;
  230. return sprintf(buf, "%u\n", value ? 1 : 0);
  231. }
  232. static void do_store_pw20_state(void *val)
  233. {
  234. u32 *value = val;
  235. u32 pw20_state;
  236. pw20_state = mfspr(SPRN_PWRMGTCR0);
  237. if (*value)
  238. pw20_state |= PWRMGTCR0_PW20_WAIT;
  239. else
  240. pw20_state &= ~PWRMGTCR0_PW20_WAIT;
  241. mtspr(SPRN_PWRMGTCR0, pw20_state);
  242. }
  243. static ssize_t store_pw20_state(struct device *dev,
  244. struct device_attribute *attr,
  245. const char *buf, size_t count)
  246. {
  247. u32 value;
  248. unsigned int cpu = dev->id;
  249. if (kstrtou32(buf, 0, &value))
  250. return -EINVAL;
  251. if (value > 1)
  252. return -EINVAL;
  253. smp_call_function_single(cpu, do_store_pw20_state, &value, 1);
  254. return count;
  255. }
  256. static ssize_t show_pw20_wait_time(struct device *dev,
  257. struct device_attribute *attr, char *buf)
  258. {
  259. u32 value;
  260. u64 tb_cycle = 1;
  261. u64 time;
  262. unsigned int cpu = dev->id;
  263. if (!pw20_wt) {
  264. smp_call_function_single(cpu, do_show_pwrmgtcr0, &value, 1);
  265. value = (value & PWRMGTCR0_PW20_ENT) >>
  266. PWRMGTCR0_PW20_ENT_SHIFT;
  267. tb_cycle = (tb_cycle << (MAX_BIT - value + 1));
  268. /* convert ms to ns */
  269. if (tb_ticks_per_usec > 1000) {
  270. time = div_u64(tb_cycle, tb_ticks_per_usec / 1000);
  271. } else {
  272. u32 rem_us;
  273. time = div_u64_rem(tb_cycle, tb_ticks_per_usec,
  274. &rem_us);
  275. time = time * 1000 + rem_us * 1000 / tb_ticks_per_usec;
  276. }
  277. } else {
  278. time = pw20_wt;
  279. }
  280. return sprintf(buf, "%llu\n", time > 0 ? time : 0);
  281. }
  282. static void set_pw20_wait_entry_bit(void *val)
  283. {
  284. u32 *value = val;
  285. u32 pw20_idle;
  286. pw20_idle = mfspr(SPRN_PWRMGTCR0);
  287. /* Set Automatic PW20 Core Idle Count */
  288. /* clear count */
  289. pw20_idle &= ~PWRMGTCR0_PW20_ENT;
  290. /* set count */
  291. pw20_idle |= ((MAX_BIT - *value) << PWRMGTCR0_PW20_ENT_SHIFT);
  292. mtspr(SPRN_PWRMGTCR0, pw20_idle);
  293. }
  294. static ssize_t store_pw20_wait_time(struct device *dev,
  295. struct device_attribute *attr,
  296. const char *buf, size_t count)
  297. {
  298. u32 entry_bit;
  299. u64 value;
  300. unsigned int cpu = dev->id;
  301. if (kstrtou64(buf, 0, &value))
  302. return -EINVAL;
  303. if (!value)
  304. return -EINVAL;
  305. entry_bit = get_idle_ticks_bit(value);
  306. if (entry_bit > MAX_BIT)
  307. return -EINVAL;
  308. pw20_wt = value;
  309. smp_call_function_single(cpu, set_pw20_wait_entry_bit,
  310. &entry_bit, 1);
  311. return count;
  312. }
  313. static ssize_t show_altivec_idle(struct device *dev,
  314. struct device_attribute *attr, char *buf)
  315. {
  316. u32 value;
  317. unsigned int cpu = dev->id;
  318. smp_call_function_single(cpu, do_show_pwrmgtcr0, &value, 1);
  319. value &= PWRMGTCR0_AV_IDLE_PD_EN;
  320. return sprintf(buf, "%u\n", value ? 1 : 0);
  321. }
  322. static void do_store_altivec_idle(void *val)
  323. {
  324. u32 *value = val;
  325. u32 altivec_idle;
  326. altivec_idle = mfspr(SPRN_PWRMGTCR0);
  327. if (*value)
  328. altivec_idle |= PWRMGTCR0_AV_IDLE_PD_EN;
  329. else
  330. altivec_idle &= ~PWRMGTCR0_AV_IDLE_PD_EN;
  331. mtspr(SPRN_PWRMGTCR0, altivec_idle);
  332. }
  333. static ssize_t store_altivec_idle(struct device *dev,
  334. struct device_attribute *attr,
  335. const char *buf, size_t count)
  336. {
  337. u32 value;
  338. unsigned int cpu = dev->id;
  339. if (kstrtou32(buf, 0, &value))
  340. return -EINVAL;
  341. if (value > 1)
  342. return -EINVAL;
  343. smp_call_function_single(cpu, do_store_altivec_idle, &value, 1);
  344. return count;
  345. }
  346. static ssize_t show_altivec_idle_wait_time(struct device *dev,
  347. struct device_attribute *attr, char *buf)
  348. {
  349. u32 value;
  350. u64 tb_cycle = 1;
  351. u64 time;
  352. unsigned int cpu = dev->id;
  353. if (!altivec_idle_wt) {
  354. smp_call_function_single(cpu, do_show_pwrmgtcr0, &value, 1);
  355. value = (value & PWRMGTCR0_AV_IDLE_CNT) >>
  356. PWRMGTCR0_AV_IDLE_CNT_SHIFT;
  357. tb_cycle = (tb_cycle << (MAX_BIT - value + 1));
  358. /* convert ms to ns */
  359. if (tb_ticks_per_usec > 1000) {
  360. time = div_u64(tb_cycle, tb_ticks_per_usec / 1000);
  361. } else {
  362. u32 rem_us;
  363. time = div_u64_rem(tb_cycle, tb_ticks_per_usec,
  364. &rem_us);
  365. time = time * 1000 + rem_us * 1000 / tb_ticks_per_usec;
  366. }
  367. } else {
  368. time = altivec_idle_wt;
  369. }
  370. return sprintf(buf, "%llu\n", time > 0 ? time : 0);
  371. }
  372. static void set_altivec_idle_wait_entry_bit(void *val)
  373. {
  374. u32 *value = val;
  375. u32 altivec_idle;
  376. altivec_idle = mfspr(SPRN_PWRMGTCR0);
  377. /* Set Automatic AltiVec Idle Count */
  378. /* clear count */
  379. altivec_idle &= ~PWRMGTCR0_AV_IDLE_CNT;
  380. /* set count */
  381. altivec_idle |= ((MAX_BIT - *value) << PWRMGTCR0_AV_IDLE_CNT_SHIFT);
  382. mtspr(SPRN_PWRMGTCR0, altivec_idle);
  383. }
  384. static ssize_t store_altivec_idle_wait_time(struct device *dev,
  385. struct device_attribute *attr,
  386. const char *buf, size_t count)
  387. {
  388. u32 entry_bit;
  389. u64 value;
  390. unsigned int cpu = dev->id;
  391. if (kstrtou64(buf, 0, &value))
  392. return -EINVAL;
  393. if (!value)
  394. return -EINVAL;
  395. entry_bit = get_idle_ticks_bit(value);
  396. if (entry_bit > MAX_BIT)
  397. return -EINVAL;
  398. altivec_idle_wt = value;
  399. smp_call_function_single(cpu, set_altivec_idle_wait_entry_bit,
  400. &entry_bit, 1);
  401. return count;
  402. }
  403. /*
  404. * Enable/Disable interface:
  405. * 0, disable. 1, enable.
  406. */
  407. static DEVICE_ATTR(pw20_state, 0600, show_pw20_state, store_pw20_state);
  408. static DEVICE_ATTR(altivec_idle, 0600, show_altivec_idle, store_altivec_idle);
  409. /*
  410. * Set wait time interface:(Nanosecond)
  411. * Example: Base on TBfreq is 41MHZ.
  412. * 1~48(ns): TB[63]
  413. * 49~97(ns): TB[62]
  414. * 98~195(ns): TB[61]
  415. * 196~390(ns): TB[60]
  416. * 391~780(ns): TB[59]
  417. * 781~1560(ns): TB[58]
  418. * ...
  419. */
  420. static DEVICE_ATTR(pw20_wait_time, 0600,
  421. show_pw20_wait_time,
  422. store_pw20_wait_time);
  423. static DEVICE_ATTR(altivec_idle_wait_time, 0600,
  424. show_altivec_idle_wait_time,
  425. store_altivec_idle_wait_time);
  426. #endif
  427. /*
  428. * Enabling PMCs will slow partition context switch times so we only do
  429. * it the first time we write to the PMCs.
  430. */
  431. static DEFINE_PER_CPU(char, pmcs_enabled);
  432. void ppc_enable_pmcs(void)
  433. {
  434. ppc_set_pmu_inuse(1);
  435. /* Only need to enable them once */
  436. if (__this_cpu_read(pmcs_enabled))
  437. return;
  438. __this_cpu_write(pmcs_enabled, 1);
  439. if (ppc_md.enable_pmcs)
  440. ppc_md.enable_pmcs();
  441. }
  442. EXPORT_SYMBOL(ppc_enable_pmcs);
  443. /* Let's define all possible registers, we'll only hook up the ones
  444. * that are implemented on the current processor
  445. */
  446. #ifdef CONFIG_PMU_SYSFS
  447. #if defined(CONFIG_PPC64) || defined(CONFIG_PPC_BOOK3S_32)
  448. #define HAS_PPC_PMC_CLASSIC 1
  449. #define HAS_PPC_PMC_IBM 1
  450. #endif
  451. #ifdef CONFIG_PPC64
  452. #define HAS_PPC_PMC_PA6T 1
  453. #define HAS_PPC_PMC56 1
  454. #endif
  455. #ifdef CONFIG_PPC_BOOK3S_32
  456. #define HAS_PPC_PMC_G4 1
  457. #endif
  458. #endif /* CONFIG_PMU_SYSFS */
  459. #if defined(CONFIG_PPC64) && defined(CONFIG_DEBUG_MISC)
  460. #define HAS_PPC_PA6T
  461. #endif
  462. /*
  463. * SPRs which are not related to PMU.
  464. */
  465. #ifdef CONFIG_PPC64
  466. SYSFS_SPRSETUP(purr, SPRN_PURR);
  467. SYSFS_SPRSETUP(spurr, SPRN_SPURR);
  468. SYSFS_SPRSETUP(pir, SPRN_PIR);
  469. SYSFS_SPRSETUP(tscr, SPRN_TSCR);
  470. /*
  471. Lets only enable read for phyp resources and
  472. enable write when needed with a separate function.
  473. Lets be conservative and default to pseries.
  474. */
  475. static DEVICE_ATTR(spurr, 0400, show_spurr, NULL);
  476. static DEVICE_ATTR(purr, 0400, show_purr, store_purr);
  477. static DEVICE_ATTR(pir, 0400, show_pir, NULL);
  478. static DEVICE_ATTR(tscr, 0600, show_tscr, store_tscr);
  479. #endif /* CONFIG_PPC64 */
  480. #ifdef HAS_PPC_PMC_CLASSIC
  481. SYSFS_PMCSETUP(mmcr0, SPRN_MMCR0);
  482. SYSFS_PMCSETUP(mmcr1, SPRN_MMCR1);
  483. SYSFS_PMCSETUP(pmc1, SPRN_PMC1);
  484. SYSFS_PMCSETUP(pmc2, SPRN_PMC2);
  485. SYSFS_PMCSETUP(pmc3, SPRN_PMC3);
  486. SYSFS_PMCSETUP(pmc4, SPRN_PMC4);
  487. SYSFS_PMCSETUP(pmc5, SPRN_PMC5);
  488. SYSFS_PMCSETUP(pmc6, SPRN_PMC6);
  489. #endif
  490. #ifdef HAS_PPC_PMC_G4
  491. SYSFS_PMCSETUP(mmcr2, SPRN_MMCR2);
  492. #endif
  493. #ifdef HAS_PPC_PMC56
  494. SYSFS_PMCSETUP(pmc7, SPRN_PMC7);
  495. SYSFS_PMCSETUP(pmc8, SPRN_PMC8);
  496. SYSFS_PMCSETUP(mmcra, SPRN_MMCRA);
  497. SYSFS_PMCSETUP(mmcr3, SPRN_MMCR3);
  498. static DEVICE_ATTR(mmcra, 0600, show_mmcra, store_mmcra);
  499. static DEVICE_ATTR(mmcr3, 0600, show_mmcr3, store_mmcr3);
  500. #endif /* HAS_PPC_PMC56 */
  501. #ifdef HAS_PPC_PMC_PA6T
  502. SYSFS_PMCSETUP(pa6t_pmc0, SPRN_PA6T_PMC0);
  503. SYSFS_PMCSETUP(pa6t_pmc1, SPRN_PA6T_PMC1);
  504. SYSFS_PMCSETUP(pa6t_pmc2, SPRN_PA6T_PMC2);
  505. SYSFS_PMCSETUP(pa6t_pmc3, SPRN_PA6T_PMC3);
  506. SYSFS_PMCSETUP(pa6t_pmc4, SPRN_PA6T_PMC4);
  507. SYSFS_PMCSETUP(pa6t_pmc5, SPRN_PA6T_PMC5);
  508. #endif
  509. #ifdef HAS_PPC_PA6T
  510. SYSFS_SPRSETUP(hid0, SPRN_HID0);
  511. SYSFS_SPRSETUP(hid1, SPRN_HID1);
  512. SYSFS_SPRSETUP(hid4, SPRN_HID4);
  513. SYSFS_SPRSETUP(hid5, SPRN_HID5);
  514. SYSFS_SPRSETUP(ima0, SPRN_PA6T_IMA0);
  515. SYSFS_SPRSETUP(ima1, SPRN_PA6T_IMA1);
  516. SYSFS_SPRSETUP(ima2, SPRN_PA6T_IMA2);
  517. SYSFS_SPRSETUP(ima3, SPRN_PA6T_IMA3);
  518. SYSFS_SPRSETUP(ima4, SPRN_PA6T_IMA4);
  519. SYSFS_SPRSETUP(ima5, SPRN_PA6T_IMA5);
  520. SYSFS_SPRSETUP(ima6, SPRN_PA6T_IMA6);
  521. SYSFS_SPRSETUP(ima7, SPRN_PA6T_IMA7);
  522. SYSFS_SPRSETUP(ima8, SPRN_PA6T_IMA8);
  523. SYSFS_SPRSETUP(ima9, SPRN_PA6T_IMA9);
  524. SYSFS_SPRSETUP(imaat, SPRN_PA6T_IMAAT);
  525. SYSFS_SPRSETUP(btcr, SPRN_PA6T_BTCR);
  526. SYSFS_SPRSETUP(pccr, SPRN_PA6T_PCCR);
  527. SYSFS_SPRSETUP(rpccr, SPRN_PA6T_RPCCR);
  528. SYSFS_SPRSETUP(der, SPRN_PA6T_DER);
  529. SYSFS_SPRSETUP(mer, SPRN_PA6T_MER);
  530. SYSFS_SPRSETUP(ber, SPRN_PA6T_BER);
  531. SYSFS_SPRSETUP(ier, SPRN_PA6T_IER);
  532. SYSFS_SPRSETUP(sier, SPRN_PA6T_SIER);
  533. SYSFS_SPRSETUP(siar, SPRN_PA6T_SIAR);
  534. SYSFS_SPRSETUP(tsr0, SPRN_PA6T_TSR0);
  535. SYSFS_SPRSETUP(tsr1, SPRN_PA6T_TSR1);
  536. SYSFS_SPRSETUP(tsr2, SPRN_PA6T_TSR2);
  537. SYSFS_SPRSETUP(tsr3, SPRN_PA6T_TSR3);
  538. #endif /* HAS_PPC_PA6T */
  539. #ifdef HAS_PPC_PMC_IBM
  540. static struct device_attribute ibm_common_attrs[] = {
  541. __ATTR(mmcr0, 0600, show_mmcr0, store_mmcr0),
  542. __ATTR(mmcr1, 0600, show_mmcr1, store_mmcr1),
  543. };
  544. #endif /* HAS_PPC_PMC_IBM */
  545. #ifdef HAS_PPC_PMC_G4
  546. static struct device_attribute g4_common_attrs[] = {
  547. __ATTR(mmcr0, 0600, show_mmcr0, store_mmcr0),
  548. __ATTR(mmcr1, 0600, show_mmcr1, store_mmcr1),
  549. __ATTR(mmcr2, 0600, show_mmcr2, store_mmcr2),
  550. };
  551. #endif /* HAS_PPC_PMC_G4 */
  552. #ifdef HAS_PPC_PMC_CLASSIC
  553. static struct device_attribute classic_pmc_attrs[] = {
  554. __ATTR(pmc1, 0600, show_pmc1, store_pmc1),
  555. __ATTR(pmc2, 0600, show_pmc2, store_pmc2),
  556. __ATTR(pmc3, 0600, show_pmc3, store_pmc3),
  557. __ATTR(pmc4, 0600, show_pmc4, store_pmc4),
  558. __ATTR(pmc5, 0600, show_pmc5, store_pmc5),
  559. __ATTR(pmc6, 0600, show_pmc6, store_pmc6),
  560. #ifdef HAS_PPC_PMC56
  561. __ATTR(pmc7, 0600, show_pmc7, store_pmc7),
  562. __ATTR(pmc8, 0600, show_pmc8, store_pmc8),
  563. #endif
  564. };
  565. #endif
  566. #if defined(HAS_PPC_PMC_PA6T) || defined(HAS_PPC_PA6T)
  567. static struct device_attribute pa6t_attrs[] = {
  568. #ifdef HAS_PPC_PMC_PA6T
  569. __ATTR(mmcr0, 0600, show_mmcr0, store_mmcr0),
  570. __ATTR(mmcr1, 0600, show_mmcr1, store_mmcr1),
  571. __ATTR(pmc0, 0600, show_pa6t_pmc0, store_pa6t_pmc0),
  572. __ATTR(pmc1, 0600, show_pa6t_pmc1, store_pa6t_pmc1),
  573. __ATTR(pmc2, 0600, show_pa6t_pmc2, store_pa6t_pmc2),
  574. __ATTR(pmc3, 0600, show_pa6t_pmc3, store_pa6t_pmc3),
  575. __ATTR(pmc4, 0600, show_pa6t_pmc4, store_pa6t_pmc4),
  576. __ATTR(pmc5, 0600, show_pa6t_pmc5, store_pa6t_pmc5),
  577. #endif
  578. #ifdef HAS_PPC_PA6T
  579. __ATTR(hid0, 0600, show_hid0, store_hid0),
  580. __ATTR(hid1, 0600, show_hid1, store_hid1),
  581. __ATTR(hid4, 0600, show_hid4, store_hid4),
  582. __ATTR(hid5, 0600, show_hid5, store_hid5),
  583. __ATTR(ima0, 0600, show_ima0, store_ima0),
  584. __ATTR(ima1, 0600, show_ima1, store_ima1),
  585. __ATTR(ima2, 0600, show_ima2, store_ima2),
  586. __ATTR(ima3, 0600, show_ima3, store_ima3),
  587. __ATTR(ima4, 0600, show_ima4, store_ima4),
  588. __ATTR(ima5, 0600, show_ima5, store_ima5),
  589. __ATTR(ima6, 0600, show_ima6, store_ima6),
  590. __ATTR(ima7, 0600, show_ima7, store_ima7),
  591. __ATTR(ima8, 0600, show_ima8, store_ima8),
  592. __ATTR(ima9, 0600, show_ima9, store_ima9),
  593. __ATTR(imaat, 0600, show_imaat, store_imaat),
  594. __ATTR(btcr, 0600, show_btcr, store_btcr),
  595. __ATTR(pccr, 0600, show_pccr, store_pccr),
  596. __ATTR(rpccr, 0600, show_rpccr, store_rpccr),
  597. __ATTR(der, 0600, show_der, store_der),
  598. __ATTR(mer, 0600, show_mer, store_mer),
  599. __ATTR(ber, 0600, show_ber, store_ber),
  600. __ATTR(ier, 0600, show_ier, store_ier),
  601. __ATTR(sier, 0600, show_sier, store_sier),
  602. __ATTR(siar, 0600, show_siar, store_siar),
  603. __ATTR(tsr0, 0600, show_tsr0, store_tsr0),
  604. __ATTR(tsr1, 0600, show_tsr1, store_tsr1),
  605. __ATTR(tsr2, 0600, show_tsr2, store_tsr2),
  606. __ATTR(tsr3, 0600, show_tsr3, store_tsr3),
  607. #endif /* HAS_PPC_PA6T */
  608. };
  609. #endif
  610. #ifdef CONFIG_PPC_SVM
  611. static ssize_t show_svm(struct device *dev, struct device_attribute *attr, char *buf)
  612. {
  613. return sprintf(buf, "%u\n", is_secure_guest());
  614. }
  615. static DEVICE_ATTR(svm, 0444, show_svm, NULL);
  616. static void __init create_svm_file(void)
  617. {
  618. struct device *dev_root = bus_get_dev_root(&cpu_subsys);
  619. if (dev_root) {
  620. device_create_file(dev_root, &dev_attr_svm);
  621. put_device(dev_root);
  622. }
  623. }
  624. #else
  625. static void __init create_svm_file(void)
  626. {
  627. }
  628. #endif /* CONFIG_PPC_SVM */
  629. #ifdef CONFIG_PPC_PSERIES
  630. static void read_idle_purr(void *val)
  631. {
  632. u64 *ret = val;
  633. *ret = read_this_idle_purr();
  634. }
  635. static ssize_t idle_purr_show(struct device *dev,
  636. struct device_attribute *attr, char *buf)
  637. {
  638. struct cpu *cpu = container_of(dev, struct cpu, dev);
  639. u64 val;
  640. smp_call_function_single(cpu->dev.id, read_idle_purr, &val, 1);
  641. return sprintf(buf, "%llx\n", val);
  642. }
  643. static DEVICE_ATTR(idle_purr, 0400, idle_purr_show, NULL);
  644. static void create_idle_purr_file(struct device *s)
  645. {
  646. if (firmware_has_feature(FW_FEATURE_LPAR))
  647. device_create_file(s, &dev_attr_idle_purr);
  648. }
  649. static void remove_idle_purr_file(struct device *s)
  650. {
  651. if (firmware_has_feature(FW_FEATURE_LPAR))
  652. device_remove_file(s, &dev_attr_idle_purr);
  653. }
  654. static void read_idle_spurr(void *val)
  655. {
  656. u64 *ret = val;
  657. *ret = read_this_idle_spurr();
  658. }
  659. static ssize_t idle_spurr_show(struct device *dev,
  660. struct device_attribute *attr, char *buf)
  661. {
  662. struct cpu *cpu = container_of(dev, struct cpu, dev);
  663. u64 val;
  664. smp_call_function_single(cpu->dev.id, read_idle_spurr, &val, 1);
  665. return sprintf(buf, "%llx\n", val);
  666. }
  667. static DEVICE_ATTR(idle_spurr, 0400, idle_spurr_show, NULL);
  668. static void create_idle_spurr_file(struct device *s)
  669. {
  670. if (firmware_has_feature(FW_FEATURE_LPAR))
  671. device_create_file(s, &dev_attr_idle_spurr);
  672. }
  673. static void remove_idle_spurr_file(struct device *s)
  674. {
  675. if (firmware_has_feature(FW_FEATURE_LPAR))
  676. device_remove_file(s, &dev_attr_idle_spurr);
  677. }
  678. #else /* CONFIG_PPC_PSERIES */
  679. #define create_idle_purr_file(s)
  680. #define remove_idle_purr_file(s)
  681. #define create_idle_spurr_file(s)
  682. #define remove_idle_spurr_file(s)
  683. #endif /* CONFIG_PPC_PSERIES */
  684. static int register_cpu_online(unsigned int cpu)
  685. {
  686. struct cpu *c = &per_cpu(cpu_devices, cpu);
  687. struct device *s = &c->dev;
  688. struct device_attribute *attrs, *pmc_attrs;
  689. int i, nattrs;
  690. /* For cpus present at boot a reference was already grabbed in register_cpu() */
  691. if (!s->of_node)
  692. s->of_node = of_get_cpu_node(cpu, NULL);
  693. #ifdef CONFIG_PPC64
  694. if (cpu_has_feature(CPU_FTR_SMT))
  695. device_create_file(s, &dev_attr_smt_snooze_delay);
  696. #endif
  697. /* PMC stuff */
  698. switch (cur_cpu_spec->pmc_type) {
  699. #ifdef HAS_PPC_PMC_IBM
  700. case PPC_PMC_IBM:
  701. attrs = ibm_common_attrs;
  702. nattrs = ARRAY_SIZE(ibm_common_attrs);
  703. pmc_attrs = classic_pmc_attrs;
  704. break;
  705. #endif /* HAS_PPC_PMC_IBM */
  706. #ifdef HAS_PPC_PMC_G4
  707. case PPC_PMC_G4:
  708. attrs = g4_common_attrs;
  709. nattrs = ARRAY_SIZE(g4_common_attrs);
  710. pmc_attrs = classic_pmc_attrs;
  711. break;
  712. #endif /* HAS_PPC_PMC_G4 */
  713. #if defined(HAS_PPC_PMC_PA6T) || defined(HAS_PPC_PA6T)
  714. case PPC_PMC_PA6T:
  715. /* PA Semi starts counting at PMC0 */
  716. attrs = pa6t_attrs;
  717. nattrs = ARRAY_SIZE(pa6t_attrs);
  718. pmc_attrs = NULL;
  719. break;
  720. #endif
  721. default:
  722. attrs = NULL;
  723. nattrs = 0;
  724. pmc_attrs = NULL;
  725. }
  726. for (i = 0; i < nattrs; i++)
  727. device_create_file(s, &attrs[i]);
  728. if (pmc_attrs)
  729. for (i = 0; i < cur_cpu_spec->num_pmcs; i++)
  730. device_create_file(s, &pmc_attrs[i]);
  731. #ifdef CONFIG_PPC64
  732. #ifdef CONFIG_PMU_SYSFS
  733. if (cpu_has_feature(CPU_FTR_MMCRA))
  734. device_create_file(s, &dev_attr_mmcra);
  735. if (cpu_has_feature(CPU_FTR_ARCH_31))
  736. device_create_file(s, &dev_attr_mmcr3);
  737. #endif /* CONFIG_PMU_SYSFS */
  738. if (cpu_has_feature(CPU_FTR_PURR)) {
  739. if (!firmware_has_feature(FW_FEATURE_LPAR))
  740. add_write_permission_dev_attr(&dev_attr_purr);
  741. device_create_file(s, &dev_attr_purr);
  742. create_idle_purr_file(s);
  743. }
  744. if (cpu_has_feature(CPU_FTR_SPURR)) {
  745. device_create_file(s, &dev_attr_spurr);
  746. create_idle_spurr_file(s);
  747. }
  748. if (cpu_has_feature(CPU_FTR_DSCR))
  749. device_create_file(s, &dev_attr_dscr);
  750. if (cpu_has_feature(CPU_FTR_PPCAS_ARCH_V2))
  751. device_create_file(s, &dev_attr_pir);
  752. if (cpu_has_feature(CPU_FTR_ARCH_206) &&
  753. !firmware_has_feature(FW_FEATURE_LPAR))
  754. device_create_file(s, &dev_attr_tscr);
  755. #endif /* CONFIG_PPC64 */
  756. #ifdef CONFIG_PPC_E500
  757. if (PVR_VER(cur_cpu_spec->pvr_value) == PVR_VER_E6500) {
  758. device_create_file(s, &dev_attr_pw20_state);
  759. device_create_file(s, &dev_attr_pw20_wait_time);
  760. device_create_file(s, &dev_attr_altivec_idle);
  761. device_create_file(s, &dev_attr_altivec_idle_wait_time);
  762. }
  763. #endif
  764. cacheinfo_cpu_online(cpu);
  765. return 0;
  766. }
  767. #ifdef CONFIG_HOTPLUG_CPU
  768. static int unregister_cpu_online(unsigned int cpu)
  769. {
  770. struct cpu *c = &per_cpu(cpu_devices, cpu);
  771. struct device *s = &c->dev;
  772. struct device_attribute *attrs, *pmc_attrs;
  773. int i, nattrs;
  774. if (WARN_RATELIMIT(!c->hotpluggable, "cpu %d can't be offlined\n", cpu))
  775. return -EBUSY;
  776. #ifdef CONFIG_PPC64
  777. if (cpu_has_feature(CPU_FTR_SMT))
  778. device_remove_file(s, &dev_attr_smt_snooze_delay);
  779. #endif
  780. /* PMC stuff */
  781. switch (cur_cpu_spec->pmc_type) {
  782. #ifdef HAS_PPC_PMC_IBM
  783. case PPC_PMC_IBM:
  784. attrs = ibm_common_attrs;
  785. nattrs = ARRAY_SIZE(ibm_common_attrs);
  786. pmc_attrs = classic_pmc_attrs;
  787. break;
  788. #endif /* HAS_PPC_PMC_IBM */
  789. #ifdef HAS_PPC_PMC_G4
  790. case PPC_PMC_G4:
  791. attrs = g4_common_attrs;
  792. nattrs = ARRAY_SIZE(g4_common_attrs);
  793. pmc_attrs = classic_pmc_attrs;
  794. break;
  795. #endif /* HAS_PPC_PMC_G4 */
  796. #if defined(HAS_PPC_PMC_PA6T) || defined(HAS_PPC_PA6T)
  797. case PPC_PMC_PA6T:
  798. /* PA Semi starts counting at PMC0 */
  799. attrs = pa6t_attrs;
  800. nattrs = ARRAY_SIZE(pa6t_attrs);
  801. pmc_attrs = NULL;
  802. break;
  803. #endif
  804. default:
  805. attrs = NULL;
  806. nattrs = 0;
  807. pmc_attrs = NULL;
  808. }
  809. for (i = 0; i < nattrs; i++)
  810. device_remove_file(s, &attrs[i]);
  811. if (pmc_attrs)
  812. for (i = 0; i < cur_cpu_spec->num_pmcs; i++)
  813. device_remove_file(s, &pmc_attrs[i]);
  814. #ifdef CONFIG_PPC64
  815. #ifdef CONFIG_PMU_SYSFS
  816. if (cpu_has_feature(CPU_FTR_MMCRA))
  817. device_remove_file(s, &dev_attr_mmcra);
  818. if (cpu_has_feature(CPU_FTR_ARCH_31))
  819. device_remove_file(s, &dev_attr_mmcr3);
  820. #endif /* CONFIG_PMU_SYSFS */
  821. if (cpu_has_feature(CPU_FTR_PURR)) {
  822. device_remove_file(s, &dev_attr_purr);
  823. remove_idle_purr_file(s);
  824. }
  825. if (cpu_has_feature(CPU_FTR_SPURR)) {
  826. device_remove_file(s, &dev_attr_spurr);
  827. remove_idle_spurr_file(s);
  828. }
  829. if (cpu_has_feature(CPU_FTR_DSCR))
  830. device_remove_file(s, &dev_attr_dscr);
  831. if (cpu_has_feature(CPU_FTR_PPCAS_ARCH_V2))
  832. device_remove_file(s, &dev_attr_pir);
  833. if (cpu_has_feature(CPU_FTR_ARCH_206) &&
  834. !firmware_has_feature(FW_FEATURE_LPAR))
  835. device_remove_file(s, &dev_attr_tscr);
  836. #endif /* CONFIG_PPC64 */
  837. #ifdef CONFIG_PPC_E500
  838. if (PVR_VER(cur_cpu_spec->pvr_value) == PVR_VER_E6500) {
  839. device_remove_file(s, &dev_attr_pw20_state);
  840. device_remove_file(s, &dev_attr_pw20_wait_time);
  841. device_remove_file(s, &dev_attr_altivec_idle);
  842. device_remove_file(s, &dev_attr_altivec_idle_wait_time);
  843. }
  844. #endif
  845. cacheinfo_cpu_offline(cpu);
  846. of_node_put(s->of_node);
  847. s->of_node = NULL;
  848. return 0;
  849. }
  850. #else /* !CONFIG_HOTPLUG_CPU */
  851. #define unregister_cpu_online NULL
  852. #endif
  853. #ifdef CONFIG_ARCH_CPU_PROBE_RELEASE
  854. ssize_t arch_cpu_probe(const char *buf, size_t count)
  855. {
  856. if (ppc_md.cpu_probe)
  857. return ppc_md.cpu_probe(buf, count);
  858. return -EINVAL;
  859. }
  860. ssize_t arch_cpu_release(const char *buf, size_t count)
  861. {
  862. if (ppc_md.cpu_release)
  863. return ppc_md.cpu_release(buf, count);
  864. return -EINVAL;
  865. }
  866. #endif /* CONFIG_ARCH_CPU_PROBE_RELEASE */
  867. static DEFINE_MUTEX(cpu_mutex);
  868. int cpu_add_dev_attr(struct device_attribute *attr)
  869. {
  870. int cpu;
  871. mutex_lock(&cpu_mutex);
  872. for_each_possible_cpu(cpu) {
  873. device_create_file(get_cpu_device(cpu), attr);
  874. }
  875. mutex_unlock(&cpu_mutex);
  876. return 0;
  877. }
  878. EXPORT_SYMBOL_GPL(cpu_add_dev_attr);
  879. int cpu_add_dev_attr_group(struct attribute_group *attrs)
  880. {
  881. int cpu;
  882. struct device *dev;
  883. int ret;
  884. mutex_lock(&cpu_mutex);
  885. for_each_possible_cpu(cpu) {
  886. dev = get_cpu_device(cpu);
  887. ret = sysfs_create_group(&dev->kobj, attrs);
  888. WARN_ON(ret != 0);
  889. }
  890. mutex_unlock(&cpu_mutex);
  891. return 0;
  892. }
  893. EXPORT_SYMBOL_GPL(cpu_add_dev_attr_group);
  894. void cpu_remove_dev_attr(struct device_attribute *attr)
  895. {
  896. int cpu;
  897. mutex_lock(&cpu_mutex);
  898. for_each_possible_cpu(cpu) {
  899. device_remove_file(get_cpu_device(cpu), attr);
  900. }
  901. mutex_unlock(&cpu_mutex);
  902. }
  903. EXPORT_SYMBOL_GPL(cpu_remove_dev_attr);
  904. void cpu_remove_dev_attr_group(struct attribute_group *attrs)
  905. {
  906. int cpu;
  907. struct device *dev;
  908. mutex_lock(&cpu_mutex);
  909. for_each_possible_cpu(cpu) {
  910. dev = get_cpu_device(cpu);
  911. sysfs_remove_group(&dev->kobj, attrs);
  912. }
  913. mutex_unlock(&cpu_mutex);
  914. }
  915. EXPORT_SYMBOL_GPL(cpu_remove_dev_attr_group);
  916. /* NUMA stuff */
  917. #ifdef CONFIG_NUMA
  918. int sysfs_add_device_to_node(struct device *dev, int nid)
  919. {
  920. struct node *node = node_devices[nid];
  921. return sysfs_create_link(&node->dev.kobj, &dev->kobj,
  922. kobject_name(&dev->kobj));
  923. }
  924. EXPORT_SYMBOL_GPL(sysfs_add_device_to_node);
  925. void sysfs_remove_device_from_node(struct device *dev, int nid)
  926. {
  927. struct node *node = node_devices[nid];
  928. sysfs_remove_link(&node->dev.kobj, kobject_name(&dev->kobj));
  929. }
  930. EXPORT_SYMBOL_GPL(sysfs_remove_device_from_node);
  931. #endif
  932. /* Only valid if CPU is present. */
  933. static ssize_t show_physical_id(struct device *dev,
  934. struct device_attribute *attr, char *buf)
  935. {
  936. struct cpu *cpu = container_of(dev, struct cpu, dev);
  937. return sprintf(buf, "%d\n", get_hard_smp_processor_id(cpu->dev.id));
  938. }
  939. static DEVICE_ATTR(physical_id, 0444, show_physical_id, NULL);
  940. static int __init topology_init(void)
  941. {
  942. int cpu, r;
  943. for_each_possible_cpu(cpu) {
  944. struct cpu *c = &per_cpu(cpu_devices, cpu);
  945. #ifdef CONFIG_HOTPLUG_CPU
  946. /*
  947. * For now, we just see if the system supports making
  948. * the RTAS calls for CPU hotplug. But, there may be a
  949. * more comprehensive way to do this for an individual
  950. * CPU. For instance, the boot cpu might never be valid
  951. * for hotplugging.
  952. */
  953. if (smp_ops && smp_ops->cpu_offline_self)
  954. c->hotpluggable = 1;
  955. #endif
  956. if (cpu_online(cpu) || c->hotpluggable) {
  957. register_cpu(c, cpu);
  958. device_create_file(&c->dev, &dev_attr_physical_id);
  959. }
  960. }
  961. r = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "powerpc/topology:online",
  962. register_cpu_online, unregister_cpu_online);
  963. WARN_ON(r < 0);
  964. #ifdef CONFIG_PPC64
  965. sysfs_create_dscr_default();
  966. #endif /* CONFIG_PPC64 */
  967. create_svm_file();
  968. return 0;
  969. }
  970. subsys_initcall(topology_init);