setup_64.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681
  1. /*
  2. *
  3. * Common boot and setup code.
  4. *
  5. * Copyright (C) 2001 PPC64 Team, IBM Corp
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Public License
  9. * as published by the Free Software Foundation; either version
  10. * 2 of the License, or (at your option) any later version.
  11. */
  12. #undef DEBUG
  13. #include <linux/export.h>
  14. #include <linux/string.h>
  15. #include <linux/sched.h>
  16. #include <linux/init.h>
  17. #include <linux/kernel.h>
  18. #include <linux/reboot.h>
  19. #include <linux/delay.h>
  20. #include <linux/initrd.h>
  21. #include <linux/seq_file.h>
  22. #include <linux/ioport.h>
  23. #include <linux/console.h>
  24. #include <linux/utsname.h>
  25. #include <linux/tty.h>
  26. #include <linux/root_dev.h>
  27. #include <linux/notifier.h>
  28. #include <linux/cpu.h>
  29. #include <linux/unistd.h>
  30. #include <linux/serial.h>
  31. #include <linux/serial_8250.h>
  32. #include <linux/bootmem.h>
  33. #include <linux/pci.h>
  34. #include <linux/lockdep.h>
  35. #include <linux/memblock.h>
  36. #include <asm/io.h>
  37. #include <asm/kdump.h>
  38. #include <asm/prom.h>
  39. #include <asm/processor.h>
  40. #include <asm/pgtable.h>
  41. #include <asm/smp.h>
  42. #include <asm/elf.h>
  43. #include <asm/machdep.h>
  44. #include <asm/paca.h>
  45. #include <asm/time.h>
  46. #include <asm/cputable.h>
  47. #include <asm/sections.h>
  48. #include <asm/btext.h>
  49. #include <asm/nvram.h>
  50. #include <asm/setup.h>
  51. #include <asm/system.h>
  52. #include <asm/rtas.h>
  53. #include <asm/iommu.h>
  54. #include <asm/serial.h>
  55. #include <asm/cache.h>
  56. #include <asm/page.h>
  57. #include <asm/mmu.h>
  58. #include <asm/firmware.h>
  59. #include <asm/xmon.h>
  60. #include <asm/udbg.h>
  61. #include <asm/kexec.h>
  62. #include <asm/mmu_context.h>
  63. #include <asm/code-patching.h>
  64. #include <asm/kvm_ppc.h>
  65. #include "setup.h"
  66. #ifdef DEBUG
  67. #define DBG(fmt...) udbg_printf(fmt)
  68. #else
  69. #define DBG(fmt...)
  70. #endif
  71. int boot_cpuid = 0;
  72. int __initdata spinning_secondaries;
  73. u64 ppc64_pft_size;
  74. /* Pick defaults since we might want to patch instructions
  75. * before we've read this from the device tree.
  76. */
  77. struct ppc64_caches ppc64_caches = {
  78. .dline_size = 0x40,
  79. .log_dline_size = 6,
  80. .iline_size = 0x40,
  81. .log_iline_size = 6
  82. };
  83. EXPORT_SYMBOL_GPL(ppc64_caches);
  84. /*
  85. * These are used in binfmt_elf.c to put aux entries on the stack
  86. * for each elf executable being started.
  87. */
  88. int dcache_bsize;
  89. int icache_bsize;
  90. int ucache_bsize;
  91. #ifdef CONFIG_SMP
  92. static char *smt_enabled_cmdline;
  93. /* Look for ibm,smt-enabled OF option */
  94. static void check_smt_enabled(void)
  95. {
  96. struct device_node *dn;
  97. const char *smt_option;
  98. /* Default to enabling all threads */
  99. smt_enabled_at_boot = threads_per_core;
  100. /* Allow the command line to overrule the OF option */
  101. if (smt_enabled_cmdline) {
  102. if (!strcmp(smt_enabled_cmdline, "on"))
  103. smt_enabled_at_boot = threads_per_core;
  104. else if (!strcmp(smt_enabled_cmdline, "off"))
  105. smt_enabled_at_boot = 0;
  106. else {
  107. long smt;
  108. int rc;
  109. rc = strict_strtol(smt_enabled_cmdline, 10, &smt);
  110. if (!rc)
  111. smt_enabled_at_boot =
  112. min(threads_per_core, (int)smt);
  113. }
  114. } else {
  115. dn = of_find_node_by_path("/options");
  116. if (dn) {
  117. smt_option = of_get_property(dn, "ibm,smt-enabled",
  118. NULL);
  119. if (smt_option) {
  120. if (!strcmp(smt_option, "on"))
  121. smt_enabled_at_boot = threads_per_core;
  122. else if (!strcmp(smt_option, "off"))
  123. smt_enabled_at_boot = 0;
  124. }
  125. of_node_put(dn);
  126. }
  127. }
  128. }
  129. /* Look for smt-enabled= cmdline option */
  130. static int __init early_smt_enabled(char *p)
  131. {
  132. smt_enabled_cmdline = p;
  133. return 0;
  134. }
  135. early_param("smt-enabled", early_smt_enabled);
  136. #else
  137. #define check_smt_enabled()
  138. #endif /* CONFIG_SMP */
  139. /*
  140. * Early initialization entry point. This is called by head.S
  141. * with MMU translation disabled. We rely on the "feature" of
  142. * the CPU that ignores the top 2 bits of the address in real
  143. * mode so we can access kernel globals normally provided we
  144. * only toy with things in the RMO region. From here, we do
  145. * some early parsing of the device-tree to setup out MEMBLOCK
  146. * data structures, and allocate & initialize the hash table
  147. * and segment tables so we can start running with translation
  148. * enabled.
  149. *
  150. * It is this function which will call the probe() callback of
  151. * the various platform types and copy the matching one to the
  152. * global ppc_md structure. Your platform can eventually do
  153. * some very early initializations from the probe() routine, but
  154. * this is not recommended, be very careful as, for example, the
  155. * device-tree is not accessible via normal means at this point.
  156. */
  157. void __init early_setup(unsigned long dt_ptr)
  158. {
  159. /* -------- printk is _NOT_ safe to use here ! ------- */
  160. /* Identify CPU type */
  161. identify_cpu(0, mfspr(SPRN_PVR));
  162. /* Assume we're on cpu 0 for now. Don't write to the paca yet! */
  163. initialise_paca(&boot_paca, 0);
  164. setup_paca(&boot_paca);
  165. /* Initialize lockdep early or else spinlocks will blow */
  166. lockdep_init();
  167. /* -------- printk is now safe to use ------- */
  168. /* Enable early debugging if any specified (see udbg.h) */
  169. udbg_early_init();
  170. DBG(" -> early_setup(), dt_ptr: 0x%lx\n", dt_ptr);
  171. /*
  172. * Do early initialization using the flattened device
  173. * tree, such as retrieving the physical memory map or
  174. * calculating/retrieving the hash table size.
  175. */
  176. early_init_devtree(__va(dt_ptr));
  177. /* Now we know the logical id of our boot cpu, setup the paca. */
  178. setup_paca(&paca[boot_cpuid]);
  179. /* Fix up paca fields required for the boot cpu */
  180. get_paca()->cpu_start = 1;
  181. /* Probe the machine type */
  182. probe_machine();
  183. setup_kdump_trampoline();
  184. DBG("Found, Initializing memory management...\n");
  185. /* Initialize the hash table or TLB handling */
  186. early_init_mmu();
  187. DBG(" <- early_setup()\n");
  188. }
  189. #ifdef CONFIG_SMP
  190. void early_setup_secondary(void)
  191. {
  192. /* Mark interrupts enabled in PACA */
  193. get_paca()->soft_enabled = 0;
  194. /* Initialize the hash table or TLB handling */
  195. early_init_mmu_secondary();
  196. }
  197. #endif /* CONFIG_SMP */
  198. #if defined(CONFIG_SMP) || defined(CONFIG_KEXEC)
  199. void smp_release_cpus(void)
  200. {
  201. unsigned long *ptr;
  202. int i;
  203. DBG(" -> smp_release_cpus()\n");
  204. /* All secondary cpus are spinning on a common spinloop, release them
  205. * all now so they can start to spin on their individual paca
  206. * spinloops. For non SMP kernels, the secondary cpus never get out
  207. * of the common spinloop.
  208. */
  209. ptr = (unsigned long *)((unsigned long)&__secondary_hold_spinloop
  210. - PHYSICAL_START);
  211. *ptr = __pa(generic_secondary_smp_init);
  212. /* And wait a bit for them to catch up */
  213. for (i = 0; i < 100000; i++) {
  214. mb();
  215. HMT_low();
  216. if (spinning_secondaries == 0)
  217. break;
  218. udelay(1);
  219. }
  220. DBG("spinning_secondaries = %d\n", spinning_secondaries);
  221. DBG(" <- smp_release_cpus()\n");
  222. }
  223. #endif /* CONFIG_SMP || CONFIG_KEXEC */
  224. /*
  225. * Initialize some remaining members of the ppc64_caches and systemcfg
  226. * structures
  227. * (at least until we get rid of them completely). This is mostly some
  228. * cache informations about the CPU that will be used by cache flush
  229. * routines and/or provided to userland
  230. */
  231. static void __init initialize_cache_info(void)
  232. {
  233. struct device_node *np;
  234. unsigned long num_cpus = 0;
  235. DBG(" -> initialize_cache_info()\n");
  236. for_each_node_by_type(np, "cpu") {
  237. num_cpus += 1;
  238. /*
  239. * We're assuming *all* of the CPUs have the same
  240. * d-cache and i-cache sizes... -Peter
  241. */
  242. if (num_cpus == 1) {
  243. const u32 *sizep, *lsizep;
  244. u32 size, lsize;
  245. size = 0;
  246. lsize = cur_cpu_spec->dcache_bsize;
  247. sizep = of_get_property(np, "d-cache-size", NULL);
  248. if (sizep != NULL)
  249. size = *sizep;
  250. lsizep = of_get_property(np, "d-cache-block-size",
  251. NULL);
  252. /* fallback if block size missing */
  253. if (lsizep == NULL)
  254. lsizep = of_get_property(np,
  255. "d-cache-line-size",
  256. NULL);
  257. if (lsizep != NULL)
  258. lsize = *lsizep;
  259. if (sizep == 0 || lsizep == 0)
  260. DBG("Argh, can't find dcache properties ! "
  261. "sizep: %p, lsizep: %p\n", sizep, lsizep);
  262. ppc64_caches.dsize = size;
  263. ppc64_caches.dline_size = lsize;
  264. ppc64_caches.log_dline_size = __ilog2(lsize);
  265. ppc64_caches.dlines_per_page = PAGE_SIZE / lsize;
  266. size = 0;
  267. lsize = cur_cpu_spec->icache_bsize;
  268. sizep = of_get_property(np, "i-cache-size", NULL);
  269. if (sizep != NULL)
  270. size = *sizep;
  271. lsizep = of_get_property(np, "i-cache-block-size",
  272. NULL);
  273. if (lsizep == NULL)
  274. lsizep = of_get_property(np,
  275. "i-cache-line-size",
  276. NULL);
  277. if (lsizep != NULL)
  278. lsize = *lsizep;
  279. if (sizep == 0 || lsizep == 0)
  280. DBG("Argh, can't find icache properties ! "
  281. "sizep: %p, lsizep: %p\n", sizep, lsizep);
  282. ppc64_caches.isize = size;
  283. ppc64_caches.iline_size = lsize;
  284. ppc64_caches.log_iline_size = __ilog2(lsize);
  285. ppc64_caches.ilines_per_page = PAGE_SIZE / lsize;
  286. }
  287. }
  288. DBG(" <- initialize_cache_info()\n");
  289. }
  290. /*
  291. * Do some initial setup of the system. The parameters are those which
  292. * were passed in from the bootloader.
  293. */
  294. void __init setup_system(void)
  295. {
  296. DBG(" -> setup_system()\n");
  297. /* Apply the CPUs-specific and firmware specific fixups to kernel
  298. * text (nop out sections not relevant to this CPU or this firmware)
  299. */
  300. do_feature_fixups(cur_cpu_spec->cpu_features,
  301. &__start___ftr_fixup, &__stop___ftr_fixup);
  302. do_feature_fixups(cur_cpu_spec->mmu_features,
  303. &__start___mmu_ftr_fixup, &__stop___mmu_ftr_fixup);
  304. do_feature_fixups(powerpc_firmware_features,
  305. &__start___fw_ftr_fixup, &__stop___fw_ftr_fixup);
  306. do_lwsync_fixups(cur_cpu_spec->cpu_features,
  307. &__start___lwsync_fixup, &__stop___lwsync_fixup);
  308. /*
  309. * Unflatten the device-tree passed by prom_init or kexec
  310. */
  311. unflatten_device_tree();
  312. /*
  313. * Fill the ppc64_caches & systemcfg structures with informations
  314. * retrieved from the device-tree.
  315. */
  316. initialize_cache_info();
  317. #ifdef CONFIG_PPC_RTAS
  318. /*
  319. * Initialize RTAS if available
  320. */
  321. rtas_initialize();
  322. #endif /* CONFIG_PPC_RTAS */
  323. /*
  324. * Check if we have an initrd provided via the device-tree
  325. */
  326. check_for_initrd();
  327. /*
  328. * Do some platform specific early initializations, that includes
  329. * setting up the hash table pointers. It also sets up some interrupt-mapping
  330. * related options that will be used by finish_device_tree()
  331. */
  332. if (ppc_md.init_early)
  333. ppc_md.init_early();
  334. /*
  335. * We can discover serial ports now since the above did setup the
  336. * hash table management for us, thus ioremap works. We do that early
  337. * so that further code can be debugged
  338. */
  339. find_legacy_serial_ports();
  340. /*
  341. * Register early console
  342. */
  343. register_early_udbg_console();
  344. /*
  345. * Initialize xmon
  346. */
  347. xmon_setup();
  348. smp_setup_cpu_maps();
  349. check_smt_enabled();
  350. #ifdef CONFIG_SMP
  351. /* Release secondary cpus out of their spinloops at 0x60 now that
  352. * we can map physical -> logical CPU ids
  353. */
  354. smp_release_cpus();
  355. #endif
  356. printk("Starting Linux PPC64 %s\n", init_utsname()->version);
  357. printk("-----------------------------------------------------\n");
  358. printk("ppc64_pft_size = 0x%llx\n", ppc64_pft_size);
  359. printk("physicalMemorySize = 0x%llx\n", memblock_phys_mem_size());
  360. if (ppc64_caches.dline_size != 0x80)
  361. printk("ppc64_caches.dcache_line_size = 0x%x\n",
  362. ppc64_caches.dline_size);
  363. if (ppc64_caches.iline_size != 0x80)
  364. printk("ppc64_caches.icache_line_size = 0x%x\n",
  365. ppc64_caches.iline_size);
  366. #ifdef CONFIG_PPC_STD_MMU_64
  367. if (htab_address)
  368. printk("htab_address = 0x%p\n", htab_address);
  369. printk("htab_hash_mask = 0x%lx\n", htab_hash_mask);
  370. #endif /* CONFIG_PPC_STD_MMU_64 */
  371. if (PHYSICAL_START > 0)
  372. printk("physical_start = 0x%llx\n",
  373. (unsigned long long)PHYSICAL_START);
  374. printk("-----------------------------------------------------\n");
  375. DBG(" <- setup_system()\n");
  376. }
  377. /* This returns the limit below which memory accesses to the linear
  378. * mapping are guarnateed not to cause a TLB or SLB miss. This is
  379. * used to allocate interrupt or emergency stacks for which our
  380. * exception entry path doesn't deal with being interrupted.
  381. */
  382. static u64 safe_stack_limit(void)
  383. {
  384. #ifdef CONFIG_PPC_BOOK3E
  385. /* Freescale BookE bolts the entire linear mapping */
  386. if (mmu_has_feature(MMU_FTR_TYPE_FSL_E))
  387. return linear_map_top;
  388. /* Other BookE, we assume the first GB is bolted */
  389. return 1ul << 30;
  390. #else
  391. /* BookS, the first segment is bolted */
  392. if (mmu_has_feature(MMU_FTR_1T_SEGMENT))
  393. return 1UL << SID_SHIFT_1T;
  394. return 1UL << SID_SHIFT;
  395. #endif
  396. }
  397. static void __init irqstack_early_init(void)
  398. {
  399. u64 limit = safe_stack_limit();
  400. unsigned int i;
  401. /*
  402. * Interrupt stacks must be in the first segment since we
  403. * cannot afford to take SLB misses on them.
  404. */
  405. for_each_possible_cpu(i) {
  406. softirq_ctx[i] = (struct thread_info *)
  407. __va(memblock_alloc_base(THREAD_SIZE,
  408. THREAD_SIZE, limit));
  409. hardirq_ctx[i] = (struct thread_info *)
  410. __va(memblock_alloc_base(THREAD_SIZE,
  411. THREAD_SIZE, limit));
  412. }
  413. }
  414. #ifdef CONFIG_PPC_BOOK3E
  415. static void __init exc_lvl_early_init(void)
  416. {
  417. extern unsigned int interrupt_base_book3e;
  418. extern unsigned int exc_debug_debug_book3e;
  419. unsigned int i;
  420. for_each_possible_cpu(i) {
  421. critirq_ctx[i] = (struct thread_info *)
  422. __va(memblock_alloc(THREAD_SIZE, THREAD_SIZE));
  423. dbgirq_ctx[i] = (struct thread_info *)
  424. __va(memblock_alloc(THREAD_SIZE, THREAD_SIZE));
  425. mcheckirq_ctx[i] = (struct thread_info *)
  426. __va(memblock_alloc(THREAD_SIZE, THREAD_SIZE));
  427. }
  428. if (cpu_has_feature(CPU_FTR_DEBUG_LVL_EXC))
  429. patch_branch(&interrupt_base_book3e + (0x040 / 4) + 1,
  430. (unsigned long)&exc_debug_debug_book3e, 0);
  431. }
  432. #else
  433. #define exc_lvl_early_init()
  434. #endif
  435. /*
  436. * Stack space used when we detect a bad kernel stack pointer, and
  437. * early in SMP boots before relocation is enabled.
  438. */
  439. static void __init emergency_stack_init(void)
  440. {
  441. u64 limit;
  442. unsigned int i;
  443. /*
  444. * Emergency stacks must be under 256MB, we cannot afford to take
  445. * SLB misses on them. The ABI also requires them to be 128-byte
  446. * aligned.
  447. *
  448. * Since we use these as temporary stacks during secondary CPU
  449. * bringup, we need to get at them in real mode. This means they
  450. * must also be within the RMO region.
  451. */
  452. limit = min(safe_stack_limit(), ppc64_rma_size);
  453. for_each_possible_cpu(i) {
  454. unsigned long sp;
  455. sp = memblock_alloc_base(THREAD_SIZE, THREAD_SIZE, limit);
  456. sp += THREAD_SIZE;
  457. paca[i].emergency_sp = __va(sp);
  458. }
  459. }
  460. /*
  461. * Called into from start_kernel this initializes bootmem, which is used
  462. * to manage page allocation until mem_init is called.
  463. */
  464. void __init setup_arch(char **cmdline_p)
  465. {
  466. ppc64_boot_msg(0x12, "Setup Arch");
  467. *cmdline_p = cmd_line;
  468. /*
  469. * Set cache line size based on type of cpu as a default.
  470. * Systems with OF can look in the properties on the cpu node(s)
  471. * for a possibly more accurate value.
  472. */
  473. dcache_bsize = ppc64_caches.dline_size;
  474. icache_bsize = ppc64_caches.iline_size;
  475. /* reboot on panic */
  476. panic_timeout = 180;
  477. if (ppc_md.panic)
  478. setup_panic();
  479. init_mm.start_code = (unsigned long)_stext;
  480. init_mm.end_code = (unsigned long) _etext;
  481. init_mm.end_data = (unsigned long) _edata;
  482. init_mm.brk = klimit;
  483. irqstack_early_init();
  484. exc_lvl_early_init();
  485. emergency_stack_init();
  486. #ifdef CONFIG_PPC_STD_MMU_64
  487. stabs_alloc();
  488. #endif
  489. /* set up the bootmem stuff with available memory */
  490. do_init_bootmem();
  491. sparse_init();
  492. #ifdef CONFIG_DUMMY_CONSOLE
  493. conswitchp = &dummy_con;
  494. #endif
  495. if (ppc_md.setup_arch)
  496. ppc_md.setup_arch();
  497. paging_init();
  498. /* Initialize the MMU context management stuff */
  499. mmu_context_init();
  500. kvm_rma_init();
  501. ppc64_boot_msg(0x15, "Setup Done");
  502. }
  503. /* ToDo: do something useful if ppc_md is not yet setup. */
  504. #define PPC64_LINUX_FUNCTION 0x0f000000
  505. #define PPC64_IPL_MESSAGE 0xc0000000
  506. #define PPC64_TERM_MESSAGE 0xb0000000
  507. static void ppc64_do_msg(unsigned int src, const char *msg)
  508. {
  509. if (ppc_md.progress) {
  510. char buf[128];
  511. sprintf(buf, "%08X\n", src);
  512. ppc_md.progress(buf, 0);
  513. snprintf(buf, 128, "%s", msg);
  514. ppc_md.progress(buf, 0);
  515. }
  516. }
  517. /* Print a boot progress message. */
  518. void ppc64_boot_msg(unsigned int src, const char *msg)
  519. {
  520. ppc64_do_msg(PPC64_LINUX_FUNCTION|PPC64_IPL_MESSAGE|src, msg);
  521. printk("[boot]%04x %s\n", src, msg);
  522. }
  523. #ifdef CONFIG_SMP
  524. #define PCPU_DYN_SIZE ()
  525. static void * __init pcpu_fc_alloc(unsigned int cpu, size_t size, size_t align)
  526. {
  527. return __alloc_bootmem_node(NODE_DATA(cpu_to_node(cpu)), size, align,
  528. __pa(MAX_DMA_ADDRESS));
  529. }
  530. static void __init pcpu_fc_free(void *ptr, size_t size)
  531. {
  532. free_bootmem(__pa(ptr), size);
  533. }
  534. static int pcpu_cpu_distance(unsigned int from, unsigned int to)
  535. {
  536. if (cpu_to_node(from) == cpu_to_node(to))
  537. return LOCAL_DISTANCE;
  538. else
  539. return REMOTE_DISTANCE;
  540. }
  541. unsigned long __per_cpu_offset[NR_CPUS] __read_mostly;
  542. EXPORT_SYMBOL(__per_cpu_offset);
  543. void __init setup_per_cpu_areas(void)
  544. {
  545. const size_t dyn_size = PERCPU_MODULE_RESERVE + PERCPU_DYNAMIC_RESERVE;
  546. size_t atom_size;
  547. unsigned long delta;
  548. unsigned int cpu;
  549. int rc;
  550. /*
  551. * Linear mapping is one of 4K, 1M and 16M. For 4K, no need
  552. * to group units. For larger mappings, use 1M atom which
  553. * should be large enough to contain a number of units.
  554. */
  555. if (mmu_linear_psize == MMU_PAGE_4K)
  556. atom_size = PAGE_SIZE;
  557. else
  558. atom_size = 1 << 20;
  559. rc = pcpu_embed_first_chunk(0, dyn_size, atom_size, pcpu_cpu_distance,
  560. pcpu_fc_alloc, pcpu_fc_free);
  561. if (rc < 0)
  562. panic("cannot initialize percpu area (err=%d)", rc);
  563. delta = (unsigned long)pcpu_base_addr - (unsigned long)__per_cpu_start;
  564. for_each_possible_cpu(cpu) {
  565. __per_cpu_offset[cpu] = delta + pcpu_unit_offsets[cpu];
  566. paca[cpu].data_offset = __per_cpu_offset[cpu];
  567. }
  568. }
  569. #endif
  570. #ifdef CONFIG_PPC_INDIRECT_IO
  571. struct ppc_pci_io ppc_pci_io;
  572. EXPORT_SYMBOL(ppc_pci_io);
  573. #endif /* CONFIG_PPC_INDIRECT_IO */