Lines Matching full:part
15 * partition This part detects the presence/absence of other
19 * channel This part manages the channels and sends/receives
67 .init_name = "", /* set to "part" at xpc_init() time */
177 struct xpc_partition *part = from_timer(part, t, disengage_timer); in xpc_timeout_partition_disengage() local
179 DBUG_ON(time_is_after_jiffies(part->disengage_timeout)); in xpc_timeout_partition_disengage()
181 (void)xpc_partition_disengaged(part); in xpc_timeout_partition_disengage()
183 DBUG_ON(part->disengage_timeout != 0); in xpc_timeout_partition_disengage()
184 DBUG_ON(xpc_arch_ops.partition_engaged(XPC_PARTID(part))); in xpc_timeout_partition_disengage()
226 struct xpc_partition *part; in xpc_check_remote_hb() local
238 part = &xpc_partitions[partid]; in xpc_check_remote_hb()
240 if (part->act_state == XPC_P_AS_INACTIVE || in xpc_check_remote_hb()
241 part->act_state == XPC_P_AS_DEACTIVATING) { in xpc_check_remote_hb()
245 ret = xpc_arch_ops.get_remote_heartbeat(part); in xpc_check_remote_hb()
247 XPC_DEACTIVATE_PARTITION(part, ret); in xpc_check_remote_hb()
339 xpc_channel_mgr(struct xpc_partition *part) in xpc_channel_mgr() argument
341 while (part->act_state != XPC_P_AS_DEACTIVATING || in xpc_channel_mgr()
342 atomic_read(&part->nchannels_active) > 0 || in xpc_channel_mgr()
343 !xpc_partition_disengaged(part)) { in xpc_channel_mgr()
345 xpc_process_sent_chctl_flags(part); in xpc_channel_mgr()
360 atomic_dec(&part->channel_mgr_requests); in xpc_channel_mgr()
361 (void)wait_event_interruptible(part->channel_mgr_wq, in xpc_channel_mgr()
362 (atomic_read(&part->channel_mgr_requests) > 0 || in xpc_channel_mgr()
363 part->chctl.all_flags != 0 || in xpc_channel_mgr()
364 (part->act_state == XPC_P_AS_DEACTIVATING && in xpc_channel_mgr()
365 atomic_read(&part->nchannels_active) == 0 && in xpc_channel_mgr()
366 xpc_partition_disengaged(part)))); in xpc_channel_mgr()
367 atomic_set(&part->channel_mgr_requests, 1); in xpc_channel_mgr()
400 xpc_setup_ch_structures(struct xpc_partition *part) in xpc_setup_ch_structures() argument
405 short partid = XPC_PARTID(part); in xpc_setup_ch_structures()
411 DBUG_ON(part->channels != NULL); in xpc_setup_ch_structures()
412 part->channels = kcalloc(XPC_MAX_NCHANNELS, in xpc_setup_ch_structures()
415 if (part->channels == NULL) { in xpc_setup_ch_structures()
422 part->remote_openclose_args = in xpc_setup_ch_structures()
424 GFP_KERNEL, &part-> in xpc_setup_ch_structures()
426 if (part->remote_openclose_args == NULL) { in xpc_setup_ch_structures()
432 part->chctl.all_flags = 0; in xpc_setup_ch_structures()
433 spin_lock_init(&part->chctl_lock); in xpc_setup_ch_structures()
435 atomic_set(&part->channel_mgr_requests, 1); in xpc_setup_ch_structures()
436 init_waitqueue_head(&part->channel_mgr_wq); in xpc_setup_ch_structures()
438 part->nchannels = XPC_MAX_NCHANNELS; in xpc_setup_ch_structures()
440 atomic_set(&part->nchannels_active, 0); in xpc_setup_ch_structures()
441 atomic_set(&part->nchannels_engaged, 0); in xpc_setup_ch_structures()
443 for (ch_number = 0; ch_number < part->nchannels; ch_number++) { in xpc_setup_ch_structures()
444 ch = &part->channels[ch_number]; in xpc_setup_ch_structures()
465 ret = xpc_arch_ops.setup_ch_structures(part); in xpc_setup_ch_structures()
473 part->setup_state = XPC_P_SS_SETUP; in xpc_setup_ch_structures()
479 kfree(part->remote_openclose_args_base); in xpc_setup_ch_structures()
480 part->remote_openclose_args = NULL; in xpc_setup_ch_structures()
482 kfree(part->channels); in xpc_setup_ch_structures()
483 part->channels = NULL; in xpc_setup_ch_structures()
492 xpc_teardown_ch_structures(struct xpc_partition *part) in xpc_teardown_ch_structures() argument
494 DBUG_ON(atomic_read(&part->nchannels_engaged) != 0); in xpc_teardown_ch_structures()
495 DBUG_ON(atomic_read(&part->nchannels_active) != 0); in xpc_teardown_ch_structures()
502 DBUG_ON(part->setup_state != XPC_P_SS_SETUP); in xpc_teardown_ch_structures()
503 part->setup_state = XPC_P_SS_WTEARDOWN; in xpc_teardown_ch_structures()
505 wait_event(part->teardown_wq, (atomic_read(&part->references) == 0)); in xpc_teardown_ch_structures()
509 xpc_arch_ops.teardown_ch_structures(part); in xpc_teardown_ch_structures()
511 kfree(part->remote_openclose_args_base); in xpc_teardown_ch_structures()
512 part->remote_openclose_args = NULL; in xpc_teardown_ch_structures()
513 kfree(part->channels); in xpc_teardown_ch_structures()
514 part->channels = NULL; in xpc_teardown_ch_structures()
516 part->setup_state = XPC_P_SS_TORNDOWN; in xpc_teardown_ch_structures()
534 struct xpc_partition *part = &xpc_partitions[partid]; in xpc_activating() local
539 spin_lock_irqsave(&part->act_lock, irq_flags); in xpc_activating()
541 if (part->act_state == XPC_P_AS_DEACTIVATING) { in xpc_activating()
542 part->act_state = XPC_P_AS_INACTIVE; in xpc_activating()
543 spin_unlock_irqrestore(&part->act_lock, irq_flags); in xpc_activating()
544 part->remote_rp_pa = 0; in xpc_activating()
549 DBUG_ON(part->act_state != XPC_P_AS_ACTIVATION_REQ); in xpc_activating()
550 part->act_state = XPC_P_AS_ACTIVATING; in xpc_activating()
552 XPC_SET_REASON(part, 0, 0); in xpc_activating()
553 spin_unlock_irqrestore(&part->act_lock, irq_flags); in xpc_activating()
559 if (xpc_setup_ch_structures(part) == xpSuccess) { in xpc_activating()
560 (void)xpc_part_ref(part); /* this will always succeed */ in xpc_activating()
562 if (xpc_arch_ops.make_first_contact(part) == xpSuccess) { in xpc_activating()
563 xpc_mark_partition_active(part); in xpc_activating()
564 xpc_channel_mgr(part); in xpc_activating()
568 xpc_part_deref(part); in xpc_activating()
569 xpc_teardown_ch_structures(part); in xpc_activating()
573 xpc_mark_partition_inactive(part); in xpc_activating()
575 if (part->reason == xpReactivating) { in xpc_activating()
577 xpc_arch_ops.request_partition_reactivation(part); in xpc_activating()
584 xpc_activate_partition(struct xpc_partition *part) in xpc_activate_partition() argument
586 short partid = XPC_PARTID(part); in xpc_activate_partition()
590 spin_lock_irqsave(&part->act_lock, irq_flags); in xpc_activate_partition()
592 DBUG_ON(part->act_state != XPC_P_AS_INACTIVE); in xpc_activate_partition()
594 part->act_state = XPC_P_AS_ACTIVATION_REQ; in xpc_activate_partition()
595 XPC_SET_REASON(part, xpCloneKThread, __LINE__); in xpc_activate_partition()
597 spin_unlock_irqrestore(&part->act_lock, irq_flags); in xpc_activate_partition()
602 spin_lock_irqsave(&part->act_lock, irq_flags); in xpc_activate_partition()
603 part->act_state = XPC_P_AS_INACTIVE; in xpc_activate_partition()
604 XPC_SET_REASON(part, xpCloneKThreadFailed, __LINE__); in xpc_activate_partition()
605 spin_unlock_irqrestore(&part->act_lock, irq_flags); in xpc_activate_partition()
648 xpc_kthread_waitmsgs(struct xpc_partition *part, struct xpc_channel *ch) in xpc_kthread_waitmsgs() argument
685 struct xpc_partition *part = &xpc_partitions[partid]; in xpc_kthread_start() local
695 ch = &part->channels[ch_number]; in xpc_kthread_start()
727 xpc_kthread_waitmsgs(part, ch); in xpc_kthread_start()
746 atomic_dec_return(&part->nchannels_engaged) == 0) { in xpc_kthread_start()
747 xpc_arch_ops.indicate_partition_disengaged(part); in xpc_kthread_start()
755 xpc_part_deref(part); in xpc_kthread_start()
777 struct xpc_partition *part = &xpc_partitions[ch->partid]; in xpc_create_kthreads() local
801 atomic_inc_return(&part->nchannels_engaged) == 1) { in xpc_create_kthreads()
802 xpc_arch_ops.indicate_partition_engaged(part); in xpc_create_kthreads()
804 (void)xpc_part_ref(part); in xpc_create_kthreads()
823 atomic_dec_return(&part->nchannels_engaged) == 0) { in xpc_create_kthreads()
824 indicate_partition_disengaged(part); in xpc_create_kthreads()
827 xpc_part_deref(part); in xpc_create_kthreads()
851 struct xpc_partition *part; in xpc_disconnect_wait() local
857 part = &xpc_partitions[partid]; in xpc_disconnect_wait()
859 if (!xpc_part_ref(part)) in xpc_disconnect_wait()
862 ch = &part->channels[ch_number]; in xpc_disconnect_wait()
865 xpc_part_deref(part); in xpc_disconnect_wait()
876 if (part->act_state != XPC_P_AS_DEACTIVATING) { in xpc_disconnect_wait()
877 spin_lock(&part->chctl_lock); in xpc_disconnect_wait()
878 part->chctl.flags[ch->number] |= in xpc_disconnect_wait()
880 spin_unlock(&part->chctl_lock); in xpc_disconnect_wait()
890 xpc_wakeup_channel_mgr(part); in xpc_disconnect_wait()
892 xpc_part_deref(part); in xpc_disconnect_wait()
900 struct xpc_partition *part; in xpc_setup_partitions() local
919 part = &xpc_partitions[partid]; in xpc_setup_partitions()
921 DBUG_ON((u64)part != L1_CACHE_ALIGN((u64)part)); in xpc_setup_partitions()
923 part->activate_IRQ_rcvd = 0; in xpc_setup_partitions()
924 spin_lock_init(&part->act_lock); in xpc_setup_partitions()
925 part->act_state = XPC_P_AS_INACTIVE; in xpc_setup_partitions()
926 XPC_SET_REASON(part, 0, 0); in xpc_setup_partitions()
928 timer_setup(&part->disengage_timer, in xpc_setup_partitions()
931 part->setup_state = XPC_P_SS_UNSET; in xpc_setup_partitions()
932 init_waitqueue_head(&part->teardown_wq); in xpc_setup_partitions()
933 atomic_set(&part->references, 0); in xpc_setup_partitions()
951 struct xpc_partition *part; in xpc_do_exit() local
983 part = &xpc_partitions[partid]; in xpc_do_exit()
985 if (xpc_partition_disengaged(part) && in xpc_do_exit()
986 part->act_state == XPC_P_AS_INACTIVE) { in xpc_do_exit()
992 XPC_DEACTIVATE_PARTITION(part, reason); in xpc_do_exit()
994 if (part->disengage_timeout > disengage_timeout) in xpc_do_exit()
995 disengage_timeout = part->disengage_timeout; in xpc_do_exit()
1086 struct xpc_partition *part; in xpc_die_deactivate() local
1101 part = &xpc_partitions[partid]; in xpc_die_deactivate()
1104 part->act_state != XPC_P_AS_INACTIVE) { in xpc_die_deactivate()
1105 xpc_arch_ops.request_partition_deactivation(part); in xpc_die_deactivate()
1106 xpc_arch_ops.indicate_partition_disengaged(part); in xpc_die_deactivate()
1226 dev_set_name(xpc_part, "part"); in xpc_init()