Cliff Wickman | 1812924 | 2008-06-02 08:56:14 -0500 | [diff] [blame] | 1 | /* |
| 2 | * SGI UltraViolet TLB flush routines. |
| 3 | * |
Cliff Wickman | a26fd71 | 2014-05-14 16:15:47 -0500 | [diff] [blame] | 4 | * (c) 2008-2014 Cliff Wickman <cpw@sgi.com>, SGI. |
Cliff Wickman | 1812924 | 2008-06-02 08:56:14 -0500 | [diff] [blame] | 5 | * |
| 6 | * This code is released under the GNU General Public License version 2 or |
| 7 | * later. |
| 8 | */ |
Jeremy Fitzhardinge | aef8f5b | 2008-10-14 21:43:43 -0700 | [diff] [blame] | 9 | #include <linux/seq_file.h> |
Cliff Wickman | 1812924 | 2008-06-02 08:56:14 -0500 | [diff] [blame] | 10 | #include <linux/proc_fs.h> |
Cliff Wickman | e8e5e8a | 2010-06-02 16:22:01 -0500 | [diff] [blame] | 11 | #include <linux/debugfs.h> |
Cliff Wickman | 1812924 | 2008-06-02 08:56:14 -0500 | [diff] [blame] | 12 | #include <linux/kernel.h> |
Tejun Heo | 5a0e3ad | 2010-03-24 17:04:11 +0900 | [diff] [blame] | 13 | #include <linux/slab.h> |
Jean Delvare | ca444564 | 2011-03-25 15:20:14 +0100 | [diff] [blame] | 14 | #include <linux/delay.h> |
Cliff Wickman | 1812924 | 2008-06-02 08:56:14 -0500 | [diff] [blame] | 15 | |
Cliff Wickman | 1812924 | 2008-06-02 08:56:14 -0500 | [diff] [blame] | 16 | #include <asm/mmu_context.h> |
Tejun Heo | bdbcdd4 | 2009-01-21 17:26:06 +0900 | [diff] [blame] | 17 | #include <asm/uv/uv.h> |
Cliff Wickman | 1812924 | 2008-06-02 08:56:14 -0500 | [diff] [blame] | 18 | #include <asm/uv/uv_mmrs.h> |
Ingo Molnar | b4c286e | 2008-06-18 14:28:19 +0200 | [diff] [blame] | 19 | #include <asm/uv/uv_hub.h> |
Cliff Wickman | 1812924 | 2008-06-02 08:56:14 -0500 | [diff] [blame] | 20 | #include <asm/uv/uv_bau.h> |
Ingo Molnar | 7b6aa33 | 2009-02-17 13:58:15 +0100 | [diff] [blame] | 21 | #include <asm/apic.h> |
Ingo Molnar | b4c286e | 2008-06-18 14:28:19 +0200 | [diff] [blame] | 22 | #include <asm/idle.h> |
Cliff Wickman | b194b12 | 2008-06-12 08:23:48 -0500 | [diff] [blame] | 23 | #include <asm/tsc.h> |
Cliff Wickman | 99dd871 | 2008-08-19 12:51:59 -0500 | [diff] [blame] | 24 | #include <asm/irq_vectors.h> |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 25 | #include <asm/timer.h> |
Cliff Wickman | 1812924 | 2008-06-02 08:56:14 -0500 | [diff] [blame] | 26 | |
Cliff Wickman | 12a6611 | 2010-06-02 16:22:01 -0500 | [diff] [blame] | 27 | /* timeouts in nanoseconds (indexed by UVH_AGING_PRESCALE_SEL urgency7 30:28) */ |
| 28 | static int timeout_base_ns[] = { |
| 29 | 20, |
| 30 | 160, |
| 31 | 1280, |
| 32 | 10240, |
| 33 | 81920, |
| 34 | 655360, |
| 35 | 5242880, |
| 36 | 167772160 |
| 37 | }; |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 38 | |
Cliff Wickman | 12a6611 | 2010-06-02 16:22:01 -0500 | [diff] [blame] | 39 | static int timeout_us; |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 40 | static int nobau; |
Cliff Wickman | 26ef857 | 2012-06-22 08:13:30 -0500 | [diff] [blame] | 41 | static int nobau_perm; |
Cliff Wickman | 50fb55a | 2010-06-02 16:22:02 -0500 | [diff] [blame] | 42 | static cycles_t congested_cycles; |
Cliff Wickman | e8e5e8a | 2010-06-02 16:22:01 -0500 | [diff] [blame] | 43 | |
| 44 | /* tunables: */ |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 45 | static int max_concurr = MAX_BAU_CONCURRENT; |
| 46 | static int max_concurr_const = MAX_BAU_CONCURRENT; |
| 47 | static int plugged_delay = PLUGGED_DELAY; |
| 48 | static int plugsb4reset = PLUGSB4RESET; |
Cliff Wickman | 8b6e511 | 2012-06-22 08:14:59 -0500 | [diff] [blame] | 49 | static int giveup_limit = GIVEUP_LIMIT; |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 50 | static int timeoutsb4reset = TIMEOUTSB4RESET; |
| 51 | static int ipi_reset_limit = IPI_RESET_LIMIT; |
| 52 | static int complete_threshold = COMPLETE_THRESHOLD; |
| 53 | static int congested_respns_us = CONGESTED_RESPONSE_US; |
| 54 | static int congested_reps = CONGESTED_REPS; |
Cliff Wickman | 8b6e511 | 2012-06-22 08:14:59 -0500 | [diff] [blame] | 55 | static int disabled_period = DISABLED_PERIOD; |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 56 | |
| 57 | static struct tunables tunables[] = { |
| 58 | {&max_concurr, MAX_BAU_CONCURRENT}, /* must be [0] */ |
| 59 | {&plugged_delay, PLUGGED_DELAY}, |
| 60 | {&plugsb4reset, PLUGSB4RESET}, |
| 61 | {&timeoutsb4reset, TIMEOUTSB4RESET}, |
| 62 | {&ipi_reset_limit, IPI_RESET_LIMIT}, |
| 63 | {&complete_threshold, COMPLETE_THRESHOLD}, |
| 64 | {&congested_respns_us, CONGESTED_RESPONSE_US}, |
| 65 | {&congested_reps, CONGESTED_REPS}, |
Cliff Wickman | 8b6e511 | 2012-06-22 08:14:59 -0500 | [diff] [blame] | 66 | {&disabled_period, DISABLED_PERIOD}, |
| 67 | {&giveup_limit, GIVEUP_LIMIT} |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 68 | }; |
| 69 | |
Cliff Wickman | e8e5e8a | 2010-06-02 16:22:01 -0500 | [diff] [blame] | 70 | static struct dentry *tunables_dir; |
| 71 | static struct dentry *tunables_file; |
| 72 | |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 73 | /* these correspond to the statistics printed by ptc_seq_show() */ |
| 74 | static char *stat_description[] = { |
| 75 | "sent: number of shootdown messages sent", |
| 76 | "stime: time spent sending messages", |
| 77 | "numuvhubs: number of hubs targeted with shootdown", |
| 78 | "numuvhubs16: number times 16 or more hubs targeted", |
| 79 | "numuvhubs8: number times 8 or more hubs targeted", |
| 80 | "numuvhubs4: number times 4 or more hubs targeted", |
| 81 | "numuvhubs2: number times 2 or more hubs targeted", |
| 82 | "numuvhubs1: number times 1 hub targeted", |
| 83 | "numcpus: number of cpus targeted with shootdown", |
| 84 | "dto: number of destination timeouts", |
| 85 | "retries: destination timeout retries sent", |
| 86 | "rok: : destination timeouts successfully retried", |
| 87 | "resetp: ipi-style resource resets for plugs", |
| 88 | "resett: ipi-style resource resets for timeouts", |
| 89 | "giveup: fall-backs to ipi-style shootdowns", |
| 90 | "sto: number of source timeouts", |
| 91 | "bz: number of stay-busy's", |
| 92 | "throt: number times spun in throttle", |
| 93 | "swack: image of UVH_LB_BAU_INTD_SOFTWARE_ACKNOWLEDGE", |
| 94 | "recv: shootdown messages received", |
| 95 | "rtime: time spent processing messages", |
| 96 | "all: shootdown all-tlb messages", |
| 97 | "one: shootdown one-tlb messages", |
| 98 | "mult: interrupts that found multiple messages", |
| 99 | "none: interrupts that found no messages", |
| 100 | "retry: number of retry messages processed", |
| 101 | "canc: number messages canceled by retries", |
| 102 | "nocan: number retries that found nothing to cancel", |
| 103 | "reset: number of ipi-style reset requests processed", |
| 104 | "rcan: number messages canceled by reset requests", |
| 105 | "disable: number times use of the BAU was disabled", |
| 106 | "enable: number times use of the BAU was re-enabled" |
| 107 | }; |
| 108 | |
| 109 | static int __init |
| 110 | setup_nobau(char *arg) |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 111 | { |
| 112 | nobau = 1; |
| 113 | return 0; |
| 114 | } |
| 115 | early_param("nobau", setup_nobau); |
Ingo Molnar | b4c286e | 2008-06-18 14:28:19 +0200 | [diff] [blame] | 116 | |
Cliff Wickman | 94ca8e4 | 2009-04-14 10:56:48 -0500 | [diff] [blame] | 117 | /* base pnode in this partition */ |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 118 | static int uv_base_pnode __read_mostly; |
Cliff Wickman | 1812924 | 2008-06-02 08:56:14 -0500 | [diff] [blame] | 119 | |
Ingo Molnar | dc163a4 | 2008-06-18 14:15:43 +0200 | [diff] [blame] | 120 | static DEFINE_PER_CPU(struct ptc_stats, ptcstats); |
| 121 | static DEFINE_PER_CPU(struct bau_control, bau_control); |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 122 | static DEFINE_PER_CPU(cpumask_var_t, uv_flush_tlb_mask); |
| 123 | |
Cliff Wickman | 26ef857 | 2012-06-22 08:13:30 -0500 | [diff] [blame] | 124 | static void |
| 125 | set_bau_on(void) |
| 126 | { |
| 127 | int cpu; |
| 128 | struct bau_control *bcp; |
| 129 | |
| 130 | if (nobau_perm) { |
| 131 | pr_info("BAU not initialized; cannot be turned on\n"); |
| 132 | return; |
| 133 | } |
| 134 | nobau = 0; |
| 135 | for_each_present_cpu(cpu) { |
| 136 | bcp = &per_cpu(bau_control, cpu); |
| 137 | bcp->nobau = 0; |
| 138 | } |
| 139 | pr_info("BAU turned on\n"); |
| 140 | return; |
| 141 | } |
| 142 | |
| 143 | static void |
| 144 | set_bau_off(void) |
| 145 | { |
| 146 | int cpu; |
| 147 | struct bau_control *bcp; |
| 148 | |
| 149 | nobau = 1; |
| 150 | for_each_present_cpu(cpu) { |
| 151 | bcp = &per_cpu(bau_control, cpu); |
| 152 | bcp->nobau = 1; |
| 153 | } |
| 154 | pr_info("BAU turned off\n"); |
| 155 | return; |
| 156 | } |
| 157 | |
Cliff Wickman | 1812924 | 2008-06-02 08:56:14 -0500 | [diff] [blame] | 158 | /* |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 159 | * Determine the first node on a uvhub. 'Nodes' are used for kernel |
| 160 | * memory allocation. |
Cliff Wickman | 9674f35 | 2009-04-03 08:34:05 -0500 | [diff] [blame] | 161 | */ |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 162 | static int __init uvhub_to_first_node(int uvhub) |
Cliff Wickman | 9674f35 | 2009-04-03 08:34:05 -0500 | [diff] [blame] | 163 | { |
| 164 | int node, b; |
| 165 | |
| 166 | for_each_online_node(node) { |
| 167 | b = uv_node_to_blade_id(node); |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 168 | if (uvhub == b) |
Cliff Wickman | 9674f35 | 2009-04-03 08:34:05 -0500 | [diff] [blame] | 169 | return node; |
| 170 | } |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 171 | return -1; |
Cliff Wickman | 9674f35 | 2009-04-03 08:34:05 -0500 | [diff] [blame] | 172 | } |
| 173 | |
| 174 | /* |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 175 | * Determine the apicid of the first cpu on a uvhub. |
Cliff Wickman | 9674f35 | 2009-04-03 08:34:05 -0500 | [diff] [blame] | 176 | */ |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 177 | static int __init uvhub_to_first_apicid(int uvhub) |
Cliff Wickman | 9674f35 | 2009-04-03 08:34:05 -0500 | [diff] [blame] | 178 | { |
| 179 | int cpu; |
| 180 | |
| 181 | for_each_present_cpu(cpu) |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 182 | if (uvhub == uv_cpu_to_blade_id(cpu)) |
Cliff Wickman | 9674f35 | 2009-04-03 08:34:05 -0500 | [diff] [blame] | 183 | return per_cpu(x86_cpu_to_apicid, cpu); |
| 184 | return -1; |
| 185 | } |
| 186 | |
| 187 | /* |
Cliff Wickman | 1812924 | 2008-06-02 08:56:14 -0500 | [diff] [blame] | 188 | * Free a software acknowledge hardware resource by clearing its Pending |
| 189 | * bit. This will return a reply to the sender. |
| 190 | * If the message has timed out, a reply has already been sent by the |
| 191 | * hardware but the resource has not been released. In that case our |
| 192 | * clear of the Timeout bit (as well) will free the resource. No reply will |
| 193 | * be sent (the hardware will only do one reply per message). |
| 194 | */ |
Cliff Wickman | c5d35d3 | 2012-01-16 15:19:47 -0600 | [diff] [blame] | 195 | static void reply_to_message(struct msg_desc *mdp, struct bau_control *bcp, |
| 196 | int do_acknowledge) |
Cliff Wickman | 1812924 | 2008-06-02 08:56:14 -0500 | [diff] [blame] | 197 | { |
Cliff Wickman | b194b12 | 2008-06-12 08:23:48 -0500 | [diff] [blame] | 198 | unsigned long dw; |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 199 | struct bau_pq_entry *msg; |
Cliff Wickman | 1812924 | 2008-06-02 08:56:14 -0500 | [diff] [blame] | 200 | |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 201 | msg = mdp->msg; |
Cliff Wickman | c5d35d3 | 2012-01-16 15:19:47 -0600 | [diff] [blame] | 202 | if (!msg->canceled && do_acknowledge) { |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 203 | dw = (msg->swack_vec << UV_SW_ACK_NPENDING) | msg->swack_vec; |
| 204 | write_mmr_sw_ack(dw); |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 205 | } |
Cliff Wickman | 1812924 | 2008-06-02 08:56:14 -0500 | [diff] [blame] | 206 | msg->replied_to = 1; |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 207 | msg->swack_vec = 0; |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 208 | } |
| 209 | |
| 210 | /* |
| 211 | * Process the receipt of a RETRY message |
| 212 | */ |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 213 | static void bau_process_retry_msg(struct msg_desc *mdp, |
| 214 | struct bau_control *bcp) |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 215 | { |
| 216 | int i; |
| 217 | int cancel_count = 0; |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 218 | unsigned long msg_res; |
| 219 | unsigned long mmr = 0; |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 220 | struct bau_pq_entry *msg = mdp->msg; |
| 221 | struct bau_pq_entry *msg2; |
| 222 | struct ptc_stats *stat = bcp->statp; |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 223 | |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 224 | stat->d_retries++; |
| 225 | /* |
| 226 | * cancel any message from msg+1 to the retry itself |
| 227 | */ |
| 228 | for (msg2 = msg+1, i = 0; i < DEST_Q_SIZE; msg2++, i++) { |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 229 | if (msg2 > mdp->queue_last) |
| 230 | msg2 = mdp->queue_first; |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 231 | if (msg2 == msg) |
| 232 | break; |
| 233 | |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 234 | /* same conditions for cancellation as do_reset */ |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 235 | if ((msg2->replied_to == 0) && (msg2->canceled == 0) && |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 236 | (msg2->swack_vec) && ((msg2->swack_vec & |
| 237 | msg->swack_vec) == 0) && |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 238 | (msg2->sending_cpu == msg->sending_cpu) && |
| 239 | (msg2->msg_type != MSG_NOOP)) { |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 240 | mmr = read_mmr_sw_ack(); |
| 241 | msg_res = msg2->swack_vec; |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 242 | /* |
| 243 | * This is a message retry; clear the resources held |
| 244 | * by the previous message only if they timed out. |
| 245 | * If it has not timed out we have an unexpected |
| 246 | * situation to report. |
| 247 | */ |
Cliff Wickman | 39847e7 | 2010-06-02 16:22:02 -0500 | [diff] [blame] | 248 | if (mmr & (msg_res << UV_SW_ACK_NPENDING)) { |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 249 | unsigned long mr; |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 250 | /* |
Cliff Wickman | c5d35d3 | 2012-01-16 15:19:47 -0600 | [diff] [blame] | 251 | * Is the resource timed out? |
| 252 | * Make everyone ignore the cancelled message. |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 253 | */ |
| 254 | msg2->canceled = 1; |
| 255 | stat->d_canceled++; |
| 256 | cancel_count++; |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 257 | mr = (msg_res << UV_SW_ACK_NPENDING) | msg_res; |
| 258 | write_mmr_sw_ack(mr); |
Cliff Wickman | 39847e7 | 2010-06-02 16:22:02 -0500 | [diff] [blame] | 259 | } |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 260 | } |
| 261 | } |
| 262 | if (!cancel_count) |
| 263 | stat->d_nocanceled++; |
Cliff Wickman | 1812924 | 2008-06-02 08:56:14 -0500 | [diff] [blame] | 264 | } |
| 265 | |
| 266 | /* |
| 267 | * Do all the things a cpu should do for a TLB shootdown message. |
| 268 | * Other cpu's may come here at the same time for this message. |
| 269 | */ |
Cliff Wickman | c5d35d3 | 2012-01-16 15:19:47 -0600 | [diff] [blame] | 270 | static void bau_process_message(struct msg_desc *mdp, struct bau_control *bcp, |
| 271 | int do_acknowledge) |
Cliff Wickman | 1812924 | 2008-06-02 08:56:14 -0500 | [diff] [blame] | 272 | { |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 273 | short socket_ack_count = 0; |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 274 | short *sp; |
| 275 | struct atomic_short *asp; |
| 276 | struct ptc_stats *stat = bcp->statp; |
| 277 | struct bau_pq_entry *msg = mdp->msg; |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 278 | struct bau_control *smaster = bcp->socket_master; |
Cliff Wickman | 1812924 | 2008-06-02 08:56:14 -0500 | [diff] [blame] | 279 | |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 280 | /* |
| 281 | * This must be a normal message, or retry of a normal message |
| 282 | */ |
Cliff Wickman | 1812924 | 2008-06-02 08:56:14 -0500 | [diff] [blame] | 283 | if (msg->address == TLB_FLUSH_ALL) { |
| 284 | local_flush_tlb(); |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 285 | stat->d_alltlb++; |
Cliff Wickman | 1812924 | 2008-06-02 08:56:14 -0500 | [diff] [blame] | 286 | } else { |
| 287 | __flush_tlb_one(msg->address); |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 288 | stat->d_onetlb++; |
Cliff Wickman | 1812924 | 2008-06-02 08:56:14 -0500 | [diff] [blame] | 289 | } |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 290 | stat->d_requestee++; |
Cliff Wickman | 1812924 | 2008-06-02 08:56:14 -0500 | [diff] [blame] | 291 | |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 292 | /* |
| 293 | * One cpu on each uvhub has the additional job on a RETRY |
| 294 | * of releasing the resource held by the message that is |
| 295 | * being retried. That message is identified by sending |
| 296 | * cpu number. |
| 297 | */ |
| 298 | if (msg->msg_type == MSG_RETRY && bcp == bcp->uvhub_master) |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 299 | bau_process_retry_msg(mdp, bcp); |
Cliff Wickman | 1812924 | 2008-06-02 08:56:14 -0500 | [diff] [blame] | 300 | |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 301 | /* |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 302 | * This is a swack message, so we have to reply to it. |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 303 | * Count each responding cpu on the socket. This avoids |
| 304 | * pinging the count's cache line back and forth between |
| 305 | * the sockets. |
| 306 | */ |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 307 | sp = &smaster->socket_acknowledge_count[mdp->msg_slot]; |
| 308 | asp = (struct atomic_short *)sp; |
| 309 | socket_ack_count = atom_asr(1, asp); |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 310 | if (socket_ack_count == bcp->cpus_in_socket) { |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 311 | int msg_ack_count; |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 312 | /* |
| 313 | * Both sockets dump their completed count total into |
| 314 | * the message's count. |
| 315 | */ |
Cliff Wickman | 8b6e511 | 2012-06-22 08:14:59 -0500 | [diff] [blame] | 316 | *sp = 0; |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 317 | asp = (struct atomic_short *)&msg->acknowledge_count; |
| 318 | msg_ack_count = atom_asr(socket_ack_count, asp); |
Ingo Molnar | dc163a4 | 2008-06-18 14:15:43 +0200 | [diff] [blame] | 319 | |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 320 | if (msg_ack_count == bcp->cpus_in_uvhub) { |
| 321 | /* |
| 322 | * All cpus in uvhub saw it; reply |
Cliff Wickman | c5d35d3 | 2012-01-16 15:19:47 -0600 | [diff] [blame] | 323 | * (unless we are in the UV2 workaround) |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 324 | */ |
Cliff Wickman | c5d35d3 | 2012-01-16 15:19:47 -0600 | [diff] [blame] | 325 | reply_to_message(mdp, bcp, do_acknowledge); |
Ingo Molnar | dc163a4 | 2008-06-18 14:15:43 +0200 | [diff] [blame] | 326 | } |
| 327 | } |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 328 | |
| 329 | return; |
Cliff Wickman | 1812924 | 2008-06-02 08:56:14 -0500 | [diff] [blame] | 330 | } |
| 331 | |
| 332 | /* |
cpw@sgi.com | 485f07d | 2011-06-21 07:21:29 -0500 | [diff] [blame] | 333 | * Determine the first cpu on a pnode. |
Cliff Wickman | 1812924 | 2008-06-02 08:56:14 -0500 | [diff] [blame] | 334 | */ |
cpw@sgi.com | 485f07d | 2011-06-21 07:21:29 -0500 | [diff] [blame] | 335 | static int pnode_to_first_cpu(int pnode, struct bau_control *smaster) |
Cliff Wickman | 1812924 | 2008-06-02 08:56:14 -0500 | [diff] [blame] | 336 | { |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 337 | int cpu; |
cpw@sgi.com | 485f07d | 2011-06-21 07:21:29 -0500 | [diff] [blame] | 338 | struct hub_and_pnode *hpp; |
| 339 | |
| 340 | for_each_present_cpu(cpu) { |
| 341 | hpp = &smaster->thp[cpu]; |
| 342 | if (pnode == hpp->pnode) |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 343 | return cpu; |
cpw@sgi.com | 485f07d | 2011-06-21 07:21:29 -0500 | [diff] [blame] | 344 | } |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 345 | return -1; |
Cliff Wickman | 1812924 | 2008-06-02 08:56:14 -0500 | [diff] [blame] | 346 | } |
| 347 | |
Cliff Wickman | b194b12 | 2008-06-12 08:23:48 -0500 | [diff] [blame] | 348 | /* |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 349 | * Last resort when we get a large number of destination timeouts is |
| 350 | * to clear resources held by a given cpu. |
| 351 | * Do this with IPI so that all messages in the BAU message queue |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 352 | * can be identified by their nonzero swack_vec field. |
Cliff Wickman | b194b12 | 2008-06-12 08:23:48 -0500 | [diff] [blame] | 353 | * |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 354 | * This is entered for a single cpu on the uvhub. |
| 355 | * The sender want's this uvhub to free a specific message's |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 356 | * swack resources. |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 357 | */ |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 358 | static void do_reset(void *ptr) |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 359 | { |
| 360 | int i; |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 361 | struct bau_control *bcp = &per_cpu(bau_control, smp_processor_id()); |
| 362 | struct reset_args *rap = (struct reset_args *)ptr; |
| 363 | struct bau_pq_entry *msg; |
| 364 | struct ptc_stats *stat = bcp->statp; |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 365 | |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 366 | stat->d_resets++; |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 367 | /* |
| 368 | * We're looking for the given sender, and |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 369 | * will free its swack resource. |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 370 | * If all cpu's finally responded after the timeout, its |
| 371 | * message 'replied_to' was set. |
| 372 | */ |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 373 | for (msg = bcp->queue_first, i = 0; i < DEST_Q_SIZE; msg++, i++) { |
| 374 | unsigned long msg_res; |
| 375 | /* do_reset: same conditions for cancellation as |
| 376 | bau_process_retry_msg() */ |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 377 | if ((msg->replied_to == 0) && |
| 378 | (msg->canceled == 0) && |
| 379 | (msg->sending_cpu == rap->sender) && |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 380 | (msg->swack_vec) && |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 381 | (msg->msg_type != MSG_NOOP)) { |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 382 | unsigned long mmr; |
| 383 | unsigned long mr; |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 384 | /* |
| 385 | * make everyone else ignore this message |
| 386 | */ |
| 387 | msg->canceled = 1; |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 388 | /* |
| 389 | * only reset the resource if it is still pending |
| 390 | */ |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 391 | mmr = read_mmr_sw_ack(); |
| 392 | msg_res = msg->swack_vec; |
| 393 | mr = (msg_res << UV_SW_ACK_NPENDING) | msg_res; |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 394 | if (mmr & msg_res) { |
| 395 | stat->d_rcanceled++; |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 396 | write_mmr_sw_ack(mr); |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 397 | } |
| 398 | } |
| 399 | } |
| 400 | return; |
| 401 | } |
| 402 | |
| 403 | /* |
| 404 | * Use IPI to get all target uvhubs to release resources held by |
| 405 | * a given sending cpu number. |
| 406 | */ |
cpw@sgi.com | a456eaa | 2011-06-21 07:21:30 -0500 | [diff] [blame] | 407 | static void reset_with_ipi(struct pnmask *distribution, struct bau_control *bcp) |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 408 | { |
cpw@sgi.com | 485f07d | 2011-06-21 07:21:29 -0500 | [diff] [blame] | 409 | int pnode; |
| 410 | int apnode; |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 411 | int maskbits; |
cpw@sgi.com | 485f07d | 2011-06-21 07:21:29 -0500 | [diff] [blame] | 412 | int sender = bcp->cpu; |
cpw@sgi.com | 442d392 | 2011-06-21 07:21:31 -0500 | [diff] [blame] | 413 | cpumask_t *mask = bcp->uvhub_master->cpumask; |
cpw@sgi.com | 485f07d | 2011-06-21 07:21:29 -0500 | [diff] [blame] | 414 | struct bau_control *smaster = bcp->socket_master; |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 415 | struct reset_args reset_args; |
| 416 | |
| 417 | reset_args.sender = sender; |
cpw@sgi.com | 442d392 | 2011-06-21 07:21:31 -0500 | [diff] [blame] | 418 | cpus_clear(*mask); |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 419 | /* find a single cpu for each uvhub in this distribution mask */ |
cpw@sgi.com | a456eaa | 2011-06-21 07:21:30 -0500 | [diff] [blame] | 420 | maskbits = sizeof(struct pnmask) * BITSPERBYTE; |
cpw@sgi.com | 485f07d | 2011-06-21 07:21:29 -0500 | [diff] [blame] | 421 | /* each bit is a pnode relative to the partition base pnode */ |
| 422 | for (pnode = 0; pnode < maskbits; pnode++) { |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 423 | int cpu; |
cpw@sgi.com | 485f07d | 2011-06-21 07:21:29 -0500 | [diff] [blame] | 424 | if (!bau_uvhub_isset(pnode, distribution)) |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 425 | continue; |
cpw@sgi.com | 485f07d | 2011-06-21 07:21:29 -0500 | [diff] [blame] | 426 | apnode = pnode + bcp->partition_base_pnode; |
| 427 | cpu = pnode_to_first_cpu(apnode, smaster); |
cpw@sgi.com | 442d392 | 2011-06-21 07:21:31 -0500 | [diff] [blame] | 428 | cpu_set(cpu, *mask); |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 429 | } |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 430 | |
| 431 | /* IPI all cpus; preemption is already disabled */ |
cpw@sgi.com | 442d392 | 2011-06-21 07:21:31 -0500 | [diff] [blame] | 432 | smp_call_function_many(mask, do_reset, (void *)&reset_args, 1); |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 433 | return; |
| 434 | } |
| 435 | |
Peter Zijlstra | 20d1c86 | 2013-11-29 15:40:29 +0100 | [diff] [blame] | 436 | /* |
| 437 | * Not to be confused with cycles_2_ns() from tsc.c; this gives a relative |
| 438 | * number, not an absolute. It converts a duration in cycles to a duration in |
| 439 | * ns. |
| 440 | */ |
| 441 | static inline unsigned long long cycles_2_ns(unsigned long long cyc) |
| 442 | { |
| 443 | struct cyc2ns_data *data = cyc2ns_read_begin(); |
| 444 | unsigned long long ns; |
| 445 | |
| 446 | ns = mul_u64_u32_shr(cyc, data->cyc2ns_mul, data->cyc2ns_shift); |
| 447 | |
| 448 | cyc2ns_read_end(data); |
| 449 | return ns; |
| 450 | } |
| 451 | |
| 452 | /* |
| 453 | * The reverse of the above; converts a duration in ns to a duration in cycles. |
Cliff Wickman | a26fd71 | 2014-05-14 16:15:47 -0500 | [diff] [blame] | 454 | */ |
Peter Zijlstra | 20d1c86 | 2013-11-29 15:40:29 +0100 | [diff] [blame] | 455 | static inline unsigned long long ns_2_cycles(unsigned long long ns) |
| 456 | { |
| 457 | struct cyc2ns_data *data = cyc2ns_read_begin(); |
| 458 | unsigned long long cyc; |
| 459 | |
| 460 | cyc = (ns << data->cyc2ns_shift) / data->cyc2ns_mul; |
| 461 | |
| 462 | cyc2ns_read_end(data); |
| 463 | return cyc; |
| 464 | } |
| 465 | |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 466 | static inline unsigned long cycles_2_us(unsigned long long cyc) |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 467 | { |
Peter Zijlstra | 20d1c86 | 2013-11-29 15:40:29 +0100 | [diff] [blame] | 468 | return cycles_2_ns(cyc) / NSEC_PER_USEC; |
| 469 | } |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 470 | |
Peter Zijlstra | 20d1c86 | 2013-11-29 15:40:29 +0100 | [diff] [blame] | 471 | static inline cycles_t sec_2_cycles(unsigned long sec) |
| 472 | { |
| 473 | return ns_2_cycles(sec * NSEC_PER_SEC); |
| 474 | } |
| 475 | |
| 476 | static inline unsigned long long usec_2_cycles(unsigned long usec) |
| 477 | { |
| 478 | return ns_2_cycles(usec * NSEC_PER_USEC); |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 479 | } |
| 480 | |
| 481 | /* |
| 482 | * wait for all cpus on this hub to finish their sends and go quiet |
| 483 | * leaves uvhub_quiesce set so that no new broadcasts are started by |
| 484 | * bau_flush_send_and_wait() |
| 485 | */ |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 486 | static inline void quiesce_local_uvhub(struct bau_control *hmaster) |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 487 | { |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 488 | atom_asr(1, (struct atomic_short *)&hmaster->uvhub_quiesce); |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 489 | } |
| 490 | |
| 491 | /* |
| 492 | * mark this quiet-requestor as done |
| 493 | */ |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 494 | static inline void end_uvhub_quiesce(struct bau_control *hmaster) |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 495 | { |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 496 | atom_asr(-1, (struct atomic_short *)&hmaster->uvhub_quiesce); |
| 497 | } |
| 498 | |
| 499 | static unsigned long uv1_read_status(unsigned long mmr_offset, int right_shift) |
| 500 | { |
| 501 | unsigned long descriptor_status; |
| 502 | |
| 503 | descriptor_status = uv_read_local_mmr(mmr_offset); |
| 504 | descriptor_status >>= right_shift; |
| 505 | descriptor_status &= UV_ACT_STATUS_MASK; |
| 506 | return descriptor_status; |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 507 | } |
| 508 | |
| 509 | /* |
| 510 | * Wait for completion of a broadcast software ack message |
| 511 | * return COMPLETE, RETRY(PLUGGED or TIMEOUT) or GIVEUP |
Cliff Wickman | b194b12 | 2008-06-12 08:23:48 -0500 | [diff] [blame] | 512 | */ |
Jack Steiner | 2a91959 | 2011-05-11 12:50:28 -0500 | [diff] [blame] | 513 | static int uv1_wait_completion(struct bau_desc *bau_desc, |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 514 | unsigned long mmr_offset, int right_shift, |
| 515 | struct bau_control *bcp, long try) |
Cliff Wickman | b194b12 | 2008-06-12 08:23:48 -0500 | [diff] [blame] | 516 | { |
Cliff Wickman | b194b12 | 2008-06-12 08:23:48 -0500 | [diff] [blame] | 517 | unsigned long descriptor_status; |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 518 | cycles_t ttm; |
Cliff Wickman | 712157a | 2010-06-02 16:22:02 -0500 | [diff] [blame] | 519 | struct ptc_stats *stat = bcp->statp; |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 520 | |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 521 | descriptor_status = uv1_read_status(mmr_offset, right_shift); |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 522 | /* spin on the status MMR, waiting for it to go idle */ |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 523 | while ((descriptor_status != DS_IDLE)) { |
Cliff Wickman | b194b12 | 2008-06-12 08:23:48 -0500 | [diff] [blame] | 524 | /* |
Jack Steiner | 2a91959 | 2011-05-11 12:50:28 -0500 | [diff] [blame] | 525 | * Our software ack messages may be blocked because |
| 526 | * there are no swack resources available. As long |
| 527 | * as none of them has timed out hardware will NACK |
| 528 | * our message and its state will stay IDLE. |
Cliff Wickman | b194b12 | 2008-06-12 08:23:48 -0500 | [diff] [blame] | 529 | */ |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 530 | if (descriptor_status == DS_SOURCE_TIMEOUT) { |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 531 | stat->s_stimeout++; |
| 532 | return FLUSH_GIVEUP; |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 533 | } else if (descriptor_status == DS_DESTINATION_TIMEOUT) { |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 534 | stat->s_dtimeout++; |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 535 | ttm = get_cycles(); |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 536 | |
| 537 | /* |
| 538 | * Our retries may be blocked by all destination |
| 539 | * swack resources being consumed, and a timeout |
| 540 | * pending. In that case hardware returns the |
| 541 | * ERROR that looks like a destination timeout. |
| 542 | */ |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 543 | if (cycles_2_us(ttm - bcp->send_message) < timeout_us) { |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 544 | bcp->conseccompletes = 0; |
| 545 | return FLUSH_RETRY_PLUGGED; |
| 546 | } |
| 547 | |
| 548 | bcp->conseccompletes = 0; |
| 549 | return FLUSH_RETRY_TIMEOUT; |
| 550 | } else { |
| 551 | /* |
| 552 | * descriptor_status is still BUSY |
| 553 | */ |
| 554 | cpu_relax(); |
Cliff Wickman | b194b12 | 2008-06-12 08:23:48 -0500 | [diff] [blame] | 555 | } |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 556 | descriptor_status = uv1_read_status(mmr_offset, right_shift); |
Cliff Wickman | b194b12 | 2008-06-12 08:23:48 -0500 | [diff] [blame] | 557 | } |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 558 | bcp->conseccompletes++; |
Cliff Wickman | b194b12 | 2008-06-12 08:23:48 -0500 | [diff] [blame] | 559 | return FLUSH_COMPLETE; |
| 560 | } |
| 561 | |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 562 | /* |
Cliff Wickman | 8b6e511 | 2012-06-22 08:14:59 -0500 | [diff] [blame] | 563 | * UV2 could have an extra bit of status in the ACTIVATION_STATUS_2 register. |
| 564 | * But not currently used. |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 565 | */ |
Cliff Wickman | a26fd71 | 2014-05-14 16:15:47 -0500 | [diff] [blame] | 566 | static unsigned long uv2_3_read_status(unsigned long offset, int rshft, int desc) |
Jack Steiner | 2a91959 | 2011-05-11 12:50:28 -0500 | [diff] [blame] | 567 | { |
| 568 | unsigned long descriptor_status; |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 569 | |
Cliff Wickman | 8b6e511 | 2012-06-22 08:14:59 -0500 | [diff] [blame] | 570 | descriptor_status = |
| 571 | ((read_lmmr(offset) >> rshft) & UV_ACT_STATUS_MASK) << 1; |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 572 | return descriptor_status; |
| 573 | } |
| 574 | |
Cliff Wickman | c5d35d3 | 2012-01-16 15:19:47 -0600 | [diff] [blame] | 575 | /* |
| 576 | * Return whether the status of the descriptor that is normally used for this |
| 577 | * cpu (the one indexed by its hub-relative cpu number) is busy. |
| 578 | * The status of the original 32 descriptors is always reflected in the 64 |
| 579 | * bits of UVH_LB_BAU_SB_ACTIVATION_STATUS_0. |
| 580 | * The bit provided by the activation_status_2 register is irrelevant to |
| 581 | * the status if it is only being tested for busy or not busy. |
| 582 | */ |
| 583 | int normal_busy(struct bau_control *bcp) |
| 584 | { |
| 585 | int cpu = bcp->uvhub_cpu; |
| 586 | int mmr_offset; |
| 587 | int right_shift; |
| 588 | |
| 589 | mmr_offset = UVH_LB_BAU_SB_ACTIVATION_STATUS_0; |
| 590 | right_shift = cpu * UV_ACT_STATUS_SIZE; |
| 591 | return (((((read_lmmr(mmr_offset) >> right_shift) & |
| 592 | UV_ACT_STATUS_MASK)) << 1) == UV2H_DESC_BUSY); |
| 593 | } |
| 594 | |
| 595 | /* |
| 596 | * Entered when a bau descriptor has gone into a permanent busy wait because |
| 597 | * of a hardware bug. |
| 598 | * Workaround the bug. |
| 599 | */ |
| 600 | int handle_uv2_busy(struct bau_control *bcp) |
| 601 | { |
Cliff Wickman | c5d35d3 | 2012-01-16 15:19:47 -0600 | [diff] [blame] | 602 | struct ptc_stats *stat = bcp->statp; |
Cliff Wickman | c5d35d3 | 2012-01-16 15:19:47 -0600 | [diff] [blame] | 603 | |
| 604 | stat->s_uv2_wars++; |
Cliff Wickman | 8b6e511 | 2012-06-22 08:14:59 -0500 | [diff] [blame] | 605 | bcp->busy = 1; |
| 606 | return FLUSH_GIVEUP; |
Cliff Wickman | c5d35d3 | 2012-01-16 15:19:47 -0600 | [diff] [blame] | 607 | } |
| 608 | |
Cliff Wickman | a26fd71 | 2014-05-14 16:15:47 -0500 | [diff] [blame] | 609 | static int uv2_3_wait_completion(struct bau_desc *bau_desc, |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 610 | unsigned long mmr_offset, int right_shift, |
| 611 | struct bau_control *bcp, long try) |
| 612 | { |
| 613 | unsigned long descriptor_stat; |
| 614 | cycles_t ttm; |
Cliff Wickman | 8b6e511 | 2012-06-22 08:14:59 -0500 | [diff] [blame] | 615 | int desc = bcp->uvhub_cpu; |
Cliff Wickman | c5d35d3 | 2012-01-16 15:19:47 -0600 | [diff] [blame] | 616 | long busy_reps = 0; |
Jack Steiner | 2a91959 | 2011-05-11 12:50:28 -0500 | [diff] [blame] | 617 | struct ptc_stats *stat = bcp->statp; |
| 618 | |
Cliff Wickman | a26fd71 | 2014-05-14 16:15:47 -0500 | [diff] [blame] | 619 | descriptor_stat = uv2_3_read_status(mmr_offset, right_shift, desc); |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 620 | |
Jack Steiner | 2a91959 | 2011-05-11 12:50:28 -0500 | [diff] [blame] | 621 | /* spin on the status MMR, waiting for it to go idle */ |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 622 | while (descriptor_stat != UV2H_DESC_IDLE) { |
Cliff Wickman | 8b6e511 | 2012-06-22 08:14:59 -0500 | [diff] [blame] | 623 | if ((descriptor_stat == UV2H_DESC_SOURCE_TIMEOUT)) { |
| 624 | /* |
| 625 | * A h/w bug on the destination side may |
| 626 | * have prevented the message being marked |
| 627 | * pending, thus it doesn't get replied to |
| 628 | * and gets continually nacked until it times |
| 629 | * out with a SOURCE_TIMEOUT. |
| 630 | */ |
Jack Steiner | 2a91959 | 2011-05-11 12:50:28 -0500 | [diff] [blame] | 631 | stat->s_stimeout++; |
| 632 | return FLUSH_GIVEUP; |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 633 | } else if (descriptor_stat == UV2H_DESC_DEST_TIMEOUT) { |
Cliff Wickman | 8b6e511 | 2012-06-22 08:14:59 -0500 | [diff] [blame] | 634 | ttm = get_cycles(); |
| 635 | |
| 636 | /* |
| 637 | * Our retries may be blocked by all destination |
| 638 | * swack resources being consumed, and a timeout |
| 639 | * pending. In that case hardware returns the |
| 640 | * ERROR that looks like a destination timeout. |
| 641 | * Without using the extended status we have to |
| 642 | * deduce from the short time that this was a |
| 643 | * strong nack. |
| 644 | */ |
| 645 | if (cycles_2_us(ttm - bcp->send_message) < timeout_us) { |
| 646 | bcp->conseccompletes = 0; |
| 647 | stat->s_plugged++; |
| 648 | /* FLUSH_RETRY_PLUGGED causes hang on boot */ |
| 649 | return FLUSH_GIVEUP; |
| 650 | } |
Jack Steiner | 2a91959 | 2011-05-11 12:50:28 -0500 | [diff] [blame] | 651 | stat->s_dtimeout++; |
Jack Steiner | 2a91959 | 2011-05-11 12:50:28 -0500 | [diff] [blame] | 652 | bcp->conseccompletes = 0; |
Cliff Wickman | 8b6e511 | 2012-06-22 08:14:59 -0500 | [diff] [blame] | 653 | /* FLUSH_RETRY_TIMEOUT causes hang on boot */ |
| 654 | return FLUSH_GIVEUP; |
Jack Steiner | 2a91959 | 2011-05-11 12:50:28 -0500 | [diff] [blame] | 655 | } else { |
Cliff Wickman | c5d35d3 | 2012-01-16 15:19:47 -0600 | [diff] [blame] | 656 | busy_reps++; |
| 657 | if (busy_reps > 1000000) { |
| 658 | /* not to hammer on the clock */ |
| 659 | busy_reps = 0; |
| 660 | ttm = get_cycles(); |
Cliff Wickman | a26fd71 | 2014-05-14 16:15:47 -0500 | [diff] [blame] | 661 | if ((ttm - bcp->send_message) > bcp->timeout_interval) |
Cliff Wickman | c5d35d3 | 2012-01-16 15:19:47 -0600 | [diff] [blame] | 662 | return handle_uv2_busy(bcp); |
Cliff Wickman | c5d35d3 | 2012-01-16 15:19:47 -0600 | [diff] [blame] | 663 | } |
Jack Steiner | 2a91959 | 2011-05-11 12:50:28 -0500 | [diff] [blame] | 664 | /* |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 665 | * descriptor_stat is still BUSY |
Jack Steiner | 2a91959 | 2011-05-11 12:50:28 -0500 | [diff] [blame] | 666 | */ |
| 667 | cpu_relax(); |
| 668 | } |
Cliff Wickman | a26fd71 | 2014-05-14 16:15:47 -0500 | [diff] [blame] | 669 | descriptor_stat = uv2_3_read_status(mmr_offset, right_shift, desc); |
Jack Steiner | 2a91959 | 2011-05-11 12:50:28 -0500 | [diff] [blame] | 670 | } |
| 671 | bcp->conseccompletes++; |
| 672 | return FLUSH_COMPLETE; |
| 673 | } |
| 674 | |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 675 | /* |
| 676 | * There are 2 status registers; each and array[32] of 2 bits. Set up for |
| 677 | * which register to read and position in that register based on cpu in |
| 678 | * current hub. |
| 679 | */ |
Cliff Wickman | a26fd71 | 2014-05-14 16:15:47 -0500 | [diff] [blame] | 680 | static int wait_completion(struct bau_desc *bau_desc, struct bau_control *bcp, long try) |
Jack Steiner | 2a91959 | 2011-05-11 12:50:28 -0500 | [diff] [blame] | 681 | { |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 682 | int right_shift; |
| 683 | unsigned long mmr_offset; |
Cliff Wickman | 8b6e511 | 2012-06-22 08:14:59 -0500 | [diff] [blame] | 684 | int desc = bcp->uvhub_cpu; |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 685 | |
Cliff Wickman | c5d35d3 | 2012-01-16 15:19:47 -0600 | [diff] [blame] | 686 | if (desc < UV_CPUS_PER_AS) { |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 687 | mmr_offset = UVH_LB_BAU_SB_ACTIVATION_STATUS_0; |
Cliff Wickman | c5d35d3 | 2012-01-16 15:19:47 -0600 | [diff] [blame] | 688 | right_shift = desc * UV_ACT_STATUS_SIZE; |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 689 | } else { |
| 690 | mmr_offset = UVH_LB_BAU_SB_ACTIVATION_STATUS_1; |
Cliff Wickman | c5d35d3 | 2012-01-16 15:19:47 -0600 | [diff] [blame] | 691 | right_shift = ((desc - UV_CPUS_PER_AS) * UV_ACT_STATUS_SIZE); |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 692 | } |
| 693 | |
Cliff Wickman | da87c93 | 2012-01-16 15:17:50 -0600 | [diff] [blame] | 694 | if (bcp->uvhub_version == 1) |
Cliff Wickman | a26fd71 | 2014-05-14 16:15:47 -0500 | [diff] [blame] | 695 | return uv1_wait_completion(bau_desc, mmr_offset, right_shift, bcp, try); |
Jack Steiner | 2a91959 | 2011-05-11 12:50:28 -0500 | [diff] [blame] | 696 | else |
Cliff Wickman | a26fd71 | 2014-05-14 16:15:47 -0500 | [diff] [blame] | 697 | return uv2_3_wait_completion(bau_desc, mmr_offset, right_shift, bcp, try); |
Jack Steiner | 2a91959 | 2011-05-11 12:50:28 -0500 | [diff] [blame] | 698 | } |
| 699 | |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 700 | /* |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 701 | * Our retries are blocked by all destination sw ack resources being |
Cliff Wickman | f6d8a56 | 2010-06-02 16:22:02 -0500 | [diff] [blame] | 702 | * in use, and a timeout is pending. In that case hardware immediately |
| 703 | * returns the ERROR that looks like a destination timeout. |
| 704 | */ |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 705 | static void destination_plugged(struct bau_desc *bau_desc, |
| 706 | struct bau_control *bcp, |
Cliff Wickman | f6d8a56 | 2010-06-02 16:22:02 -0500 | [diff] [blame] | 707 | struct bau_control *hmaster, struct ptc_stats *stat) |
| 708 | { |
| 709 | udelay(bcp->plugged_delay); |
| 710 | bcp->plugged_tries++; |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 711 | |
Cliff Wickman | f6d8a56 | 2010-06-02 16:22:02 -0500 | [diff] [blame] | 712 | if (bcp->plugged_tries >= bcp->plugsb4reset) { |
| 713 | bcp->plugged_tries = 0; |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 714 | |
Cliff Wickman | f6d8a56 | 2010-06-02 16:22:02 -0500 | [diff] [blame] | 715 | quiesce_local_uvhub(hmaster); |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 716 | |
Cliff Wickman | f6d8a56 | 2010-06-02 16:22:02 -0500 | [diff] [blame] | 717 | spin_lock(&hmaster->queue_lock); |
cpw@sgi.com | 485f07d | 2011-06-21 07:21:29 -0500 | [diff] [blame] | 718 | reset_with_ipi(&bau_desc->distribution, bcp); |
Cliff Wickman | f6d8a56 | 2010-06-02 16:22:02 -0500 | [diff] [blame] | 719 | spin_unlock(&hmaster->queue_lock); |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 720 | |
Cliff Wickman | f6d8a56 | 2010-06-02 16:22:02 -0500 | [diff] [blame] | 721 | end_uvhub_quiesce(hmaster); |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 722 | |
Cliff Wickman | f6d8a56 | 2010-06-02 16:22:02 -0500 | [diff] [blame] | 723 | bcp->ipi_attempts++; |
| 724 | stat->s_resets_plug++; |
| 725 | } |
| 726 | } |
| 727 | |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 728 | static void destination_timeout(struct bau_desc *bau_desc, |
| 729 | struct bau_control *bcp, struct bau_control *hmaster, |
| 730 | struct ptc_stats *stat) |
Cliff Wickman | f6d8a56 | 2010-06-02 16:22:02 -0500 | [diff] [blame] | 731 | { |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 732 | hmaster->max_concurr = 1; |
Cliff Wickman | f6d8a56 | 2010-06-02 16:22:02 -0500 | [diff] [blame] | 733 | bcp->timeout_tries++; |
| 734 | if (bcp->timeout_tries >= bcp->timeoutsb4reset) { |
| 735 | bcp->timeout_tries = 0; |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 736 | |
Cliff Wickman | f6d8a56 | 2010-06-02 16:22:02 -0500 | [diff] [blame] | 737 | quiesce_local_uvhub(hmaster); |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 738 | |
Cliff Wickman | f6d8a56 | 2010-06-02 16:22:02 -0500 | [diff] [blame] | 739 | spin_lock(&hmaster->queue_lock); |
cpw@sgi.com | 485f07d | 2011-06-21 07:21:29 -0500 | [diff] [blame] | 740 | reset_with_ipi(&bau_desc->distribution, bcp); |
Cliff Wickman | f6d8a56 | 2010-06-02 16:22:02 -0500 | [diff] [blame] | 741 | spin_unlock(&hmaster->queue_lock); |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 742 | |
Cliff Wickman | f6d8a56 | 2010-06-02 16:22:02 -0500 | [diff] [blame] | 743 | end_uvhub_quiesce(hmaster); |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 744 | |
Cliff Wickman | f6d8a56 | 2010-06-02 16:22:02 -0500 | [diff] [blame] | 745 | bcp->ipi_attempts++; |
| 746 | stat->s_resets_timeout++; |
| 747 | } |
| 748 | } |
| 749 | |
| 750 | /* |
Cliff Wickman | 8b6e511 | 2012-06-22 08:14:59 -0500 | [diff] [blame] | 751 | * Stop all cpus on a uvhub from using the BAU for a period of time. |
| 752 | * This is reversed by check_enable. |
Cliff Wickman | 50fb55a | 2010-06-02 16:22:02 -0500 | [diff] [blame] | 753 | */ |
Cliff Wickman | 8b6e511 | 2012-06-22 08:14:59 -0500 | [diff] [blame] | 754 | static void disable_for_period(struct bau_control *bcp, struct ptc_stats *stat) |
Cliff Wickman | 50fb55a | 2010-06-02 16:22:02 -0500 | [diff] [blame] | 755 | { |
Cliff Wickman | 8b6e511 | 2012-06-22 08:14:59 -0500 | [diff] [blame] | 756 | int tcpu; |
| 757 | struct bau_control *tbcp; |
| 758 | struct bau_control *hmaster; |
| 759 | cycles_t tm1; |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 760 | |
Cliff Wickman | 8b6e511 | 2012-06-22 08:14:59 -0500 | [diff] [blame] | 761 | hmaster = bcp->uvhub_master; |
| 762 | spin_lock(&hmaster->disable_lock); |
| 763 | if (!bcp->baudisabled) { |
Cliff Wickman | 50fb55a | 2010-06-02 16:22:02 -0500 | [diff] [blame] | 764 | stat->s_bau_disabled++; |
Cliff Wickman | 8b6e511 | 2012-06-22 08:14:59 -0500 | [diff] [blame] | 765 | tm1 = get_cycles(); |
Cliff Wickman | 50fb55a | 2010-06-02 16:22:02 -0500 | [diff] [blame] | 766 | for_each_present_cpu(tcpu) { |
| 767 | tbcp = &per_cpu(bau_control, tcpu); |
Cliff Wickman | 8b6e511 | 2012-06-22 08:14:59 -0500 | [diff] [blame] | 768 | if (tbcp->uvhub_master == hmaster) { |
| 769 | tbcp->baudisabled = 1; |
| 770 | tbcp->set_bau_on_time = |
| 771 | tm1 + bcp->disabled_period; |
| 772 | } |
Cliff Wickman | 50fb55a | 2010-06-02 16:22:02 -0500 | [diff] [blame] | 773 | } |
| 774 | } |
Cliff Wickman | 8b6e511 | 2012-06-22 08:14:59 -0500 | [diff] [blame] | 775 | spin_unlock(&hmaster->disable_lock); |
Cliff Wickman | 50fb55a | 2010-06-02 16:22:02 -0500 | [diff] [blame] | 776 | } |
| 777 | |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 778 | static void count_max_concurr(int stat, struct bau_control *bcp, |
| 779 | struct bau_control *hmaster) |
| 780 | { |
| 781 | bcp->plugged_tries = 0; |
| 782 | bcp->timeout_tries = 0; |
| 783 | if (stat != FLUSH_COMPLETE) |
| 784 | return; |
| 785 | if (bcp->conseccompletes <= bcp->complete_threshold) |
| 786 | return; |
| 787 | if (hmaster->max_concurr >= hmaster->max_concurr_const) |
| 788 | return; |
| 789 | hmaster->max_concurr++; |
| 790 | } |
| 791 | |
| 792 | static void record_send_stats(cycles_t time1, cycles_t time2, |
| 793 | struct bau_control *bcp, struct ptc_stats *stat, |
| 794 | int completion_status, int try) |
| 795 | { |
| 796 | cycles_t elapsed; |
| 797 | |
| 798 | if (time2 > time1) { |
| 799 | elapsed = time2 - time1; |
| 800 | stat->s_time += elapsed; |
| 801 | |
| 802 | if ((completion_status == FLUSH_COMPLETE) && (try == 1)) { |
| 803 | bcp->period_requests++; |
| 804 | bcp->period_time += elapsed; |
| 805 | if ((elapsed > congested_cycles) && |
Cliff Wickman | 8b6e511 | 2012-06-22 08:14:59 -0500 | [diff] [blame] | 806 | (bcp->period_requests > bcp->cong_reps) && |
| 807 | ((bcp->period_time / bcp->period_requests) > |
| 808 | congested_cycles)) { |
| 809 | stat->s_congested++; |
| 810 | disable_for_period(bcp, stat); |
| 811 | } |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 812 | } |
| 813 | } else |
| 814 | stat->s_requestor--; |
| 815 | |
| 816 | if (completion_status == FLUSH_COMPLETE && try > 1) |
| 817 | stat->s_retriesok++; |
Cliff Wickman | 8b6e511 | 2012-06-22 08:14:59 -0500 | [diff] [blame] | 818 | else if (completion_status == FLUSH_GIVEUP) { |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 819 | stat->s_giveup++; |
Cliff Wickman | 8b6e511 | 2012-06-22 08:14:59 -0500 | [diff] [blame] | 820 | if (get_cycles() > bcp->period_end) |
| 821 | bcp->period_giveups = 0; |
| 822 | bcp->period_giveups++; |
| 823 | if (bcp->period_giveups == 1) |
| 824 | bcp->period_end = get_cycles() + bcp->disabled_period; |
| 825 | if (bcp->period_giveups > bcp->giveup_limit) { |
| 826 | disable_for_period(bcp, stat); |
| 827 | stat->s_giveuplimit++; |
| 828 | } |
| 829 | } |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 830 | } |
| 831 | |
| 832 | /* |
| 833 | * Because of a uv1 hardware bug only a limited number of concurrent |
| 834 | * requests can be made. |
| 835 | */ |
| 836 | static void uv1_throttle(struct bau_control *hmaster, struct ptc_stats *stat) |
| 837 | { |
| 838 | spinlock_t *lock = &hmaster->uvhub_lock; |
| 839 | atomic_t *v; |
| 840 | |
| 841 | v = &hmaster->active_descriptor_count; |
| 842 | if (!atomic_inc_unless_ge(lock, v, hmaster->max_concurr)) { |
| 843 | stat->s_throttles++; |
| 844 | do { |
| 845 | cpu_relax(); |
| 846 | } while (!atomic_inc_unless_ge(lock, v, hmaster->max_concurr)); |
| 847 | } |
| 848 | } |
| 849 | |
| 850 | /* |
| 851 | * Handle the completion status of a message send. |
| 852 | */ |
| 853 | static void handle_cmplt(int completion_status, struct bau_desc *bau_desc, |
| 854 | struct bau_control *bcp, struct bau_control *hmaster, |
| 855 | struct ptc_stats *stat) |
| 856 | { |
| 857 | if (completion_status == FLUSH_RETRY_PLUGGED) |
| 858 | destination_plugged(bau_desc, bcp, hmaster, stat); |
| 859 | else if (completion_status == FLUSH_RETRY_TIMEOUT) |
| 860 | destination_timeout(bau_desc, bcp, hmaster, stat); |
| 861 | } |
| 862 | |
| 863 | /* |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 864 | * Send a broadcast and wait for it to complete. |
Cliff Wickman | b194b12 | 2008-06-12 08:23:48 -0500 | [diff] [blame] | 865 | * |
Cliff Wickman | f6d8a56 | 2010-06-02 16:22:02 -0500 | [diff] [blame] | 866 | * The flush_mask contains the cpus the broadcast is to be sent to including |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 867 | * cpus that are on the local uvhub. |
Cliff Wickman | b194b12 | 2008-06-12 08:23:48 -0500 | [diff] [blame] | 868 | * |
Cliff Wickman | 450a007 | 2010-06-02 16:22:02 -0500 | [diff] [blame] | 869 | * Returns 0 if all flushing represented in the mask was done. |
| 870 | * Returns 1 if it gives up entirely and the original cpu mask is to be |
| 871 | * returned to the kernel. |
Cliff Wickman | b194b12 | 2008-06-12 08:23:48 -0500 | [diff] [blame] | 872 | */ |
Cliff Wickman | 8b6e511 | 2012-06-22 08:14:59 -0500 | [diff] [blame] | 873 | int uv_flush_send_and_wait(struct cpumask *flush_mask, struct bau_control *bcp, |
| 874 | struct bau_desc *bau_desc) |
Cliff Wickman | b194b12 | 2008-06-12 08:23:48 -0500 | [diff] [blame] | 875 | { |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 876 | int seq_number = 0; |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 877 | int completion_stat = 0; |
Cliff Wickman | da87c93 | 2012-01-16 15:17:50 -0600 | [diff] [blame] | 878 | int uv1 = 0; |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 879 | long try = 0; |
Ingo Molnar | b4c286e | 2008-06-18 14:28:19 +0200 | [diff] [blame] | 880 | unsigned long index; |
Cliff Wickman | b194b12 | 2008-06-12 08:23:48 -0500 | [diff] [blame] | 881 | cycles_t time1; |
| 882 | cycles_t time2; |
Cliff Wickman | 712157a | 2010-06-02 16:22:02 -0500 | [diff] [blame] | 883 | struct ptc_stats *stat = bcp->statp; |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 884 | struct bau_control *hmaster = bcp->uvhub_master; |
Cliff Wickman | da87c93 | 2012-01-16 15:17:50 -0600 | [diff] [blame] | 885 | struct uv1_bau_msg_header *uv1_hdr = NULL; |
Cliff Wickman | a26fd71 | 2014-05-14 16:15:47 -0500 | [diff] [blame] | 886 | struct uv2_3_bau_msg_header *uv2_3_hdr = NULL; |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 887 | |
Cliff Wickman | 8b6e511 | 2012-06-22 08:14:59 -0500 | [diff] [blame] | 888 | if (bcp->uvhub_version == 1) { |
| 889 | uv1 = 1; |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 890 | uv1_throttle(hmaster, stat); |
Cliff Wickman | 8b6e511 | 2012-06-22 08:14:59 -0500 | [diff] [blame] | 891 | } |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 892 | |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 893 | while (hmaster->uvhub_quiesce) |
| 894 | cpu_relax(); |
Cliff Wickman | b194b12 | 2008-06-12 08:23:48 -0500 | [diff] [blame] | 895 | |
Cliff Wickman | b194b12 | 2008-06-12 08:23:48 -0500 | [diff] [blame] | 896 | time1 = get_cycles(); |
Cliff Wickman | 8b6e511 | 2012-06-22 08:14:59 -0500 | [diff] [blame] | 897 | if (uv1) |
| 898 | uv1_hdr = &bau_desc->header.uv1_hdr; |
| 899 | else |
Cliff Wickman | a26fd71 | 2014-05-14 16:15:47 -0500 | [diff] [blame] | 900 | /* uv2 and uv3 */ |
| 901 | uv2_3_hdr = &bau_desc->header.uv2_3_hdr; |
Cliff Wickman | 8b6e511 | 2012-06-22 08:14:59 -0500 | [diff] [blame] | 902 | |
Cliff Wickman | b194b12 | 2008-06-12 08:23:48 -0500 | [diff] [blame] | 903 | do { |
Cliff Wickman | 8b6e511 | 2012-06-22 08:14:59 -0500 | [diff] [blame] | 904 | if (try == 0) { |
Cliff Wickman | da87c93 | 2012-01-16 15:17:50 -0600 | [diff] [blame] | 905 | if (uv1) |
| 906 | uv1_hdr->msg_type = MSG_REGULAR; |
| 907 | else |
Cliff Wickman | a26fd71 | 2014-05-14 16:15:47 -0500 | [diff] [blame] | 908 | uv2_3_hdr->msg_type = MSG_REGULAR; |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 909 | seq_number = bcp->message_number++; |
| 910 | } else { |
Cliff Wickman | da87c93 | 2012-01-16 15:17:50 -0600 | [diff] [blame] | 911 | if (uv1) |
| 912 | uv1_hdr->msg_type = MSG_RETRY; |
| 913 | else |
Cliff Wickman | a26fd71 | 2014-05-14 16:15:47 -0500 | [diff] [blame] | 914 | uv2_3_hdr->msg_type = MSG_RETRY; |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 915 | stat->s_retry_messages++; |
| 916 | } |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 917 | |
Cliff Wickman | da87c93 | 2012-01-16 15:17:50 -0600 | [diff] [blame] | 918 | if (uv1) |
| 919 | uv1_hdr->sequence = seq_number; |
| 920 | else |
Cliff Wickman | a26fd71 | 2014-05-14 16:15:47 -0500 | [diff] [blame] | 921 | uv2_3_hdr->sequence = seq_number; |
Cliff Wickman | 8b6e511 | 2012-06-22 08:14:59 -0500 | [diff] [blame] | 922 | index = (1UL << AS_PUSH_SHIFT) | bcp->uvhub_cpu; |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 923 | bcp->send_message = get_cycles(); |
| 924 | |
| 925 | write_mmr_activation(index); |
| 926 | |
| 927 | try++; |
| 928 | completion_stat = wait_completion(bau_desc, bcp, try); |
| 929 | |
| 930 | handle_cmplt(completion_stat, bau_desc, bcp, hmaster, stat); |
| 931 | |
Cliff Wickman | e8e5e8a | 2010-06-02 16:22:01 -0500 | [diff] [blame] | 932 | if (bcp->ipi_attempts >= bcp->ipi_reset_limit) { |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 933 | bcp->ipi_attempts = 0; |
Cliff Wickman | 8b6e511 | 2012-06-22 08:14:59 -0500 | [diff] [blame] | 934 | stat->s_overipilimit++; |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 935 | completion_stat = FLUSH_GIVEUP; |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 936 | break; |
| 937 | } |
| 938 | cpu_relax(); |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 939 | } while ((completion_stat == FLUSH_RETRY_PLUGGED) || |
| 940 | (completion_stat == FLUSH_RETRY_TIMEOUT)); |
| 941 | |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 942 | time2 = get_cycles(); |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 943 | |
| 944 | count_max_concurr(completion_stat, bcp, hmaster); |
| 945 | |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 946 | while (hmaster->uvhub_quiesce) |
| 947 | cpu_relax(); |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 948 | |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 949 | atomic_dec(&hmaster->active_descriptor_count); |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 950 | |
| 951 | record_send_stats(time1, time2, bcp, stat, completion_stat, try); |
| 952 | |
| 953 | if (completion_stat == FLUSH_GIVEUP) |
Cliff Wickman | c5d35d3 | 2012-01-16 15:19:47 -0600 | [diff] [blame] | 954 | /* FLUSH_GIVEUP will fall back to using IPI's for tlb flush */ |
Cliff Wickman | 450a007 | 2010-06-02 16:22:02 -0500 | [diff] [blame] | 955 | return 1; |
Cliff Wickman | 450a007 | 2010-06-02 16:22:02 -0500 | [diff] [blame] | 956 | return 0; |
Cliff Wickman | b194b12 | 2008-06-12 08:23:48 -0500 | [diff] [blame] | 957 | } |
| 958 | |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 959 | /* |
Cliff Wickman | 8b6e511 | 2012-06-22 08:14:59 -0500 | [diff] [blame] | 960 | * The BAU is disabled for this uvhub. When the disabled time period has |
| 961 | * expired re-enable it. |
| 962 | * Return 0 if it is re-enabled for all cpus on this uvhub. |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 963 | */ |
| 964 | static int check_enable(struct bau_control *bcp, struct ptc_stats *stat) |
| 965 | { |
| 966 | int tcpu; |
| 967 | struct bau_control *tbcp; |
Cliff Wickman | 8b6e511 | 2012-06-22 08:14:59 -0500 | [diff] [blame] | 968 | struct bau_control *hmaster; |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 969 | |
Cliff Wickman | 8b6e511 | 2012-06-22 08:14:59 -0500 | [diff] [blame] | 970 | hmaster = bcp->uvhub_master; |
| 971 | spin_lock(&hmaster->disable_lock); |
| 972 | if (bcp->baudisabled && (get_cycles() >= bcp->set_bau_on_time)) { |
| 973 | stat->s_bau_reenabled++; |
| 974 | for_each_present_cpu(tcpu) { |
| 975 | tbcp = &per_cpu(bau_control, tcpu); |
| 976 | if (tbcp->uvhub_master == hmaster) { |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 977 | tbcp->baudisabled = 0; |
| 978 | tbcp->period_requests = 0; |
| 979 | tbcp->period_time = 0; |
Cliff Wickman | 8b6e511 | 2012-06-22 08:14:59 -0500 | [diff] [blame] | 980 | tbcp->period_giveups = 0; |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 981 | } |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 982 | } |
Cliff Wickman | 8b6e511 | 2012-06-22 08:14:59 -0500 | [diff] [blame] | 983 | spin_unlock(&hmaster->disable_lock); |
| 984 | return 0; |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 985 | } |
Cliff Wickman | 8b6e511 | 2012-06-22 08:14:59 -0500 | [diff] [blame] | 986 | spin_unlock(&hmaster->disable_lock); |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 987 | return -1; |
| 988 | } |
| 989 | |
| 990 | static void record_send_statistics(struct ptc_stats *stat, int locals, int hubs, |
| 991 | int remotes, struct bau_desc *bau_desc) |
| 992 | { |
| 993 | stat->s_requestor++; |
| 994 | stat->s_ntargcpu += remotes + locals; |
| 995 | stat->s_ntargremotes += remotes; |
| 996 | stat->s_ntarglocals += locals; |
| 997 | |
| 998 | /* uvhub statistics */ |
| 999 | hubs = bau_uvhub_weight(&bau_desc->distribution); |
| 1000 | if (locals) { |
| 1001 | stat->s_ntarglocaluvhub++; |
| 1002 | stat->s_ntargremoteuvhub += (hubs - 1); |
| 1003 | } else |
| 1004 | stat->s_ntargremoteuvhub += hubs; |
| 1005 | |
| 1006 | stat->s_ntarguvhub += hubs; |
| 1007 | |
| 1008 | if (hubs >= 16) |
| 1009 | stat->s_ntarguvhub16++; |
| 1010 | else if (hubs >= 8) |
| 1011 | stat->s_ntarguvhub8++; |
| 1012 | else if (hubs >= 4) |
| 1013 | stat->s_ntarguvhub4++; |
| 1014 | else if (hubs >= 2) |
| 1015 | stat->s_ntarguvhub2++; |
| 1016 | else |
| 1017 | stat->s_ntarguvhub1++; |
| 1018 | } |
| 1019 | |
| 1020 | /* |
| 1021 | * Translate a cpu mask to the uvhub distribution mask in the BAU |
| 1022 | * activation descriptor. |
| 1023 | */ |
| 1024 | static int set_distrib_bits(struct cpumask *flush_mask, struct bau_control *bcp, |
| 1025 | struct bau_desc *bau_desc, int *localsp, int *remotesp) |
| 1026 | { |
| 1027 | int cpu; |
| 1028 | int pnode; |
| 1029 | int cnt = 0; |
| 1030 | struct hub_and_pnode *hpp; |
| 1031 | |
| 1032 | for_each_cpu(cpu, flush_mask) { |
| 1033 | /* |
| 1034 | * The distribution vector is a bit map of pnodes, relative |
| 1035 | * to the partition base pnode (and the partition base nasid |
| 1036 | * in the header). |
| 1037 | * Translate cpu to pnode and hub using a local memory array. |
| 1038 | */ |
| 1039 | hpp = &bcp->socket_master->thp[cpu]; |
| 1040 | pnode = hpp->pnode - bcp->partition_base_pnode; |
| 1041 | bau_uvhub_set(pnode, &bau_desc->distribution); |
| 1042 | cnt++; |
| 1043 | if (hpp->uvhub == bcp->uvhub) |
| 1044 | (*localsp)++; |
| 1045 | else |
| 1046 | (*remotesp)++; |
| 1047 | } |
| 1048 | if (!cnt) |
| 1049 | return 1; |
| 1050 | return 0; |
| 1051 | } |
| 1052 | |
| 1053 | /* |
| 1054 | * globally purge translation cache of a virtual address or all TLB's |
Tejun Heo | bdbcdd4 | 2009-01-21 17:26:06 +0900 | [diff] [blame] | 1055 | * @cpumask: mask of all cpu's in which the address is to be removed |
Cliff Wickman | 1812924 | 2008-06-02 08:56:14 -0500 | [diff] [blame] | 1056 | * @mm: mm_struct containing virtual address range |
Alex Shi | 57c4f43 | 2012-12-18 12:22:14 -0800 | [diff] [blame] | 1057 | * @start: start virtual address to be removed from TLB |
| 1058 | * @end: end virtual address to be remove from TLB |
Tejun Heo | bdbcdd4 | 2009-01-21 17:26:06 +0900 | [diff] [blame] | 1059 | * @cpu: the current cpu |
Cliff Wickman | 1812924 | 2008-06-02 08:56:14 -0500 | [diff] [blame] | 1060 | * |
| 1061 | * This is the entry point for initiating any UV global TLB shootdown. |
| 1062 | * |
| 1063 | * Purges the translation caches of all specified processors of the given |
| 1064 | * virtual address, or purges all TLB's on specified processors. |
| 1065 | * |
Tejun Heo | bdbcdd4 | 2009-01-21 17:26:06 +0900 | [diff] [blame] | 1066 | * The caller has derived the cpumask from the mm_struct. This function |
| 1067 | * is called only if there are bits set in the mask. (e.g. flush_tlb_page()) |
Cliff Wickman | 1812924 | 2008-06-02 08:56:14 -0500 | [diff] [blame] | 1068 | * |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 1069 | * The cpumask is converted into a uvhubmask of the uvhubs containing |
| 1070 | * those cpus. |
Cliff Wickman | b194b12 | 2008-06-12 08:23:48 -0500 | [diff] [blame] | 1071 | * |
Tejun Heo | bdbcdd4 | 2009-01-21 17:26:06 +0900 | [diff] [blame] | 1072 | * Note that this function should be called with preemption disabled. |
| 1073 | * |
| 1074 | * Returns NULL if all remote flushing was done. |
| 1075 | * Returns pointer to cpumask if some remote flushing remains to be |
| 1076 | * done. The returned pointer is valid till preemption is re-enabled. |
Cliff Wickman | 1812924 | 2008-06-02 08:56:14 -0500 | [diff] [blame] | 1077 | */ |
Tejun Heo | bdbcdd4 | 2009-01-21 17:26:06 +0900 | [diff] [blame] | 1078 | const struct cpumask *uv_flush_tlb_others(const struct cpumask *cpumask, |
Cliff Wickman | a26fd71 | 2014-05-14 16:15:47 -0500 | [diff] [blame] | 1079 | struct mm_struct *mm, |
| 1080 | unsigned long start, |
| 1081 | unsigned long end, |
| 1082 | unsigned int cpu) |
Cliff Wickman | 1812924 | 2008-06-02 08:56:14 -0500 | [diff] [blame] | 1083 | { |
Cliff Wickman | b194b12 | 2008-06-12 08:23:48 -0500 | [diff] [blame] | 1084 | int locals = 0; |
Cliff Wickman | 450a007 | 2010-06-02 16:22:02 -0500 | [diff] [blame] | 1085 | int remotes = 0; |
| 1086 | int hubs = 0; |
Ingo Molnar | dc163a4 | 2008-06-18 14:15:43 +0200 | [diff] [blame] | 1087 | struct bau_desc *bau_desc; |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 1088 | struct cpumask *flush_mask; |
| 1089 | struct ptc_stats *stat; |
| 1090 | struct bau_control *bcp; |
Cliff Wickman | 8b6e511 | 2012-06-22 08:14:59 -0500 | [diff] [blame] | 1091 | unsigned long descriptor_status; |
| 1092 | unsigned long status; |
Cliff Wickman | 1812924 | 2008-06-02 08:56:14 -0500 | [diff] [blame] | 1093 | |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 1094 | bcp = &per_cpu(bau_control, cpu); |
Cliff Wickman | 26ef857 | 2012-06-22 08:13:30 -0500 | [diff] [blame] | 1095 | |
| 1096 | if (bcp->nobau) |
| 1097 | return cpumask; |
Cliff Wickman | 50fb55a | 2010-06-02 16:22:02 -0500 | [diff] [blame] | 1098 | |
cpw | 3eae49c | 2013-12-03 17:15:30 -0600 | [diff] [blame] | 1099 | stat = bcp->statp; |
| 1100 | stat->s_enters++; |
| 1101 | |
Cliff Wickman | 8b6e511 | 2012-06-22 08:14:59 -0500 | [diff] [blame] | 1102 | if (bcp->busy) { |
| 1103 | descriptor_status = |
| 1104 | read_lmmr(UVH_LB_BAU_SB_ACTIVATION_STATUS_0); |
| 1105 | status = ((descriptor_status >> (bcp->uvhub_cpu * |
| 1106 | UV_ACT_STATUS_SIZE)) & UV_ACT_STATUS_MASK) << 1; |
| 1107 | if (status == UV2H_DESC_BUSY) |
| 1108 | return cpumask; |
| 1109 | bcp->busy = 0; |
| 1110 | } |
| 1111 | |
Cliff Wickman | 50fb55a | 2010-06-02 16:22:02 -0500 | [diff] [blame] | 1112 | /* bau was disabled due to slow response */ |
| 1113 | if (bcp->baudisabled) { |
Cliff Wickman | 8b6e511 | 2012-06-22 08:14:59 -0500 | [diff] [blame] | 1114 | if (check_enable(bcp, stat)) { |
| 1115 | stat->s_ipifordisabled++; |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 1116 | return cpumask; |
Cliff Wickman | 8b6e511 | 2012-06-22 08:14:59 -0500 | [diff] [blame] | 1117 | } |
Cliff Wickman | 50fb55a | 2010-06-02 16:22:02 -0500 | [diff] [blame] | 1118 | } |
Cliff Wickman | e8e5e8a | 2010-06-02 16:22:01 -0500 | [diff] [blame] | 1119 | |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 1120 | /* |
| 1121 | * Each sending cpu has a per-cpu mask which it fills from the caller's |
Cliff Wickman | 450a007 | 2010-06-02 16:22:02 -0500 | [diff] [blame] | 1122 | * cpu mask. All cpus are converted to uvhubs and copied to the |
| 1123 | * activation descriptor. |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 1124 | */ |
| 1125 | flush_mask = (struct cpumask *)per_cpu(uv_flush_tlb_mask, cpu); |
Cliff Wickman | 450a007 | 2010-06-02 16:22:02 -0500 | [diff] [blame] | 1126 | /* don't actually do a shootdown of the local cpu */ |
Tejun Heo | bdbcdd4 | 2009-01-21 17:26:06 +0900 | [diff] [blame] | 1127 | cpumask_andnot(flush_mask, cpumask, cpumask_of(cpu)); |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 1128 | |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 1129 | if (cpu_isset(cpu, *cpumask)) |
Cliff Wickman | 450a007 | 2010-06-02 16:22:02 -0500 | [diff] [blame] | 1130 | stat->s_ntargself++; |
Tejun Heo | bdbcdd4 | 2009-01-21 17:26:06 +0900 | [diff] [blame] | 1131 | |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 1132 | bau_desc = bcp->descriptor_base; |
Cliff Wickman | 8b6e511 | 2012-06-22 08:14:59 -0500 | [diff] [blame] | 1133 | bau_desc += (ITEMS_PER_DESC * bcp->uvhub_cpu); |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 1134 | bau_uvhubs_clear(&bau_desc->distribution, UV_DISTRIBUTION_SIZE); |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 1135 | if (set_distrib_bits(flush_mask, bcp, bau_desc, &locals, &remotes)) |
Cliff Wickman | 450a007 | 2010-06-02 16:22:02 -0500 | [diff] [blame] | 1136 | return NULL; |
Cliff Wickman | 450a007 | 2010-06-02 16:22:02 -0500 | [diff] [blame] | 1137 | |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 1138 | record_send_statistics(stat, locals, hubs, remotes, bau_desc); |
Cliff Wickman | 1812924 | 2008-06-02 08:56:14 -0500 | [diff] [blame] | 1139 | |
Alex Shi | 57c4f43 | 2012-12-18 12:22:14 -0800 | [diff] [blame] | 1140 | if (!end || (end - start) <= PAGE_SIZE) |
| 1141 | bau_desc->payload.address = start; |
| 1142 | else |
| 1143 | bau_desc->payload.address = TLB_FLUSH_ALL; |
Tejun Heo | bdbcdd4 | 2009-01-21 17:26:06 +0900 | [diff] [blame] | 1144 | bau_desc->payload.sending_cpu = cpu; |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 1145 | /* |
Cliff Wickman | 450a007 | 2010-06-02 16:22:02 -0500 | [diff] [blame] | 1146 | * uv_flush_send_and_wait returns 0 if all cpu's were messaged, |
| 1147 | * or 1 if it gave up and the original cpumask should be returned. |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 1148 | */ |
Cliff Wickman | 8b6e511 | 2012-06-22 08:14:59 -0500 | [diff] [blame] | 1149 | if (!uv_flush_send_and_wait(flush_mask, bcp, bau_desc)) |
Cliff Wickman | 450a007 | 2010-06-02 16:22:02 -0500 | [diff] [blame] | 1150 | return NULL; |
| 1151 | else |
| 1152 | return cpumask; |
Cliff Wickman | 1812924 | 2008-06-02 08:56:14 -0500 | [diff] [blame] | 1153 | } |
| 1154 | |
| 1155 | /* |
Cliff Wickman | 8b6e511 | 2012-06-22 08:14:59 -0500 | [diff] [blame] | 1156 | * Search the message queue for any 'other' unprocessed message with the |
| 1157 | * same software acknowledge resource bit vector as the 'msg' message. |
Cliff Wickman | c5d35d3 | 2012-01-16 15:19:47 -0600 | [diff] [blame] | 1158 | */ |
| 1159 | struct bau_pq_entry *find_another_by_swack(struct bau_pq_entry *msg, |
Cliff Wickman | 8b6e511 | 2012-06-22 08:14:59 -0500 | [diff] [blame] | 1160 | struct bau_control *bcp) |
Cliff Wickman | c5d35d3 | 2012-01-16 15:19:47 -0600 | [diff] [blame] | 1161 | { |
| 1162 | struct bau_pq_entry *msg_next = msg + 1; |
Cliff Wickman | 8b6e511 | 2012-06-22 08:14:59 -0500 | [diff] [blame] | 1163 | unsigned char swack_vec = msg->swack_vec; |
Cliff Wickman | c5d35d3 | 2012-01-16 15:19:47 -0600 | [diff] [blame] | 1164 | |
| 1165 | if (msg_next > bcp->queue_last) |
| 1166 | msg_next = bcp->queue_first; |
Cliff Wickman | 8b6e511 | 2012-06-22 08:14:59 -0500 | [diff] [blame] | 1167 | while (msg_next != msg) { |
| 1168 | if ((msg_next->canceled == 0) && (msg_next->replied_to == 0) && |
| 1169 | (msg_next->swack_vec == swack_vec)) |
Cliff Wickman | c5d35d3 | 2012-01-16 15:19:47 -0600 | [diff] [blame] | 1170 | return msg_next; |
| 1171 | msg_next++; |
| 1172 | if (msg_next > bcp->queue_last) |
| 1173 | msg_next = bcp->queue_first; |
| 1174 | } |
| 1175 | return NULL; |
| 1176 | } |
| 1177 | |
| 1178 | /* |
| 1179 | * UV2 needs to work around a bug in which an arriving message has not |
| 1180 | * set a bit in the UVH_LB_BAU_INTD_SOFTWARE_ACKNOWLEDGE register. |
| 1181 | * Such a message must be ignored. |
| 1182 | */ |
| 1183 | void process_uv2_message(struct msg_desc *mdp, struct bau_control *bcp) |
| 1184 | { |
| 1185 | unsigned long mmr_image; |
| 1186 | unsigned char swack_vec; |
| 1187 | struct bau_pq_entry *msg = mdp->msg; |
| 1188 | struct bau_pq_entry *other_msg; |
| 1189 | |
| 1190 | mmr_image = read_mmr_sw_ack(); |
| 1191 | swack_vec = msg->swack_vec; |
| 1192 | |
| 1193 | if ((swack_vec & mmr_image) == 0) { |
| 1194 | /* |
| 1195 | * This message was assigned a swack resource, but no |
| 1196 | * reserved acknowlegment is pending. |
| 1197 | * The bug has prevented this message from setting the MMR. |
Cliff Wickman | c5d35d3 | 2012-01-16 15:19:47 -0600 | [diff] [blame] | 1198 | */ |
Cliff Wickman | c5d35d3 | 2012-01-16 15:19:47 -0600 | [diff] [blame] | 1199 | /* |
Cliff Wickman | 8b6e511 | 2012-06-22 08:14:59 -0500 | [diff] [blame] | 1200 | * Some message has set the MMR 'pending' bit; it might have |
| 1201 | * been another message. Look for that message. |
Cliff Wickman | c5d35d3 | 2012-01-16 15:19:47 -0600 | [diff] [blame] | 1202 | */ |
Cliff Wickman | 8b6e511 | 2012-06-22 08:14:59 -0500 | [diff] [blame] | 1203 | other_msg = find_another_by_swack(msg, bcp); |
| 1204 | if (other_msg) { |
| 1205 | /* |
| 1206 | * There is another. Process this one but do not |
| 1207 | * ack it. |
| 1208 | */ |
| 1209 | bau_process_message(mdp, bcp, 0); |
| 1210 | /* |
| 1211 | * Let the natural processing of that other message |
| 1212 | * acknowledge it. Don't get the processing of sw_ack's |
| 1213 | * out of order. |
| 1214 | */ |
| 1215 | return; |
| 1216 | } |
Cliff Wickman | c5d35d3 | 2012-01-16 15:19:47 -0600 | [diff] [blame] | 1217 | } |
| 1218 | |
| 1219 | /* |
Cliff Wickman | 8b6e511 | 2012-06-22 08:14:59 -0500 | [diff] [blame] | 1220 | * Either the MMR shows this one pending a reply or there is no |
| 1221 | * other message using this sw_ack, so it is safe to acknowledge it. |
Cliff Wickman | c5d35d3 | 2012-01-16 15:19:47 -0600 | [diff] [blame] | 1222 | */ |
| 1223 | bau_process_message(mdp, bcp, 1); |
| 1224 | |
| 1225 | return; |
| 1226 | } |
| 1227 | |
| 1228 | /* |
Cliff Wickman | 1812924 | 2008-06-02 08:56:14 -0500 | [diff] [blame] | 1229 | * The BAU message interrupt comes here. (registered by set_intr_gate) |
| 1230 | * See entry_64.S |
| 1231 | * |
| 1232 | * We received a broadcast assist message. |
| 1233 | * |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 1234 | * Interrupts are disabled; this interrupt could represent |
Cliff Wickman | 1812924 | 2008-06-02 08:56:14 -0500 | [diff] [blame] | 1235 | * the receipt of several messages. |
| 1236 | * |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 1237 | * All cores/threads on this hub get this interrupt. |
| 1238 | * The last one to see it does the software ack. |
Cliff Wickman | 1812924 | 2008-06-02 08:56:14 -0500 | [diff] [blame] | 1239 | * (the resource will not be freed until noninterruptable cpus see this |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 1240 | * interrupt; hardware may timeout the s/w ack and reply ERROR) |
Cliff Wickman | 1812924 | 2008-06-02 08:56:14 -0500 | [diff] [blame] | 1241 | */ |
Cliff Wickman | b194b12 | 2008-06-12 08:23:48 -0500 | [diff] [blame] | 1242 | void uv_bau_message_interrupt(struct pt_regs *regs) |
Cliff Wickman | 1812924 | 2008-06-02 08:56:14 -0500 | [diff] [blame] | 1243 | { |
Cliff Wickman | 1812924 | 2008-06-02 08:56:14 -0500 | [diff] [blame] | 1244 | int count = 0; |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 1245 | cycles_t time_start; |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 1246 | struct bau_pq_entry *msg; |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 1247 | struct bau_control *bcp; |
| 1248 | struct ptc_stats *stat; |
| 1249 | struct msg_desc msgdesc; |
Cliff Wickman | 1812924 | 2008-06-02 08:56:14 -0500 | [diff] [blame] | 1250 | |
Cliff Wickman | 88ed9dd | 2012-01-16 15:21:46 -0600 | [diff] [blame] | 1251 | ack_APIC_irq(); |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 1252 | time_start = get_cycles(); |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 1253 | |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 1254 | bcp = &per_cpu(bau_control, smp_processor_id()); |
Cliff Wickman | 712157a | 2010-06-02 16:22:02 -0500 | [diff] [blame] | 1255 | stat = bcp->statp; |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 1256 | |
| 1257 | msgdesc.queue_first = bcp->queue_first; |
| 1258 | msgdesc.queue_last = bcp->queue_last; |
| 1259 | |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 1260 | msg = bcp->bau_msg_head; |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 1261 | while (msg->swack_vec) { |
Cliff Wickman | 1812924 | 2008-06-02 08:56:14 -0500 | [diff] [blame] | 1262 | count++; |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 1263 | |
| 1264 | msgdesc.msg_slot = msg - msgdesc.queue_first; |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 1265 | msgdesc.msg = msg; |
Cliff Wickman | c5d35d3 | 2012-01-16 15:19:47 -0600 | [diff] [blame] | 1266 | if (bcp->uvhub_version == 2) |
| 1267 | process_uv2_message(&msgdesc, bcp); |
| 1268 | else |
Cliff Wickman | a26fd71 | 2014-05-14 16:15:47 -0500 | [diff] [blame] | 1269 | /* no error workaround for uv1 or uv3 */ |
Cliff Wickman | c5d35d3 | 2012-01-16 15:19:47 -0600 | [diff] [blame] | 1270 | bau_process_message(&msgdesc, bcp, 1); |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 1271 | |
Cliff Wickman | 1812924 | 2008-06-02 08:56:14 -0500 | [diff] [blame] | 1272 | msg++; |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 1273 | if (msg > msgdesc.queue_last) |
| 1274 | msg = msgdesc.queue_first; |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 1275 | bcp->bau_msg_head = msg; |
Cliff Wickman | 1812924 | 2008-06-02 08:56:14 -0500 | [diff] [blame] | 1276 | } |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 1277 | stat->d_time += (get_cycles() - time_start); |
Cliff Wickman | 1812924 | 2008-06-02 08:56:14 -0500 | [diff] [blame] | 1278 | if (!count) |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 1279 | stat->d_nomsg++; |
Cliff Wickman | 1812924 | 2008-06-02 08:56:14 -0500 | [diff] [blame] | 1280 | else if (count > 1) |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 1281 | stat->d_multmsg++; |
Cliff Wickman | 1812924 | 2008-06-02 08:56:14 -0500 | [diff] [blame] | 1282 | } |
| 1283 | |
Cliff Wickman | c4c4688 | 2009-04-03 08:34:32 -0500 | [diff] [blame] | 1284 | /* |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 1285 | * Each target uvhub (i.e. a uvhub that has cpu's) needs to have |
Cliff Wickman | c4c4688 | 2009-04-03 08:34:32 -0500 | [diff] [blame] | 1286 | * shootdown message timeouts enabled. The timeout does not cause |
| 1287 | * an interrupt, but causes an error message to be returned to |
| 1288 | * the sender. |
| 1289 | */ |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 1290 | static void __init enable_timeouts(void) |
Cliff Wickman | 1812924 | 2008-06-02 08:56:14 -0500 | [diff] [blame] | 1291 | { |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 1292 | int uvhub; |
| 1293 | int nuvhubs; |
Cliff Wickman | 1812924 | 2008-06-02 08:56:14 -0500 | [diff] [blame] | 1294 | int pnode; |
Cliff Wickman | c4c4688 | 2009-04-03 08:34:32 -0500 | [diff] [blame] | 1295 | unsigned long mmr_image; |
Cliff Wickman | 1812924 | 2008-06-02 08:56:14 -0500 | [diff] [blame] | 1296 | |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 1297 | nuvhubs = uv_num_possible_blades(); |
Cliff Wickman | c4c4688 | 2009-04-03 08:34:32 -0500 | [diff] [blame] | 1298 | |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 1299 | for (uvhub = 0; uvhub < nuvhubs; uvhub++) { |
| 1300 | if (!uv_blade_nr_possible_cpus(uvhub)) |
Cliff Wickman | 1812924 | 2008-06-02 08:56:14 -0500 | [diff] [blame] | 1301 | continue; |
Cliff Wickman | c4c4688 | 2009-04-03 08:34:32 -0500 | [diff] [blame] | 1302 | |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 1303 | pnode = uv_blade_to_pnode(uvhub); |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 1304 | mmr_image = read_mmr_misc_control(pnode); |
Cliff Wickman | c4c4688 | 2009-04-03 08:34:32 -0500 | [diff] [blame] | 1305 | /* |
| 1306 | * Set the timeout period and then lock it in, in three |
| 1307 | * steps; captures and locks in the period. |
| 1308 | * |
| 1309 | * To program the period, the SOFT_ACK_MODE must be off. |
| 1310 | */ |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 1311 | mmr_image &= ~(1L << SOFTACK_MSHIFT); |
| 1312 | write_mmr_misc_control(pnode, mmr_image); |
Cliff Wickman | c4c4688 | 2009-04-03 08:34:32 -0500 | [diff] [blame] | 1313 | /* |
| 1314 | * Set the 4-bit period. |
| 1315 | */ |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 1316 | mmr_image &= ~((unsigned long)0xf << SOFTACK_PSHIFT); |
| 1317 | mmr_image |= (SOFTACK_TIMEOUT_PERIOD << SOFTACK_PSHIFT); |
| 1318 | write_mmr_misc_control(pnode, mmr_image); |
Cliff Wickman | c4c4688 | 2009-04-03 08:34:32 -0500 | [diff] [blame] | 1319 | /* |
Jack Steiner | 2a91959 | 2011-05-11 12:50:28 -0500 | [diff] [blame] | 1320 | * UV1: |
Cliff Wickman | c4c4688 | 2009-04-03 08:34:32 -0500 | [diff] [blame] | 1321 | * Subsequent reversals of the timebase bit (3) cause an |
| 1322 | * immediate timeout of one or all INTD resources as |
| 1323 | * indicated in bits 2:0 (7 causes all of them to timeout). |
| 1324 | */ |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 1325 | mmr_image |= (1L << SOFTACK_MSHIFT); |
Jack Steiner | 2a91959 | 2011-05-11 12:50:28 -0500 | [diff] [blame] | 1326 | if (is_uv2_hub()) { |
Cliff Wickman | a26fd71 | 2014-05-14 16:15:47 -0500 | [diff] [blame] | 1327 | /* do not touch the legacy mode bit */ |
Cliff Wickman | 8b6e511 | 2012-06-22 08:14:59 -0500 | [diff] [blame] | 1328 | /* hw bug workaround; do not use extended status */ |
| 1329 | mmr_image &= ~(1L << UV2_EXT_SHFT); |
Cliff Wickman | a26fd71 | 2014-05-14 16:15:47 -0500 | [diff] [blame] | 1330 | } else if (is_uv3_hub()) { |
| 1331 | mmr_image &= ~(1L << PREFETCH_HINT_SHFT); |
| 1332 | mmr_image |= (1L << SB_STATUS_SHFT); |
Jack Steiner | 2a91959 | 2011-05-11 12:50:28 -0500 | [diff] [blame] | 1333 | } |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 1334 | write_mmr_misc_control(pnode, mmr_image); |
Cliff Wickman | 1812924 | 2008-06-02 08:56:14 -0500 | [diff] [blame] | 1335 | } |
Cliff Wickman | 1812924 | 2008-06-02 08:56:14 -0500 | [diff] [blame] | 1336 | } |
| 1337 | |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 1338 | static void *ptc_seq_start(struct seq_file *file, loff_t *offset) |
Cliff Wickman | 1812924 | 2008-06-02 08:56:14 -0500 | [diff] [blame] | 1339 | { |
| 1340 | if (*offset < num_possible_cpus()) |
| 1341 | return offset; |
| 1342 | return NULL; |
| 1343 | } |
| 1344 | |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 1345 | static void *ptc_seq_next(struct seq_file *file, void *data, loff_t *offset) |
Cliff Wickman | 1812924 | 2008-06-02 08:56:14 -0500 | [diff] [blame] | 1346 | { |
| 1347 | (*offset)++; |
| 1348 | if (*offset < num_possible_cpus()) |
| 1349 | return offset; |
| 1350 | return NULL; |
| 1351 | } |
| 1352 | |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 1353 | static void ptc_seq_stop(struct seq_file *file, void *data) |
Cliff Wickman | 1812924 | 2008-06-02 08:56:14 -0500 | [diff] [blame] | 1354 | { |
| 1355 | } |
| 1356 | |
| 1357 | /* |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 1358 | * Display the statistics thru /proc/sgi_uv/ptc_statistics |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 1359 | * 'data' points to the cpu number |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 1360 | * Note: see the descriptions in stat_description[]. |
Cliff Wickman | 1812924 | 2008-06-02 08:56:14 -0500 | [diff] [blame] | 1361 | */ |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 1362 | static int ptc_seq_show(struct seq_file *file, void *data) |
Cliff Wickman | 1812924 | 2008-06-02 08:56:14 -0500 | [diff] [blame] | 1363 | { |
| 1364 | struct ptc_stats *stat; |
Cliff Wickman | 26ef857 | 2012-06-22 08:13:30 -0500 | [diff] [blame] | 1365 | struct bau_control *bcp; |
Cliff Wickman | 1812924 | 2008-06-02 08:56:14 -0500 | [diff] [blame] | 1366 | int cpu; |
| 1367 | |
| 1368 | cpu = *(loff_t *)data; |
Cliff Wickman | 1812924 | 2008-06-02 08:56:14 -0500 | [diff] [blame] | 1369 | if (!cpu) { |
| 1370 | seq_printf(file, |
Cliff Wickman | 8b6e511 | 2012-06-22 08:14:59 -0500 | [diff] [blame] | 1371 | "# cpu bauoff sent stime self locals remotes ncpus localhub "); |
Cliff Wickman | 1812924 | 2008-06-02 08:56:14 -0500 | [diff] [blame] | 1372 | seq_printf(file, |
Cliff Wickman | 450a007 | 2010-06-02 16:22:02 -0500 | [diff] [blame] | 1373 | "remotehub numuvhubs numuvhubs16 numuvhubs8 "); |
| 1374 | seq_printf(file, |
Cliff Wickman | 8b6e511 | 2012-06-22 08:14:59 -0500 | [diff] [blame] | 1375 | "numuvhubs4 numuvhubs2 numuvhubs1 dto snacks retries "); |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 1376 | seq_printf(file, |
Cliff Wickman | 8b6e511 | 2012-06-22 08:14:59 -0500 | [diff] [blame] | 1377 | "rok resetp resett giveup sto bz throt disable "); |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 1378 | seq_printf(file, |
Cliff Wickman | 8b6e511 | 2012-06-22 08:14:59 -0500 | [diff] [blame] | 1379 | "enable wars warshw warwaits enters ipidis plugged "); |
Cliff Wickman | 50fb55a | 2010-06-02 16:22:02 -0500 | [diff] [blame] | 1380 | seq_printf(file, |
Cliff Wickman | 8b6e511 | 2012-06-22 08:14:59 -0500 | [diff] [blame] | 1381 | "ipiover glim cong swack recv rtime all one mult "); |
| 1382 | seq_printf(file, |
| 1383 | "none retry canc nocan reset rcan\n"); |
Cliff Wickman | 1812924 | 2008-06-02 08:56:14 -0500 | [diff] [blame] | 1384 | } |
| 1385 | if (cpu < num_possible_cpus() && cpu_online(cpu)) { |
Cliff Wickman | 26ef857 | 2012-06-22 08:13:30 -0500 | [diff] [blame] | 1386 | bcp = &per_cpu(bau_control, cpu); |
| 1387 | stat = bcp->statp; |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 1388 | /* source side statistics */ |
| 1389 | seq_printf(file, |
Cliff Wickman | 8b6e511 | 2012-06-22 08:14:59 -0500 | [diff] [blame] | 1390 | "cpu %d %d %ld %ld %ld %ld %ld %ld %ld %ld %ld %ld ", |
Cliff Wickman | 26ef857 | 2012-06-22 08:13:30 -0500 | [diff] [blame] | 1391 | cpu, bcp->nobau, stat->s_requestor, |
| 1392 | cycles_2_us(stat->s_time), |
Cliff Wickman | 450a007 | 2010-06-02 16:22:02 -0500 | [diff] [blame] | 1393 | stat->s_ntargself, stat->s_ntarglocals, |
| 1394 | stat->s_ntargremotes, stat->s_ntargcpu, |
| 1395 | stat->s_ntarglocaluvhub, stat->s_ntargremoteuvhub, |
| 1396 | stat->s_ntarguvhub, stat->s_ntarguvhub16); |
Cliff Wickman | b54bd9b | 2012-01-16 15:22:38 -0600 | [diff] [blame] | 1397 | seq_printf(file, "%ld %ld %ld %ld %ld %ld ", |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 1398 | stat->s_ntarguvhub8, stat->s_ntarguvhub4, |
| 1399 | stat->s_ntarguvhub2, stat->s_ntarguvhub1, |
Cliff Wickman | b54bd9b | 2012-01-16 15:22:38 -0600 | [diff] [blame] | 1400 | stat->s_dtimeout, stat->s_strongnacks); |
Cliff Wickman | 8b6e511 | 2012-06-22 08:14:59 -0500 | [diff] [blame] | 1401 | seq_printf(file, "%ld %ld %ld %ld %ld %ld %ld %ld ", |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 1402 | stat->s_retry_messages, stat->s_retriesok, |
| 1403 | stat->s_resets_plug, stat->s_resets_timeout, |
| 1404 | stat->s_giveup, stat->s_stimeout, |
Cliff Wickman | 8b6e511 | 2012-06-22 08:14:59 -0500 | [diff] [blame] | 1405 | stat->s_busy, stat->s_throttles); |
| 1406 | seq_printf(file, "%ld %ld %ld %ld %ld %ld %ld %ld %ld %ld %ld ", |
| 1407 | stat->s_bau_disabled, stat->s_bau_reenabled, |
| 1408 | stat->s_uv2_wars, stat->s_uv2_wars_hw, |
| 1409 | stat->s_uv2_war_waits, stat->s_enters, |
| 1410 | stat->s_ipifordisabled, stat->s_plugged, |
| 1411 | stat->s_overipilimit, stat->s_giveuplimit, |
| 1412 | stat->s_congested); |
Cliff Wickman | e8e5e8a | 2010-06-02 16:22:01 -0500 | [diff] [blame] | 1413 | |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 1414 | /* destination side statistics */ |
| 1415 | seq_printf(file, |
Cliff Wickman | 8b6e511 | 2012-06-22 08:14:59 -0500 | [diff] [blame] | 1416 | "%lx %ld %ld %ld %ld %ld %ld %ld %ld %ld %ld %ld\n", |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 1417 | read_gmmr_sw_ack(uv_cpu_to_pnode(cpu)), |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 1418 | stat->d_requestee, cycles_2_us(stat->d_time), |
| 1419 | stat->d_alltlb, stat->d_onetlb, stat->d_multmsg, |
| 1420 | stat->d_nomsg, stat->d_retries, stat->d_canceled, |
| 1421 | stat->d_nocanceled, stat->d_resets, |
| 1422 | stat->d_rcanceled); |
Cliff Wickman | 1812924 | 2008-06-02 08:56:14 -0500 | [diff] [blame] | 1423 | } |
Cliff Wickman | 1812924 | 2008-06-02 08:56:14 -0500 | [diff] [blame] | 1424 | return 0; |
| 1425 | } |
| 1426 | |
| 1427 | /* |
Cliff Wickman | e8e5e8a | 2010-06-02 16:22:01 -0500 | [diff] [blame] | 1428 | * Display the tunables thru debugfs |
| 1429 | */ |
| 1430 | static ssize_t tunables_read(struct file *file, char __user *userbuf, |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 1431 | size_t count, loff_t *ppos) |
Cliff Wickman | e8e5e8a | 2010-06-02 16:22:01 -0500 | [diff] [blame] | 1432 | { |
Dan Carpenter | b365a85 | 2010-09-29 10:41:05 +0200 | [diff] [blame] | 1433 | char *buf; |
Cliff Wickman | e8e5e8a | 2010-06-02 16:22:01 -0500 | [diff] [blame] | 1434 | int ret; |
| 1435 | |
Cliff Wickman | 8b6e511 | 2012-06-22 08:14:59 -0500 | [diff] [blame] | 1436 | buf = kasprintf(GFP_KERNEL, "%s %s %s\n%d %d %d %d %d %d %d %d %d %d\n", |
| 1437 | "max_concur plugged_delay plugsb4reset timeoutsb4reset", |
| 1438 | "ipi_reset_limit complete_threshold congested_response_us", |
| 1439 | "congested_reps disabled_period giveup_limit", |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 1440 | max_concurr, plugged_delay, plugsb4reset, |
Cliff Wickman | e8e5e8a | 2010-06-02 16:22:01 -0500 | [diff] [blame] | 1441 | timeoutsb4reset, ipi_reset_limit, complete_threshold, |
Cliff Wickman | 8b6e511 | 2012-06-22 08:14:59 -0500 | [diff] [blame] | 1442 | congested_respns_us, congested_reps, disabled_period, |
| 1443 | giveup_limit); |
Cliff Wickman | e8e5e8a | 2010-06-02 16:22:01 -0500 | [diff] [blame] | 1444 | |
Dan Carpenter | b365a85 | 2010-09-29 10:41:05 +0200 | [diff] [blame] | 1445 | if (!buf) |
| 1446 | return -ENOMEM; |
| 1447 | |
| 1448 | ret = simple_read_from_buffer(userbuf, count, ppos, buf, strlen(buf)); |
| 1449 | kfree(buf); |
| 1450 | return ret; |
Cliff Wickman | e8e5e8a | 2010-06-02 16:22:01 -0500 | [diff] [blame] | 1451 | } |
| 1452 | |
| 1453 | /* |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 1454 | * handle a write to /proc/sgi_uv/ptc_statistics |
| 1455 | * -1: reset the statistics |
Cliff Wickman | 1812924 | 2008-06-02 08:56:14 -0500 | [diff] [blame] | 1456 | * 0: display meaning of the statistics |
Cliff Wickman | 1812924 | 2008-06-02 08:56:14 -0500 | [diff] [blame] | 1457 | */ |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 1458 | static ssize_t ptc_proc_write(struct file *file, const char __user *user, |
| 1459 | size_t count, loff_t *data) |
Cliff Wickman | 1812924 | 2008-06-02 08:56:14 -0500 | [diff] [blame] | 1460 | { |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 1461 | int cpu; |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 1462 | int i; |
| 1463 | int elements; |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 1464 | long input_arg; |
Cliff Wickman | 1812924 | 2008-06-02 08:56:14 -0500 | [diff] [blame] | 1465 | char optstr[64]; |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 1466 | struct ptc_stats *stat; |
Cliff Wickman | 1812924 | 2008-06-02 08:56:14 -0500 | [diff] [blame] | 1467 | |
Cliff Wickman | e7eb872 | 2008-06-23 08:32:25 -0500 | [diff] [blame] | 1468 | if (count == 0 || count > sizeof(optstr)) |
Cliff Wickman | cef5327 | 2008-06-19 11:16:24 -0500 | [diff] [blame] | 1469 | return -EINVAL; |
Cliff Wickman | 1812924 | 2008-06-02 08:56:14 -0500 | [diff] [blame] | 1470 | if (copy_from_user(optstr, user, count)) |
| 1471 | return -EFAULT; |
| 1472 | optstr[count - 1] = '\0'; |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 1473 | |
Cliff Wickman | 26ef857 | 2012-06-22 08:13:30 -0500 | [diff] [blame] | 1474 | if (!strcmp(optstr, "on")) { |
| 1475 | set_bau_on(); |
| 1476 | return count; |
| 1477 | } else if (!strcmp(optstr, "off")) { |
| 1478 | set_bau_off(); |
| 1479 | return count; |
| 1480 | } |
| 1481 | |
Daniel Walter | 164109e | 2014-08-08 14:24:03 -0700 | [diff] [blame^] | 1482 | if (kstrtol(optstr, 10, &input_arg) < 0) { |
Cliff Wickman | 1812924 | 2008-06-02 08:56:14 -0500 | [diff] [blame] | 1483 | printk(KERN_DEBUG "%s is invalid\n", optstr); |
| 1484 | return -EINVAL; |
| 1485 | } |
| 1486 | |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 1487 | if (input_arg == 0) { |
Sasha Levin | 6444174 | 2012-12-20 14:11:34 -0500 | [diff] [blame] | 1488 | elements = ARRAY_SIZE(stat_description); |
Cliff Wickman | 1812924 | 2008-06-02 08:56:14 -0500 | [diff] [blame] | 1489 | printk(KERN_DEBUG "# cpu: cpu number\n"); |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 1490 | printk(KERN_DEBUG "Sender statistics:\n"); |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 1491 | for (i = 0; i < elements; i++) |
| 1492 | printk(KERN_DEBUG "%s\n", stat_description[i]); |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 1493 | } else if (input_arg == -1) { |
| 1494 | for_each_present_cpu(cpu) { |
| 1495 | stat = &per_cpu(ptcstats, cpu); |
| 1496 | memset(stat, 0, sizeof(struct ptc_stats)); |
| 1497 | } |
Cliff Wickman | 1812924 | 2008-06-02 08:56:14 -0500 | [diff] [blame] | 1498 | } |
| 1499 | |
| 1500 | return count; |
| 1501 | } |
| 1502 | |
Cliff Wickman | e8e5e8a | 2010-06-02 16:22:01 -0500 | [diff] [blame] | 1503 | static int local_atoi(const char *name) |
| 1504 | { |
| 1505 | int val = 0; |
| 1506 | |
| 1507 | for (;; name++) { |
| 1508 | switch (*name) { |
| 1509 | case '0' ... '9': |
| 1510 | val = 10*val+(*name-'0'); |
| 1511 | break; |
| 1512 | default: |
| 1513 | return val; |
| 1514 | } |
| 1515 | } |
| 1516 | } |
| 1517 | |
| 1518 | /* |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 1519 | * Parse the values written to /sys/kernel/debug/sgi_uv/bau_tunables. |
| 1520 | * Zero values reset them to defaults. |
Cliff Wickman | e8e5e8a | 2010-06-02 16:22:01 -0500 | [diff] [blame] | 1521 | */ |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 1522 | static int parse_tunables_write(struct bau_control *bcp, char *instr, |
| 1523 | int count) |
Cliff Wickman | e8e5e8a | 2010-06-02 16:22:01 -0500 | [diff] [blame] | 1524 | { |
Cliff Wickman | e8e5e8a | 2010-06-02 16:22:01 -0500 | [diff] [blame] | 1525 | char *p; |
| 1526 | char *q; |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 1527 | int cnt = 0; |
| 1528 | int val; |
Sasha Levin | 6444174 | 2012-12-20 14:11:34 -0500 | [diff] [blame] | 1529 | int e = ARRAY_SIZE(tunables); |
Cliff Wickman | e8e5e8a | 2010-06-02 16:22:01 -0500 | [diff] [blame] | 1530 | |
Cliff Wickman | e8e5e8a | 2010-06-02 16:22:01 -0500 | [diff] [blame] | 1531 | p = instr + strspn(instr, WHITESPACE); |
| 1532 | q = p; |
| 1533 | for (; *p; p = q + strspn(q, WHITESPACE)) { |
| 1534 | q = p + strcspn(p, WHITESPACE); |
| 1535 | cnt++; |
| 1536 | if (q == p) |
| 1537 | break; |
| 1538 | } |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 1539 | if (cnt != e) { |
| 1540 | printk(KERN_INFO "bau tunable error: should be %d values\n", e); |
Cliff Wickman | e8e5e8a | 2010-06-02 16:22:01 -0500 | [diff] [blame] | 1541 | return -EINVAL; |
| 1542 | } |
| 1543 | |
| 1544 | p = instr + strspn(instr, WHITESPACE); |
| 1545 | q = p; |
| 1546 | for (cnt = 0; *p; p = q + strspn(q, WHITESPACE), cnt++) { |
| 1547 | q = p + strcspn(p, WHITESPACE); |
| 1548 | val = local_atoi(p); |
| 1549 | switch (cnt) { |
| 1550 | case 0: |
| 1551 | if (val == 0) { |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 1552 | max_concurr = MAX_BAU_CONCURRENT; |
| 1553 | max_concurr_const = MAX_BAU_CONCURRENT; |
Cliff Wickman | e8e5e8a | 2010-06-02 16:22:01 -0500 | [diff] [blame] | 1554 | continue; |
| 1555 | } |
Cliff Wickman | e8e5e8a | 2010-06-02 16:22:01 -0500 | [diff] [blame] | 1556 | if (val < 1 || val > bcp->cpus_in_uvhub) { |
| 1557 | printk(KERN_DEBUG |
| 1558 | "Error: BAU max concurrent %d is invalid\n", |
| 1559 | val); |
| 1560 | return -EINVAL; |
| 1561 | } |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 1562 | max_concurr = val; |
| 1563 | max_concurr_const = val; |
Cliff Wickman | e8e5e8a | 2010-06-02 16:22:01 -0500 | [diff] [blame] | 1564 | continue; |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 1565 | default: |
Cliff Wickman | e8e5e8a | 2010-06-02 16:22:01 -0500 | [diff] [blame] | 1566 | if (val == 0) |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 1567 | *tunables[cnt].tunp = tunables[cnt].deflt; |
Cliff Wickman | e8e5e8a | 2010-06-02 16:22:01 -0500 | [diff] [blame] | 1568 | else |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 1569 | *tunables[cnt].tunp = val; |
Cliff Wickman | e8e5e8a | 2010-06-02 16:22:01 -0500 | [diff] [blame] | 1570 | continue; |
| 1571 | } |
| 1572 | if (q == p) |
| 1573 | break; |
| 1574 | } |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 1575 | return 0; |
| 1576 | } |
| 1577 | |
| 1578 | /* |
| 1579 | * Handle a write to debugfs. (/sys/kernel/debug/sgi_uv/bau_tunables) |
| 1580 | */ |
| 1581 | static ssize_t tunables_write(struct file *file, const char __user *user, |
| 1582 | size_t count, loff_t *data) |
| 1583 | { |
| 1584 | int cpu; |
| 1585 | int ret; |
| 1586 | char instr[100]; |
| 1587 | struct bau_control *bcp; |
| 1588 | |
| 1589 | if (count == 0 || count > sizeof(instr)-1) |
| 1590 | return -EINVAL; |
| 1591 | if (copy_from_user(instr, user, count)) |
| 1592 | return -EFAULT; |
| 1593 | |
| 1594 | instr[count] = '\0'; |
| 1595 | |
cpw@sgi.com | 00b30cf | 2011-06-21 07:21:26 -0500 | [diff] [blame] | 1596 | cpu = get_cpu(); |
| 1597 | bcp = &per_cpu(bau_control, cpu); |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 1598 | ret = parse_tunables_write(bcp, instr, count); |
cpw@sgi.com | 00b30cf | 2011-06-21 07:21:26 -0500 | [diff] [blame] | 1599 | put_cpu(); |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 1600 | if (ret) |
| 1601 | return ret; |
| 1602 | |
Cliff Wickman | e8e5e8a | 2010-06-02 16:22:01 -0500 | [diff] [blame] | 1603 | for_each_present_cpu(cpu) { |
| 1604 | bcp = &per_cpu(bau_control, cpu); |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 1605 | bcp->max_concurr = max_concurr; |
| 1606 | bcp->max_concurr_const = max_concurr; |
| 1607 | bcp->plugged_delay = plugged_delay; |
| 1608 | bcp->plugsb4reset = plugsb4reset; |
| 1609 | bcp->timeoutsb4reset = timeoutsb4reset; |
| 1610 | bcp->ipi_reset_limit = ipi_reset_limit; |
| 1611 | bcp->complete_threshold = complete_threshold; |
| 1612 | bcp->cong_response_us = congested_respns_us; |
| 1613 | bcp->cong_reps = congested_reps; |
Cliff Wickman | 8b6e511 | 2012-06-22 08:14:59 -0500 | [diff] [blame] | 1614 | bcp->disabled_period = sec_2_cycles(disabled_period); |
| 1615 | bcp->giveup_limit = giveup_limit; |
Cliff Wickman | e8e5e8a | 2010-06-02 16:22:01 -0500 | [diff] [blame] | 1616 | } |
| 1617 | return count; |
| 1618 | } |
| 1619 | |
Cliff Wickman | 1812924 | 2008-06-02 08:56:14 -0500 | [diff] [blame] | 1620 | static const struct seq_operations uv_ptc_seq_ops = { |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 1621 | .start = ptc_seq_start, |
| 1622 | .next = ptc_seq_next, |
| 1623 | .stop = ptc_seq_stop, |
| 1624 | .show = ptc_seq_show |
Cliff Wickman | 1812924 | 2008-06-02 08:56:14 -0500 | [diff] [blame] | 1625 | }; |
| 1626 | |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 1627 | static int ptc_proc_open(struct inode *inode, struct file *file) |
Cliff Wickman | 1812924 | 2008-06-02 08:56:14 -0500 | [diff] [blame] | 1628 | { |
| 1629 | return seq_open(file, &uv_ptc_seq_ops); |
| 1630 | } |
| 1631 | |
Cliff Wickman | e8e5e8a | 2010-06-02 16:22:01 -0500 | [diff] [blame] | 1632 | static int tunables_open(struct inode *inode, struct file *file) |
| 1633 | { |
| 1634 | return 0; |
| 1635 | } |
| 1636 | |
Cliff Wickman | 1812924 | 2008-06-02 08:56:14 -0500 | [diff] [blame] | 1637 | static const struct file_operations proc_uv_ptc_operations = { |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 1638 | .open = ptc_proc_open, |
Cliff Wickman | b194b12 | 2008-06-12 08:23:48 -0500 | [diff] [blame] | 1639 | .read = seq_read, |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 1640 | .write = ptc_proc_write, |
Cliff Wickman | b194b12 | 2008-06-12 08:23:48 -0500 | [diff] [blame] | 1641 | .llseek = seq_lseek, |
| 1642 | .release = seq_release, |
Cliff Wickman | 1812924 | 2008-06-02 08:56:14 -0500 | [diff] [blame] | 1643 | }; |
| 1644 | |
Cliff Wickman | e8e5e8a | 2010-06-02 16:22:01 -0500 | [diff] [blame] | 1645 | static const struct file_operations tunables_fops = { |
| 1646 | .open = tunables_open, |
| 1647 | .read = tunables_read, |
| 1648 | .write = tunables_write, |
Arnd Bergmann | 6038f37 | 2010-08-15 18:52:59 +0200 | [diff] [blame] | 1649 | .llseek = default_llseek, |
Cliff Wickman | e8e5e8a | 2010-06-02 16:22:01 -0500 | [diff] [blame] | 1650 | }; |
| 1651 | |
Cliff Wickman | b194b12 | 2008-06-12 08:23:48 -0500 | [diff] [blame] | 1652 | static int __init uv_ptc_init(void) |
Cliff Wickman | 1812924 | 2008-06-02 08:56:14 -0500 | [diff] [blame] | 1653 | { |
Cliff Wickman | b194b12 | 2008-06-12 08:23:48 -0500 | [diff] [blame] | 1654 | struct proc_dir_entry *proc_uv_ptc; |
Cliff Wickman | 1812924 | 2008-06-02 08:56:14 -0500 | [diff] [blame] | 1655 | |
| 1656 | if (!is_uv_system()) |
| 1657 | return 0; |
| 1658 | |
Alexey Dobriyan | 10f02d11 | 2009-08-23 23:17:27 +0400 | [diff] [blame] | 1659 | proc_uv_ptc = proc_create(UV_PTC_BASENAME, 0444, NULL, |
| 1660 | &proc_uv_ptc_operations); |
Cliff Wickman | 1812924 | 2008-06-02 08:56:14 -0500 | [diff] [blame] | 1661 | if (!proc_uv_ptc) { |
| 1662 | printk(KERN_ERR "unable to create %s proc entry\n", |
| 1663 | UV_PTC_BASENAME); |
| 1664 | return -EINVAL; |
| 1665 | } |
Cliff Wickman | e8e5e8a | 2010-06-02 16:22:01 -0500 | [diff] [blame] | 1666 | |
| 1667 | tunables_dir = debugfs_create_dir(UV_BAU_TUNABLES_DIR, NULL); |
| 1668 | if (!tunables_dir) { |
| 1669 | printk(KERN_ERR "unable to create debugfs directory %s\n", |
| 1670 | UV_BAU_TUNABLES_DIR); |
| 1671 | return -EINVAL; |
| 1672 | } |
| 1673 | tunables_file = debugfs_create_file(UV_BAU_TUNABLES_FILE, 0600, |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 1674 | tunables_dir, NULL, &tunables_fops); |
Cliff Wickman | e8e5e8a | 2010-06-02 16:22:01 -0500 | [diff] [blame] | 1675 | if (!tunables_file) { |
| 1676 | printk(KERN_ERR "unable to create debugfs file %s\n", |
| 1677 | UV_BAU_TUNABLES_FILE); |
| 1678 | return -EINVAL; |
| 1679 | } |
Cliff Wickman | 1812924 | 2008-06-02 08:56:14 -0500 | [diff] [blame] | 1680 | return 0; |
| 1681 | } |
| 1682 | |
Cliff Wickman | b194b12 | 2008-06-12 08:23:48 -0500 | [diff] [blame] | 1683 | /* |
Cliff Wickman | 77ed23f | 2011-05-10 08:26:43 -0500 | [diff] [blame] | 1684 | * Initialize the sending side's sending buffers. |
Cliff Wickman | b194b12 | 2008-06-12 08:23:48 -0500 | [diff] [blame] | 1685 | */ |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 1686 | static void activation_descriptor_init(int node, int pnode, int base_pnode) |
Cliff Wickman | b194b12 | 2008-06-12 08:23:48 -0500 | [diff] [blame] | 1687 | { |
| 1688 | int i; |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 1689 | int cpu; |
Cliff Wickman | da87c93 | 2012-01-16 15:17:50 -0600 | [diff] [blame] | 1690 | int uv1 = 0; |
Jack Steiner | 6a469e4 | 2011-09-20 13:55:04 -0700 | [diff] [blame] | 1691 | unsigned long gpa; |
Cliff Wickman | b194b12 | 2008-06-12 08:23:48 -0500 | [diff] [blame] | 1692 | unsigned long m; |
| 1693 | unsigned long n; |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 1694 | size_t dsize; |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 1695 | struct bau_desc *bau_desc; |
| 1696 | struct bau_desc *bd2; |
Cliff Wickman | da87c93 | 2012-01-16 15:17:50 -0600 | [diff] [blame] | 1697 | struct uv1_bau_msg_header *uv1_hdr; |
Cliff Wickman | a26fd71 | 2014-05-14 16:15:47 -0500 | [diff] [blame] | 1698 | struct uv2_3_bau_msg_header *uv2_3_hdr; |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 1699 | struct bau_control *bcp; |
Cliff Wickman | b194b12 | 2008-06-12 08:23:48 -0500 | [diff] [blame] | 1700 | |
Cliff Wickman | 0e2595c | 2009-05-20 08:10:57 -0500 | [diff] [blame] | 1701 | /* |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 1702 | * each bau_desc is 64 bytes; there are 8 (ITEMS_PER_DESC) |
| 1703 | * per cpu; and one per cpu on the uvhub (ADP_SZ) |
Cliff Wickman | 0e2595c | 2009-05-20 08:10:57 -0500 | [diff] [blame] | 1704 | */ |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 1705 | dsize = sizeof(struct bau_desc) * ADP_SZ * ITEMS_PER_DESC; |
| 1706 | bau_desc = kmalloc_node(dsize, GFP_KERNEL, node); |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 1707 | BUG_ON(!bau_desc); |
Ingo Molnar | b4c286e | 2008-06-18 14:28:19 +0200 | [diff] [blame] | 1708 | |
Jack Steiner | 6a469e4 | 2011-09-20 13:55:04 -0700 | [diff] [blame] | 1709 | gpa = uv_gpa(bau_desc); |
| 1710 | n = uv_gpa_to_gnode(gpa); |
| 1711 | m = uv_gpa_to_offset(gpa); |
Cliff Wickman | da87c93 | 2012-01-16 15:17:50 -0600 | [diff] [blame] | 1712 | if (is_uv1_hub()) |
| 1713 | uv1 = 1; |
Ingo Molnar | b4c286e | 2008-06-18 14:28:19 +0200 | [diff] [blame] | 1714 | |
Cliff Wickman | 77ed23f | 2011-05-10 08:26:43 -0500 | [diff] [blame] | 1715 | /* the 14-bit pnode */ |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 1716 | write_mmr_descriptor_base(pnode, (n << UV_DESC_PSHIFT | m)); |
Cliff Wickman | 0e2595c | 2009-05-20 08:10:57 -0500 | [diff] [blame] | 1717 | /* |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 1718 | * Initializing all 8 (ITEMS_PER_DESC) descriptors for each |
Cliff Wickman | 0e2595c | 2009-05-20 08:10:57 -0500 | [diff] [blame] | 1719 | * cpu even though we only use the first one; one descriptor can |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 1720 | * describe a broadcast to 256 uv hubs. |
Cliff Wickman | 0e2595c | 2009-05-20 08:10:57 -0500 | [diff] [blame] | 1721 | */ |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 1722 | for (i = 0, bd2 = bau_desc; i < (ADP_SZ * ITEMS_PER_DESC); i++, bd2++) { |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 1723 | memset(bd2, 0, sizeof(struct bau_desc)); |
Cliff Wickman | da87c93 | 2012-01-16 15:17:50 -0600 | [diff] [blame] | 1724 | if (uv1) { |
| 1725 | uv1_hdr = &bd2->header.uv1_hdr; |
| 1726 | uv1_hdr->swack_flag = 1; |
| 1727 | /* |
| 1728 | * The base_dest_nasid set in the message header |
| 1729 | * is the nasid of the first uvhub in the partition. |
| 1730 | * The bit map will indicate destination pnode numbers |
| 1731 | * relative to that base. They may not be consecutive |
| 1732 | * if nasid striding is being used. |
| 1733 | */ |
| 1734 | uv1_hdr->base_dest_nasid = |
| 1735 | UV_PNODE_TO_NASID(base_pnode); |
| 1736 | uv1_hdr->dest_subnodeid = UV_LB_SUBNODEID; |
| 1737 | uv1_hdr->command = UV_NET_ENDPOINT_INTD; |
| 1738 | uv1_hdr->int_both = 1; |
| 1739 | /* |
| 1740 | * all others need to be set to zero: |
| 1741 | * fairness chaining multilevel count replied_to |
| 1742 | */ |
| 1743 | } else { |
Cliff Wickman | 8b6e511 | 2012-06-22 08:14:59 -0500 | [diff] [blame] | 1744 | /* |
Cliff Wickman | a26fd71 | 2014-05-14 16:15:47 -0500 | [diff] [blame] | 1745 | * BIOS uses legacy mode, but uv2 and uv3 hardware always |
Cliff Wickman | 8b6e511 | 2012-06-22 08:14:59 -0500 | [diff] [blame] | 1746 | * uses native mode for selective broadcasts. |
| 1747 | */ |
Cliff Wickman | a26fd71 | 2014-05-14 16:15:47 -0500 | [diff] [blame] | 1748 | uv2_3_hdr = &bd2->header.uv2_3_hdr; |
| 1749 | uv2_3_hdr->swack_flag = 1; |
| 1750 | uv2_3_hdr->base_dest_nasid = |
Cliff Wickman | da87c93 | 2012-01-16 15:17:50 -0600 | [diff] [blame] | 1751 | UV_PNODE_TO_NASID(base_pnode); |
Cliff Wickman | a26fd71 | 2014-05-14 16:15:47 -0500 | [diff] [blame] | 1752 | uv2_3_hdr->dest_subnodeid = UV_LB_SUBNODEID; |
| 1753 | uv2_3_hdr->command = UV_NET_ENDPOINT_INTD; |
Cliff Wickman | da87c93 | 2012-01-16 15:17:50 -0600 | [diff] [blame] | 1754 | } |
Cliff Wickman | b194b12 | 2008-06-12 08:23:48 -0500 | [diff] [blame] | 1755 | } |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 1756 | for_each_present_cpu(cpu) { |
| 1757 | if (pnode != uv_blade_to_pnode(uv_cpu_to_blade_id(cpu))) |
| 1758 | continue; |
| 1759 | bcp = &per_cpu(bau_control, cpu); |
| 1760 | bcp->descriptor_base = bau_desc; |
| 1761 | } |
Cliff Wickman | b194b12 | 2008-06-12 08:23:48 -0500 | [diff] [blame] | 1762 | } |
| 1763 | |
| 1764 | /* |
| 1765 | * initialize the destination side's receiving buffers |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 1766 | * entered for each uvhub in the partition |
| 1767 | * - node is first node (kernel memory notion) on the uvhub |
| 1768 | * - pnode is the uvhub's physical identifier |
Cliff Wickman | b194b12 | 2008-06-12 08:23:48 -0500 | [diff] [blame] | 1769 | */ |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 1770 | static void pq_init(int node, int pnode) |
Cliff Wickman | b194b12 | 2008-06-12 08:23:48 -0500 | [diff] [blame] | 1771 | { |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 1772 | int cpu; |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 1773 | size_t plsize; |
Ingo Molnar | b4c286e | 2008-06-18 14:28:19 +0200 | [diff] [blame] | 1774 | char *cp; |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 1775 | void *vp; |
| 1776 | unsigned long pn; |
| 1777 | unsigned long first; |
| 1778 | unsigned long pn_first; |
| 1779 | unsigned long last; |
| 1780 | struct bau_pq_entry *pqp; |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 1781 | struct bau_control *bcp; |
Cliff Wickman | b194b12 | 2008-06-12 08:23:48 -0500 | [diff] [blame] | 1782 | |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 1783 | plsize = (DEST_Q_SIZE + 1) * sizeof(struct bau_pq_entry); |
| 1784 | vp = kmalloc_node(plsize, GFP_KERNEL, node); |
| 1785 | pqp = (struct bau_pq_entry *)vp; |
Ingo Molnar | dc163a4 | 2008-06-18 14:15:43 +0200 | [diff] [blame] | 1786 | BUG_ON(!pqp); |
Ingo Molnar | b4c286e | 2008-06-18 14:28:19 +0200 | [diff] [blame] | 1787 | |
Cliff Wickman | b194b12 | 2008-06-12 08:23:48 -0500 | [diff] [blame] | 1788 | cp = (char *)pqp + 31; |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 1789 | pqp = (struct bau_pq_entry *)(((unsigned long)cp >> 5) << 5); |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 1790 | |
| 1791 | for_each_present_cpu(cpu) { |
| 1792 | if (pnode != uv_cpu_to_pnode(cpu)) |
| 1793 | continue; |
| 1794 | /* for every cpu on this pnode: */ |
| 1795 | bcp = &per_cpu(bau_control, cpu); |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 1796 | bcp->queue_first = pqp; |
| 1797 | bcp->bau_msg_head = pqp; |
| 1798 | bcp->queue_last = pqp + (DEST_Q_SIZE - 1); |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 1799 | } |
Cliff Wickman | 4ea3c51 | 2009-04-16 07:53:09 -0500 | [diff] [blame] | 1800 | /* |
Jack Steiner | 6a469e4 | 2011-09-20 13:55:04 -0700 | [diff] [blame] | 1801 | * need the gnode of where the memory was really allocated |
Cliff Wickman | 4ea3c51 | 2009-04-16 07:53:09 -0500 | [diff] [blame] | 1802 | */ |
Jack Steiner | 6a469e4 | 2011-09-20 13:55:04 -0700 | [diff] [blame] | 1803 | pn = uv_gpa_to_gnode(uv_gpa(pqp)); |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 1804 | first = uv_physnodeaddr(pqp); |
| 1805 | pn_first = ((unsigned long)pn << UV_PAYLOADQ_PNODE_SHIFT) | first; |
| 1806 | last = uv_physnodeaddr(pqp + (DEST_Q_SIZE - 1)); |
| 1807 | write_mmr_payload_first(pnode, pn_first); |
| 1808 | write_mmr_payload_tail(pnode, first); |
| 1809 | write_mmr_payload_last(pnode, last); |
Cliff Wickman | c5d35d3 | 2012-01-16 15:19:47 -0600 | [diff] [blame] | 1810 | write_gmmr_sw_ack(pnode, 0xffffUL); |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 1811 | |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 1812 | /* in effect, all msg_type's are set to MSG_NOOP */ |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 1813 | memset(pqp, 0, sizeof(struct bau_pq_entry) * DEST_Q_SIZE); |
Cliff Wickman | b194b12 | 2008-06-12 08:23:48 -0500 | [diff] [blame] | 1814 | } |
| 1815 | |
| 1816 | /* |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 1817 | * Initialization of each UV hub's structures |
Cliff Wickman | b194b12 | 2008-06-12 08:23:48 -0500 | [diff] [blame] | 1818 | */ |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 1819 | static void __init init_uvhub(int uvhub, int vector, int base_pnode) |
Cliff Wickman | b194b12 | 2008-06-12 08:23:48 -0500 | [diff] [blame] | 1820 | { |
Cliff Wickman | 9674f35 | 2009-04-03 08:34:05 -0500 | [diff] [blame] | 1821 | int node; |
Cliff Wickman | b194b12 | 2008-06-12 08:23:48 -0500 | [diff] [blame] | 1822 | int pnode; |
Cliff Wickman | b194b12 | 2008-06-12 08:23:48 -0500 | [diff] [blame] | 1823 | unsigned long apicid; |
Cliff Wickman | b194b12 | 2008-06-12 08:23:48 -0500 | [diff] [blame] | 1824 | |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 1825 | node = uvhub_to_first_node(uvhub); |
| 1826 | pnode = uv_blade_to_pnode(uvhub); |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 1827 | |
| 1828 | activation_descriptor_init(node, pnode, base_pnode); |
| 1829 | |
| 1830 | pq_init(node, pnode); |
Cliff Wickman | b194b12 | 2008-06-12 08:23:48 -0500 | [diff] [blame] | 1831 | /* |
Cliff Wickman | 77ed23f | 2011-05-10 08:26:43 -0500 | [diff] [blame] | 1832 | * The below initialization can't be in firmware because the |
| 1833 | * messaging IRQ will be determined by the OS. |
Cliff Wickman | b194b12 | 2008-06-12 08:23:48 -0500 | [diff] [blame] | 1834 | */ |
Dimitri Sivanich | 8191c9f | 2010-11-16 16:23:52 -0600 | [diff] [blame] | 1835 | apicid = uvhub_to_first_apicid(uvhub) | uv_apicid_hibits; |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 1836 | write_mmr_data_config(pnode, ((apicid << 32) | vector)); |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 1837 | } |
| 1838 | |
| 1839 | /* |
Cliff Wickman | 12a6611 | 2010-06-02 16:22:01 -0500 | [diff] [blame] | 1840 | * We will set BAU_MISC_CONTROL with a timeout period. |
| 1841 | * But the BIOS has set UVH_AGING_PRESCALE_SEL and UVH_TRANSACTION_TIMEOUT. |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 1842 | * So the destination timeout period has to be calculated from them. |
Cliff Wickman | 12a6611 | 2010-06-02 16:22:01 -0500 | [diff] [blame] | 1843 | */ |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 1844 | static int calculate_destination_timeout(void) |
Cliff Wickman | 12a6611 | 2010-06-02 16:22:01 -0500 | [diff] [blame] | 1845 | { |
| 1846 | unsigned long mmr_image; |
| 1847 | int mult1; |
| 1848 | int mult2; |
| 1849 | int index; |
| 1850 | int base; |
| 1851 | int ret; |
| 1852 | unsigned long ts_ns; |
| 1853 | |
Jack Steiner | 2a91959 | 2011-05-11 12:50:28 -0500 | [diff] [blame] | 1854 | if (is_uv1_hub()) { |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 1855 | mult1 = SOFTACK_TIMEOUT_PERIOD & BAU_MISC_CONTROL_MULT_MASK; |
Jack Steiner | 2a91959 | 2011-05-11 12:50:28 -0500 | [diff] [blame] | 1856 | mmr_image = uv_read_local_mmr(UVH_AGING_PRESCALE_SEL); |
| 1857 | index = (mmr_image >> BAU_URGENCY_7_SHIFT) & BAU_URGENCY_7_MASK; |
| 1858 | mmr_image = uv_read_local_mmr(UVH_TRANSACTION_TIMEOUT); |
| 1859 | mult2 = (mmr_image >> BAU_TRANS_SHIFT) & BAU_TRANS_MASK; |
Cliff Wickman | 11cab71 | 2012-06-22 08:12:12 -0500 | [diff] [blame] | 1860 | ts_ns = timeout_base_ns[index]; |
| 1861 | ts_ns *= (mult1 * mult2); |
Jack Steiner | 2a91959 | 2011-05-11 12:50:28 -0500 | [diff] [blame] | 1862 | ret = ts_ns / 1000; |
| 1863 | } else { |
Cliff Wickman | a26fd71 | 2014-05-14 16:15:47 -0500 | [diff] [blame] | 1864 | /* same destination timeout for uv2 and uv3 */ |
Cliff Wickman | d059f9f | 2012-01-16 15:18:48 -0600 | [diff] [blame] | 1865 | /* 4 bits 0/1 for 10/80us base, 3 bits of multiplier */ |
| 1866 | mmr_image = uv_read_local_mmr(UVH_LB_BAU_MISC_CONTROL); |
Jack Steiner | 2a91959 | 2011-05-11 12:50:28 -0500 | [diff] [blame] | 1867 | mmr_image = (mmr_image & UV_SA_MASK) >> UV_SA_SHFT; |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 1868 | if (mmr_image & (1L << UV2_ACK_UNITS_SHFT)) |
Cliff Wickman | d059f9f | 2012-01-16 15:18:48 -0600 | [diff] [blame] | 1869 | base = 80; |
Jack Steiner | 2a91959 | 2011-05-11 12:50:28 -0500 | [diff] [blame] | 1870 | else |
Cliff Wickman | d059f9f | 2012-01-16 15:18:48 -0600 | [diff] [blame] | 1871 | base = 10; |
| 1872 | mult1 = mmr_image & UV2_ACK_MASK; |
Jack Steiner | 2a91959 | 2011-05-11 12:50:28 -0500 | [diff] [blame] | 1873 | ret = mult1 * base; |
| 1874 | } |
Cliff Wickman | 12a6611 | 2010-06-02 16:22:01 -0500 | [diff] [blame] | 1875 | return ret; |
| 1876 | } |
| 1877 | |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 1878 | static void __init init_per_cpu_tunables(void) |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 1879 | { |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 1880 | int cpu; |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 1881 | struct bau_control *bcp; |
| 1882 | |
| 1883 | for_each_present_cpu(cpu) { |
| 1884 | bcp = &per_cpu(bau_control, cpu); |
| 1885 | bcp->baudisabled = 0; |
Cliff Wickman | 26ef857 | 2012-06-22 08:13:30 -0500 | [diff] [blame] | 1886 | if (nobau) |
| 1887 | bcp->nobau = 1; |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 1888 | bcp->statp = &per_cpu(ptcstats, cpu); |
| 1889 | /* time interval to catch a hardware stay-busy bug */ |
| 1890 | bcp->timeout_interval = usec_2_cycles(2*timeout_us); |
| 1891 | bcp->max_concurr = max_concurr; |
| 1892 | bcp->max_concurr_const = max_concurr; |
| 1893 | bcp->plugged_delay = plugged_delay; |
| 1894 | bcp->plugsb4reset = plugsb4reset; |
| 1895 | bcp->timeoutsb4reset = timeoutsb4reset; |
| 1896 | bcp->ipi_reset_limit = ipi_reset_limit; |
| 1897 | bcp->complete_threshold = complete_threshold; |
| 1898 | bcp->cong_response_us = congested_respns_us; |
| 1899 | bcp->cong_reps = congested_reps; |
Cliff Wickman | 8b6e511 | 2012-06-22 08:14:59 -0500 | [diff] [blame] | 1900 | bcp->disabled_period = sec_2_cycles(disabled_period); |
| 1901 | bcp->giveup_limit = giveup_limit; |
Cliff Wickman | d2ebc71 | 2012-01-18 09:40:47 -0600 | [diff] [blame] | 1902 | spin_lock_init(&bcp->queue_lock); |
| 1903 | spin_lock_init(&bcp->uvhub_lock); |
Cliff Wickman | 8b6e511 | 2012-06-22 08:14:59 -0500 | [diff] [blame] | 1904 | spin_lock_init(&bcp->disable_lock); |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 1905 | } |
| 1906 | } |
| 1907 | |
| 1908 | /* |
| 1909 | * Scan all cpus to collect blade and socket summaries. |
| 1910 | */ |
| 1911 | static int __init get_cpu_topology(int base_pnode, |
| 1912 | struct uvhub_desc *uvhub_descs, |
| 1913 | unsigned char *uvhub_mask) |
| 1914 | { |
| 1915 | int cpu; |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 1916 | int pnode; |
| 1917 | int uvhub; |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 1918 | int socket; |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 1919 | struct bau_control *bcp; |
| 1920 | struct uvhub_desc *bdp; |
| 1921 | struct socket_desc *sdp; |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 1922 | |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 1923 | for_each_present_cpu(cpu) { |
| 1924 | bcp = &per_cpu(bau_control, cpu); |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 1925 | |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 1926 | memset(bcp, 0, sizeof(struct bau_control)); |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 1927 | |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 1928 | pnode = uv_cpu_hub_info(cpu)->pnode; |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 1929 | if ((pnode - base_pnode) >= UV_DISTRIBUTION_SIZE) { |
Cliff Wickman | 77ed23f | 2011-05-10 08:26:43 -0500 | [diff] [blame] | 1930 | printk(KERN_EMERG |
| 1931 | "cpu %d pnode %d-%d beyond %d; BAU disabled\n", |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 1932 | cpu, pnode, base_pnode, UV_DISTRIBUTION_SIZE); |
Cliff Wickman | 77ed23f | 2011-05-10 08:26:43 -0500 | [diff] [blame] | 1933 | return 1; |
| 1934 | } |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 1935 | |
Cliff Wickman | 77ed23f | 2011-05-10 08:26:43 -0500 | [diff] [blame] | 1936 | bcp->osnode = cpu_to_node(cpu); |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 1937 | bcp->partition_base_pnode = base_pnode; |
| 1938 | |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 1939 | uvhub = uv_cpu_hub_info(cpu)->numa_blade_id; |
Cliff Wickman | c4026cf | 2010-07-30 14:10:55 -0500 | [diff] [blame] | 1940 | *(uvhub_mask + (uvhub/8)) |= (1 << (uvhub%8)); |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 1941 | bdp = &uvhub_descs[uvhub]; |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 1942 | |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 1943 | bdp->num_cpus++; |
| 1944 | bdp->uvhub = uvhub; |
| 1945 | bdp->pnode = pnode; |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 1946 | |
Cliff Wickman | a8328ee | 2010-06-02 16:22:02 -0500 | [diff] [blame] | 1947 | /* kludge: 'assuming' one node per socket, and assuming that |
| 1948 | disabling a socket just leaves a gap in node numbers */ |
Cliff Wickman | 77ed23f | 2011-05-10 08:26:43 -0500 | [diff] [blame] | 1949 | socket = bcp->osnode & 1; |
Cliff Wickman | a8328ee | 2010-06-02 16:22:02 -0500 | [diff] [blame] | 1950 | bdp->socket_mask |= (1 << socket); |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 1951 | sdp = &bdp->socket[socket]; |
| 1952 | sdp->cpu_number[sdp->num_cpus] = cpu; |
| 1953 | sdp->num_cpus++; |
Cliff Wickman | cfa6091 | 2011-01-03 12:03:53 -0600 | [diff] [blame] | 1954 | if (sdp->num_cpus > MAX_CPUS_PER_SOCKET) { |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 1955 | printk(KERN_EMERG "%d cpus per socket invalid\n", |
| 1956 | sdp->num_cpus); |
Cliff Wickman | cfa6091 | 2011-01-03 12:03:53 -0600 | [diff] [blame] | 1957 | return 1; |
| 1958 | } |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 1959 | } |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 1960 | return 0; |
| 1961 | } |
| 1962 | |
| 1963 | /* |
| 1964 | * Each socket is to get a local array of pnodes/hubs. |
| 1965 | */ |
| 1966 | static void make_per_cpu_thp(struct bau_control *smaster) |
| 1967 | { |
| 1968 | int cpu; |
| 1969 | size_t hpsz = sizeof(struct hub_and_pnode) * num_possible_cpus(); |
| 1970 | |
| 1971 | smaster->thp = kmalloc_node(hpsz, GFP_KERNEL, smaster->osnode); |
| 1972 | memset(smaster->thp, 0, hpsz); |
| 1973 | for_each_present_cpu(cpu) { |
| 1974 | smaster->thp[cpu].pnode = uv_cpu_hub_info(cpu)->pnode; |
| 1975 | smaster->thp[cpu].uvhub = uv_cpu_hub_info(cpu)->numa_blade_id; |
| 1976 | } |
| 1977 | } |
| 1978 | |
| 1979 | /* |
cpw@sgi.com | 442d392 | 2011-06-21 07:21:31 -0500 | [diff] [blame] | 1980 | * Each uvhub is to get a local cpumask. |
| 1981 | */ |
| 1982 | static void make_per_hub_cpumask(struct bau_control *hmaster) |
| 1983 | { |
| 1984 | int sz = sizeof(cpumask_t); |
| 1985 | |
| 1986 | hmaster->cpumask = kzalloc_node(sz, GFP_KERNEL, hmaster->osnode); |
| 1987 | } |
| 1988 | |
| 1989 | /* |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 1990 | * Initialize all the per_cpu information for the cpu's on a given socket, |
| 1991 | * given what has been gathered into the socket_desc struct. |
| 1992 | * And reports the chosen hub and socket masters back to the caller. |
| 1993 | */ |
| 1994 | static int scan_sock(struct socket_desc *sdp, struct uvhub_desc *bdp, |
| 1995 | struct bau_control **smasterp, |
| 1996 | struct bau_control **hmasterp) |
| 1997 | { |
| 1998 | int i; |
| 1999 | int cpu; |
| 2000 | struct bau_control *bcp; |
| 2001 | |
| 2002 | for (i = 0; i < sdp->num_cpus; i++) { |
| 2003 | cpu = sdp->cpu_number[i]; |
| 2004 | bcp = &per_cpu(bau_control, cpu); |
| 2005 | bcp->cpu = cpu; |
| 2006 | if (i == 0) { |
| 2007 | *smasterp = bcp; |
| 2008 | if (!(*hmasterp)) |
| 2009 | *hmasterp = bcp; |
| 2010 | } |
| 2011 | bcp->cpus_in_uvhub = bdp->num_cpus; |
| 2012 | bcp->cpus_in_socket = sdp->num_cpus; |
| 2013 | bcp->socket_master = *smasterp; |
| 2014 | bcp->uvhub = bdp->uvhub; |
Cliff Wickman | da87c93 | 2012-01-16 15:17:50 -0600 | [diff] [blame] | 2015 | if (is_uv1_hub()) |
| 2016 | bcp->uvhub_version = 1; |
| 2017 | else if (is_uv2_hub()) |
| 2018 | bcp->uvhub_version = 2; |
Cliff Wickman | a26fd71 | 2014-05-14 16:15:47 -0500 | [diff] [blame] | 2019 | else if (is_uv3_hub()) |
| 2020 | bcp->uvhub_version = 3; |
Cliff Wickman | da87c93 | 2012-01-16 15:17:50 -0600 | [diff] [blame] | 2021 | else { |
Cliff Wickman | a26fd71 | 2014-05-14 16:15:47 -0500 | [diff] [blame] | 2022 | printk(KERN_EMERG "uvhub version not 1, 2 or 3\n"); |
Cliff Wickman | da87c93 | 2012-01-16 15:17:50 -0600 | [diff] [blame] | 2023 | return 1; |
| 2024 | } |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 2025 | bcp->uvhub_master = *hmasterp; |
| 2026 | bcp->uvhub_cpu = uv_cpu_hub_info(cpu)->blade_processor_id; |
| 2027 | if (bcp->uvhub_cpu >= MAX_CPUS_PER_UVHUB) { |
| 2028 | printk(KERN_EMERG "%d cpus per uvhub invalid\n", |
| 2029 | bcp->uvhub_cpu); |
| 2030 | return 1; |
| 2031 | } |
| 2032 | } |
| 2033 | return 0; |
| 2034 | } |
| 2035 | |
| 2036 | /* |
| 2037 | * Summarize the blade and socket topology into the per_cpu structures. |
| 2038 | */ |
| 2039 | static int __init summarize_uvhub_sockets(int nuvhubs, |
| 2040 | struct uvhub_desc *uvhub_descs, |
| 2041 | unsigned char *uvhub_mask) |
| 2042 | { |
| 2043 | int socket; |
| 2044 | int uvhub; |
| 2045 | unsigned short socket_mask; |
| 2046 | |
Cliff Wickman | c4026cf | 2010-07-30 14:10:55 -0500 | [diff] [blame] | 2047 | for (uvhub = 0; uvhub < nuvhubs; uvhub++) { |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 2048 | struct uvhub_desc *bdp; |
| 2049 | struct bau_control *smaster = NULL; |
| 2050 | struct bau_control *hmaster = NULL; |
| 2051 | |
Cliff Wickman | c4026cf | 2010-07-30 14:10:55 -0500 | [diff] [blame] | 2052 | if (!(*(uvhub_mask + (uvhub/8)) & (1 << (uvhub%8)))) |
| 2053 | continue; |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 2054 | |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 2055 | bdp = &uvhub_descs[uvhub]; |
Cliff Wickman | a8328ee | 2010-06-02 16:22:02 -0500 | [diff] [blame] | 2056 | socket_mask = bdp->socket_mask; |
| 2057 | socket = 0; |
| 2058 | while (socket_mask) { |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 2059 | struct socket_desc *sdp; |
| 2060 | if ((socket_mask & 1)) { |
| 2061 | sdp = &bdp->socket[socket]; |
| 2062 | if (scan_sock(sdp, bdp, &smaster, &hmaster)) |
Cliff Wickman | cfa6091 | 2011-01-03 12:03:53 -0600 | [diff] [blame] | 2063 | return 1; |
cpw@sgi.com | 9c9153d | 2011-06-21 07:21:28 -0500 | [diff] [blame] | 2064 | make_per_cpu_thp(smaster); |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 2065 | } |
| 2066 | socket++; |
Cliff Wickman | a8328ee | 2010-06-02 16:22:02 -0500 | [diff] [blame] | 2067 | socket_mask = (socket_mask >> 1); |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 2068 | } |
cpw@sgi.com | 442d392 | 2011-06-21 07:21:31 -0500 | [diff] [blame] | 2069 | make_per_hub_cpumask(hmaster); |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 2070 | } |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 2071 | return 0; |
| 2072 | } |
| 2073 | |
| 2074 | /* |
| 2075 | * initialize the bau_control structure for each cpu |
| 2076 | */ |
| 2077 | static int __init init_per_cpu(int nuvhubs, int base_part_pnode) |
| 2078 | { |
| 2079 | unsigned char *uvhub_mask; |
| 2080 | void *vp; |
| 2081 | struct uvhub_desc *uvhub_descs; |
| 2082 | |
| 2083 | timeout_us = calculate_destination_timeout(); |
| 2084 | |
| 2085 | vp = kmalloc(nuvhubs * sizeof(struct uvhub_desc), GFP_KERNEL); |
| 2086 | uvhub_descs = (struct uvhub_desc *)vp; |
| 2087 | memset(uvhub_descs, 0, nuvhubs * sizeof(struct uvhub_desc)); |
| 2088 | uvhub_mask = kzalloc((nuvhubs+7)/8, GFP_KERNEL); |
| 2089 | |
| 2090 | if (get_cpu_topology(base_part_pnode, uvhub_descs, uvhub_mask)) |
cpw@sgi.com | bbd270e | 2011-06-21 07:21:32 -0500 | [diff] [blame] | 2091 | goto fail; |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 2092 | |
| 2093 | if (summarize_uvhub_sockets(nuvhubs, uvhub_descs, uvhub_mask)) |
cpw@sgi.com | bbd270e | 2011-06-21 07:21:32 -0500 | [diff] [blame] | 2094 | goto fail; |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 2095 | |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 2096 | kfree(uvhub_descs); |
Cliff Wickman | c4026cf | 2010-07-30 14:10:55 -0500 | [diff] [blame] | 2097 | kfree(uvhub_mask); |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 2098 | init_per_cpu_tunables(); |
Cliff Wickman | cfa6091 | 2011-01-03 12:03:53 -0600 | [diff] [blame] | 2099 | return 0; |
cpw@sgi.com | bbd270e | 2011-06-21 07:21:32 -0500 | [diff] [blame] | 2100 | |
| 2101 | fail: |
| 2102 | kfree(uvhub_descs); |
| 2103 | kfree(uvhub_mask); |
| 2104 | return 1; |
Cliff Wickman | b194b12 | 2008-06-12 08:23:48 -0500 | [diff] [blame] | 2105 | } |
Cliff Wickman | 1812924 | 2008-06-02 08:56:14 -0500 | [diff] [blame] | 2106 | |
| 2107 | /* |
| 2108 | * Initialization of BAU-related structures |
| 2109 | */ |
Cliff Wickman | b194b12 | 2008-06-12 08:23:48 -0500 | [diff] [blame] | 2110 | static int __init uv_bau_init(void) |
Cliff Wickman | 1812924 | 2008-06-02 08:56:14 -0500 | [diff] [blame] | 2111 | { |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 2112 | int uvhub; |
| 2113 | int pnode; |
| 2114 | int nuvhubs; |
Rusty Russell | 2c74d66 | 2009-03-18 08:22:30 +1030 | [diff] [blame] | 2115 | int cur_cpu; |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 2116 | int cpus; |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 2117 | int vector; |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 2118 | cpumask_var_t *mask; |
Cliff Wickman | 1812924 | 2008-06-02 08:56:14 -0500 | [diff] [blame] | 2119 | |
| 2120 | if (!is_uv_system()) |
| 2121 | return 0; |
| 2122 | |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 2123 | for_each_possible_cpu(cur_cpu) { |
| 2124 | mask = &per_cpu(uv_flush_tlb_mask, cur_cpu); |
| 2125 | zalloc_cpumask_var_node(mask, GFP_KERNEL, cpu_to_node(cur_cpu)); |
| 2126 | } |
Rusty Russell | 76ba0ec | 2009-03-13 14:49:57 +1030 | [diff] [blame] | 2127 | |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 2128 | nuvhubs = uv_num_possible_blades(); |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 2129 | congested_cycles = usec_2_cycles(congested_respns_us); |
Cliff Wickman | 9674f35 | 2009-04-03 08:34:05 -0500 | [diff] [blame] | 2130 | |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 2131 | uv_base_pnode = 0x7fffffff; |
Cliff Wickman | 77ed23f | 2011-05-10 08:26:43 -0500 | [diff] [blame] | 2132 | for (uvhub = 0; uvhub < nuvhubs; uvhub++) { |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 2133 | cpus = uv_blade_nr_possible_cpus(uvhub); |
| 2134 | if (cpus && (uv_blade_to_pnode(uvhub) < uv_base_pnode)) |
| 2135 | uv_base_pnode = uv_blade_to_pnode(uvhub); |
Cliff Wickman | 77ed23f | 2011-05-10 08:26:43 -0500 | [diff] [blame] | 2136 | } |
| 2137 | |
Cliff Wickman | d059f9f | 2012-01-16 15:18:48 -0600 | [diff] [blame] | 2138 | enable_timeouts(); |
| 2139 | |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 2140 | if (init_per_cpu(nuvhubs, uv_base_pnode)) { |
Cliff Wickman | 26ef857 | 2012-06-22 08:13:30 -0500 | [diff] [blame] | 2141 | set_bau_off(); |
| 2142 | nobau_perm = 1; |
Cliff Wickman | cfa6091 | 2011-01-03 12:03:53 -0600 | [diff] [blame] | 2143 | return 0; |
| 2144 | } |
Ingo Molnar | b4c286e | 2008-06-18 14:28:19 +0200 | [diff] [blame] | 2145 | |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 2146 | vector = UV_BAU_MESSAGE; |
Cliff Wickman | a26fd71 | 2014-05-14 16:15:47 -0500 | [diff] [blame] | 2147 | for_each_possible_blade(uvhub) { |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 2148 | if (uv_blade_nr_possible_cpus(uvhub)) |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 2149 | init_uvhub(uvhub, vector, uv_base_pnode); |
Cliff Wickman | a26fd71 | 2014-05-14 16:15:47 -0500 | [diff] [blame] | 2150 | } |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 2151 | |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 2152 | alloc_intr_gate(vector, uv_bau_message_intr1); |
| 2153 | |
| 2154 | for_each_possible_blade(uvhub) { |
Cliff Wickman | 93a7ca0 | 2010-07-16 10:11:21 -0500 | [diff] [blame] | 2155 | if (uv_blade_nr_possible_cpus(uvhub)) { |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 2156 | unsigned long val; |
| 2157 | unsigned long mmr; |
Cliff Wickman | 93a7ca0 | 2010-07-16 10:11:21 -0500 | [diff] [blame] | 2158 | pnode = uv_blade_to_pnode(uvhub); |
| 2159 | /* INIT the bau */ |
Cliff Wickman | f073cc8 | 2011-05-24 13:07:36 -0500 | [diff] [blame] | 2160 | val = 1L << 63; |
| 2161 | write_gmmr_activation(pnode, val); |
Cliff Wickman | 93a7ca0 | 2010-07-16 10:11:21 -0500 | [diff] [blame] | 2162 | mmr = 1; /* should be 1 to broadcast to both sockets */ |
Cliff Wickman | da87c93 | 2012-01-16 15:17:50 -0600 | [diff] [blame] | 2163 | if (!is_uv1_hub()) |
| 2164 | write_mmr_data_broadcast(pnode, mmr); |
Cliff Wickman | 93a7ca0 | 2010-07-16 10:11:21 -0500 | [diff] [blame] | 2165 | } |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 2166 | } |
Ingo Molnar | b4c286e | 2008-06-18 14:28:19 +0200 | [diff] [blame] | 2167 | |
Cliff Wickman | 1812924 | 2008-06-02 08:56:14 -0500 | [diff] [blame] | 2168 | return 0; |
| 2169 | } |
Cliff Wickman | b8f7fb1 | 2010-04-14 11:35:46 -0500 | [diff] [blame] | 2170 | core_initcall(uv_bau_init); |
Cliff Wickman | e8e5e8a | 2010-06-02 16:22:01 -0500 | [diff] [blame] | 2171 | fs_initcall(uv_ptc_init); |