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 void on_each_cpu_mask(const struct cpumask *mask,
48 void (*func)(void *), void *info, bool wait);
49
50
51extern HV_Topology smp_topology;
52
53
54#define smp_height (smp_topology.height)
55#define smp_width (smp_topology.width)
56
57
58static inline int cpu_x(int cpu)
59{
60 return cpu % smp_width;
61}
62static inline int cpu_y(int cpu)
63{
64 return cpu / smp_width;
65}
66static inline int xy_to_cpu(int x, int y)
67{
68 return y * smp_width + x;
69}
70
71
72#define MSG_TAG_START_CPU 1
73#define MSG_TAG_STOP_CPU 2
74#define MSG_TAG_CALL_FUNCTION_MANY 3
75#define MSG_TAG_CALL_FUNCTION_SINGLE 4
76
77
78static inline void arch_send_call_function_ipi_mask(struct cpumask *mask)
79{
80 send_IPI_many(mask, MSG_TAG_CALL_FUNCTION_MANY);
81}
82
83
84static inline void arch_send_call_function_single_ipi(int cpu)
85{
86 send_IPI_single(cpu, MSG_TAG_CALL_FUNCTION_SINGLE);
87}
88
89
90void print_disabled_cpus(void);
91
92#else
93
94#define on_each_cpu_mask(mask, func, info, wait) \
95 do { if (cpumask_test_cpu(0, (mask))) func(info); } while (0)
96
97#define smp_master_cpu 0
98#define smp_height 1
99#define smp_width 1
100#define cpu_x(cpu) 0
101#define cpu_y(cpu) 0
102#define xy_to_cpu(x, y) 0
103
104#endif
105
106
107
108extern struct cpumask cpu_lotar_map;
109#define cpu_is_valid_lotar(cpu) cpumask_test_cpu((cpu), &cpu_lotar_map)
110
111#if CHIP_HAS_CBOX_HOME_MAP()
112
113extern struct cpumask hash_for_home_map;
114#endif
115
116
117extern struct cpumask cpu_cacheable_map;
118#define cpu_cacheable(cpu) cpumask_test_cpu((cpu), &cpu_cacheable_map)
119
120
121static inline int hv_lotar_to_cpu(HV_LOTAR lotar)
122{
123 return HV_LOTAR_X(lotar) + (HV_LOTAR_Y(lotar) * smp_width);
124}
125
126
127
128
129
130
131int bitmap_parselist_crop(const char *bp, unsigned long *maskp, int nmaskbits);
132
133#define cpulist_parse_crop(buf, dst) \
134 __cpulist_parse_crop((buf), (dst), NR_CPUS)
135static inline int __cpulist_parse_crop(const char *buf, struct cpumask *dstp,
136 int nbits)
137{
138 return bitmap_parselist_crop(buf, cpumask_bits(dstp), nbits);
139}
140
141
142void ipi_init(void);
143
144
145extern unsigned long start_cpu_function_addr;
146
147#endif
148