aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc/sgi-xp/xpc.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/misc/sgi-xp/xpc.h')
-rw-r--r--drivers/misc/sgi-xp/xpc.h158
1 files changed, 128 insertions, 30 deletions
diff --git a/drivers/misc/sgi-xp/xpc.h b/drivers/misc/sgi-xp/xpc.h
index 1e48f7765050..4c26181defff 100644
--- a/drivers/misc/sgi-xp/xpc.h
+++ b/drivers/misc/sgi-xp/xpc.h
@@ -164,8 +164,8 @@ struct xpc_vars_part_sn2 {
164 * MAGIC2 indicates that this partition has pulled the remote partititions 164 * MAGIC2 indicates that this partition has pulled the remote partititions
165 * per partition variables that pertain to this partition. 165 * per partition variables that pertain to this partition.
166 */ 166 */
167#define XPC_VP_MAGIC1 0x0053524156435058L /* 'XPCVARS\0'L (little endian) */ 167#define XPC_VP_MAGIC1_SN2 0x0053524156435058L /* 'XPCVARS\0'L (little endian) */
168#define XPC_VP_MAGIC2 0x0073726176435058L /* 'XPCvars\0'L (little endian) */ 168#define XPC_VP_MAGIC2_SN2 0x0073726176435058L /* 'XPCvars\0'L (little endian) */
169 169
170/* the reserved page sizes and offsets */ 170/* the reserved page sizes and offsets */
171 171
@@ -181,6 +181,80 @@ struct xpc_vars_part_sn2 {
181 xpc_nasid_mask_nlongs)) 181 xpc_nasid_mask_nlongs))
182 182
183/* 183/*
184 * The activate_mq is used to send/receive messages that affect XPC's heartbeat,
185 * partition active state, and channel state. This is UV only.
186 */
187struct xpc_activate_mq_msghdr_uv {
188 short partid; /* sender's partid */
189 u8 act_state; /* sender's act_state at time msg sent */
190 u8 type; /* message's type */
191 unsigned long rp_ts_jiffies; /* timestamp of sender's rp setup by XPC */
192};
193
194/* activate_mq defined message types */
195#define XPC_ACTIVATE_MQ_MSG_SYNC_ACT_STATE_UV 0
196#define XPC_ACTIVATE_MQ_MSG_INC_HEARTBEAT_UV 1
197#define XPC_ACTIVATE_MQ_MSG_OFFLINE_HEARTBEAT_UV 2
198#define XPC_ACTIVATE_MQ_MSG_ONLINE_HEARTBEAT_UV 3
199
200#define XPC_ACTIVATE_MQ_MSG_ACTIVATE_REQ_UV 4
201#define XPC_ACTIVATE_MQ_MSG_DEACTIVATE_REQ_UV 5
202
203#define XPC_ACTIVATE_MQ_MSG_CHCTL_CLOSEREQUEST_UV 6
204#define XPC_ACTIVATE_MQ_MSG_CHCTL_CLOSEREPLY_UV 7
205#define XPC_ACTIVATE_MQ_MSG_CHCTL_OPENREQUEST_UV 8
206#define XPC_ACTIVATE_MQ_MSG_CHCTL_OPENREPLY_UV 9
207
208#define XPC_ACTIVATE_MQ_MSG_MARK_ENGAGED_UV 10
209#define XPC_ACTIVATE_MQ_MSG_MARK_DISENGAGED_UV 11
210
211struct xpc_activate_mq_msg_uv {
212 struct xpc_activate_mq_msghdr_uv header;
213};
214
215struct xpc_activate_mq_msg_heartbeat_req_uv {
216 struct xpc_activate_mq_msghdr_uv header;
217 u64 heartbeat;
218};
219
220struct xpc_activate_mq_msg_activate_req_uv {
221 struct xpc_activate_mq_msghdr_uv header;
222 unsigned long rp_gpa;
223 unsigned long activate_mq_gpa;
224};
225
226struct xpc_activate_mq_msg_deactivate_req_uv {
227 struct xpc_activate_mq_msghdr_uv header;
228 enum xp_retval reason;
229};
230
231struct xpc_activate_mq_msg_chctl_closerequest_uv {
232 struct xpc_activate_mq_msghdr_uv header;
233 short ch_number;
234 enum xp_retval reason;
235};
236
237struct xpc_activate_mq_msg_chctl_closereply_uv {
238 struct xpc_activate_mq_msghdr_uv header;
239 short ch_number;
240};
241
242struct xpc_activate_mq_msg_chctl_openrequest_uv {
243 struct xpc_activate_mq_msghdr_uv header;
244 short ch_number;
245 short msg_size; /* size of notify_mq's messages */
246 short local_nentries; /* ??? Is this needed? What is? */
247};
248
249struct xpc_activate_mq_msg_chctl_openreply_uv {
250 struct xpc_activate_mq_msghdr_uv header;
251 short ch_number;
252 short remote_nentries; /* ??? Is this needed? What is? */
253 short local_nentries; /* ??? Is this needed? What is? */
254 unsigned long local_notify_mq_gpa;
255};
256
257/*
184 * Functions registered by add_timer() or called by kernel_thread() only 258 * Functions registered by add_timer() or called by kernel_thread() only
185 * allow for a single 64-bit argument. The following macros can be used to 259 * allow for a single 64-bit argument. The following macros can be used to
186 * pack and unpack two (32-bit, 16-bit or 8-bit) arguments into or out from 260 * pack and unpack two (32-bit, 16-bit or 8-bit) arguments into or out from
@@ -331,6 +405,18 @@ struct xpc_notify {
331 */ 405 */
332 406
333struct xpc_channel_sn2 { 407struct xpc_channel_sn2 {
408 struct xpc_openclose_args *local_openclose_args; /* args passed on */
409 /* opening or closing of channel */
410
411 void *local_msgqueue_base; /* base address of kmalloc'd space */
412 struct xpc_msg *local_msgqueue; /* local message queue */
413 void *remote_msgqueue_base; /* base address of kmalloc'd space */
414 struct xpc_msg *remote_msgqueue; /* cached copy of remote partition's */
415 /* local message queue */
416 unsigned long remote_msgqueue_pa; /* phys addr of remote partition's */
417 /* local message queue */
418
419 struct xpc_notify *notify_queue; /* notify queue for messages sent */
334 420
335 /* various flavors of local and remote Get/Put values */ 421 /* various flavors of local and remote Get/Put values */
336 422
@@ -344,13 +430,14 @@ struct xpc_channel_sn2 {
344}; 430};
345 431
346struct xpc_channel_uv { 432struct xpc_channel_uv {
347 /* !!! code is coming */ 433 unsigned long remote_notify_mq_gpa; /* gru phys address of remote */
434 /* partition's notify mq */
348}; 435};
349 436
350struct xpc_channel { 437struct xpc_channel {
351 short partid; /* ID of remote partition connected */ 438 short partid; /* ID of remote partition connected */
352 spinlock_t lock; /* lock for updating this structure */ 439 spinlock_t lock; /* lock for updating this structure */
353 u32 flags; /* general flags */ 440 unsigned int flags; /* general flags */
354 441
355 enum xp_retval reason; /* reason why channel is disconnect'g */ 442 enum xp_retval reason; /* reason why channel is disconnect'g */
356 int reason_line; /* line# disconnect initiated from */ 443 int reason_line; /* line# disconnect initiated from */
@@ -361,14 +448,6 @@ struct xpc_channel {
361 u16 local_nentries; /* #of msg entries in local msg queue */ 448 u16 local_nentries; /* #of msg entries in local msg queue */
362 u16 remote_nentries; /* #of msg entries in remote msg queue */ 449 u16 remote_nentries; /* #of msg entries in remote msg queue */
363 450
364 void *local_msgqueue_base; /* base address of kmalloc'd space */
365 struct xpc_msg *local_msgqueue; /* local message queue */
366 void *remote_msgqueue_base; /* base address of kmalloc'd space */
367 struct xpc_msg *remote_msgqueue; /* cached copy of remote partition's */
368 /* local message queue */
369 unsigned long remote_msgqueue_pa; /* phys addr of remote partition's */
370 /* local message queue */
371
372 atomic_t references; /* #of external references to queues */ 451 atomic_t references; /* #of external references to queues */
373 452
374 atomic_t n_on_msg_allocate_wq; /* #on msg allocation wait queue */ 453 atomic_t n_on_msg_allocate_wq; /* #on msg allocation wait queue */
@@ -377,19 +456,13 @@ struct xpc_channel {
377 u8 delayed_chctl_flags; /* chctl flags received, but delayed */ 456 u8 delayed_chctl_flags; /* chctl flags received, but delayed */
378 /* action until channel disconnected */ 457 /* action until channel disconnected */
379 458
380 /* queue of msg senders who want to be notified when msg received */
381
382 atomic_t n_to_notify; /* #of msg senders to notify */ 459 atomic_t n_to_notify; /* #of msg senders to notify */
383 struct xpc_notify *notify_queue; /* notify queue for messages sent */
384 460
385 xpc_channel_func func; /* user's channel function */ 461 xpc_channel_func func; /* user's channel function */
386 void *key; /* pointer to user's key */ 462 void *key; /* pointer to user's key */
387 463
388 struct completion wdisconnect_wait; /* wait for channel disconnect */ 464 struct completion wdisconnect_wait; /* wait for channel disconnect */
389 465
390 struct xpc_openclose_args *local_openclose_args; /* args passed on */
391 /* opening or closing of channel */
392
393 /* kthread management related fields */ 466 /* kthread management related fields */
394 467
395 atomic_t kthreads_assigned; /* #of kthreads assigned to channel */ 468 atomic_t kthreads_assigned; /* #of kthreads assigned to channel */
@@ -507,6 +580,8 @@ struct xpc_partition_sn2 {
507 unsigned long remote_GPs_pa; /* phys addr of remote partition's local */ 580 unsigned long remote_GPs_pa; /* phys addr of remote partition's local */
508 /* Get/Put values */ 581 /* Get/Put values */
509 582
583 void *local_openclose_args_base; /* base address of kmalloc'd space */
584 struct xpc_openclose_args *local_openclose_args; /* local's args */
510 unsigned long remote_openclose_args_pa; /* phys addr of remote's args */ 585 unsigned long remote_openclose_args_pa; /* phys addr of remote's args */
511 586
512 int notify_IRQ_nasid; /* nasid of where to send notify IRQs */ 587 int notify_IRQ_nasid; /* nasid of where to send notify IRQs */
@@ -520,9 +595,27 @@ struct xpc_partition_sn2 {
520}; 595};
521 596
522struct xpc_partition_uv { 597struct xpc_partition_uv {
523 /* !!! code is coming */ 598 unsigned long remote_activate_mq_gpa; /* gru phys address of remote */
599 /* partition's activate mq */
600 spinlock_t flags_lock; /* protect updating of flags */
601 unsigned int flags; /* general flags */
602 u8 remote_act_state; /* remote partition's act_state */
603 u8 act_state_req; /* act_state request from remote partition */
604 enum xp_retval reason; /* reason for deactivate act_state request */
605 u64 heartbeat; /* incremented by remote partition */
524}; 606};
525 607
608/* struct xpc_partition_uv flags */
609
610#define XPC_P_HEARTBEAT_OFFLINE_UV 0x00000001
611#define XPC_P_ENGAGED_UV 0x00000002
612
613/* struct xpc_partition_uv act_state change requests */
614
615#define XPC_P_ASR_ACTIVATE_UV 0x01
616#define XPC_P_ASR_REACTIVATE_UV 0x02
617#define XPC_P_ASR_DEACTIVATE_UV 0x03
618
526struct xpc_partition { 619struct xpc_partition {
527 620
528 /* XPC HB infrastructure */ 621 /* XPC HB infrastructure */
@@ -556,8 +649,6 @@ struct xpc_partition {
556 union xpc_channel_ctl_flags chctl; /* chctl flags yet to be processed */ 649 union xpc_channel_ctl_flags chctl; /* chctl flags yet to be processed */
557 spinlock_t chctl_lock; /* chctl flags lock */ 650 spinlock_t chctl_lock; /* chctl flags lock */
558 651
559 void *local_openclose_args_base; /* base address of kmalloc'd space */
560 struct xpc_openclose_args *local_openclose_args; /* local's args */
561 void *remote_openclose_args_base; /* base address of kmalloc'd space */ 652 void *remote_openclose_args_base; /* base address of kmalloc'd space */
562 struct xpc_openclose_args *remote_openclose_args; /* copy of remote's */ 653 struct xpc_openclose_args *remote_openclose_args; /* copy of remote's */
563 /* args */ 654 /* args */
@@ -616,17 +707,20 @@ extern struct device *xpc_part;
616extern struct device *xpc_chan; 707extern struct device *xpc_chan;
617extern int xpc_disengage_timelimit; 708extern int xpc_disengage_timelimit;
618extern int xpc_disengage_timedout; 709extern int xpc_disengage_timedout;
619extern atomic_t xpc_activate_IRQ_rcvd; 710extern int xpc_activate_IRQ_rcvd;
711extern spinlock_t xpc_activate_IRQ_rcvd_lock;
620extern wait_queue_head_t xpc_activate_IRQ_wq; 712extern wait_queue_head_t xpc_activate_IRQ_wq;
621extern void *xpc_heartbeating_to_mask; 713extern void *xpc_heartbeating_to_mask;
714extern void *xpc_kzalloc_cacheline_aligned(size_t, gfp_t, void **);
622extern void xpc_activate_partition(struct xpc_partition *); 715extern void xpc_activate_partition(struct xpc_partition *);
623extern void xpc_activate_kthreads(struct xpc_channel *, int); 716extern void xpc_activate_kthreads(struct xpc_channel *, int);
624extern void xpc_create_kthreads(struct xpc_channel *, int, int); 717extern void xpc_create_kthreads(struct xpc_channel *, int, int);
625extern void xpc_disconnect_wait(int); 718extern void xpc_disconnect_wait(int);
719extern int (*xpc_setup_partitions_sn) (void);
626extern enum xp_retval (*xpc_get_partition_rsvd_page_pa) (void *, u64 *, 720extern enum xp_retval (*xpc_get_partition_rsvd_page_pa) (void *, u64 *,
627 unsigned long *, 721 unsigned long *,
628 size_t *); 722 size_t *);
629extern enum xp_retval (*xpc_rsvd_page_init) (struct xpc_rsvd_page *); 723extern int (*xpc_setup_rsvd_page_sn) (struct xpc_rsvd_page *);
630extern void (*xpc_heartbeat_init) (void); 724extern void (*xpc_heartbeat_init) (void);
631extern void (*xpc_heartbeat_exit) (void); 725extern void (*xpc_heartbeat_exit) (void);
632extern void (*xpc_increment_heartbeat) (void); 726extern void (*xpc_increment_heartbeat) (void);
@@ -635,8 +729,8 @@ extern void (*xpc_online_heartbeat) (void);
635extern enum xp_retval (*xpc_get_remote_heartbeat) (struct xpc_partition *); 729extern enum xp_retval (*xpc_get_remote_heartbeat) (struct xpc_partition *);
636extern enum xp_retval (*xpc_make_first_contact) (struct xpc_partition *); 730extern enum xp_retval (*xpc_make_first_contact) (struct xpc_partition *);
637extern u64 (*xpc_get_chctl_all_flags) (struct xpc_partition *); 731extern u64 (*xpc_get_chctl_all_flags) (struct xpc_partition *);
638extern enum xp_retval (*xpc_allocate_msgqueues) (struct xpc_channel *); 732extern enum xp_retval (*xpc_setup_msg_structures) (struct xpc_channel *);
639extern void (*xpc_free_msgqueues) (struct xpc_channel *); 733extern void (*xpc_teardown_msg_structures) (struct xpc_channel *);
640extern void (*xpc_notify_senders_of_disconnect) (struct xpc_channel *); 734extern void (*xpc_notify_senders_of_disconnect) (struct xpc_channel *);
641extern void (*xpc_process_msg_chctl_flags) (struct xpc_partition *, int); 735extern void (*xpc_process_msg_chctl_flags) (struct xpc_partition *, int);
642extern int (*xpc_n_of_deliverable_msgs) (struct xpc_channel *); 736extern int (*xpc_n_of_deliverable_msgs) (struct xpc_channel *);
@@ -647,9 +741,9 @@ extern void (*xpc_request_partition_reactivation) (struct xpc_partition *);
647extern void (*xpc_request_partition_deactivation) (struct xpc_partition *); 741extern void (*xpc_request_partition_deactivation) (struct xpc_partition *);
648extern void (*xpc_cancel_partition_deactivation_request) ( 742extern void (*xpc_cancel_partition_deactivation_request) (
649 struct xpc_partition *); 743 struct xpc_partition *);
650extern void (*xpc_process_activate_IRQ_rcvd) (int); 744extern void (*xpc_process_activate_IRQ_rcvd) (void);
651extern enum xp_retval (*xpc_setup_infrastructure) (struct xpc_partition *); 745extern enum xp_retval (*xpc_setup_ch_structures_sn) (struct xpc_partition *);
652extern void (*xpc_teardown_infrastructure) (struct xpc_partition *); 746extern void (*xpc_teardown_ch_structures_sn) (struct xpc_partition *);
653 747
654extern void (*xpc_indicate_partition_engaged) (struct xpc_partition *); 748extern void (*xpc_indicate_partition_engaged) (struct xpc_partition *);
655extern int (*xpc_partition_engaged) (short); 749extern int (*xpc_partition_engaged) (short);
@@ -665,6 +759,9 @@ extern void (*xpc_send_chctl_openrequest) (struct xpc_channel *,
665 unsigned long *); 759 unsigned long *);
666extern void (*xpc_send_chctl_openreply) (struct xpc_channel *, unsigned long *); 760extern void (*xpc_send_chctl_openreply) (struct xpc_channel *, unsigned long *);
667 761
762extern void (*xpc_save_remote_msgqueue_pa) (struct xpc_channel *,
763 unsigned long);
764
668extern enum xp_retval (*xpc_send_msg) (struct xpc_channel *, u32, void *, u16, 765extern enum xp_retval (*xpc_send_msg) (struct xpc_channel *, u32, void *, u16,
669 u8, xpc_notify_func, void *); 766 u8, xpc_notify_func, void *);
670extern void (*xpc_received_msg) (struct xpc_channel *, struct xpc_msg *); 767extern void (*xpc_received_msg) (struct xpc_channel *, struct xpc_msg *);
@@ -674,7 +771,7 @@ extern int xpc_init_sn2(void);
674extern void xpc_exit_sn2(void); 771extern void xpc_exit_sn2(void);
675 772
676/* found in xpc_uv.c */ 773/* found in xpc_uv.c */
677extern void xpc_init_uv(void); 774extern int xpc_init_uv(void);
678extern void xpc_exit_uv(void); 775extern void xpc_exit_uv(void);
679 776
680/* found in xpc_partition.c */ 777/* found in xpc_partition.c */
@@ -684,7 +781,8 @@ extern struct xpc_rsvd_page *xpc_rsvd_page;
684extern unsigned long *xpc_mach_nasids; 781extern unsigned long *xpc_mach_nasids;
685extern struct xpc_partition *xpc_partitions; 782extern struct xpc_partition *xpc_partitions;
686extern void *xpc_kmalloc_cacheline_aligned(size_t, gfp_t, void **); 783extern void *xpc_kmalloc_cacheline_aligned(size_t, gfp_t, void **);
687extern struct xpc_rsvd_page *xpc_setup_rsvd_page(void); 784extern int xpc_setup_rsvd_page(void);
785extern void xpc_teardown_rsvd_page(void);
688extern int xpc_identify_activate_IRQ_sender(void); 786extern int xpc_identify_activate_IRQ_sender(void);
689extern int xpc_partition_disengaged(struct xpc_partition *); 787extern int xpc_partition_disengaged(struct xpc_partition *);
690extern enum xp_retval xpc_mark_partition_active(struct xpc_partition *); 788extern enum xp_retval xpc_mark_partition_active(struct xpc_partition *);