11 #include <linux/export.h>
16 #include <asm/sections.h>
17 #include <asm/pgtable.h>
18 #include <asm/kexec.h>
24 #ifdef CONFIG_PPC_BOOK3S
35 struct lppaca lppaca[] = {
36 [0 ... (NR_LPPACAS-1)] = {
38 .size =
sizeof(
struct lppaca),
46 static struct lppaca *extra_lppacas;
49 static void allocate_lppacas(
int nr_cpus,
unsigned long limit)
51 if (nr_cpus <= NR_LPPACAS)
54 lppaca_size =
PAGE_ALIGN(
sizeof(
struct lppaca) *
55 (nr_cpus - NR_LPPACAS));
60 static struct lppaca *new_lppaca(
int cpu)
67 lp = extra_lppacas + (cpu - NR_LPPACAS);
73 static void free_lppacas(
void)
75 long new_size = 0,
nr;
82 if (new_size >= lppaca_size)
86 lppaca_size = new_size;
91 static inline void allocate_lppacas(
int nr_cpus,
unsigned long limit) { }
92 static inline void free_lppacas(
void) { }
96 #ifdef CONFIG_PPC_STD_MMU_64
105 .buffer_length =
sizeof(
struct slb_shadow),
132 #ifdef CONFIG_PPC_BOOK3S
133 new_paca->lppaca_ptr = new_lppaca(cpu);
137 new_paca->lock_token = 0x8000;
138 new_paca->paca_index =
cpu;
139 new_paca->kernel_toc = kernel_toc;
140 new_paca->kernelbase = (
unsigned long)
_stext;
141 new_paca->kernel_msr = MSR_KERNEL;
142 new_paca->hw_cpu_id = 0xffff;
143 new_paca->kexec_state = KEXEC_STATE_NONE;
145 new_paca->data_offset = 0xfeeeeeeeeeeeeeeeULL;
146 #ifdef CONFIG_PPC_STD_MMU_64
147 new_paca->slb_shadow_ptr = &slb_shadow[
cpu];
155 local_paca = new_paca;
157 #ifdef CONFIG_PPC_BOOK3E
159 mtspr(SPRN_SPRG_TLB_EXFRAME, local_paca->extlb);
166 mtspr(SPRN_SPRG_HPACA, local_paca);
168 mtspr(SPRN_SPRG_PACA, local_paca);
183 limit =
min(0x10000000ULL, ppc64_rma_size);
188 memset(paca, 0, paca_size);
191 paca_size, nr_cpu_ids, paca);
193 allocate_lppacas(nr_cpu_ids, limit);
196 for (cpu = 0; cpu < nr_cpu_ids; cpu++)
206 if (new_size >= paca_size)
212 paca_size - new_size);
214 paca_size = new_size;