ap_bus.c (b3e8652bcbfa04807e44708d4d0c8cdad39c9215) ap_bus.c (fc1d3f02544a6fd5f417921b57c663388586a17a)
1/*
2 * Copyright IBM Corp. 2006, 2012
3 * Author(s): Cornelia Huck <cornelia.huck@de.ibm.com>
4 * Martin Schwidefsky <schwidefsky@de.ibm.com>
5 * Ralph Wuerthner <rwuerthn@de.ibm.com>
6 * Felix Beck <felix.beck@de.ibm.com>
7 * Holger Dengler <hd@linux.vnet.ibm.com>
8 *

--- 48 unchanged lines hidden (view full) ---

57 "Copyright IBM Corp. 2006, 2012");
58MODULE_LICENSE("GPL");
59MODULE_ALIAS_CRYPTO("z90crypt");
60
61/*
62 * Module parameter
63 */
64int ap_domain_index = -1; /* Adjunct Processor Domain Index */
1/*
2 * Copyright IBM Corp. 2006, 2012
3 * Author(s): Cornelia Huck <cornelia.huck@de.ibm.com>
4 * Martin Schwidefsky <schwidefsky@de.ibm.com>
5 * Ralph Wuerthner <rwuerthn@de.ibm.com>
6 * Felix Beck <felix.beck@de.ibm.com>
7 * Holger Dengler <hd@linux.vnet.ibm.com>
8 *

--- 48 unchanged lines hidden (view full) ---

57 "Copyright IBM Corp. 2006, 2012");
58MODULE_LICENSE("GPL");
59MODULE_ALIAS_CRYPTO("z90crypt");
60
61/*
62 * Module parameter
63 */
64int ap_domain_index = -1; /* Adjunct Processor Domain Index */
65static DEFINE_SPINLOCK(ap_domain_lock);
65module_param_named(domain, ap_domain_index, int, S_IRUSR|S_IRGRP);
66MODULE_PARM_DESC(domain, "domain index for ap devices");
67EXPORT_SYMBOL(ap_domain_index);
68
69static int ap_thread_flag = 0;
70module_param_named(poll_thread, ap_thread_flag, int, S_IRUSR|S_IRGRP);
71MODULE_PARM_DESC(poll_thread, "Turn on/off poll thread, default is 0 (off).");
72

--- 1403 unchanged lines hidden (view full) ---

1476/*
1477 * AP bus attributes.
1478 */
1479static ssize_t ap_domain_show(struct bus_type *bus, char *buf)
1480{
1481 return snprintf(buf, PAGE_SIZE, "%d\n", ap_domain_index);
1482}
1483
66module_param_named(domain, ap_domain_index, int, S_IRUSR|S_IRGRP);
67MODULE_PARM_DESC(domain, "domain index for ap devices");
68EXPORT_SYMBOL(ap_domain_index);
69
70static int ap_thread_flag = 0;
71module_param_named(poll_thread, ap_thread_flag, int, S_IRUSR|S_IRGRP);
72MODULE_PARM_DESC(poll_thread, "Turn on/off poll thread, default is 0 (off).");
73

--- 1403 unchanged lines hidden (view full) ---

1477/*
1478 * AP bus attributes.
1479 */
1480static ssize_t ap_domain_show(struct bus_type *bus, char *buf)
1481{
1482 return snprintf(buf, PAGE_SIZE, "%d\n", ap_domain_index);
1483}
1484
1484static BUS_ATTR(ap_domain, 0444, ap_domain_show, NULL);
1485static ssize_t ap_domain_store(struct bus_type *bus,
1486 const char *buf, size_t count)
1487{
1488 int domain;
1485
1489
1490 if (sscanf(buf, "%i\n", &domain) != 1 ||
1491 domain < 0 || domain > ap_max_domain_id)
1492 return -EINVAL;
1493 spin_lock_bh(&ap_domain_lock);
1494 ap_domain_index = domain;
1495 spin_unlock_bh(&ap_domain_lock);
1496 return count;
1497}
1498
1499static BUS_ATTR(ap_domain, 0644, ap_domain_show, ap_domain_store);
1500
1486static ssize_t ap_control_domain_mask_show(struct bus_type *bus, char *buf)
1487{
1488 if (!ap_configuration) /* QCI not supported */
1489 return snprintf(buf, PAGE_SIZE, "not supported\n");
1490 if (!test_facility(76))
1491 /* format 0 - 16 bit domain field */
1492 return snprintf(buf, PAGE_SIZE, "%08x%08x\n",
1493 ap_configuration->adm[0],

--- 124 unchanged lines hidden (view full) ---

1618 struct ap_queue_status status;
1619 int i, j;
1620
1621 /*
1622 * We want to use a single domain. Either the one specified with
1623 * the "domain=" parameter or the domain with the maximum number
1624 * of devices.
1625 */
1501static ssize_t ap_control_domain_mask_show(struct bus_type *bus, char *buf)
1502{
1503 if (!ap_configuration) /* QCI not supported */
1504 return snprintf(buf, PAGE_SIZE, "not supported\n");
1505 if (!test_facility(76))
1506 /* format 0 - 16 bit domain field */
1507 return snprintf(buf, PAGE_SIZE, "%08x%08x\n",
1508 ap_configuration->adm[0],

--- 124 unchanged lines hidden (view full) ---

1633 struct ap_queue_status status;
1634 int i, j;
1635
1636 /*
1637 * We want to use a single domain. Either the one specified with
1638 * the "domain=" parameter or the domain with the maximum number
1639 * of devices.
1640 */
1626 if (ap_domain_index >= 0)
1641 spin_lock_bh(&ap_domain_lock);
1642 if (ap_domain_index >= 0) {
1627 /* Domain has already been selected. */
1643 /* Domain has already been selected. */
1644 spin_unlock_bh(&ap_domain_lock);
1628 return 0;
1645 return 0;
1646 }
1629 best_domain = -1;
1630 max_count = 0;
1631 for (i = 0; i < AP_DOMAINS; i++) {
1632 if (!ap_test_config_domain(i))
1633 continue;
1634 count = 0;
1635 for (j = 0; j < AP_DEVICES; j++) {
1636 if (!ap_test_config_card_id(j))

--- 5 unchanged lines hidden (view full) ---

1642 }
1643 if (count > max_count) {
1644 max_count = count;
1645 best_domain = i;
1646 }
1647 }
1648 if (best_domain >= 0){
1649 ap_domain_index = best_domain;
1647 best_domain = -1;
1648 max_count = 0;
1649 for (i = 0; i < AP_DOMAINS; i++) {
1650 if (!ap_test_config_domain(i))
1651 continue;
1652 count = 0;
1653 for (j = 0; j < AP_DEVICES; j++) {
1654 if (!ap_test_config_card_id(j))

--- 5 unchanged lines hidden (view full) ---

1660 }
1661 if (count > max_count) {
1662 max_count = count;
1663 best_domain = i;
1664 }
1665 }
1666 if (best_domain >= 0){
1667 ap_domain_index = best_domain;
1668 spin_unlock_bh(&ap_domain_lock);
1650 return 0;
1651 }
1669 return 0;
1670 }
1671 spin_unlock_bh(&ap_domain_lock);
1652 return -ENODEV;
1653}
1654
1655/**
1656 * __ap_scan_bus(): Scan the AP bus.
1657 * @dev: Pointer to device
1658 * @data: Pointer to data
1659 *

--- 12 unchanged lines hidden (view full) ---

1672 int queue_depth = 0, device_type = 0;
1673 unsigned int device_functions = 0;
1674 int rc, i, borked;
1675
1676 ap_query_configuration();
1677 if (ap_select_domain() != 0)
1678 goto out;
1679
1672 return -ENODEV;
1673}
1674
1675/**
1676 * __ap_scan_bus(): Scan the AP bus.
1677 * @dev: Pointer to device
1678 * @data: Pointer to data
1679 *

--- 12 unchanged lines hidden (view full) ---

1692 int queue_depth = 0, device_type = 0;
1693 unsigned int device_functions = 0;
1694 int rc, i, borked;
1695
1696 ap_query_configuration();
1697 if (ap_select_domain() != 0)
1698 goto out;
1699
1700
1701 spin_lock_bh(&ap_domain_lock);
1680 for (i = 0; i < AP_DEVICES; i++) {
1681 qid = AP_MKQID(i, ap_domain_index);
1682 dev = bus_find_device(&ap_bus_type, NULL,
1683 (void *)(unsigned long)qid,
1684 __ap_scan_bus);
1685 rc = ap_query_queue(qid, &queue_depth, &device_type,
1686 &device_functions);
1687 if (dev) {

--- 60 unchanged lines hidden (view full) ---

1748 /* Add device attributes. */
1749 rc = sysfs_create_group(&ap_dev->device.kobj,
1750 &ap_dev_attr_group);
1751 if (rc) {
1752 device_unregister(&ap_dev->device);
1753 continue;
1754 }
1755 }
1702 for (i = 0; i < AP_DEVICES; i++) {
1703 qid = AP_MKQID(i, ap_domain_index);
1704 dev = bus_find_device(&ap_bus_type, NULL,
1705 (void *)(unsigned long)qid,
1706 __ap_scan_bus);
1707 rc = ap_query_queue(qid, &queue_depth, &device_type,
1708 &device_functions);
1709 if (dev) {

--- 60 unchanged lines hidden (view full) ---

1770 /* Add device attributes. */
1771 rc = sysfs_create_group(&ap_dev->device.kobj,
1772 &ap_dev_attr_group);
1773 if (rc) {
1774 device_unregister(&ap_dev->device);
1775 continue;
1776 }
1777 }
1778 spin_unlock_bh(&ap_domain_lock);
1756out:
1757 mod_timer(&ap_config_timer, jiffies + ap_config_time * HZ);
1758}
1759
1760static void ap_config_timeout(unsigned long ptr)
1761{
1762 if (ap_suspend_flag)
1763 return;

--- 165 unchanged lines hidden ---
1779out:
1780 mod_timer(&ap_config_timer, jiffies + ap_config_time * HZ);
1781}
1782
1783static void ap_config_timeout(unsigned long ptr)
1784{
1785 if (ap_suspend_flag)
1786 return;

--- 165 unchanged lines hidden ---