Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'x86-uv-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip

* 'x86-uv-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
x86, UV: uv_irq.c: Fix all sparse warnings
x86, UV: Improve BAU performance and error recovery
x86, UV: Delete unneeded boot messages
x86, UV: Clean up UV headers for MMR definitions

+1176 -914
+174 -71
arch/x86/include/asm/uv/uv_bau.h
··· 27 27 * set 2 is at BASE + 2*512, set 3 at BASE + 3*512, and so on. 28 28 * 29 29 * We will use 31 sets, one for sending BAU messages from each of the 32 30 - * cpu's on the node. 30 + * cpu's on the uvhub. 31 31 * 32 32 * TLB shootdown will use the first of the 8 descriptors of each set. 33 33 * Each of the descriptors is 64 bytes in size (8*64 = 512 bytes in a set). 34 34 */ 35 35 36 36 #define UV_ITEMS_PER_DESCRIPTOR 8 37 + #define MAX_BAU_CONCURRENT 3 37 38 #define UV_CPUS_PER_ACT_STATUS 32 38 39 #define UV_ACT_STATUS_MASK 0x3 39 40 #define UV_ACT_STATUS_SIZE 2 ··· 46 45 #define UV_PAYLOADQ_PNODE_SHIFT 49 47 46 #define UV_PTC_BASENAME "sgi_uv/ptc_statistics" 48 47 #define uv_physnodeaddr(x) ((__pa((unsigned long)(x)) & uv_mmask)) 48 + #define UV_ENABLE_INTD_SOFT_ACK_MODE_SHIFT 15 49 + #define UV_INTD_SOFT_ACK_TIMEOUT_PERIOD_SHIFT 16 50 + #define UV_INTD_SOFT_ACK_TIMEOUT_PERIOD 0x000000000bUL 49 51 50 52 /* 51 53 * bits in UVH_LB_BAU_SB_ACTIVATION_STATUS_0/1 ··· 59 55 #define DESC_STATUS_SOURCE_TIMEOUT 3 60 56 61 57 /* 62 - * source side thresholds at which message retries print a warning 58 + * source side threshholds at which message retries print a warning 63 59 */ 64 60 #define SOURCE_TIMEOUT_LIMIT 20 65 61 #define DESTINATION_TIMEOUT_LIMIT 20 66 62 67 63 /* 64 + * misc. delays, in microseconds 65 + */ 66 + #define THROTTLE_DELAY 10 67 + #define TIMEOUT_DELAY 10 68 + #define BIOS_TO 1000 69 + /* BIOS is assumed to set the destination timeout to 1003520 nanoseconds */ 70 + 71 + /* 72 + * threshholds at which to use IPI to free resources 73 + */ 74 + #define PLUGSB4RESET 100 75 + #define TIMEOUTSB4RESET 100 76 + 77 + /* 68 78 * number of entries in the destination side payload queue 69 79 */ 70 - #define DEST_Q_SIZE 17 80 + #define DEST_Q_SIZE 20 71 81 /* 72 82 * number of destination side software ack resources 73 83 */ ··· 90 72 /* 91 73 * completion statuses for sending a TLB flush message 92 74 */ 93 - #define FLUSH_RETRY 1 94 - #define FLUSH_GIVEUP 2 95 - #define FLUSH_COMPLETE 3 75 + #define FLUSH_RETRY_PLUGGED 1 76 + #define FLUSH_RETRY_TIMEOUT 2 77 + #define FLUSH_GIVEUP 3 78 + #define FLUSH_COMPLETE 4 96 79 97 80 /* 98 81 * Distribution: 32 bytes (256 bits) (bytes 0-0x1f of descriptor) ··· 105 86 * 'base_dest_nodeid' field of the header corresponds to the 106 87 * destination nodeID associated with that specified bit. 107 88 */ 108 - struct bau_target_nodemask { 109 - unsigned long bits[BITS_TO_LONGS(256)]; 89 + struct bau_target_uvhubmask { 90 + unsigned long bits[BITS_TO_LONGS(UV_DISTRIBUTION_SIZE)]; 110 91 }; 111 92 112 93 /* 113 - * mask of cpu's on a node 94 + * mask of cpu's on a uvhub 114 95 * (during initialization we need to check that unsigned long has 115 - * enough bits for max. cpu's per node) 96 + * enough bits for max. cpu's per uvhub) 116 97 */ 117 98 struct bau_local_cpumask { 118 99 unsigned long bits; ··· 154 135 struct bau_msg_header { 155 136 unsigned int dest_subnodeid:6; /* must be 0x10, for the LB */ 156 137 /* bits 5:0 */ 157 - unsigned int base_dest_nodeid:15; /* nasid>>1 (pnode) of */ 158 - /* bits 20:6 */ /* first bit in node_map */ 138 + unsigned int base_dest_nodeid:15; /* nasid (pnode<<1) of */ 139 + /* bits 20:6 */ /* first bit in uvhub map */ 159 140 unsigned int command:8; /* message type */ 160 141 /* bits 28:21 */ 161 142 /* 0x38: SN3net EndPoint Message */ ··· 165 146 unsigned int rsvd_2:9; /* must be zero */ 166 147 /* bits 40:32 */ 167 148 /* Suppl_A is 56-41 */ 168 - unsigned int payload_2a:8;/* becomes byte 16 of msg */ 169 - /* bits 48:41 */ /* not currently using */ 170 - unsigned int payload_2b:8;/* becomes byte 17 of msg */ 171 - /* bits 56:49 */ /* not currently using */ 149 + unsigned int sequence:16;/* message sequence number */ 150 + /* bits 56:41 */ /* becomes bytes 16-17 of msg */ 172 151 /* Address field (96:57) is never used as an 173 152 address (these are address bits 42:3) */ 153 + 174 154 unsigned int rsvd_3:1; /* must be zero */ 175 155 /* bit 57 */ 176 156 /* address bits 27:4 are payload */ 177 - /* these 24 bits become bytes 12-14 of msg */ 157 + /* these next 24 (58-81) bits become bytes 12-14 of msg */ 158 + 159 + /* bits 65:58 land in byte 12 */ 178 160 unsigned int replied_to:1;/* sent as 0 by the source to byte 12 */ 179 161 /* bit 58 */ 162 + unsigned int msg_type:3; /* software type of the message*/ 163 + /* bits 61:59 */ 164 + unsigned int canceled:1; /* message canceled, resource to be freed*/ 165 + /* bit 62 */ 166 + unsigned int payload_1a:1;/* not currently used */ 167 + /* bit 63 */ 168 + unsigned int payload_1b:2;/* not currently used */ 169 + /* bits 65:64 */ 180 170 181 - unsigned int payload_1a:5;/* not currently used */ 182 - /* bits 63:59 */ 183 - unsigned int payload_1b:8;/* not currently used */ 184 - /* bits 71:64 */ 185 - unsigned int payload_1c:8;/* not currently used */ 186 - /* bits 79:72 */ 187 - unsigned int payload_1d:2;/* not currently used */ 171 + /* bits 73:66 land in byte 13 */ 172 + unsigned int payload_1ca:6;/* not currently used */ 173 + /* bits 71:66 */ 174 + unsigned int payload_1c:2;/* not currently used */ 175 + /* bits 73:72 */ 176 + 177 + /* bits 81:74 land in byte 14 */ 178 + unsigned int payload_1d:6;/* not currently used */ 179 + /* bits 79:74 */ 180 + unsigned int payload_1e:2;/* not currently used */ 188 181 /* bits 81:80 */ 189 182 190 183 unsigned int rsvd_4:7; /* must be zero */ ··· 209 178 /* bits 95:90 */ 210 179 unsigned int rsvd_6:5; /* must be zero */ 211 180 /* bits 100:96 */ 212 - unsigned int int_both:1;/* if 1, interrupt both sockets on the blade */ 181 + unsigned int int_both:1;/* if 1, interrupt both sockets on the uvhub */ 213 182 /* bit 101*/ 214 183 unsigned int fairness:3;/* usually zero */ 215 184 /* bits 104:102 */ ··· 222 191 /* bits 127:107 */ 223 192 }; 224 193 194 + /* see msg_type: */ 195 + #define MSG_NOOP 0 196 + #define MSG_REGULAR 1 197 + #define MSG_RETRY 2 198 + 225 199 /* 226 200 * The activation descriptor: 227 201 * The format of the message to send, plus all accompanying control 228 202 * Should be 64 bytes 229 203 */ 230 204 struct bau_desc { 231 - struct bau_target_nodemask distribution; 205 + struct bau_target_uvhubmask distribution; 232 206 /* 233 207 * message template, consisting of header and payload: 234 208 */ ··· 273 237 unsigned short acknowledge_count; /* filled in by destination */ 274 238 /* 16 bits, bytes 10-11 */ 275 239 276 - unsigned short replied_to:1; /* sent as 0 by the source */ 277 - /* 1 bit */ 278 - unsigned short unused1:7; /* not currently using */ 279 - /* 7 bits: byte 12) */ 240 + /* these next 3 bytes come from bits 58-81 of the message header */ 241 + unsigned short replied_to:1; /* sent as 0 by the source */ 242 + unsigned short msg_type:3; /* software message type */ 243 + unsigned short canceled:1; /* sent as 0 by the source */ 244 + unsigned short unused1:3; /* not currently using */ 245 + /* byte 12 */ 280 246 281 - unsigned char unused2[2]; /* not currently using */ 282 - /* bytes 13-14 */ 247 + unsigned char unused2a; /* not currently using */ 248 + /* byte 13 */ 249 + unsigned char unused2; /* not currently using */ 250 + /* byte 14 */ 283 251 284 252 unsigned char sw_ack_vector; /* filled in by the hardware */ 285 253 /* byte 15 (bits 127:120) */ 286 254 287 - unsigned char unused4[3]; /* not currently using bytes 17-19 */ 288 - /* bytes 17-19 */ 255 + unsigned short sequence; /* message sequence number */ 256 + /* bytes 16-17 */ 257 + unsigned char unused4[2]; /* not currently using bytes 18-19 */ 258 + /* bytes 18-19 */ 289 259 290 260 int number_of_cpus; /* filled in at destination */ 291 261 /* 32 bits, bytes 20-23 (aligned) */ ··· 301 259 }; 302 260 303 261 /* 304 - * one for every slot in the destination payload queue 305 - */ 306 - struct bau_msg_status { 307 - struct bau_local_cpumask seen_by; /* map of cpu's */ 308 - }; 309 - 310 - /* 311 - * one for every slot in the destination software ack resources 312 - */ 313 - struct bau_sw_ack_status { 314 - struct bau_payload_queue_entry *msg; /* associated message */ 315 - int watcher; /* cpu monitoring, or -1 */ 316 - }; 317 - 318 - /* 319 - * one on every node and per-cpu; to locate the software tables 262 + * one per-cpu; to locate the software tables 320 263 */ 321 264 struct bau_control { 322 265 struct bau_desc *descriptor_base; 323 - struct bau_payload_queue_entry *bau_msg_head; 324 266 struct bau_payload_queue_entry *va_queue_first; 325 267 struct bau_payload_queue_entry *va_queue_last; 326 - struct bau_msg_status *msg_statuses; 327 - int *watching; /* pointer to array */ 268 + struct bau_payload_queue_entry *bau_msg_head; 269 + struct bau_control *uvhub_master; 270 + struct bau_control *socket_master; 271 + unsigned long timeout_interval; 272 + atomic_t active_descriptor_count; 273 + int max_concurrent; 274 + int max_concurrent_constant; 275 + int retry_message_scans; 276 + int plugged_tries; 277 + int timeout_tries; 278 + int ipi_attempts; 279 + int conseccompletes; 280 + short cpu; 281 + short uvhub_cpu; 282 + short uvhub; 283 + short cpus_in_socket; 284 + short cpus_in_uvhub; 285 + unsigned short message_number; 286 + unsigned short uvhub_quiesce; 287 + short socket_acknowledge_count[DEST_Q_SIZE]; 288 + cycles_t send_message; 289 + spinlock_t masks_lock; 290 + spinlock_t uvhub_lock; 291 + spinlock_t queue_lock; 328 292 }; 329 293 330 294 /* 331 295 * This structure is allocated per_cpu for UV TLB shootdown statistics. 332 296 */ 333 297 struct ptc_stats { 334 - unsigned long ptc_i; /* number of IPI-style flushes */ 335 - unsigned long requestor; /* number of nodes this cpu sent to */ 336 - unsigned long requestee; /* times cpu was remotely requested */ 337 - unsigned long alltlb; /* times all tlb's on this cpu were flushed */ 338 - unsigned long onetlb; /* times just one tlb on this cpu was flushed */ 339 - unsigned long s_retry; /* retries on source side timeouts */ 340 - unsigned long d_retry; /* retries on destination side timeouts */ 341 - unsigned long sflush; /* cycles spent in uv_flush_tlb_others */ 342 - unsigned long dflush; /* cycles spent on destination side */ 343 - unsigned long retriesok; /* successes on retries */ 344 - unsigned long nomsg; /* interrupts with no message */ 345 - unsigned long multmsg; /* interrupts with multiple messages */ 346 - unsigned long ntargeted;/* nodes targeted */ 298 + /* sender statistics */ 299 + unsigned long s_giveup; /* number of fall backs to IPI-style flushes */ 300 + unsigned long s_requestor; /* number of shootdown requests */ 301 + unsigned long s_stimeout; /* source side timeouts */ 302 + unsigned long s_dtimeout; /* destination side timeouts */ 303 + unsigned long s_time; /* time spent in sending side */ 304 + unsigned long s_retriesok; /* successful retries */ 305 + unsigned long s_ntargcpu; /* number of cpus targeted */ 306 + unsigned long s_ntarguvhub; /* number of uvhubs targeted */ 307 + unsigned long s_ntarguvhub16; /* number of times >= 16 target hubs */ 308 + unsigned long s_ntarguvhub8; /* number of times >= 8 target hubs */ 309 + unsigned long s_ntarguvhub4; /* number of times >= 4 target hubs */ 310 + unsigned long s_ntarguvhub2; /* number of times >= 2 target hubs */ 311 + unsigned long s_ntarguvhub1; /* number of times == 1 target hub */ 312 + unsigned long s_resets_plug; /* ipi-style resets from plug state */ 313 + unsigned long s_resets_timeout; /* ipi-style resets from timeouts */ 314 + unsigned long s_busy; /* status stayed busy past s/w timer */ 315 + unsigned long s_throttles; /* waits in throttle */ 316 + unsigned long s_retry_messages; /* retry broadcasts */ 317 + /* destination statistics */ 318 + unsigned long d_alltlb; /* times all tlb's on this cpu were flushed */ 319 + unsigned long d_onetlb; /* times just one tlb on this cpu was flushed */ 320 + unsigned long d_multmsg; /* interrupts with multiple messages */ 321 + unsigned long d_nomsg; /* interrupts with no message */ 322 + unsigned long d_time; /* time spent on destination side */ 323 + unsigned long d_requestee; /* number of messages processed */ 324 + unsigned long d_retries; /* number of retry messages processed */ 325 + unsigned long d_canceled; /* number of messages canceled by retries */ 326 + unsigned long d_nocanceled; /* retries that found nothing to cancel */ 327 + unsigned long d_resets; /* number of ipi-style requests processed */ 328 + unsigned long d_rcanceled; /* number of messages canceled by resets */ 347 329 }; 348 330 349 - static inline int bau_node_isset(int node, struct bau_target_nodemask *dstp) 331 + static inline int bau_uvhub_isset(int uvhub, struct bau_target_uvhubmask *dstp) 350 332 { 351 - return constant_test_bit(node, &dstp->bits[0]); 333 + return constant_test_bit(uvhub, &dstp->bits[0]); 352 334 } 353 - static inline void bau_node_set(int node, struct bau_target_nodemask *dstp) 335 + static inline void bau_uvhub_set(int uvhub, struct bau_target_uvhubmask *dstp) 354 336 { 355 - __set_bit(node, &dstp->bits[0]); 337 + __set_bit(uvhub, &dstp->bits[0]); 356 338 } 357 - static inline void bau_nodes_clear(struct bau_target_nodemask *dstp, int nbits) 339 + static inline void bau_uvhubs_clear(struct bau_target_uvhubmask *dstp, 340 + int nbits) 358 341 { 359 342 bitmap_zero(&dstp->bits[0], nbits); 343 + } 344 + static inline int bau_uvhub_weight(struct bau_target_uvhubmask *dstp) 345 + { 346 + return bitmap_weight((unsigned long *)&dstp->bits[0], 347 + UV_DISTRIBUTION_SIZE); 360 348 } 361 349 362 350 static inline void bau_cpubits_clear(struct bau_local_cpumask *dstp, int nbits) ··· 399 327 400 328 extern void uv_bau_message_intr1(void); 401 329 extern void uv_bau_timeout_intr1(void); 330 + 331 + struct atomic_short { 332 + short counter; 333 + }; 334 + 335 + /** 336 + * atomic_read_short - read a short atomic variable 337 + * @v: pointer of type atomic_short 338 + * 339 + * Atomically reads the value of @v. 340 + */ 341 + static inline int atomic_read_short(const struct atomic_short *v) 342 + { 343 + return v->counter; 344 + } 345 + 346 + /** 347 + * atomic_add_short_return - add and return a short int 348 + * @i: short value to add 349 + * @v: pointer of type atomic_short 350 + * 351 + * Atomically adds @i to @v and returns @i + @v 352 + */ 353 + static inline int atomic_add_short_return(short i, struct atomic_short *v) 354 + { 355 + short __i = i; 356 + asm volatile(LOCK_PREFIX "xaddw %0, %1" 357 + : "+r" (i), "+m" (v->counter) 358 + : : "memory"); 359 + return i + __i; 360 + } 402 361 403 362 #endif /* _ASM_X86_UV_UV_BAU_H */
+1 -1
arch/x86/include/asm/uv/uv_hub.h
··· 307 307 * Access Global MMR space using the MMR space located at the top of physical 308 308 * memory. 309 309 */ 310 - static inline unsigned long *uv_global_mmr64_address(int pnode, unsigned long offset) 310 + static inline volatile void __iomem *uv_global_mmr64_address(int pnode, unsigned long offset) 311 311 { 312 312 return __va(UV_GLOBAL_MMR64_BASE | 313 313 UV_GLOBAL_MMR64_PNODE_BITS(pnode) | offset);
+79 -449
arch/x86/include/asm/uv/uv_mmrs.h
··· 1 - 2 1 /* 3 2 * This file is subject to the terms and conditions of the GNU General Public 4 3 * License. See the file "COPYING" in the main directory of this archive ··· 14 15 #define UV_MMR_ENABLE (1UL << 63) 15 16 16 17 /* ========================================================================= */ 18 + /* UVH_BAU_DATA_BROADCAST */ 19 + /* ========================================================================= */ 20 + #define UVH_BAU_DATA_BROADCAST 0x61688UL 21 + #define UVH_BAU_DATA_BROADCAST_32 0x0440 22 + 23 + #define UVH_BAU_DATA_BROADCAST_ENABLE_SHFT 0 24 + #define UVH_BAU_DATA_BROADCAST_ENABLE_MASK 0x0000000000000001UL 25 + 26 + union uvh_bau_data_broadcast_u { 27 + unsigned long v; 28 + struct uvh_bau_data_broadcast_s { 29 + unsigned long enable : 1; /* RW */ 30 + unsigned long rsvd_1_63: 63; /* */ 31 + } s; 32 + }; 33 + 34 + /* ========================================================================= */ 17 35 /* UVH_BAU_DATA_CONFIG */ 18 36 /* ========================================================================= */ 19 - #define UVH_LB_BAU_MISC_CONTROL 0x320170UL 20 - #define UV_ENABLE_INTD_SOFT_ACK_MODE_SHIFT 15 21 - #define UV_INTD_SOFT_ACK_TIMEOUT_PERIOD_SHIFT 16 22 - #define UV_INTD_SOFT_ACK_TIMEOUT_PERIOD 0x000000000bUL 23 - /* 1011 timebase 7 (168millisec) * 3 ticks -> 500ms */ 24 37 #define UVH_BAU_DATA_CONFIG 0x61680UL 25 38 #define UVH_BAU_DATA_CONFIG_32 0x0438 26 39 ··· 615 604 #define UVH_LB_BAU_INTD_SOFTWARE_ACKNOWLEDGE_ALIAS_32 0x0a70 616 605 617 606 /* ========================================================================= */ 607 + /* UVH_LB_BAU_MISC_CONTROL */ 608 + /* ========================================================================= */ 609 + #define UVH_LB_BAU_MISC_CONTROL 0x320170UL 610 + #define UVH_LB_BAU_MISC_CONTROL_32 0x00a10 611 + 612 + #define UVH_LB_BAU_MISC_CONTROL_REJECTION_DELAY_SHFT 0 613 + #define UVH_LB_BAU_MISC_CONTROL_REJECTION_DELAY_MASK 0x00000000000000ffUL 614 + #define UVH_LB_BAU_MISC_CONTROL_APIC_MODE_SHFT 8 615 + #define UVH_LB_BAU_MISC_CONTROL_APIC_MODE_MASK 0x0000000000000100UL 616 + #define UVH_LB_BAU_MISC_CONTROL_FORCE_BROADCAST_SHFT 9 617 + #define UVH_LB_BAU_MISC_CONTROL_FORCE_BROADCAST_MASK 0x0000000000000200UL 618 + #define UVH_LB_BAU_MISC_CONTROL_FORCE_LOCK_NOP_SHFT 10 619 + #define UVH_LB_BAU_MISC_CONTROL_FORCE_LOCK_NOP_MASK 0x0000000000000400UL 620 + #define UVH_LB_BAU_MISC_CONTROL_CSI_AGENT_PRESENCE_VECTOR_SHFT 11 621 + #define UVH_LB_BAU_MISC_CONTROL_CSI_AGENT_PRESENCE_VECTOR_MASK 0x0000000000003800UL 622 + #define UVH_LB_BAU_MISC_CONTROL_DESCRIPTOR_FETCH_MODE_SHFT 14 623 + #define UVH_LB_BAU_MISC_CONTROL_DESCRIPTOR_FETCH_MODE_MASK 0x0000000000004000UL 624 + #define UVH_LB_BAU_MISC_CONTROL_ENABLE_INTD_SOFT_ACK_MODE_SHFT 15 625 + #define UVH_LB_BAU_MISC_CONTROL_ENABLE_INTD_SOFT_ACK_MODE_MASK 0x0000000000008000UL 626 + #define UVH_LB_BAU_MISC_CONTROL_INTD_SOFT_ACK_TIMEOUT_PERIOD_SHFT 16 627 + #define UVH_LB_BAU_MISC_CONTROL_INTD_SOFT_ACK_TIMEOUT_PERIOD_MASK 0x00000000000f0000UL 628 + #define UVH_LB_BAU_MISC_CONTROL_ENABLE_DUAL_MAPPING_MODE_SHFT 20 629 + #define UVH_LB_BAU_MISC_CONTROL_ENABLE_DUAL_MAPPING_MODE_MASK 0x0000000000100000UL 630 + #define UVH_LB_BAU_MISC_CONTROL_VGA_IO_PORT_DECODE_ENABLE_SHFT 21 631 + #define UVH_LB_BAU_MISC_CONTROL_VGA_IO_PORT_DECODE_ENABLE_MASK 0x0000000000200000UL 632 + #define UVH_LB_BAU_MISC_CONTROL_VGA_IO_PORT_16_BIT_DECODE_SHFT 22 633 + #define UVH_LB_BAU_MISC_CONTROL_VGA_IO_PORT_16_BIT_DECODE_MASK 0x0000000000400000UL 634 + #define UVH_LB_BAU_MISC_CONTROL_SUPPRESS_DEST_REGISTRATION_SHFT 23 635 + #define UVH_LB_BAU_MISC_CONTROL_SUPPRESS_DEST_REGISTRATION_MASK 0x0000000000800000UL 636 + #define UVH_LB_BAU_MISC_CONTROL_PROGRAMMED_INITIAL_PRIORITY_SHFT 24 637 + #define UVH_LB_BAU_MISC_CONTROL_PROGRAMMED_INITIAL_PRIORITY_MASK 0x0000000007000000UL 638 + #define UVH_LB_BAU_MISC_CONTROL_USE_INCOMING_PRIORITY_SHFT 27 639 + #define UVH_LB_BAU_MISC_CONTROL_USE_INCOMING_PRIORITY_MASK 0x0000000008000000UL 640 + #define UVH_LB_BAU_MISC_CONTROL_ENABLE_PROGRAMMED_INITIAL_PRIORITY_SHFT 28 641 + #define UVH_LB_BAU_MISC_CONTROL_ENABLE_PROGRAMMED_INITIAL_PRIORITY_MASK 0x0000000010000000UL 642 + #define UVH_LB_BAU_MISC_CONTROL_FUN_SHFT 48 643 + #define UVH_LB_BAU_MISC_CONTROL_FUN_MASK 0xffff000000000000UL 644 + 645 + union uvh_lb_bau_misc_control_u { 646 + unsigned long v; 647 + struct uvh_lb_bau_misc_control_s { 648 + unsigned long rejection_delay : 8; /* RW */ 649 + unsigned long apic_mode : 1; /* RW */ 650 + unsigned long force_broadcast : 1; /* RW */ 651 + unsigned long force_lock_nop : 1; /* RW */ 652 + unsigned long csi_agent_presence_vector : 3; /* RW */ 653 + unsigned long descriptor_fetch_mode : 1; /* RW */ 654 + unsigned long enable_intd_soft_ack_mode : 1; /* RW */ 655 + unsigned long intd_soft_ack_timeout_period : 4; /* RW */ 656 + unsigned long enable_dual_mapping_mode : 1; /* RW */ 657 + unsigned long vga_io_port_decode_enable : 1; /* RW */ 658 + unsigned long vga_io_port_16_bit_decode : 1; /* RW */ 659 + unsigned long suppress_dest_registration : 1; /* RW */ 660 + unsigned long programmed_initial_priority : 3; /* RW */ 661 + unsigned long use_incoming_priority : 1; /* RW */ 662 + unsigned long enable_programmed_initial_priority : 1; /* RW */ 663 + unsigned long rsvd_29_47 : 19; /* */ 664 + unsigned long fun : 16; /* RW */ 665 + } s; 666 + }; 667 + 668 + /* ========================================================================= */ 618 669 /* UVH_LB_BAU_SB_ACTIVATION_CONTROL */ 619 670 /* ========================================================================= */ 620 671 #define UVH_LB_BAU_SB_ACTIVATION_CONTROL 0x320020UL ··· 750 677 unsigned long rsvd_43_48 : 6; /* */ 751 678 unsigned long node_id : 14; /* RW */ 752 679 unsigned long rsvd_63 : 1; /* */ 753 - } s; 754 - }; 755 - 756 - /* ========================================================================= */ 757 - /* UVH_LB_MCAST_AOERR0_RPT_ENABLE */ 758 - /* ========================================================================= */ 759 - #define UVH_LB_MCAST_AOERR0_RPT_ENABLE 0x50b20UL 760 - 761 - #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_MCAST_OBESE_MSG_SHFT 0 762 - #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_MCAST_OBESE_MSG_MASK 0x0000000000000001UL 763 - #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_MCAST_DATA_SB_ERR_SHFT 1 764 - #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_MCAST_DATA_SB_ERR_MASK 0x0000000000000002UL 765 - #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_MCAST_NACK_BUFF_PARITY_SHFT 2 766 - #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_MCAST_NACK_BUFF_PARITY_MASK 0x0000000000000004UL 767 - #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_MCAST_TIMEOUT_SHFT 3 768 - #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_MCAST_TIMEOUT_MASK 0x0000000000000008UL 769 - #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_MCAST_INACTIVE_REPLY_SHFT 4 770 - #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_MCAST_INACTIVE_REPLY_MASK 0x0000000000000010UL 771 - #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_MCAST_UPGRADE_ERROR_SHFT 5 772 - #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_MCAST_UPGRADE_ERROR_MASK 0x0000000000000020UL 773 - #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_MCAST_REG_COUNT_UNDERFLOW_SHFT 6 774 - #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_MCAST_REG_COUNT_UNDERFLOW_MASK 0x0000000000000040UL 775 - #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_MCAST_REP_OBESE_MSG_SHFT 7 776 - #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_MCAST_REP_OBESE_MSG_MASK 0x0000000000000080UL 777 - #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_UCACHE_REQ_RUNT_MSG_SHFT 8 778 - #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_UCACHE_REQ_RUNT_MSG_MASK 0x0000000000000100UL 779 - #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_UCACHE_REQ_OBESE_MSG_SHFT 9 780 - #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_UCACHE_REQ_OBESE_MSG_MASK 0x0000000000000200UL 781 - #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_UCACHE_REQ_DATA_SB_ERR_SHFT 10 782 - #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_UCACHE_REQ_DATA_SB_ERR_MASK 0x0000000000000400UL 783 - #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_UCACHE_REP_RUNT_MSG_SHFT 11 784 - #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_UCACHE_REP_RUNT_MSG_MASK 0x0000000000000800UL 785 - #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_UCACHE_REP_OBESE_MSG_SHFT 12 786 - #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_UCACHE_REP_OBESE_MSG_MASK 0x0000000000001000UL 787 - #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_UCACHE_REP_DATA_SB_ERR_SHFT 13 788 - #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_UCACHE_REP_DATA_SB_ERR_MASK 0x0000000000002000UL 789 - #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_UCACHE_REP_COMMAND_ERR_SHFT 14 790 - #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_UCACHE_REP_COMMAND_ERR_MASK 0x0000000000004000UL 791 - #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_UCACHE_PEND_TIMEOUT_SHFT 15 792 - #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_UCACHE_PEND_TIMEOUT_MASK 0x0000000000008000UL 793 - #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_MACC_REQ_RUNT_MSG_SHFT 16 794 - #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_MACC_REQ_RUNT_MSG_MASK 0x0000000000010000UL 795 - #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_MACC_REQ_OBESE_MSG_SHFT 17 796 - #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_MACC_REQ_OBESE_MSG_MASK 0x0000000000020000UL 797 - #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_MACC_REQ_DATA_SB_ERR_SHFT 18 798 - #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_MACC_REQ_DATA_SB_ERR_MASK 0x0000000000040000UL 799 - #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_MACC_REP_RUNT_MSG_SHFT 19 800 - #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_MACC_REP_RUNT_MSG_MASK 0x0000000000080000UL 801 - #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_MACC_REP_OBESE_MSG_SHFT 20 802 - #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_MACC_REP_OBESE_MSG_MASK 0x0000000000100000UL 803 - #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_MACC_REP_DATA_SB_ERR_SHFT 21 804 - #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_MACC_REP_DATA_SB_ERR_MASK 0x0000000000200000UL 805 - #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_MACC_AMO_TIMEOUT_SHFT 22 806 - #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_MACC_AMO_TIMEOUT_MASK 0x0000000000400000UL 807 - #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_MACC_PUT_TIMEOUT_SHFT 23 808 - #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_MACC_PUT_TIMEOUT_MASK 0x0000000000800000UL 809 - #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_MACC_SPURIOUS_EVENT_SHFT 24 810 - #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_MACC_SPURIOUS_EVENT_MASK 0x0000000001000000UL 811 - #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_IOH_DESTINATION_TABLE_PARITY_SHFT 25 812 - #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_IOH_DESTINATION_TABLE_PARITY_MASK 0x0000000002000000UL 813 - #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_GET_HAD_ERROR_REPLY_SHFT 26 814 - #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_GET_HAD_ERROR_REPLY_MASK 0x0000000004000000UL 815 - #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_GET_TIMEOUT_SHFT 27 816 - #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_GET_TIMEOUT_MASK 0x0000000008000000UL 817 - #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_LOCK_MANAGER_HAD_ERROR_REPLY_SHFT 28 818 - #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_LOCK_MANAGER_HAD_ERROR_REPLY_MASK 0x0000000010000000UL 819 - #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_PUT_HAD_ERROR_REPLY_SHFT 29 820 - #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_PUT_HAD_ERROR_REPLY_MASK 0x0000000020000000UL 821 - #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_PUT_TIMEOUT_SHFT 30 822 - #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_PUT_TIMEOUT_MASK 0x0000000040000000UL 823 - #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_SB_ACTIVATION_OVERRUN_SHFT 31 824 - #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_SB_ACTIVATION_OVERRUN_MASK 0x0000000080000000UL 825 - #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_COMPLETED_GB_ACTIVATION_HAD_ERROR_REPLY_SHFT 32 826 - #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_COMPLETED_GB_ACTIVATION_HAD_ERROR_REPLY_MASK 0x0000000100000000UL 827 - #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_COMPLETED_GB_ACTIVATION_TIMEOUT_SHFT 33 828 - #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_COMPLETED_GB_ACTIVATION_TIMEOUT_MASK 0x0000000200000000UL 829 - #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_DESCRIPTOR_BUFFER_0_PARITY_SHFT 34 830 - #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_DESCRIPTOR_BUFFER_0_PARITY_MASK 0x0000000400000000UL 831 - #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_DESCRIPTOR_BUFFER_1_PARITY_SHFT 35 832 - #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_DESCRIPTOR_BUFFER_1_PARITY_MASK 0x0000000800000000UL 833 - #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_SOCKET_DESTINATION_TABLE_PARITY_SHFT 36 834 - #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_SOCKET_DESTINATION_TABLE_PARITY_MASK 0x0000001000000000UL 835 - #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_BAU_REPLY_PAYLOAD_CORRUPTION_SHFT 37 836 - #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_BAU_REPLY_PAYLOAD_CORRUPTION_MASK 0x0000002000000000UL 837 - #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_IO_PORT_DESTINATION_TABLE_PARITY_SHFT 38 838 - #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_IO_PORT_DESTINATION_TABLE_PARITY_MASK 0x0000004000000000UL 839 - #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_INTD_SOFT_ACK_TIMEOUT_SHFT 39 840 - #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_INTD_SOFT_ACK_TIMEOUT_MASK 0x0000008000000000UL 841 - #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_INT_REP_OBESE_MSG_SHFT 40 842 - #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_INT_REP_OBESE_MSG_MASK 0x0000010000000000UL 843 - #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_INT_REP_COMMAND_ERR_SHFT 41 844 - #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_INT_REP_COMMAND_ERR_MASK 0x0000020000000000UL 845 - #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_INT_TIMEOUT_SHFT 42 846 - #define UVH_LB_MCAST_AOERR0_RPT_ENABLE_INT_TIMEOUT_MASK 0x0000040000000000UL 847 - 848 - union uvh_lb_mcast_aoerr0_rpt_enable_u { 849 - unsigned long v; 850 - struct uvh_lb_mcast_aoerr0_rpt_enable_s { 851 - unsigned long mcast_obese_msg : 1; /* RW */ 852 - unsigned long mcast_data_sb_err : 1; /* RW */ 853 - unsigned long mcast_nack_buff_parity : 1; /* RW */ 854 - unsigned long mcast_timeout : 1; /* RW */ 855 - unsigned long mcast_inactive_reply : 1; /* RW */ 856 - unsigned long mcast_upgrade_error : 1; /* RW */ 857 - unsigned long mcast_reg_count_underflow : 1; /* RW */ 858 - unsigned long mcast_rep_obese_msg : 1; /* RW */ 859 - unsigned long ucache_req_runt_msg : 1; /* RW */ 860 - unsigned long ucache_req_obese_msg : 1; /* RW */ 861 - unsigned long ucache_req_data_sb_err : 1; /* RW */ 862 - unsigned long ucache_rep_runt_msg : 1; /* RW */ 863 - unsigned long ucache_rep_obese_msg : 1; /* RW */ 864 - unsigned long ucache_rep_data_sb_err : 1; /* RW */ 865 - unsigned long ucache_rep_command_err : 1; /* RW */ 866 - unsigned long ucache_pend_timeout : 1; /* RW */ 867 - unsigned long macc_req_runt_msg : 1; /* RW */ 868 - unsigned long macc_req_obese_msg : 1; /* RW */ 869 - unsigned long macc_req_data_sb_err : 1; /* RW */ 870 - unsigned long macc_rep_runt_msg : 1; /* RW */ 871 - unsigned long macc_rep_obese_msg : 1; /* RW */ 872 - unsigned long macc_rep_data_sb_err : 1; /* RW */ 873 - unsigned long macc_amo_timeout : 1; /* RW */ 874 - unsigned long macc_put_timeout : 1; /* RW */ 875 - unsigned long macc_spurious_event : 1; /* RW */ 876 - unsigned long ioh_destination_table_parity : 1; /* RW */ 877 - unsigned long get_had_error_reply : 1; /* RW */ 878 - unsigned long get_timeout : 1; /* RW */ 879 - unsigned long lock_manager_had_error_reply : 1; /* RW */ 880 - unsigned long put_had_error_reply : 1; /* RW */ 881 - unsigned long put_timeout : 1; /* RW */ 882 - unsigned long sb_activation_overrun : 1; /* RW */ 883 - unsigned long completed_gb_activation_had_error_reply : 1; /* RW */ 884 - unsigned long completed_gb_activation_timeout : 1; /* RW */ 885 - unsigned long descriptor_buffer_0_parity : 1; /* RW */ 886 - unsigned long descriptor_buffer_1_parity : 1; /* RW */ 887 - unsigned long socket_destination_table_parity : 1; /* RW */ 888 - unsigned long bau_reply_payload_corruption : 1; /* RW */ 889 - unsigned long io_port_destination_table_parity : 1; /* RW */ 890 - unsigned long intd_soft_ack_timeout : 1; /* RW */ 891 - unsigned long int_rep_obese_msg : 1; /* RW */ 892 - unsigned long int_rep_command_err : 1; /* RW */ 893 - unsigned long int_timeout : 1; /* RW */ 894 - unsigned long rsvd_43_63 : 21; /* */ 895 - } s; 896 - }; 897 - 898 - /* ========================================================================= */ 899 - /* UVH_LOCAL_INT0_CONFIG */ 900 - /* ========================================================================= */ 901 - #define UVH_LOCAL_INT0_CONFIG 0x61000UL 902 - 903 - #define UVH_LOCAL_INT0_CONFIG_VECTOR_SHFT 0 904 - #define UVH_LOCAL_INT0_CONFIG_VECTOR_MASK 0x00000000000000ffUL 905 - #define UVH_LOCAL_INT0_CONFIG_DM_SHFT 8 906 - #define UVH_LOCAL_INT0_CONFIG_DM_MASK 0x0000000000000700UL 907 - #define UVH_LOCAL_INT0_CONFIG_DESTMODE_SHFT 11 908 - #define UVH_LOCAL_INT0_CONFIG_DESTMODE_MASK 0x0000000000000800UL 909 - #define UVH_LOCAL_INT0_CONFIG_STATUS_SHFT 12 910 - #define UVH_LOCAL_INT0_CONFIG_STATUS_MASK 0x0000000000001000UL 911 - #define UVH_LOCAL_INT0_CONFIG_P_SHFT 13 912 - #define UVH_LOCAL_INT0_CONFIG_P_MASK 0x0000000000002000UL 913 - #define UVH_LOCAL_INT0_CONFIG_T_SHFT 15 914 - #define UVH_LOCAL_INT0_CONFIG_T_MASK 0x0000000000008000UL 915 - #define UVH_LOCAL_INT0_CONFIG_M_SHFT 16 916 - #define UVH_LOCAL_INT0_CONFIG_M_MASK 0x0000000000010000UL 917 - #define UVH_LOCAL_INT0_CONFIG_APIC_ID_SHFT 32 918 - #define UVH_LOCAL_INT0_CONFIG_APIC_ID_MASK 0xffffffff00000000UL 919 - 920 - union uvh_local_int0_config_u { 921 - unsigned long v; 922 - struct uvh_local_int0_config_s { 923 - unsigned long vector_ : 8; /* RW */ 924 - unsigned long dm : 3; /* RW */ 925 - unsigned long destmode : 1; /* RW */ 926 - unsigned long status : 1; /* RO */ 927 - unsigned long p : 1; /* RO */ 928 - unsigned long rsvd_14 : 1; /* */ 929 - unsigned long t : 1; /* RO */ 930 - unsigned long m : 1; /* RW */ 931 - unsigned long rsvd_17_31: 15; /* */ 932 - unsigned long apic_id : 32; /* RW */ 933 - } s; 934 - }; 935 - 936 - /* ========================================================================= */ 937 - /* UVH_LOCAL_INT0_ENABLE */ 938 - /* ========================================================================= */ 939 - #define UVH_LOCAL_INT0_ENABLE 0x65000UL 940 - 941 - #define UVH_LOCAL_INT0_ENABLE_LB_HCERR_SHFT 0 942 - #define UVH_LOCAL_INT0_ENABLE_LB_HCERR_MASK 0x0000000000000001UL 943 - #define UVH_LOCAL_INT0_ENABLE_GR0_HCERR_SHFT 1 944 - #define UVH_LOCAL_INT0_ENABLE_GR0_HCERR_MASK 0x0000000000000002UL 945 - #define UVH_LOCAL_INT0_ENABLE_GR1_HCERR_SHFT 2 946 - #define UVH_LOCAL_INT0_ENABLE_GR1_HCERR_MASK 0x0000000000000004UL 947 - #define UVH_LOCAL_INT0_ENABLE_LH_HCERR_SHFT 3 948 - #define UVH_LOCAL_INT0_ENABLE_LH_HCERR_MASK 0x0000000000000008UL 949 - #define UVH_LOCAL_INT0_ENABLE_RH_HCERR_SHFT 4 950 - #define UVH_LOCAL_INT0_ENABLE_RH_HCERR_MASK 0x0000000000000010UL 951 - #define UVH_LOCAL_INT0_ENABLE_XN_HCERR_SHFT 5 952 - #define UVH_LOCAL_INT0_ENABLE_XN_HCERR_MASK 0x0000000000000020UL 953 - #define UVH_LOCAL_INT0_ENABLE_SI_HCERR_SHFT 6 954 - #define UVH_LOCAL_INT0_ENABLE_SI_HCERR_MASK 0x0000000000000040UL 955 - #define UVH_LOCAL_INT0_ENABLE_LB_AOERR0_SHFT 7 956 - #define UVH_LOCAL_INT0_ENABLE_LB_AOERR0_MASK 0x0000000000000080UL 957 - #define UVH_LOCAL_INT0_ENABLE_GR0_AOERR0_SHFT 8 958 - #define UVH_LOCAL_INT0_ENABLE_GR0_AOERR0_MASK 0x0000000000000100UL 959 - #define UVH_LOCAL_INT0_ENABLE_GR1_AOERR0_SHFT 9 960 - #define UVH_LOCAL_INT0_ENABLE_GR1_AOERR0_MASK 0x0000000000000200UL 961 - #define UVH_LOCAL_INT0_ENABLE_LH_AOERR0_SHFT 10 962 - #define UVH_LOCAL_INT0_ENABLE_LH_AOERR0_MASK 0x0000000000000400UL 963 - #define UVH_LOCAL_INT0_ENABLE_RH_AOERR0_SHFT 11 964 - #define UVH_LOCAL_INT0_ENABLE_RH_AOERR0_MASK 0x0000000000000800UL 965 - #define UVH_LOCAL_INT0_ENABLE_XN_AOERR0_SHFT 12 966 - #define UVH_LOCAL_INT0_ENABLE_XN_AOERR0_MASK 0x0000000000001000UL 967 - #define UVH_LOCAL_INT0_ENABLE_SI_AOERR0_SHFT 13 968 - #define UVH_LOCAL_INT0_ENABLE_SI_AOERR0_MASK 0x0000000000002000UL 969 - #define UVH_LOCAL_INT0_ENABLE_LB_AOERR1_SHFT 14 970 - #define UVH_LOCAL_INT0_ENABLE_LB_AOERR1_MASK 0x0000000000004000UL 971 - #define UVH_LOCAL_INT0_ENABLE_GR0_AOERR1_SHFT 15 972 - #define UVH_LOCAL_INT0_ENABLE_GR0_AOERR1_MASK 0x0000000000008000UL 973 - #define UVH_LOCAL_INT0_ENABLE_GR1_AOERR1_SHFT 16 974 - #define UVH_LOCAL_INT0_ENABLE_GR1_AOERR1_MASK 0x0000000000010000UL 975 - #define UVH_LOCAL_INT0_ENABLE_LH_AOERR1_SHFT 17 976 - #define UVH_LOCAL_INT0_ENABLE_LH_AOERR1_MASK 0x0000000000020000UL 977 - #define UVH_LOCAL_INT0_ENABLE_RH_AOERR1_SHFT 18 978 - #define UVH_LOCAL_INT0_ENABLE_RH_AOERR1_MASK 0x0000000000040000UL 979 - #define UVH_LOCAL_INT0_ENABLE_XN_AOERR1_SHFT 19 980 - #define UVH_LOCAL_INT0_ENABLE_XN_AOERR1_MASK 0x0000000000080000UL 981 - #define UVH_LOCAL_INT0_ENABLE_SI_AOERR1_SHFT 20 982 - #define UVH_LOCAL_INT0_ENABLE_SI_AOERR1_MASK 0x0000000000100000UL 983 - #define UVH_LOCAL_INT0_ENABLE_RH_VPI_INT_SHFT 21 984 - #define UVH_LOCAL_INT0_ENABLE_RH_VPI_INT_MASK 0x0000000000200000UL 985 - #define UVH_LOCAL_INT0_ENABLE_SYSTEM_SHUTDOWN_INT_SHFT 22 986 - #define UVH_LOCAL_INT0_ENABLE_SYSTEM_SHUTDOWN_INT_MASK 0x0000000000400000UL 987 - #define UVH_LOCAL_INT0_ENABLE_LB_IRQ_INT_0_SHFT 23 988 - #define UVH_LOCAL_INT0_ENABLE_LB_IRQ_INT_0_MASK 0x0000000000800000UL 989 - #define UVH_LOCAL_INT0_ENABLE_LB_IRQ_INT_1_SHFT 24 990 - #define UVH_LOCAL_INT0_ENABLE_LB_IRQ_INT_1_MASK 0x0000000001000000UL 991 - #define UVH_LOCAL_INT0_ENABLE_LB_IRQ_INT_2_SHFT 25 992 - #define UVH_LOCAL_INT0_ENABLE_LB_IRQ_INT_2_MASK 0x0000000002000000UL 993 - #define UVH_LOCAL_INT0_ENABLE_LB_IRQ_INT_3_SHFT 26 994 - #define UVH_LOCAL_INT0_ENABLE_LB_IRQ_INT_3_MASK 0x0000000004000000UL 995 - #define UVH_LOCAL_INT0_ENABLE_LB_IRQ_INT_4_SHFT 27 996 - #define UVH_LOCAL_INT0_ENABLE_LB_IRQ_INT_4_MASK 0x0000000008000000UL 997 - #define UVH_LOCAL_INT0_ENABLE_LB_IRQ_INT_5_SHFT 28 998 - #define UVH_LOCAL_INT0_ENABLE_LB_IRQ_INT_5_MASK 0x0000000010000000UL 999 - #define UVH_LOCAL_INT0_ENABLE_LB_IRQ_INT_6_SHFT 29 1000 - #define UVH_LOCAL_INT0_ENABLE_LB_IRQ_INT_6_MASK 0x0000000020000000UL 1001 - #define UVH_LOCAL_INT0_ENABLE_LB_IRQ_INT_7_SHFT 30 1002 - #define UVH_LOCAL_INT0_ENABLE_LB_IRQ_INT_7_MASK 0x0000000040000000UL 1003 - #define UVH_LOCAL_INT0_ENABLE_LB_IRQ_INT_8_SHFT 31 1004 - #define UVH_LOCAL_INT0_ENABLE_LB_IRQ_INT_8_MASK 0x0000000080000000UL 1005 - #define UVH_LOCAL_INT0_ENABLE_LB_IRQ_INT_9_SHFT 32 1006 - #define UVH_LOCAL_INT0_ENABLE_LB_IRQ_INT_9_MASK 0x0000000100000000UL 1007 - #define UVH_LOCAL_INT0_ENABLE_LB_IRQ_INT_10_SHFT 33 1008 - #define UVH_LOCAL_INT0_ENABLE_LB_IRQ_INT_10_MASK 0x0000000200000000UL 1009 - #define UVH_LOCAL_INT0_ENABLE_LB_IRQ_INT_11_SHFT 34 1010 - #define UVH_LOCAL_INT0_ENABLE_LB_IRQ_INT_11_MASK 0x0000000400000000UL 1011 - #define UVH_LOCAL_INT0_ENABLE_LB_IRQ_INT_12_SHFT 35 1012 - #define UVH_LOCAL_INT0_ENABLE_LB_IRQ_INT_12_MASK 0x0000000800000000UL 1013 - #define UVH_LOCAL_INT0_ENABLE_LB_IRQ_INT_13_SHFT 36 1014 - #define UVH_LOCAL_INT0_ENABLE_LB_IRQ_INT_13_MASK 0x0000001000000000UL 1015 - #define UVH_LOCAL_INT0_ENABLE_LB_IRQ_INT_14_SHFT 37 1016 - #define UVH_LOCAL_INT0_ENABLE_LB_IRQ_INT_14_MASK 0x0000002000000000UL 1017 - #define UVH_LOCAL_INT0_ENABLE_LB_IRQ_INT_15_SHFT 38 1018 - #define UVH_LOCAL_INT0_ENABLE_LB_IRQ_INT_15_MASK 0x0000004000000000UL 1019 - #define UVH_LOCAL_INT0_ENABLE_L1_NMI_INT_SHFT 39 1020 - #define UVH_LOCAL_INT0_ENABLE_L1_NMI_INT_MASK 0x0000008000000000UL 1021 - #define UVH_LOCAL_INT0_ENABLE_STOP_CLOCK_SHFT 40 1022 - #define UVH_LOCAL_INT0_ENABLE_STOP_CLOCK_MASK 0x0000010000000000UL 1023 - #define UVH_LOCAL_INT0_ENABLE_ASIC_TO_L1_SHFT 41 1024 - #define UVH_LOCAL_INT0_ENABLE_ASIC_TO_L1_MASK 0x0000020000000000UL 1025 - #define UVH_LOCAL_INT0_ENABLE_L1_TO_ASIC_SHFT 42 1026 - #define UVH_LOCAL_INT0_ENABLE_L1_TO_ASIC_MASK 0x0000040000000000UL 1027 - #define UVH_LOCAL_INT0_ENABLE_LTC_INT_SHFT 43 1028 - #define UVH_LOCAL_INT0_ENABLE_LTC_INT_MASK 0x0000080000000000UL 1029 - #define UVH_LOCAL_INT0_ENABLE_LA_SEQ_TRIGGER_SHFT 44 1030 - #define UVH_LOCAL_INT0_ENABLE_LA_SEQ_TRIGGER_MASK 0x0000100000000000UL 1031 - 1032 - union uvh_local_int0_enable_u { 1033 - unsigned long v; 1034 - struct uvh_local_int0_enable_s { 1035 - unsigned long lb_hcerr : 1; /* RW */ 1036 - unsigned long gr0_hcerr : 1; /* RW */ 1037 - unsigned long gr1_hcerr : 1; /* RW */ 1038 - unsigned long lh_hcerr : 1; /* RW */ 1039 - unsigned long rh_hcerr : 1; /* RW */ 1040 - unsigned long xn_hcerr : 1; /* RW */ 1041 - unsigned long si_hcerr : 1; /* RW */ 1042 - unsigned long lb_aoerr0 : 1; /* RW */ 1043 - unsigned long gr0_aoerr0 : 1; /* RW */ 1044 - unsigned long gr1_aoerr0 : 1; /* RW */ 1045 - unsigned long lh_aoerr0 : 1; /* RW */ 1046 - unsigned long rh_aoerr0 : 1; /* RW */ 1047 - unsigned long xn_aoerr0 : 1; /* RW */ 1048 - unsigned long si_aoerr0 : 1; /* RW */ 1049 - unsigned long lb_aoerr1 : 1; /* RW */ 1050 - unsigned long gr0_aoerr1 : 1; /* RW */ 1051 - unsigned long gr1_aoerr1 : 1; /* RW */ 1052 - unsigned long lh_aoerr1 : 1; /* RW */ 1053 - unsigned long rh_aoerr1 : 1; /* RW */ 1054 - unsigned long xn_aoerr1 : 1; /* RW */ 1055 - unsigned long si_aoerr1 : 1; /* RW */ 1056 - unsigned long rh_vpi_int : 1; /* RW */ 1057 - unsigned long system_shutdown_int : 1; /* RW */ 1058 - unsigned long lb_irq_int_0 : 1; /* RW */ 1059 - unsigned long lb_irq_int_1 : 1; /* RW */ 1060 - unsigned long lb_irq_int_2 : 1; /* RW */ 1061 - unsigned long lb_irq_int_3 : 1; /* RW */ 1062 - unsigned long lb_irq_int_4 : 1; /* RW */ 1063 - unsigned long lb_irq_int_5 : 1; /* RW */ 1064 - unsigned long lb_irq_int_6 : 1; /* RW */ 1065 - unsigned long lb_irq_int_7 : 1; /* RW */ 1066 - unsigned long lb_irq_int_8 : 1; /* RW */ 1067 - unsigned long lb_irq_int_9 : 1; /* RW */ 1068 - unsigned long lb_irq_int_10 : 1; /* RW */ 1069 - unsigned long lb_irq_int_11 : 1; /* RW */ 1070 - unsigned long lb_irq_int_12 : 1; /* RW */ 1071 - unsigned long lb_irq_int_13 : 1; /* RW */ 1072 - unsigned long lb_irq_int_14 : 1; /* RW */ 1073 - unsigned long lb_irq_int_15 : 1; /* RW */ 1074 - unsigned long l1_nmi_int : 1; /* RW */ 1075 - unsigned long stop_clock : 1; /* RW */ 1076 - unsigned long asic_to_l1 : 1; /* RW */ 1077 - unsigned long l1_to_asic : 1; /* RW */ 1078 - unsigned long ltc_int : 1; /* RW */ 1079 - unsigned long la_seq_trigger : 1; /* RW */ 1080 - unsigned long rsvd_45_63 : 19; /* */ 1081 680 } s; 1082 681 }; 1083 682 ··· 853 1108 unsigned long rsvd_0_23 : 24; /* */ 854 1109 unsigned long dest_base : 22; /* RW */ 855 1110 unsigned long rsvd_46_63: 18; /* */ 856 - } s; 857 - }; 858 - 859 - /* ========================================================================= */ 860 - /* UVH_RH_GAM_CFG_OVERLAY_CONFIG_MMR */ 861 - /* ========================================================================= */ 862 - #define UVH_RH_GAM_CFG_OVERLAY_CONFIG_MMR 0x1600020UL 863 - 864 - #define UVH_RH_GAM_CFG_OVERLAY_CONFIG_MMR_BASE_SHFT 26 865 - #define UVH_RH_GAM_CFG_OVERLAY_CONFIG_MMR_BASE_MASK 0x00003ffffc000000UL 866 - #define UVH_RH_GAM_CFG_OVERLAY_CONFIG_MMR_ENABLE_SHFT 63 867 - #define UVH_RH_GAM_CFG_OVERLAY_CONFIG_MMR_ENABLE_MASK 0x8000000000000000UL 868 - 869 - union uvh_rh_gam_cfg_overlay_config_mmr_u { 870 - unsigned long v; 871 - struct uvh_rh_gam_cfg_overlay_config_mmr_s { 872 - unsigned long rsvd_0_25: 26; /* */ 873 - unsigned long base : 20; /* RW */ 874 - unsigned long rsvd_46_62: 17; /* */ 875 - unsigned long enable : 1; /* RW */ 876 1111 } s; 877 1112 }; 878 1113 ··· 984 1259 unsigned long m : 1; /* RW */ 985 1260 unsigned long rsvd_17_31: 15; /* */ 986 1261 unsigned long apic_id : 32; /* RW */ 987 - } s; 988 - }; 989 - 990 - /* ========================================================================= */ 991 - /* UVH_RTC2_INT_CONFIG */ 992 - /* ========================================================================= */ 993 - #define UVH_RTC2_INT_CONFIG 0x61600UL 994 - 995 - #define UVH_RTC2_INT_CONFIG_VECTOR_SHFT 0 996 - #define UVH_RTC2_INT_CONFIG_VECTOR_MASK 0x00000000000000ffUL 997 - #define UVH_RTC2_INT_CONFIG_DM_SHFT 8 998 - #define UVH_RTC2_INT_CONFIG_DM_MASK 0x0000000000000700UL 999 - #define UVH_RTC2_INT_CONFIG_DESTMODE_SHFT 11 1000 - #define UVH_RTC2_INT_CONFIG_DESTMODE_MASK 0x0000000000000800UL 1001 - #define UVH_RTC2_INT_CONFIG_STATUS_SHFT 12 1002 - #define UVH_RTC2_INT_CONFIG_STATUS_MASK 0x0000000000001000UL 1003 - #define UVH_RTC2_INT_CONFIG_P_SHFT 13 1004 - #define UVH_RTC2_INT_CONFIG_P_MASK 0x0000000000002000UL 1005 - #define UVH_RTC2_INT_CONFIG_T_SHFT 15 1006 - #define UVH_RTC2_INT_CONFIG_T_MASK 0x0000000000008000UL 1007 - #define UVH_RTC2_INT_CONFIG_M_SHFT 16 1008 - #define UVH_RTC2_INT_CONFIG_M_MASK 0x0000000000010000UL 1009 - #define UVH_RTC2_INT_CONFIG_APIC_ID_SHFT 32 1010 - #define UVH_RTC2_INT_CONFIG_APIC_ID_MASK 0xffffffff00000000UL 1011 - 1012 - union uvh_rtc2_int_config_u { 1013 - unsigned long v; 1014 - struct uvh_rtc2_int_config_s { 1015 - unsigned long vector_ : 8; /* RW */ 1016 - unsigned long dm : 3; /* RW */ 1017 - unsigned long destmode : 1; /* RW */ 1018 - unsigned long status : 1; /* RO */ 1019 - unsigned long p : 1; /* RO */ 1020 - unsigned long rsvd_14 : 1; /* */ 1021 - unsigned long t : 1; /* RO */ 1022 - unsigned long m : 1; /* RW */ 1023 - unsigned long rsvd_17_31: 15; /* */ 1024 - unsigned long apic_id : 32; /* RW */ 1025 - } s; 1026 - }; 1027 - 1028 - /* ========================================================================= */ 1029 - /* UVH_RTC3_INT_CONFIG */ 1030 - /* ========================================================================= */ 1031 - #define UVH_RTC3_INT_CONFIG 0x61640UL 1032 - 1033 - #define UVH_RTC3_INT_CONFIG_VECTOR_SHFT 0 1034 - #define UVH_RTC3_INT_CONFIG_VECTOR_MASK 0x00000000000000ffUL 1035 - #define UVH_RTC3_INT_CONFIG_DM_SHFT 8 1036 - #define UVH_RTC3_INT_CONFIG_DM_MASK 0x0000000000000700UL 1037 - #define UVH_RTC3_INT_CONFIG_DESTMODE_SHFT 11 1038 - #define UVH_RTC3_INT_CONFIG_DESTMODE_MASK 0x0000000000000800UL 1039 - #define UVH_RTC3_INT_CONFIG_STATUS_SHFT 12 1040 - #define UVH_RTC3_INT_CONFIG_STATUS_MASK 0x0000000000001000UL 1041 - #define UVH_RTC3_INT_CONFIG_P_SHFT 13 1042 - #define UVH_RTC3_INT_CONFIG_P_MASK 0x0000000000002000UL 1043 - #define UVH_RTC3_INT_CONFIG_T_SHFT 15 1044 - #define UVH_RTC3_INT_CONFIG_T_MASK 0x0000000000008000UL 1045 - #define UVH_RTC3_INT_CONFIG_M_SHFT 16 1046 - #define UVH_RTC3_INT_CONFIG_M_MASK 0x0000000000010000UL 1047 - #define UVH_RTC3_INT_CONFIG_APIC_ID_SHFT 32 1048 - #define UVH_RTC3_INT_CONFIG_APIC_ID_MASK 0xffffffff00000000UL 1049 - 1050 - union uvh_rtc3_int_config_u { 1051 - unsigned long v; 1052 - struct uvh_rtc3_int_config_s { 1053 - unsigned long vector_ : 8; /* RW */ 1054 - unsigned long dm : 3; /* RW */ 1055 - unsigned long destmode : 1; /* RW */ 1056 - unsigned long status : 1; /* RO */ 1057 - unsigned long p : 1; /* RO */ 1058 - unsigned long rsvd_14 : 1; /* */ 1059 - unsigned long t : 1; /* RO */ 1060 - unsigned long m : 1; /* RW */ 1061 - unsigned long rsvd_17_31: 15; /* */ 1062 - unsigned long apic_id : 32; /* RW */ 1063 - } s; 1064 - }; 1065 - 1066 - /* ========================================================================= */ 1067 - /* UVH_RTC_INC_RATIO */ 1068 - /* ========================================================================= */ 1069 - #define UVH_RTC_INC_RATIO 0x350000UL 1070 - 1071 - #define UVH_RTC_INC_RATIO_FRACTION_SHFT 0 1072 - #define UVH_RTC_INC_RATIO_FRACTION_MASK 0x00000000000fffffUL 1073 - #define UVH_RTC_INC_RATIO_RATIO_SHFT 20 1074 - #define UVH_RTC_INC_RATIO_RATIO_MASK 0x0000000000700000UL 1075 - 1076 - union uvh_rtc_inc_ratio_u { 1077 - unsigned long v; 1078 - struct uvh_rtc_inc_ratio_s { 1079 - unsigned long fraction : 20; /* RW */ 1080 - unsigned long ratio : 3; /* RW */ 1081 - unsigned long rsvd_23_63: 41; /* */ 1082 1262 } s; 1083 1263 }; 1084 1264
-3
arch/x86/kernel/apic/x2apic_uv_x.c
··· 735 735 uv_node_to_blade[nid] = blade; 736 736 uv_cpu_to_blade[cpu] = blade; 737 737 max_pnode = max(pnode, max_pnode); 738 - 739 - printk(KERN_DEBUG "UV: cpu %d, apicid 0x%x, pnode %d, nid %d, lcpu %d, blade %d\n", 740 - cpu, apicid, pnode, nid, lcpu, blade); 741 738 } 742 739 743 740 /* Add blade/pnode info for nodes without cpus */
+916 -384
arch/x86/kernel/tlb_uv.c
··· 1 1 /* 2 2 * SGI UltraViolet TLB flush routines. 3 3 * 4 - * (c) 2008 Cliff Wickman <cpw@sgi.com>, SGI. 4 + * (c) 2008-2010 Cliff Wickman <cpw@sgi.com>, SGI. 5 5 * 6 6 * This code is released under the GNU General Public License version 2 or 7 7 * later. ··· 20 20 #include <asm/idle.h> 21 21 #include <asm/tsc.h> 22 22 #include <asm/irq_vectors.h> 23 + #include <asm/timer.h> 23 24 24 - static struct bau_control **uv_bau_table_bases __read_mostly; 25 - static int uv_bau_retry_limit __read_mostly; 25 + struct msg_desc { 26 + struct bau_payload_queue_entry *msg; 27 + int msg_slot; 28 + int sw_ack_slot; 29 + struct bau_payload_queue_entry *va_queue_first; 30 + struct bau_payload_queue_entry *va_queue_last; 31 + }; 32 + 33 + #define UV_INTD_SOFT_ACK_TIMEOUT_PERIOD 0x000000000bUL 34 + 35 + static int uv_bau_max_concurrent __read_mostly; 36 + 37 + static int nobau; 38 + static int __init setup_nobau(char *arg) 39 + { 40 + nobau = 1; 41 + return 0; 42 + } 43 + early_param("nobau", setup_nobau); 26 44 27 45 /* base pnode in this partition */ 28 - static int uv_partition_base_pnode __read_mostly; 29 - 30 - static unsigned long uv_mmask __read_mostly; 46 + static int uv_partition_base_pnode __read_mostly; 47 + /* position of pnode (which is nasid>>1): */ 48 + static int uv_nshift __read_mostly; 49 + static unsigned long uv_mmask __read_mostly; 31 50 32 51 static DEFINE_PER_CPU(struct ptc_stats, ptcstats); 33 52 static DEFINE_PER_CPU(struct bau_control, bau_control); 53 + static DEFINE_PER_CPU(cpumask_var_t, uv_flush_tlb_mask); 54 + 55 + struct reset_args { 56 + int sender; 57 + }; 34 58 35 59 /* 36 - * Determine the first node on a blade. 60 + * Determine the first node on a uvhub. 'Nodes' are used for kernel 61 + * memory allocation. 37 62 */ 38 - static int __init blade_to_first_node(int blade) 63 + static int __init uvhub_to_first_node(int uvhub) 39 64 { 40 65 int node, b; 41 66 42 67 for_each_online_node(node) { 43 68 b = uv_node_to_blade_id(node); 44 - if (blade == b) 69 + if (uvhub == b) 45 70 return node; 46 71 } 47 - return -1; /* shouldn't happen */ 72 + return -1; 48 73 } 49 74 50 75 /* 51 - * Determine the apicid of the first cpu on a blade. 76 + * Determine the apicid of the first cpu on a uvhub. 52 77 */ 53 - static int __init blade_to_first_apicid(int blade) 78 + static int __init uvhub_to_first_apicid(int uvhub) 54 79 { 55 80 int cpu; 56 81 57 82 for_each_present_cpu(cpu) 58 - if (blade == uv_cpu_to_blade_id(cpu)) 83 + if (uvhub == uv_cpu_to_blade_id(cpu)) 59 84 return per_cpu(x86_cpu_to_apicid, cpu); 60 85 return -1; 61 86 } ··· 93 68 * clear of the Timeout bit (as well) will free the resource. No reply will 94 69 * be sent (the hardware will only do one reply per message). 95 70 */ 96 - static void uv_reply_to_message(int resource, 97 - struct bau_payload_queue_entry *msg, 98 - struct bau_msg_status *msp) 71 + static inline void uv_reply_to_message(struct msg_desc *mdp, 72 + struct bau_control *bcp) 99 73 { 100 74 unsigned long dw; 75 + struct bau_payload_queue_entry *msg; 101 76 102 - dw = (1 << (resource + UV_SW_ACK_NPENDING)) | (1 << resource); 77 + msg = mdp->msg; 78 + if (!msg->canceled) { 79 + dw = (msg->sw_ack_vector << UV_SW_ACK_NPENDING) | 80 + msg->sw_ack_vector; 81 + uv_write_local_mmr( 82 + UVH_LB_BAU_INTD_SOFTWARE_ACKNOWLEDGE_ALIAS, dw); 83 + } 103 84 msg->replied_to = 1; 104 85 msg->sw_ack_vector = 0; 105 - if (msp) 106 - msp->seen_by.bits = 0; 107 - uv_write_local_mmr(UVH_LB_BAU_INTD_SOFTWARE_ACKNOWLEDGE_ALIAS, dw); 86 + } 87 + 88 + /* 89 + * Process the receipt of a RETRY message 90 + */ 91 + static inline void uv_bau_process_retry_msg(struct msg_desc *mdp, 92 + struct bau_control *bcp) 93 + { 94 + int i; 95 + int cancel_count = 0; 96 + int slot2; 97 + unsigned long msg_res; 98 + unsigned long mmr = 0; 99 + struct bau_payload_queue_entry *msg; 100 + struct bau_payload_queue_entry *msg2; 101 + struct ptc_stats *stat; 102 + 103 + msg = mdp->msg; 104 + stat = &per_cpu(ptcstats, bcp->cpu); 105 + stat->d_retries++; 106 + /* 107 + * cancel any message from msg+1 to the retry itself 108 + */ 109 + for (msg2 = msg+1, i = 0; i < DEST_Q_SIZE; msg2++, i++) { 110 + if (msg2 > mdp->va_queue_last) 111 + msg2 = mdp->va_queue_first; 112 + if (msg2 == msg) 113 + break; 114 + 115 + /* same conditions for cancellation as uv_do_reset */ 116 + if ((msg2->replied_to == 0) && (msg2->canceled == 0) && 117 + (msg2->sw_ack_vector) && ((msg2->sw_ack_vector & 118 + msg->sw_ack_vector) == 0) && 119 + (msg2->sending_cpu == msg->sending_cpu) && 120 + (msg2->msg_type != MSG_NOOP)) { 121 + slot2 = msg2 - mdp->va_queue_first; 122 + mmr = uv_read_local_mmr 123 + (UVH_LB_BAU_INTD_SOFTWARE_ACKNOWLEDGE); 124 + msg_res = ((msg2->sw_ack_vector << 8) | 125 + msg2->sw_ack_vector); 126 + /* 127 + * This is a message retry; clear the resources held 128 + * by the previous message only if they timed out. 129 + * If it has not timed out we have an unexpected 130 + * situation to report. 131 + */ 132 + if (mmr & (msg_res << 8)) { 133 + /* 134 + * is the resource timed out? 135 + * make everyone ignore the cancelled message. 136 + */ 137 + msg2->canceled = 1; 138 + stat->d_canceled++; 139 + cancel_count++; 140 + uv_write_local_mmr( 141 + UVH_LB_BAU_INTD_SOFTWARE_ACKNOWLEDGE_ALIAS, 142 + (msg_res << 8) | msg_res); 143 + } else 144 + printk(KERN_INFO "note bau retry: no effect\n"); 145 + } 146 + } 147 + if (!cancel_count) 148 + stat->d_nocanceled++; 108 149 } 109 150 110 151 /* 111 152 * Do all the things a cpu should do for a TLB shootdown message. 112 153 * Other cpu's may come here at the same time for this message. 113 154 */ 114 - static void uv_bau_process_message(struct bau_payload_queue_entry *msg, 115 - int msg_slot, int sw_ack_slot) 155 + static void uv_bau_process_message(struct msg_desc *mdp, 156 + struct bau_control *bcp) 116 157 { 117 - unsigned long this_cpu_mask; 118 - struct bau_msg_status *msp; 119 - int cpu; 158 + int msg_ack_count; 159 + short socket_ack_count = 0; 160 + struct ptc_stats *stat; 161 + struct bau_payload_queue_entry *msg; 162 + struct bau_control *smaster = bcp->socket_master; 120 163 121 - msp = __get_cpu_var(bau_control).msg_statuses + msg_slot; 122 - cpu = uv_blade_processor_id(); 123 - msg->number_of_cpus = 124 - uv_blade_nr_online_cpus(uv_node_to_blade_id(numa_node_id())); 125 - this_cpu_mask = 1UL << cpu; 126 - if (msp->seen_by.bits & this_cpu_mask) 127 - return; 128 - atomic_or_long(&msp->seen_by.bits, this_cpu_mask); 129 - 130 - if (msg->replied_to == 1) 131 - return; 132 - 164 + /* 165 + * This must be a normal message, or retry of a normal message 166 + */ 167 + msg = mdp->msg; 168 + stat = &per_cpu(ptcstats, bcp->cpu); 133 169 if (msg->address == TLB_FLUSH_ALL) { 134 170 local_flush_tlb(); 135 - __get_cpu_var(ptcstats).alltlb++; 171 + stat->d_alltlb++; 136 172 } else { 137 173 __flush_tlb_one(msg->address); 138 - __get_cpu_var(ptcstats).onetlb++; 174 + stat->d_onetlb++; 139 175 } 176 + stat->d_requestee++; 140 177 141 - __get_cpu_var(ptcstats).requestee++; 178 + /* 179 + * One cpu on each uvhub has the additional job on a RETRY 180 + * of releasing the resource held by the message that is 181 + * being retried. That message is identified by sending 182 + * cpu number. 183 + */ 184 + if (msg->msg_type == MSG_RETRY && bcp == bcp->uvhub_master) 185 + uv_bau_process_retry_msg(mdp, bcp); 142 186 143 - atomic_inc_short(&msg->acknowledge_count); 144 - if (msg->number_of_cpus == msg->acknowledge_count) 145 - uv_reply_to_message(sw_ack_slot, msg, msp); 146 - } 187 + /* 188 + * This is a sw_ack message, so we have to reply to it. 189 + * Count each responding cpu on the socket. This avoids 190 + * pinging the count's cache line back and forth between 191 + * the sockets. 192 + */ 193 + socket_ack_count = atomic_add_short_return(1, (struct atomic_short *) 194 + &smaster->socket_acknowledge_count[mdp->msg_slot]); 195 + if (socket_ack_count == bcp->cpus_in_socket) { 196 + /* 197 + * Both sockets dump their completed count total into 198 + * the message's count. 199 + */ 200 + smaster->socket_acknowledge_count[mdp->msg_slot] = 0; 201 + msg_ack_count = atomic_add_short_return(socket_ack_count, 202 + (struct atomic_short *)&msg->acknowledge_count); 147 203 148 - /* 149 - * Examine the payload queue on one distribution node to see 150 - * which messages have not been seen, and which cpu(s) have not seen them. 151 - * 152 - * Returns the number of cpu's that have not responded. 153 - */ 154 - static int uv_examine_destination(struct bau_control *bau_tablesp, int sender) 155 - { 156 - struct bau_payload_queue_entry *msg; 157 - struct bau_msg_status *msp; 158 - int count = 0; 159 - int i; 160 - int j; 161 - 162 - for (msg = bau_tablesp->va_queue_first, i = 0; i < DEST_Q_SIZE; 163 - msg++, i++) { 164 - if ((msg->sending_cpu == sender) && (!msg->replied_to)) { 165 - msp = bau_tablesp->msg_statuses + i; 166 - printk(KERN_DEBUG 167 - "blade %d: address:%#lx %d of %d, not cpu(s): ", 168 - i, msg->address, msg->acknowledge_count, 169 - msg->number_of_cpus); 170 - for (j = 0; j < msg->number_of_cpus; j++) { 171 - if (!((1L << j) & msp->seen_by.bits)) { 172 - count++; 173 - printk("%d ", j); 174 - } 175 - } 176 - printk("\n"); 204 + if (msg_ack_count == bcp->cpus_in_uvhub) { 205 + /* 206 + * All cpus in uvhub saw it; reply 207 + */ 208 + uv_reply_to_message(mdp, bcp); 177 209 } 178 210 } 179 - return count; 211 + 212 + return; 180 213 } 181 214 182 215 /* 183 - * Examine the payload queue on all the distribution nodes to see 184 - * which messages have not been seen, and which cpu(s) have not seen them. 185 - * 186 - * Returns the number of cpu's that have not responded. 216 + * Determine the first cpu on a uvhub. 187 217 */ 188 - static int uv_examine_destinations(struct bau_target_nodemask *distribution) 218 + static int uvhub_to_first_cpu(int uvhub) 189 219 { 190 - int sender; 191 - int i; 192 - int count = 0; 193 - 194 - sender = smp_processor_id(); 195 - for (i = 0; i < sizeof(struct bau_target_nodemask) * BITSPERBYTE; i++) { 196 - if (!bau_node_isset(i, distribution)) 197 - continue; 198 - count += uv_examine_destination(uv_bau_table_bases[i], sender); 199 - } 200 - return count; 220 + int cpu; 221 + for_each_present_cpu(cpu) 222 + if (uvhub == uv_cpu_to_blade_id(cpu)) 223 + return cpu; 224 + return -1; 201 225 } 202 226 203 227 /* 204 - * wait for completion of a broadcast message 228 + * Last resort when we get a large number of destination timeouts is 229 + * to clear resources held by a given cpu. 230 + * Do this with IPI so that all messages in the BAU message queue 231 + * can be identified by their nonzero sw_ack_vector field. 205 232 * 206 - * return COMPLETE, RETRY or GIVEUP 233 + * This is entered for a single cpu on the uvhub. 234 + * The sender want's this uvhub to free a specific message's 235 + * sw_ack resources. 236 + */ 237 + static void 238 + uv_do_reset(void *ptr) 239 + { 240 + int i; 241 + int slot; 242 + int count = 0; 243 + unsigned long mmr; 244 + unsigned long msg_res; 245 + struct bau_control *bcp; 246 + struct reset_args *rap; 247 + struct bau_payload_queue_entry *msg; 248 + struct ptc_stats *stat; 249 + 250 + bcp = &per_cpu(bau_control, smp_processor_id()); 251 + rap = (struct reset_args *)ptr; 252 + stat = &per_cpu(ptcstats, bcp->cpu); 253 + stat->d_resets++; 254 + 255 + /* 256 + * We're looking for the given sender, and 257 + * will free its sw_ack resource. 258 + * If all cpu's finally responded after the timeout, its 259 + * message 'replied_to' was set. 260 + */ 261 + for (msg = bcp->va_queue_first, i = 0; i < DEST_Q_SIZE; msg++, i++) { 262 + /* uv_do_reset: same conditions for cancellation as 263 + uv_bau_process_retry_msg() */ 264 + if ((msg->replied_to == 0) && 265 + (msg->canceled == 0) && 266 + (msg->sending_cpu == rap->sender) && 267 + (msg->sw_ack_vector) && 268 + (msg->msg_type != MSG_NOOP)) { 269 + /* 270 + * make everyone else ignore this message 271 + */ 272 + msg->canceled = 1; 273 + slot = msg - bcp->va_queue_first; 274 + count++; 275 + /* 276 + * only reset the resource if it is still pending 277 + */ 278 + mmr = uv_read_local_mmr 279 + (UVH_LB_BAU_INTD_SOFTWARE_ACKNOWLEDGE); 280 + msg_res = ((msg->sw_ack_vector << 8) | 281 + msg->sw_ack_vector); 282 + if (mmr & msg_res) { 283 + stat->d_rcanceled++; 284 + uv_write_local_mmr( 285 + UVH_LB_BAU_INTD_SOFTWARE_ACKNOWLEDGE_ALIAS, 286 + msg_res); 287 + } 288 + } 289 + } 290 + return; 291 + } 292 + 293 + /* 294 + * Use IPI to get all target uvhubs to release resources held by 295 + * a given sending cpu number. 296 + */ 297 + static void uv_reset_with_ipi(struct bau_target_uvhubmask *distribution, 298 + int sender) 299 + { 300 + int uvhub; 301 + int cpu; 302 + cpumask_t mask; 303 + struct reset_args reset_args; 304 + 305 + reset_args.sender = sender; 306 + 307 + cpus_clear(mask); 308 + /* find a single cpu for each uvhub in this distribution mask */ 309 + for (uvhub = 0; 310 + uvhub < sizeof(struct bau_target_uvhubmask) * BITSPERBYTE; 311 + uvhub++) { 312 + if (!bau_uvhub_isset(uvhub, distribution)) 313 + continue; 314 + /* find a cpu for this uvhub */ 315 + cpu = uvhub_to_first_cpu(uvhub); 316 + cpu_set(cpu, mask); 317 + } 318 + /* IPI all cpus; Preemption is already disabled */ 319 + smp_call_function_many(&mask, uv_do_reset, (void *)&reset_args, 1); 320 + return; 321 + } 322 + 323 + static inline unsigned long 324 + cycles_2_us(unsigned long long cyc) 325 + { 326 + unsigned long long ns; 327 + unsigned long us; 328 + ns = (cyc * per_cpu(cyc2ns, smp_processor_id())) 329 + >> CYC2NS_SCALE_FACTOR; 330 + us = ns / 1000; 331 + return us; 332 + } 333 + 334 + /* 335 + * wait for all cpus on this hub to finish their sends and go quiet 336 + * leaves uvhub_quiesce set so that no new broadcasts are started by 337 + * bau_flush_send_and_wait() 338 + */ 339 + static inline void 340 + quiesce_local_uvhub(struct bau_control *hmaster) 341 + { 342 + atomic_add_short_return(1, (struct atomic_short *) 343 + &hmaster->uvhub_quiesce); 344 + } 345 + 346 + /* 347 + * mark this quiet-requestor as done 348 + */ 349 + static inline void 350 + end_uvhub_quiesce(struct bau_control *hmaster) 351 + { 352 + atomic_add_short_return(-1, (struct atomic_short *) 353 + &hmaster->uvhub_quiesce); 354 + } 355 + 356 + /* 357 + * Wait for completion of a broadcast software ack message 358 + * return COMPLETE, RETRY(PLUGGED or TIMEOUT) or GIVEUP 207 359 */ 208 360 static int uv_wait_completion(struct bau_desc *bau_desc, 209 - unsigned long mmr_offset, int right_shift) 361 + unsigned long mmr_offset, int right_shift, int this_cpu, 362 + struct bau_control *bcp, struct bau_control *smaster, long try) 210 363 { 211 - int exams = 0; 212 - long destination_timeouts = 0; 213 - long source_timeouts = 0; 364 + int relaxes = 0; 214 365 unsigned long descriptor_status; 366 + unsigned long mmr; 367 + unsigned long mask; 368 + cycles_t ttime; 369 + cycles_t timeout_time; 370 + struct ptc_stats *stat = &per_cpu(ptcstats, this_cpu); 371 + struct bau_control *hmaster; 215 372 373 + hmaster = bcp->uvhub_master; 374 + timeout_time = get_cycles() + bcp->timeout_interval; 375 + 376 + /* spin on the status MMR, waiting for it to go idle */ 216 377 while ((descriptor_status = (((unsigned long) 217 378 uv_read_local_mmr(mmr_offset) >> 218 379 right_shift) & UV_ACT_STATUS_MASK)) != 219 380 DESC_STATUS_IDLE) { 220 - if (descriptor_status == DESC_STATUS_SOURCE_TIMEOUT) { 221 - source_timeouts++; 222 - if (source_timeouts > SOURCE_TIMEOUT_LIMIT) 223 - source_timeouts = 0; 224 - __get_cpu_var(ptcstats).s_retry++; 225 - return FLUSH_RETRY; 226 - } 227 381 /* 228 - * spin here looking for progress at the destinations 382 + * Our software ack messages may be blocked because there are 383 + * no swack resources available. As long as none of them 384 + * has timed out hardware will NACK our message and its 385 + * state will stay IDLE. 229 386 */ 230 - if (descriptor_status == DESC_STATUS_DESTINATION_TIMEOUT) { 231 - destination_timeouts++; 232 - if (destination_timeouts > DESTINATION_TIMEOUT_LIMIT) { 233 - /* 234 - * returns number of cpus not responding 235 - */ 236 - if (uv_examine_destinations 237 - (&bau_desc->distribution) == 0) { 238 - __get_cpu_var(ptcstats).d_retry++; 239 - return FLUSH_RETRY; 240 - } 241 - exams++; 242 - if (exams >= uv_bau_retry_limit) { 243 - printk(KERN_DEBUG 244 - "uv_flush_tlb_others"); 245 - printk("giving up on cpu %d\n", 246 - smp_processor_id()); 387 + if (descriptor_status == DESC_STATUS_SOURCE_TIMEOUT) { 388 + stat->s_stimeout++; 389 + return FLUSH_GIVEUP; 390 + } else if (descriptor_status == 391 + DESC_STATUS_DESTINATION_TIMEOUT) { 392 + stat->s_dtimeout++; 393 + ttime = get_cycles(); 394 + 395 + /* 396 + * Our retries may be blocked by all destination 397 + * swack resources being consumed, and a timeout 398 + * pending. In that case hardware returns the 399 + * ERROR that looks like a destination timeout. 400 + */ 401 + if (cycles_2_us(ttime - bcp->send_message) < BIOS_TO) { 402 + bcp->conseccompletes = 0; 403 + return FLUSH_RETRY_PLUGGED; 404 + } 405 + 406 + bcp->conseccompletes = 0; 407 + return FLUSH_RETRY_TIMEOUT; 408 + } else { 409 + /* 410 + * descriptor_status is still BUSY 411 + */ 412 + cpu_relax(); 413 + relaxes++; 414 + if (relaxes >= 10000) { 415 + relaxes = 0; 416 + if (get_cycles() > timeout_time) { 417 + quiesce_local_uvhub(hmaster); 418 + 419 + /* single-thread the register change */ 420 + spin_lock(&hmaster->masks_lock); 421 + mmr = uv_read_local_mmr(mmr_offset); 422 + mask = 0UL; 423 + mask |= (3UL < right_shift); 424 + mask = ~mask; 425 + mmr &= mask; 426 + uv_write_local_mmr(mmr_offset, mmr); 427 + spin_unlock(&hmaster->masks_lock); 428 + end_uvhub_quiesce(hmaster); 429 + stat->s_busy++; 247 430 return FLUSH_GIVEUP; 248 431 } 249 - /* 250 - * delays can hang the simulator 251 - udelay(1000); 252 - */ 253 - destination_timeouts = 0; 254 432 } 255 433 } 256 - cpu_relax(); 257 434 } 435 + bcp->conseccompletes++; 258 436 return FLUSH_COMPLETE; 437 + } 438 + 439 + static inline cycles_t 440 + sec_2_cycles(unsigned long sec) 441 + { 442 + unsigned long ns; 443 + cycles_t cyc; 444 + 445 + ns = sec * 1000000000; 446 + cyc = (ns << CYC2NS_SCALE_FACTOR)/(per_cpu(cyc2ns, smp_processor_id())); 447 + return cyc; 448 + } 449 + 450 + /* 451 + * conditionally add 1 to *v, unless *v is >= u 452 + * return 0 if we cannot add 1 to *v because it is >= u 453 + * return 1 if we can add 1 to *v because it is < u 454 + * the add is atomic 455 + * 456 + * This is close to atomic_add_unless(), but this allows the 'u' value 457 + * to be lowered below the current 'v'. atomic_add_unless can only stop 458 + * on equal. 459 + */ 460 + static inline int atomic_inc_unless_ge(spinlock_t *lock, atomic_t *v, int u) 461 + { 462 + spin_lock(lock); 463 + if (atomic_read(v) >= u) { 464 + spin_unlock(lock); 465 + return 0; 466 + } 467 + atomic_inc(v); 468 + spin_unlock(lock); 469 + return 1; 259 470 } 260 471 261 472 /** 262 473 * uv_flush_send_and_wait 263 474 * 264 - * Send a broadcast and wait for a broadcast message to complete. 475 + * Send a broadcast and wait for it to complete. 265 476 * 266 - * The flush_mask contains the cpus the broadcast was sent to. 477 + * The flush_mask contains the cpus the broadcast is to be sent to, plus 478 + * cpus that are on the local uvhub. 267 479 * 268 - * Returns NULL if all remote flushing was done. The mask is zeroed. 480 + * Returns NULL if all flushing represented in the mask was done. The mask 481 + * is zeroed. 269 482 * Returns @flush_mask if some remote flushing remains to be done. The 270 - * mask will have some bits still set. 483 + * mask will have some bits still set, representing any cpus on the local 484 + * uvhub (not current cpu) and any on remote uvhubs if the broadcast failed. 271 485 */ 272 - const struct cpumask *uv_flush_send_and_wait(int cpu, int this_pnode, 273 - struct bau_desc *bau_desc, 274 - struct cpumask *flush_mask) 486 + const struct cpumask *uv_flush_send_and_wait(struct bau_desc *bau_desc, 487 + struct cpumask *flush_mask, 488 + struct bau_control *bcp) 275 489 { 276 - int completion_status = 0; 277 490 int right_shift; 278 - int tries = 0; 279 - int pnode; 491 + int uvhub; 280 492 int bit; 493 + int completion_status = 0; 494 + int seq_number = 0; 495 + long try = 0; 496 + int cpu = bcp->uvhub_cpu; 497 + int this_cpu = bcp->cpu; 498 + int this_uvhub = bcp->uvhub; 281 499 unsigned long mmr_offset; 282 500 unsigned long index; 283 501 cycles_t time1; 284 502 cycles_t time2; 503 + struct ptc_stats *stat = &per_cpu(ptcstats, bcp->cpu); 504 + struct bau_control *smaster = bcp->socket_master; 505 + struct bau_control *hmaster = bcp->uvhub_master; 506 + 507 + /* 508 + * Spin here while there are hmaster->max_concurrent or more active 509 + * descriptors. This is the per-uvhub 'throttle'. 510 + */ 511 + if (!atomic_inc_unless_ge(&hmaster->uvhub_lock, 512 + &hmaster->active_descriptor_count, 513 + hmaster->max_concurrent)) { 514 + stat->s_throttles++; 515 + do { 516 + cpu_relax(); 517 + } while (!atomic_inc_unless_ge(&hmaster->uvhub_lock, 518 + &hmaster->active_descriptor_count, 519 + hmaster->max_concurrent)); 520 + } 521 + 522 + while (hmaster->uvhub_quiesce) 523 + cpu_relax(); 285 524 286 525 if (cpu < UV_CPUS_PER_ACT_STATUS) { 287 526 mmr_offset = UVH_LB_BAU_SB_ACTIVATION_STATUS_0; ··· 557 268 } 558 269 time1 = get_cycles(); 559 270 do { 560 - tries++; 271 + /* 272 + * Every message from any given cpu gets a unique message 273 + * sequence number. But retries use that same number. 274 + * Our message may have timed out at the destination because 275 + * all sw-ack resources are in use and there is a timeout 276 + * pending there. In that case, our last send never got 277 + * placed into the queue and we need to persist until it 278 + * does. 279 + * 280 + * Make any retry a type MSG_RETRY so that the destination will 281 + * free any resource held by a previous message from this cpu. 282 + */ 283 + if (try == 0) { 284 + /* use message type set by the caller the first time */ 285 + seq_number = bcp->message_number++; 286 + } else { 287 + /* use RETRY type on all the rest; same sequence */ 288 + bau_desc->header.msg_type = MSG_RETRY; 289 + stat->s_retry_messages++; 290 + } 291 + bau_desc->header.sequence = seq_number; 561 292 index = (1UL << UVH_LB_BAU_SB_ACTIVATION_CONTROL_PUSH_SHFT) | 562 - cpu; 563 - uv_write_local_mmr(UVH_LB_BAU_SB_ACTIVATION_CONTROL, index); 564 - completion_status = uv_wait_completion(bau_desc, mmr_offset, 565 - right_shift); 566 - } while (completion_status == FLUSH_RETRY); 567 - time2 = get_cycles(); 568 - __get_cpu_var(ptcstats).sflush += (time2 - time1); 569 - if (tries > 1) 570 - __get_cpu_var(ptcstats).retriesok++; 293 + bcp->uvhub_cpu; 294 + bcp->send_message = get_cycles(); 571 295 572 - if (completion_status == FLUSH_GIVEUP) { 296 + uv_write_local_mmr(UVH_LB_BAU_SB_ACTIVATION_CONTROL, index); 297 + 298 + try++; 299 + completion_status = uv_wait_completion(bau_desc, mmr_offset, 300 + right_shift, this_cpu, bcp, smaster, try); 301 + 302 + if (completion_status == FLUSH_RETRY_PLUGGED) { 303 + /* 304 + * Our retries may be blocked by all destination swack 305 + * resources being consumed, and a timeout pending. In 306 + * that case hardware immediately returns the ERROR 307 + * that looks like a destination timeout. 308 + */ 309 + udelay(TIMEOUT_DELAY); 310 + bcp->plugged_tries++; 311 + if (bcp->plugged_tries >= PLUGSB4RESET) { 312 + bcp->plugged_tries = 0; 313 + quiesce_local_uvhub(hmaster); 314 + spin_lock(&hmaster->queue_lock); 315 + uv_reset_with_ipi(&bau_desc->distribution, 316 + this_cpu); 317 + spin_unlock(&hmaster->queue_lock); 318 + end_uvhub_quiesce(hmaster); 319 + bcp->ipi_attempts++; 320 + stat->s_resets_plug++; 321 + } 322 + } else if (completion_status == FLUSH_RETRY_TIMEOUT) { 323 + hmaster->max_concurrent = 1; 324 + bcp->timeout_tries++; 325 + udelay(TIMEOUT_DELAY); 326 + if (bcp->timeout_tries >= TIMEOUTSB4RESET) { 327 + bcp->timeout_tries = 0; 328 + quiesce_local_uvhub(hmaster); 329 + spin_lock(&hmaster->queue_lock); 330 + uv_reset_with_ipi(&bau_desc->distribution, 331 + this_cpu); 332 + spin_unlock(&hmaster->queue_lock); 333 + end_uvhub_quiesce(hmaster); 334 + bcp->ipi_attempts++; 335 + stat->s_resets_timeout++; 336 + } 337 + } 338 + if (bcp->ipi_attempts >= 3) { 339 + bcp->ipi_attempts = 0; 340 + completion_status = FLUSH_GIVEUP; 341 + break; 342 + } 343 + cpu_relax(); 344 + } while ((completion_status == FLUSH_RETRY_PLUGGED) || 345 + (completion_status == FLUSH_RETRY_TIMEOUT)); 346 + time2 = get_cycles(); 347 + 348 + if ((completion_status == FLUSH_COMPLETE) && (bcp->conseccompletes > 5) 349 + && (hmaster->max_concurrent < hmaster->max_concurrent_constant)) 350 + hmaster->max_concurrent++; 351 + 352 + /* 353 + * hold any cpu not timing out here; no other cpu currently held by 354 + * the 'throttle' should enter the activation code 355 + */ 356 + while (hmaster->uvhub_quiesce) 357 + cpu_relax(); 358 + atomic_dec(&hmaster->active_descriptor_count); 359 + 360 + /* guard against cycles wrap */ 361 + if (time2 > time1) 362 + stat->s_time += (time2 - time1); 363 + else 364 + stat->s_requestor--; /* don't count this one */ 365 + if (completion_status == FLUSH_COMPLETE && try > 1) 366 + stat->s_retriesok++; 367 + else if (completion_status == FLUSH_GIVEUP) { 573 368 /* 574 369 * Cause the caller to do an IPI-style TLB shootdown on 575 - * the cpu's, all of which are still in the mask. 370 + * the target cpu's, all of which are still in the mask. 576 371 */ 577 - __get_cpu_var(ptcstats).ptc_i++; 372 + stat->s_giveup++; 578 373 return flush_mask; 579 374 } 580 375 ··· 667 294 * use the IPI method of shootdown on them. 668 295 */ 669 296 for_each_cpu(bit, flush_mask) { 670 - pnode = uv_cpu_to_pnode(bit); 671 - if (pnode == this_pnode) 297 + uvhub = uv_cpu_to_blade_id(bit); 298 + if (uvhub == this_uvhub) 672 299 continue; 673 300 cpumask_clear_cpu(bit, flush_mask); 674 301 } 675 302 if (!cpumask_empty(flush_mask)) 676 303 return flush_mask; 304 + 677 305 return NULL; 678 306 } 679 - 680 - static DEFINE_PER_CPU(cpumask_var_t, uv_flush_tlb_mask); 681 307 682 308 /** 683 309 * uv_flush_tlb_others - globally purge translation cache of a virtual ··· 694 322 * The caller has derived the cpumask from the mm_struct. This function 695 323 * is called only if there are bits set in the mask. (e.g. flush_tlb_page()) 696 324 * 697 - * The cpumask is converted into a nodemask of the nodes containing 698 - * the cpus. 325 + * The cpumask is converted into a uvhubmask of the uvhubs containing 326 + * those cpus. 699 327 * 700 328 * Note that this function should be called with preemption disabled. 701 329 * ··· 707 335 struct mm_struct *mm, 708 336 unsigned long va, unsigned int cpu) 709 337 { 710 - struct cpumask *flush_mask = __get_cpu_var(uv_flush_tlb_mask); 711 - int i; 712 - int bit; 713 - int pnode; 714 - int uv_cpu; 715 - int this_pnode; 338 + int remotes; 339 + int tcpu; 340 + int uvhub; 716 341 int locals = 0; 717 342 struct bau_desc *bau_desc; 343 + struct cpumask *flush_mask; 344 + struct ptc_stats *stat; 345 + struct bau_control *bcp; 718 346 347 + if (nobau) 348 + return cpumask; 349 + 350 + bcp = &per_cpu(bau_control, cpu); 351 + /* 352 + * Each sending cpu has a per-cpu mask which it fills from the caller's 353 + * cpu mask. Only remote cpus are converted to uvhubs and copied. 354 + */ 355 + flush_mask = (struct cpumask *)per_cpu(uv_flush_tlb_mask, cpu); 356 + /* 357 + * copy cpumask to flush_mask, removing current cpu 358 + * (current cpu should already have been flushed by the caller and 359 + * should never be returned if we return flush_mask) 360 + */ 719 361 cpumask_andnot(flush_mask, cpumask, cpumask_of(cpu)); 362 + if (cpu_isset(cpu, *cpumask)) 363 + locals++; /* current cpu was targeted */ 720 364 721 - uv_cpu = uv_blade_processor_id(); 722 - this_pnode = uv_hub_info->pnode; 723 - bau_desc = __get_cpu_var(bau_control).descriptor_base; 724 - bau_desc += UV_ITEMS_PER_DESCRIPTOR * uv_cpu; 365 + bau_desc = bcp->descriptor_base; 366 + bau_desc += UV_ITEMS_PER_DESCRIPTOR * bcp->uvhub_cpu; 725 367 726 - bau_nodes_clear(&bau_desc->distribution, UV_DISTRIBUTION_SIZE); 727 - 728 - i = 0; 729 - for_each_cpu(bit, flush_mask) { 730 - pnode = uv_cpu_to_pnode(bit); 731 - BUG_ON(pnode > (UV_DISTRIBUTION_SIZE - 1)); 732 - if (pnode == this_pnode) { 368 + bau_uvhubs_clear(&bau_desc->distribution, UV_DISTRIBUTION_SIZE); 369 + remotes = 0; 370 + for_each_cpu(tcpu, flush_mask) { 371 + uvhub = uv_cpu_to_blade_id(tcpu); 372 + if (uvhub == bcp->uvhub) { 733 373 locals++; 734 374 continue; 735 375 } 736 - bau_node_set(pnode - uv_partition_base_pnode, 737 - &bau_desc->distribution); 738 - i++; 376 + bau_uvhub_set(uvhub, &bau_desc->distribution); 377 + remotes++; 739 378 } 740 - if (i == 0) { 379 + if (remotes == 0) { 741 380 /* 742 - * no off_node flushing; return status for local node 381 + * No off_hub flushing; return status for local hub. 382 + * Return the caller's mask if all were local (the current 383 + * cpu may be in that mask). 743 384 */ 744 385 if (locals) 745 - return flush_mask; 386 + return cpumask; 746 387 else 747 388 return NULL; 748 389 } 749 - __get_cpu_var(ptcstats).requestor++; 750 - __get_cpu_var(ptcstats).ntargeted += i; 390 + stat = &per_cpu(ptcstats, cpu); 391 + stat->s_requestor++; 392 + stat->s_ntargcpu += remotes; 393 + remotes = bau_uvhub_weight(&bau_desc->distribution); 394 + stat->s_ntarguvhub += remotes; 395 + if (remotes >= 16) 396 + stat->s_ntarguvhub16++; 397 + else if (remotes >= 8) 398 + stat->s_ntarguvhub8++; 399 + else if (remotes >= 4) 400 + stat->s_ntarguvhub4++; 401 + else if (remotes >= 2) 402 + stat->s_ntarguvhub2++; 403 + else 404 + stat->s_ntarguvhub1++; 751 405 752 406 bau_desc->payload.address = va; 753 407 bau_desc->payload.sending_cpu = cpu; 754 408 755 - return uv_flush_send_and_wait(uv_cpu, this_pnode, bau_desc, flush_mask); 409 + /* 410 + * uv_flush_send_and_wait returns null if all cpu's were messaged, or 411 + * the adjusted flush_mask if any cpu's were not messaged. 412 + */ 413 + return uv_flush_send_and_wait(bau_desc, flush_mask, bcp); 756 414 } 757 415 758 416 /* ··· 791 389 * 792 390 * We received a broadcast assist message. 793 391 * 794 - * Interrupts may have been disabled; this interrupt could represent 392 + * Interrupts are disabled; this interrupt could represent 795 393 * the receipt of several messages. 796 394 * 797 - * All cores/threads on this node get this interrupt. 798 - * The last one to see it does the s/w ack. 395 + * All cores/threads on this hub get this interrupt. 396 + * The last one to see it does the software ack. 799 397 * (the resource will not be freed until noninterruptable cpus see this 800 - * interrupt; hardware will timeout the s/w ack and reply ERROR) 398 + * interrupt; hardware may timeout the s/w ack and reply ERROR) 801 399 */ 802 400 void uv_bau_message_interrupt(struct pt_regs *regs) 803 401 { 804 - struct bau_payload_queue_entry *va_queue_first; 805 - struct bau_payload_queue_entry *va_queue_last; 806 - struct bau_payload_queue_entry *msg; 807 - struct pt_regs *old_regs = set_irq_regs(regs); 808 - cycles_t time1; 809 - cycles_t time2; 810 - int msg_slot; 811 - int sw_ack_slot; 812 - int fw; 813 402 int count = 0; 814 - unsigned long local_pnode; 403 + cycles_t time_start; 404 + struct bau_payload_queue_entry *msg; 405 + struct bau_control *bcp; 406 + struct ptc_stats *stat; 407 + struct msg_desc msgdesc; 815 408 816 - ack_APIC_irq(); 817 - exit_idle(); 818 - irq_enter(); 819 - 820 - time1 = get_cycles(); 821 - 822 - local_pnode = uv_blade_to_pnode(uv_numa_blade_id()); 823 - 824 - va_queue_first = __get_cpu_var(bau_control).va_queue_first; 825 - va_queue_last = __get_cpu_var(bau_control).va_queue_last; 826 - 827 - msg = __get_cpu_var(bau_control).bau_msg_head; 409 + time_start = get_cycles(); 410 + bcp = &per_cpu(bau_control, smp_processor_id()); 411 + stat = &per_cpu(ptcstats, smp_processor_id()); 412 + msgdesc.va_queue_first = bcp->va_queue_first; 413 + msgdesc.va_queue_last = bcp->va_queue_last; 414 + msg = bcp->bau_msg_head; 828 415 while (msg->sw_ack_vector) { 829 416 count++; 830 - fw = msg->sw_ack_vector; 831 - msg_slot = msg - va_queue_first; 832 - sw_ack_slot = ffs(fw) - 1; 833 - 834 - uv_bau_process_message(msg, msg_slot, sw_ack_slot); 835 - 417 + msgdesc.msg_slot = msg - msgdesc.va_queue_first; 418 + msgdesc.sw_ack_slot = ffs(msg->sw_ack_vector) - 1; 419 + msgdesc.msg = msg; 420 + uv_bau_process_message(&msgdesc, bcp); 836 421 msg++; 837 - if (msg > va_queue_last) 838 - msg = va_queue_first; 839 - __get_cpu_var(bau_control).bau_msg_head = msg; 422 + if (msg > msgdesc.va_queue_last) 423 + msg = msgdesc.va_queue_first; 424 + bcp->bau_msg_head = msg; 840 425 } 426 + stat->d_time += (get_cycles() - time_start); 841 427 if (!count) 842 - __get_cpu_var(ptcstats).nomsg++; 428 + stat->d_nomsg++; 843 429 else if (count > 1) 844 - __get_cpu_var(ptcstats).multmsg++; 845 - 846 - time2 = get_cycles(); 847 - __get_cpu_var(ptcstats).dflush += (time2 - time1); 848 - 849 - irq_exit(); 850 - set_irq_regs(old_regs); 430 + stat->d_multmsg++; 431 + ack_APIC_irq(); 851 432 } 852 433 853 434 /* 854 435 * uv_enable_timeouts 855 436 * 856 - * Each target blade (i.e. blades that have cpu's) needs to have 437 + * Each target uvhub (i.e. a uvhub that has no cpu's) needs to have 857 438 * shootdown message timeouts enabled. The timeout does not cause 858 439 * an interrupt, but causes an error message to be returned to 859 440 * the sender. 860 441 */ 861 442 static void uv_enable_timeouts(void) 862 443 { 863 - int blade; 864 - int nblades; 444 + int uvhub; 445 + int nuvhubs; 865 446 int pnode; 866 447 unsigned long mmr_image; 867 448 868 - nblades = uv_num_possible_blades(); 449 + nuvhubs = uv_num_possible_blades(); 869 450 870 - for (blade = 0; blade < nblades; blade++) { 871 - if (!uv_blade_nr_possible_cpus(blade)) 451 + for (uvhub = 0; uvhub < nuvhubs; uvhub++) { 452 + if (!uv_blade_nr_possible_cpus(uvhub)) 872 453 continue; 873 454 874 - pnode = uv_blade_to_pnode(blade); 455 + pnode = uv_blade_to_pnode(uvhub); 875 456 mmr_image = 876 457 uv_read_global_mmr64(pnode, UVH_LB_BAU_MISC_CONTROL); 877 458 /* ··· 864 479 * To program the period, the SOFT_ACK_MODE must be off. 865 480 */ 866 481 mmr_image &= ~((unsigned long)1 << 867 - UV_ENABLE_INTD_SOFT_ACK_MODE_SHIFT); 482 + UVH_LB_BAU_MISC_CONTROL_ENABLE_INTD_SOFT_ACK_MODE_SHFT); 868 483 uv_write_global_mmr64 869 484 (pnode, UVH_LB_BAU_MISC_CONTROL, mmr_image); 870 485 /* 871 486 * Set the 4-bit period. 872 487 */ 873 488 mmr_image &= ~((unsigned long)0xf << 874 - UV_INTD_SOFT_ACK_TIMEOUT_PERIOD_SHIFT); 489 + UVH_LB_BAU_MISC_CONTROL_INTD_SOFT_ACK_TIMEOUT_PERIOD_SHFT); 875 490 mmr_image |= (UV_INTD_SOFT_ACK_TIMEOUT_PERIOD << 876 - UV_INTD_SOFT_ACK_TIMEOUT_PERIOD_SHIFT); 491 + UVH_LB_BAU_MISC_CONTROL_INTD_SOFT_ACK_TIMEOUT_PERIOD_SHFT); 877 492 uv_write_global_mmr64 878 493 (pnode, UVH_LB_BAU_MISC_CONTROL, mmr_image); 879 494 /* ··· 882 497 * indicated in bits 2:0 (7 causes all of them to timeout). 883 498 */ 884 499 mmr_image |= ((unsigned long)1 << 885 - UV_ENABLE_INTD_SOFT_ACK_MODE_SHIFT); 500 + UVH_LB_BAU_MISC_CONTROL_ENABLE_INTD_SOFT_ACK_MODE_SHFT); 886 501 uv_write_global_mmr64 887 502 (pnode, UVH_LB_BAU_MISC_CONTROL, mmr_image); 888 503 } ··· 907 522 { 908 523 } 909 524 525 + static inline unsigned long long 526 + millisec_2_cycles(unsigned long millisec) 527 + { 528 + unsigned long ns; 529 + unsigned long long cyc; 530 + 531 + ns = millisec * 1000; 532 + cyc = (ns << CYC2NS_SCALE_FACTOR)/(per_cpu(cyc2ns, smp_processor_id())); 533 + return cyc; 534 + } 535 + 910 536 /* 911 - * Display the statistics thru /proc 912 - * data points to the cpu number 537 + * Display the statistics thru /proc. 538 + * 'data' points to the cpu number 913 539 */ 914 540 static int uv_ptc_seq_show(struct seq_file *file, void *data) 915 541 { ··· 931 535 932 536 if (!cpu) { 933 537 seq_printf(file, 934 - "# cpu requestor requestee one all sretry dretry ptc_i "); 538 + "# cpu sent stime numuvhubs numuvhubs16 numuvhubs8 "); 935 539 seq_printf(file, 936 - "sw_ack sflush dflush sok dnomsg dmult starget\n"); 540 + "numuvhubs4 numuvhubs2 numuvhubs1 numcpus dto "); 541 + seq_printf(file, 542 + "retries rok resetp resett giveup sto bz throt "); 543 + seq_printf(file, 544 + "sw_ack recv rtime all "); 545 + seq_printf(file, 546 + "one mult none retry canc nocan reset rcan\n"); 937 547 } 938 548 if (cpu < num_possible_cpus() && cpu_online(cpu)) { 939 549 stat = &per_cpu(ptcstats, cpu); 940 - seq_printf(file, "cpu %d %ld %ld %ld %ld %ld %ld %ld ", 941 - cpu, stat->requestor, 942 - stat->requestee, stat->onetlb, stat->alltlb, 943 - stat->s_retry, stat->d_retry, stat->ptc_i); 944 - seq_printf(file, "%lx %ld %ld %ld %ld %ld %ld\n", 550 + /* source side statistics */ 551 + seq_printf(file, 552 + "cpu %d %ld %ld %ld %ld %ld %ld %ld %ld %ld %ld ", 553 + cpu, stat->s_requestor, cycles_2_us(stat->s_time), 554 + stat->s_ntarguvhub, stat->s_ntarguvhub16, 555 + stat->s_ntarguvhub8, stat->s_ntarguvhub4, 556 + stat->s_ntarguvhub2, stat->s_ntarguvhub1, 557 + stat->s_ntargcpu, stat->s_dtimeout); 558 + seq_printf(file, "%ld %ld %ld %ld %ld %ld %ld %ld ", 559 + stat->s_retry_messages, stat->s_retriesok, 560 + stat->s_resets_plug, stat->s_resets_timeout, 561 + stat->s_giveup, stat->s_stimeout, 562 + stat->s_busy, stat->s_throttles); 563 + /* destination side statistics */ 564 + seq_printf(file, 565 + "%lx %ld %ld %ld %ld %ld %ld %ld %ld %ld %ld %ld\n", 945 566 uv_read_global_mmr64(uv_cpu_to_pnode(cpu), 946 567 UVH_LB_BAU_INTD_SOFTWARE_ACKNOWLEDGE), 947 - stat->sflush, stat->dflush, 948 - stat->retriesok, stat->nomsg, 949 - stat->multmsg, stat->ntargeted); 568 + stat->d_requestee, cycles_2_us(stat->d_time), 569 + stat->d_alltlb, stat->d_onetlb, stat->d_multmsg, 570 + stat->d_nomsg, stat->d_retries, stat->d_canceled, 571 + stat->d_nocanceled, stat->d_resets, 572 + stat->d_rcanceled); 950 573 } 951 574 952 575 return 0; 953 576 } 954 577 955 578 /* 579 + * -1: resetf the statistics 956 580 * 0: display meaning of the statistics 957 - * >0: retry limit 581 + * >0: maximum concurrent active descriptors per uvhub (throttle) 958 582 */ 959 583 static ssize_t uv_ptc_proc_write(struct file *file, const char __user *user, 960 584 size_t count, loff_t *data) 961 585 { 962 - long newmode; 586 + int cpu; 587 + long input_arg; 963 588 char optstr[64]; 589 + struct ptc_stats *stat; 590 + struct bau_control *bcp; 964 591 965 592 if (count == 0 || count > sizeof(optstr)) 966 593 return -EINVAL; 967 594 if (copy_from_user(optstr, user, count)) 968 595 return -EFAULT; 969 596 optstr[count - 1] = '\0'; 970 - if (strict_strtoul(optstr, 10, &newmode) < 0) { 597 + if (strict_strtol(optstr, 10, &input_arg) < 0) { 971 598 printk(KERN_DEBUG "%s is invalid\n", optstr); 972 599 return -EINVAL; 973 600 } 974 601 975 - if (newmode == 0) { 602 + if (input_arg == 0) { 976 603 printk(KERN_DEBUG "# cpu: cpu number\n"); 604 + printk(KERN_DEBUG "Sender statistics:\n"); 977 605 printk(KERN_DEBUG 978 - "requestor: times this cpu was the flush requestor\n"); 606 + "sent: number of shootdown messages sent\n"); 979 607 printk(KERN_DEBUG 980 - "requestee: times this cpu was requested to flush its TLBs\n"); 608 + "stime: time spent sending messages\n"); 981 609 printk(KERN_DEBUG 982 - "one: times requested to flush a single address\n"); 610 + "numuvhubs: number of hubs targeted with shootdown\n"); 983 611 printk(KERN_DEBUG 984 - "all: times requested to flush all TLB's\n"); 612 + "numuvhubs16: number times 16 or more hubs targeted\n"); 985 613 printk(KERN_DEBUG 986 - "sretry: number of retries of source-side timeouts\n"); 614 + "numuvhubs8: number times 8 or more hubs targeted\n"); 987 615 printk(KERN_DEBUG 988 - "dretry: number of retries of destination-side timeouts\n"); 616 + "numuvhubs4: number times 4 or more hubs targeted\n"); 989 617 printk(KERN_DEBUG 990 - "ptc_i: times UV fell through to IPI-style flushes\n"); 618 + "numuvhubs2: number times 2 or more hubs targeted\n"); 991 619 printk(KERN_DEBUG 992 - "sw_ack: image of UVH_LB_BAU_INTD_SOFTWARE_ACKNOWLEDGE\n"); 620 + "numuvhubs1: number times 1 hub targeted\n"); 993 621 printk(KERN_DEBUG 994 - "sflush_us: cycles spent in uv_flush_tlb_others()\n"); 622 + "numcpus: number of cpus targeted with shootdown\n"); 995 623 printk(KERN_DEBUG 996 - "dflush_us: cycles spent in handling flush requests\n"); 997 - printk(KERN_DEBUG "sok: successes on retry\n"); 998 - printk(KERN_DEBUG "dnomsg: interrupts with no message\n"); 624 + "dto: number of destination timeouts\n"); 999 625 printk(KERN_DEBUG 1000 - "dmult: interrupts with multiple messages\n"); 1001 - printk(KERN_DEBUG "starget: nodes targeted\n"); 626 + "retries: destination timeout retries sent\n"); 627 + printk(KERN_DEBUG 628 + "rok: : destination timeouts successfully retried\n"); 629 + printk(KERN_DEBUG 630 + "resetp: ipi-style resource resets for plugs\n"); 631 + printk(KERN_DEBUG 632 + "resett: ipi-style resource resets for timeouts\n"); 633 + printk(KERN_DEBUG 634 + "giveup: fall-backs to ipi-style shootdowns\n"); 635 + printk(KERN_DEBUG 636 + "sto: number of source timeouts\n"); 637 + printk(KERN_DEBUG 638 + "bz: number of stay-busy's\n"); 639 + printk(KERN_DEBUG 640 + "throt: number times spun in throttle\n"); 641 + printk(KERN_DEBUG "Destination side statistics:\n"); 642 + printk(KERN_DEBUG 643 + "sw_ack: image of UVH_LB_BAU_INTD_SOFTWARE_ACKNOWLEDGE\n"); 644 + printk(KERN_DEBUG 645 + "recv: shootdown messages received\n"); 646 + printk(KERN_DEBUG 647 + "rtime: time spent processing messages\n"); 648 + printk(KERN_DEBUG 649 + "all: shootdown all-tlb messages\n"); 650 + printk(KERN_DEBUG 651 + "one: shootdown one-tlb messages\n"); 652 + printk(KERN_DEBUG 653 + "mult: interrupts that found multiple messages\n"); 654 + printk(KERN_DEBUG 655 + "none: interrupts that found no messages\n"); 656 + printk(KERN_DEBUG 657 + "retry: number of retry messages processed\n"); 658 + printk(KERN_DEBUG 659 + "canc: number messages canceled by retries\n"); 660 + printk(KERN_DEBUG 661 + "nocan: number retries that found nothing to cancel\n"); 662 + printk(KERN_DEBUG 663 + "reset: number of ipi-style reset requests processed\n"); 664 + printk(KERN_DEBUG 665 + "rcan: number messages canceled by reset requests\n"); 666 + } else if (input_arg == -1) { 667 + for_each_present_cpu(cpu) { 668 + stat = &per_cpu(ptcstats, cpu); 669 + memset(stat, 0, sizeof(struct ptc_stats)); 670 + } 1002 671 } else { 1003 - uv_bau_retry_limit = newmode; 1004 - printk(KERN_DEBUG "timeout retry limit:%d\n", 1005 - uv_bau_retry_limit); 672 + uv_bau_max_concurrent = input_arg; 673 + bcp = &per_cpu(bau_control, smp_processor_id()); 674 + if (uv_bau_max_concurrent < 1 || 675 + uv_bau_max_concurrent > bcp->cpus_in_uvhub) { 676 + printk(KERN_DEBUG 677 + "Error: BAU max concurrent %d; %d is invalid\n", 678 + bcp->max_concurrent, uv_bau_max_concurrent); 679 + return -EINVAL; 680 + } 681 + printk(KERN_DEBUG "Set BAU max concurrent:%d\n", 682 + uv_bau_max_concurrent); 683 + for_each_present_cpu(cpu) { 684 + bcp = &per_cpu(bau_control, cpu); 685 + bcp->max_concurrent = uv_bau_max_concurrent; 686 + } 1006 687 } 1007 688 1008 689 return count; ··· 1123 650 } 1124 651 1125 652 /* 1126 - * begin the initialization of the per-blade control structures 1127 - */ 1128 - static struct bau_control * __init uv_table_bases_init(int blade, int node) 1129 - { 1130 - int i; 1131 - struct bau_msg_status *msp; 1132 - struct bau_control *bau_tabp; 1133 - 1134 - bau_tabp = 1135 - kmalloc_node(sizeof(struct bau_control), GFP_KERNEL, node); 1136 - BUG_ON(!bau_tabp); 1137 - 1138 - bau_tabp->msg_statuses = 1139 - kmalloc_node(sizeof(struct bau_msg_status) * 1140 - DEST_Q_SIZE, GFP_KERNEL, node); 1141 - BUG_ON(!bau_tabp->msg_statuses); 1142 - 1143 - for (i = 0, msp = bau_tabp->msg_statuses; i < DEST_Q_SIZE; i++, msp++) 1144 - bau_cpubits_clear(&msp->seen_by, (int) 1145 - uv_blade_nr_possible_cpus(blade)); 1146 - 1147 - uv_bau_table_bases[blade] = bau_tabp; 1148 - 1149 - return bau_tabp; 1150 - } 1151 - 1152 - /* 1153 - * finish the initialization of the per-blade control structures 1154 - */ 1155 - static void __init 1156 - uv_table_bases_finish(int blade, 1157 - struct bau_control *bau_tablesp, 1158 - struct bau_desc *adp) 1159 - { 1160 - struct bau_control *bcp; 1161 - int cpu; 1162 - 1163 - for_each_present_cpu(cpu) { 1164 - if (blade != uv_cpu_to_blade_id(cpu)) 1165 - continue; 1166 - 1167 - bcp = (struct bau_control *)&per_cpu(bau_control, cpu); 1168 - bcp->bau_msg_head = bau_tablesp->va_queue_first; 1169 - bcp->va_queue_first = bau_tablesp->va_queue_first; 1170 - bcp->va_queue_last = bau_tablesp->va_queue_last; 1171 - bcp->msg_statuses = bau_tablesp->msg_statuses; 1172 - bcp->descriptor_base = adp; 1173 - } 1174 - } 1175 - 1176 - /* 1177 653 * initialize the sending side's sending buffers 1178 654 */ 1179 - static struct bau_desc * __init 655 + static void 1180 656 uv_activation_descriptor_init(int node, int pnode) 1181 657 { 1182 658 int i; 659 + int cpu; 1183 660 unsigned long pa; 1184 661 unsigned long m; 1185 662 unsigned long n; 1186 - struct bau_desc *adp; 1187 - struct bau_desc *ad2; 663 + struct bau_desc *bau_desc; 664 + struct bau_desc *bd2; 665 + struct bau_control *bcp; 1188 666 1189 667 /* 1190 668 * each bau_desc is 64 bytes; there are 8 (UV_ITEMS_PER_DESCRIPTOR) 1191 - * per cpu; and up to 32 (UV_ADP_SIZE) cpu's per blade 669 + * per cpu; and up to 32 (UV_ADP_SIZE) cpu's per uvhub 1192 670 */ 1193 - adp = (struct bau_desc *)kmalloc_node(sizeof(struct bau_desc)* 671 + bau_desc = (struct bau_desc *)kmalloc_node(sizeof(struct bau_desc)* 1194 672 UV_ADP_SIZE*UV_ITEMS_PER_DESCRIPTOR, GFP_KERNEL, node); 1195 - BUG_ON(!adp); 673 + BUG_ON(!bau_desc); 1196 674 1197 - pa = uv_gpa(adp); /* need the real nasid*/ 1198 - n = uv_gpa_to_pnode(pa); 675 + pa = uv_gpa(bau_desc); /* need the real nasid*/ 676 + n = pa >> uv_nshift; 1199 677 m = pa & uv_mmask; 1200 678 1201 679 uv_write_global_mmr64(pnode, UVH_LB_BAU_SB_DESCRIPTOR_BASE, ··· 1155 731 /* 1156 732 * initializing all 8 (UV_ITEMS_PER_DESCRIPTOR) descriptors for each 1157 733 * cpu even though we only use the first one; one descriptor can 1158 - * describe a broadcast to 256 nodes. 734 + * describe a broadcast to 256 uv hubs. 1159 735 */ 1160 - for (i = 0, ad2 = adp; i < (UV_ADP_SIZE*UV_ITEMS_PER_DESCRIPTOR); 1161 - i++, ad2++) { 1162 - memset(ad2, 0, sizeof(struct bau_desc)); 1163 - ad2->header.sw_ack_flag = 1; 736 + for (i = 0, bd2 = bau_desc; i < (UV_ADP_SIZE*UV_ITEMS_PER_DESCRIPTOR); 737 + i++, bd2++) { 738 + memset(bd2, 0, sizeof(struct bau_desc)); 739 + bd2->header.sw_ack_flag = 1; 1164 740 /* 1165 - * base_dest_nodeid is the first node in the partition, so 1166 - * the bit map will indicate partition-relative node numbers. 1167 - * note that base_dest_nodeid is actually a nasid. 741 + * base_dest_nodeid is the nasid (pnode<<1) of the first uvhub 742 + * in the partition. The bit map will indicate uvhub numbers, 743 + * which are 0-N in a partition. Pnodes are unique system-wide. 1168 744 */ 1169 - ad2->header.base_dest_nodeid = uv_partition_base_pnode << 1; 1170 - ad2->header.dest_subnodeid = 0x10; /* the LB */ 1171 - ad2->header.command = UV_NET_ENDPOINT_INTD; 1172 - ad2->header.int_both = 1; 745 + bd2->header.base_dest_nodeid = uv_partition_base_pnode << 1; 746 + bd2->header.dest_subnodeid = 0x10; /* the LB */ 747 + bd2->header.command = UV_NET_ENDPOINT_INTD; 748 + bd2->header.int_both = 1; 1173 749 /* 1174 750 * all others need to be set to zero: 1175 751 * fairness chaining multilevel count replied_to 1176 752 */ 1177 753 } 1178 - return adp; 754 + for_each_present_cpu(cpu) { 755 + if (pnode != uv_blade_to_pnode(uv_cpu_to_blade_id(cpu))) 756 + continue; 757 + bcp = &per_cpu(bau_control, cpu); 758 + bcp->descriptor_base = bau_desc; 759 + } 1179 760 } 1180 761 1181 762 /* 1182 763 * initialize the destination side's receiving buffers 764 + * entered for each uvhub in the partition 765 + * - node is first node (kernel memory notion) on the uvhub 766 + * - pnode is the uvhub's physical identifier 1183 767 */ 1184 - static struct bau_payload_queue_entry * __init 1185 - uv_payload_queue_init(int node, int pnode, struct bau_control *bau_tablesp) 768 + static void 769 + uv_payload_queue_init(int node, int pnode) 1186 770 { 1187 - struct bau_payload_queue_entry *pqp; 1188 - unsigned long pa; 1189 771 int pn; 772 + int cpu; 1190 773 char *cp; 774 + unsigned long pa; 775 + struct bau_payload_queue_entry *pqp; 776 + struct bau_payload_queue_entry *pqp_malloc; 777 + struct bau_control *bcp; 1191 778 1192 779 pqp = (struct bau_payload_queue_entry *) kmalloc_node( 1193 780 (DEST_Q_SIZE + 1) * sizeof(struct bau_payload_queue_entry), 1194 781 GFP_KERNEL, node); 1195 782 BUG_ON(!pqp); 783 + pqp_malloc = pqp; 1196 784 1197 785 cp = (char *)pqp + 31; 1198 786 pqp = (struct bau_payload_queue_entry *)(((unsigned long)cp >> 5) << 5); 1199 - bau_tablesp->va_queue_first = pqp; 787 + 788 + for_each_present_cpu(cpu) { 789 + if (pnode != uv_cpu_to_pnode(cpu)) 790 + continue; 791 + /* for every cpu on this pnode: */ 792 + bcp = &per_cpu(bau_control, cpu); 793 + bcp->va_queue_first = pqp; 794 + bcp->bau_msg_head = pqp; 795 + bcp->va_queue_last = pqp + (DEST_Q_SIZE - 1); 796 + } 1200 797 /* 1201 798 * need the pnode of where the memory was really allocated 1202 799 */ 1203 800 pa = uv_gpa(pqp); 1204 - pn = uv_gpa_to_pnode(pa); 801 + pn = pa >> uv_nshift; 1205 802 uv_write_global_mmr64(pnode, 1206 803 UVH_LB_BAU_INTD_PAYLOAD_QUEUE_FIRST, 1207 804 ((unsigned long)pn << UV_PAYLOADQ_PNODE_SHIFT) | 1208 805 uv_physnodeaddr(pqp)); 1209 806 uv_write_global_mmr64(pnode, UVH_LB_BAU_INTD_PAYLOAD_QUEUE_TAIL, 1210 807 uv_physnodeaddr(pqp)); 1211 - bau_tablesp->va_queue_last = pqp + (DEST_Q_SIZE - 1); 1212 808 uv_write_global_mmr64(pnode, UVH_LB_BAU_INTD_PAYLOAD_QUEUE_LAST, 1213 809 (unsigned long) 1214 - uv_physnodeaddr(bau_tablesp->va_queue_last)); 810 + uv_physnodeaddr(pqp + (DEST_Q_SIZE - 1))); 811 + /* in effect, all msg_type's are set to MSG_NOOP */ 1215 812 memset(pqp, 0, sizeof(struct bau_payload_queue_entry) * DEST_Q_SIZE); 1216 - 1217 - return pqp; 1218 813 } 1219 814 1220 815 /* 1221 - * Initialization of each UV blade's structures 816 + * Initialization of each UV hub's structures 1222 817 */ 1223 - static int __init uv_init_blade(int blade) 818 + static void __init uv_init_uvhub(int uvhub, int vector) 1224 819 { 1225 820 int node; 1226 821 int pnode; 1227 - unsigned long pa; 1228 822 unsigned long apicid; 1229 - struct bau_desc *adp; 1230 - struct bau_payload_queue_entry *pqp; 1231 - struct bau_control *bau_tablesp; 1232 823 1233 - node = blade_to_first_node(blade); 1234 - bau_tablesp = uv_table_bases_init(blade, node); 1235 - pnode = uv_blade_to_pnode(blade); 1236 - adp = uv_activation_descriptor_init(node, pnode); 1237 - pqp = uv_payload_queue_init(node, pnode, bau_tablesp); 1238 - uv_table_bases_finish(blade, bau_tablesp, adp); 824 + node = uvhub_to_first_node(uvhub); 825 + pnode = uv_blade_to_pnode(uvhub); 826 + uv_activation_descriptor_init(node, pnode); 827 + uv_payload_queue_init(node, pnode); 1239 828 /* 1240 829 * the below initialization can't be in firmware because the 1241 830 * messaging IRQ will be determined by the OS 1242 831 */ 1243 - apicid = blade_to_first_apicid(blade); 1244 - pa = uv_read_global_mmr64(pnode, UVH_BAU_DATA_CONFIG); 832 + apicid = uvhub_to_first_apicid(uvhub); 1245 833 uv_write_global_mmr64(pnode, UVH_BAU_DATA_CONFIG, 1246 - ((apicid << 32) | UV_BAU_MESSAGE)); 1247 - return 0; 834 + ((apicid << 32) | vector)); 835 + } 836 + 837 + /* 838 + * initialize the bau_control structure for each cpu 839 + */ 840 + static void uv_init_per_cpu(int nuvhubs) 841 + { 842 + int i, j, k; 843 + int cpu; 844 + int pnode; 845 + int uvhub; 846 + short socket = 0; 847 + struct bau_control *bcp; 848 + struct uvhub_desc *bdp; 849 + struct socket_desc *sdp; 850 + struct bau_control *hmaster = NULL; 851 + struct bau_control *smaster = NULL; 852 + struct socket_desc { 853 + short num_cpus; 854 + short cpu_number[16]; 855 + }; 856 + struct uvhub_desc { 857 + short num_sockets; 858 + short num_cpus; 859 + short uvhub; 860 + short pnode; 861 + struct socket_desc socket[2]; 862 + }; 863 + struct uvhub_desc *uvhub_descs; 864 + 865 + uvhub_descs = (struct uvhub_desc *) 866 + kmalloc(nuvhubs * sizeof(struct uvhub_desc), GFP_KERNEL); 867 + memset(uvhub_descs, 0, nuvhubs * sizeof(struct uvhub_desc)); 868 + for_each_present_cpu(cpu) { 869 + bcp = &per_cpu(bau_control, cpu); 870 + memset(bcp, 0, sizeof(struct bau_control)); 871 + spin_lock_init(&bcp->masks_lock); 872 + bcp->max_concurrent = uv_bau_max_concurrent; 873 + pnode = uv_cpu_hub_info(cpu)->pnode; 874 + uvhub = uv_cpu_hub_info(cpu)->numa_blade_id; 875 + bdp = &uvhub_descs[uvhub]; 876 + bdp->num_cpus++; 877 + bdp->uvhub = uvhub; 878 + bdp->pnode = pnode; 879 + /* time interval to catch a hardware stay-busy bug */ 880 + bcp->timeout_interval = millisec_2_cycles(3); 881 + /* kludge: assume uv_hub.h is constant */ 882 + socket = (cpu_physical_id(cpu)>>5)&1; 883 + if (socket >= bdp->num_sockets) 884 + bdp->num_sockets = socket+1; 885 + sdp = &bdp->socket[socket]; 886 + sdp->cpu_number[sdp->num_cpus] = cpu; 887 + sdp->num_cpus++; 888 + } 889 + socket = 0; 890 + for_each_possible_blade(uvhub) { 891 + bdp = &uvhub_descs[uvhub]; 892 + for (i = 0; i < bdp->num_sockets; i++) { 893 + sdp = &bdp->socket[i]; 894 + for (j = 0; j < sdp->num_cpus; j++) { 895 + cpu = sdp->cpu_number[j]; 896 + bcp = &per_cpu(bau_control, cpu); 897 + bcp->cpu = cpu; 898 + if (j == 0) { 899 + smaster = bcp; 900 + if (i == 0) 901 + hmaster = bcp; 902 + } 903 + bcp->cpus_in_uvhub = bdp->num_cpus; 904 + bcp->cpus_in_socket = sdp->num_cpus; 905 + bcp->socket_master = smaster; 906 + bcp->uvhub_master = hmaster; 907 + for (k = 0; k < DEST_Q_SIZE; k++) 908 + bcp->socket_acknowledge_count[k] = 0; 909 + bcp->uvhub_cpu = 910 + uv_cpu_hub_info(cpu)->blade_processor_id; 911 + } 912 + socket++; 913 + } 914 + } 915 + kfree(uvhub_descs); 1248 916 } 1249 917 1250 918 /* ··· 1344 828 */ 1345 829 static int __init uv_bau_init(void) 1346 830 { 1347 - int blade; 1348 - int nblades; 831 + int uvhub; 832 + int pnode; 833 + int nuvhubs; 1349 834 int cur_cpu; 835 + int vector; 836 + unsigned long mmr; 1350 837 1351 838 if (!is_uv_system()) 839 + return 0; 840 + 841 + if (nobau) 1352 842 return 0; 1353 843 1354 844 for_each_possible_cpu(cur_cpu) 1355 845 zalloc_cpumask_var_node(&per_cpu(uv_flush_tlb_mask, cur_cpu), 1356 846 GFP_KERNEL, cpu_to_node(cur_cpu)); 1357 847 1358 - uv_bau_retry_limit = 1; 848 + uv_bau_max_concurrent = MAX_BAU_CONCURRENT; 849 + uv_nshift = uv_hub_info->m_val; 1359 850 uv_mmask = (1UL << uv_hub_info->m_val) - 1; 1360 - nblades = uv_num_possible_blades(); 851 + nuvhubs = uv_num_possible_blades(); 1361 852 1362 - uv_bau_table_bases = (struct bau_control **) 1363 - kmalloc(nblades * sizeof(struct bau_control *), GFP_KERNEL); 1364 - BUG_ON(!uv_bau_table_bases); 853 + uv_init_per_cpu(nuvhubs); 1365 854 1366 855 uv_partition_base_pnode = 0x7fffffff; 1367 - for (blade = 0; blade < nblades; blade++) 1368 - if (uv_blade_nr_possible_cpus(blade) && 1369 - (uv_blade_to_pnode(blade) < uv_partition_base_pnode)) 1370 - uv_partition_base_pnode = uv_blade_to_pnode(blade); 1371 - for (blade = 0; blade < nblades; blade++) 1372 - if (uv_blade_nr_possible_cpus(blade)) 1373 - uv_init_blade(blade); 856 + for (uvhub = 0; uvhub < nuvhubs; uvhub++) 857 + if (uv_blade_nr_possible_cpus(uvhub) && 858 + (uv_blade_to_pnode(uvhub) < uv_partition_base_pnode)) 859 + uv_partition_base_pnode = uv_blade_to_pnode(uvhub); 1374 860 1375 - alloc_intr_gate(UV_BAU_MESSAGE, uv_bau_message_intr1); 861 + vector = UV_BAU_MESSAGE; 862 + for_each_possible_blade(uvhub) 863 + if (uv_blade_nr_possible_cpus(uvhub)) 864 + uv_init_uvhub(uvhub, vector); 865 + 1376 866 uv_enable_timeouts(); 867 + alloc_intr_gate(vector, uv_bau_message_intr1); 868 + 869 + for_each_possible_blade(uvhub) { 870 + pnode = uv_blade_to_pnode(uvhub); 871 + /* INIT the bau */ 872 + uv_write_global_mmr64(pnode, UVH_LB_BAU_SB_ACTIVATION_CONTROL, 873 + ((unsigned long)1 << 63)); 874 + mmr = 1; /* should be 1 to broadcast to both sockets */ 875 + uv_write_global_mmr64(pnode, UVH_BAU_DATA_BROADCAST, mmr); 876 + } 1377 877 1378 878 return 0; 1379 879 } 1380 - __initcall(uv_bau_init); 1381 - __initcall(uv_ptc_init); 880 + core_initcall(uv_bau_init); 881 + core_initcall(uv_ptc_init);
+6 -6
arch/x86/kernel/uv_irq.c
··· 44 44 ack_APIC_irq(); 45 45 } 46 46 47 - struct irq_chip uv_irq_chip = { 47 + static struct irq_chip uv_irq_chip = { 48 48 .name = "UV-CORE", 49 49 .startup = uv_noop_ret, 50 50 .shutdown = uv_noop, ··· 141 141 */ 142 142 static int 143 143 arch_enable_uv_irq(char *irq_name, unsigned int irq, int cpu, int mmr_blade, 144 - unsigned long mmr_offset, int restrict) 144 + unsigned long mmr_offset, int limit) 145 145 { 146 146 const struct cpumask *eligible_cpu = cpumask_of(cpu); 147 147 struct irq_desc *desc = irq_to_desc(irq); ··· 160 160 if (err != 0) 161 161 return err; 162 162 163 - if (restrict == UV_AFFINITY_CPU) 163 + if (limit == UV_AFFINITY_CPU) 164 164 desc->status |= IRQ_NO_BALANCING; 165 165 else 166 166 desc->status |= IRQ_MOVE_PCNTXT; ··· 214 214 unsigned long mmr_value; 215 215 struct uv_IO_APIC_route_entry *entry; 216 216 unsigned long mmr_offset; 217 - unsigned mmr_pnode; 217 + int mmr_pnode; 218 218 219 219 if (set_desc_affinity(desc, mask, &dest)) 220 220 return -1; ··· 248 248 * interrupt is raised. 249 249 */ 250 250 int uv_setup_irq(char *irq_name, int cpu, int mmr_blade, 251 - unsigned long mmr_offset, int restrict) 251 + unsigned long mmr_offset, int limit) 252 252 { 253 253 int irq, ret; 254 254 ··· 258 258 return -EBUSY; 259 259 260 260 ret = arch_enable_uv_irq(irq_name, irq, cpu, mmr_blade, mmr_offset, 261 - restrict); 261 + limit); 262 262 if (ret == irq) 263 263 uv_set_irq_2_mmr_info(irq, mmr_offset, mmr_blade); 264 264 else