ap_bus.c (50501936288d6a29d7ef78f25d00e33240fad45f) ap_bus.c (5ac8c72462cdad56e37981eb2172c5baa1ea40d6)
1// SPDX-License-Identifier: GPL-2.0+
2/*
1// SPDX-License-Identifier: GPL-2.0+
2/*
3 * Copyright IBM Corp. 2006, 2021
3 * Copyright IBM Corp. 2006, 2023
4 * Author(s): Cornelia Huck <cornelia.huck@de.ibm.com>
5 * Martin Schwidefsky <schwidefsky@de.ibm.com>
6 * Ralph Wuerthner <rwuerthn@de.ibm.com>
7 * Felix Beck <felix.beck@de.ibm.com>
8 * Holger Dengler <hd@linux.vnet.ibm.com>
9 * Harald Freudenberger <freude@linux.ibm.com>
10 *
11 * Adjunct processor bus.

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

382 if (WARN_ON_ONCE(!tapq_info.value))
383 return 0;
384 *q_type = tapq_info.at;
385 *q_fac = tapq_info.fac;
386 *q_depth = tapq_info.qd;
387 *q_ml = tapq_info.ml;
388 *q_decfg = status.response_code == AP_RESPONSE_DECONFIGURED;
389 *q_cstop = status.response_code == AP_RESPONSE_CHECKSTOPPED;
4 * Author(s): Cornelia Huck <cornelia.huck@de.ibm.com>
5 * Martin Schwidefsky <schwidefsky@de.ibm.com>
6 * Ralph Wuerthner <rwuerthn@de.ibm.com>
7 * Felix Beck <felix.beck@de.ibm.com>
8 * Holger Dengler <hd@linux.vnet.ibm.com>
9 * Harald Freudenberger <freude@linux.ibm.com>
10 *
11 * Adjunct processor bus.

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

382 if (WARN_ON_ONCE(!tapq_info.value))
383 return 0;
384 *q_type = tapq_info.at;
385 *q_fac = tapq_info.fac;
386 *q_depth = tapq_info.qd;
387 *q_ml = tapq_info.ml;
388 *q_decfg = status.response_code == AP_RESPONSE_DECONFIGURED;
389 *q_cstop = status.response_code == AP_RESPONSE_CHECKSTOPPED;
390 switch (*q_type) {
391 /* For CEX2 and CEX3 the available functions
392 * are not reflected by the facilities bits.
393 * Instead it is coded into the type. So here
394 * modify the function bits based on the type.
395 */
396 case AP_DEVICE_TYPE_CEX2A:
397 case AP_DEVICE_TYPE_CEX3A:
398 *q_fac |= 0x08000000;
399 break;
400 case AP_DEVICE_TYPE_CEX2C:
401 case AP_DEVICE_TYPE_CEX3C:
402 *q_fac |= 0x10000000;
403 break;
404 default:
405 break;
406 }
407 return 1;
408 default:
409 /*
410 * A response code which indicates, there is no info available.
411 */
412 return -1;
413 }
414}

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

492 */
493static void ap_tasklet_fn(unsigned long dummy)
494{
495 int bkt;
496 struct ap_queue *aq;
497 enum ap_sm_wait wait = AP_SM_WAIT_NONE;
498
499 /* Reset the indicator if interrupts are used. Thus new interrupts can
390 return 1;
391 default:
392 /*
393 * A response code which indicates, there is no info available.
394 */
395 return -1;
396 }
397}

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

475 */
476static void ap_tasklet_fn(unsigned long dummy)
477{
478 int bkt;
479 struct ap_queue *aq;
480 enum ap_sm_wait wait = AP_SM_WAIT_NONE;
481
482 /* Reset the indicator if interrupts are used. Thus new interrupts can
500 * be received. Doing it in the beginning of the tasklet is therefor
483 * be received. Doing it in the beginning of the tasklet is therefore
501 * important that no requests on any AP get lost.
502 */
503 if (ap_irq_flag)
504 xchg(ap_airq.lsi_ptr, 0);
505
506 spin_lock_bh(&ap_queues_lock);
507 hash_for_each(ap_queues, bkt, aq, hnode) {
508 spin_lock_bh(&aq->lock);

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

1673 * This function checks the type and returns either 0 for not
1674 * supported or the highest compatible type value (which may
1675 * include the input type value).
1676 */
1677static int ap_get_compatible_type(ap_qid_t qid, int rawtype, unsigned int func)
1678{
1679 int comp_type = 0;
1680
484 * important that no requests on any AP get lost.
485 */
486 if (ap_irq_flag)
487 xchg(ap_airq.lsi_ptr, 0);
488
489 spin_lock_bh(&ap_queues_lock);
490 hash_for_each(ap_queues, bkt, aq, hnode) {
491 spin_lock_bh(&aq->lock);

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

1656 * This function checks the type and returns either 0 for not
1657 * supported or the highest compatible type value (which may
1658 * include the input type value).
1659 */
1660static int ap_get_compatible_type(ap_qid_t qid, int rawtype, unsigned int func)
1661{
1662 int comp_type = 0;
1663
1681 /* < CEX2A is not supported */
1682 if (rawtype < AP_DEVICE_TYPE_CEX2A) {
1664 /* < CEX4 is not supported */
1665 if (rawtype < AP_DEVICE_TYPE_CEX4) {
1683 AP_DBF_WARN("%s queue=%02x.%04x unsupported type %d\n",
1684 __func__, AP_QID_CARD(qid),
1685 AP_QID_QUEUE(qid), rawtype);
1686 return 0;
1687 }
1688 /* up to CEX8 known and fully supported */
1689 if (rawtype <= AP_DEVICE_TYPE_CEX8)
1690 return rawtype;

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

1696 if (ap_qact_available()) {
1697 struct ap_queue_status status;
1698 union ap_qact_ap_info apinfo = {0};
1699
1700 apinfo.mode = (func >> 26) & 0x07;
1701 apinfo.cat = AP_DEVICE_TYPE_CEX8;
1702 status = ap_qact(qid, 0, &apinfo);
1703 if (status.response_code == AP_RESPONSE_NORMAL &&
1666 AP_DBF_WARN("%s queue=%02x.%04x unsupported type %d\n",
1667 __func__, AP_QID_CARD(qid),
1668 AP_QID_QUEUE(qid), rawtype);
1669 return 0;
1670 }
1671 /* up to CEX8 known and fully supported */
1672 if (rawtype <= AP_DEVICE_TYPE_CEX8)
1673 return rawtype;

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

1679 if (ap_qact_available()) {
1680 struct ap_queue_status status;
1681 union ap_qact_ap_info apinfo = {0};
1682
1683 apinfo.mode = (func >> 26) & 0x07;
1684 apinfo.cat = AP_DEVICE_TYPE_CEX8;
1685 status = ap_qact(qid, 0, &apinfo);
1686 if (status.response_code == AP_RESPONSE_NORMAL &&
1704 apinfo.cat >= AP_DEVICE_TYPE_CEX2A &&
1687 apinfo.cat >= AP_DEVICE_TYPE_CEX4 &&
1705 apinfo.cat <= AP_DEVICE_TYPE_CEX8)
1706 comp_type = apinfo.cat;
1707 }
1708 if (!comp_type)
1709 AP_DBF_WARN("%s queue=%02x.%04x unable to map type %d\n",
1710 __func__, AP_QID_CARD(qid),
1711 AP_QID_QUEUE(qid), rawtype);
1712 else if (comp_type != rawtype)

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

2284 if (rc)
2285 goto out_bus;
2286 ap_root_device->bus = &ap_bus_type;
2287
2288 /* Setup the AP bus rescan timer. */
2289 timer_setup(&ap_config_timer, ap_config_timeout, 0);
2290
2291 /*
1688 apinfo.cat <= AP_DEVICE_TYPE_CEX8)
1689 comp_type = apinfo.cat;
1690 }
1691 if (!comp_type)
1692 AP_DBF_WARN("%s queue=%02x.%04x unable to map type %d\n",
1693 __func__, AP_QID_CARD(qid),
1694 AP_QID_QUEUE(qid), rawtype);
1695 else if (comp_type != rawtype)

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

2267 if (rc)
2268 goto out_bus;
2269 ap_root_device->bus = &ap_bus_type;
2270
2271 /* Setup the AP bus rescan timer. */
2272 timer_setup(&ap_config_timer, ap_config_timeout, 0);
2273
2274 /*
2292 * Setup the high resultion poll timer.
2275 * Setup the high resolution poll timer.
2293 * If we are running under z/VM adjust polling to z/VM polling rate.
2294 */
2295 if (MACHINE_IS_VM)
2296 poll_high_timeout = 1500000;
2297 hrtimer_init(&ap_poll_timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS);
2298 ap_poll_timer.function = ap_poll_timeout;
2299
2300 /* Start the low priority AP bus poll thread. */

--- 22 unchanged lines hidden ---
2276 * If we are running under z/VM adjust polling to z/VM polling rate.
2277 */
2278 if (MACHINE_IS_VM)
2279 poll_high_timeout = 1500000;
2280 hrtimer_init(&ap_poll_timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS);
2281 ap_poll_timer.function = ap_poll_timeout;
2282
2283 /* Start the low priority AP bus poll thread. */

--- 22 unchanged lines hidden ---