Lines Matching refs:pcpu
73 struct pcpu { struct
83 static struct pcpu pcpu_devices[NR_CPUS]; argument
132 static int pcpu_sigp_retry(struct pcpu *pcpu, u8 order, u32 parm) in pcpu_sigp_retry() argument
137 cc = __pcpu_sigp(pcpu->address, order, parm, NULL); in pcpu_sigp_retry()
146 static inline int pcpu_stopped(struct pcpu *pcpu) in pcpu_stopped() argument
150 if (__pcpu_sigp(pcpu->address, SIGP_SENSE, in pcpu_stopped()
156 static inline int pcpu_running(struct pcpu *pcpu) in pcpu_running() argument
158 if (__pcpu_sigp(pcpu->address, SIGP_SENSE_RUNNING, in pcpu_running()
168 static struct pcpu *pcpu_find_address(const struct cpumask *mask, u16 address) in pcpu_find_address()
178 static void pcpu_ec_call(struct pcpu *pcpu, int ec_bit) in pcpu_ec_call() argument
182 if (test_and_set_bit(ec_bit, &pcpu->ec_mask)) in pcpu_ec_call()
184 order = pcpu_running(pcpu) ? SIGP_EXTERNAL_CALL : SIGP_EMERGENCY_SIGNAL; in pcpu_ec_call()
185 pcpu->ec_clk = get_tod_clock_fast(); in pcpu_ec_call()
186 pcpu_sigp_retry(pcpu, order, 0); in pcpu_ec_call()
192 static int pcpu_alloc_lowcore(struct pcpu *pcpu, int cpu) in pcpu_alloc_lowcore() argument
197 if (pcpu != &pcpu_devices[0]) { in pcpu_alloc_lowcore()
198 pcpu->lowcore = (struct lowcore *) in pcpu_alloc_lowcore()
202 if (!pcpu->lowcore || !panic_stack || !async_stack) in pcpu_alloc_lowcore()
205 async_stack = pcpu->lowcore->async_stack - ASYNC_FRAME_OFFSET; in pcpu_alloc_lowcore()
206 panic_stack = pcpu->lowcore->panic_stack - PANIC_FRAME_OFFSET; in pcpu_alloc_lowcore()
208 lc = pcpu->lowcore; in pcpu_alloc_lowcore()
222 pcpu_sigp_retry(pcpu, SIGP_SET_PREFIX, (u32)(unsigned long) lc); in pcpu_alloc_lowcore()
228 if (pcpu != &pcpu_devices[0]) { in pcpu_alloc_lowcore()
231 free_pages((unsigned long) pcpu->lowcore, LC_ORDER); in pcpu_alloc_lowcore()
238 static void pcpu_free_lowcore(struct pcpu *pcpu) in pcpu_free_lowcore() argument
240 pcpu_sigp_retry(pcpu, SIGP_SET_PREFIX, 0); in pcpu_free_lowcore()
241 lowcore_ptr[pcpu - pcpu_devices] = NULL; in pcpu_free_lowcore()
242 vdso_free_per_cpu(pcpu->lowcore); in pcpu_free_lowcore()
243 nmi_free_per_cpu(pcpu->lowcore); in pcpu_free_lowcore()
244 if (pcpu == &pcpu_devices[0]) in pcpu_free_lowcore()
246 free_page(pcpu->lowcore->panic_stack-PANIC_FRAME_OFFSET); in pcpu_free_lowcore()
247 free_pages(pcpu->lowcore->async_stack-ASYNC_FRAME_OFFSET, ASYNC_ORDER); in pcpu_free_lowcore()
248 free_pages((unsigned long) pcpu->lowcore, LC_ORDER); in pcpu_free_lowcore()
253 static void pcpu_prepare_secondary(struct pcpu *pcpu, int cpu) in pcpu_prepare_secondary() argument
255 struct lowcore *lc = pcpu->lowcore; in pcpu_prepare_secondary()
275 static void pcpu_attach_task(struct pcpu *pcpu, struct task_struct *tsk) in pcpu_attach_task() argument
277 struct lowcore *lc = pcpu->lowcore; in pcpu_attach_task()
292 static void pcpu_start_fn(struct pcpu *pcpu, void (*func)(void *), void *data) in pcpu_start_fn() argument
294 struct lowcore *lc = pcpu->lowcore; in pcpu_start_fn()
300 pcpu_sigp_retry(pcpu, SIGP_RESTART, 0); in pcpu_start_fn()
306 static void pcpu_delegate(struct pcpu *pcpu, void (*func)(void *), in pcpu_delegate() argument
309 struct lowcore *lc = lowcore_ptr[pcpu - pcpu_devices]; in pcpu_delegate()
313 if (pcpu->address == source_cpu) in pcpu_delegate()
316 pcpu_sigp_retry(pcpu, SIGP_STOP, 0); in pcpu_delegate()
328 : : "d" (pcpu->address), "d" (source_cpu), in pcpu_delegate()
359 struct pcpu *pcpu; in smp_call_online_cpu() local
362 pcpu = pcpu_find_address(cpu_online_mask, stap()); in smp_call_online_cpu()
363 if (!pcpu) in smp_call_online_cpu()
365 pcpu = pcpu_devices + cpumask_first(cpu_online_mask); in smp_call_online_cpu()
366 pcpu_delegate(pcpu, func, data, (unsigned long) restart_stack); in smp_call_online_cpu()
426 struct pcpu *pcpu = pcpu_devices + cpu; in smp_emergency_stop() local
427 set_bit(ec_stop_cpu, &pcpu->ec_mask); in smp_emergency_stop()
428 while (__pcpu_sigp(pcpu->address, SIGP_EMERGENCY_SIGNAL, in smp_emergency_stop()
566 struct pcpu *pcpu = pcpu_devices + cpu; in smp_store_status() local
569 pa = __pa(&pcpu->lowcore->floating_pt_save_area); in smp_store_status()
570 if (__pcpu_sigp_relax(pcpu->address, SIGP_STORE_STATUS_AT_ADDRESS, in smp_store_status()
575 pa = __pa(pcpu->lowcore->mcesad & MCESA_ORIGIN_MASK); in smp_store_status()
577 pa |= pcpu->lowcore->mcesad & MCESA_LC_MASK; in smp_store_status()
578 if (__pcpu_sigp_relax(pcpu->address, SIGP_STORE_ADDITIONAL_STATUS, in smp_store_status()
713 struct pcpu *pcpu; in __smp_rescan_cpus() local
728 pcpu = pcpu_devices + cpu; in __smp_rescan_cpus()
729 pcpu->address = address + j; in __smp_rescan_cpus()
730 pcpu->state = in __smp_rescan_cpus()
828 struct pcpu *pcpu; in __cpu_up() local
831 pcpu = pcpu_devices + cpu; in __cpu_up()
832 if (pcpu->state != CPU_STATE_CONFIGURED) in __cpu_up()
849 rc = pcpu_alloc_lowcore(pcpu, cpu); in __cpu_up()
852 pcpu_prepare_secondary(pcpu, cpu); in __cpu_up()
853 pcpu_attach_task(pcpu, tidle); in __cpu_up()
854 pcpu_start_fn(pcpu, smp_start_secondary, NULL); in __cpu_up()
893 struct pcpu *pcpu; in __cpu_die() local
896 pcpu = pcpu_devices + cpu; in __cpu_die()
897 while (!pcpu_stopped(pcpu)) in __cpu_die()
899 pcpu_free_lowcore(pcpu); in __cpu_die()
939 struct pcpu *pcpu = pcpu_devices; in smp_prepare_boot_cpu() local
942 pcpu->state = CPU_STATE_CONFIGURED; in smp_prepare_boot_cpu()
943 pcpu->lowcore = (struct lowcore *)(unsigned long) store_prefix(); in smp_prepare_boot_cpu()
987 struct pcpu *pcpu; in cpu_configure_store() local
1006 pcpu = pcpu_devices + cpu; in cpu_configure_store()
1010 if (pcpu->state != CPU_STATE_CONFIGURED) in cpu_configure_store()
1012 rc = sclp_core_deconfigure(pcpu->address >> smp_cpu_mt_shift); in cpu_configure_store()
1018 pcpu[i].state = CPU_STATE_STANDBY; in cpu_configure_store()
1025 if (pcpu->state != CPU_STATE_STANDBY) in cpu_configure_store()
1027 rc = sclp_core_configure(pcpu->address >> smp_cpu_mt_shift); in cpu_configure_store()
1033 pcpu[i].state = CPU_STATE_CONFIGURED; in cpu_configure_store()