aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc/sgi-xp/xpc_main.c
diff options
context:
space:
mode:
authorDean Nelson <dcn@sgi.com>2008-07-30 01:34:06 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-07-30 12:41:49 -0400
commite17d416b1bc947df68499863f13b401fb42b48f6 (patch)
treed0c766c93dce9acb27948022b1613347981fd9b3 /drivers/misc/sgi-xp/xpc_main.c
parent94bd2708d4a95d7da5a1c7c28a063eccd127fb69 (diff)
sgi-xp: isolate xpc_vars_part structure to sn2 only
Isolate the xpc_vars_part structure of XPC's reserved page to sn2 only. Signed-off-by: Dean Nelson <dcn@sgi.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/misc/sgi-xp/xpc_main.c')
-rw-r--r--drivers/misc/sgi-xp/xpc_main.c97
1 files changed, 25 insertions, 72 deletions
diff --git a/drivers/misc/sgi-xp/xpc_main.c b/drivers/misc/sgi-xp/xpc_main.c
index 2180f1f7e087..be3a48539307 100644
--- a/drivers/misc/sgi-xp/xpc_main.c
+++ b/drivers/misc/sgi-xp/xpc_main.c
@@ -176,6 +176,12 @@ static struct notifier_block xpc_die_notifier = {
176}; 176};
177 177
178enum xp_retval (*xpc_rsvd_page_init) (struct xpc_rsvd_page *rp); 178enum xp_retval (*xpc_rsvd_page_init) (struct xpc_rsvd_page *rp);
179enum xp_retval (*xpc_make_first_contact) (struct xpc_partition *part);
180u64 (*xpc_get_IPI_flags) (struct xpc_partition *part);
181struct xpc_msg *(*xpc_get_deliverable_msg) (struct xpc_channel *ch);
182enum xp_retval (*xpc_setup_infrastructure) (struct xpc_partition *part);
183void (*xpc_teardown_infrastructure) (struct xpc_partition *part);
184
179 185
180/* 186/*
181 * Timer function to enforce the timelimit on the partition disengage request. 187 * Timer function to enforce the timelimit on the partition disengage request.
@@ -313,37 +319,8 @@ xpc_initiate_discovery(void *ignore)
313} 319}
314 320
315/* 321/*
316 * Establish first contact with the remote partititon. This involves pulling
317 * the XPC per partition variables from the remote partition and waiting for
318 * the remote partition to pull ours.
319 */
320static enum xp_retval
321xpc_make_first_contact(struct xpc_partition *part)
322{
323 enum xp_retval ret;
324
325 while ((ret = xpc_pull_remote_vars_part(part)) != xpSuccess) {
326 if (ret != xpRetry) {
327 XPC_DEACTIVATE_PARTITION(part, ret);
328 return ret;
329 }
330
331 dev_dbg(xpc_chan, "waiting to make first contact with "
332 "partition %d\n", XPC_PARTID(part));
333
334 /* wait a 1/4 of a second or so */
335 (void)msleep_interruptible(250);
336
337 if (part->act_state == XPC_P_DEACTIVATING)
338 return part->reason;
339 }
340
341 return xpc_mark_partition_active(part);
342}
343
344/*
345 * The first kthread assigned to a newly activated partition is the one 322 * The first kthread assigned to a newly activated partition is the one
346 * created by XPC HB with which it calls xpc_partition_up(). XPC hangs on to 323 * created by XPC HB with which it calls xpc_activating(). XPC hangs on to
347 * that kthread until the partition is brought down, at which time that kthread 324 * that kthread until the partition is brought down, at which time that kthread
348 * returns back to XPC HB. (The return of that kthread will signify to XPC HB 325 * returns back to XPC HB. (The return of that kthread will signify to XPC HB
349 * that XPC has dismantled all communication infrastructure for the associated 326 * that XPC has dismantled all communication infrastructure for the associated
@@ -393,41 +370,10 @@ xpc_channel_mgr(struct xpc_partition *part)
393 * upped partition. 370 * upped partition.
394 * 371 *
395 * The kthread that was created by XPC HB and which setup the XPC 372 * The kthread that was created by XPC HB and which setup the XPC
396 * infrastructure will remain assigned to the partition until the partition 373 * infrastructure will remain assigned to the partition becoming the channel
397 * goes down. At which time the kthread will teardown the XPC infrastructure 374 * manager for that partition until the partition is deactivating, at which
398 * and then exit. 375 * time the kthread will teardown the XPC infrastructure and then exit.
399 *
400 * XPC HB will put the remote partition's XPC per partition specific variables
401 * physical address into xpc_partitions[partid].remote_vars_part_pa prior to
402 * calling xpc_partition_up().
403 */ 376 */
404static void
405xpc_partition_up(struct xpc_partition *part)
406{
407 DBUG_ON(part->channels != NULL);
408
409 dev_dbg(xpc_chan, "activating partition %d\n", XPC_PARTID(part));
410
411 if (xpc_setup_infrastructure(part) != xpSuccess)
412 return;
413
414 /*
415 * The kthread that XPC HB called us with will become the
416 * channel manager for this partition. It will not return
417 * back to XPC HB until the partition's XPC infrastructure
418 * has been dismantled.
419 */
420
421 (void)xpc_part_ref(part); /* this will always succeed */
422
423 if (xpc_make_first_contact(part) == xpSuccess)
424 xpc_channel_mgr(part);
425
426 xpc_part_deref(part);
427
428 xpc_teardown_infrastructure(part);
429}
430
431static int 377static int
432xpc_activating(void *__partid) 378xpc_activating(void *__partid)
433{ 379{
@@ -453,7 +399,7 @@ xpc_activating(void *__partid)
453 XPC_SET_REASON(part, 0, 0); 399 XPC_SET_REASON(part, 0, 0);
454 spin_unlock_irqrestore(&part->act_lock, irq_flags); 400 spin_unlock_irqrestore(&part->act_lock, irq_flags);
455 401
456 dev_dbg(xpc_part, "bringing partition %d up\n", partid); 402 dev_dbg(xpc_part, "activating partition %d\n", partid);
457 403
458 /* 404 /*
459 * Register the remote partition's AMOs with SAL so it can handle 405 * Register the remote partition's AMOs with SAL so it can handle
@@ -467,7 +413,7 @@ xpc_activating(void *__partid)
467 */ 413 */
468 if (sn_register_xp_addr_region(part->remote_amos_page_pa, 414 if (sn_register_xp_addr_region(part->remote_amos_page_pa,
469 PAGE_SIZE, 1) < 0) { 415 PAGE_SIZE, 1) < 0) {
470 dev_warn(xpc_part, "xpc_partition_up(%d) failed to register " 416 dev_warn(xpc_part, "xpc_activating(%d) failed to register "
471 "xp_addr region\n", partid); 417 "xp_addr region\n", partid);
472 418
473 spin_lock_irqsave(&part->act_lock, irq_flags); 419 spin_lock_irqsave(&part->act_lock, irq_flags);
@@ -481,11 +427,18 @@ xpc_activating(void *__partid)
481 xpc_allow_hb(partid, xpc_vars); 427 xpc_allow_hb(partid, xpc_vars);
482 xpc_IPI_send_activated(part); 428 xpc_IPI_send_activated(part);
483 429
484 /* 430 if (xpc_setup_infrastructure(part) == xpSuccess) {
485 * xpc_partition_up() holds this thread and marks this partition as 431 (void)xpc_part_ref(part); /* this will always succeed */
486 * XPC_P_ACTIVE by calling xpc_hb_mark_active(). 432
487 */ 433 if (xpc_make_first_contact(part) == xpSuccess) {
488 (void)xpc_partition_up(part); 434 xpc_mark_partition_active(part);
435 xpc_channel_mgr(part);
436 /* won't return until partition is deactivating */
437 }
438
439 xpc_part_deref(part);
440 xpc_teardown_infrastructure(part);
441 }
489 442
490 xpc_disallow_hb(partid, xpc_vars); 443 xpc_disallow_hb(partid, xpc_vars);
491 xpc_mark_partition_inactive(part); 444 xpc_mark_partition_inactive(part);
@@ -568,7 +521,7 @@ xpc_dropped_IPI_check(struct xpc_partition *part)
568 xpc_check_for_channel_activity(part); 521 xpc_check_for_channel_activity(part);
569 522
570 part->dropped_IPI_timer.expires = jiffies + 523 part->dropped_IPI_timer.expires = jiffies +
571 XPC_P_DROPPED_IPI_WAIT; 524 XPC_P_DROPPED_IPI_WAIT_INTERVAL;
572 add_timer(&part->dropped_IPI_timer); 525 add_timer(&part->dropped_IPI_timer);
573 xpc_part_deref(part); 526 xpc_part_deref(part);
574 } 527 }