Lines Matching +full:no +full:- +full:poll +full:- +full:on +full:- +full:init
1 // SPDX-License-Identifier: GPL-2.0+
19 #include <linux/init.h>
51 int ap_domain_index = -1; /* Adjunct Processor Domain Index */
59 MODULE_PARM_DESC(poll_thread, "Turn on/off poll thread, default is 0 (off).");
71 MODULE_PARM_DESC(useirq, "Use interrupt if available, default is 1 (on).");
78 /* Hashtable of all queue devices on the AP bus */
89 /* # of bindings complete since init */
128 * In LPAR poll with 4kHz frequency. Poll every 250000 nanoseconds.
158 * ap_airq_ptr() - Get the address of the adapter interrupt indicator
160 * Returns the address of the local-summary-indicator of the adapter
210 return ap_qci_info->qact; in ap_qact_available()
220 return ap_qci_info->apsb; in ap_sb_available()
224 * ap_is_se_guest(): Check for SE guest with AP pass-through support.
247 if (ap_qci_info->apxa) { in ap_init_qci_info()
248 if (ap_qci_info->na) { in ap_init_qci_info()
249 ap_max_adapter_id = ap_qci_info->na; in ap_init_qci_info()
253 if (ap_qci_info->nd) { in ap_init_qci_info()
254 ap_max_domain_id = ap_qci_info->nd; in ap_init_qci_info()
281 if (ap_qci_info->flags) in ap_test_config_card_id()
282 return ap_test_config(ap_qci_info->apm, id); in ap_test_config_card_id()
298 if (ap_qci_info->flags) in ap_test_config_usage_domain()
299 return ap_test_config(ap_qci_info->aqm, domain); in ap_test_config_usage_domain()
316 return ap_test_config(ap_qci_info->adm, domain); in ap_test_config_ctrl_domain()
323 * 0 if APQN seems to exist but there is no info
325 * -1 invalid APQN, TAPQ error or AP queue status which
326 * indicates there is no APQN.
333 hwinfo->value = 0; in ap_queue_info()
338 return -1; in ap_queue_info()
340 /* call TAPQ on this APQN */ in ap_queue_info()
352 /* On a pending async error the info should be available */ in ap_queue_info()
354 return -1; in ap_queue_info()
359 if (WARN_ON_ONCE(!hwinfo->value)) in ap_queue_info()
410 spin_lock_bh(&aq->lock); in ap_request_timeout()
412 spin_unlock_bh(&aq->lock); in ap_request_timeout()
428 * ap_interrupt_handler() - Schedule ap_tasklet on interrupt
440 * ap_tasklet_fn(): Tasklet to poll all AP devices.
443 * Poll all AP devices on the bus.
453 * important that no requests on any AP get lost. in ap_tasklet_fn()
460 spin_lock_bh(&aq->lock); in ap_tasklet_fn()
462 spin_unlock_bh(&aq->lock); in ap_tasklet_fn()
476 if (aq->queue_count == 0) in ap_pending_requests()
489 * AP bus poll thread. The purpose of this thread is to poll for
490 * finished requests in a loop if there is a "free" cpu - that is
546 #define is_card_dev(x) ((x)->parent == ap_root_device)
547 #define is_queue_dev(x) ((x)->parent != ap_root_device)
565 for (id = ap_drv->ids; id->match_flags; id++) { in ap_bus_match()
567 id->match_flags & AP_DEVICE_ID_MATCH_CARD_TYPE && in ap_bus_match()
568 id->dev_type == to_ap_dev(dev)->device_type) in ap_bus_match()
571 id->match_flags & AP_DEVICE_ID_MATCH_QUEUE_TYPE && in ap_bus_match()
572 id->dev_type == to_ap_dev(dev)->device_type) in ap_bus_match()
596 struct ap_card *ac = to_ap_card(&ap_dev->device); in ap_uevent()
599 rc = add_uevent_var(env, "DEV_TYPE=%04X", ap_dev->device_type); in ap_uevent()
603 rc = add_uevent_var(env, "MODALIAS=ap:t%02X", ap_dev->device_type); in ap_uevent()
608 if (ac->hwinfo.accel) in ap_uevent()
610 else if (ac->hwinfo.cca) in ap_uevent()
612 else if (ac->hwinfo.ep11) in ap_uevent()
617 struct ap_queue *aq = to_ap_queue(&ap_dev->device); in ap_uevent()
620 if (aq->card->hwinfo.accel) in ap_uevent()
622 else if (aq->card->hwinfo.cca) in ap_uevent()
624 else if (aq->card->hwinfo.ep11) in ap_uevent()
637 kobject_uevent_env(&ap_root_device->kobj, KOBJ_CHANGE, envp); in ap_send_init_scan_done_uevent()
647 kobject_uevent_env(&ap_root_device->kobj, KOBJ_CHANGE, envp); in ap_send_bindings_complete_uevent()
657 kobject_uevent_env(&ap_dev->device.kobj, KOBJ_CHANGE, envp); in ap_send_config_uevent()
668 kobject_uevent_env(&ap_dev->device.kobj, KOBJ_CHANGE, envp); in ap_send_online_uevent()
687 kobject_uevent_env(&ap_root_device->kobj, KOBJ_CHANGE, envp); in ap_send_mask_changed_uevent()
704 pctrs->apqns++; in __ap_calc_helper()
705 if (dev->driver) in __ap_calc_helper()
706 pctrs->bound++; in __ap_calc_helper()
747 * on a condition with wait_for_completion_interruptible_timeout().
750 * -ETIME is returned. On failures negative return values are
768 rc = l == -ERESTARTSYS ? -EINTR : l; in ap_wait_apqn_bindings_complete()
770 rc = -ETIME; in ap_wait_apqn_bindings_complete()
780 AP_QID_CARD(to_ap_queue(dev)->qid) == (int)(long)data) in __ap_queue_devices_with_id_unregister()
790 card = AP_QID_CARD(to_ap_queue(dev)->qid); in __ap_revise_reserved()
791 queue = AP_QID_QUEUE(to_ap_queue(dev)->qid); in __ap_revise_reserved()
796 drvres = to_ap_drv(dev->driver)->flags in __ap_revise_reserved()
831 return -EINVAL; in ap_owned_by_def_drv()
873 struct ap_driver *ap_drv = to_ap_drv(dev->driver); in ap_device_probe()
874 int card, queue, devres, drvres, rc = -ENODEV; in ap_device_probe()
886 card = AP_QID_CARD(to_ap_queue(dev)->qid); in ap_device_probe()
887 queue = AP_QID_QUEUE(to_ap_queue(dev)->qid); in ap_device_probe()
892 drvres = ap_drv->flags & AP_DRIVER_FLAG_DEFAULT; in ap_device_probe()
906 hash_add(ap_queues, &to_ap_queue(dev)->hnode, in ap_device_probe()
907 to_ap_queue(dev)->qid); in ap_device_probe()
910 rc = ap_drv->probe ? ap_drv->probe(ap_dev) : -ENODEV; in ap_device_probe()
915 hash_del(&to_ap_queue(dev)->hnode); in ap_device_probe()
928 struct ap_driver *ap_drv = to_ap_drv(dev->driver); in ap_device_remove()
935 if (ap_drv->remove) in ap_device_remove()
936 ap_drv->remove(ap_dev); in ap_device_remove()
945 hash_del(&to_ap_queue(dev)->hnode); in ap_device_remove()
958 if (aq->qid == qid) { in ap_get_qdev()
959 get_device(&aq->ap_dev.device); in ap_get_qdev()
973 struct device_driver *drv = &ap_drv->driver; in ap_driver_register()
976 drv->bus = &ap_bus_type; in ap_driver_register()
977 drv->owner = owner; in ap_driver_register()
978 drv->name = name; in ap_driver_register()
989 driver_unregister(&ap_drv->driver); in ap_driver_unregister()
1077 return -EINVAL; in ap_hex2bitmap()
1095 return -EINVAL; in ap_hex2bitmap()
1101 * modify_bitmap() - parse bitmask argument and modify an existing
1104 * +<bitnr>[-<bitnr>] or -<bitnr>[-<bitnr>]
1106 * 0...bits-1; the leading + or - is required. Here are some examples:
1107 * +0-15,+32,-128,-0xFF
1108 * -0-255,+1-16,+0x128
1109 * +1,+2,+3,+4,-5,-7-10
1114 * +0-255,-128 = first bits 0-255 will be set, then bit 128 will be
1124 return -EINVAL; in modify_bitmap()
1128 if (sign != '+' && sign != '-') in modify_bitmap()
1129 return -EINVAL; in modify_bitmap()
1132 return -EINVAL; in modify_bitmap()
1134 if (*str == '-') { in modify_bitmap()
1137 return -EINVAL; in modify_bitmap()
1159 if (*str == '+' || *str == '-') { in ap_parse_bitmap_str()
1178 return -EINVAL; in ap_parse_mask_str()
1183 return -ENOMEM; in ap_parse_mask_str()
1186 return -ERESTARTSYS; in ap_parse_mask_str()
1214 return -EINVAL; in ap_domain_store()
1230 if (!ap_qci_info->flags) /* QCI not supported */ in ap_control_domain_mask_show()
1234 ap_qci_info->adm[0], ap_qci_info->adm[1], in ap_control_domain_mask_show()
1235 ap_qci_info->adm[2], ap_qci_info->adm[3], in ap_control_domain_mask_show()
1236 ap_qci_info->adm[4], ap_qci_info->adm[5], in ap_control_domain_mask_show()
1237 ap_qci_info->adm[6], ap_qci_info->adm[7]); in ap_control_domain_mask_show()
1244 if (!ap_qci_info->flags) /* QCI not supported */ in ap_usage_domain_mask_show()
1248 ap_qci_info->aqm[0], ap_qci_info->aqm[1], in ap_usage_domain_mask_show()
1249 ap_qci_info->aqm[2], ap_qci_info->aqm[3], in ap_usage_domain_mask_show()
1250 ap_qci_info->aqm[4], ap_qci_info->aqm[5], in ap_usage_domain_mask_show()
1251 ap_qci_info->aqm[6], ap_qci_info->aqm[7]); in ap_usage_domain_mask_show()
1258 if (!ap_qci_info->flags) /* QCI not supported */ in ap_adapter_mask_show()
1262 ap_qci_info->apm[0], ap_qci_info->apm[1], in ap_adapter_mask_show()
1263 ap_qci_info->apm[2], ap_qci_info->apm[3], in ap_adapter_mask_show()
1264 ap_qci_info->apm[4], ap_qci_info->apm[5], in ap_adapter_mask_show()
1265 ap_qci_info->apm[6], ap_qci_info->apm[7]); in ap_adapter_mask_show()
1288 return -EINVAL; in config_time_store()
1339 /* 120 seconds = maximum poll interval */ in poll_timeout_store()
1341 return -EINVAL; in poll_timeout_store()
1375 return -ERESTARTSYS; in apmask_show()
1394 if (!try_module_get(drv->owner)) in __verify_card_reservations()
1397 if (ap_drv->in_use) { in __verify_card_reservations()
1398 rc = ap_drv->in_use(newapm, ap_perms.aqm); in __verify_card_reservations()
1400 rc = -EBUSY; in __verify_card_reservations()
1404 module_put(drv->owner); in __verify_card_reservations()
1416 * result in queues being removed from non-default drivers in apmask_commit()
1437 return -ERESTARTSYS; in apmask_store()
1467 return -ERESTARTSYS; in aqmask_show()
1486 if (!try_module_get(drv->owner)) in __verify_queue_reservations()
1489 if (ap_drv->in_use) { in __verify_queue_reservations()
1490 rc = ap_drv->in_use(ap_perms.apm, newaqm); in __verify_queue_reservations()
1492 rc = -EBUSY; in __verify_queue_reservations()
1496 module_put(drv->owner); in __verify_queue_reservations()
1508 * result in queues being removed from non-default drivers in aqmask_commit()
1529 return -ERESTARTSYS; in aqmask_store()
1591 if (!ap_qci_info->flags) /* QCI not supported */ in features_show()
1592 return sysfs_emit(buf, "-\n"); in features_show()
1594 if (ap_qci_info->apsc) in features_show()
1596 if (ap_qci_info->apxa) in features_show()
1598 if (ap_qci_info->qact) in features_show()
1600 if (ap_qci_info->rc8a) in features_show()
1602 if (ap_qci_info->apsb) in features_show()
1605 sysfs_emit_at(buf, n == 0 ? 0 : n - 1, "\n"); in features_show()
1739 return is_card_dev(dev) && to_ap_card(dev)->id == (int)(long)(void *)data; in __match_card_device_with_id()
1748 return is_queue_dev(dev) && to_ap_queue(dev)->qid == (int)(long)data; in __match_queue_device_with_qid()
1758 AP_QID_QUEUE(to_ap_queue(dev)->qid) == (int)(long)data; in __match_queue_device_with_queue_id()
1766 if (try_module_get(drv->owner)) { in __drv_notify_config_changed()
1767 if (ap_drv->on_config_changed) in __drv_notify_config_changed()
1768 ap_drv->on_config_changed(ap_qci_info, ap_qci_info_old); in __drv_notify_config_changed()
1769 module_put(drv->owner); in __drv_notify_config_changed()
1787 if (try_module_get(drv->owner)) { in __drv_notify_scan_complete()
1788 if (ap_drv->on_scan_complete) in __drv_notify_scan_complete()
1789 ap_drv->on_scan_complete(ap_qci_info, in __drv_notify_scan_complete()
1791 module_put(drv->owner); in __drv_notify_scan_complete()
1811 (void *)(long)ac->id, in ap_scan_rm_card_dev_and_queue_devs()
1813 device_unregister(&ac->ap_dev.device); in ap_scan_rm_card_dev_and_queue_devs()
1837 qid = AP_MKQID(ac->id, dom); in ap_scan_domains()
1845 __func__, ac->id, dom); in ap_scan_domains()
1853 case -1: in ap_scan_domains()
1856 __func__, ac->id, dom); in ap_scan_domains()
1865 /* if no queue device exists, create a new one */ in ap_scan_domains()
1870 __func__, ac->id, dom); in ap_scan_domains()
1873 aq->config = !decfg; in ap_scan_domains()
1874 aq->chkstop = chkstop; in ap_scan_domains()
1875 aq->se_bstate = hwinfo.bs; in ap_scan_domains()
1876 dev = &aq->ap_dev.device; in ap_scan_domains()
1877 dev->bus = &ap_bus_type; in ap_scan_domains()
1878 dev->parent = &ac->ap_dev.device; in ap_scan_domains()
1879 dev_set_name(dev, "%02x.%04x", ac->id, dom); in ap_scan_domains()
1884 __func__, ac->id, dom); in ap_scan_domains()
1891 __func__, ac->id, dom); in ap_scan_domains()
1894 __func__, ac->id, dom); in ap_scan_domains()
1899 __func__, ac->id, dom); in ap_scan_domains()
1903 /* handle state changes on already existing queue device */ in ap_scan_domains()
1904 spin_lock_bh(&aq->lock); in ap_scan_domains()
1906 aq->se_bstate = hwinfo.bs; in ap_scan_domains()
1908 if (chkstop && !aq->chkstop) { in ap_scan_domains()
1909 /* checkstop on */ in ap_scan_domains()
1910 aq->chkstop = true; in ap_scan_domains()
1911 if (aq->dev_state > AP_DEV_STATE_UNINITIATED) { in ap_scan_domains()
1912 aq->dev_state = AP_DEV_STATE_ERROR; in ap_scan_domains()
1913 aq->last_err_rc = AP_RESPONSE_CHECKSTOPPED; in ap_scan_domains()
1915 spin_unlock_bh(&aq->lock); in ap_scan_domains()
1916 pr_debug("(%d,%d) queue dev checkstop on\n", in ap_scan_domains()
1917 ac->id, dom); in ap_scan_domains()
1918 /* 'receive' pending messages with -EAGAIN */ in ap_scan_domains()
1921 } else if (!chkstop && aq->chkstop) { in ap_scan_domains()
1923 aq->chkstop = false; in ap_scan_domains()
1924 if (aq->dev_state > AP_DEV_STATE_UNINITIATED) in ap_scan_domains()
1926 spin_unlock_bh(&aq->lock); in ap_scan_domains()
1928 ac->id, dom); in ap_scan_domains()
1932 if (decfg && aq->config) { in ap_scan_domains()
1934 aq->config = false; in ap_scan_domains()
1935 if (aq->dev_state > AP_DEV_STATE_UNINITIATED) { in ap_scan_domains()
1936 aq->dev_state = AP_DEV_STATE_ERROR; in ap_scan_domains()
1937 aq->last_err_rc = AP_RESPONSE_DECONFIGURED; in ap_scan_domains()
1939 spin_unlock_bh(&aq->lock); in ap_scan_domains()
1941 ac->id, dom); in ap_scan_domains()
1942 ap_send_config_uevent(&aq->ap_dev, aq->config); in ap_scan_domains()
1943 /* 'receive' pending messages with -EAGAIN */ in ap_scan_domains()
1946 } else if (!decfg && !aq->config) { in ap_scan_domains()
1947 /* config on this queue device */ in ap_scan_domains()
1948 aq->config = true; in ap_scan_domains()
1949 if (aq->dev_state > AP_DEV_STATE_UNINITIATED) in ap_scan_domains()
1951 spin_unlock_bh(&aq->lock); in ap_scan_domains()
1952 pr_debug("(%d,%d) queue dev config on\n", in ap_scan_domains()
1953 ac->id, dom); in ap_scan_domains()
1954 ap_send_config_uevent(&aq->ap_dev, aq->config); in ap_scan_domains()
1958 if (!decfg && aq->dev_state == AP_DEV_STATE_ERROR) { in ap_scan_domains()
1959 spin_unlock_bh(&aq->lock); in ap_scan_domains()
1960 /* 'receive' pending messages with -EAGAIN */ in ap_scan_domains()
1962 /* re-init (with reset) the queue device */ in ap_scan_domains()
1965 __func__, ac->id, dom); in ap_scan_domains()
1968 spin_unlock_bh(&aq->lock); in ap_scan_domains()
2006 * If no card device exists, build one. If a card device exists, check in ap_scan_adapter()
2020 AP_DBF_INFO("%s(%d) no type info (no APQN found), rm card and queue devs\n", in ap_scan_adapter()
2025 pr_debug("(%d) no type info (no APQN found), ignored\n", in ap_scan_adapter()
2031 /* No apdater type info available, an unusable adapter */ in ap_scan_adapter()
2033 AP_DBF_INFO("%s(%d) no valid type (0) info, rm card and queue devs\n", in ap_scan_adapter()
2038 pr_debug("(%d) no valid type (0) info, ignored\n", ap); in ap_scan_adapter()
2045 if (ac->hwinfo.at != hwinfo.at) { in ap_scan_adapter()
2051 } else if (ac->hwinfo.fac != hwinfo.fac) { in ap_scan_adapter()
2059 if (chkstop && !ac->chkstop) { in ap_scan_adapter()
2060 /* checkstop on */ in ap_scan_adapter()
2061 ac->chkstop = true; in ap_scan_adapter()
2062 AP_DBF_INFO("%s(%d) card dev checkstop on\n", in ap_scan_adapter()
2064 } else if (!chkstop && ac->chkstop) { in ap_scan_adapter()
2066 ac->chkstop = false; in ap_scan_adapter()
2071 if (decfg && ac->config) { in ap_scan_adapter()
2072 ac->config = false; in ap_scan_adapter()
2075 ap_send_config_uevent(&ac->ap_dev, ac->config); in ap_scan_adapter()
2076 } else if (!decfg && !ac->config) { in ap_scan_adapter()
2077 ac->config = true; in ap_scan_adapter()
2078 AP_DBF_INFO("%s(%d) card dev config on\n", in ap_scan_adapter()
2080 ap_send_config_uevent(&ac->ap_dev, ac->config); in ap_scan_adapter()
2099 ac->config = !decfg; in ap_scan_adapter()
2100 ac->chkstop = chkstop; in ap_scan_adapter()
2101 dev = &ac->ap_dev.device; in ap_scan_adapter()
2102 dev->bus = &ap_bus_type; in ap_scan_adapter()
2103 dev->parent = ap_root_device; in ap_scan_adapter()
2106 if (ac->maxmsgsize > atomic_read(&ap_max_msg_size)) { in ap_scan_adapter()
2107 atomic_set(&ap_max_msg_size, ac->maxmsgsize); in ap_scan_adapter()
2137 put_device(&ac->ap_dev.device); in ap_scan_adapter()
2141 * ap_get_configuration - get the host AP configuration
2152 if (!ap_qci_info->flags) /* QCI not supported */ in ap_get_configuration()
2163 * ap_config_has_new_aps - Check current against old qci info if
2173 if (!ap_qci_info->flags) in ap_config_has_new_aps()
2176 bitmap_andnot(m, (unsigned long *)ap_qci_info->apm, in ap_config_has_new_aps()
2177 (unsigned long *)ap_qci_info_old->apm, AP_DEVICES); in ap_config_has_new_aps()
2185 * ap_config_has_new_doms - Check current against old qci info if
2194 if (!ap_qci_info->flags) in ap_config_has_new_doms()
2197 bitmap_andnot(m, (unsigned long *)ap_qci_info->aqm, in ap_config_has_new_doms()
2198 (unsigned long *)ap_qci_info_old->aqm, AP_DOMAINS); in ap_config_has_new_doms()
2219 /* (re-)fetch configuration via QCI */ in ap_scan_bus()
2253 AP_DBF_INFO("%s no queue device with default domain %d available\n", in ap_scan_bus()
2258 pr_debug("init scan complete\n"); in ap_scan_bus()
2292 * AP scan bus and there is no need to wait and re-trigger the in ap_scan_bus_wq_callback()
2294 * the AP scan bus timer is re-armed which triggers then the in ap_scan_bus_wq_callback()
2324 * Setup the high resolution poll timer. in ap_async_init()
2338 /* Start the low priority AP bus poll thread. */ in ap_async_init()
2393 /* all resources usable if no kernel parameter string given */ in ap_perms_init()
2428 return -ENODEV; in ap_module_init()
2431 /* init ap_queue hashtable */ in ap_module_init()
2441 if (ap_domain_index < -1 || ap_domain_index > ap_max_domain_id || in ap_module_init()
2446 ap_domain_index = -1; in ap_module_init()
2459 ap_root_device->bus = &ap_bus_type; in ap_module_init()