xref: /openbmc/linux/arch/ia64/include/asm/smp.h (revision 2f8be0e5)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * SMP Support
4  *
5  * Copyright (C) 1999 VA Linux Systems
6  * Copyright (C) 1999 Walt Drummond <drummond@valinux.com>
7  * (c) Copyright 2001-2003, 2005 Hewlett-Packard Development Company, L.P.
8  *	David Mosberger-Tang <davidm@hpl.hp.com>
9  *	Bjorn Helgaas <bjorn.helgaas@hp.com>
10  */
11 #ifndef _ASM_IA64_SMP_H
12 #define _ASM_IA64_SMP_H
13 
14 #include <linux/init.h>
15 #include <linux/threads.h>
16 #include <linux/kernel.h>
17 #include <linux/cpumask.h>
18 #include <linux/bitops.h>
19 #include <linux/irqreturn.h>
20 
21 #include <asm/param.h>
22 #include <asm/processor.h>
23 #include <asm/ptrace.h>
24 
25 static inline unsigned int
26 ia64_get_lid (void)
27 {
28 	union {
29 		struct {
30 			unsigned long reserved : 16;
31 			unsigned long eid : 8;
32 			unsigned long id : 8;
33 			unsigned long ignored : 32;
34 		} f;
35 		unsigned long bits;
36 	} lid;
37 
38 	lid.bits = ia64_getreg(_IA64_REG_CR_LID);
39 	return lid.f.id << 8 | lid.f.eid;
40 }
41 
42 #define hard_smp_processor_id()		ia64_get_lid()
43 
44 #ifdef CONFIG_SMP
45 
46 #define raw_smp_processor_id() (current_thread_info()->cpu)
47 
48 extern struct smp_boot_data {
49 	int cpu_count;
50 	int cpu_phys_id[NR_CPUS];
51 } smp_boot_data __initdata;
52 
53 extern char no_int_routing;
54 
55 extern cpumask_t cpu_core_map[NR_CPUS];
56 DECLARE_PER_CPU_SHARED_ALIGNED(cpumask_t, cpu_sibling_map);
57 extern int smp_num_siblings;
58 extern void __iomem *ipi_base_addr;
59 
60 extern volatile int ia64_cpu_to_sapicid[];
61 #define cpu_physical_id(i)	ia64_cpu_to_sapicid[i]
62 
63 extern unsigned long ap_wakeup_vector;
64 
65 /*
66  * Function to map hard smp processor id to logical id.  Slow, so don't use this in
67  * performance-critical code.
68  */
69 static inline int
70 cpu_logical_id (int cpuid)
71 {
72 	int i;
73 
74 	for (i = 0; i < NR_CPUS; ++i)
75 		if (cpu_physical_id(i) == cpuid)
76 			break;
77 	return i;
78 }
79 
80 /* Upping and downing of CPUs */
81 extern int __cpu_disable (void);
82 extern void __cpu_die (unsigned int cpu);
83 extern void cpu_die (void) __attribute__ ((noreturn));
84 extern void __init smp_build_cpu_map(void);
85 
86 extern void __init init_smp_config (void);
87 extern void smp_do_timer (struct pt_regs *regs);
88 
89 extern irqreturn_t handle_IPI(int irq, void *dev_id);
90 extern void smp_send_reschedule (int cpu);
91 extern void identify_siblings (struct cpuinfo_ia64 *);
92 extern int is_multithreading_enabled(void);
93 
94 extern void arch_send_call_function_single_ipi(int cpu);
95 extern void arch_send_call_function_ipi_mask(const struct cpumask *mask);
96 
97 #else /* CONFIG_SMP */
98 
99 #define cpu_logical_id(i)		0
100 #define cpu_physical_id(i)		ia64_get_lid()
101 
102 #endif /* CONFIG_SMP */
103 #endif /* _ASM_IA64_SMP_H */
104