Loading...
1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * Copyright IBM Corp. 1999, 2012
4 * Author(s): Denis Joseph Barrow,
5 * Martin Schwidefsky <schwidefsky@de.ibm.com>,
6 */
7#ifndef __ASM_SMP_H
8#define __ASM_SMP_H
9
10#include <asm/sigp.h>
11#include <asm/lowcore.h>
12#include <asm/processor.h>
13
14#define raw_smp_processor_id() (S390_lowcore.cpu_nr)
15
16extern struct mutex smp_cpu_state_mutex;
17extern unsigned int smp_cpu_mt_shift;
18extern unsigned int smp_cpu_mtid;
19extern __vector128 __initdata boot_cpu_vector_save_area[__NUM_VXRS];
20extern cpumask_t cpu_setup_mask;
21
22extern int __cpu_up(unsigned int cpu, struct task_struct *tidle);
23
24extern void arch_send_call_function_single_ipi(int cpu);
25extern void arch_send_call_function_ipi_mask(const struct cpumask *mask);
26
27extern void smp_call_online_cpu(void (*func)(void *), void *);
28extern void smp_call_ipl_cpu(void (*func)(void *), void *);
29extern void smp_emergency_stop(void);
30
31extern int smp_find_processor_id(u16 address);
32extern int smp_store_status(int cpu);
33extern void smp_save_dump_ipl_cpu(void);
34extern void smp_save_dump_secondary_cpus(void);
35extern void smp_yield_cpu(int cpu);
36extern void smp_cpu_set_polarization(int cpu, int val);
37extern int smp_cpu_get_polarization(int cpu);
38extern int smp_cpu_get_cpu_address(int cpu);
39extern void smp_fill_possible_mask(void);
40extern void smp_detect_cpus(void);
41
42static inline void smp_stop_cpu(void)
43{
44 u16 pcpu = stap();
45
46 for (;;) {
47 __pcpu_sigp(pcpu, SIGP_STOP, 0, NULL);
48 cpu_relax();
49 }
50}
51
52/* Return thread 0 CPU number as base CPU */
53static inline int smp_get_base_cpu(int cpu)
54{
55 return cpu - (cpu % (smp_cpu_mtid + 1));
56}
57
58static inline void smp_cpus_done(unsigned int max_cpus)
59{
60}
61
62extern int smp_reinit_ipl_cpu(void);
63extern int smp_rescan_cpus(void);
64extern void __noreturn cpu_die(void);
65extern void __cpu_die(unsigned int cpu);
66extern int __cpu_disable(void);
67extern void schedule_mcck_handler(void);
68void notrace smp_yield_cpu(int cpu);
69
70#endif /* __ASM_SMP_H */
1/*
2 * Copyright IBM Corp. 1999, 2012
3 * Author(s): Denis Joseph Barrow,
4 * Martin Schwidefsky <schwidefsky@de.ibm.com>,
5 * Heiko Carstens <heiko.carstens@de.ibm.com>,
6 */
7#ifndef __ASM_SMP_H
8#define __ASM_SMP_H
9
10#include <asm/sigp.h>
11
12#ifdef CONFIG_SMP
13
14#include <asm/lowcore.h>
15
16#define raw_smp_processor_id() (S390_lowcore.cpu_nr)
17
18extern struct mutex smp_cpu_state_mutex;
19
20extern int __cpu_up(unsigned int cpu, struct task_struct *tidle);
21
22extern void arch_send_call_function_single_ipi(int cpu);
23extern void arch_send_call_function_ipi_mask(const struct cpumask *mask);
24
25extern void smp_call_online_cpu(void (*func)(void *), void *);
26extern void smp_call_ipl_cpu(void (*func)(void *), void *);
27
28extern int smp_find_processor_id(u16 address);
29extern int smp_store_status(int cpu);
30extern int smp_vcpu_scheduled(int cpu);
31extern void smp_yield_cpu(int cpu);
32extern void smp_yield(void);
33extern void smp_stop_cpu(void);
34extern void smp_cpu_set_polarization(int cpu, int val);
35extern int smp_cpu_get_polarization(int cpu);
36extern void smp_fill_possible_mask(void);
37
38#else /* CONFIG_SMP */
39
40static inline void smp_call_ipl_cpu(void (*func)(void *), void *data)
41{
42 func(data);
43}
44
45static inline void smp_call_online_cpu(void (*func)(void *), void *data)
46{
47 func(data);
48}
49
50static inline int smp_find_processor_id(u16 address) { return 0; }
51static inline int smp_store_status(int cpu) { return 0; }
52static inline int smp_vcpu_scheduled(int cpu) { return 1; }
53static inline void smp_yield_cpu(int cpu) { }
54static inline void smp_yield(void) { }
55static inline void smp_fill_possible_mask(void) { }
56
57static inline void smp_stop_cpu(void)
58{
59 u16 pcpu = stap();
60
61 for (;;) {
62 __pcpu_sigp(pcpu, SIGP_STOP, 0, NULL);
63 cpu_relax();
64 }
65}
66
67#endif /* CONFIG_SMP */
68
69#ifdef CONFIG_HOTPLUG_CPU
70extern int smp_rescan_cpus(void);
71extern void __noreturn cpu_die(void);
72extern void __cpu_die(unsigned int cpu);
73extern int __cpu_disable(void);
74#else
75static inline int smp_rescan_cpus(void) { return 0; }
76static inline void cpu_die(void) { }
77#endif
78
79#endif /* __ASM_SMP_H */