File Index
Files and directories
Sign in
FILE

smp.h

File preview with syntax highlighting.

linux-6.19.14/arch/s390/include/asm/smp.h C
 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/processor.h>
11#include <asm/lowcore.h>
12#include <asm/machine.h>
13#include <asm/sigp.h>
14
15static __always_inline unsigned int raw_smp_processor_id(void)
16{
17	unsigned long lc_cpu_nr;
18	unsigned int cpu;
19
20	BUILD_BUG_ON(sizeof_field(struct lowcore, cpu_nr) != sizeof(cpu));
21	lc_cpu_nr = offsetof(struct lowcore, cpu_nr);
22	asm_inline(
23		ALTERNATIVE("   ly      %[cpu],%[offzero](%%r0)\n",
24			    "   ly      %[cpu],%[offalt](%%r0)\n",
25			    ALT_FEATURE(MFEATURE_LOWCORE))
26		: [cpu] "=d" (cpu)
27		: [offzero] "i" (lc_cpu_nr),
28		  [offalt] "i" (lc_cpu_nr + LOWCORE_ALT_ADDRESS),
29		  "m" (((struct lowcore *)0)->cpu_nr));
30	return cpu;
31}
32
33#define arch_scale_cpu_capacity smp_cpu_get_capacity
34
35extern struct mutex smp_cpu_state_mutex;
36extern unsigned int smp_cpu_mt_shift;
37extern unsigned int smp_cpu_mtid;
38extern __vector128 __initdata boot_cpu_vector_save_area[__NUM_VXRS];
39extern cpumask_t cpu_setup_mask;
40
41extern int __cpu_up(unsigned int cpu, struct task_struct *tidle);
42
43extern void arch_send_call_function_single_ipi(int cpu);
44extern void arch_send_call_function_ipi_mask(const struct cpumask *mask);
45
46extern void __noreturn smp_call_ipl_cpu(void (*func)(void *), void *data);
47extern void smp_emergency_stop(void);
48
49extern int smp_find_processor_id(u16 address);
50extern int smp_store_status(int cpu);
51extern void smp_save_dump_ipl_cpu(void);
52extern void smp_save_dump_secondary_cpus(void);
53extern void smp_yield_cpu(int cpu);
54extern void smp_cpu_set_polarization(int cpu, int val);
55extern int smp_cpu_get_polarization(int cpu);
56extern void smp_cpu_set_capacity(int cpu, unsigned long val);
57extern void smp_set_core_capacity(int cpu, unsigned long val);
58extern unsigned long smp_cpu_get_capacity(int cpu);
59extern int smp_cpu_get_cpu_address(int cpu);
60extern void smp_fill_possible_mask(void);
61extern void smp_detect_cpus(void);
62
63static inline void smp_stop_cpu(void)
64{
65	u16 pcpu = stap();
66
67	for (;;) {
68		__pcpu_sigp(pcpu, SIGP_STOP, 0, NULL);
69		cpu_relax();
70	}
71}
72
73/* Return thread 0 CPU number as base CPU */
74static inline int smp_get_base_cpu(int cpu)
75{
76	return cpu - (cpu % (smp_cpu_mtid + 1));
77}
78
79static inline void smp_cpus_done(unsigned int max_cpus)
80{
81}
82
83extern int smp_rescan_cpus(bool early);
84extern void __noreturn cpu_die(void);
85extern void __cpu_die(unsigned int cpu);
86extern int __cpu_disable(void);
87extern void schedule_mcck_handler(void);
88void notrace smp_yield_cpu(int cpu);
89
90#endif /* __ASM_SMP_H */
~/ Read-only file preview.