paca.c 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. /*
  2. * c 2001 PPC 64 Team, IBM Corp
  3. *
  4. * This program is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU General Public License
  6. * as published by the Free Software Foundation; either version
  7. * 2 of the License, or (at your option) any later version.
  8. */
  9. #include <linux/types.h>
  10. #include <linux/threads.h>
  11. #include <linux/module.h>
  12. #include <asm/processor.h>
  13. #include <asm/ptrace.h>
  14. #include <asm/page.h>
  15. #include <asm/lppaca.h>
  16. #include <asm/iseries/it_lp_reg_save.h>
  17. #include <asm/paca.h>
  18. #include <asm/mmu.h>
  19. /* This symbol is provided by the linker - let it fill in the paca
  20. * field correctly */
  21. extern unsigned long __toc_start;
  22. /*
  23. * iSeries structure which the hypervisor knows about - this structure
  24. * should not cross a page boundary. The vpa_init/register_vpa call
  25. * is now known to fail if the lppaca structure crosses a page
  26. * boundary. The lppaca is also used on POWER5 pSeries boxes. The
  27. * lppaca is 640 bytes long, and cannot readily change since the
  28. * hypervisor knows its layout, so a 1kB alignment will suffice to
  29. * ensure that it doesn't cross a page boundary.
  30. */
  31. struct lppaca lppaca[] = {
  32. [0 ... (NR_CPUS-1)] = {
  33. .desc = 0xd397d781, /* "LpPa" */
  34. .size = sizeof(struct lppaca),
  35. .dyn_proc_status = 2,
  36. .decr_val = 0x00ff0000,
  37. .fpregs_in_use = 1,
  38. .end_of_quantum = 0xfffffffffffffffful,
  39. .slb_count = 64,
  40. .vmxregs_in_use = 0,
  41. },
  42. };
  43. /*
  44. * 3 persistent SLBs are registered here. The buffer will be zero
  45. * initially, hence will all be invaild until we actually write them.
  46. */
  47. struct slb_shadow slb_shadow[] __cacheline_aligned = {
  48. [0 ... (NR_CPUS-1)] = {
  49. .persistent = SLB_NUM_BOLTED,
  50. .buffer_length = sizeof(struct slb_shadow),
  51. },
  52. };
  53. /* The Paca is an array with one entry per processor. Each contains an
  54. * lppaca, which contains the information shared between the
  55. * hypervisor and Linux.
  56. * On systems with hardware multi-threading, there are two threads
  57. * per processor. The Paca array must contain an entry for each thread.
  58. * The VPD Areas will give a max logical processors = 2 * max physical
  59. * processors. The processor VPD array needs one entry per physical
  60. * processor (not thread).
  61. */
  62. #define PACA_INIT_COMMON(number) \
  63. .lppaca_ptr = &lppaca[number], \
  64. .lock_token = 0x8000, \
  65. .paca_index = (number), /* Paca Index */ \
  66. .kernel_toc = (unsigned long)(&__toc_start) + 0x8000UL, \
  67. .hw_cpu_id = 0xffff, \
  68. .slb_shadow_ptr = &slb_shadow[number],
  69. #ifdef CONFIG_PPC_ISERIES
  70. #define PACA_INIT_ISERIES(number) \
  71. .reg_save_ptr = &iseries_reg_save[number],
  72. #define PACA_INIT(number) \
  73. { \
  74. PACA_INIT_COMMON(number) \
  75. PACA_INIT_ISERIES(number) \
  76. }
  77. #else
  78. #define PACA_INIT(number) \
  79. { \
  80. PACA_INIT_COMMON(number) \
  81. }
  82. #endif
  83. struct paca_struct paca[] = {
  84. PACA_INIT(0),
  85. #if NR_CPUS > 1
  86. PACA_INIT( 1), PACA_INIT( 2), PACA_INIT( 3),
  87. #if NR_CPUS > 4
  88. PACA_INIT( 4), PACA_INIT( 5), PACA_INIT( 6), PACA_INIT( 7),
  89. #if NR_CPUS > 8
  90. PACA_INIT( 8), PACA_INIT( 9), PACA_INIT( 10), PACA_INIT( 11),
  91. PACA_INIT( 12), PACA_INIT( 13), PACA_INIT( 14), PACA_INIT( 15),
  92. PACA_INIT( 16), PACA_INIT( 17), PACA_INIT( 18), PACA_INIT( 19),
  93. PACA_INIT( 20), PACA_INIT( 21), PACA_INIT( 22), PACA_INIT( 23),
  94. PACA_INIT( 24), PACA_INIT( 25), PACA_INIT( 26), PACA_INIT( 27),
  95. PACA_INIT( 28), PACA_INIT( 29), PACA_INIT( 30), PACA_INIT( 31),
  96. #if NR_CPUS > 32
  97. PACA_INIT( 32), PACA_INIT( 33), PACA_INIT( 34), PACA_INIT( 35),
  98. PACA_INIT( 36), PACA_INIT( 37), PACA_INIT( 38), PACA_INIT( 39),
  99. PACA_INIT( 40), PACA_INIT( 41), PACA_INIT( 42), PACA_INIT( 43),
  100. PACA_INIT( 44), PACA_INIT( 45), PACA_INIT( 46), PACA_INIT( 47),
  101. PACA_INIT( 48), PACA_INIT( 49), PACA_INIT( 50), PACA_INIT( 51),
  102. PACA_INIT( 52), PACA_INIT( 53), PACA_INIT( 54), PACA_INIT( 55),
  103. PACA_INIT( 56), PACA_INIT( 57), PACA_INIT( 58), PACA_INIT( 59),
  104. PACA_INIT( 60), PACA_INIT( 61), PACA_INIT( 62), PACA_INIT( 63),
  105. #if NR_CPUS > 64
  106. PACA_INIT( 64), PACA_INIT( 65), PACA_INIT( 66), PACA_INIT( 67),
  107. PACA_INIT( 68), PACA_INIT( 69), PACA_INIT( 70), PACA_INIT( 71),
  108. PACA_INIT( 72), PACA_INIT( 73), PACA_INIT( 74), PACA_INIT( 75),
  109. PACA_INIT( 76), PACA_INIT( 77), PACA_INIT( 78), PACA_INIT( 79),
  110. PACA_INIT( 80), PACA_INIT( 81), PACA_INIT( 82), PACA_INIT( 83),
  111. PACA_INIT( 84), PACA_INIT( 85), PACA_INIT( 86), PACA_INIT( 87),
  112. PACA_INIT( 88), PACA_INIT( 89), PACA_INIT( 90), PACA_INIT( 91),
  113. PACA_INIT( 92), PACA_INIT( 93), PACA_INIT( 94), PACA_INIT( 95),
  114. PACA_INIT( 96), PACA_INIT( 97), PACA_INIT( 98), PACA_INIT( 99),
  115. PACA_INIT(100), PACA_INIT(101), PACA_INIT(102), PACA_INIT(103),
  116. PACA_INIT(104), PACA_INIT(105), PACA_INIT(106), PACA_INIT(107),
  117. PACA_INIT(108), PACA_INIT(109), PACA_INIT(110), PACA_INIT(111),
  118. PACA_INIT(112), PACA_INIT(113), PACA_INIT(114), PACA_INIT(115),
  119. PACA_INIT(116), PACA_INIT(117), PACA_INIT(118), PACA_INIT(119),
  120. PACA_INIT(120), PACA_INIT(121), PACA_INIT(122), PACA_INIT(123),
  121. PACA_INIT(124), PACA_INIT(125), PACA_INIT(126), PACA_INIT(127),
  122. #endif
  123. #endif
  124. #endif
  125. #endif
  126. #endif
  127. };
  128. EXPORT_SYMBOL(paca);