1
2
3
4
5
6
7
8
9
10
11
12
13
14
15#ifndef _ASM_TILE_SMP_H
16#define _ASM_TILE_SMP_H
17
18#ifdef CONFIG_SMP
19
20#include <asm/processor.h>
21#include <linux/cpumask.h>
22#include <linux/irqreturn.h>
23#include <hv/hypervisor.h>
24
25
26void init_messaging(void);
27
28
29void init_per_tile_IRQs(void);
30
31
32void send_IPI_many(const struct cpumask *mask, int tag);
33
34
35void send_IPI_allbutself(int tag);
36
37
38void send_IPI_single(int dest, int tag);
39
40
41void evaluate_message(int tag);
42
43
44void online_secondary(void);
45
46
47extern HV_Topology smp_topology;
48
49
50#define smp_height (smp_topology.height)
51#define smp_width (smp_topology.width)
52
53
54static inline int cpu_x(int cpu)
55{
56 return cpu % smp_width;
57}
58static inline int cpu_y(int cpu)
59{
60 return cpu / smp_width;
61}
62static inline int xy_to_cpu(int x, int y)
63{
64 return y * smp_width + x;
65}
66
67
68#define MSG_TAG_START_CPU 1
69#define MSG_TAG_STOP_CPU 2
70#define MSG_TAG_CALL_FUNCTION_MANY 3
71#define MSG_TAG_CALL_FUNCTION_SINGLE 4
72
73
74static inline void arch_send_call_function_ipi_mask(struct cpumask *mask)
75{
76 send_IPI_many(mask, MSG_TAG_CALL_FUNCTION_MANY);
77}
78
79
80static inline void arch_send_call_function_single_ipi(int cpu)
81{
82 send_IPI_single(cpu, MSG_TAG_CALL_FUNCTION_SINGLE);
83}
84
85
86void print_disabled_cpus(void);
87
88#else
89
90#define smp_master_cpu 0
91#define smp_height 1
92#define smp_width 1
93#define cpu_x(cpu) 0
94#define cpu_y(cpu) 0
95#define xy_to_cpu(x, y) 0
96
97#endif
98
99
100
101extern struct cpumask cpu_lotar_map;
102#define cpu_is_valid_lotar(cpu) cpumask_test_cpu((cpu), &cpu_lotar_map)
103
104#if CHIP_HAS_CBOX_HOME_MAP()
105
106extern struct cpumask hash_for_home_map;
107#endif
108
109
110extern struct cpumask cpu_cacheable_map;
111#define cpu_cacheable(cpu) cpumask_test_cpu((cpu), &cpu_cacheable_map)
112
113
114static inline int hv_lotar_to_cpu(HV_LOTAR lotar)
115{
116 return HV_LOTAR_X(lotar) + (HV_LOTAR_Y(lotar) * smp_width);
117}
118
119
120
121
122
123
124int bitmap_parselist_crop(const char *bp, unsigned long *maskp, int nmaskbits);
125
126#define cpulist_parse_crop(buf, dst) \
127 __cpulist_parse_crop((buf), (dst), NR_CPUS)
128static inline int __cpulist_parse_crop(const char *buf, struct cpumask *dstp,
129 int nbits)
130{
131 return bitmap_parselist_crop(buf, cpumask_bits(dstp), nbits);
132}
133
134
135void ipi_init(void);
136
137
138extern unsigned long start_cpu_function_addr;
139
140#endif
141