Lines Matching refs:pcpu

74 struct pcpu {  struct
84 static struct pcpu pcpu_devices[NR_CPUS]; argument
133 static int pcpu_sigp_retry(struct pcpu *pcpu, u8 order, u32 parm) in pcpu_sigp_retry() argument
138 cc = __pcpu_sigp(pcpu->address, order, parm, NULL); in pcpu_sigp_retry()
147 static inline int pcpu_stopped(struct pcpu *pcpu) in pcpu_stopped() argument
151 if (__pcpu_sigp(pcpu->address, SIGP_SENSE, in pcpu_stopped()
157 static inline int pcpu_running(struct pcpu *pcpu) in pcpu_running() argument
159 if (__pcpu_sigp(pcpu->address, SIGP_SENSE_RUNNING, in pcpu_running()
169 static struct pcpu *pcpu_find_address(const struct cpumask *mask, u16 address) in pcpu_find_address()
179 static void pcpu_ec_call(struct pcpu *pcpu, int ec_bit) in pcpu_ec_call() argument
183 if (test_and_set_bit(ec_bit, &pcpu->ec_mask)) in pcpu_ec_call()
185 order = pcpu_running(pcpu) ? SIGP_EXTERNAL_CALL : SIGP_EMERGENCY_SIGNAL; in pcpu_ec_call()
186 pcpu->ec_clk = get_tod_clock_fast(); in pcpu_ec_call()
187 pcpu_sigp_retry(pcpu, order, 0); in pcpu_ec_call()
190 static int pcpu_alloc_lowcore(struct pcpu *pcpu, int cpu) in pcpu_alloc_lowcore() argument
195 if (pcpu != &pcpu_devices[0]) { in pcpu_alloc_lowcore()
196 pcpu->lowcore = (struct lowcore *) in pcpu_alloc_lowcore()
199 if (!pcpu->lowcore || !nodat_stack) in pcpu_alloc_lowcore()
202 nodat_stack = pcpu->lowcore->nodat_stack - STACK_INIT_OFFSET; in pcpu_alloc_lowcore()
207 lc = pcpu->lowcore; in pcpu_alloc_lowcore()
223 pcpu_sigp_retry(pcpu, SIGP_SET_PREFIX, (u32)(unsigned long) lc); in pcpu_alloc_lowcore()
231 if (pcpu != &pcpu_devices[0]) { in pcpu_alloc_lowcore()
233 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
242 nodat_stack = pcpu->lowcore->nodat_stack - STACK_INIT_OFFSET; in pcpu_free_lowcore()
243 async_stack = pcpu->lowcore->async_stack - STACK_INIT_OFFSET; in pcpu_free_lowcore()
244 lowcore = (unsigned long) pcpu->lowcore; in pcpu_free_lowcore()
246 pcpu_sigp_retry(pcpu, SIGP_SET_PREFIX, 0); in pcpu_free_lowcore()
247 lowcore_ptr[pcpu - pcpu_devices] = NULL; in pcpu_free_lowcore()
248 vdso_free_per_cpu(pcpu->lowcore); in pcpu_free_lowcore()
249 nmi_free_per_cpu(pcpu->lowcore); in pcpu_free_lowcore()
251 if (pcpu == &pcpu_devices[0]) in pcpu_free_lowcore()
257 static void pcpu_prepare_secondary(struct pcpu *pcpu, int cpu) in pcpu_prepare_secondary() argument
259 struct lowcore *lc = pcpu->lowcore; in pcpu_prepare_secondary()
283 static void pcpu_attach_task(struct pcpu *pcpu, struct task_struct *tsk) in pcpu_attach_task() argument
285 struct lowcore *lc = pcpu->lowcore; in pcpu_attach_task()
300 static void pcpu_start_fn(struct pcpu *pcpu, void (*func)(void *), void *data) in pcpu_start_fn() argument
302 struct lowcore *lc = pcpu->lowcore; in pcpu_start_fn()
308 pcpu_sigp_retry(pcpu, SIGP_RESTART, 0); in pcpu_start_fn()
319 static void __no_sanitize_address pcpu_delegate(struct pcpu *pcpu, in pcpu_delegate() argument
323 struct lowcore *lc = lowcore_ptr[pcpu - pcpu_devices]; in pcpu_delegate()
327 if (pcpu->address == source_cpu) in pcpu_delegate()
330 pcpu_sigp_retry(pcpu, SIGP_STOP, 0); in pcpu_delegate()
342 : : "d" (pcpu->address), "d" (source_cpu), in pcpu_delegate()
373 struct pcpu *pcpu; in smp_call_online_cpu() local
376 pcpu = pcpu_find_address(cpu_online_mask, stap()); in smp_call_online_cpu()
377 if (!pcpu) in smp_call_online_cpu()
379 pcpu = pcpu_devices + cpumask_first(cpu_online_mask); in smp_call_online_cpu()
380 pcpu_delegate(pcpu, func, data, (unsigned long) restart_stack); in smp_call_online_cpu()
446 struct pcpu *pcpu = pcpu_devices + cpu; in smp_emergency_stop() local
447 set_bit(ec_stop_cpu, &pcpu->ec_mask); in smp_emergency_stop()
448 while (__pcpu_sigp(pcpu->address, SIGP_EMERGENCY_SIGNAL, in smp_emergency_stop()
588 struct pcpu *pcpu = pcpu_devices + cpu; in smp_store_status() local
591 pa = __pa(&pcpu->lowcore->floating_pt_save_area); in smp_store_status()
592 if (__pcpu_sigp_relax(pcpu->address, SIGP_STORE_STATUS_AT_ADDRESS, in smp_store_status()
597 pa = __pa(pcpu->lowcore->mcesad & MCESA_ORIGIN_MASK); in smp_store_status()
599 pa |= pcpu->lowcore->mcesad & MCESA_LC_MASK; in smp_store_status()
600 if (__pcpu_sigp_relax(pcpu->address, SIGP_STORE_ADDITIONAL_STATUS, in smp_store_status()
745 struct pcpu *pcpu; in smp_add_core() local
757 pcpu = pcpu_devices + cpu; in smp_add_core()
758 pcpu->address = address + i; in smp_add_core()
760 pcpu->state = CPU_STATE_CONFIGURED; in smp_add_core()
762 pcpu->state = CPU_STATE_STANDBY; in smp_add_core()
899 struct pcpu *pcpu; in __cpu_up() local
902 pcpu = pcpu_devices + cpu; in __cpu_up()
903 if (pcpu->state != CPU_STATE_CONFIGURED) in __cpu_up()
920 rc = pcpu_alloc_lowcore(pcpu, cpu); in __cpu_up()
923 pcpu_prepare_secondary(pcpu, cpu); in __cpu_up()
924 pcpu_attach_task(pcpu, tidle); in __cpu_up()
925 pcpu_start_fn(pcpu, smp_start_secondary, NULL); in __cpu_up()
963 struct pcpu *pcpu; in __cpu_die() local
966 pcpu = pcpu_devices + cpu; in __cpu_die()
967 while (!pcpu_stopped(pcpu)) in __cpu_die()
969 pcpu_free_lowcore(pcpu); in __cpu_die()
1007 struct pcpu *pcpu = pcpu_devices; in smp_prepare_boot_cpu() local
1010 pcpu->state = CPU_STATE_CONFIGURED; in smp_prepare_boot_cpu()
1011 pcpu->lowcore = (struct lowcore *)(unsigned long) store_prefix(); in smp_prepare_boot_cpu()
1050 struct pcpu *pcpu; in cpu_configure_store() local
1069 pcpu = pcpu_devices + cpu; in cpu_configure_store()
1073 if (pcpu->state != CPU_STATE_CONFIGURED) in cpu_configure_store()
1075 rc = sclp_core_deconfigure(pcpu->address >> smp_cpu_mt_shift); in cpu_configure_store()
1081 pcpu[i].state = CPU_STATE_STANDBY; in cpu_configure_store()
1088 if (pcpu->state != CPU_STATE_STANDBY) in cpu_configure_store()
1090 rc = sclp_core_configure(pcpu->address >> smp_cpu_mt_shift); in cpu_configure_store()
1096 pcpu[i].state = CPU_STATE_CONFIGURED; in cpu_configure_store()