Lines Matching refs:part
15 * partition This part detects the presence/absence of other
19 * channel This part manages the channels and sends/receives
63 .init_name = "", /* set to "part" at xpc_init() time */
173 struct xpc_partition *part = (struct xpc_partition *)data;
175 DBUG_ON(time_is_after_jiffies(part->disengage_timeout));
177 (void)xpc_partition_disengaged(part);
179 DBUG_ON(part->disengage_timeout != 0);
180 DBUG_ON(xpc_arch_ops.partition_engaged(XPC_PARTID(part)));
223 struct xpc_partition *part;
235 part = &xpc_partitions[partid];
237 if (part->act_state == XPC_P_AS_INACTIVE ||
238 part->act_state == XPC_P_AS_DEACTIVATING) {
242 ret = xpc_arch_ops.get_remote_heartbeat(part);
244 XPC_DEACTIVATE_PARTITION(part, ret);
343 xpc_channel_mgr(struct xpc_partition *part)
345 while (part->act_state != XPC_P_AS_DEACTIVATING ||
346 atomic_read(&part->nchannels_active) > 0 ||
347 !xpc_partition_disengaged(part)) {
349 xpc_process_sent_chctl_flags(part);
364 atomic_dec(&part->channel_mgr_requests);
365 (void)wait_event_interruptible(part->channel_mgr_wq,
366 (atomic_read(&part->channel_mgr_requests) > 0 ||
367 part->chctl.all_flags != 0 ||
368 (part->act_state == XPC_P_AS_DEACTIVATING &&
369 atomic_read(&part->nchannels_active) == 0 &&
370 xpc_partition_disengaged(part))));
371 atomic_set(&part->channel_mgr_requests, 1);
404 xpc_setup_ch_structures(struct xpc_partition *part)
409 short partid = XPC_PARTID(part);
415 DBUG_ON(part->channels != NULL);
416 part->channels = kzalloc(sizeof(struct xpc_channel) * XPC_MAX_NCHANNELS,
418 if (part->channels == NULL) {
425 part->remote_openclose_args =
427 GFP_KERNEL, &part->
429 if (part->remote_openclose_args == NULL) {
435 part->chctl.all_flags = 0;
436 spin_lock_init(&part->chctl_lock);
438 atomic_set(&part->channel_mgr_requests, 1);
439 init_waitqueue_head(&part->channel_mgr_wq);
441 part->nchannels = XPC_MAX_NCHANNELS;
443 atomic_set(&part->nchannels_active, 0);
444 atomic_set(&part->nchannels_engaged, 0);
446 for (ch_number = 0; ch_number < part->nchannels; ch_number++) {
447 ch = &part->channels[ch_number];
468 ret = xpc_arch_ops.setup_ch_structures(part);
476 part->setup_state = XPC_P_SS_SETUP;
482 kfree(part->remote_openclose_args_base);
483 part->remote_openclose_args = NULL;
485 kfree(part->channels);
486 part->channels = NULL;
495 xpc_teardown_ch_structures(struct xpc_partition *part)
497 DBUG_ON(atomic_read(&part->nchannels_engaged) != 0);
498 DBUG_ON(atomic_read(&part->nchannels_active) != 0);
505 DBUG_ON(part->setup_state != XPC_P_SS_SETUP);
506 part->setup_state = XPC_P_SS_WTEARDOWN;
508 wait_event(part->teardown_wq, (atomic_read(&part->references) == 0));
512 xpc_arch_ops.teardown_ch_structures(part);
514 kfree(part->remote_openclose_args_base);
515 part->remote_openclose_args = NULL;
516 kfree(part->channels);
517 part->channels = NULL;
519 part->setup_state = XPC_P_SS_TORNDOWN;
537 struct xpc_partition *part = &xpc_partitions[partid];
542 spin_lock_irqsave(&part->act_lock, irq_flags);
544 if (part->act_state == XPC_P_AS_DEACTIVATING) {
545 part->act_state = XPC_P_AS_INACTIVE;
546 spin_unlock_irqrestore(&part->act_lock, irq_flags);
547 part->remote_rp_pa = 0;
552 DBUG_ON(part->act_state != XPC_P_AS_ACTIVATION_REQ);
553 part->act_state = XPC_P_AS_ACTIVATING;
555 XPC_SET_REASON(part, 0, 0);
556 spin_unlock_irqrestore(&part->act_lock, irq_flags);
562 if (xpc_setup_ch_structures(part) == xpSuccess) {
563 (void)xpc_part_ref(part); /* this will always succeed */
565 if (xpc_arch_ops.make_first_contact(part) == xpSuccess) {
566 xpc_mark_partition_active(part);
567 xpc_channel_mgr(part);
571 xpc_part_deref(part);
572 xpc_teardown_ch_structures(part);
576 xpc_mark_partition_inactive(part);
578 if (part->reason == xpReactivating) {
580 xpc_arch_ops.request_partition_reactivation(part);
587 xpc_activate_partition(struct xpc_partition *part)
589 short partid = XPC_PARTID(part);
593 spin_lock_irqsave(&part->act_lock, irq_flags);
595 DBUG_ON(part->act_state != XPC_P_AS_INACTIVE);
597 part->act_state = XPC_P_AS_ACTIVATION_REQ;
598 XPC_SET_REASON(part, xpCloneKThread, __LINE__);
600 spin_unlock_irqrestore(&part->act_lock, irq_flags);
605 spin_lock_irqsave(&part->act_lock, irq_flags);
606 part->act_state = XPC_P_AS_INACTIVE;
607 XPC_SET_REASON(part, xpCloneKThreadFailed, __LINE__);
608 spin_unlock_irqrestore(&part->act_lock, irq_flags);
651 xpc_kthread_waitmsgs(struct xpc_partition *part, struct xpc_channel *ch)
688 struct xpc_partition *part = &xpc_partitions[partid];
698 ch = &part->channels[ch_number];
730 xpc_kthread_waitmsgs(part, ch);
749 atomic_dec_return(&part->nchannels_engaged) == 0) {
750 xpc_arch_ops.indicate_partition_disengaged(part);
758 xpc_part_deref(part);
780 struct xpc_partition *part = &xpc_partitions[ch->partid];
804 atomic_inc_return(&part->nchannels_engaged) == 1) {
805 xpc_arch_ops.indicate_partition_engaged(part);
807 (void)xpc_part_ref(part);
826 atomic_dec_return(&part->nchannels_engaged) == 0) {
827 indicate_partition_disengaged(part);
830 xpc_part_deref(part);
854 struct xpc_partition *part;
860 part = &xpc_partitions[partid];
862 if (!xpc_part_ref(part))
865 ch = &part->channels[ch_number];
868 xpc_part_deref(part);
879 if (part->act_state != XPC_P_AS_DEACTIVATING) {
880 spin_lock(&part->chctl_lock);
881 part->chctl.flags[ch->number] |=
883 spin_unlock(&part->chctl_lock);
893 xpc_wakeup_channel_mgr(part);
895 xpc_part_deref(part);
903 struct xpc_partition *part;
921 part = &xpc_partitions[partid];
923 DBUG_ON((u64)part != L1_CACHE_ALIGN((u64)part));
925 part->activate_IRQ_rcvd = 0;
926 spin_lock_init(&part->act_lock);
927 part->act_state = XPC_P_AS_INACTIVE;
928 XPC_SET_REASON(part, 0, 0);
930 init_timer(&part->disengage_timer);
931 part->disengage_timer.function =
933 part->disengage_timer.data = (unsigned long)part;
935 part->setup_state = XPC_P_SS_UNSET;
936 init_waitqueue_head(&part->teardown_wq);
937 atomic_set(&part->references, 0);
955 struct xpc_partition *part;
987 part = &xpc_partitions[partid];
989 if (xpc_partition_disengaged(part) &&
990 part->act_state == XPC_P_AS_INACTIVE) {
996 XPC_DEACTIVATE_PARTITION(part, reason);
998 if (part->disengage_timeout > disengage_timeout)
999 disengage_timeout = part->disengage_timeout;
1089 struct xpc_partition *part;
1101 part = &xpc_partitions[partid];
1104 part->act_state != XPC_P_AS_INACTIVE) {
1105 xpc_arch_ops.request_partition_deactivation(part);
1106 xpc_arch_ops.indicate_partition_disengaged(part);
1206 dev_set_name(xpc_part, "part");