diff options
author | Ingo Molnar <mingo@elte.hu> | 2009-05-07 05:17:13 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-05-07 05:17:34 -0400 |
commit | 44347d947f628060b92449702071bfe1d31dfb75 (patch) | |
tree | c6ed74610d5b3295df4296659f80f5feb94b28cc /drivers/misc/sgi-xp | |
parent | d94fc523f3c35bd8013f04827e94756cbc0212f4 (diff) | |
parent | 413f81eba35d6ede9289b0c8a920c013a84fac71 (diff) |
Merge branch 'linus' into tracing/core
Merge reason: tracing/core was on a .30-rc1 base and was missing out on
on a handful of tracing fixes present in .30-rc5-almost.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'drivers/misc/sgi-xp')
-rw-r--r-- | drivers/misc/sgi-xp/xp_main.c | 12 | ||||
-rw-r--r-- | drivers/misc/sgi-xp/xpc.h | 254 | ||||
-rw-r--r-- | drivers/misc/sgi-xp/xpc_channel.c | 138 | ||||
-rw-r--r-- | drivers/misc/sgi-xp/xpc_main.c | 128 | ||||
-rw-r--r-- | drivers/misc/sgi-xp/xpc_partition.c | 20 | ||||
-rw-r--r-- | drivers/misc/sgi-xp/xpc_sn2.c | 164 | ||||
-rw-r--r-- | drivers/misc/sgi-xp/xpc_uv.c | 257 |
7 files changed, 483 insertions, 490 deletions
diff --git a/drivers/misc/sgi-xp/xp_main.c b/drivers/misc/sgi-xp/xp_main.c index 16f8dcab2da4..7896849b16dc 100644 --- a/drivers/misc/sgi-xp/xp_main.c +++ b/drivers/misc/sgi-xp/xp_main.c | |||
@@ -248,19 +248,19 @@ xp_init(void) | |||
248 | enum xp_retval ret; | 248 | enum xp_retval ret; |
249 | int ch_number; | 249 | int ch_number; |
250 | 250 | ||
251 | /* initialize the connection registration mutex */ | ||
252 | for (ch_number = 0; ch_number < XPC_MAX_NCHANNELS; ch_number++) | ||
253 | mutex_init(&xpc_registrations[ch_number].mutex); | ||
254 | |||
251 | if (is_shub()) | 255 | if (is_shub()) |
252 | ret = xp_init_sn2(); | 256 | ret = xp_init_sn2(); |
253 | else if (is_uv()) | 257 | else if (is_uv()) |
254 | ret = xp_init_uv(); | 258 | ret = xp_init_uv(); |
255 | else | 259 | else |
256 | ret = xpUnsupported; | 260 | ret = 0; |
257 | 261 | ||
258 | if (ret != xpSuccess) | 262 | if (ret != xpSuccess) |
259 | return -ENODEV; | 263 | return ret; |
260 | |||
261 | /* initialize the connection registration mutex */ | ||
262 | for (ch_number = 0; ch_number < XPC_MAX_NCHANNELS; ch_number++) | ||
263 | mutex_init(&xpc_registrations[ch_number].mutex); | ||
264 | 264 | ||
265 | return 0; | 265 | return 0; |
266 | } | 266 | } |
diff --git a/drivers/misc/sgi-xp/xpc.h b/drivers/misc/sgi-xp/xpc.h index 114444cfd496..b94d5f767703 100644 --- a/drivers/misc/sgi-xp/xpc.h +++ b/drivers/misc/sgi-xp/xpc.h | |||
@@ -90,18 +90,21 @@ struct xpc_rsvd_page { | |||
90 | short max_npartitions; /* value of XPC_MAX_PARTITIONS */ | 90 | short max_npartitions; /* value of XPC_MAX_PARTITIONS */ |
91 | u8 version; | 91 | u8 version; |
92 | u8 pad1[3]; /* align to next u64 in 1st 64-byte cacheline */ | 92 | u8 pad1[3]; /* align to next u64 in 1st 64-byte cacheline */ |
93 | unsigned long ts_jiffies; /* timestamp when rsvd pg was setup by XPC */ | ||
93 | union { | 94 | union { |
94 | unsigned long vars_pa; /* phys address of struct xpc_vars */ | 95 | struct { |
95 | unsigned long activate_gru_mq_desc_gpa; /* phys addr of */ | 96 | unsigned long vars_pa; /* phys addr */ |
96 | /* activate mq's */ | 97 | } sn2; |
97 | /* gru mq descriptor */ | 98 | struct { |
99 | unsigned long heartbeat_gpa; /* phys addr */ | ||
100 | unsigned long activate_gru_mq_desc_gpa; /* phys addr */ | ||
101 | } uv; | ||
98 | } sn; | 102 | } sn; |
99 | unsigned long ts_jiffies; /* timestamp when rsvd pg was setup by XPC */ | 103 | u64 pad2[9]; /* align to last u64 in 2nd 64-byte cacheline */ |
100 | u64 pad2[10]; /* align to last u64 in 2nd 64-byte cacheline */ | ||
101 | u64 SAL_nasids_size; /* SAL: size of each nasid mask in bytes */ | 104 | u64 SAL_nasids_size; /* SAL: size of each nasid mask in bytes */ |
102 | }; | 105 | }; |
103 | 106 | ||
104 | #define XPC_RP_VERSION _XPC_VERSION(2, 0) /* version 2.0 of the reserved page */ | 107 | #define XPC_RP_VERSION _XPC_VERSION(3, 0) /* version 3.0 of the reserved page */ |
105 | 108 | ||
106 | /* | 109 | /* |
107 | * Define the structures by which XPC variables can be exported to other | 110 | * Define the structures by which XPC variables can be exported to other |
@@ -182,6 +185,17 @@ struct xpc_vars_part_sn2 { | |||
182 | (XPC_RP_MACH_NASIDS(_rp) + \ | 185 | (XPC_RP_MACH_NASIDS(_rp) + \ |
183 | xpc_nasid_mask_nlongs)) | 186 | xpc_nasid_mask_nlongs)) |
184 | 187 | ||
188 | |||
189 | /* | ||
190 | * The following structure describes the partition's heartbeat info which | ||
191 | * will be periodically read by other partitions to determine whether this | ||
192 | * XPC is still 'alive'. | ||
193 | */ | ||
194 | struct xpc_heartbeat_uv { | ||
195 | unsigned long value; | ||
196 | unsigned long offline; /* if 0, heartbeat should be changing */ | ||
197 | }; | ||
198 | |||
185 | /* | 199 | /* |
186 | * Info pertinent to a GRU message queue using a watch list for irq generation. | 200 | * Info pertinent to a GRU message queue using a watch list for irq generation. |
187 | */ | 201 | */ |
@@ -198,7 +212,7 @@ struct xpc_gru_mq_uv { | |||
198 | 212 | ||
199 | /* | 213 | /* |
200 | * The activate_mq is used to send/receive GRU messages that affect XPC's | 214 | * The activate_mq is used to send/receive GRU messages that affect XPC's |
201 | * heartbeat, partition active state, and channel state. This is UV only. | 215 | * partition active state and channel state. This is uv only. |
202 | */ | 216 | */ |
203 | struct xpc_activate_mq_msghdr_uv { | 217 | struct xpc_activate_mq_msghdr_uv { |
204 | unsigned int gru_msg_hdr; /* FOR GRU INTERNAL USE ONLY */ | 218 | unsigned int gru_msg_hdr; /* FOR GRU INTERNAL USE ONLY */ |
@@ -210,33 +224,27 @@ struct xpc_activate_mq_msghdr_uv { | |||
210 | 224 | ||
211 | /* activate_mq defined message types */ | 225 | /* activate_mq defined message types */ |
212 | #define XPC_ACTIVATE_MQ_MSG_SYNC_ACT_STATE_UV 0 | 226 | #define XPC_ACTIVATE_MQ_MSG_SYNC_ACT_STATE_UV 0 |
213 | #define XPC_ACTIVATE_MQ_MSG_INC_HEARTBEAT_UV 1 | ||
214 | #define XPC_ACTIVATE_MQ_MSG_OFFLINE_HEARTBEAT_UV 2 | ||
215 | #define XPC_ACTIVATE_MQ_MSG_ONLINE_HEARTBEAT_UV 3 | ||
216 | 227 | ||
217 | #define XPC_ACTIVATE_MQ_MSG_ACTIVATE_REQ_UV 4 | 228 | #define XPC_ACTIVATE_MQ_MSG_ACTIVATE_REQ_UV 1 |
218 | #define XPC_ACTIVATE_MQ_MSG_DEACTIVATE_REQ_UV 5 | 229 | #define XPC_ACTIVATE_MQ_MSG_DEACTIVATE_REQ_UV 2 |
219 | 230 | ||
220 | #define XPC_ACTIVATE_MQ_MSG_CHCTL_CLOSEREQUEST_UV 6 | 231 | #define XPC_ACTIVATE_MQ_MSG_CHCTL_CLOSEREQUEST_UV 3 |
221 | #define XPC_ACTIVATE_MQ_MSG_CHCTL_CLOSEREPLY_UV 7 | 232 | #define XPC_ACTIVATE_MQ_MSG_CHCTL_CLOSEREPLY_UV 4 |
222 | #define XPC_ACTIVATE_MQ_MSG_CHCTL_OPENREQUEST_UV 8 | 233 | #define XPC_ACTIVATE_MQ_MSG_CHCTL_OPENREQUEST_UV 5 |
223 | #define XPC_ACTIVATE_MQ_MSG_CHCTL_OPENREPLY_UV 9 | 234 | #define XPC_ACTIVATE_MQ_MSG_CHCTL_OPENREPLY_UV 6 |
235 | #define XPC_ACTIVATE_MQ_MSG_CHCTL_OPENCOMPLETE_UV 7 | ||
224 | 236 | ||
225 | #define XPC_ACTIVATE_MQ_MSG_MARK_ENGAGED_UV 10 | 237 | #define XPC_ACTIVATE_MQ_MSG_MARK_ENGAGED_UV 8 |
226 | #define XPC_ACTIVATE_MQ_MSG_MARK_DISENGAGED_UV 11 | 238 | #define XPC_ACTIVATE_MQ_MSG_MARK_DISENGAGED_UV 9 |
227 | 239 | ||
228 | struct xpc_activate_mq_msg_uv { | 240 | struct xpc_activate_mq_msg_uv { |
229 | struct xpc_activate_mq_msghdr_uv hdr; | 241 | struct xpc_activate_mq_msghdr_uv hdr; |
230 | }; | 242 | }; |
231 | 243 | ||
232 | struct xpc_activate_mq_msg_heartbeat_req_uv { | ||
233 | struct xpc_activate_mq_msghdr_uv hdr; | ||
234 | u64 heartbeat; | ||
235 | }; | ||
236 | |||
237 | struct xpc_activate_mq_msg_activate_req_uv { | 244 | struct xpc_activate_mq_msg_activate_req_uv { |
238 | struct xpc_activate_mq_msghdr_uv hdr; | 245 | struct xpc_activate_mq_msghdr_uv hdr; |
239 | unsigned long rp_gpa; | 246 | unsigned long rp_gpa; |
247 | unsigned long heartbeat_gpa; | ||
240 | unsigned long activate_gru_mq_desc_gpa; | 248 | unsigned long activate_gru_mq_desc_gpa; |
241 | }; | 249 | }; |
242 | 250 | ||
@@ -271,6 +279,11 @@ struct xpc_activate_mq_msg_chctl_openreply_uv { | |||
271 | unsigned long notify_gru_mq_desc_gpa; | 279 | unsigned long notify_gru_mq_desc_gpa; |
272 | }; | 280 | }; |
273 | 281 | ||
282 | struct xpc_activate_mq_msg_chctl_opencomplete_uv { | ||
283 | struct xpc_activate_mq_msghdr_uv hdr; | ||
284 | short ch_number; | ||
285 | }; | ||
286 | |||
274 | /* | 287 | /* |
275 | * Functions registered by add_timer() or called by kernel_thread() only | 288 | * Functions registered by add_timer() or called by kernel_thread() only |
276 | * allow for a single 64-bit argument. The following macros can be used to | 289 | * allow for a single 64-bit argument. The following macros can be used to |
@@ -576,30 +589,32 @@ struct xpc_channel { | |||
576 | 589 | ||
577 | #define XPC_C_WASCONNECTED 0x00000001 /* channel was connected */ | 590 | #define XPC_C_WASCONNECTED 0x00000001 /* channel was connected */ |
578 | 591 | ||
579 | #define XPC_C_ROPENREPLY 0x00000002 /* remote open channel reply */ | 592 | #define XPC_C_ROPENCOMPLETE 0x00000002 /* remote open channel complete */ |
580 | #define XPC_C_OPENREPLY 0x00000004 /* local open channel reply */ | 593 | #define XPC_C_OPENCOMPLETE 0x00000004 /* local open channel complete */ |
581 | #define XPC_C_ROPENREQUEST 0x00000008 /* remote open channel request */ | 594 | #define XPC_C_ROPENREPLY 0x00000008 /* remote open channel reply */ |
582 | #define XPC_C_OPENREQUEST 0x00000010 /* local open channel request */ | 595 | #define XPC_C_OPENREPLY 0x00000010 /* local open channel reply */ |
596 | #define XPC_C_ROPENREQUEST 0x00000020 /* remote open channel request */ | ||
597 | #define XPC_C_OPENREQUEST 0x00000040 /* local open channel request */ | ||
583 | 598 | ||
584 | #define XPC_C_SETUP 0x00000020 /* channel's msgqueues are alloc'd */ | 599 | #define XPC_C_SETUP 0x00000080 /* channel's msgqueues are alloc'd */ |
585 | #define XPC_C_CONNECTEDCALLOUT 0x00000040 /* connected callout initiated */ | 600 | #define XPC_C_CONNECTEDCALLOUT 0x00000100 /* connected callout initiated */ |
586 | #define XPC_C_CONNECTEDCALLOUT_MADE \ | 601 | #define XPC_C_CONNECTEDCALLOUT_MADE \ |
587 | 0x00000080 /* connected callout completed */ | 602 | 0x00000200 /* connected callout completed */ |
588 | #define XPC_C_CONNECTED 0x00000100 /* local channel is connected */ | 603 | #define XPC_C_CONNECTED 0x00000400 /* local channel is connected */ |
589 | #define XPC_C_CONNECTING 0x00000200 /* channel is being connected */ | 604 | #define XPC_C_CONNECTING 0x00000800 /* channel is being connected */ |
590 | 605 | ||
591 | #define XPC_C_RCLOSEREPLY 0x00000400 /* remote close channel reply */ | 606 | #define XPC_C_RCLOSEREPLY 0x00001000 /* remote close channel reply */ |
592 | #define XPC_C_CLOSEREPLY 0x00000800 /* local close channel reply */ | 607 | #define XPC_C_CLOSEREPLY 0x00002000 /* local close channel reply */ |
593 | #define XPC_C_RCLOSEREQUEST 0x00001000 /* remote close channel request */ | 608 | #define XPC_C_RCLOSEREQUEST 0x00004000 /* remote close channel request */ |
594 | #define XPC_C_CLOSEREQUEST 0x00002000 /* local close channel request */ | 609 | #define XPC_C_CLOSEREQUEST 0x00008000 /* local close channel request */ |
595 | 610 | ||
596 | #define XPC_C_DISCONNECTED 0x00004000 /* channel is disconnected */ | 611 | #define XPC_C_DISCONNECTED 0x00010000 /* channel is disconnected */ |
597 | #define XPC_C_DISCONNECTING 0x00008000 /* channel is being disconnected */ | 612 | #define XPC_C_DISCONNECTING 0x00020000 /* channel is being disconnected */ |
598 | #define XPC_C_DISCONNECTINGCALLOUT \ | 613 | #define XPC_C_DISCONNECTINGCALLOUT \ |
599 | 0x00010000 /* disconnecting callout initiated */ | 614 | 0x00040000 /* disconnecting callout initiated */ |
600 | #define XPC_C_DISCONNECTINGCALLOUT_MADE \ | 615 | #define XPC_C_DISCONNECTINGCALLOUT_MADE \ |
601 | 0x00020000 /* disconnecting callout completed */ | 616 | 0x00080000 /* disconnecting callout completed */ |
602 | #define XPC_C_WDISCONNECT 0x00040000 /* waiting for channel disconnect */ | 617 | #define XPC_C_WDISCONNECT 0x00100000 /* waiting for channel disconnect */ |
603 | 618 | ||
604 | /* | 619 | /* |
605 | * The channel control flags (chctl) union consists of a 64-bit variable which | 620 | * The channel control flags (chctl) union consists of a 64-bit variable which |
@@ -618,11 +633,13 @@ union xpc_channel_ctl_flags { | |||
618 | #define XPC_CHCTL_CLOSEREPLY 0x02 | 633 | #define XPC_CHCTL_CLOSEREPLY 0x02 |
619 | #define XPC_CHCTL_OPENREQUEST 0x04 | 634 | #define XPC_CHCTL_OPENREQUEST 0x04 |
620 | #define XPC_CHCTL_OPENREPLY 0x08 | 635 | #define XPC_CHCTL_OPENREPLY 0x08 |
621 | #define XPC_CHCTL_MSGREQUEST 0x10 | 636 | #define XPC_CHCTL_OPENCOMPLETE 0x10 |
637 | #define XPC_CHCTL_MSGREQUEST 0x20 | ||
622 | 638 | ||
623 | #define XPC_OPENCLOSE_CHCTL_FLAGS \ | 639 | #define XPC_OPENCLOSE_CHCTL_FLAGS \ |
624 | (XPC_CHCTL_CLOSEREQUEST | XPC_CHCTL_CLOSEREPLY | \ | 640 | (XPC_CHCTL_CLOSEREQUEST | XPC_CHCTL_CLOSEREPLY | \ |
625 | XPC_CHCTL_OPENREQUEST | XPC_CHCTL_OPENREPLY) | 641 | XPC_CHCTL_OPENREQUEST | XPC_CHCTL_OPENREPLY | \ |
642 | XPC_CHCTL_OPENCOMPLETE) | ||
626 | #define XPC_MSG_CHCTL_FLAGS XPC_CHCTL_MSGREQUEST | 643 | #define XPC_MSG_CHCTL_FLAGS XPC_CHCTL_MSGREQUEST |
627 | 644 | ||
628 | static inline int | 645 | static inline int |
@@ -687,6 +704,9 @@ struct xpc_partition_sn2 { | |||
687 | }; | 704 | }; |
688 | 705 | ||
689 | struct xpc_partition_uv { | 706 | struct xpc_partition_uv { |
707 | unsigned long heartbeat_gpa; /* phys addr of partition's heartbeat */ | ||
708 | struct xpc_heartbeat_uv cached_heartbeat; /* cached copy of */ | ||
709 | /* partition's heartbeat */ | ||
690 | unsigned long activate_gru_mq_desc_gpa; /* phys addr of parititon's */ | 710 | unsigned long activate_gru_mq_desc_gpa; /* phys addr of parititon's */ |
691 | /* activate mq's gru mq */ | 711 | /* activate mq's gru mq */ |
692 | /* descriptor */ | 712 | /* descriptor */ |
@@ -698,14 +718,12 @@ struct xpc_partition_uv { | |||
698 | u8 remote_act_state; /* remote partition's act_state */ | 718 | u8 remote_act_state; /* remote partition's act_state */ |
699 | u8 act_state_req; /* act_state request from remote partition */ | 719 | u8 act_state_req; /* act_state request from remote partition */ |
700 | enum xp_retval reason; /* reason for deactivate act_state request */ | 720 | enum xp_retval reason; /* reason for deactivate act_state request */ |
701 | u64 heartbeat; /* incremented by remote partition */ | ||
702 | }; | 721 | }; |
703 | 722 | ||
704 | /* struct xpc_partition_uv flags */ | 723 | /* struct xpc_partition_uv flags */ |
705 | 724 | ||
706 | #define XPC_P_HEARTBEAT_OFFLINE_UV 0x00000001 | 725 | #define XPC_P_CACHED_ACTIVATE_GRU_MQ_DESC_UV 0x00000001 |
707 | #define XPC_P_ENGAGED_UV 0x00000002 | 726 | #define XPC_P_ENGAGED_UV 0x00000002 |
708 | #define XPC_P_CACHED_ACTIVATE_GRU_MQ_DESC_UV 0x00000004 | ||
709 | 727 | ||
710 | /* struct xpc_partition_uv act_state change requests */ | 728 | /* struct xpc_partition_uv act_state change requests */ |
711 | 729 | ||
@@ -762,6 +780,62 @@ struct xpc_partition { | |||
762 | 780 | ||
763 | } ____cacheline_aligned; | 781 | } ____cacheline_aligned; |
764 | 782 | ||
783 | struct xpc_arch_operations { | ||
784 | int (*setup_partitions) (void); | ||
785 | void (*teardown_partitions) (void); | ||
786 | void (*process_activate_IRQ_rcvd) (void); | ||
787 | enum xp_retval (*get_partition_rsvd_page_pa) | ||
788 | (void *, u64 *, unsigned long *, size_t *); | ||
789 | int (*setup_rsvd_page) (struct xpc_rsvd_page *); | ||
790 | |||
791 | void (*allow_hb) (short); | ||
792 | void (*disallow_hb) (short); | ||
793 | void (*disallow_all_hbs) (void); | ||
794 | void (*increment_heartbeat) (void); | ||
795 | void (*offline_heartbeat) (void); | ||
796 | void (*online_heartbeat) (void); | ||
797 | void (*heartbeat_init) (void); | ||
798 | void (*heartbeat_exit) (void); | ||
799 | enum xp_retval (*get_remote_heartbeat) (struct xpc_partition *); | ||
800 | |||
801 | void (*request_partition_activation) (struct xpc_rsvd_page *, | ||
802 | unsigned long, int); | ||
803 | void (*request_partition_reactivation) (struct xpc_partition *); | ||
804 | void (*request_partition_deactivation) (struct xpc_partition *); | ||
805 | void (*cancel_partition_deactivation_request) (struct xpc_partition *); | ||
806 | enum xp_retval (*setup_ch_structures) (struct xpc_partition *); | ||
807 | void (*teardown_ch_structures) (struct xpc_partition *); | ||
808 | |||
809 | enum xp_retval (*make_first_contact) (struct xpc_partition *); | ||
810 | |||
811 | u64 (*get_chctl_all_flags) (struct xpc_partition *); | ||
812 | void (*send_chctl_closerequest) (struct xpc_channel *, unsigned long *); | ||
813 | void (*send_chctl_closereply) (struct xpc_channel *, unsigned long *); | ||
814 | void (*send_chctl_openrequest) (struct xpc_channel *, unsigned long *); | ||
815 | void (*send_chctl_openreply) (struct xpc_channel *, unsigned long *); | ||
816 | void (*send_chctl_opencomplete) (struct xpc_channel *, unsigned long *); | ||
817 | void (*process_msg_chctl_flags) (struct xpc_partition *, int); | ||
818 | |||
819 | enum xp_retval (*save_remote_msgqueue_pa) (struct xpc_channel *, | ||
820 | unsigned long); | ||
821 | |||
822 | enum xp_retval (*setup_msg_structures) (struct xpc_channel *); | ||
823 | void (*teardown_msg_structures) (struct xpc_channel *); | ||
824 | |||
825 | void (*indicate_partition_engaged) (struct xpc_partition *); | ||
826 | void (*indicate_partition_disengaged) (struct xpc_partition *); | ||
827 | void (*assume_partition_disengaged) (short); | ||
828 | int (*partition_engaged) (short); | ||
829 | int (*any_partition_engaged) (void); | ||
830 | |||
831 | int (*n_of_deliverable_payloads) (struct xpc_channel *); | ||
832 | enum xp_retval (*send_payload) (struct xpc_channel *, u32, void *, | ||
833 | u16, u8, xpc_notify_func, void *); | ||
834 | void *(*get_deliverable_payload) (struct xpc_channel *); | ||
835 | void (*received_payload) (struct xpc_channel *, void *); | ||
836 | void (*notify_senders_of_disconnect) (struct xpc_channel *); | ||
837 | }; | ||
838 | |||
765 | /* struct xpc_partition act_state values (for XPC HB) */ | 839 | /* struct xpc_partition act_state values (for XPC HB) */ |
766 | 840 | ||
767 | #define XPC_P_AS_INACTIVE 0x00 /* partition is not active */ | 841 | #define XPC_P_AS_INACTIVE 0x00 /* partition is not active */ |
@@ -802,67 +876,17 @@ extern struct xpc_registration xpc_registrations[]; | |||
802 | /* found in xpc_main.c */ | 876 | /* found in xpc_main.c */ |
803 | extern struct device *xpc_part; | 877 | extern struct device *xpc_part; |
804 | extern struct device *xpc_chan; | 878 | extern struct device *xpc_chan; |
879 | extern struct xpc_arch_operations xpc_arch_ops; | ||
805 | extern int xpc_disengage_timelimit; | 880 | extern int xpc_disengage_timelimit; |
806 | extern int xpc_disengage_timedout; | 881 | extern int xpc_disengage_timedout; |
807 | extern int xpc_activate_IRQ_rcvd; | 882 | extern int xpc_activate_IRQ_rcvd; |
808 | extern spinlock_t xpc_activate_IRQ_rcvd_lock; | 883 | extern spinlock_t xpc_activate_IRQ_rcvd_lock; |
809 | extern wait_queue_head_t xpc_activate_IRQ_wq; | 884 | extern wait_queue_head_t xpc_activate_IRQ_wq; |
810 | extern void *xpc_heartbeating_to_mask; | ||
811 | extern void *xpc_kzalloc_cacheline_aligned(size_t, gfp_t, void **); | 885 | extern void *xpc_kzalloc_cacheline_aligned(size_t, gfp_t, void **); |
812 | extern void xpc_activate_partition(struct xpc_partition *); | 886 | extern void xpc_activate_partition(struct xpc_partition *); |
813 | extern void xpc_activate_kthreads(struct xpc_channel *, int); | 887 | extern void xpc_activate_kthreads(struct xpc_channel *, int); |
814 | extern void xpc_create_kthreads(struct xpc_channel *, int, int); | 888 | extern void xpc_create_kthreads(struct xpc_channel *, int, int); |
815 | extern void xpc_disconnect_wait(int); | 889 | extern void xpc_disconnect_wait(int); |
816 | extern int (*xpc_setup_partitions_sn) (void); | ||
817 | extern void (*xpc_teardown_partitions_sn) (void); | ||
818 | extern enum xp_retval (*xpc_get_partition_rsvd_page_pa) (void *, u64 *, | ||
819 | unsigned long *, | ||
820 | size_t *); | ||
821 | extern int (*xpc_setup_rsvd_page_sn) (struct xpc_rsvd_page *); | ||
822 | extern void (*xpc_heartbeat_init) (void); | ||
823 | extern void (*xpc_heartbeat_exit) (void); | ||
824 | extern void (*xpc_increment_heartbeat) (void); | ||
825 | extern void (*xpc_offline_heartbeat) (void); | ||
826 | extern void (*xpc_online_heartbeat) (void); | ||
827 | extern enum xp_retval (*xpc_get_remote_heartbeat) (struct xpc_partition *); | ||
828 | extern enum xp_retval (*xpc_make_first_contact) (struct xpc_partition *); | ||
829 | extern u64 (*xpc_get_chctl_all_flags) (struct xpc_partition *); | ||
830 | extern enum xp_retval (*xpc_setup_msg_structures) (struct xpc_channel *); | ||
831 | extern void (*xpc_teardown_msg_structures) (struct xpc_channel *); | ||
832 | extern void (*xpc_notify_senders_of_disconnect) (struct xpc_channel *); | ||
833 | extern void (*xpc_process_msg_chctl_flags) (struct xpc_partition *, int); | ||
834 | extern int (*xpc_n_of_deliverable_payloads) (struct xpc_channel *); | ||
835 | extern void *(*xpc_get_deliverable_payload) (struct xpc_channel *); | ||
836 | extern void (*xpc_request_partition_activation) (struct xpc_rsvd_page *, | ||
837 | unsigned long, int); | ||
838 | extern void (*xpc_request_partition_reactivation) (struct xpc_partition *); | ||
839 | extern void (*xpc_request_partition_deactivation) (struct xpc_partition *); | ||
840 | extern void (*xpc_cancel_partition_deactivation_request) ( | ||
841 | struct xpc_partition *); | ||
842 | extern void (*xpc_process_activate_IRQ_rcvd) (void); | ||
843 | extern enum xp_retval (*xpc_setup_ch_structures_sn) (struct xpc_partition *); | ||
844 | extern void (*xpc_teardown_ch_structures_sn) (struct xpc_partition *); | ||
845 | |||
846 | extern void (*xpc_indicate_partition_engaged) (struct xpc_partition *); | ||
847 | extern int (*xpc_partition_engaged) (short); | ||
848 | extern int (*xpc_any_partition_engaged) (void); | ||
849 | extern void (*xpc_indicate_partition_disengaged) (struct xpc_partition *); | ||
850 | extern void (*xpc_assume_partition_disengaged) (short); | ||
851 | |||
852 | extern void (*xpc_send_chctl_closerequest) (struct xpc_channel *, | ||
853 | unsigned long *); | ||
854 | extern void (*xpc_send_chctl_closereply) (struct xpc_channel *, | ||
855 | unsigned long *); | ||
856 | extern void (*xpc_send_chctl_openrequest) (struct xpc_channel *, | ||
857 | unsigned long *); | ||
858 | extern void (*xpc_send_chctl_openreply) (struct xpc_channel *, unsigned long *); | ||
859 | |||
860 | extern enum xp_retval (*xpc_save_remote_msgqueue_pa) (struct xpc_channel *, | ||
861 | unsigned long); | ||
862 | |||
863 | extern enum xp_retval (*xpc_send_payload) (struct xpc_channel *, u32, void *, | ||
864 | u16, u8, xpc_notify_func, void *); | ||
865 | extern void (*xpc_received_payload) (struct xpc_channel *, void *); | ||
866 | 890 | ||
867 | /* found in xpc_sn2.c */ | 891 | /* found in xpc_sn2.c */ |
868 | extern int xpc_init_sn2(void); | 892 | extern int xpc_init_sn2(void); |
@@ -909,40 +933,6 @@ extern void xpc_disconnect_channel(const int, struct xpc_channel *, | |||
909 | extern void xpc_disconnect_callout(struct xpc_channel *, enum xp_retval); | 933 | extern void xpc_disconnect_callout(struct xpc_channel *, enum xp_retval); |
910 | extern void xpc_partition_going_down(struct xpc_partition *, enum xp_retval); | 934 | extern void xpc_partition_going_down(struct xpc_partition *, enum xp_retval); |
911 | 935 | ||
912 | static inline int | ||
913 | xpc_hb_allowed(short partid, void *heartbeating_to_mask) | ||
914 | { | ||
915 | return test_bit(partid, heartbeating_to_mask); | ||
916 | } | ||
917 | |||
918 | static inline int | ||
919 | xpc_any_hbs_allowed(void) | ||
920 | { | ||
921 | DBUG_ON(xpc_heartbeating_to_mask == NULL); | ||
922 | return !bitmap_empty(xpc_heartbeating_to_mask, xp_max_npartitions); | ||
923 | } | ||
924 | |||
925 | static inline void | ||
926 | xpc_allow_hb(short partid) | ||
927 | { | ||
928 | DBUG_ON(xpc_heartbeating_to_mask == NULL); | ||
929 | set_bit(partid, xpc_heartbeating_to_mask); | ||
930 | } | ||
931 | |||
932 | static inline void | ||
933 | xpc_disallow_hb(short partid) | ||
934 | { | ||
935 | DBUG_ON(xpc_heartbeating_to_mask == NULL); | ||
936 | clear_bit(partid, xpc_heartbeating_to_mask); | ||
937 | } | ||
938 | |||
939 | static inline void | ||
940 | xpc_disallow_all_hbs(void) | ||
941 | { | ||
942 | DBUG_ON(xpc_heartbeating_to_mask == NULL); | ||
943 | bitmap_zero(xpc_heartbeating_to_mask, xp_max_npartitions); | ||
944 | } | ||
945 | |||
946 | static inline void | 936 | static inline void |
947 | xpc_wakeup_channel_mgr(struct xpc_partition *part) | 937 | xpc_wakeup_channel_mgr(struct xpc_partition *part) |
948 | { | 938 | { |
diff --git a/drivers/misc/sgi-xp/xpc_channel.c b/drivers/misc/sgi-xp/xpc_channel.c index 99a2534c38a1..652593fc486d 100644 --- a/drivers/misc/sgi-xp/xpc_channel.c +++ b/drivers/misc/sgi-xp/xpc_channel.c | |||
@@ -3,7 +3,7 @@ | |||
3 | * License. See the file "COPYING" in the main directory of this archive | 3 | * License. See the file "COPYING" in the main directory of this archive |
4 | * for more details. | 4 | * for more details. |
5 | * | 5 | * |
6 | * Copyright (c) 2004-2008 Silicon Graphics, Inc. All Rights Reserved. | 6 | * Copyright (c) 2004-2009 Silicon Graphics, Inc. All Rights Reserved. |
7 | */ | 7 | */ |
8 | 8 | ||
9 | /* | 9 | /* |
@@ -39,34 +39,38 @@ xpc_process_connect(struct xpc_channel *ch, unsigned long *irq_flags) | |||
39 | 39 | ||
40 | if (!(ch->flags & XPC_C_SETUP)) { | 40 | if (!(ch->flags & XPC_C_SETUP)) { |
41 | spin_unlock_irqrestore(&ch->lock, *irq_flags); | 41 | spin_unlock_irqrestore(&ch->lock, *irq_flags); |
42 | ret = xpc_setup_msg_structures(ch); | 42 | ret = xpc_arch_ops.setup_msg_structures(ch); |
43 | spin_lock_irqsave(&ch->lock, *irq_flags); | 43 | spin_lock_irqsave(&ch->lock, *irq_flags); |
44 | 44 | ||
45 | if (ret != xpSuccess) | 45 | if (ret != xpSuccess) |
46 | XPC_DISCONNECT_CHANNEL(ch, ret, irq_flags); | 46 | XPC_DISCONNECT_CHANNEL(ch, ret, irq_flags); |
47 | else | ||
48 | ch->flags |= XPC_C_SETUP; | ||
47 | 49 | ||
48 | ch->flags |= XPC_C_SETUP; | 50 | if (ch->flags & XPC_C_DISCONNECTING) |
49 | |||
50 | if (ch->flags & (XPC_C_CONNECTED | XPC_C_DISCONNECTING)) | ||
51 | return; | 51 | return; |
52 | } | 52 | } |
53 | 53 | ||
54 | if (!(ch->flags & XPC_C_OPENREPLY)) { | 54 | if (!(ch->flags & XPC_C_OPENREPLY)) { |
55 | ch->flags |= XPC_C_OPENREPLY; | 55 | ch->flags |= XPC_C_OPENREPLY; |
56 | xpc_send_chctl_openreply(ch, irq_flags); | 56 | xpc_arch_ops.send_chctl_openreply(ch, irq_flags); |
57 | } | 57 | } |
58 | 58 | ||
59 | if (!(ch->flags & XPC_C_ROPENREPLY)) | 59 | if (!(ch->flags & XPC_C_ROPENREPLY)) |
60 | return; | 60 | return; |
61 | 61 | ||
62 | ch->flags = (XPC_C_CONNECTED | XPC_C_SETUP); /* clear all else */ | 62 | if (!(ch->flags & XPC_C_OPENCOMPLETE)) { |
63 | ch->flags |= (XPC_C_OPENCOMPLETE | XPC_C_CONNECTED); | ||
64 | xpc_arch_ops.send_chctl_opencomplete(ch, irq_flags); | ||
65 | } | ||
66 | |||
67 | if (!(ch->flags & XPC_C_ROPENCOMPLETE)) | ||
68 | return; | ||
63 | 69 | ||
64 | dev_info(xpc_chan, "channel %d to partition %d connected\n", | 70 | dev_info(xpc_chan, "channel %d to partition %d connected\n", |
65 | ch->number, ch->partid); | 71 | ch->number, ch->partid); |
66 | 72 | ||
67 | spin_unlock_irqrestore(&ch->lock, *irq_flags); | 73 | ch->flags = (XPC_C_CONNECTED | XPC_C_SETUP); /* clear all else */ |
68 | xpc_create_kthreads(ch, 1, 0); | ||
69 | spin_lock_irqsave(&ch->lock, *irq_flags); | ||
70 | } | 74 | } |
71 | 75 | ||
72 | /* | 76 | /* |
@@ -96,7 +100,7 @@ xpc_process_disconnect(struct xpc_channel *ch, unsigned long *irq_flags) | |||
96 | 100 | ||
97 | if (part->act_state == XPC_P_AS_DEACTIVATING) { | 101 | if (part->act_state == XPC_P_AS_DEACTIVATING) { |
98 | /* can't proceed until the other side disengages from us */ | 102 | /* can't proceed until the other side disengages from us */ |
99 | if (xpc_partition_engaged(ch->partid)) | 103 | if (xpc_arch_ops.partition_engaged(ch->partid)) |
100 | return; | 104 | return; |
101 | 105 | ||
102 | } else { | 106 | } else { |
@@ -108,7 +112,7 @@ xpc_process_disconnect(struct xpc_channel *ch, unsigned long *irq_flags) | |||
108 | 112 | ||
109 | if (!(ch->flags & XPC_C_CLOSEREPLY)) { | 113 | if (!(ch->flags & XPC_C_CLOSEREPLY)) { |
110 | ch->flags |= XPC_C_CLOSEREPLY; | 114 | ch->flags |= XPC_C_CLOSEREPLY; |
111 | xpc_send_chctl_closereply(ch, irq_flags); | 115 | xpc_arch_ops.send_chctl_closereply(ch, irq_flags); |
112 | } | 116 | } |
113 | 117 | ||
114 | if (!(ch->flags & XPC_C_RCLOSEREPLY)) | 118 | if (!(ch->flags & XPC_C_RCLOSEREPLY)) |
@@ -118,7 +122,7 @@ xpc_process_disconnect(struct xpc_channel *ch, unsigned long *irq_flags) | |||
118 | /* wake those waiting for notify completion */ | 122 | /* wake those waiting for notify completion */ |
119 | if (atomic_read(&ch->n_to_notify) > 0) { | 123 | if (atomic_read(&ch->n_to_notify) > 0) { |
120 | /* we do callout while holding ch->lock, callout can't block */ | 124 | /* we do callout while holding ch->lock, callout can't block */ |
121 | xpc_notify_senders_of_disconnect(ch); | 125 | xpc_arch_ops.notify_senders_of_disconnect(ch); |
122 | } | 126 | } |
123 | 127 | ||
124 | /* both sides are disconnected now */ | 128 | /* both sides are disconnected now */ |
@@ -132,7 +136,7 @@ xpc_process_disconnect(struct xpc_channel *ch, unsigned long *irq_flags) | |||
132 | DBUG_ON(atomic_read(&ch->n_to_notify) != 0); | 136 | DBUG_ON(atomic_read(&ch->n_to_notify) != 0); |
133 | 137 | ||
134 | /* it's now safe to free the channel's message queues */ | 138 | /* it's now safe to free the channel's message queues */ |
135 | xpc_teardown_msg_structures(ch); | 139 | xpc_arch_ops.teardown_msg_structures(ch); |
136 | 140 | ||
137 | ch->func = NULL; | 141 | ch->func = NULL; |
138 | ch->key = NULL; | 142 | ch->key = NULL; |
@@ -144,8 +148,9 @@ xpc_process_disconnect(struct xpc_channel *ch, unsigned long *irq_flags) | |||
144 | 148 | ||
145 | /* | 149 | /* |
146 | * Mark the channel disconnected and clear all other flags, including | 150 | * Mark the channel disconnected and clear all other flags, including |
147 | * XPC_C_SETUP (because of call to xpc_teardown_msg_structures()) but | 151 | * XPC_C_SETUP (because of call to |
148 | * not including XPC_C_WDISCONNECT (if it was set). | 152 | * xpc_arch_ops.teardown_msg_structures()) but not including |
153 | * XPC_C_WDISCONNECT (if it was set). | ||
149 | */ | 154 | */ |
150 | ch->flags = (XPC_C_DISCONNECTED | (ch->flags & XPC_C_WDISCONNECT)); | 155 | ch->flags = (XPC_C_DISCONNECTED | (ch->flags & XPC_C_WDISCONNECT)); |
151 | 156 | ||
@@ -184,6 +189,7 @@ xpc_process_openclose_chctl_flags(struct xpc_partition *part, int ch_number, | |||
184 | struct xpc_channel *ch = &part->channels[ch_number]; | 189 | struct xpc_channel *ch = &part->channels[ch_number]; |
185 | enum xp_retval reason; | 190 | enum xp_retval reason; |
186 | enum xp_retval ret; | 191 | enum xp_retval ret; |
192 | int create_kthread = 0; | ||
187 | 193 | ||
188 | spin_lock_irqsave(&ch->lock, irq_flags); | 194 | spin_lock_irqsave(&ch->lock, irq_flags); |
189 | 195 | ||
@@ -196,8 +202,7 @@ again: | |||
196 | * has had a chance to see that the channel is disconnected. | 202 | * has had a chance to see that the channel is disconnected. |
197 | */ | 203 | */ |
198 | ch->delayed_chctl_flags |= chctl_flags; | 204 | ch->delayed_chctl_flags |= chctl_flags; |
199 | spin_unlock_irqrestore(&ch->lock, irq_flags); | 205 | goto out; |
200 | return; | ||
201 | } | 206 | } |
202 | 207 | ||
203 | if (chctl_flags & XPC_CHCTL_CLOSEREQUEST) { | 208 | if (chctl_flags & XPC_CHCTL_CLOSEREQUEST) { |
@@ -239,8 +244,7 @@ again: | |||
239 | XPC_CHCTL_CLOSEREQUEST; | 244 | XPC_CHCTL_CLOSEREQUEST; |
240 | spin_unlock(&part->chctl_lock); | 245 | spin_unlock(&part->chctl_lock); |
241 | } | 246 | } |
242 | spin_unlock_irqrestore(&ch->lock, irq_flags); | 247 | goto out; |
243 | return; | ||
244 | } | 248 | } |
245 | 249 | ||
246 | XPC_SET_REASON(ch, 0, 0); | 250 | XPC_SET_REASON(ch, 0, 0); |
@@ -250,7 +254,8 @@ again: | |||
250 | ch->flags |= (XPC_C_CONNECTING | XPC_C_ROPENREQUEST); | 254 | ch->flags |= (XPC_C_CONNECTING | XPC_C_ROPENREQUEST); |
251 | } | 255 | } |
252 | 256 | ||
253 | chctl_flags &= ~(XPC_CHCTL_OPENREQUEST | XPC_CHCTL_OPENREPLY); | 257 | chctl_flags &= ~(XPC_CHCTL_OPENREQUEST | XPC_CHCTL_OPENREPLY | |
258 | XPC_CHCTL_OPENCOMPLETE); | ||
254 | 259 | ||
255 | /* | 260 | /* |
256 | * The meaningful CLOSEREQUEST connection state fields are: | 261 | * The meaningful CLOSEREQUEST connection state fields are: |
@@ -269,8 +274,7 @@ again: | |||
269 | XPC_DISCONNECT_CHANNEL(ch, reason, &irq_flags); | 274 | XPC_DISCONNECT_CHANNEL(ch, reason, &irq_flags); |
270 | 275 | ||
271 | DBUG_ON(chctl_flags & XPC_CHCTL_CLOSEREPLY); | 276 | DBUG_ON(chctl_flags & XPC_CHCTL_CLOSEREPLY); |
272 | spin_unlock_irqrestore(&ch->lock, irq_flags); | 277 | goto out; |
273 | return; | ||
274 | } | 278 | } |
275 | 279 | ||
276 | xpc_process_disconnect(ch, &irq_flags); | 280 | xpc_process_disconnect(ch, &irq_flags); |
@@ -283,8 +287,7 @@ again: | |||
283 | 287 | ||
284 | if (ch->flags & XPC_C_DISCONNECTED) { | 288 | if (ch->flags & XPC_C_DISCONNECTED) { |
285 | DBUG_ON(part->act_state != XPC_P_AS_DEACTIVATING); | 289 | DBUG_ON(part->act_state != XPC_P_AS_DEACTIVATING); |
286 | spin_unlock_irqrestore(&ch->lock, irq_flags); | 290 | goto out; |
287 | return; | ||
288 | } | 291 | } |
289 | 292 | ||
290 | DBUG_ON(!(ch->flags & XPC_C_CLOSEREQUEST)); | 293 | DBUG_ON(!(ch->flags & XPC_C_CLOSEREQUEST)); |
@@ -299,8 +302,7 @@ again: | |||
299 | XPC_CHCTL_CLOSEREPLY; | 302 | XPC_CHCTL_CLOSEREPLY; |
300 | spin_unlock(&part->chctl_lock); | 303 | spin_unlock(&part->chctl_lock); |
301 | } | 304 | } |
302 | spin_unlock_irqrestore(&ch->lock, irq_flags); | 305 | goto out; |
303 | return; | ||
304 | } | 306 | } |
305 | 307 | ||
306 | ch->flags |= XPC_C_RCLOSEREPLY; | 308 | ch->flags |= XPC_C_RCLOSEREPLY; |
@@ -320,14 +322,12 @@ again: | |||
320 | 322 | ||
321 | if (part->act_state == XPC_P_AS_DEACTIVATING || | 323 | if (part->act_state == XPC_P_AS_DEACTIVATING || |
322 | (ch->flags & XPC_C_ROPENREQUEST)) { | 324 | (ch->flags & XPC_C_ROPENREQUEST)) { |
323 | spin_unlock_irqrestore(&ch->lock, irq_flags); | 325 | goto out; |
324 | return; | ||
325 | } | 326 | } |
326 | 327 | ||
327 | if (ch->flags & (XPC_C_DISCONNECTING | XPC_C_WDISCONNECT)) { | 328 | if (ch->flags & (XPC_C_DISCONNECTING | XPC_C_WDISCONNECT)) { |
328 | ch->delayed_chctl_flags |= XPC_CHCTL_OPENREQUEST; | 329 | ch->delayed_chctl_flags |= XPC_CHCTL_OPENREQUEST; |
329 | spin_unlock_irqrestore(&ch->lock, irq_flags); | 330 | goto out; |
330 | return; | ||
331 | } | 331 | } |
332 | DBUG_ON(!(ch->flags & (XPC_C_DISCONNECTED | | 332 | DBUG_ON(!(ch->flags & (XPC_C_DISCONNECTED | |
333 | XPC_C_OPENREQUEST))); | 333 | XPC_C_OPENREQUEST))); |
@@ -341,8 +341,7 @@ again: | |||
341 | */ | 341 | */ |
342 | if (args->entry_size == 0 || args->local_nentries == 0) { | 342 | if (args->entry_size == 0 || args->local_nentries == 0) { |
343 | /* assume OPENREQUEST was delayed by mistake */ | 343 | /* assume OPENREQUEST was delayed by mistake */ |
344 | spin_unlock_irqrestore(&ch->lock, irq_flags); | 344 | goto out; |
345 | return; | ||
346 | } | 345 | } |
347 | 346 | ||
348 | ch->flags |= (XPC_C_ROPENREQUEST | XPC_C_CONNECTING); | 347 | ch->flags |= (XPC_C_ROPENREQUEST | XPC_C_CONNECTING); |
@@ -352,8 +351,7 @@ again: | |||
352 | if (args->entry_size != ch->entry_size) { | 351 | if (args->entry_size != ch->entry_size) { |
353 | XPC_DISCONNECT_CHANNEL(ch, xpUnequalMsgSizes, | 352 | XPC_DISCONNECT_CHANNEL(ch, xpUnequalMsgSizes, |
354 | &irq_flags); | 353 | &irq_flags); |
355 | spin_unlock_irqrestore(&ch->lock, irq_flags); | 354 | goto out; |
356 | return; | ||
357 | } | 355 | } |
358 | } else { | 356 | } else { |
359 | ch->entry_size = args->entry_size; | 357 | ch->entry_size = args->entry_size; |
@@ -375,15 +373,13 @@ again: | |||
375 | args->local_msgqueue_pa, args->local_nentries, | 373 | args->local_msgqueue_pa, args->local_nentries, |
376 | args->remote_nentries, ch->partid, ch->number); | 374 | args->remote_nentries, ch->partid, ch->number); |
377 | 375 | ||
378 | if (ch->flags & (XPC_C_DISCONNECTING | XPC_C_DISCONNECTED)) { | 376 | if (ch->flags & (XPC_C_DISCONNECTING | XPC_C_DISCONNECTED)) |
379 | spin_unlock_irqrestore(&ch->lock, irq_flags); | 377 | goto out; |
380 | return; | 378 | |
381 | } | ||
382 | if (!(ch->flags & XPC_C_OPENREQUEST)) { | 379 | if (!(ch->flags & XPC_C_OPENREQUEST)) { |
383 | XPC_DISCONNECT_CHANNEL(ch, xpOpenCloseError, | 380 | XPC_DISCONNECT_CHANNEL(ch, xpOpenCloseError, |
384 | &irq_flags); | 381 | &irq_flags); |
385 | spin_unlock_irqrestore(&ch->lock, irq_flags); | 382 | goto out; |
386 | return; | ||
387 | } | 383 | } |
388 | 384 | ||
389 | DBUG_ON(!(ch->flags & XPC_C_ROPENREQUEST)); | 385 | DBUG_ON(!(ch->flags & XPC_C_ROPENREQUEST)); |
@@ -400,11 +396,11 @@ again: | |||
400 | DBUG_ON(args->local_nentries == 0); | 396 | DBUG_ON(args->local_nentries == 0); |
401 | DBUG_ON(args->remote_nentries == 0); | 397 | DBUG_ON(args->remote_nentries == 0); |
402 | 398 | ||
403 | ret = xpc_save_remote_msgqueue_pa(ch, args->local_msgqueue_pa); | 399 | ret = xpc_arch_ops.save_remote_msgqueue_pa(ch, |
400 | args->local_msgqueue_pa); | ||
404 | if (ret != xpSuccess) { | 401 | if (ret != xpSuccess) { |
405 | XPC_DISCONNECT_CHANNEL(ch, ret, &irq_flags); | 402 | XPC_DISCONNECT_CHANNEL(ch, ret, &irq_flags); |
406 | spin_unlock_irqrestore(&ch->lock, irq_flags); | 403 | goto out; |
407 | return; | ||
408 | } | 404 | } |
409 | ch->flags |= XPC_C_ROPENREPLY; | 405 | ch->flags |= XPC_C_ROPENREPLY; |
410 | 406 | ||
@@ -430,7 +426,36 @@ again: | |||
430 | xpc_process_connect(ch, &irq_flags); | 426 | xpc_process_connect(ch, &irq_flags); |
431 | } | 427 | } |
432 | 428 | ||
429 | if (chctl_flags & XPC_CHCTL_OPENCOMPLETE) { | ||
430 | |||
431 | dev_dbg(xpc_chan, "XPC_CHCTL_OPENCOMPLETE received from " | ||
432 | "partid=%d, channel=%d\n", ch->partid, ch->number); | ||
433 | |||
434 | if (ch->flags & (XPC_C_DISCONNECTING | XPC_C_DISCONNECTED)) | ||
435 | goto out; | ||
436 | |||
437 | if (!(ch->flags & XPC_C_OPENREQUEST) || | ||
438 | !(ch->flags & XPC_C_OPENREPLY)) { | ||
439 | XPC_DISCONNECT_CHANNEL(ch, xpOpenCloseError, | ||
440 | &irq_flags); | ||
441 | goto out; | ||
442 | } | ||
443 | |||
444 | DBUG_ON(!(ch->flags & XPC_C_ROPENREQUEST)); | ||
445 | DBUG_ON(!(ch->flags & XPC_C_ROPENREPLY)); | ||
446 | DBUG_ON(!(ch->flags & XPC_C_CONNECTED)); | ||
447 | |||
448 | ch->flags |= XPC_C_ROPENCOMPLETE; | ||
449 | |||
450 | xpc_process_connect(ch, &irq_flags); | ||
451 | create_kthread = 1; | ||
452 | } | ||
453 | |||
454 | out: | ||
433 | spin_unlock_irqrestore(&ch->lock, irq_flags); | 455 | spin_unlock_irqrestore(&ch->lock, irq_flags); |
456 | |||
457 | if (create_kthread) | ||
458 | xpc_create_kthreads(ch, 1, 0); | ||
434 | } | 459 | } |
435 | 460 | ||
436 | /* | 461 | /* |
@@ -508,7 +533,7 @@ xpc_connect_channel(struct xpc_channel *ch) | |||
508 | /* initiate the connection */ | 533 | /* initiate the connection */ |
509 | 534 | ||
510 | ch->flags |= (XPC_C_OPENREQUEST | XPC_C_CONNECTING); | 535 | ch->flags |= (XPC_C_OPENREQUEST | XPC_C_CONNECTING); |
511 | xpc_send_chctl_openrequest(ch, &irq_flags); | 536 | xpc_arch_ops.send_chctl_openrequest(ch, &irq_flags); |
512 | 537 | ||
513 | xpc_process_connect(ch, &irq_flags); | 538 | xpc_process_connect(ch, &irq_flags); |
514 | 539 | ||
@@ -526,7 +551,7 @@ xpc_process_sent_chctl_flags(struct xpc_partition *part) | |||
526 | int ch_number; | 551 | int ch_number; |
527 | u32 ch_flags; | 552 | u32 ch_flags; |
528 | 553 | ||
529 | chctl.all_flags = xpc_get_chctl_all_flags(part); | 554 | chctl.all_flags = xpc_arch_ops.get_chctl_all_flags(part); |
530 | 555 | ||
531 | /* | 556 | /* |
532 | * Initiate channel connections for registered channels. | 557 | * Initiate channel connections for registered channels. |
@@ -564,10 +589,6 @@ xpc_process_sent_chctl_flags(struct xpc_partition *part) | |||
564 | if (!(ch_flags & XPC_C_OPENREQUEST)) { | 589 | if (!(ch_flags & XPC_C_OPENREQUEST)) { |
565 | DBUG_ON(ch_flags & XPC_C_SETUP); | 590 | DBUG_ON(ch_flags & XPC_C_SETUP); |
566 | (void)xpc_connect_channel(ch); | 591 | (void)xpc_connect_channel(ch); |
567 | } else { | ||
568 | spin_lock_irqsave(&ch->lock, irq_flags); | ||
569 | xpc_process_connect(ch, &irq_flags); | ||
570 | spin_unlock_irqrestore(&ch->lock, irq_flags); | ||
571 | } | 592 | } |
572 | continue; | 593 | continue; |
573 | } | 594 | } |
@@ -579,7 +600,7 @@ xpc_process_sent_chctl_flags(struct xpc_partition *part) | |||
579 | */ | 600 | */ |
580 | 601 | ||
581 | if (chctl.flags[ch_number] & XPC_MSG_CHCTL_FLAGS) | 602 | if (chctl.flags[ch_number] & XPC_MSG_CHCTL_FLAGS) |
582 | xpc_process_msg_chctl_flags(part, ch_number); | 603 | xpc_arch_ops.process_msg_chctl_flags(part, ch_number); |
583 | } | 604 | } |
584 | } | 605 | } |
585 | 606 | ||
@@ -755,7 +776,7 @@ xpc_disconnect_channel(const int line, struct xpc_channel *ch, | |||
755 | XPC_C_ROPENREQUEST | XPC_C_ROPENREPLY | | 776 | XPC_C_ROPENREQUEST | XPC_C_ROPENREPLY | |
756 | XPC_C_CONNECTING | XPC_C_CONNECTED); | 777 | XPC_C_CONNECTING | XPC_C_CONNECTED); |
757 | 778 | ||
758 | xpc_send_chctl_closerequest(ch, irq_flags); | 779 | xpc_arch_ops.send_chctl_closerequest(ch, irq_flags); |
759 | 780 | ||
760 | if (channel_was_connected) | 781 | if (channel_was_connected) |
761 | ch->flags |= XPC_C_WASCONNECTED; | 782 | ch->flags |= XPC_C_WASCONNECTED; |
@@ -862,8 +883,8 @@ xpc_initiate_send(short partid, int ch_number, u32 flags, void *payload, | |||
862 | DBUG_ON(payload == NULL); | 883 | DBUG_ON(payload == NULL); |
863 | 884 | ||
864 | if (xpc_part_ref(part)) { | 885 | if (xpc_part_ref(part)) { |
865 | ret = xpc_send_payload(&part->channels[ch_number], flags, | 886 | ret = xpc_arch_ops.send_payload(&part->channels[ch_number], |
866 | payload, payload_size, 0, NULL, NULL); | 887 | flags, payload, payload_size, 0, NULL, NULL); |
867 | xpc_part_deref(part); | 888 | xpc_part_deref(part); |
868 | } | 889 | } |
869 | 890 | ||
@@ -914,9 +935,8 @@ xpc_initiate_send_notify(short partid, int ch_number, u32 flags, void *payload, | |||
914 | DBUG_ON(func == NULL); | 935 | DBUG_ON(func == NULL); |
915 | 936 | ||
916 | if (xpc_part_ref(part)) { | 937 | if (xpc_part_ref(part)) { |
917 | ret = xpc_send_payload(&part->channels[ch_number], flags, | 938 | ret = xpc_arch_ops.send_payload(&part->channels[ch_number], |
918 | payload, payload_size, XPC_N_CALL, func, | 939 | flags, payload, payload_size, XPC_N_CALL, func, key); |
919 | key); | ||
920 | xpc_part_deref(part); | 940 | xpc_part_deref(part); |
921 | } | 941 | } |
922 | return ret; | 942 | return ret; |
@@ -930,7 +950,7 @@ xpc_deliver_payload(struct xpc_channel *ch) | |||
930 | { | 950 | { |
931 | void *payload; | 951 | void *payload; |
932 | 952 | ||
933 | payload = xpc_get_deliverable_payload(ch); | 953 | payload = xpc_arch_ops.get_deliverable_payload(ch); |
934 | if (payload != NULL) { | 954 | if (payload != NULL) { |
935 | 955 | ||
936 | /* | 956 | /* |
@@ -984,7 +1004,7 @@ xpc_initiate_received(short partid, int ch_number, void *payload) | |||
984 | DBUG_ON(ch_number < 0 || ch_number >= part->nchannels); | 1004 | DBUG_ON(ch_number < 0 || ch_number >= part->nchannels); |
985 | 1005 | ||
986 | ch = &part->channels[ch_number]; | 1006 | ch = &part->channels[ch_number]; |
987 | xpc_received_payload(ch, payload); | 1007 | xpc_arch_ops.received_payload(ch, payload); |
988 | 1008 | ||
989 | /* the call to xpc_msgqueue_ref() was done by xpc_deliver_payload() */ | 1009 | /* the call to xpc_msgqueue_ref() was done by xpc_deliver_payload() */ |
990 | xpc_msgqueue_deref(ch); | 1010 | xpc_msgqueue_deref(ch); |
diff --git a/drivers/misc/sgi-xp/xpc_main.c b/drivers/misc/sgi-xp/xpc_main.c index 1ab9fda87fab..fd3688a3e23f 100644 --- a/drivers/misc/sgi-xp/xpc_main.c +++ b/drivers/misc/sgi-xp/xpc_main.c | |||
@@ -3,7 +3,7 @@ | |||
3 | * License. See the file "COPYING" in the main directory of this archive | 3 | * License. See the file "COPYING" in the main directory of this archive |
4 | * for more details. | 4 | * for more details. |
5 | * | 5 | * |
6 | * Copyright (c) 2004-2008 Silicon Graphics, Inc. All Rights Reserved. | 6 | * Copyright (c) 2004-2009 Silicon Graphics, Inc. All Rights Reserved. |
7 | */ | 7 | */ |
8 | 8 | ||
9 | /* | 9 | /* |
@@ -150,7 +150,6 @@ DECLARE_WAIT_QUEUE_HEAD(xpc_activate_IRQ_wq); | |||
150 | 150 | ||
151 | static unsigned long xpc_hb_check_timeout; | 151 | static unsigned long xpc_hb_check_timeout; |
152 | static struct timer_list xpc_hb_timer; | 152 | static struct timer_list xpc_hb_timer; |
153 | void *xpc_heartbeating_to_mask; | ||
154 | 153 | ||
155 | /* notification that the xpc_hb_checker thread has exited */ | 154 | /* notification that the xpc_hb_checker thread has exited */ |
156 | static DECLARE_COMPLETION(xpc_hb_checker_exited); | 155 | static DECLARE_COMPLETION(xpc_hb_checker_exited); |
@@ -170,62 +169,7 @@ static struct notifier_block xpc_die_notifier = { | |||
170 | .notifier_call = xpc_system_die, | 169 | .notifier_call = xpc_system_die, |
171 | }; | 170 | }; |
172 | 171 | ||
173 | int (*xpc_setup_partitions_sn) (void); | 172 | struct xpc_arch_operations xpc_arch_ops; |
174 | void (*xpc_teardown_partitions_sn) (void); | ||
175 | enum xp_retval (*xpc_get_partition_rsvd_page_pa) (void *buf, u64 *cookie, | ||
176 | unsigned long *rp_pa, | ||
177 | size_t *len); | ||
178 | int (*xpc_setup_rsvd_page_sn) (struct xpc_rsvd_page *rp); | ||
179 | void (*xpc_heartbeat_init) (void); | ||
180 | void (*xpc_heartbeat_exit) (void); | ||
181 | void (*xpc_increment_heartbeat) (void); | ||
182 | void (*xpc_offline_heartbeat) (void); | ||
183 | void (*xpc_online_heartbeat) (void); | ||
184 | enum xp_retval (*xpc_get_remote_heartbeat) (struct xpc_partition *part); | ||
185 | |||
186 | enum xp_retval (*xpc_make_first_contact) (struct xpc_partition *part); | ||
187 | void (*xpc_notify_senders_of_disconnect) (struct xpc_channel *ch); | ||
188 | u64 (*xpc_get_chctl_all_flags) (struct xpc_partition *part); | ||
189 | enum xp_retval (*xpc_setup_msg_structures) (struct xpc_channel *ch); | ||
190 | void (*xpc_teardown_msg_structures) (struct xpc_channel *ch); | ||
191 | void (*xpc_process_msg_chctl_flags) (struct xpc_partition *part, int ch_number); | ||
192 | int (*xpc_n_of_deliverable_payloads) (struct xpc_channel *ch); | ||
193 | void *(*xpc_get_deliverable_payload) (struct xpc_channel *ch); | ||
194 | |||
195 | void (*xpc_request_partition_activation) (struct xpc_rsvd_page *remote_rp, | ||
196 | unsigned long remote_rp_pa, | ||
197 | int nasid); | ||
198 | void (*xpc_request_partition_reactivation) (struct xpc_partition *part); | ||
199 | void (*xpc_request_partition_deactivation) (struct xpc_partition *part); | ||
200 | void (*xpc_cancel_partition_deactivation_request) (struct xpc_partition *part); | ||
201 | |||
202 | void (*xpc_process_activate_IRQ_rcvd) (void); | ||
203 | enum xp_retval (*xpc_setup_ch_structures_sn) (struct xpc_partition *part); | ||
204 | void (*xpc_teardown_ch_structures_sn) (struct xpc_partition *part); | ||
205 | |||
206 | void (*xpc_indicate_partition_engaged) (struct xpc_partition *part); | ||
207 | int (*xpc_partition_engaged) (short partid); | ||
208 | int (*xpc_any_partition_engaged) (void); | ||
209 | void (*xpc_indicate_partition_disengaged) (struct xpc_partition *part); | ||
210 | void (*xpc_assume_partition_disengaged) (short partid); | ||
211 | |||
212 | void (*xpc_send_chctl_closerequest) (struct xpc_channel *ch, | ||
213 | unsigned long *irq_flags); | ||
214 | void (*xpc_send_chctl_closereply) (struct xpc_channel *ch, | ||
215 | unsigned long *irq_flags); | ||
216 | void (*xpc_send_chctl_openrequest) (struct xpc_channel *ch, | ||
217 | unsigned long *irq_flags); | ||
218 | void (*xpc_send_chctl_openreply) (struct xpc_channel *ch, | ||
219 | unsigned long *irq_flags); | ||
220 | |||
221 | enum xp_retval (*xpc_save_remote_msgqueue_pa) (struct xpc_channel *ch, | ||
222 | unsigned long msgqueue_pa); | ||
223 | |||
224 | enum xp_retval (*xpc_send_payload) (struct xpc_channel *ch, u32 flags, | ||
225 | void *payload, u16 payload_size, | ||
226 | u8 notify_type, xpc_notify_func func, | ||
227 | void *key); | ||
228 | void (*xpc_received_payload) (struct xpc_channel *ch, void *payload); | ||
229 | 173 | ||
230 | /* | 174 | /* |
231 | * Timer function to enforce the timelimit on the partition disengage. | 175 | * Timer function to enforce the timelimit on the partition disengage. |
@@ -240,7 +184,7 @@ xpc_timeout_partition_disengage(unsigned long data) | |||
240 | (void)xpc_partition_disengaged(part); | 184 | (void)xpc_partition_disengaged(part); |
241 | 185 | ||
242 | DBUG_ON(part->disengage_timeout != 0); | 186 | DBUG_ON(part->disengage_timeout != 0); |
243 | DBUG_ON(xpc_partition_engaged(XPC_PARTID(part))); | 187 | DBUG_ON(xpc_arch_ops.partition_engaged(XPC_PARTID(part))); |
244 | } | 188 | } |
245 | 189 | ||
246 | /* | 190 | /* |
@@ -251,7 +195,7 @@ xpc_timeout_partition_disengage(unsigned long data) | |||
251 | static void | 195 | static void |
252 | xpc_hb_beater(unsigned long dummy) | 196 | xpc_hb_beater(unsigned long dummy) |
253 | { | 197 | { |
254 | xpc_increment_heartbeat(); | 198 | xpc_arch_ops.increment_heartbeat(); |
255 | 199 | ||
256 | if (time_is_before_eq_jiffies(xpc_hb_check_timeout)) | 200 | if (time_is_before_eq_jiffies(xpc_hb_check_timeout)) |
257 | wake_up_interruptible(&xpc_activate_IRQ_wq); | 201 | wake_up_interruptible(&xpc_activate_IRQ_wq); |
@@ -263,7 +207,7 @@ xpc_hb_beater(unsigned long dummy) | |||
263 | static void | 207 | static void |
264 | xpc_start_hb_beater(void) | 208 | xpc_start_hb_beater(void) |
265 | { | 209 | { |
266 | xpc_heartbeat_init(); | 210 | xpc_arch_ops.heartbeat_init(); |
267 | init_timer(&xpc_hb_timer); | 211 | init_timer(&xpc_hb_timer); |
268 | xpc_hb_timer.function = xpc_hb_beater; | 212 | xpc_hb_timer.function = xpc_hb_beater; |
269 | xpc_hb_beater(0); | 213 | xpc_hb_beater(0); |
@@ -273,7 +217,7 @@ static void | |||
273 | xpc_stop_hb_beater(void) | 217 | xpc_stop_hb_beater(void) |
274 | { | 218 | { |
275 | del_timer_sync(&xpc_hb_timer); | 219 | del_timer_sync(&xpc_hb_timer); |
276 | xpc_heartbeat_exit(); | 220 | xpc_arch_ops.heartbeat_exit(); |
277 | } | 221 | } |
278 | 222 | ||
279 | /* | 223 | /* |
@@ -302,7 +246,7 @@ xpc_check_remote_hb(void) | |||
302 | continue; | 246 | continue; |
303 | } | 247 | } |
304 | 248 | ||
305 | ret = xpc_get_remote_heartbeat(part); | 249 | ret = xpc_arch_ops.get_remote_heartbeat(part); |
306 | if (ret != xpSuccess) | 250 | if (ret != xpSuccess) |
307 | XPC_DEACTIVATE_PARTITION(part, ret); | 251 | XPC_DEACTIVATE_PARTITION(part, ret); |
308 | } | 252 | } |
@@ -353,7 +297,7 @@ xpc_hb_checker(void *ignore) | |||
353 | force_IRQ = 0; | 297 | force_IRQ = 0; |
354 | dev_dbg(xpc_part, "processing activate IRQs " | 298 | dev_dbg(xpc_part, "processing activate IRQs " |
355 | "received\n"); | 299 | "received\n"); |
356 | xpc_process_activate_IRQ_rcvd(); | 300 | xpc_arch_ops.process_activate_IRQ_rcvd(); |
357 | } | 301 | } |
358 | 302 | ||
359 | /* wait for IRQ or timeout */ | 303 | /* wait for IRQ or timeout */ |
@@ -528,7 +472,7 @@ xpc_setup_ch_structures(struct xpc_partition *part) | |||
528 | init_waitqueue_head(&ch->idle_wq); | 472 | init_waitqueue_head(&ch->idle_wq); |
529 | } | 473 | } |
530 | 474 | ||
531 | ret = xpc_setup_ch_structures_sn(part); | 475 | ret = xpc_arch_ops.setup_ch_structures(part); |
532 | if (ret != xpSuccess) | 476 | if (ret != xpSuccess) |
533 | goto out_2; | 477 | goto out_2; |
534 | 478 | ||
@@ -572,7 +516,7 @@ xpc_teardown_ch_structures(struct xpc_partition *part) | |||
572 | 516 | ||
573 | /* now we can begin tearing down the infrastructure */ | 517 | /* now we can begin tearing down the infrastructure */ |
574 | 518 | ||
575 | xpc_teardown_ch_structures_sn(part); | 519 | xpc_arch_ops.teardown_ch_structures(part); |
576 | 520 | ||
577 | kfree(part->remote_openclose_args_base); | 521 | kfree(part->remote_openclose_args_base); |
578 | part->remote_openclose_args = NULL; | 522 | part->remote_openclose_args = NULL; |
@@ -620,12 +564,12 @@ xpc_activating(void *__partid) | |||
620 | 564 | ||
621 | dev_dbg(xpc_part, "activating partition %d\n", partid); | 565 | dev_dbg(xpc_part, "activating partition %d\n", partid); |
622 | 566 | ||
623 | xpc_allow_hb(partid); | 567 | xpc_arch_ops.allow_hb(partid); |
624 | 568 | ||
625 | if (xpc_setup_ch_structures(part) == xpSuccess) { | 569 | if (xpc_setup_ch_structures(part) == xpSuccess) { |
626 | (void)xpc_part_ref(part); /* this will always succeed */ | 570 | (void)xpc_part_ref(part); /* this will always succeed */ |
627 | 571 | ||
628 | if (xpc_make_first_contact(part) == xpSuccess) { | 572 | if (xpc_arch_ops.make_first_contact(part) == xpSuccess) { |
629 | xpc_mark_partition_active(part); | 573 | xpc_mark_partition_active(part); |
630 | xpc_channel_mgr(part); | 574 | xpc_channel_mgr(part); |
631 | /* won't return until partition is deactivating */ | 575 | /* won't return until partition is deactivating */ |
@@ -635,12 +579,12 @@ xpc_activating(void *__partid) | |||
635 | xpc_teardown_ch_structures(part); | 579 | xpc_teardown_ch_structures(part); |
636 | } | 580 | } |
637 | 581 | ||
638 | xpc_disallow_hb(partid); | 582 | xpc_arch_ops.disallow_hb(partid); |
639 | xpc_mark_partition_inactive(part); | 583 | xpc_mark_partition_inactive(part); |
640 | 584 | ||
641 | if (part->reason == xpReactivating) { | 585 | if (part->reason == xpReactivating) { |
642 | /* interrupting ourselves results in activating partition */ | 586 | /* interrupting ourselves results in activating partition */ |
643 | xpc_request_partition_reactivation(part); | 587 | xpc_arch_ops.request_partition_reactivation(part); |
644 | } | 588 | } |
645 | 589 | ||
646 | return 0; | 590 | return 0; |
@@ -713,10 +657,13 @@ xpc_activate_kthreads(struct xpc_channel *ch, int needed) | |||
713 | static void | 657 | static void |
714 | xpc_kthread_waitmsgs(struct xpc_partition *part, struct xpc_channel *ch) | 658 | xpc_kthread_waitmsgs(struct xpc_partition *part, struct xpc_channel *ch) |
715 | { | 659 | { |
660 | int (*n_of_deliverable_payloads) (struct xpc_channel *) = | ||
661 | xpc_arch_ops.n_of_deliverable_payloads; | ||
662 | |||
716 | do { | 663 | do { |
717 | /* deliver messages to their intended recipients */ | 664 | /* deliver messages to their intended recipients */ |
718 | 665 | ||
719 | while (xpc_n_of_deliverable_payloads(ch) > 0 && | 666 | while (n_of_deliverable_payloads(ch) > 0 && |
720 | !(ch->flags & XPC_C_DISCONNECTING)) { | 667 | !(ch->flags & XPC_C_DISCONNECTING)) { |
721 | xpc_deliver_payload(ch); | 668 | xpc_deliver_payload(ch); |
722 | } | 669 | } |
@@ -732,7 +679,7 @@ xpc_kthread_waitmsgs(struct xpc_partition *part, struct xpc_channel *ch) | |||
732 | "wait_event_interruptible_exclusive()\n"); | 679 | "wait_event_interruptible_exclusive()\n"); |
733 | 680 | ||
734 | (void)wait_event_interruptible_exclusive(ch->idle_wq, | 681 | (void)wait_event_interruptible_exclusive(ch->idle_wq, |
735 | (xpc_n_of_deliverable_payloads(ch) > 0 || | 682 | (n_of_deliverable_payloads(ch) > 0 || |
736 | (ch->flags & XPC_C_DISCONNECTING))); | 683 | (ch->flags & XPC_C_DISCONNECTING))); |
737 | 684 | ||
738 | atomic_dec(&ch->kthreads_idle); | 685 | atomic_dec(&ch->kthreads_idle); |
@@ -749,6 +696,8 @@ xpc_kthread_start(void *args) | |||
749 | struct xpc_channel *ch; | 696 | struct xpc_channel *ch; |
750 | int n_needed; | 697 | int n_needed; |
751 | unsigned long irq_flags; | 698 | unsigned long irq_flags; |
699 | int (*n_of_deliverable_payloads) (struct xpc_channel *) = | ||
700 | xpc_arch_ops.n_of_deliverable_payloads; | ||
752 | 701 | ||
753 | dev_dbg(xpc_chan, "kthread starting, partid=%d, channel=%d\n", | 702 | dev_dbg(xpc_chan, "kthread starting, partid=%d, channel=%d\n", |
754 | partid, ch_number); | 703 | partid, ch_number); |
@@ -777,7 +726,7 @@ xpc_kthread_start(void *args) | |||
777 | * additional kthreads to help deliver them. We only | 726 | * additional kthreads to help deliver them. We only |
778 | * need one less than total #of messages to deliver. | 727 | * need one less than total #of messages to deliver. |
779 | */ | 728 | */ |
780 | n_needed = xpc_n_of_deliverable_payloads(ch) - 1; | 729 | n_needed = n_of_deliverable_payloads(ch) - 1; |
781 | if (n_needed > 0 && !(ch->flags & XPC_C_DISCONNECTING)) | 730 | if (n_needed > 0 && !(ch->flags & XPC_C_DISCONNECTING)) |
782 | xpc_activate_kthreads(ch, n_needed); | 731 | xpc_activate_kthreads(ch, n_needed); |
783 | 732 | ||
@@ -805,7 +754,7 @@ xpc_kthread_start(void *args) | |||
805 | 754 | ||
806 | if (atomic_dec_return(&ch->kthreads_assigned) == 0 && | 755 | if (atomic_dec_return(&ch->kthreads_assigned) == 0 && |
807 | atomic_dec_return(&part->nchannels_engaged) == 0) { | 756 | atomic_dec_return(&part->nchannels_engaged) == 0) { |
808 | xpc_indicate_partition_disengaged(part); | 757 | xpc_arch_ops.indicate_partition_disengaged(part); |
809 | } | 758 | } |
810 | 759 | ||
811 | xpc_msgqueue_deref(ch); | 760 | xpc_msgqueue_deref(ch); |
@@ -837,6 +786,8 @@ xpc_create_kthreads(struct xpc_channel *ch, int needed, | |||
837 | u64 args = XPC_PACK_ARGS(ch->partid, ch->number); | 786 | u64 args = XPC_PACK_ARGS(ch->partid, ch->number); |
838 | struct xpc_partition *part = &xpc_partitions[ch->partid]; | 787 | struct xpc_partition *part = &xpc_partitions[ch->partid]; |
839 | struct task_struct *kthread; | 788 | struct task_struct *kthread; |
789 | void (*indicate_partition_disengaged) (struct xpc_partition *) = | ||
790 | xpc_arch_ops.indicate_partition_disengaged; | ||
840 | 791 | ||
841 | while (needed-- > 0) { | 792 | while (needed-- > 0) { |
842 | 793 | ||
@@ -858,7 +809,7 @@ xpc_create_kthreads(struct xpc_channel *ch, int needed, | |||
858 | 809 | ||
859 | } else if (atomic_inc_return(&ch->kthreads_assigned) == 1 && | 810 | } else if (atomic_inc_return(&ch->kthreads_assigned) == 1 && |
860 | atomic_inc_return(&part->nchannels_engaged) == 1) { | 811 | atomic_inc_return(&part->nchannels_engaged) == 1) { |
861 | xpc_indicate_partition_engaged(part); | 812 | xpc_arch_ops.indicate_partition_engaged(part); |
862 | } | 813 | } |
863 | (void)xpc_part_ref(part); | 814 | (void)xpc_part_ref(part); |
864 | xpc_msgqueue_ref(ch); | 815 | xpc_msgqueue_ref(ch); |
@@ -880,7 +831,7 @@ xpc_create_kthreads(struct xpc_channel *ch, int needed, | |||
880 | 831 | ||
881 | if (atomic_dec_return(&ch->kthreads_assigned) == 0 && | 832 | if (atomic_dec_return(&ch->kthreads_assigned) == 0 && |
882 | atomic_dec_return(&part->nchannels_engaged) == 0) { | 833 | atomic_dec_return(&part->nchannels_engaged) == 0) { |
883 | xpc_indicate_partition_disengaged(part); | 834 | indicate_partition_disengaged(part); |
884 | } | 835 | } |
885 | xpc_msgqueue_deref(ch); | 836 | xpc_msgqueue_deref(ch); |
886 | xpc_part_deref(part); | 837 | xpc_part_deref(part); |
@@ -993,13 +944,13 @@ xpc_setup_partitions(void) | |||
993 | atomic_set(&part->references, 0); | 944 | atomic_set(&part->references, 0); |
994 | } | 945 | } |
995 | 946 | ||
996 | return xpc_setup_partitions_sn(); | 947 | return xpc_arch_ops.setup_partitions(); |
997 | } | 948 | } |
998 | 949 | ||
999 | static void | 950 | static void |
1000 | xpc_teardown_partitions(void) | 951 | xpc_teardown_partitions(void) |
1001 | { | 952 | { |
1002 | xpc_teardown_partitions_sn(); | 953 | xpc_arch_ops.teardown_partitions(); |
1003 | kfree(xpc_partitions); | 954 | kfree(xpc_partitions); |
1004 | } | 955 | } |
1005 | 956 | ||
@@ -1055,7 +1006,7 @@ xpc_do_exit(enum xp_retval reason) | |||
1055 | disengage_timeout = part->disengage_timeout; | 1006 | disengage_timeout = part->disengage_timeout; |
1056 | } | 1007 | } |
1057 | 1008 | ||
1058 | if (xpc_any_partition_engaged()) { | 1009 | if (xpc_arch_ops.any_partition_engaged()) { |
1059 | if (time_is_before_jiffies(printmsg_time)) { | 1010 | if (time_is_before_jiffies(printmsg_time)) { |
1060 | dev_info(xpc_part, "waiting for remote " | 1011 | dev_info(xpc_part, "waiting for remote " |
1061 | "partitions to deactivate, timeout in " | 1012 | "partitions to deactivate, timeout in " |
@@ -1086,8 +1037,7 @@ xpc_do_exit(enum xp_retval reason) | |||
1086 | 1037 | ||
1087 | } while (1); | 1038 | } while (1); |
1088 | 1039 | ||
1089 | DBUG_ON(xpc_any_partition_engaged()); | 1040 | DBUG_ON(xpc_arch_ops.any_partition_engaged()); |
1090 | DBUG_ON(xpc_any_hbs_allowed() != 0); | ||
1091 | 1041 | ||
1092 | xpc_teardown_rsvd_page(); | 1042 | xpc_teardown_rsvd_page(); |
1093 | 1043 | ||
@@ -1152,15 +1102,15 @@ xpc_die_deactivate(void) | |||
1152 | /* keep xpc_hb_checker thread from doing anything (just in case) */ | 1102 | /* keep xpc_hb_checker thread from doing anything (just in case) */ |
1153 | xpc_exiting = 1; | 1103 | xpc_exiting = 1; |
1154 | 1104 | ||
1155 | xpc_disallow_all_hbs(); /*indicate we're deactivated */ | 1105 | xpc_arch_ops.disallow_all_hbs(); /*indicate we're deactivated */ |
1156 | 1106 | ||
1157 | for (partid = 0; partid < xp_max_npartitions; partid++) { | 1107 | for (partid = 0; partid < xp_max_npartitions; partid++) { |
1158 | part = &xpc_partitions[partid]; | 1108 | part = &xpc_partitions[partid]; |
1159 | 1109 | ||
1160 | if (xpc_partition_engaged(partid) || | 1110 | if (xpc_arch_ops.partition_engaged(partid) || |
1161 | part->act_state != XPC_P_AS_INACTIVE) { | 1111 | part->act_state != XPC_P_AS_INACTIVE) { |
1162 | xpc_request_partition_deactivation(part); | 1112 | xpc_arch_ops.request_partition_deactivation(part); |
1163 | xpc_indicate_partition_disengaged(part); | 1113 | xpc_arch_ops.indicate_partition_disengaged(part); |
1164 | } | 1114 | } |
1165 | } | 1115 | } |
1166 | 1116 | ||
@@ -1177,7 +1127,7 @@ xpc_die_deactivate(void) | |||
1177 | wait_to_print = XPC_DEACTIVATE_PRINTMSG_INTERVAL * 1000 * 5; | 1127 | wait_to_print = XPC_DEACTIVATE_PRINTMSG_INTERVAL * 1000 * 5; |
1178 | 1128 | ||
1179 | while (1) { | 1129 | while (1) { |
1180 | any_engaged = xpc_any_partition_engaged(); | 1130 | any_engaged = xpc_arch_ops.any_partition_engaged(); |
1181 | if (!any_engaged) { | 1131 | if (!any_engaged) { |
1182 | dev_info(xpc_part, "all partitions have deactivated\n"); | 1132 | dev_info(xpc_part, "all partitions have deactivated\n"); |
1183 | break; | 1133 | break; |
@@ -1186,7 +1136,7 @@ xpc_die_deactivate(void) | |||
1186 | if (!keep_waiting--) { | 1136 | if (!keep_waiting--) { |
1187 | for (partid = 0; partid < xp_max_npartitions; | 1137 | for (partid = 0; partid < xp_max_npartitions; |
1188 | partid++) { | 1138 | partid++) { |
1189 | if (xpc_partition_engaged(partid)) { | 1139 | if (xpc_arch_ops.partition_engaged(partid)) { |
1190 | dev_info(xpc_part, "deactivate from " | 1140 | dev_info(xpc_part, "deactivate from " |
1191 | "remote partition %d timed " | 1141 | "remote partition %d timed " |
1192 | "out\n", partid); | 1142 | "out\n", partid); |
@@ -1233,7 +1183,7 @@ xpc_system_die(struct notifier_block *nb, unsigned long event, void *unused) | |||
1233 | /* fall through */ | 1183 | /* fall through */ |
1234 | case DIE_MCA_MONARCH_ENTER: | 1184 | case DIE_MCA_MONARCH_ENTER: |
1235 | case DIE_INIT_MONARCH_ENTER: | 1185 | case DIE_INIT_MONARCH_ENTER: |
1236 | xpc_offline_heartbeat(); | 1186 | xpc_arch_ops.offline_heartbeat(); |
1237 | break; | 1187 | break; |
1238 | 1188 | ||
1239 | case DIE_KDEBUG_LEAVE: | 1189 | case DIE_KDEBUG_LEAVE: |
@@ -1244,7 +1194,7 @@ xpc_system_die(struct notifier_block *nb, unsigned long event, void *unused) | |||
1244 | /* fall through */ | 1194 | /* fall through */ |
1245 | case DIE_MCA_MONARCH_LEAVE: | 1195 | case DIE_MCA_MONARCH_LEAVE: |
1246 | case DIE_INIT_MONARCH_LEAVE: | 1196 | case DIE_INIT_MONARCH_LEAVE: |
1247 | xpc_online_heartbeat(); | 1197 | xpc_arch_ops.online_heartbeat(); |
1248 | break; | 1198 | break; |
1249 | } | 1199 | } |
1250 | #else | 1200 | #else |
diff --git a/drivers/misc/sgi-xp/xpc_partition.c b/drivers/misc/sgi-xp/xpc_partition.c index 6722f6fe4dc7..65877bc5edaa 100644 --- a/drivers/misc/sgi-xp/xpc_partition.c +++ b/drivers/misc/sgi-xp/xpc_partition.c | |||
@@ -70,6 +70,9 @@ xpc_get_rsvd_page_pa(int nasid) | |||
70 | size_t buf_len = 0; | 70 | size_t buf_len = 0; |
71 | void *buf = buf; | 71 | void *buf = buf; |
72 | void *buf_base = NULL; | 72 | void *buf_base = NULL; |
73 | enum xp_retval (*get_partition_rsvd_page_pa) | ||
74 | (void *, u64 *, unsigned long *, size_t *) = | ||
75 | xpc_arch_ops.get_partition_rsvd_page_pa; | ||
73 | 76 | ||
74 | while (1) { | 77 | while (1) { |
75 | 78 | ||
@@ -79,8 +82,7 @@ xpc_get_rsvd_page_pa(int nasid) | |||
79 | * ??? function or have two versions? Rename rp_pa for UV to | 82 | * ??? function or have two versions? Rename rp_pa for UV to |
80 | * ??? rp_gpa? | 83 | * ??? rp_gpa? |
81 | */ | 84 | */ |
82 | ret = xpc_get_partition_rsvd_page_pa(buf, &cookie, &rp_pa, | 85 | ret = get_partition_rsvd_page_pa(buf, &cookie, &rp_pa, &len); |
83 | &len); | ||
84 | 86 | ||
85 | dev_dbg(xpc_part, "SAL returned with ret=%d, cookie=0x%016lx, " | 87 | dev_dbg(xpc_part, "SAL returned with ret=%d, cookie=0x%016lx, " |
86 | "address=0x%016lx, len=0x%016lx\n", ret, | 88 | "address=0x%016lx, len=0x%016lx\n", ret, |
@@ -172,7 +174,7 @@ xpc_setup_rsvd_page(void) | |||
172 | xpc_part_nasids = XPC_RP_PART_NASIDS(rp); | 174 | xpc_part_nasids = XPC_RP_PART_NASIDS(rp); |
173 | xpc_mach_nasids = XPC_RP_MACH_NASIDS(rp); | 175 | xpc_mach_nasids = XPC_RP_MACH_NASIDS(rp); |
174 | 176 | ||
175 | ret = xpc_setup_rsvd_page_sn(rp); | 177 | ret = xpc_arch_ops.setup_rsvd_page(rp); |
176 | if (ret != 0) | 178 | if (ret != 0) |
177 | return ret; | 179 | return ret; |
178 | 180 | ||
@@ -264,7 +266,7 @@ xpc_partition_disengaged(struct xpc_partition *part) | |||
264 | short partid = XPC_PARTID(part); | 266 | short partid = XPC_PARTID(part); |
265 | int disengaged; | 267 | int disengaged; |
266 | 268 | ||
267 | disengaged = !xpc_partition_engaged(partid); | 269 | disengaged = !xpc_arch_ops.partition_engaged(partid); |
268 | if (part->disengage_timeout) { | 270 | if (part->disengage_timeout) { |
269 | if (!disengaged) { | 271 | if (!disengaged) { |
270 | if (time_is_after_jiffies(part->disengage_timeout)) { | 272 | if (time_is_after_jiffies(part->disengage_timeout)) { |
@@ -280,7 +282,7 @@ xpc_partition_disengaged(struct xpc_partition *part) | |||
280 | dev_info(xpc_part, "deactivate request to remote " | 282 | dev_info(xpc_part, "deactivate request to remote " |
281 | "partition %d timed out\n", partid); | 283 | "partition %d timed out\n", partid); |
282 | xpc_disengage_timedout = 1; | 284 | xpc_disengage_timedout = 1; |
283 | xpc_assume_partition_disengaged(partid); | 285 | xpc_arch_ops.assume_partition_disengaged(partid); |
284 | disengaged = 1; | 286 | disengaged = 1; |
285 | } | 287 | } |
286 | part->disengage_timeout = 0; | 288 | part->disengage_timeout = 0; |
@@ -294,7 +296,7 @@ xpc_partition_disengaged(struct xpc_partition *part) | |||
294 | if (part->act_state != XPC_P_AS_INACTIVE) | 296 | if (part->act_state != XPC_P_AS_INACTIVE) |
295 | xpc_wakeup_channel_mgr(part); | 297 | xpc_wakeup_channel_mgr(part); |
296 | 298 | ||
297 | xpc_cancel_partition_deactivation_request(part); | 299 | xpc_arch_ops.cancel_partition_deactivation_request(part); |
298 | } | 300 | } |
299 | return disengaged; | 301 | return disengaged; |
300 | } | 302 | } |
@@ -339,7 +341,7 @@ xpc_deactivate_partition(const int line, struct xpc_partition *part, | |||
339 | spin_unlock_irqrestore(&part->act_lock, irq_flags); | 341 | spin_unlock_irqrestore(&part->act_lock, irq_flags); |
340 | if (reason == xpReactivating) { | 342 | if (reason == xpReactivating) { |
341 | /* we interrupt ourselves to reactivate partition */ | 343 | /* we interrupt ourselves to reactivate partition */ |
342 | xpc_request_partition_reactivation(part); | 344 | xpc_arch_ops.request_partition_reactivation(part); |
343 | } | 345 | } |
344 | return; | 346 | return; |
345 | } | 347 | } |
@@ -358,7 +360,7 @@ xpc_deactivate_partition(const int line, struct xpc_partition *part, | |||
358 | spin_unlock_irqrestore(&part->act_lock, irq_flags); | 360 | spin_unlock_irqrestore(&part->act_lock, irq_flags); |
359 | 361 | ||
360 | /* ask remote partition to deactivate with regard to us */ | 362 | /* ask remote partition to deactivate with regard to us */ |
361 | xpc_request_partition_deactivation(part); | 363 | xpc_arch_ops.request_partition_deactivation(part); |
362 | 364 | ||
363 | /* set a timelimit on the disengage phase of the deactivation request */ | 365 | /* set a timelimit on the disengage phase of the deactivation request */ |
364 | part->disengage_timeout = jiffies + (xpc_disengage_timelimit * HZ); | 366 | part->disengage_timeout = jiffies + (xpc_disengage_timelimit * HZ); |
@@ -496,7 +498,7 @@ xpc_discovery(void) | |||
496 | continue; | 498 | continue; |
497 | } | 499 | } |
498 | 500 | ||
499 | xpc_request_partition_activation(remote_rp, | 501 | xpc_arch_ops.request_partition_activation(remote_rp, |
500 | remote_rp_pa, nasid); | 502 | remote_rp_pa, nasid); |
501 | } | 503 | } |
502 | } | 504 | } |
diff --git a/drivers/misc/sgi-xp/xpc_sn2.c b/drivers/misc/sgi-xp/xpc_sn2.c index eaaa964942de..915a3b495da5 100644 --- a/drivers/misc/sgi-xp/xpc_sn2.c +++ b/drivers/misc/sgi-xp/xpc_sn2.c | |||
@@ -3,7 +3,7 @@ | |||
3 | * License. See the file "COPYING" in the main directory of this archive | 3 | * License. See the file "COPYING" in the main directory of this archive |
4 | * for more details. | 4 | * for more details. |
5 | * | 5 | * |
6 | * Copyright (c) 2008 Silicon Graphics, Inc. All Rights Reserved. | 6 | * Copyright (c) 2008-2009 Silicon Graphics, Inc. All Rights Reserved. |
7 | */ | 7 | */ |
8 | 8 | ||
9 | /* | 9 | /* |
@@ -60,14 +60,14 @@ static struct xpc_vars_sn2 *xpc_vars_sn2; | |||
60 | static struct xpc_vars_part_sn2 *xpc_vars_part_sn2; | 60 | static struct xpc_vars_part_sn2 *xpc_vars_part_sn2; |
61 | 61 | ||
62 | static int | 62 | static int |
63 | xpc_setup_partitions_sn_sn2(void) | 63 | xpc_setup_partitions_sn2(void) |
64 | { | 64 | { |
65 | /* nothing needs to be done */ | 65 | /* nothing needs to be done */ |
66 | return 0; | 66 | return 0; |
67 | } | 67 | } |
68 | 68 | ||
69 | static void | 69 | static void |
70 | xpc_teardown_partitions_sn_sn2(void) | 70 | xpc_teardown_partitions_sn2(void) |
71 | { | 71 | { |
72 | /* nothing needs to be done */ | 72 | /* nothing needs to be done */ |
73 | } | 73 | } |
@@ -431,6 +431,13 @@ xpc_send_chctl_openreply_sn2(struct xpc_channel *ch, unsigned long *irq_flags) | |||
431 | } | 431 | } |
432 | 432 | ||
433 | static void | 433 | static void |
434 | xpc_send_chctl_opencomplete_sn2(struct xpc_channel *ch, | ||
435 | unsigned long *irq_flags) | ||
436 | { | ||
437 | XPC_SEND_NOTIFY_IRQ_SN2(ch, XPC_CHCTL_OPENCOMPLETE, irq_flags); | ||
438 | } | ||
439 | |||
440 | static void | ||
434 | xpc_send_chctl_msgrequest_sn2(struct xpc_channel *ch) | 441 | xpc_send_chctl_msgrequest_sn2(struct xpc_channel *ch) |
435 | { | 442 | { |
436 | XPC_SEND_NOTIFY_IRQ_SN2(ch, XPC_CHCTL_MSGREQUEST, NULL); | 443 | XPC_SEND_NOTIFY_IRQ_SN2(ch, XPC_CHCTL_MSGREQUEST, NULL); |
@@ -621,7 +628,7 @@ xpc_get_partition_rsvd_page_pa_sn2(void *buf, u64 *cookie, unsigned long *rp_pa, | |||
621 | 628 | ||
622 | 629 | ||
623 | static int | 630 | static int |
624 | xpc_setup_rsvd_page_sn_sn2(struct xpc_rsvd_page *rp) | 631 | xpc_setup_rsvd_page_sn2(struct xpc_rsvd_page *rp) |
625 | { | 632 | { |
626 | struct amo *amos_page; | 633 | struct amo *amos_page; |
627 | int i; | 634 | int i; |
@@ -629,7 +636,7 @@ xpc_setup_rsvd_page_sn_sn2(struct xpc_rsvd_page *rp) | |||
629 | 636 | ||
630 | xpc_vars_sn2 = XPC_RP_VARS(rp); | 637 | xpc_vars_sn2 = XPC_RP_VARS(rp); |
631 | 638 | ||
632 | rp->sn.vars_pa = xp_pa(xpc_vars_sn2); | 639 | rp->sn.sn2.vars_pa = xp_pa(xpc_vars_sn2); |
633 | 640 | ||
634 | /* vars_part array follows immediately after vars */ | 641 | /* vars_part array follows immediately after vars */ |
635 | xpc_vars_part_sn2 = (struct xpc_vars_part_sn2 *)((u8 *)XPC_RP_VARS(rp) + | 642 | xpc_vars_part_sn2 = (struct xpc_vars_part_sn2 *)((u8 *)XPC_RP_VARS(rp) + |
@@ -693,6 +700,33 @@ xpc_setup_rsvd_page_sn_sn2(struct xpc_rsvd_page *rp) | |||
693 | return 0; | 700 | return 0; |
694 | } | 701 | } |
695 | 702 | ||
703 | static int | ||
704 | xpc_hb_allowed_sn2(short partid, void *heartbeating_to_mask) | ||
705 | { | ||
706 | return test_bit(partid, heartbeating_to_mask); | ||
707 | } | ||
708 | |||
709 | static void | ||
710 | xpc_allow_hb_sn2(short partid) | ||
711 | { | ||
712 | DBUG_ON(xpc_vars_sn2 == NULL); | ||
713 | set_bit(partid, xpc_vars_sn2->heartbeating_to_mask); | ||
714 | } | ||
715 | |||
716 | static void | ||
717 | xpc_disallow_hb_sn2(short partid) | ||
718 | { | ||
719 | DBUG_ON(xpc_vars_sn2 == NULL); | ||
720 | clear_bit(partid, xpc_vars_sn2->heartbeating_to_mask); | ||
721 | } | ||
722 | |||
723 | static void | ||
724 | xpc_disallow_all_hbs_sn2(void) | ||
725 | { | ||
726 | DBUG_ON(xpc_vars_sn2 == NULL); | ||
727 | bitmap_zero(xpc_vars_sn2->heartbeating_to_mask, xp_max_npartitions); | ||
728 | } | ||
729 | |||
696 | static void | 730 | static void |
697 | xpc_increment_heartbeat_sn2(void) | 731 | xpc_increment_heartbeat_sn2(void) |
698 | { | 732 | { |
@@ -719,7 +753,6 @@ xpc_heartbeat_init_sn2(void) | |||
719 | DBUG_ON(xpc_vars_sn2 == NULL); | 753 | DBUG_ON(xpc_vars_sn2 == NULL); |
720 | 754 | ||
721 | bitmap_zero(xpc_vars_sn2->heartbeating_to_mask, XP_MAX_NPARTITIONS_SN2); | 755 | bitmap_zero(xpc_vars_sn2->heartbeating_to_mask, XP_MAX_NPARTITIONS_SN2); |
722 | xpc_heartbeating_to_mask = &xpc_vars_sn2->heartbeating_to_mask[0]; | ||
723 | xpc_online_heartbeat_sn2(); | 756 | xpc_online_heartbeat_sn2(); |
724 | } | 757 | } |
725 | 758 | ||
@@ -751,9 +784,9 @@ xpc_get_remote_heartbeat_sn2(struct xpc_partition *part) | |||
751 | remote_vars->heartbeating_to_mask[0]); | 784 | remote_vars->heartbeating_to_mask[0]); |
752 | 785 | ||
753 | if ((remote_vars->heartbeat == part->last_heartbeat && | 786 | if ((remote_vars->heartbeat == part->last_heartbeat && |
754 | remote_vars->heartbeat_offline == 0) || | 787 | !remote_vars->heartbeat_offline) || |
755 | !xpc_hb_allowed(sn_partition_id, | 788 | !xpc_hb_allowed_sn2(sn_partition_id, |
756 | &remote_vars->heartbeating_to_mask)) { | 789 | remote_vars->heartbeating_to_mask)) { |
757 | ret = xpNoHeartbeat; | 790 | ret = xpNoHeartbeat; |
758 | } else { | 791 | } else { |
759 | part->last_heartbeat = remote_vars->heartbeat; | 792 | part->last_heartbeat = remote_vars->heartbeat; |
@@ -972,7 +1005,7 @@ xpc_identify_activate_IRQ_req_sn2(int nasid) | |||
972 | return; | 1005 | return; |
973 | } | 1006 | } |
974 | 1007 | ||
975 | remote_vars_pa = remote_rp->sn.vars_pa; | 1008 | remote_vars_pa = remote_rp->sn.sn2.vars_pa; |
976 | remote_rp_version = remote_rp->version; | 1009 | remote_rp_version = remote_rp->version; |
977 | remote_rp_ts_jiffies = remote_rp->ts_jiffies; | 1010 | remote_rp_ts_jiffies = remote_rp->ts_jiffies; |
978 | 1011 | ||
@@ -1129,7 +1162,7 @@ xpc_process_activate_IRQ_rcvd_sn2(void) | |||
1129 | * Setup the channel structures that are sn2 specific. | 1162 | * Setup the channel structures that are sn2 specific. |
1130 | */ | 1163 | */ |
1131 | static enum xp_retval | 1164 | static enum xp_retval |
1132 | xpc_setup_ch_structures_sn_sn2(struct xpc_partition *part) | 1165 | xpc_setup_ch_structures_sn2(struct xpc_partition *part) |
1133 | { | 1166 | { |
1134 | struct xpc_partition_sn2 *part_sn2 = &part->sn.sn2; | 1167 | struct xpc_partition_sn2 *part_sn2 = &part->sn.sn2; |
1135 | struct xpc_channel_sn2 *ch_sn2; | 1168 | struct xpc_channel_sn2 *ch_sn2; |
@@ -1251,7 +1284,7 @@ out_1: | |||
1251 | * Teardown the channel structures that are sn2 specific. | 1284 | * Teardown the channel structures that are sn2 specific. |
1252 | */ | 1285 | */ |
1253 | static void | 1286 | static void |
1254 | xpc_teardown_ch_structures_sn_sn2(struct xpc_partition *part) | 1287 | xpc_teardown_ch_structures_sn2(struct xpc_partition *part) |
1255 | { | 1288 | { |
1256 | struct xpc_partition_sn2 *part_sn2 = &part->sn.sn2; | 1289 | struct xpc_partition_sn2 *part_sn2 = &part->sn.sn2; |
1257 | short partid = XPC_PARTID(part); | 1290 | short partid = XPC_PARTID(part); |
@@ -2315,61 +2348,70 @@ xpc_received_payload_sn2(struct xpc_channel *ch, void *payload) | |||
2315 | xpc_acknowledge_msgs_sn2(ch, get, msg->flags); | 2348 | xpc_acknowledge_msgs_sn2(ch, get, msg->flags); |
2316 | } | 2349 | } |
2317 | 2350 | ||
2351 | static struct xpc_arch_operations xpc_arch_ops_sn2 = { | ||
2352 | .setup_partitions = xpc_setup_partitions_sn2, | ||
2353 | .teardown_partitions = xpc_teardown_partitions_sn2, | ||
2354 | .process_activate_IRQ_rcvd = xpc_process_activate_IRQ_rcvd_sn2, | ||
2355 | .get_partition_rsvd_page_pa = xpc_get_partition_rsvd_page_pa_sn2, | ||
2356 | .setup_rsvd_page = xpc_setup_rsvd_page_sn2, | ||
2357 | |||
2358 | .allow_hb = xpc_allow_hb_sn2, | ||
2359 | .disallow_hb = xpc_disallow_hb_sn2, | ||
2360 | .disallow_all_hbs = xpc_disallow_all_hbs_sn2, | ||
2361 | .increment_heartbeat = xpc_increment_heartbeat_sn2, | ||
2362 | .offline_heartbeat = xpc_offline_heartbeat_sn2, | ||
2363 | .online_heartbeat = xpc_online_heartbeat_sn2, | ||
2364 | .heartbeat_init = xpc_heartbeat_init_sn2, | ||
2365 | .heartbeat_exit = xpc_heartbeat_exit_sn2, | ||
2366 | .get_remote_heartbeat = xpc_get_remote_heartbeat_sn2, | ||
2367 | |||
2368 | .request_partition_activation = | ||
2369 | xpc_request_partition_activation_sn2, | ||
2370 | .request_partition_reactivation = | ||
2371 | xpc_request_partition_reactivation_sn2, | ||
2372 | .request_partition_deactivation = | ||
2373 | xpc_request_partition_deactivation_sn2, | ||
2374 | .cancel_partition_deactivation_request = | ||
2375 | xpc_cancel_partition_deactivation_request_sn2, | ||
2376 | |||
2377 | .setup_ch_structures = xpc_setup_ch_structures_sn2, | ||
2378 | .teardown_ch_structures = xpc_teardown_ch_structures_sn2, | ||
2379 | |||
2380 | .make_first_contact = xpc_make_first_contact_sn2, | ||
2381 | |||
2382 | .get_chctl_all_flags = xpc_get_chctl_all_flags_sn2, | ||
2383 | .send_chctl_closerequest = xpc_send_chctl_closerequest_sn2, | ||
2384 | .send_chctl_closereply = xpc_send_chctl_closereply_sn2, | ||
2385 | .send_chctl_openrequest = xpc_send_chctl_openrequest_sn2, | ||
2386 | .send_chctl_openreply = xpc_send_chctl_openreply_sn2, | ||
2387 | .send_chctl_opencomplete = xpc_send_chctl_opencomplete_sn2, | ||
2388 | .process_msg_chctl_flags = xpc_process_msg_chctl_flags_sn2, | ||
2389 | |||
2390 | .save_remote_msgqueue_pa = xpc_save_remote_msgqueue_pa_sn2, | ||
2391 | |||
2392 | .setup_msg_structures = xpc_setup_msg_structures_sn2, | ||
2393 | .teardown_msg_structures = xpc_teardown_msg_structures_sn2, | ||
2394 | |||
2395 | .indicate_partition_engaged = xpc_indicate_partition_engaged_sn2, | ||
2396 | .indicate_partition_disengaged = xpc_indicate_partition_disengaged_sn2, | ||
2397 | .partition_engaged = xpc_partition_engaged_sn2, | ||
2398 | .any_partition_engaged = xpc_any_partition_engaged_sn2, | ||
2399 | .assume_partition_disengaged = xpc_assume_partition_disengaged_sn2, | ||
2400 | |||
2401 | .n_of_deliverable_payloads = xpc_n_of_deliverable_payloads_sn2, | ||
2402 | .send_payload = xpc_send_payload_sn2, | ||
2403 | .get_deliverable_payload = xpc_get_deliverable_payload_sn2, | ||
2404 | .received_payload = xpc_received_payload_sn2, | ||
2405 | .notify_senders_of_disconnect = xpc_notify_senders_of_disconnect_sn2, | ||
2406 | }; | ||
2407 | |||
2318 | int | 2408 | int |
2319 | xpc_init_sn2(void) | 2409 | xpc_init_sn2(void) |
2320 | { | 2410 | { |
2321 | int ret; | 2411 | int ret; |
2322 | size_t buf_size; | 2412 | size_t buf_size; |
2323 | 2413 | ||
2324 | xpc_setup_partitions_sn = xpc_setup_partitions_sn_sn2; | 2414 | xpc_arch_ops = xpc_arch_ops_sn2; |
2325 | xpc_teardown_partitions_sn = xpc_teardown_partitions_sn_sn2; | ||
2326 | xpc_get_partition_rsvd_page_pa = xpc_get_partition_rsvd_page_pa_sn2; | ||
2327 | xpc_setup_rsvd_page_sn = xpc_setup_rsvd_page_sn_sn2; | ||
2328 | xpc_increment_heartbeat = xpc_increment_heartbeat_sn2; | ||
2329 | xpc_offline_heartbeat = xpc_offline_heartbeat_sn2; | ||
2330 | xpc_online_heartbeat = xpc_online_heartbeat_sn2; | ||
2331 | xpc_heartbeat_init = xpc_heartbeat_init_sn2; | ||
2332 | xpc_heartbeat_exit = xpc_heartbeat_exit_sn2; | ||
2333 | xpc_get_remote_heartbeat = xpc_get_remote_heartbeat_sn2; | ||
2334 | |||
2335 | xpc_request_partition_activation = xpc_request_partition_activation_sn2; | ||
2336 | xpc_request_partition_reactivation = | ||
2337 | xpc_request_partition_reactivation_sn2; | ||
2338 | xpc_request_partition_deactivation = | ||
2339 | xpc_request_partition_deactivation_sn2; | ||
2340 | xpc_cancel_partition_deactivation_request = | ||
2341 | xpc_cancel_partition_deactivation_request_sn2; | ||
2342 | |||
2343 | xpc_process_activate_IRQ_rcvd = xpc_process_activate_IRQ_rcvd_sn2; | ||
2344 | xpc_setup_ch_structures_sn = xpc_setup_ch_structures_sn_sn2; | ||
2345 | xpc_teardown_ch_structures_sn = xpc_teardown_ch_structures_sn_sn2; | ||
2346 | xpc_make_first_contact = xpc_make_first_contact_sn2; | ||
2347 | |||
2348 | xpc_get_chctl_all_flags = xpc_get_chctl_all_flags_sn2; | ||
2349 | xpc_send_chctl_closerequest = xpc_send_chctl_closerequest_sn2; | ||
2350 | xpc_send_chctl_closereply = xpc_send_chctl_closereply_sn2; | ||
2351 | xpc_send_chctl_openrequest = xpc_send_chctl_openrequest_sn2; | ||
2352 | xpc_send_chctl_openreply = xpc_send_chctl_openreply_sn2; | ||
2353 | |||
2354 | xpc_save_remote_msgqueue_pa = xpc_save_remote_msgqueue_pa_sn2; | ||
2355 | |||
2356 | xpc_setup_msg_structures = xpc_setup_msg_structures_sn2; | ||
2357 | xpc_teardown_msg_structures = xpc_teardown_msg_structures_sn2; | ||
2358 | |||
2359 | xpc_notify_senders_of_disconnect = xpc_notify_senders_of_disconnect_sn2; | ||
2360 | xpc_process_msg_chctl_flags = xpc_process_msg_chctl_flags_sn2; | ||
2361 | xpc_n_of_deliverable_payloads = xpc_n_of_deliverable_payloads_sn2; | ||
2362 | xpc_get_deliverable_payload = xpc_get_deliverable_payload_sn2; | ||
2363 | |||
2364 | xpc_indicate_partition_engaged = xpc_indicate_partition_engaged_sn2; | ||
2365 | xpc_indicate_partition_disengaged = | ||
2366 | xpc_indicate_partition_disengaged_sn2; | ||
2367 | xpc_partition_engaged = xpc_partition_engaged_sn2; | ||
2368 | xpc_any_partition_engaged = xpc_any_partition_engaged_sn2; | ||
2369 | xpc_assume_partition_disengaged = xpc_assume_partition_disengaged_sn2; | ||
2370 | |||
2371 | xpc_send_payload = xpc_send_payload_sn2; | ||
2372 | xpc_received_payload = xpc_received_payload_sn2; | ||
2373 | 2415 | ||
2374 | if (offsetof(struct xpc_msg_sn2, payload) > XPC_MSG_HDR_MAX_SIZE) { | 2416 | if (offsetof(struct xpc_msg_sn2, payload) > XPC_MSG_HDR_MAX_SIZE) { |
2375 | dev_err(xpc_part, "header portion of struct xpc_msg_sn2 is " | 2417 | dev_err(xpc_part, "header portion of struct xpc_msg_sn2 is " |
diff --git a/drivers/misc/sgi-xp/xpc_uv.c b/drivers/misc/sgi-xp/xpc_uv.c index f7fff4727edb..9172fcdee4e2 100644 --- a/drivers/misc/sgi-xp/xpc_uv.c +++ b/drivers/misc/sgi-xp/xpc_uv.c | |||
@@ -46,8 +46,7 @@ struct uv_IO_APIC_route_entry { | |||
46 | }; | 46 | }; |
47 | #endif | 47 | #endif |
48 | 48 | ||
49 | static atomic64_t xpc_heartbeat_uv; | 49 | static struct xpc_heartbeat_uv *xpc_heartbeat_uv; |
50 | static DECLARE_BITMAP(xpc_heartbeating_to_mask_uv, XP_MAX_NPARTITIONS_UV); | ||
51 | 50 | ||
52 | #define XPC_ACTIVATE_MSG_SIZE_UV (1 * GRU_CACHE_LINE_BYTES) | 51 | #define XPC_ACTIVATE_MSG_SIZE_UV (1 * GRU_CACHE_LINE_BYTES) |
53 | #define XPC_ACTIVATE_MQ_SIZE_UV (4 * XP_MAX_NPARTITIONS_UV * \ | 52 | #define XPC_ACTIVATE_MQ_SIZE_UV (4 * XP_MAX_NPARTITIONS_UV * \ |
@@ -63,7 +62,7 @@ static struct xpc_gru_mq_uv *xpc_activate_mq_uv; | |||
63 | static struct xpc_gru_mq_uv *xpc_notify_mq_uv; | 62 | static struct xpc_gru_mq_uv *xpc_notify_mq_uv; |
64 | 63 | ||
65 | static int | 64 | static int |
66 | xpc_setup_partitions_sn_uv(void) | 65 | xpc_setup_partitions_uv(void) |
67 | { | 66 | { |
68 | short partid; | 67 | short partid; |
69 | struct xpc_partition_uv *part_uv; | 68 | struct xpc_partition_uv *part_uv; |
@@ -79,7 +78,7 @@ xpc_setup_partitions_sn_uv(void) | |||
79 | } | 78 | } |
80 | 79 | ||
81 | static void | 80 | static void |
82 | xpc_teardown_partitions_sn_uv(void) | 81 | xpc_teardown_partitions_uv(void) |
83 | { | 82 | { |
84 | short partid; | 83 | short partid; |
85 | struct xpc_partition_uv *part_uv; | 84 | struct xpc_partition_uv *part_uv; |
@@ -423,41 +422,6 @@ xpc_handle_activate_mq_msg_uv(struct xpc_partition *part, | |||
423 | /* syncing of remote_act_state was just done above */ | 422 | /* syncing of remote_act_state was just done above */ |
424 | break; | 423 | break; |
425 | 424 | ||
426 | case XPC_ACTIVATE_MQ_MSG_INC_HEARTBEAT_UV: { | ||
427 | struct xpc_activate_mq_msg_heartbeat_req_uv *msg; | ||
428 | |||
429 | msg = container_of(msg_hdr, | ||
430 | struct xpc_activate_mq_msg_heartbeat_req_uv, | ||
431 | hdr); | ||
432 | part_uv->heartbeat = msg->heartbeat; | ||
433 | break; | ||
434 | } | ||
435 | case XPC_ACTIVATE_MQ_MSG_OFFLINE_HEARTBEAT_UV: { | ||
436 | struct xpc_activate_mq_msg_heartbeat_req_uv *msg; | ||
437 | |||
438 | msg = container_of(msg_hdr, | ||
439 | struct xpc_activate_mq_msg_heartbeat_req_uv, | ||
440 | hdr); | ||
441 | part_uv->heartbeat = msg->heartbeat; | ||
442 | |||
443 | spin_lock_irqsave(&part_uv->flags_lock, irq_flags); | ||
444 | part_uv->flags |= XPC_P_HEARTBEAT_OFFLINE_UV; | ||
445 | spin_unlock_irqrestore(&part_uv->flags_lock, irq_flags); | ||
446 | break; | ||
447 | } | ||
448 | case XPC_ACTIVATE_MQ_MSG_ONLINE_HEARTBEAT_UV: { | ||
449 | struct xpc_activate_mq_msg_heartbeat_req_uv *msg; | ||
450 | |||
451 | msg = container_of(msg_hdr, | ||
452 | struct xpc_activate_mq_msg_heartbeat_req_uv, | ||
453 | hdr); | ||
454 | part_uv->heartbeat = msg->heartbeat; | ||
455 | |||
456 | spin_lock_irqsave(&part_uv->flags_lock, irq_flags); | ||
457 | part_uv->flags &= ~XPC_P_HEARTBEAT_OFFLINE_UV; | ||
458 | spin_unlock_irqrestore(&part_uv->flags_lock, irq_flags); | ||
459 | break; | ||
460 | } | ||
461 | case XPC_ACTIVATE_MQ_MSG_ACTIVATE_REQ_UV: { | 425 | case XPC_ACTIVATE_MQ_MSG_ACTIVATE_REQ_UV: { |
462 | struct xpc_activate_mq_msg_activate_req_uv *msg; | 426 | struct xpc_activate_mq_msg_activate_req_uv *msg; |
463 | 427 | ||
@@ -475,6 +439,7 @@ xpc_handle_activate_mq_msg_uv(struct xpc_partition *part, | |||
475 | part_uv->act_state_req = XPC_P_ASR_ACTIVATE_UV; | 439 | part_uv->act_state_req = XPC_P_ASR_ACTIVATE_UV; |
476 | part->remote_rp_pa = msg->rp_gpa; /* !!! _pa is _gpa */ | 440 | part->remote_rp_pa = msg->rp_gpa; /* !!! _pa is _gpa */ |
477 | part->remote_rp_ts_jiffies = msg_hdr->rp_ts_jiffies; | 441 | part->remote_rp_ts_jiffies = msg_hdr->rp_ts_jiffies; |
442 | part_uv->heartbeat_gpa = msg->heartbeat_gpa; | ||
478 | 443 | ||
479 | if (msg->activate_gru_mq_desc_gpa != | 444 | if (msg->activate_gru_mq_desc_gpa != |
480 | part_uv->activate_gru_mq_desc_gpa) { | 445 | part_uv->activate_gru_mq_desc_gpa) { |
@@ -569,6 +534,17 @@ xpc_handle_activate_mq_msg_uv(struct xpc_partition *part, | |||
569 | xpc_wakeup_channel_mgr(part); | 534 | xpc_wakeup_channel_mgr(part); |
570 | break; | 535 | break; |
571 | } | 536 | } |
537 | case XPC_ACTIVATE_MQ_MSG_CHCTL_OPENCOMPLETE_UV: { | ||
538 | struct xpc_activate_mq_msg_chctl_opencomplete_uv *msg; | ||
539 | |||
540 | msg = container_of(msg_hdr, struct | ||
541 | xpc_activate_mq_msg_chctl_opencomplete_uv, hdr); | ||
542 | spin_lock_irqsave(&part->chctl_lock, irq_flags); | ||
543 | part->chctl.flags[msg->ch_number] |= XPC_CHCTL_OPENCOMPLETE; | ||
544 | spin_unlock_irqrestore(&part->chctl_lock, irq_flags); | ||
545 | |||
546 | xpc_wakeup_channel_mgr(part); | ||
547 | } | ||
572 | case XPC_ACTIVATE_MQ_MSG_MARK_ENGAGED_UV: | 548 | case XPC_ACTIVATE_MQ_MSG_MARK_ENGAGED_UV: |
573 | spin_lock_irqsave(&part_uv->flags_lock, irq_flags); | 549 | spin_lock_irqsave(&part_uv->flags_lock, irq_flags); |
574 | part_uv->flags |= XPC_P_ENGAGED_UV; | 550 | part_uv->flags |= XPC_P_ENGAGED_UV; |
@@ -759,7 +735,7 @@ xpc_send_local_activate_IRQ_uv(struct xpc_partition *part, int act_state_req) | |||
759 | 735 | ||
760 | /* | 736 | /* |
761 | * !!! Make our side think that the remote partition sent an activate | 737 | * !!! Make our side think that the remote partition sent an activate |
762 | * !!! message our way by doing what the activate IRQ handler would | 738 | * !!! mq message our way by doing what the activate IRQ handler would |
763 | * !!! do had one really been sent. | 739 | * !!! do had one really been sent. |
764 | */ | 740 | */ |
765 | 741 | ||
@@ -806,90 +782,82 @@ xpc_get_partition_rsvd_page_pa_uv(void *buf, u64 *cookie, unsigned long *rp_pa, | |||
806 | } | 782 | } |
807 | 783 | ||
808 | static int | 784 | static int |
809 | xpc_setup_rsvd_page_sn_uv(struct xpc_rsvd_page *rp) | 785 | xpc_setup_rsvd_page_uv(struct xpc_rsvd_page *rp) |
810 | { | 786 | { |
811 | rp->sn.activate_gru_mq_desc_gpa = | 787 | xpc_heartbeat_uv = |
788 | &xpc_partitions[sn_partition_id].sn.uv.cached_heartbeat; | ||
789 | rp->sn.uv.heartbeat_gpa = uv_gpa(xpc_heartbeat_uv); | ||
790 | rp->sn.uv.activate_gru_mq_desc_gpa = | ||
812 | uv_gpa(xpc_activate_mq_uv->gru_mq_desc); | 791 | uv_gpa(xpc_activate_mq_uv->gru_mq_desc); |
813 | return 0; | 792 | return 0; |
814 | } | 793 | } |
815 | 794 | ||
816 | static void | 795 | static void |
817 | xpc_send_heartbeat_uv(int msg_type) | 796 | xpc_allow_hb_uv(short partid) |
818 | { | 797 | { |
819 | short partid; | 798 | } |
820 | struct xpc_partition *part; | ||
821 | struct xpc_activate_mq_msg_heartbeat_req_uv msg; | ||
822 | |||
823 | /* | ||
824 | * !!! On uv we're broadcasting a heartbeat message every 5 seconds. | ||
825 | * !!! Whereas on sn2 we're bte_copy'ng the heartbeat info every 20 | ||
826 | * !!! seconds. This is an increase in numalink traffic. | ||
827 | * ??? Is this good? | ||
828 | */ | ||
829 | |||
830 | msg.heartbeat = atomic64_inc_return(&xpc_heartbeat_uv); | ||
831 | |||
832 | partid = find_first_bit(xpc_heartbeating_to_mask_uv, | ||
833 | XP_MAX_NPARTITIONS_UV); | ||
834 | |||
835 | while (partid < XP_MAX_NPARTITIONS_UV) { | ||
836 | part = &xpc_partitions[partid]; | ||
837 | 799 | ||
838 | xpc_send_activate_IRQ_part_uv(part, &msg, sizeof(msg), | 800 | static void |
839 | msg_type); | 801 | xpc_disallow_hb_uv(short partid) |
802 | { | ||
803 | } | ||
840 | 804 | ||
841 | partid = find_next_bit(xpc_heartbeating_to_mask_uv, | 805 | static void |
842 | XP_MAX_NPARTITIONS_UV, partid + 1); | 806 | xpc_disallow_all_hbs_uv(void) |
843 | } | 807 | { |
844 | } | 808 | } |
845 | 809 | ||
846 | static void | 810 | static void |
847 | xpc_increment_heartbeat_uv(void) | 811 | xpc_increment_heartbeat_uv(void) |
848 | { | 812 | { |
849 | xpc_send_heartbeat_uv(XPC_ACTIVATE_MQ_MSG_INC_HEARTBEAT_UV); | 813 | xpc_heartbeat_uv->value++; |
850 | } | 814 | } |
851 | 815 | ||
852 | static void | 816 | static void |
853 | xpc_offline_heartbeat_uv(void) | 817 | xpc_offline_heartbeat_uv(void) |
854 | { | 818 | { |
855 | xpc_send_heartbeat_uv(XPC_ACTIVATE_MQ_MSG_OFFLINE_HEARTBEAT_UV); | 819 | xpc_increment_heartbeat_uv(); |
820 | xpc_heartbeat_uv->offline = 1; | ||
856 | } | 821 | } |
857 | 822 | ||
858 | static void | 823 | static void |
859 | xpc_online_heartbeat_uv(void) | 824 | xpc_online_heartbeat_uv(void) |
860 | { | 825 | { |
861 | xpc_send_heartbeat_uv(XPC_ACTIVATE_MQ_MSG_ONLINE_HEARTBEAT_UV); | 826 | xpc_increment_heartbeat_uv(); |
827 | xpc_heartbeat_uv->offline = 0; | ||
862 | } | 828 | } |
863 | 829 | ||
864 | static void | 830 | static void |
865 | xpc_heartbeat_init_uv(void) | 831 | xpc_heartbeat_init_uv(void) |
866 | { | 832 | { |
867 | atomic64_set(&xpc_heartbeat_uv, 0); | 833 | xpc_heartbeat_uv->value = 1; |
868 | bitmap_zero(xpc_heartbeating_to_mask_uv, XP_MAX_NPARTITIONS_UV); | 834 | xpc_heartbeat_uv->offline = 0; |
869 | xpc_heartbeating_to_mask = &xpc_heartbeating_to_mask_uv[0]; | ||
870 | } | 835 | } |
871 | 836 | ||
872 | static void | 837 | static void |
873 | xpc_heartbeat_exit_uv(void) | 838 | xpc_heartbeat_exit_uv(void) |
874 | { | 839 | { |
875 | xpc_send_heartbeat_uv(XPC_ACTIVATE_MQ_MSG_OFFLINE_HEARTBEAT_UV); | 840 | xpc_offline_heartbeat_uv(); |
876 | } | 841 | } |
877 | 842 | ||
878 | static enum xp_retval | 843 | static enum xp_retval |
879 | xpc_get_remote_heartbeat_uv(struct xpc_partition *part) | 844 | xpc_get_remote_heartbeat_uv(struct xpc_partition *part) |
880 | { | 845 | { |
881 | struct xpc_partition_uv *part_uv = &part->sn.uv; | 846 | struct xpc_partition_uv *part_uv = &part->sn.uv; |
882 | enum xp_retval ret = xpNoHeartbeat; | 847 | enum xp_retval ret; |
883 | 848 | ||
884 | if (part_uv->remote_act_state != XPC_P_AS_INACTIVE && | 849 | ret = xp_remote_memcpy(uv_gpa(&part_uv->cached_heartbeat), |
885 | part_uv->remote_act_state != XPC_P_AS_DEACTIVATING) { | 850 | part_uv->heartbeat_gpa, |
851 | sizeof(struct xpc_heartbeat_uv)); | ||
852 | if (ret != xpSuccess) | ||
853 | return ret; | ||
886 | 854 | ||
887 | if (part_uv->heartbeat != part->last_heartbeat || | 855 | if (part_uv->cached_heartbeat.value == part->last_heartbeat && |
888 | (part_uv->flags & XPC_P_HEARTBEAT_OFFLINE_UV)) { | 856 | !part_uv->cached_heartbeat.offline) { |
889 | 857 | ||
890 | part->last_heartbeat = part_uv->heartbeat; | 858 | ret = xpNoHeartbeat; |
891 | ret = xpSuccess; | 859 | } else { |
892 | } | 860 | part->last_heartbeat = part_uv->cached_heartbeat.value; |
893 | } | 861 | } |
894 | return ret; | 862 | return ret; |
895 | } | 863 | } |
@@ -904,8 +872,9 @@ xpc_request_partition_activation_uv(struct xpc_rsvd_page *remote_rp, | |||
904 | 872 | ||
905 | part->remote_rp_pa = remote_rp_gpa; /* !!! _pa here is really _gpa */ | 873 | part->remote_rp_pa = remote_rp_gpa; /* !!! _pa here is really _gpa */ |
906 | part->remote_rp_ts_jiffies = remote_rp->ts_jiffies; | 874 | part->remote_rp_ts_jiffies = remote_rp->ts_jiffies; |
875 | part->sn.uv.heartbeat_gpa = remote_rp->sn.uv.heartbeat_gpa; | ||
907 | part->sn.uv.activate_gru_mq_desc_gpa = | 876 | part->sn.uv.activate_gru_mq_desc_gpa = |
908 | remote_rp->sn.activate_gru_mq_desc_gpa; | 877 | remote_rp->sn.uv.activate_gru_mq_desc_gpa; |
909 | 878 | ||
910 | /* | 879 | /* |
911 | * ??? Is it a good idea to make this conditional on what is | 880 | * ??? Is it a good idea to make this conditional on what is |
@@ -913,8 +882,9 @@ xpc_request_partition_activation_uv(struct xpc_rsvd_page *remote_rp, | |||
913 | */ | 882 | */ |
914 | if (part->sn.uv.remote_act_state == XPC_P_AS_INACTIVE) { | 883 | if (part->sn.uv.remote_act_state == XPC_P_AS_INACTIVE) { |
915 | msg.rp_gpa = uv_gpa(xpc_rsvd_page); | 884 | msg.rp_gpa = uv_gpa(xpc_rsvd_page); |
885 | msg.heartbeat_gpa = xpc_rsvd_page->sn.uv.heartbeat_gpa; | ||
916 | msg.activate_gru_mq_desc_gpa = | 886 | msg.activate_gru_mq_desc_gpa = |
917 | xpc_rsvd_page->sn.activate_gru_mq_desc_gpa; | 887 | xpc_rsvd_page->sn.uv.activate_gru_mq_desc_gpa; |
918 | xpc_send_activate_IRQ_part_uv(part, &msg, sizeof(msg), | 888 | xpc_send_activate_IRQ_part_uv(part, &msg, sizeof(msg), |
919 | XPC_ACTIVATE_MQ_MSG_ACTIVATE_REQ_UV); | 889 | XPC_ACTIVATE_MQ_MSG_ACTIVATE_REQ_UV); |
920 | } | 890 | } |
@@ -1010,7 +980,7 @@ xpc_n_of_fifo_entries_uv(struct xpc_fifo_head_uv *head) | |||
1010 | * Setup the channel structures that are uv specific. | 980 | * Setup the channel structures that are uv specific. |
1011 | */ | 981 | */ |
1012 | static enum xp_retval | 982 | static enum xp_retval |
1013 | xpc_setup_ch_structures_sn_uv(struct xpc_partition *part) | 983 | xpc_setup_ch_structures_uv(struct xpc_partition *part) |
1014 | { | 984 | { |
1015 | struct xpc_channel_uv *ch_uv; | 985 | struct xpc_channel_uv *ch_uv; |
1016 | int ch_number; | 986 | int ch_number; |
@@ -1029,7 +999,7 @@ xpc_setup_ch_structures_sn_uv(struct xpc_partition *part) | |||
1029 | * Teardown the channel structures that are uv specific. | 999 | * Teardown the channel structures that are uv specific. |
1030 | */ | 1000 | */ |
1031 | static void | 1001 | static void |
1032 | xpc_teardown_ch_structures_sn_uv(struct xpc_partition *part) | 1002 | xpc_teardown_ch_structures_uv(struct xpc_partition *part) |
1033 | { | 1003 | { |
1034 | /* nothing needs to be done */ | 1004 | /* nothing needs to be done */ |
1035 | return; | 1005 | return; |
@@ -1243,6 +1213,16 @@ xpc_send_chctl_openreply_uv(struct xpc_channel *ch, unsigned long *irq_flags) | |||
1243 | } | 1213 | } |
1244 | 1214 | ||
1245 | static void | 1215 | static void |
1216 | xpc_send_chctl_opencomplete_uv(struct xpc_channel *ch, unsigned long *irq_flags) | ||
1217 | { | ||
1218 | struct xpc_activate_mq_msg_chctl_opencomplete_uv msg; | ||
1219 | |||
1220 | msg.ch_number = ch->number; | ||
1221 | xpc_send_activate_IRQ_ch_uv(ch, irq_flags, &msg, sizeof(msg), | ||
1222 | XPC_ACTIVATE_MQ_MSG_CHCTL_OPENCOMPLETE_UV); | ||
1223 | } | ||
1224 | |||
1225 | static void | ||
1246 | xpc_send_chctl_local_msgrequest_uv(struct xpc_partition *part, int ch_number) | 1226 | xpc_send_chctl_local_msgrequest_uv(struct xpc_partition *part, int ch_number) |
1247 | { | 1227 | { |
1248 | unsigned long irq_flags; | 1228 | unsigned long irq_flags; |
@@ -1669,58 +1649,67 @@ xpc_received_payload_uv(struct xpc_channel *ch, void *payload) | |||
1669 | msg->hdr.msg_slot_number += ch->remote_nentries; | 1649 | msg->hdr.msg_slot_number += ch->remote_nentries; |
1670 | } | 1650 | } |
1671 | 1651 | ||
1652 | static struct xpc_arch_operations xpc_arch_ops_uv = { | ||
1653 | .setup_partitions = xpc_setup_partitions_uv, | ||
1654 | .teardown_partitions = xpc_teardown_partitions_uv, | ||
1655 | .process_activate_IRQ_rcvd = xpc_process_activate_IRQ_rcvd_uv, | ||
1656 | .get_partition_rsvd_page_pa = xpc_get_partition_rsvd_page_pa_uv, | ||
1657 | .setup_rsvd_page = xpc_setup_rsvd_page_uv, | ||
1658 | |||
1659 | .allow_hb = xpc_allow_hb_uv, | ||
1660 | .disallow_hb = xpc_disallow_hb_uv, | ||
1661 | .disallow_all_hbs = xpc_disallow_all_hbs_uv, | ||
1662 | .increment_heartbeat = xpc_increment_heartbeat_uv, | ||
1663 | .offline_heartbeat = xpc_offline_heartbeat_uv, | ||
1664 | .online_heartbeat = xpc_online_heartbeat_uv, | ||
1665 | .heartbeat_init = xpc_heartbeat_init_uv, | ||
1666 | .heartbeat_exit = xpc_heartbeat_exit_uv, | ||
1667 | .get_remote_heartbeat = xpc_get_remote_heartbeat_uv, | ||
1668 | |||
1669 | .request_partition_activation = | ||
1670 | xpc_request_partition_activation_uv, | ||
1671 | .request_partition_reactivation = | ||
1672 | xpc_request_partition_reactivation_uv, | ||
1673 | .request_partition_deactivation = | ||
1674 | xpc_request_partition_deactivation_uv, | ||
1675 | .cancel_partition_deactivation_request = | ||
1676 | xpc_cancel_partition_deactivation_request_uv, | ||
1677 | |||
1678 | .setup_ch_structures = xpc_setup_ch_structures_uv, | ||
1679 | .teardown_ch_structures = xpc_teardown_ch_structures_uv, | ||
1680 | |||
1681 | .make_first_contact = xpc_make_first_contact_uv, | ||
1682 | |||
1683 | .get_chctl_all_flags = xpc_get_chctl_all_flags_uv, | ||
1684 | .send_chctl_closerequest = xpc_send_chctl_closerequest_uv, | ||
1685 | .send_chctl_closereply = xpc_send_chctl_closereply_uv, | ||
1686 | .send_chctl_openrequest = xpc_send_chctl_openrequest_uv, | ||
1687 | .send_chctl_openreply = xpc_send_chctl_openreply_uv, | ||
1688 | .send_chctl_opencomplete = xpc_send_chctl_opencomplete_uv, | ||
1689 | .process_msg_chctl_flags = xpc_process_msg_chctl_flags_uv, | ||
1690 | |||
1691 | .save_remote_msgqueue_pa = xpc_save_remote_msgqueue_pa_uv, | ||
1692 | |||
1693 | .setup_msg_structures = xpc_setup_msg_structures_uv, | ||
1694 | .teardown_msg_structures = xpc_teardown_msg_structures_uv, | ||
1695 | |||
1696 | .indicate_partition_engaged = xpc_indicate_partition_engaged_uv, | ||
1697 | .indicate_partition_disengaged = xpc_indicate_partition_disengaged_uv, | ||
1698 | .assume_partition_disengaged = xpc_assume_partition_disengaged_uv, | ||
1699 | .partition_engaged = xpc_partition_engaged_uv, | ||
1700 | .any_partition_engaged = xpc_any_partition_engaged_uv, | ||
1701 | |||
1702 | .n_of_deliverable_payloads = xpc_n_of_deliverable_payloads_uv, | ||
1703 | .send_payload = xpc_send_payload_uv, | ||
1704 | .get_deliverable_payload = xpc_get_deliverable_payload_uv, | ||
1705 | .received_payload = xpc_received_payload_uv, | ||
1706 | .notify_senders_of_disconnect = xpc_notify_senders_of_disconnect_uv, | ||
1707 | }; | ||
1708 | |||
1672 | int | 1709 | int |
1673 | xpc_init_uv(void) | 1710 | xpc_init_uv(void) |
1674 | { | 1711 | { |
1675 | xpc_setup_partitions_sn = xpc_setup_partitions_sn_uv; | 1712 | xpc_arch_ops = xpc_arch_ops_uv; |
1676 | xpc_teardown_partitions_sn = xpc_teardown_partitions_sn_uv; | ||
1677 | xpc_process_activate_IRQ_rcvd = xpc_process_activate_IRQ_rcvd_uv; | ||
1678 | xpc_get_partition_rsvd_page_pa = xpc_get_partition_rsvd_page_pa_uv; | ||
1679 | xpc_setup_rsvd_page_sn = xpc_setup_rsvd_page_sn_uv; | ||
1680 | xpc_increment_heartbeat = xpc_increment_heartbeat_uv; | ||
1681 | xpc_offline_heartbeat = xpc_offline_heartbeat_uv; | ||
1682 | xpc_online_heartbeat = xpc_online_heartbeat_uv; | ||
1683 | xpc_heartbeat_init = xpc_heartbeat_init_uv; | ||
1684 | xpc_heartbeat_exit = xpc_heartbeat_exit_uv; | ||
1685 | xpc_get_remote_heartbeat = xpc_get_remote_heartbeat_uv; | ||
1686 | |||
1687 | xpc_request_partition_activation = xpc_request_partition_activation_uv; | ||
1688 | xpc_request_partition_reactivation = | ||
1689 | xpc_request_partition_reactivation_uv; | ||
1690 | xpc_request_partition_deactivation = | ||
1691 | xpc_request_partition_deactivation_uv; | ||
1692 | xpc_cancel_partition_deactivation_request = | ||
1693 | xpc_cancel_partition_deactivation_request_uv; | ||
1694 | |||
1695 | xpc_setup_ch_structures_sn = xpc_setup_ch_structures_sn_uv; | ||
1696 | xpc_teardown_ch_structures_sn = xpc_teardown_ch_structures_sn_uv; | ||
1697 | |||
1698 | xpc_make_first_contact = xpc_make_first_contact_uv; | ||
1699 | |||
1700 | xpc_get_chctl_all_flags = xpc_get_chctl_all_flags_uv; | ||
1701 | xpc_send_chctl_closerequest = xpc_send_chctl_closerequest_uv; | ||
1702 | xpc_send_chctl_closereply = xpc_send_chctl_closereply_uv; | ||
1703 | xpc_send_chctl_openrequest = xpc_send_chctl_openrequest_uv; | ||
1704 | xpc_send_chctl_openreply = xpc_send_chctl_openreply_uv; | ||
1705 | |||
1706 | xpc_save_remote_msgqueue_pa = xpc_save_remote_msgqueue_pa_uv; | ||
1707 | |||
1708 | xpc_setup_msg_structures = xpc_setup_msg_structures_uv; | ||
1709 | xpc_teardown_msg_structures = xpc_teardown_msg_structures_uv; | ||
1710 | |||
1711 | xpc_indicate_partition_engaged = xpc_indicate_partition_engaged_uv; | ||
1712 | xpc_indicate_partition_disengaged = | ||
1713 | xpc_indicate_partition_disengaged_uv; | ||
1714 | xpc_assume_partition_disengaged = xpc_assume_partition_disengaged_uv; | ||
1715 | xpc_partition_engaged = xpc_partition_engaged_uv; | ||
1716 | xpc_any_partition_engaged = xpc_any_partition_engaged_uv; | ||
1717 | |||
1718 | xpc_n_of_deliverable_payloads = xpc_n_of_deliverable_payloads_uv; | ||
1719 | xpc_process_msg_chctl_flags = xpc_process_msg_chctl_flags_uv; | ||
1720 | xpc_send_payload = xpc_send_payload_uv; | ||
1721 | xpc_notify_senders_of_disconnect = xpc_notify_senders_of_disconnect_uv; | ||
1722 | xpc_get_deliverable_payload = xpc_get_deliverable_payload_uv; | ||
1723 | xpc_received_payload = xpc_received_payload_uv; | ||
1724 | 1713 | ||
1725 | if (sizeof(struct xpc_notify_mq_msghdr_uv) > XPC_MSG_HDR_MAX_SIZE) { | 1714 | if (sizeof(struct xpc_notify_mq_msghdr_uv) > XPC_MSG_HDR_MAX_SIZE) { |
1726 | dev_err(xpc_part, "xpc_notify_mq_msghdr_uv is larger than %d\n", | 1715 | dev_err(xpc_part, "xpc_notify_mq_msghdr_uv is larger than %d\n", |