spi-topcliff-pch: Fix issue for transmitting over 4KByte
[zen-stable.git] / arch / tile / include / asm / smp.h
blob532124ae4b128f896335b0629af9043fc5277aaa
1 /*
2 * Copyright 2010 Tilera Corporation. All Rights Reserved.
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation, version 2.
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
11 * NON INFRINGEMENT. See the GNU General Public License for
12 * more details.
15 #ifndef _ASM_TILE_SMP_H
16 #define _ASM_TILE_SMP_H
18 #ifdef CONFIG_SMP
20 #include <asm/processor.h>
21 #include <linux/cpumask.h>
22 #include <linux/irqreturn.h>
23 #include <hv/hypervisor.h>
25 /* Set up this tile to support receiving hypervisor messages */
26 void init_messaging(void);
28 /* Set up this tile to support receiving device interrupts and IPIs. */
29 void init_per_tile_IRQs(void);
31 /* Send a message to processors specified in mask */
32 void send_IPI_many(const struct cpumask *mask, int tag);
34 /* Send a message to all but the sending processor */
35 void send_IPI_allbutself(int tag);
37 /* Send a message to a specific processor */
38 void send_IPI_single(int dest, int tag);
40 /* Process an IPI message */
41 void evaluate_message(int tag);
43 /* Boot a secondary cpu */
44 void online_secondary(void);
46 /* Call a function on a specified set of CPUs (may include this one). */
47 extern void on_each_cpu_mask(const struct cpumask *mask,
48 void (*func)(void *), void *info, bool wait);
50 /* Topology of the supervisor tile grid, and coordinates of boot processor */
51 extern HV_Topology smp_topology;
53 /* Accessors for grid size */
54 #define smp_height (smp_topology.height)
55 #define smp_width (smp_topology.width)
57 /* Convenience functions for converting cpu <-> coords. */
58 static inline int cpu_x(int cpu)
60 return cpu % smp_width;
62 static inline int cpu_y(int cpu)
64 return cpu / smp_width;
66 static inline int xy_to_cpu(int x, int y)
68 return y * smp_width + x;
71 /* Hypervisor message tags sent via the tile send_IPI*() routines. */
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
77 /* Hook for the generic smp_call_function_many() routine. */
78 static inline void arch_send_call_function_ipi_mask(struct cpumask *mask)
80 send_IPI_many(mask, MSG_TAG_CALL_FUNCTION_MANY);
83 /* Hook for the generic smp_call_function_single() routine. */
84 static inline void arch_send_call_function_single_ipi(int cpu)
86 send_IPI_single(cpu, MSG_TAG_CALL_FUNCTION_SINGLE);
89 /* Print out the boot string describing which cpus were disabled. */
90 void print_disabled_cpus(void);
92 #else /* !CONFIG_SMP */
94 #define on_each_cpu_mask(mask, func, info, wait) \
95 do { if (cpumask_test_cpu(0, (mask))) func(info); } while (0)
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
104 #endif /* !CONFIG_SMP */
107 /* Which cpus may be used as the lotar in a page table entry. */
108 extern struct cpumask cpu_lotar_map;
109 #define cpu_is_valid_lotar(cpu) cpumask_test_cpu((cpu), &cpu_lotar_map)
111 #if CHIP_HAS_CBOX_HOME_MAP()
112 /* Which processors are used for hash-for-home mapping */
113 extern struct cpumask hash_for_home_map;
114 #endif
116 /* Which cpus can have their cache flushed by hv_flush_remote(). */
117 extern struct cpumask cpu_cacheable_map;
118 #define cpu_cacheable(cpu) cpumask_test_cpu((cpu), &cpu_cacheable_map)
120 /* Convert an HV_LOTAR value into a cpu. */
121 static inline int hv_lotar_to_cpu(HV_LOTAR lotar)
123 return HV_LOTAR_X(lotar) + (HV_LOTAR_Y(lotar) * smp_width);
127 * Extension of <linux/cpumask.h> functionality when you just want
128 * to express a mask or suppression or inclusion region without
129 * being too concerned about exactly which cpus are valid in that region.
131 int bitmap_parselist_crop(const char *bp, unsigned long *maskp, int nmaskbits);
133 #define cpulist_parse_crop(buf, dst) \
134 __cpulist_parse_crop((buf), (dst), NR_CPUS)
135 static inline int __cpulist_parse_crop(const char *buf, struct cpumask *dstp,
136 int nbits)
138 return bitmap_parselist_crop(buf, cpumask_bits(dstp), nbits);
141 /* Initialize the IPI subsystem. */
142 void ipi_init(void);
144 /* Function for start-cpu message to cause us to jump to. */
145 extern unsigned long start_cpu_function_addr;
147 #endif /* _ASM_TILE_SMP_H */