aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc/sgi-xp/xpc_channel.c
diff options
context:
space:
mode:
authorDean Nelson <dcn@sgi.com>2008-07-30 01:34:19 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-07-30 12:41:50 -0400
commitbd3e64c1759e4930315ebf022611468ee9621486 (patch)
tree314f4f8a80788b181aa03714d952854c8e2a1866 /drivers/misc/sgi-xp/xpc_channel.c
parent5b8669dfd110a62a74eea525a009342f73987ea0 (diff)
sgi-xp: setup the notify GRU message queue
Setup the notify GRU message queue that is used for sending user messages on UV systems. Signed-off-by: Dean Nelson <dcn@sgi.com> Cc: Jack Steiner <steiner@sgi.com> Cc: "Luck, Tony" <tony.luck@intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/misc/sgi-xp/xpc_channel.c')
-rw-r--r--drivers/misc/sgi-xp/xpc_channel.c63
1 files changed, 29 insertions, 34 deletions
diff --git a/drivers/misc/sgi-xp/xpc_channel.c b/drivers/misc/sgi-xp/xpc_channel.c
index 73df9fb5ee66..9cd2ebe2a3b6 100644
--- a/drivers/misc/sgi-xp/xpc_channel.c
+++ b/drivers/misc/sgi-xp/xpc_channel.c
@@ -139,7 +139,7 @@ xpc_process_disconnect(struct xpc_channel *ch, unsigned long *irq_flags)
139 139
140 ch->func = NULL; 140 ch->func = NULL;
141 ch->key = NULL; 141 ch->key = NULL;
142 ch->msg_size = 0; 142 ch->entry_size = 0;
143 ch->local_nentries = 0; 143 ch->local_nentries = 0;
144 ch->remote_nentries = 0; 144 ch->remote_nentries = 0;
145 ch->kthreads_assigned_limit = 0; 145 ch->kthreads_assigned_limit = 0;
@@ -315,9 +315,9 @@ again:
315 315
316 if (chctl_flags & XPC_CHCTL_OPENREQUEST) { 316 if (chctl_flags & XPC_CHCTL_OPENREQUEST) {
317 317
318 dev_dbg(xpc_chan, "XPC_CHCTL_OPENREQUEST (msg_size=%d, " 318 dev_dbg(xpc_chan, "XPC_CHCTL_OPENREQUEST (entry_size=%d, "
319 "local_nentries=%d) received from partid=%d, " 319 "local_nentries=%d) received from partid=%d, "
320 "channel=%d\n", args->msg_size, args->local_nentries, 320 "channel=%d\n", args->entry_size, args->local_nentries,
321 ch->partid, ch->number); 321 ch->partid, ch->number);
322 322
323 if (part->act_state == XPC_P_AS_DEACTIVATING || 323 if (part->act_state == XPC_P_AS_DEACTIVATING ||
@@ -338,10 +338,10 @@ again:
338 338
339 /* 339 /*
340 * The meaningful OPENREQUEST connection state fields are: 340 * The meaningful OPENREQUEST connection state fields are:
341 * msg_size = size of channel's messages in bytes 341 * entry_size = size of channel's messages in bytes
342 * local_nentries = remote partition's local_nentries 342 * local_nentries = remote partition's local_nentries
343 */ 343 */
344 if (args->msg_size == 0 || args->local_nentries == 0) { 344 if (args->entry_size == 0 || args->local_nentries == 0) {
345 /* assume OPENREQUEST was delayed by mistake */ 345 /* assume OPENREQUEST was delayed by mistake */
346 spin_unlock_irqrestore(&ch->lock, irq_flags); 346 spin_unlock_irqrestore(&ch->lock, irq_flags);
347 return; 347 return;
@@ -351,14 +351,14 @@ again:
351 ch->remote_nentries = args->local_nentries; 351 ch->remote_nentries = args->local_nentries;
352 352
353 if (ch->flags & XPC_C_OPENREQUEST) { 353 if (ch->flags & XPC_C_OPENREQUEST) {
354 if (args->msg_size != ch->msg_size) { 354 if (args->entry_size != ch->entry_size) {
355 XPC_DISCONNECT_CHANNEL(ch, xpUnequalMsgSizes, 355 XPC_DISCONNECT_CHANNEL(ch, xpUnequalMsgSizes,
356 &irq_flags); 356 &irq_flags);
357 spin_unlock_irqrestore(&ch->lock, irq_flags); 357 spin_unlock_irqrestore(&ch->lock, irq_flags);
358 return; 358 return;
359 } 359 }
360 } else { 360 } else {
361 ch->msg_size = args->msg_size; 361 ch->entry_size = args->entry_size;
362 362
363 XPC_SET_REASON(ch, 0, 0); 363 XPC_SET_REASON(ch, 0, 0);
364 ch->flags &= ~XPC_C_DISCONNECTED; 364 ch->flags &= ~XPC_C_DISCONNECTED;
@@ -473,7 +473,7 @@ xpc_connect_channel(struct xpc_channel *ch)
473 ch->local_nentries = registration->nentries; 473 ch->local_nentries = registration->nentries;
474 474
475 if (ch->flags & XPC_C_ROPENREQUEST) { 475 if (ch->flags & XPC_C_ROPENREQUEST) {
476 if (registration->msg_size != ch->msg_size) { 476 if (registration->entry_size != ch->entry_size) {
477 /* the local and remote sides aren't the same */ 477 /* the local and remote sides aren't the same */
478 478
479 /* 479 /*
@@ -492,7 +492,7 @@ xpc_connect_channel(struct xpc_channel *ch)
492 return xpUnequalMsgSizes; 492 return xpUnequalMsgSizes;
493 } 493 }
494 } else { 494 } else {
495 ch->msg_size = registration->msg_size; 495 ch->entry_size = registration->entry_size;
496 496
497 XPC_SET_REASON(ch, 0, 0); 497 XPC_SET_REASON(ch, 0, 0);
498 ch->flags &= ~XPC_C_DISCONNECTED; 498 ch->flags &= ~XPC_C_DISCONNECTED;
@@ -859,8 +859,8 @@ xpc_initiate_send(short partid, int ch_number, u32 flags, void *payload,
859 DBUG_ON(payload == NULL); 859 DBUG_ON(payload == NULL);
860 860
861 if (xpc_part_ref(part)) { 861 if (xpc_part_ref(part)) {
862 ret = xpc_send_msg(&part->channels[ch_number], flags, payload, 862 ret = xpc_send_payload(&part->channels[ch_number], flags,
863 payload_size, 0, NULL, NULL); 863 payload, payload_size, 0, NULL, NULL);
864 xpc_part_deref(part); 864 xpc_part_deref(part);
865 } 865 }
866 866
@@ -911,23 +911,24 @@ xpc_initiate_send_notify(short partid, int ch_number, u32 flags, void *payload,
911 DBUG_ON(func == NULL); 911 DBUG_ON(func == NULL);
912 912
913 if (xpc_part_ref(part)) { 913 if (xpc_part_ref(part)) {
914 ret = xpc_send_msg(&part->channels[ch_number], flags, payload, 914 ret = xpc_send_payload(&part->channels[ch_number], flags,
915 payload_size, XPC_N_CALL, func, key); 915 payload, payload_size, XPC_N_CALL, func,
916 key);
916 xpc_part_deref(part); 917 xpc_part_deref(part);
917 } 918 }
918 return ret; 919 return ret;
919} 920}
920 921
921/* 922/*
922 * Deliver a message to its intended recipient. 923 * Deliver a message's payload to its intended recipient.
923 */ 924 */
924void 925void
925xpc_deliver_msg(struct xpc_channel *ch) 926xpc_deliver_payload(struct xpc_channel *ch)
926{ 927{
927 struct xpc_msg *msg; 928 void *payload;
928 929
929 msg = xpc_get_deliverable_msg(ch); 930 payload = xpc_get_deliverable_payload(ch);
930 if (msg != NULL) { 931 if (payload != NULL) {
931 932
932 /* 933 /*
933 * This ref is taken to protect the payload itself from being 934 * This ref is taken to protect the payload itself from being
@@ -939,18 +940,16 @@ xpc_deliver_msg(struct xpc_channel *ch)
939 atomic_inc(&ch->kthreads_active); 940 atomic_inc(&ch->kthreads_active);
940 941
941 if (ch->func != NULL) { 942 if (ch->func != NULL) {
942 dev_dbg(xpc_chan, "ch->func() called, msg=0x%p, " 943 dev_dbg(xpc_chan, "ch->func() called, payload=0x%p "
943 "msg_number=%ld, partid=%d, channel=%d\n", 944 "partid=%d channel=%d\n", payload, ch->partid,
944 msg, (signed long)msg->number, ch->partid,
945 ch->number); 945 ch->number);
946 946
947 /* deliver the message to its intended recipient */ 947 /* deliver the message to its intended recipient */
948 ch->func(xpMsgReceived, ch->partid, ch->number, 948 ch->func(xpMsgReceived, ch->partid, ch->number, payload,
949 &msg->payload, ch->key); 949 ch->key);
950 950
951 dev_dbg(xpc_chan, "ch->func() returned, msg=0x%p, " 951 dev_dbg(xpc_chan, "ch->func() returned, payload=0x%p "
952 "msg_number=%ld, partid=%d, channel=%d\n", 952 "partid=%d channel=%d\n", payload, ch->partid,
953 msg, (signed long)msg->number, ch->partid,
954 ch->number); 953 ch->number);
955 } 954 }
956 955
@@ -959,14 +958,11 @@ xpc_deliver_msg(struct xpc_channel *ch)
959} 958}
960 959
961/* 960/*
962 * Acknowledge receipt of a delivered message. 961 * Acknowledge receipt of a delivered message's payload.
963 *
964 * If a message has XPC_M_INTERRUPT set, send an interrupt to the partition
965 * that sent the message.
966 * 962 *
967 * This function, although called by users, does not call xpc_part_ref() to 963 * This function, although called by users, does not call xpc_part_ref() to
968 * ensure that the partition infrastructure is in place. It relies on the 964 * ensure that the partition infrastructure is in place. It relies on the
969 * fact that we called xpc_msgqueue_ref() in xpc_deliver_msg(). 965 * fact that we called xpc_msgqueue_ref() in xpc_deliver_payload().
970 * 966 *
971 * Arguments: 967 * Arguments:
972 * 968 *
@@ -980,14 +976,13 @@ xpc_initiate_received(short partid, int ch_number, void *payload)
980{ 976{
981 struct xpc_partition *part = &xpc_partitions[partid]; 977 struct xpc_partition *part = &xpc_partitions[partid];
982 struct xpc_channel *ch; 978 struct xpc_channel *ch;
983 struct xpc_msg *msg = XPC_MSG_ADDRESS(payload);
984 979
985 DBUG_ON(partid < 0 || partid >= xp_max_npartitions); 980 DBUG_ON(partid < 0 || partid >= xp_max_npartitions);
986 DBUG_ON(ch_number < 0 || ch_number >= part->nchannels); 981 DBUG_ON(ch_number < 0 || ch_number >= part->nchannels);
987 982
988 ch = &part->channels[ch_number]; 983 ch = &part->channels[ch_number];
989 xpc_received_msg(ch, msg); 984 xpc_received_payload(ch, payload);
990 985
991 /* the call to xpc_msgqueue_ref() was done by xpc_deliver_msg() */ 986 /* the call to xpc_msgqueue_ref() was done by xpc_deliver_payload() */
992 xpc_msgqueue_deref(ch); 987 xpc_msgqueue_deref(ch);
993} 988}