aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc/sgi-xp/xpc.h
diff options
context:
space:
mode:
authorDean Nelson <dcn@sgi.com>2008-07-30 01:34:09 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-07-30 12:41:49 -0400
commita47d5dac9d8481766382f8cf1483dd581df38b99 (patch)
treed815a930f6d5f0d48b34eb7506447909c02eb3c3 /drivers/misc/sgi-xp/xpc.h
parent6e41017aad9ed175ca51e4828eabc8c5cf5910be (diff)
sgi-xp: isolate additional sn2 specific code
Move additional sn2 specific code into xpc_sn2.c. Signed-off-by: Dean Nelson <dcn@sgi.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/misc/sgi-xp/xpc.h')
-rw-r--r--drivers/misc/sgi-xp/xpc.h173
1 files changed, 97 insertions, 76 deletions
diff --git a/drivers/misc/sgi-xp/xpc.h b/drivers/misc/sgi-xp/xpc.h
index 1edf37512de6..b04cfbed9581 100644
--- a/drivers/misc/sgi-xp/xpc.h
+++ b/drivers/misc/sgi-xp/xpc.h
@@ -122,9 +122,6 @@ struct xpc_rsvd_page {
122 122
123#define XPC_RP_VERSION _XPC_VERSION(2, 0) /* version 2.0 of the reserved page */ 123#define XPC_RP_VERSION _XPC_VERSION(2, 0) /* version 2.0 of the reserved page */
124 124
125#define XPC_SUPPORTS_RP_STAMP(_version) \
126 (_version >= _XPC_VERSION(1, 1))
127
128/* 125/*
129 * Define the structures by which XPC variables can be exported to other 126 * Define the structures by which XPC variables can be exported to other
130 * partitions. (There are two: struct xpc_vars and struct xpc_vars_part) 127 * partitions. (There are two: struct xpc_vars and struct xpc_vars_part)
@@ -144,8 +141,8 @@ struct xpc_vars_sn2 {
144 u64 heartbeat; 141 u64 heartbeat;
145 DECLARE_BITMAP(heartbeating_to_mask, XP_MAX_NPARTITIONS_SN2); 142 DECLARE_BITMAP(heartbeating_to_mask, XP_MAX_NPARTITIONS_SN2);
146 u64 heartbeat_offline; /* if 0, heartbeat should be changing */ 143 u64 heartbeat_offline; /* if 0, heartbeat should be changing */
147 int act_nasid; 144 int activate_IRQ_nasid;
148 int act_phys_cpuid; 145 int activate_IRQ_phys_cpuid;
149 u64 vars_part_pa; 146 u64 vars_part_pa;
150 u64 amos_page_pa; /* paddr of page of AMOs from MSPEC driver */ 147 u64 amos_page_pa; /* paddr of page of AMOs from MSPEC driver */
151 AMO_t *amos_page; /* vaddr of page of AMOs from MSPEC driver */ 148 AMO_t *amos_page; /* vaddr of page of AMOs from MSPEC driver */
@@ -153,9 +150,6 @@ struct xpc_vars_sn2 {
153 150
154#define XPC_V_VERSION _XPC_VERSION(3, 1) /* version 3.1 of the cross vars */ 151#define XPC_V_VERSION _XPC_VERSION(3, 1) /* version 3.1 of the cross vars */
155 152
156#define XPC_SUPPORTS_DISENGAGE_REQUEST(_version) \
157 (_version >= _XPC_VERSION(3, 1))
158
159/* 153/*
160 * The following pertains to ia64-sn2 only. 154 * The following pertains to ia64-sn2 only.
161 * 155 *
@@ -167,14 +161,14 @@ struct xpc_vars_sn2 {
167 * a PI FSB Protocol error to be generated by the SHUB. For XPC, we need 64 161 * a PI FSB Protocol error to be generated by the SHUB. For XPC, we need 64
168 * AMO variables (based on XP_MAX_NPARTITIONS_SN2) to identify the senders of 162 * AMO variables (based on XP_MAX_NPARTITIONS_SN2) to identify the senders of
169 * NOTIFY IRQs, 128 AMO variables (based on XP_NASID_MASK_WORDS) to identify 163 * NOTIFY IRQs, 128 AMO variables (based on XP_NASID_MASK_WORDS) to identify
170 * the senders of ACTIVATE IRQs, and 2 AMO variables to identify which remote 164 * the senders of ACTIVATE IRQs, 1 AMO variable to identify which remote
171 * partitions (i.e., XPCs) consider themselves currently engaged with the 165 * partitions (i.e., XPCs) consider themselves currently engaged with the
172 * local XPC. 166 * local XPC and 1 AMO variable to request partition deactivation.
173 */ 167 */
174#define XPC_NOTIFY_IRQ_AMOS 0 168#define XPC_NOTIFY_IRQ_AMOS 0
175#define XPC_ACTIVATE_IRQ_AMOS (XPC_NOTIFY_IRQ_AMOS + XP_MAX_NPARTITIONS_SN2) 169#define XPC_ACTIVATE_IRQ_AMOS (XPC_NOTIFY_IRQ_AMOS + XP_MAX_NPARTITIONS_SN2)
176#define XPC_ENGAGED_PARTITIONS_AMO (XPC_ACTIVATE_IRQ_AMOS + XP_NASID_MASK_WORDS) 170#define XPC_ENGAGED_PARTITIONS_AMO (XPC_ACTIVATE_IRQ_AMOS + XP_NASID_MASK_WORDS)
177#define XPC_DISENGAGE_REQUEST_AMO (XPC_ENGAGED_PARTITIONS_AMO + 1) 171#define XPC_DEACTIVATE_REQUEST_AMO (XPC_ENGAGED_PARTITIONS_AMO + 1)
178 172
179/* 173/*
180 * The following structure describes the per partition specific variables. 174 * The following structure describes the per partition specific variables.
@@ -369,6 +363,23 @@ struct xpc_notify {
369 * new messages, by the clearing of the message flags of the acknowledged 363 * new messages, by the clearing of the message flags of the acknowledged
370 * messages. 364 * messages.
371 */ 365 */
366struct xpc_channel_sn2 {
367
368 /* various flavors of local and remote Get/Put values */
369
370 struct xpc_gp *local_GP; /* local Get/Put values */
371 struct xpc_gp remote_GP; /* remote Get/Put values */
372 struct xpc_gp w_local_GP; /* working local Get/Put values */
373 struct xpc_gp w_remote_GP; /* working remote Get/Put values */
374 s64 next_msg_to_pull; /* Put value of next msg to pull */
375
376 struct mutex msg_to_pull_mutex; /* next msg to pull serialization */
377};
378
379struct xpc_channel_uv {
380 /* >>> code is coming */
381};
382
372struct xpc_channel { 383struct xpc_channel {
373 short partid; /* ID of remote partition connected */ 384 short partid; /* ID of remote partition connected */
374 spinlock_t lock; /* lock for updating this structure */ 385 spinlock_t lock; /* lock for updating this structure */
@@ -407,20 +418,11 @@ struct xpc_channel {
407 xpc_channel_func func; /* user's channel function */ 418 xpc_channel_func func; /* user's channel function */
408 void *key; /* pointer to user's key */ 419 void *key; /* pointer to user's key */
409 420
410 struct mutex msg_to_pull_mutex; /* next msg to pull serialization */
411 struct completion wdisconnect_wait; /* wait for channel disconnect */ 421 struct completion wdisconnect_wait; /* wait for channel disconnect */
412 422
413 struct xpc_openclose_args *local_openclose_args; /* args passed on */ 423 struct xpc_openclose_args *local_openclose_args; /* args passed on */
414 /* opening or closing of channel */ 424 /* opening or closing of channel */
415 425
416 /* various flavors of local and remote Get/Put values */
417
418 struct xpc_gp *local_GP; /* local Get/Put values */
419 struct xpc_gp remote_GP; /* remote Get/Put values */
420 struct xpc_gp w_local_GP; /* working local Get/Put values */
421 struct xpc_gp w_remote_GP; /* working remote Get/Put values */
422 s64 next_msg_to_pull; /* Put value of next msg to pull */
423
424 /* kthread management related fields */ 426 /* kthread management related fields */
425 427
426 atomic_t kthreads_assigned; /* #of kthreads assigned to channel */ 428 atomic_t kthreads_assigned; /* #of kthreads assigned to channel */
@@ -431,6 +433,11 @@ struct xpc_channel {
431 433
432 wait_queue_head_t idle_wq; /* idle kthread wait queue */ 434 wait_queue_head_t idle_wq; /* idle kthread wait queue */
433 435
436 union {
437 struct xpc_channel_sn2 sn2;
438 struct xpc_channel_uv uv;
439 } sn;
440
434} ____cacheline_aligned; 441} ____cacheline_aligned;
435 442
436/* struct xpc_channel flags */ 443/* struct xpc_channel flags */
@@ -467,6 +474,40 @@ struct xpc_channel {
467 * for each partition (a partition will never utilize the structure that 474 * for each partition (a partition will never utilize the structure that
468 * represents itself). 475 * represents itself).
469 */ 476 */
477
478struct xpc_partition_sn2 {
479 u64 remote_amos_page_pa; /* phys addr of partition's amos page */
480 int activate_IRQ_nasid; /* active partition's act/deact nasid */
481 int activate_IRQ_phys_cpuid; /* active part's act/deact phys cpuid */
482
483 u64 remote_vars_pa; /* phys addr of partition's vars */
484 u64 remote_vars_part_pa; /* phys addr of partition's vars part */
485 u8 remote_vars_version; /* version# of partition's vars */
486
487 void *local_GPs_base; /* base address of kmalloc'd space */
488 struct xpc_gp *local_GPs; /* local Get/Put values */
489 void *remote_GPs_base; /* base address of kmalloc'd space */
490 struct xpc_gp *remote_GPs; /* copy of remote partition's local */
491 /* Get/Put values */
492 u64 remote_GPs_pa; /* phys address of remote partition's local */
493 /* Get/Put values */
494
495 u64 remote_openclose_args_pa; /* phys addr of remote's args */
496
497 int remote_IPI_nasid; /* nasid of where to send IPIs */
498 int remote_IPI_phys_cpuid; /* phys CPU ID of where to send IPIs */
499 char IPI_owner[8]; /* IPI owner's name */
500
501 AMO_t *remote_IPI_amo_va; /* address of remote IPI AMO_t structure */
502 AMO_t *local_IPI_amo_va; /* address of IPI AMO_t structure */
503
504 struct timer_list dropped_notify_IRQ_timer; /* dropped IRQ timer */
505};
506
507struct xpc_partition_uv {
508 /* >>> code is coming */
509};
510
470struct xpc_partition { 511struct xpc_partition {
471 512
472 /* XPC HB infrastructure */ 513 /* XPC HB infrastructure */
@@ -474,22 +515,15 @@ struct xpc_partition {
474 u8 remote_rp_version; /* version# of partition's rsvd pg */ 515 u8 remote_rp_version; /* version# of partition's rsvd pg */
475 unsigned long remote_rp_stamp; /* time when rsvd pg was initialized */ 516 unsigned long remote_rp_stamp; /* time when rsvd pg was initialized */
476 u64 remote_rp_pa; /* phys addr of partition's rsvd pg */ 517 u64 remote_rp_pa; /* phys addr of partition's rsvd pg */
477 u64 remote_vars_pa; /* phys addr of partition's vars */
478 u64 remote_vars_part_pa; /* phys addr of partition's vars part */
479 u64 last_heartbeat; /* HB at last read */ 518 u64 last_heartbeat; /* HB at last read */
480 u64 remote_amos_page_pa; /* phys addr of partition's amos page */
481 int remote_act_nasid; /* active part's act/deact nasid */
482 int remote_act_phys_cpuid; /* active part's act/deact phys cpuid */
483 u32 activate_IRQ_rcvd; /* IRQs since activation */ 519 u32 activate_IRQ_rcvd; /* IRQs since activation */
484 spinlock_t act_lock; /* protect updating of act_state */ 520 spinlock_t act_lock; /* protect updating of act_state */
485 u8 act_state; /* from XPC HB viewpoint */ 521 u8 act_state; /* from XPC HB viewpoint */
486 u8 remote_vars_version; /* version# of partition's vars */
487 enum xp_retval reason; /* reason partition is deactivating */ 522 enum xp_retval reason; /* reason partition is deactivating */
488 int reason_line; /* line# deactivation initiated from */ 523 int reason_line; /* line# deactivation initiated from */
489 int reactivate_nasid; /* nasid in partition to reactivate */
490 524
491 unsigned long disengage_request_timeout; /* timeout in jiffies */ 525 unsigned long disengage_timeout; /* timeout in jiffies */
492 struct timer_list disengage_request_timer; 526 struct timer_list disengage_timer;
493 527
494 /* XPC infrastructure referencing and teardown control */ 528 /* XPC infrastructure referencing and teardown control */
495 529
@@ -502,14 +536,6 @@ struct xpc_partition {
502 atomic_t nchannels_engaged; /* #of channels engaged with remote part */ 536 atomic_t nchannels_engaged; /* #of channels engaged with remote part */
503 struct xpc_channel *channels; /* array of channel structures */ 537 struct xpc_channel *channels; /* array of channel structures */
504 538
505 void *local_GPs_base; /* base address of kmalloc'd space */
506 struct xpc_gp *local_GPs; /* local Get/Put values */
507 void *remote_GPs_base; /* base address of kmalloc'd space */
508 struct xpc_gp *remote_GPs; /* copy of remote partition's local */
509 /* Get/Put values */
510 u64 remote_GPs_pa; /* phys address of remote partition's local */
511 /* Get/Put values */
512
513 /* fields used to pass args when opening or closing a channel */ 539 /* fields used to pass args when opening or closing a channel */
514 540
515 void *local_openclose_args_base; /* base address of kmalloc'd space */ 541 void *local_openclose_args_base; /* base address of kmalloc'd space */
@@ -517,19 +543,10 @@ struct xpc_partition {
517 void *remote_openclose_args_base; /* base address of kmalloc'd space */ 543 void *remote_openclose_args_base; /* base address of kmalloc'd space */
518 struct xpc_openclose_args *remote_openclose_args; /* copy of remote's */ 544 struct xpc_openclose_args *remote_openclose_args; /* copy of remote's */
519 /* args */ 545 /* args */
520 u64 remote_openclose_args_pa; /* phys addr of remote's args */
521 546
522 /* IPI sending, receiving and handling related fields */ 547 /* IPI sending, receiving and handling related fields */
523 548
524 int remote_IPI_nasid; /* nasid of where to send IPIs */
525 int remote_IPI_phys_cpuid; /* phys CPU ID of where to send IPIs */
526 AMO_t *remote_IPI_amo_va; /* address of remote IPI AMO_t structure */
527
528 AMO_t *local_IPI_amo_va; /* address of IPI AMO_t structure */
529 u64 local_IPI_amo; /* IPI amo flags yet to be handled */ 549 u64 local_IPI_amo; /* IPI amo flags yet to be handled */
530 char IPI_owner[8]; /* IPI owner's name */
531 struct timer_list dropped_IPI_timer; /* dropped IPI timer */
532
533 spinlock_t IPI_lock; /* IPI handler lock */ 550 spinlock_t IPI_lock; /* IPI handler lock */
534 551
535 /* channel manager related fields */ 552 /* channel manager related fields */
@@ -537,6 +554,11 @@ struct xpc_partition {
537 atomic_t channel_mgr_requests; /* #of requests to activate chan mgr */ 554 atomic_t channel_mgr_requests; /* #of requests to activate chan mgr */
538 wait_queue_head_t channel_mgr_wq; /* channel mgr's wait queue */ 555 wait_queue_head_t channel_mgr_wq; /* channel mgr's wait queue */
539 556
557 union {
558 struct xpc_partition_sn2 sn2;
559 struct xpc_partition_uv uv;
560 } sn;
561
540} ____cacheline_aligned; 562} ____cacheline_aligned;
541 563
542/* struct xpc_partition act_state values (for XPC HB) */ 564/* struct xpc_partition act_state values (for XPC HB) */
@@ -565,10 +587,10 @@ struct xpc_partition {
565#define XPC_P_DROPPED_IPI_WAIT_INTERVAL (0.25 * HZ) 587#define XPC_P_DROPPED_IPI_WAIT_INTERVAL (0.25 * HZ)
566 588
567/* number of seconds to wait for other partitions to disengage */ 589/* number of seconds to wait for other partitions to disengage */
568#define XPC_DISENGAGE_REQUEST_DEFAULT_TIMELIMIT 90 590#define XPC_DISENGAGE_DEFAULT_TIMELIMIT 90
569 591
570/* interval in seconds to print 'waiting disengagement' messages */ 592/* interval in seconds to print 'waiting deactivation' messages */
571#define XPC_DISENGAGE_PRINTMSG_INTERVAL 10 593#define XPC_DEACTIVATE_PRINTMSG_INTERVAL 10
572 594
573#define XPC_PARTID(_p) ((short)((_p) - &xpc_partitions[0])) 595#define XPC_PARTID(_p) ((short)((_p) - &xpc_partitions[0]))
574 596
@@ -578,13 +600,11 @@ extern struct xpc_registration xpc_registrations[];
578/* found in xpc_main.c */ 600/* found in xpc_main.c */
579extern struct device *xpc_part; 601extern struct device *xpc_part;
580extern struct device *xpc_chan; 602extern struct device *xpc_chan;
581extern int xpc_disengage_request_timelimit; 603extern int xpc_disengage_timelimit;
582extern int xpc_disengage_request_timedout; 604extern int xpc_disengage_timedout;
583extern atomic_t xpc_activate_IRQ_rcvd; 605extern atomic_t xpc_activate_IRQ_rcvd;
584extern wait_queue_head_t xpc_activate_IRQ_wq; 606extern wait_queue_head_t xpc_activate_IRQ_wq;
585extern void *xpc_heartbeating_to_mask; 607extern void *xpc_heartbeating_to_mask;
586extern irqreturn_t xpc_notify_IRQ_handler(int, void *);
587extern void xpc_dropped_IPI_check(struct xpc_partition *);
588extern void xpc_activate_partition(struct xpc_partition *); 608extern void xpc_activate_partition(struct xpc_partition *);
589extern void xpc_activate_kthreads(struct xpc_channel *, int); 609extern void xpc_activate_kthreads(struct xpc_channel *, int);
590extern void xpc_create_kthreads(struct xpc_channel *, int, int); 610extern void xpc_create_kthreads(struct xpc_channel *, int, int);
@@ -598,31 +618,34 @@ extern void (*xpc_online_heartbeat) (void);
598extern void (*xpc_check_remote_hb) (void); 618extern void (*xpc_check_remote_hb) (void);
599extern enum xp_retval (*xpc_make_first_contact) (struct xpc_partition *); 619extern enum xp_retval (*xpc_make_first_contact) (struct xpc_partition *);
600extern u64 (*xpc_get_IPI_flags) (struct xpc_partition *); 620extern u64 (*xpc_get_IPI_flags) (struct xpc_partition *);
621extern void (*xpc_notify_senders_of_disconnect) (struct xpc_channel *);
622extern void (*xpc_process_msg_IPI) (struct xpc_partition *, int);
623extern int (*xpc_n_of_deliverable_msgs) (struct xpc_channel *);
601extern struct xpc_msg *(*xpc_get_deliverable_msg) (struct xpc_channel *); 624extern struct xpc_msg *(*xpc_get_deliverable_msg) (struct xpc_channel *);
602extern void (*xpc_initiate_partition_activation) (struct xpc_rsvd_page *, u64, 625extern void (*xpc_request_partition_activation) (struct xpc_rsvd_page *, u64,
603 int); 626 int);
627extern void (*xpc_request_partition_reactivation) (struct xpc_partition *);
628extern void (*xpc_request_partition_deactivation) (struct xpc_partition *);
629extern void (*xpc_cancel_partition_deactivation_request) (
630 struct xpc_partition *);
604extern void (*xpc_process_activate_IRQ_rcvd) (int); 631extern void (*xpc_process_activate_IRQ_rcvd) (int);
605extern enum xp_retval (*xpc_setup_infrastructure) (struct xpc_partition *); 632extern enum xp_retval (*xpc_setup_infrastructure) (struct xpc_partition *);
606extern void (*xpc_teardown_infrastructure) (struct xpc_partition *); 633extern void (*xpc_teardown_infrastructure) (struct xpc_partition *);
607extern void (*xpc_mark_partition_engaged) (struct xpc_partition *); 634
608extern void (*xpc_mark_partition_disengaged) (struct xpc_partition *); 635extern void (*xpc_indicate_partition_engaged) (struct xpc_partition *);
609extern void (*xpc_request_partition_disengage) (struct xpc_partition *); 636extern int (*xpc_partition_engaged) (short);
610extern void (*xpc_cancel_partition_disengage_request) (struct xpc_partition *); 637extern int (*xpc_any_partition_engaged) (void);
611extern u64 (*xpc_partition_engaged) (u64); 638extern void (*xpc_indicate_partition_disengaged) (struct xpc_partition *);
612extern u64 (*xpc_partition_disengage_requested) (u64);; 639extern void (*xpc_assume_partition_disengaged) (short);
613extern void (*xpc_clear_partition_engaged) (u64); 640
614extern void (*xpc_clear_partition_disengage_request) (u64); 641extern void (*xpc_send_channel_closerequest) (struct xpc_channel *,
615 642 unsigned long *);
616extern void (*xpc_IPI_send_local_activate) (int); 643extern void (*xpc_send_channel_closereply) (struct xpc_channel *,
617extern void (*xpc_IPI_send_activated) (struct xpc_partition *); 644 unsigned long *);
618extern void (*xpc_IPI_send_local_reactivate) (int); 645extern void (*xpc_send_channel_openrequest) (struct xpc_channel *,
619extern void (*xpc_IPI_send_disengage) (struct xpc_partition *); 646 unsigned long *);
620 647extern void (*xpc_send_channel_openreply) (struct xpc_channel *,
621extern void (*xpc_IPI_send_closerequest) (struct xpc_channel *, 648 unsigned long *);
622 unsigned long *);
623extern void (*xpc_IPI_send_closereply) (struct xpc_channel *, unsigned long *);
624extern void (*xpc_IPI_send_openrequest) (struct xpc_channel *, unsigned long *);
625extern void (*xpc_IPI_send_openreply) (struct xpc_channel *, unsigned long *);
626 649
627extern enum xp_retval (*xpc_send_msg) (struct xpc_channel *, u32, void *, u16, 650extern enum xp_retval (*xpc_send_msg) (struct xpc_channel *, u32, void *, u16,
628 u8, xpc_notify_func, void *); 651 u8, xpc_notify_func, void *);
@@ -646,8 +669,6 @@ extern char *xpc_remote_copy_buffer;
646extern void *xpc_remote_copy_buffer_base; 669extern void *xpc_remote_copy_buffer_base;
647extern void *xpc_kmalloc_cacheline_aligned(size_t, gfp_t, void **); 670extern void *xpc_kmalloc_cacheline_aligned(size_t, gfp_t, void **);
648extern struct xpc_rsvd_page *xpc_setup_rsvd_page(void); 671extern struct xpc_rsvd_page *xpc_setup_rsvd_page(void);
649extern void xpc_allow_IPI_ops(void);
650extern void xpc_restrict_IPI_ops(void);
651extern int xpc_identify_activate_IRQ_sender(void); 672extern int xpc_identify_activate_IRQ_sender(void);
652extern int xpc_partition_disengaged(struct xpc_partition *); 673extern int xpc_partition_disengaged(struct xpc_partition *);
653extern enum xp_retval xpc_mark_partition_active(struct xpc_partition *); 674extern enum xp_retval xpc_mark_partition_active(struct xpc_partition *);