.. | .. |
---|
71 | 71 | * 'SAL_nasids_size'. (Local partition's mask pointers are xpc_part_nasids |
---|
72 | 72 | * and xpc_mach_nasids.) |
---|
73 | 73 | * |
---|
74 | | - * vars (ia64-sn2 only) |
---|
75 | | - * vars part (ia64-sn2 only) |
---|
76 | | - * |
---|
77 | 74 | * Immediately following the mach_nasids mask are the XPC variables |
---|
78 | 75 | * required by other partitions. First are those that are generic to all |
---|
79 | 76 | * partitions (vars), followed on the next available cacheline by those |
---|
80 | 77 | * which are partition specific (vars part). These are setup by XPC. |
---|
81 | | - * (Local partition's vars pointers are xpc_vars and xpc_vars_part.) |
---|
82 | 78 | * |
---|
83 | 79 | * Note: Until 'ts_jiffies' is set non-zero, the partition XPC code has not been |
---|
84 | 80 | * initialized. |
---|
.. | .. |
---|
93 | 89 | unsigned long ts_jiffies; /* timestamp when rsvd pg was setup by XPC */ |
---|
94 | 90 | union { |
---|
95 | 91 | struct { |
---|
96 | | - unsigned long vars_pa; /* phys addr */ |
---|
97 | | - } sn2; |
---|
98 | | - struct { |
---|
99 | 92 | unsigned long heartbeat_gpa; /* phys addr */ |
---|
100 | 93 | unsigned long activate_gru_mq_desc_gpa; /* phys addr */ |
---|
101 | 94 | } uv; |
---|
.. | .. |
---|
106 | 99 | |
---|
107 | 100 | #define XPC_RP_VERSION _XPC_VERSION(3, 0) /* version 3.0 of the reserved page */ |
---|
108 | 101 | |
---|
109 | | -/* |
---|
110 | | - * Define the structures by which XPC variables can be exported to other |
---|
111 | | - * partitions. (There are two: struct xpc_vars and struct xpc_vars_part) |
---|
112 | | - */ |
---|
113 | | - |
---|
114 | | -/* |
---|
115 | | - * The following structure describes the partition generic variables |
---|
116 | | - * needed by other partitions in order to properly initialize. |
---|
117 | | - * |
---|
118 | | - * struct xpc_vars version number also applies to struct xpc_vars_part. |
---|
119 | | - * Changes to either structure and/or related functionality should be |
---|
120 | | - * reflected by incrementing either the major or minor version numbers |
---|
121 | | - * of struct xpc_vars. |
---|
122 | | - */ |
---|
123 | | -struct xpc_vars_sn2 { |
---|
124 | | - u8 version; |
---|
125 | | - u64 heartbeat; |
---|
126 | | - DECLARE_BITMAP(heartbeating_to_mask, XP_MAX_NPARTITIONS_SN2); |
---|
127 | | - u64 heartbeat_offline; /* if 0, heartbeat should be changing */ |
---|
128 | | - int activate_IRQ_nasid; |
---|
129 | | - int activate_IRQ_phys_cpuid; |
---|
130 | | - unsigned long vars_part_pa; |
---|
131 | | - unsigned long amos_page_pa;/* paddr of page of amos from MSPEC driver */ |
---|
132 | | - struct amo *amos_page; /* vaddr of page of amos from MSPEC driver */ |
---|
133 | | -}; |
---|
134 | | - |
---|
135 | | -#define XPC_V_VERSION _XPC_VERSION(3, 1) /* version 3.1 of the cross vars */ |
---|
136 | | - |
---|
137 | | -/* |
---|
138 | | - * The following structure describes the per partition specific variables. |
---|
139 | | - * |
---|
140 | | - * An array of these structures, one per partition, will be defined. As a |
---|
141 | | - * partition becomes active XPC will copy the array entry corresponding to |
---|
142 | | - * itself from that partition. It is desirable that the size of this structure |
---|
143 | | - * evenly divides into a 128-byte cacheline, such that none of the entries in |
---|
144 | | - * this array crosses a 128-byte cacheline boundary. As it is now, each entry |
---|
145 | | - * occupies 64-bytes. |
---|
146 | | - */ |
---|
147 | | -struct xpc_vars_part_sn2 { |
---|
148 | | - u64 magic; |
---|
149 | | - |
---|
150 | | - unsigned long openclose_args_pa; /* phys addr of open and close args */ |
---|
151 | | - unsigned long GPs_pa; /* physical address of Get/Put values */ |
---|
152 | | - |
---|
153 | | - unsigned long chctl_amo_pa; /* physical address of chctl flags' amo */ |
---|
154 | | - |
---|
155 | | - int notify_IRQ_nasid; /* nasid of where to send notify IRQs */ |
---|
156 | | - int notify_IRQ_phys_cpuid; /* CPUID of where to send notify IRQs */ |
---|
157 | | - |
---|
158 | | - u8 nchannels; /* #of defined channels supported */ |
---|
159 | | - |
---|
160 | | - u8 reserved[23]; /* pad to a full 64 bytes */ |
---|
161 | | -}; |
---|
162 | | - |
---|
163 | | -/* |
---|
164 | | - * The vars_part MAGIC numbers play a part in the first contact protocol. |
---|
165 | | - * |
---|
166 | | - * MAGIC1 indicates that the per partition specific variables for a remote |
---|
167 | | - * partition have been initialized by this partition. |
---|
168 | | - * |
---|
169 | | - * MAGIC2 indicates that this partition has pulled the remote partititions |
---|
170 | | - * per partition variables that pertain to this partition. |
---|
171 | | - */ |
---|
172 | | -#define XPC_VP_MAGIC1_SN2 0x0053524156435058L /* 'XPCVARS\0'L (little endian) */ |
---|
173 | | -#define XPC_VP_MAGIC2_SN2 0x0073726176435058L /* 'XPCvars\0'L (little endian) */ |
---|
174 | | - |
---|
175 | 102 | /* the reserved page sizes and offsets */ |
---|
176 | 103 | |
---|
177 | 104 | #define XPC_RP_HEADER_SIZE L1_CACHE_ALIGN(sizeof(struct xpc_rsvd_page)) |
---|
178 | | -#define XPC_RP_VARS_SIZE L1_CACHE_ALIGN(sizeof(struct xpc_vars_sn2)) |
---|
179 | 105 | |
---|
180 | 106 | #define XPC_RP_PART_NASIDS(_rp) ((unsigned long *)((u8 *)(_rp) + \ |
---|
181 | 107 | XPC_RP_HEADER_SIZE)) |
---|
182 | 108 | #define XPC_RP_MACH_NASIDS(_rp) (XPC_RP_PART_NASIDS(_rp) + \ |
---|
183 | 109 | xpc_nasid_mask_nlongs) |
---|
184 | | -#define XPC_RP_VARS(_rp) ((struct xpc_vars_sn2 *) \ |
---|
185 | | - (XPC_RP_MACH_NASIDS(_rp) + \ |
---|
186 | | - xpc_nasid_mask_nlongs)) |
---|
187 | 110 | |
---|
188 | 111 | |
---|
189 | 112 | /* |
---|
.. | .. |
---|
298 | 221 | #define XPC_UNPACK_ARG2(_args) ((((u64)_args) >> 32) & 0xffffffff) |
---|
299 | 222 | |
---|
300 | 223 | /* |
---|
301 | | - * Define a Get/Put value pair (pointers) used with a message queue. |
---|
302 | | - */ |
---|
303 | | -struct xpc_gp_sn2 { |
---|
304 | | - s64 get; /* Get value */ |
---|
305 | | - s64 put; /* Put value */ |
---|
306 | | -}; |
---|
307 | | - |
---|
308 | | -#define XPC_GP_SIZE \ |
---|
309 | | - L1_CACHE_ALIGN(sizeof(struct xpc_gp_sn2) * XPC_MAX_NCHANNELS) |
---|
310 | | - |
---|
311 | | -/* |
---|
312 | 224 | * Define a structure that contains arguments associated with opening and |
---|
313 | 225 | * closing a channel. |
---|
314 | 226 | */ |
---|
.. | .. |
---|
341 | 253 | }; |
---|
342 | 254 | |
---|
343 | 255 | /* |
---|
344 | | - * Define a sn2 styled message. |
---|
345 | | - * |
---|
346 | | - * A user-defined message resides in the payload area. The max size of the |
---|
347 | | - * payload is defined by the user via xpc_connect(). |
---|
348 | | - * |
---|
349 | | - * The size of a message entry (within a message queue) must be a 128-byte |
---|
350 | | - * cacheline sized multiple in order to facilitate the BTE transfer of messages |
---|
351 | | - * from one message queue to another. |
---|
352 | | - */ |
---|
353 | | -struct xpc_msg_sn2 { |
---|
354 | | - u8 flags; /* FOR XPC INTERNAL USE ONLY */ |
---|
355 | | - u8 reserved[7]; /* FOR XPC INTERNAL USE ONLY */ |
---|
356 | | - s64 number; /* FOR XPC INTERNAL USE ONLY */ |
---|
357 | | - |
---|
358 | | - u64 payload; /* user defined portion of message */ |
---|
359 | | -}; |
---|
360 | | - |
---|
361 | | -/* struct xpc_msg_sn2 flags */ |
---|
362 | | - |
---|
363 | | -#define XPC_M_SN2_DONE 0x01 /* msg has been received/consumed */ |
---|
364 | | -#define XPC_M_SN2_READY 0x02 /* msg is ready to be sent */ |
---|
365 | | -#define XPC_M_SN2_INTERRUPT 0x04 /* send interrupt when msg consumed */ |
---|
366 | | - |
---|
367 | | -/* |
---|
368 | 256 | * The format of a uv XPC notify_mq GRU message is as follows: |
---|
369 | 257 | * |
---|
370 | 258 | * A user-defined message resides in the payload area. The max size of the |
---|
.. | .. |
---|
388 | 276 | struct xpc_notify_mq_msg_uv { |
---|
389 | 277 | struct xpc_notify_mq_msghdr_uv hdr; |
---|
390 | 278 | unsigned long payload; |
---|
391 | | -}; |
---|
392 | | - |
---|
393 | | -/* |
---|
394 | | - * Define sn2's notify entry. |
---|
395 | | - * |
---|
396 | | - * This is used to notify a message's sender that their message was received |
---|
397 | | - * and consumed by the intended recipient. |
---|
398 | | - */ |
---|
399 | | -struct xpc_notify_sn2 { |
---|
400 | | - u8 type; /* type of notification */ |
---|
401 | | - |
---|
402 | | - /* the following two fields are only used if type == XPC_N_CALL */ |
---|
403 | | - xpc_notify_func func; /* user's notify function */ |
---|
404 | | - void *key; /* pointer to user's key */ |
---|
405 | 279 | }; |
---|
406 | 280 | |
---|
407 | 281 | /* struct xpc_notify_sn2 type of notification */ |
---|
.. | .. |
---|
430 | 304 | * allocated at the time a partition becomes active. The array contains one |
---|
431 | 305 | * of these structures for each potential channel connection to that partition. |
---|
432 | 306 | */ |
---|
433 | | - |
---|
434 | | -/* |
---|
435 | | - * The following is sn2 only. |
---|
436 | | - * |
---|
437 | | - * Each channel structure manages two message queues (circular buffers). |
---|
438 | | - * They are allocated at the time a channel connection is made. One of |
---|
439 | | - * these message queues (local_msgqueue) holds the locally created messages |
---|
440 | | - * that are destined for the remote partition. The other of these message |
---|
441 | | - * queues (remote_msgqueue) is a locally cached copy of the remote partition's |
---|
442 | | - * own local_msgqueue. |
---|
443 | | - * |
---|
444 | | - * The following is a description of the Get/Put pointers used to manage these |
---|
445 | | - * two message queues. Consider the local_msgqueue to be on one partition |
---|
446 | | - * and the remote_msgqueue to be its cached copy on another partition. A |
---|
447 | | - * description of what each of the lettered areas contains is included. |
---|
448 | | - * |
---|
449 | | - * |
---|
450 | | - * local_msgqueue remote_msgqueue |
---|
451 | | - * |
---|
452 | | - * |/////////| |/////////| |
---|
453 | | - * w_remote_GP.get --> +---------+ |/////////| |
---|
454 | | - * | F | |/////////| |
---|
455 | | - * remote_GP.get --> +---------+ +---------+ <-- local_GP->get |
---|
456 | | - * | | | | |
---|
457 | | - * | | | E | |
---|
458 | | - * | | | | |
---|
459 | | - * | | +---------+ <-- w_local_GP.get |
---|
460 | | - * | B | |/////////| |
---|
461 | | - * | | |////D////| |
---|
462 | | - * | | |/////////| |
---|
463 | | - * | | +---------+ <-- w_remote_GP.put |
---|
464 | | - * | | |////C////| |
---|
465 | | - * local_GP->put --> +---------+ +---------+ <-- remote_GP.put |
---|
466 | | - * | | |/////////| |
---|
467 | | - * | A | |/////////| |
---|
468 | | - * | | |/////////| |
---|
469 | | - * w_local_GP.put --> +---------+ |/////////| |
---|
470 | | - * |/////////| |/////////| |
---|
471 | | - * |
---|
472 | | - * |
---|
473 | | - * ( remote_GP.[get|put] are cached copies of the remote |
---|
474 | | - * partition's local_GP->[get|put], and thus their values can |
---|
475 | | - * lag behind their counterparts on the remote partition. ) |
---|
476 | | - * |
---|
477 | | - * |
---|
478 | | - * A - Messages that have been allocated, but have not yet been sent to the |
---|
479 | | - * remote partition. |
---|
480 | | - * |
---|
481 | | - * B - Messages that have been sent, but have not yet been acknowledged by the |
---|
482 | | - * remote partition as having been received. |
---|
483 | | - * |
---|
484 | | - * C - Area that needs to be prepared for the copying of sent messages, by |
---|
485 | | - * the clearing of the message flags of any previously received messages. |
---|
486 | | - * |
---|
487 | | - * D - Area into which sent messages are to be copied from the remote |
---|
488 | | - * partition's local_msgqueue and then delivered to their intended |
---|
489 | | - * recipients. [ To allow for a multi-message copy, another pointer |
---|
490 | | - * (next_msg_to_pull) has been added to keep track of the next message |
---|
491 | | - * number needing to be copied (pulled). It chases after w_remote_GP.put. |
---|
492 | | - * Any messages lying between w_local_GP.get and next_msg_to_pull have |
---|
493 | | - * been copied and are ready to be delivered. ] |
---|
494 | | - * |
---|
495 | | - * E - Messages that have been copied and delivered, but have not yet been |
---|
496 | | - * acknowledged by the recipient as having been received. |
---|
497 | | - * |
---|
498 | | - * F - Messages that have been acknowledged, but XPC has not yet notified the |
---|
499 | | - * sender that the message was received by its intended recipient. |
---|
500 | | - * This is also an area that needs to be prepared for the allocating of |
---|
501 | | - * new messages, by the clearing of the message flags of the acknowledged |
---|
502 | | - * messages. |
---|
503 | | - */ |
---|
504 | | - |
---|
505 | | -struct xpc_channel_sn2 { |
---|
506 | | - struct xpc_openclose_args *local_openclose_args; /* args passed on */ |
---|
507 | | - /* opening or closing of channel */ |
---|
508 | | - |
---|
509 | | - void *local_msgqueue_base; /* base address of kmalloc'd space */ |
---|
510 | | - struct xpc_msg_sn2 *local_msgqueue; /* local message queue */ |
---|
511 | | - void *remote_msgqueue_base; /* base address of kmalloc'd space */ |
---|
512 | | - struct xpc_msg_sn2 *remote_msgqueue; /* cached copy of remote */ |
---|
513 | | - /* partition's local message queue */ |
---|
514 | | - unsigned long remote_msgqueue_pa; /* phys addr of remote partition's */ |
---|
515 | | - /* local message queue */ |
---|
516 | | - |
---|
517 | | - struct xpc_notify_sn2 *notify_queue;/* notify queue for messages sent */ |
---|
518 | | - |
---|
519 | | - /* various flavors of local and remote Get/Put values */ |
---|
520 | | - |
---|
521 | | - struct xpc_gp_sn2 *local_GP; /* local Get/Put values */ |
---|
522 | | - struct xpc_gp_sn2 remote_GP; /* remote Get/Put values */ |
---|
523 | | - struct xpc_gp_sn2 w_local_GP; /* working local Get/Put values */ |
---|
524 | | - struct xpc_gp_sn2 w_remote_GP; /* working remote Get/Put values */ |
---|
525 | | - s64 next_msg_to_pull; /* Put value of next msg to pull */ |
---|
526 | | - |
---|
527 | | - struct mutex msg_to_pull_mutex; /* next msg to pull serialization */ |
---|
528 | | -}; |
---|
529 | 307 | |
---|
530 | 308 | struct xpc_channel_uv { |
---|
531 | 309 | void *cached_notify_gru_mq_desc; /* remote partition's notify mq's */ |
---|
.. | .. |
---|
579 | 357 | wait_queue_head_t idle_wq; /* idle kthread wait queue */ |
---|
580 | 358 | |
---|
581 | 359 | union { |
---|
582 | | - struct xpc_channel_sn2 sn2; |
---|
583 | 360 | struct xpc_channel_uv uv; |
---|
584 | 361 | } sn; |
---|
585 | 362 | |
---|
.. | .. |
---|
666 | 443 | return 0; |
---|
667 | 444 | } |
---|
668 | 445 | |
---|
669 | | -/* |
---|
670 | | - * Manage channels on a partition basis. There is one of these structures |
---|
671 | | - * for each partition (a partition will never utilize the structure that |
---|
672 | | - * represents itself). |
---|
673 | | - */ |
---|
674 | | - |
---|
675 | | -struct xpc_partition_sn2 { |
---|
676 | | - unsigned long remote_amos_page_pa; /* paddr of partition's amos page */ |
---|
677 | | - int activate_IRQ_nasid; /* active partition's act/deact nasid */ |
---|
678 | | - int activate_IRQ_phys_cpuid; /* active part's act/deact phys cpuid */ |
---|
679 | | - |
---|
680 | | - unsigned long remote_vars_pa; /* phys addr of partition's vars */ |
---|
681 | | - unsigned long remote_vars_part_pa; /* paddr of partition's vars part */ |
---|
682 | | - u8 remote_vars_version; /* version# of partition's vars */ |
---|
683 | | - |
---|
684 | | - void *local_GPs_base; /* base address of kmalloc'd space */ |
---|
685 | | - struct xpc_gp_sn2 *local_GPs; /* local Get/Put values */ |
---|
686 | | - void *remote_GPs_base; /* base address of kmalloc'd space */ |
---|
687 | | - struct xpc_gp_sn2 *remote_GPs; /* copy of remote partition's local */ |
---|
688 | | - /* Get/Put values */ |
---|
689 | | - unsigned long remote_GPs_pa; /* phys addr of remote partition's local */ |
---|
690 | | - /* Get/Put values */ |
---|
691 | | - |
---|
692 | | - void *local_openclose_args_base; /* base address of kmalloc'd space */ |
---|
693 | | - struct xpc_openclose_args *local_openclose_args; /* local's args */ |
---|
694 | | - unsigned long remote_openclose_args_pa; /* phys addr of remote's args */ |
---|
695 | | - |
---|
696 | | - int notify_IRQ_nasid; /* nasid of where to send notify IRQs */ |
---|
697 | | - int notify_IRQ_phys_cpuid; /* CPUID of where to send notify IRQs */ |
---|
698 | | - char notify_IRQ_owner[8]; /* notify IRQ's owner's name */ |
---|
699 | | - |
---|
700 | | - struct amo *remote_chctl_amo_va; /* addr of remote chctl flags' amo */ |
---|
701 | | - struct amo *local_chctl_amo_va; /* address of chctl flags' amo */ |
---|
702 | | - |
---|
703 | | - struct timer_list dropped_notify_IRQ_timer; /* dropped IRQ timer */ |
---|
704 | | -}; |
---|
705 | | - |
---|
706 | 446 | struct xpc_partition_uv { |
---|
707 | 447 | unsigned long heartbeat_gpa; /* phys addr of partition's heartbeat */ |
---|
708 | 448 | struct xpc_heartbeat_uv cached_heartbeat; /* cached copy of */ |
---|
.. | .. |
---|
774 | 514 | wait_queue_head_t channel_mgr_wq; /* channel mgr's wait queue */ |
---|
775 | 515 | |
---|
776 | 516 | union { |
---|
777 | | - struct xpc_partition_sn2 sn2; |
---|
778 | 517 | struct xpc_partition_uv uv; |
---|
779 | 518 | } sn; |
---|
780 | 519 | |
---|
.. | .. |
---|
854 | 593 | #define XPC_P_SS_WTEARDOWN 0x02 /* waiting to teardown infrastructure */ |
---|
855 | 594 | #define XPC_P_SS_TORNDOWN 0x03 /* infrastructure is torndown */ |
---|
856 | 595 | |
---|
857 | | -/* |
---|
858 | | - * struct xpc_partition_sn2's dropped notify IRQ timer is set to wait the |
---|
859 | | - * following interval #of seconds before checking for dropped notify IRQs. |
---|
860 | | - * These can occur whenever an IRQ's associated amo write doesn't complete |
---|
861 | | - * until after the IRQ was received. |
---|
862 | | - */ |
---|
863 | | -#define XPC_DROPPED_NOTIFY_IRQ_WAIT_INTERVAL (0.25 * HZ) |
---|
864 | | - |
---|
865 | 596 | /* number of seconds to wait for other partitions to disengage */ |
---|
866 | 597 | #define XPC_DISENGAGE_DEFAULT_TIMELIMIT 90 |
---|
867 | 598 | |
---|
.. | .. |
---|
887 | 618 | extern void xpc_activate_kthreads(struct xpc_channel *, int); |
---|
888 | 619 | extern void xpc_create_kthreads(struct xpc_channel *, int, int); |
---|
889 | 620 | extern void xpc_disconnect_wait(int); |
---|
890 | | - |
---|
891 | | -/* found in xpc_sn2.c */ |
---|
892 | | -extern int xpc_init_sn2(void); |
---|
893 | | -extern void xpc_exit_sn2(void); |
---|
894 | 621 | |
---|
895 | 622 | /* found in xpc_uv.c */ |
---|
896 | 623 | extern int xpc_init_uv(void); |
---|