Lines Matching refs:part

167 	struct xpc_partition *part = from_timer(part, t, disengage_timer);  in xpc_timeout_partition_disengage()  local
169 DBUG_ON(time_is_after_jiffies(part->disengage_timeout)); in xpc_timeout_partition_disengage()
171 xpc_partition_disengaged_from_timer(part); in xpc_timeout_partition_disengage()
173 DBUG_ON(part->disengage_timeout != 0); in xpc_timeout_partition_disengage()
174 DBUG_ON(xpc_arch_ops.partition_engaged(XPC_PARTID(part))); in xpc_timeout_partition_disengage()
216 struct xpc_partition *part; in xpc_check_remote_hb() local
228 part = &xpc_partitions[partid]; in xpc_check_remote_hb()
230 if (part->act_state == XPC_P_AS_INACTIVE || in xpc_check_remote_hb()
231 part->act_state == XPC_P_AS_DEACTIVATING) { in xpc_check_remote_hb()
235 ret = xpc_arch_ops.get_remote_heartbeat(part); in xpc_check_remote_hb()
237 XPC_DEACTIVATE_PARTITION(part, ret); in xpc_check_remote_hb()
329 xpc_channel_mgr(struct xpc_partition *part) in xpc_channel_mgr() argument
331 while (part->act_state != XPC_P_AS_DEACTIVATING || in xpc_channel_mgr()
332 atomic_read(&part->nchannels_active) > 0 || in xpc_channel_mgr()
333 !xpc_partition_disengaged(part)) { in xpc_channel_mgr()
335 xpc_process_sent_chctl_flags(part); in xpc_channel_mgr()
350 atomic_dec(&part->channel_mgr_requests); in xpc_channel_mgr()
351 (void)wait_event_interruptible(part->channel_mgr_wq, in xpc_channel_mgr()
352 (atomic_read(&part->channel_mgr_requests) > 0 || in xpc_channel_mgr()
353 part->chctl.all_flags != 0 || in xpc_channel_mgr()
354 (part->act_state == XPC_P_AS_DEACTIVATING && in xpc_channel_mgr()
355 atomic_read(&part->nchannels_active) == 0 && in xpc_channel_mgr()
356 xpc_partition_disengaged(part)))); in xpc_channel_mgr()
357 atomic_set(&part->channel_mgr_requests, 1); in xpc_channel_mgr()
390 xpc_setup_ch_structures(struct xpc_partition *part) in xpc_setup_ch_structures() argument
395 short partid = XPC_PARTID(part); in xpc_setup_ch_structures()
401 DBUG_ON(part->channels != NULL); in xpc_setup_ch_structures()
402 part->channels = kcalloc(XPC_MAX_NCHANNELS, in xpc_setup_ch_structures()
405 if (part->channels == NULL) { in xpc_setup_ch_structures()
412 part->remote_openclose_args = in xpc_setup_ch_structures()
414 GFP_KERNEL, &part-> in xpc_setup_ch_structures()
416 if (part->remote_openclose_args == NULL) { in xpc_setup_ch_structures()
422 part->chctl.all_flags = 0; in xpc_setup_ch_structures()
423 spin_lock_init(&part->chctl_lock); in xpc_setup_ch_structures()
425 atomic_set(&part->channel_mgr_requests, 1); in xpc_setup_ch_structures()
426 init_waitqueue_head(&part->channel_mgr_wq); in xpc_setup_ch_structures()
428 part->nchannels = XPC_MAX_NCHANNELS; in xpc_setup_ch_structures()
430 atomic_set(&part->nchannels_active, 0); in xpc_setup_ch_structures()
431 atomic_set(&part->nchannels_engaged, 0); in xpc_setup_ch_structures()
433 for (ch_number = 0; ch_number < part->nchannels; ch_number++) { in xpc_setup_ch_structures()
434 ch = &part->channels[ch_number]; in xpc_setup_ch_structures()
455 ret = xpc_arch_ops.setup_ch_structures(part); in xpc_setup_ch_structures()
463 part->setup_state = XPC_P_SS_SETUP; in xpc_setup_ch_structures()
469 kfree(part->remote_openclose_args_base); in xpc_setup_ch_structures()
470 part->remote_openclose_args = NULL; in xpc_setup_ch_structures()
472 kfree(part->channels); in xpc_setup_ch_structures()
473 part->channels = NULL; in xpc_setup_ch_structures()
482 xpc_teardown_ch_structures(struct xpc_partition *part) in xpc_teardown_ch_structures() argument
484 DBUG_ON(atomic_read(&part->nchannels_engaged) != 0); in xpc_teardown_ch_structures()
485 DBUG_ON(atomic_read(&part->nchannels_active) != 0); in xpc_teardown_ch_structures()
492 DBUG_ON(part->setup_state != XPC_P_SS_SETUP); in xpc_teardown_ch_structures()
493 part->setup_state = XPC_P_SS_WTEARDOWN; in xpc_teardown_ch_structures()
495 wait_event(part->teardown_wq, (atomic_read(&part->references) == 0)); in xpc_teardown_ch_structures()
499 xpc_arch_ops.teardown_ch_structures(part); in xpc_teardown_ch_structures()
501 kfree(part->remote_openclose_args_base); in xpc_teardown_ch_structures()
502 part->remote_openclose_args = NULL; in xpc_teardown_ch_structures()
503 kfree(part->channels); in xpc_teardown_ch_structures()
504 part->channels = NULL; in xpc_teardown_ch_structures()
506 part->setup_state = XPC_P_SS_TORNDOWN; in xpc_teardown_ch_structures()
524 struct xpc_partition *part = &xpc_partitions[partid]; in xpc_activating() local
529 spin_lock_irqsave(&part->act_lock, irq_flags); in xpc_activating()
531 if (part->act_state == XPC_P_AS_DEACTIVATING) { in xpc_activating()
532 part->act_state = XPC_P_AS_INACTIVE; in xpc_activating()
533 spin_unlock_irqrestore(&part->act_lock, irq_flags); in xpc_activating()
534 part->remote_rp_pa = 0; in xpc_activating()
539 DBUG_ON(part->act_state != XPC_P_AS_ACTIVATION_REQ); in xpc_activating()
540 part->act_state = XPC_P_AS_ACTIVATING; in xpc_activating()
542 XPC_SET_REASON(part, 0, 0); in xpc_activating()
543 spin_unlock_irqrestore(&part->act_lock, irq_flags); in xpc_activating()
549 if (xpc_setup_ch_structures(part) == xpSuccess) { in xpc_activating()
550 (void)xpc_part_ref(part); /* this will always succeed */ in xpc_activating()
552 if (xpc_arch_ops.make_first_contact(part) == xpSuccess) { in xpc_activating()
553 xpc_mark_partition_active(part); in xpc_activating()
554 xpc_channel_mgr(part); in xpc_activating()
558 xpc_part_deref(part); in xpc_activating()
559 xpc_teardown_ch_structures(part); in xpc_activating()
563 xpc_mark_partition_inactive(part); in xpc_activating()
565 if (part->reason == xpReactivating) { in xpc_activating()
567 xpc_arch_ops.request_partition_reactivation(part); in xpc_activating()
574 xpc_activate_partition(struct xpc_partition *part) in xpc_activate_partition() argument
576 short partid = XPC_PARTID(part); in xpc_activate_partition()
580 spin_lock_irqsave(&part->act_lock, irq_flags); in xpc_activate_partition()
582 DBUG_ON(part->act_state != XPC_P_AS_INACTIVE); in xpc_activate_partition()
584 part->act_state = XPC_P_AS_ACTIVATION_REQ; in xpc_activate_partition()
585 XPC_SET_REASON(part, xpCloneKThread, __LINE__); in xpc_activate_partition()
587 spin_unlock_irqrestore(&part->act_lock, irq_flags); in xpc_activate_partition()
592 spin_lock_irqsave(&part->act_lock, irq_flags); in xpc_activate_partition()
593 part->act_state = XPC_P_AS_INACTIVE; in xpc_activate_partition()
594 XPC_SET_REASON(part, xpCloneKThreadFailed, __LINE__); in xpc_activate_partition()
595 spin_unlock_irqrestore(&part->act_lock, irq_flags); in xpc_activate_partition()
638 xpc_kthread_waitmsgs(struct xpc_partition *part, struct xpc_channel *ch) in xpc_kthread_waitmsgs() argument
675 struct xpc_partition *part = &xpc_partitions[partid]; in xpc_kthread_start() local
685 ch = &part->channels[ch_number]; in xpc_kthread_start()
717 xpc_kthread_waitmsgs(part, ch); in xpc_kthread_start()
736 atomic_dec_return(&part->nchannels_engaged) == 0) { in xpc_kthread_start()
737 xpc_arch_ops.indicate_partition_disengaged(part); in xpc_kthread_start()
745 xpc_part_deref(part); in xpc_kthread_start()
767 struct xpc_partition *part = &xpc_partitions[ch->partid]; in xpc_create_kthreads() local
791 atomic_inc_return(&part->nchannels_engaged) == 1) { in xpc_create_kthreads()
792 xpc_arch_ops.indicate_partition_engaged(part); in xpc_create_kthreads()
794 (void)xpc_part_ref(part); in xpc_create_kthreads()
813 atomic_dec_return(&part->nchannels_engaged) == 0) { in xpc_create_kthreads()
814 indicate_partition_disengaged(part); in xpc_create_kthreads()
817 xpc_part_deref(part); in xpc_create_kthreads()
841 struct xpc_partition *part; in xpc_disconnect_wait() local
847 part = &xpc_partitions[partid]; in xpc_disconnect_wait()
849 if (!xpc_part_ref(part)) in xpc_disconnect_wait()
852 ch = &part->channels[ch_number]; in xpc_disconnect_wait()
855 xpc_part_deref(part); in xpc_disconnect_wait()
866 if (part->act_state != XPC_P_AS_DEACTIVATING) { in xpc_disconnect_wait()
867 spin_lock(&part->chctl_lock); in xpc_disconnect_wait()
868 part->chctl.flags[ch->number] |= in xpc_disconnect_wait()
870 spin_unlock(&part->chctl_lock); in xpc_disconnect_wait()
880 xpc_wakeup_channel_mgr(part); in xpc_disconnect_wait()
882 xpc_part_deref(part); in xpc_disconnect_wait()
890 struct xpc_partition *part; in xpc_setup_partitions() local
909 part = &xpc_partitions[partid]; in xpc_setup_partitions()
911 DBUG_ON((u64)part != L1_CACHE_ALIGN((u64)part)); in xpc_setup_partitions()
913 part->activate_IRQ_rcvd = 0; in xpc_setup_partitions()
914 spin_lock_init(&part->act_lock); in xpc_setup_partitions()
915 part->act_state = XPC_P_AS_INACTIVE; in xpc_setup_partitions()
916 XPC_SET_REASON(part, 0, 0); in xpc_setup_partitions()
918 timer_setup(&part->disengage_timer, in xpc_setup_partitions()
921 part->setup_state = XPC_P_SS_UNSET; in xpc_setup_partitions()
922 init_waitqueue_head(&part->teardown_wq); in xpc_setup_partitions()
923 atomic_set(&part->references, 0); in xpc_setup_partitions()
941 struct xpc_partition *part; in xpc_do_exit() local
973 part = &xpc_partitions[partid]; in xpc_do_exit()
975 if (xpc_partition_disengaged(part) && in xpc_do_exit()
976 part->act_state == XPC_P_AS_INACTIVE) { in xpc_do_exit()
982 XPC_DEACTIVATE_PARTITION(part, reason); in xpc_do_exit()
984 if (part->disengage_timeout > disengage_timeout) in xpc_do_exit()
985 disengage_timeout = part->disengage_timeout; in xpc_do_exit()
1078 struct xpc_partition *part; in xpc_die_deactivate() local
1093 part = &xpc_partitions[partid]; in xpc_die_deactivate()
1096 part->act_state != XPC_P_AS_INACTIVE) { in xpc_die_deactivate()
1097 xpc_arch_ops.request_partition_deactivation(part); in xpc_die_deactivate()
1098 xpc_arch_ops.indicate_partition_disengaged(part); in xpc_die_deactivate()