Lines Matching refs:lcu
62 list_for_each_entry(pos, &server->lculist, lcu) { in _find_lcu()
69 static struct alias_pav_group *_find_group(struct alias_lcu *lcu, in _find_group() argument
76 if (lcu->pav == HYPER_PAV) { in _find_group()
77 if (list_empty(&lcu->grouplist)) in _find_group()
80 return list_first_entry(&lcu->grouplist, in _find_group()
89 list_for_each_entry(pos, &lcu->grouplist, group) { in _find_group()
118 struct alias_lcu *lcu; in _allocate_lcu() local
120 lcu = kzalloc(sizeof(*lcu), GFP_KERNEL); in _allocate_lcu()
121 if (!lcu) in _allocate_lcu()
123 lcu->uac = kzalloc(sizeof(*(lcu->uac)), GFP_KERNEL | GFP_DMA); in _allocate_lcu()
124 if (!lcu->uac) in _allocate_lcu()
126 lcu->rsu_cqr = kzalloc(sizeof(*lcu->rsu_cqr), GFP_KERNEL | GFP_DMA); in _allocate_lcu()
127 if (!lcu->rsu_cqr) in _allocate_lcu()
129 lcu->rsu_cqr->cpaddr = kzalloc(sizeof(struct ccw1), in _allocate_lcu()
131 if (!lcu->rsu_cqr->cpaddr) in _allocate_lcu()
133 lcu->rsu_cqr->data = kzalloc(16, GFP_KERNEL | GFP_DMA); in _allocate_lcu()
134 if (!lcu->rsu_cqr->data) in _allocate_lcu()
137 memcpy(lcu->uid.vendor, uid->vendor, sizeof(uid->vendor)); in _allocate_lcu()
138 memcpy(lcu->uid.serial, uid->serial, sizeof(uid->serial)); in _allocate_lcu()
139 lcu->uid.ssid = uid->ssid; in _allocate_lcu()
140 lcu->pav = NO_PAV; in _allocate_lcu()
141 lcu->flags = NEED_UAC_UPDATE | UPDATE_PENDING; in _allocate_lcu()
142 INIT_LIST_HEAD(&lcu->lcu); in _allocate_lcu()
143 INIT_LIST_HEAD(&lcu->inactive_devices); in _allocate_lcu()
144 INIT_LIST_HEAD(&lcu->active_devices); in _allocate_lcu()
145 INIT_LIST_HEAD(&lcu->grouplist); in _allocate_lcu()
146 INIT_WORK(&lcu->suc_data.worker, summary_unit_check_handling_work); in _allocate_lcu()
147 INIT_DELAYED_WORK(&lcu->ruac_data.dwork, lcu_update_work); in _allocate_lcu()
148 spin_lock_init(&lcu->lock); in _allocate_lcu()
149 init_completion(&lcu->lcu_setup); in _allocate_lcu()
150 return lcu; in _allocate_lcu()
153 kfree(lcu->rsu_cqr->cpaddr); in _allocate_lcu()
155 kfree(lcu->rsu_cqr); in _allocate_lcu()
157 kfree(lcu->uac); in _allocate_lcu()
159 kfree(lcu); in _allocate_lcu()
163 static void _free_lcu(struct alias_lcu *lcu) in _free_lcu() argument
165 kfree(lcu->rsu_cqr->data); in _free_lcu()
166 kfree(lcu->rsu_cqr->cpaddr); in _free_lcu()
167 kfree(lcu->rsu_cqr); in _free_lcu()
168 kfree(lcu->uac); in _free_lcu()
169 kfree(lcu); in _free_lcu()
184 struct alias_lcu *lcu, *newlcu; in dasd_alias_make_device_known_to_lcu() local
206 lcu = _find_lcu(server, &uid); in dasd_alias_make_device_known_to_lcu()
207 if (!lcu) { in dasd_alias_make_device_known_to_lcu()
213 lcu = _find_lcu(server, &uid); in dasd_alias_make_device_known_to_lcu()
214 if (!lcu) { in dasd_alias_make_device_known_to_lcu()
215 list_add(&newlcu->lcu, &server->lculist); in dasd_alias_make_device_known_to_lcu()
216 lcu = newlcu; in dasd_alias_make_device_known_to_lcu()
222 spin_lock(&lcu->lock); in dasd_alias_make_device_known_to_lcu()
223 list_add(&device->alias_list, &lcu->inactive_devices); in dasd_alias_make_device_known_to_lcu()
224 private->lcu = lcu; in dasd_alias_make_device_known_to_lcu()
225 spin_unlock(&lcu->lock); in dasd_alias_make_device_known_to_lcu()
240 struct alias_lcu *lcu; in dasd_alias_disconnect_device_from_lcu() local
245 lcu = private->lcu; in dasd_alias_disconnect_device_from_lcu()
247 if (!lcu) in dasd_alias_disconnect_device_from_lcu()
250 spin_lock_irqsave(&lcu->lock, flags); in dasd_alias_disconnect_device_from_lcu()
252 if (device == lcu->suc_data.device) { in dasd_alias_disconnect_device_from_lcu()
253 spin_unlock_irqrestore(&lcu->lock, flags); in dasd_alias_disconnect_device_from_lcu()
254 cancel_work_sync(&lcu->suc_data.worker); in dasd_alias_disconnect_device_from_lcu()
255 spin_lock_irqsave(&lcu->lock, flags); in dasd_alias_disconnect_device_from_lcu()
256 if (device == lcu->suc_data.device) { in dasd_alias_disconnect_device_from_lcu()
258 lcu->suc_data.device = NULL; in dasd_alias_disconnect_device_from_lcu()
262 if (device == lcu->ruac_data.device) { in dasd_alias_disconnect_device_from_lcu()
263 spin_unlock_irqrestore(&lcu->lock, flags); in dasd_alias_disconnect_device_from_lcu()
265 cancel_delayed_work_sync(&lcu->ruac_data.dwork); in dasd_alias_disconnect_device_from_lcu()
266 spin_lock_irqsave(&lcu->lock, flags); in dasd_alias_disconnect_device_from_lcu()
267 if (device == lcu->ruac_data.device) { in dasd_alias_disconnect_device_from_lcu()
269 lcu->ruac_data.device = NULL; in dasd_alias_disconnect_device_from_lcu()
272 private->lcu = NULL; in dasd_alias_disconnect_device_from_lcu()
273 spin_unlock_irqrestore(&lcu->lock, flags); in dasd_alias_disconnect_device_from_lcu()
276 spin_lock(&lcu->lock); in dasd_alias_disconnect_device_from_lcu()
278 if (list_empty(&lcu->grouplist) && in dasd_alias_disconnect_device_from_lcu()
279 list_empty(&lcu->active_devices) && in dasd_alias_disconnect_device_from_lcu()
280 list_empty(&lcu->inactive_devices)) { in dasd_alias_disconnect_device_from_lcu()
281 list_del(&lcu->lcu); in dasd_alias_disconnect_device_from_lcu()
282 spin_unlock(&lcu->lock); in dasd_alias_disconnect_device_from_lcu()
283 _free_lcu(lcu); in dasd_alias_disconnect_device_from_lcu()
284 lcu = NULL; in dasd_alias_disconnect_device_from_lcu()
287 _schedule_lcu_update(lcu, NULL); in dasd_alias_disconnect_device_from_lcu()
288 spin_unlock(&lcu->lock); in dasd_alias_disconnect_device_from_lcu()
304 static int _add_device_to_lcu(struct alias_lcu *lcu, in _add_device_to_lcu() argument
314 private->uid.type = lcu->uac->unit[private->uid.real_unit_addr].ua_type; in _add_device_to_lcu()
316 lcu->uac->unit[private->uid.real_unit_addr].base_ua; in _add_device_to_lcu()
320 if (lcu->pav == NO_PAV) { in _add_device_to_lcu()
321 list_move(&device->alias_list, &lcu->active_devices); in _add_device_to_lcu()
324 group = _find_group(lcu, &uid); in _add_device_to_lcu()
340 list_add(&group->group, &lcu->grouplist); in _add_device_to_lcu()
350 static void _remove_device_from_lcu(struct alias_lcu *lcu, in _remove_device_from_lcu() argument
356 list_move(&device->alias_list, &lcu->inactive_devices); in _remove_device_from_lcu()
408 struct alias_lcu *lcu) in read_unit_address_configuration() argument
441 memset(lcu->uac, 0, sizeof(*(lcu->uac))); in read_unit_address_configuration()
445 ccw->count = sizeof(*(lcu->uac)); in read_unit_address_configuration()
446 ccw->cda = virt_to_dma32(lcu->uac); in read_unit_address_configuration()
452 spin_lock_irqsave(&lcu->lock, flags); in read_unit_address_configuration()
453 lcu->flags &= ~NEED_UAC_UPDATE; in read_unit_address_configuration()
454 spin_unlock_irqrestore(&lcu->lock, flags); in read_unit_address_configuration()
465 spin_lock_irqsave(&lcu->lock, flags); in read_unit_address_configuration()
466 lcu->flags |= NEED_UAC_UPDATE; in read_unit_address_configuration()
467 spin_unlock_irqrestore(&lcu->lock, flags); in read_unit_address_configuration()
474 static int _lcu_update(struct dasd_device *refdev, struct alias_lcu *lcu) in _lcu_update() argument
482 spin_lock_irqsave(&lcu->lock, flags); in _lcu_update()
483 list_for_each_entry_safe(pavgroup, tempgroup, &lcu->grouplist, group) { in _lcu_update()
486 list_move(&device->alias_list, &lcu->active_devices); in _lcu_update()
492 list_move(&device->alias_list, &lcu->active_devices); in _lcu_update()
499 spin_unlock_irqrestore(&lcu->lock, flags); in _lcu_update()
501 rc = read_unit_address_configuration(refdev, lcu); in _lcu_update()
505 spin_lock_irqsave(&lcu->lock, flags); in _lcu_update()
512 if (lcu->flags & NEED_UAC_UPDATE) in _lcu_update()
514 lcu->pav = NO_PAV; in _lcu_update()
516 switch (lcu->uac->unit[i].ua_type) { in _lcu_update()
518 lcu->pav = BASE_PAV; in _lcu_update()
521 lcu->pav = HYPER_PAV; in _lcu_update()
524 if (lcu->pav != NO_PAV) in _lcu_update()
528 list_for_each_entry_safe(device, tempdev, &lcu->active_devices, in _lcu_update()
530 _add_device_to_lcu(lcu, device, refdev); in _lcu_update()
533 spin_unlock_irqrestore(&lcu->lock, flags); in _lcu_update()
539 struct alias_lcu *lcu; in lcu_update_work() local
546 lcu = container_of(ruac_data, struct alias_lcu, ruac_data); in lcu_update_work()
548 rc = _lcu_update(device, lcu); in lcu_update_work()
554 spin_lock_irqsave(&lcu->lock, flags); in lcu_update_work()
555 if ((rc && (rc != -EOPNOTSUPP)) || (lcu->flags & NEED_UAC_UPDATE)) { in lcu_update_work()
558 if (!schedule_delayed_work(&lcu->ruac_data.dwork, 30*HZ)) in lcu_update_work()
562 lcu->ruac_data.device = NULL; in lcu_update_work()
563 lcu->flags &= ~UPDATE_PENDING; in lcu_update_work()
565 spin_unlock_irqrestore(&lcu->lock, flags); in lcu_update_work()
568 static int _schedule_lcu_update(struct alias_lcu *lcu, in _schedule_lcu_update() argument
574 lcu->flags |= NEED_UAC_UPDATE; in _schedule_lcu_update()
575 if (lcu->ruac_data.device) { in _schedule_lcu_update()
582 if (!usedev && !list_empty(&lcu->grouplist)) { in _schedule_lcu_update()
583 group = list_first_entry(&lcu->grouplist, in _schedule_lcu_update()
594 if (!usedev && !list_empty(&lcu->active_devices)) { in _schedule_lcu_update()
595 usedev = list_first_entry(&lcu->active_devices, in _schedule_lcu_update()
605 lcu->ruac_data.device = usedev; in _schedule_lcu_update()
606 if (!schedule_delayed_work(&lcu->ruac_data.dwork, 0)) in _schedule_lcu_update()
615 struct alias_lcu *lcu = private->lcu; in dasd_alias_add_device() local
620 spin_lock_irqsave(&lcu->lock, flags); in dasd_alias_add_device()
625 if (private->uid.type != lcu->uac->unit[uaddr].ua_type) { in dasd_alias_add_device()
626 lcu->flags |= UPDATE_PENDING; in dasd_alias_add_device()
630 if (!(lcu->flags & UPDATE_PENDING)) { in dasd_alias_add_device()
631 rc = _add_device_to_lcu(lcu, device, device); in dasd_alias_add_device()
633 lcu->flags |= UPDATE_PENDING; in dasd_alias_add_device()
635 if (lcu->flags & UPDATE_PENDING) { in dasd_alias_add_device()
636 list_move(&device->alias_list, &lcu->active_devices); in dasd_alias_add_device()
638 _schedule_lcu_update(lcu, device); in dasd_alias_add_device()
640 spin_unlock_irqrestore(&lcu->lock, flags); in dasd_alias_add_device()
648 private->lcu->flags |= UPDATE_PENDING; in dasd_alias_update_add_device()
655 struct alias_lcu *lcu = private->lcu; in dasd_alias_remove_device() local
659 if (!lcu) in dasd_alias_remove_device()
661 spin_lock_irqsave(&lcu->lock, flags); in dasd_alias_remove_device()
662 _remove_device_from_lcu(lcu, device); in dasd_alias_remove_device()
663 spin_unlock_irqrestore(&lcu->lock, flags); in dasd_alias_remove_device()
670 struct alias_lcu *lcu = private->lcu; in dasd_alias_get_start_dev() local
675 if (!lcu) in dasd_alias_get_start_dev()
677 if (lcu->pav == NO_PAV || in dasd_alias_get_start_dev()
678 lcu->flags & (NEED_UAC_UPDATE | UPDATE_PENDING)) in dasd_alias_get_start_dev()
691 spin_lock_irqsave(&lcu->lock, flags); in dasd_alias_get_start_dev()
694 spin_unlock_irqrestore(&lcu->lock, flags); in dasd_alias_get_start_dev()
700 spin_unlock_irqrestore(&lcu->lock, flags); in dasd_alias_get_start_dev()
714 spin_unlock_irqrestore(&lcu->lock, flags); in dasd_alias_get_start_dev()
727 static int reset_summary_unit_check(struct alias_lcu *lcu, in reset_summary_unit_check() argument
735 cqr = lcu->rsu_cqr; in reset_summary_unit_check()
758 static void _restart_all_base_devices_on_lcu(struct alias_lcu *lcu) in _restart_all_base_devices_on_lcu() argument
765 list_for_each_entry(device, &lcu->active_devices, alias_list) { in _restart_all_base_devices_on_lcu()
772 list_for_each_entry(device, &lcu->inactive_devices, alias_list) { in _restart_all_base_devices_on_lcu()
779 list_for_each_entry(pavgroup, &lcu->grouplist, group) { in _restart_all_base_devices_on_lcu()
787 static void flush_all_alias_devices_on_lcu(struct alias_lcu *lcu) in flush_all_alias_devices_on_lcu() argument
806 spin_lock_irqsave(&lcu->lock, flags); in flush_all_alias_devices_on_lcu()
807 list_for_each_entry_safe(device, temp, &lcu->active_devices, in flush_all_alias_devices_on_lcu()
815 list_for_each_entry(pavgroup, &lcu->grouplist, group) { in flush_all_alias_devices_on_lcu()
821 spin_unlock_irqrestore(&lcu->lock, flags); in flush_all_alias_devices_on_lcu()
823 spin_lock_irqsave(&lcu->lock, flags); in flush_all_alias_devices_on_lcu()
830 list_move(&device->alias_list, &lcu->active_devices); in flush_all_alias_devices_on_lcu()
835 spin_unlock_irqrestore(&lcu->lock, flags); in flush_all_alias_devices_on_lcu()
838 static void _stop_all_devices_on_lcu(struct alias_lcu *lcu) in _stop_all_devices_on_lcu() argument
843 list_for_each_entry(device, &lcu->active_devices, alias_list) { in _stop_all_devices_on_lcu()
848 list_for_each_entry(device, &lcu->inactive_devices, alias_list) { in _stop_all_devices_on_lcu()
853 list_for_each_entry(pavgroup, &lcu->grouplist, group) { in _stop_all_devices_on_lcu()
867 static void _unstop_all_devices_on_lcu(struct alias_lcu *lcu) in _unstop_all_devices_on_lcu() argument
872 list_for_each_entry(device, &lcu->active_devices, alias_list) { in _unstop_all_devices_on_lcu()
877 list_for_each_entry(device, &lcu->inactive_devices, alias_list) { in _unstop_all_devices_on_lcu()
882 list_for_each_entry(pavgroup, &lcu->grouplist, group) { in _unstop_all_devices_on_lcu()
898 struct alias_lcu *lcu; in summary_unit_check_handling_work() local
905 lcu = container_of(suc_data, struct alias_lcu, suc_data); in summary_unit_check_handling_work()
909 flush_all_alias_devices_on_lcu(lcu); in summary_unit_check_handling_work()
916 reset_summary_unit_check(lcu, device, suc_data->reason); in summary_unit_check_handling_work()
918 spin_lock_irqsave(&lcu->lock, flags); in summary_unit_check_handling_work()
919 _unstop_all_devices_on_lcu(lcu); in summary_unit_check_handling_work()
920 _restart_all_base_devices_on_lcu(lcu); in summary_unit_check_handling_work()
922 _schedule_lcu_update(lcu, device); in summary_unit_check_handling_work()
923 lcu->suc_data.device = NULL; in summary_unit_check_handling_work()
925 spin_unlock_irqrestore(&lcu->lock, flags); in summary_unit_check_handling_work()
933 struct alias_lcu *lcu; in dasd_alias_handle_summary_unit_check() local
936 lcu = private->lcu; in dasd_alias_handle_summary_unit_check()
937 if (!lcu) { in dasd_alias_handle_summary_unit_check()
943 spin_lock_irqsave(&lcu->lock, flags); in dasd_alias_handle_summary_unit_check()
953 if (lcu->suc_data.device) { in dasd_alias_handle_summary_unit_check()
960 _stop_all_devices_on_lcu(lcu); in dasd_alias_handle_summary_unit_check()
962 lcu->flags |= NEED_UAC_UPDATE | UPDATE_PENDING; in dasd_alias_handle_summary_unit_check()
963 lcu->suc_data.reason = private->suc_reason; in dasd_alias_handle_summary_unit_check()
964 lcu->suc_data.device = device; in dasd_alias_handle_summary_unit_check()
966 if (!schedule_work(&lcu->suc_data.worker)) in dasd_alias_handle_summary_unit_check()
969 spin_unlock_irqrestore(&lcu->lock, flags); in dasd_alias_handle_summary_unit_check()