UAPI Changes: - New uapi adding OA functionality to Xe (Ashutosh) Cross-subsystem Changes: - devcoredump: Add dev_coredumpm_timeout (Jose) Driver Changes: - More SRIOV preparation, including GuC communication improvements (Michal) - Kconfig update: do not select ACPI_BUTTON (Jani) - Rework GPU page fault handling (Brost) - Forcewake clean-up and fixes (Himal, Michal) - Drop EXEC_QUEUE_FLAG_BANNED (Brost) - Xe/Xe2 Workarounds fixes and additions (Tejas, Akshata, Sai, Vinay) - Xe devcoredump changes (Jose) - Tracing cleanup and add mmio tracing (RK) - Add BMG PCI IDs (Roper) - Scheduler fixes and improvements (Brost) - Some overal driver clean-up around headers and print macros (Michal) - Rename xe_exec_queue::compute to xe_exec_queue::lr (Francois) - Improve RTP rules to allow easier 'OR' conditions in WA declaration (Lucas) - Use ttm_uncached for BO with NEEDS_UC flag (Michal) - Other OA related work and fixes (Ashutosh, Michal, Jose) - Simplify locking in new_vma (Brost) - Remove xe_irq_shutdown (Ilia) Signed-off-by: Dave Airlie <airlied@redhat.com>
Showing the changes to include/uapi (1 of 87 files). Show all
Unified · Split
| @@ -80,6 +80,7 @@ extern "C" { · 79 unmodified lines | ||
| 80 | 80 | * - &DRM_IOCTL_XE_EXEC_QUEUE_GET_PROPERTY |
| 81 | 81 | * - &DRM_IOCTL_XE_EXEC |
| 82 | 82 | * - &DRM_IOCTL_XE_WAIT_USER_FENCE |
| 83 | + * - &DRM_IOCTL_XE_PERF | |
| 83 | 84 | */ |
| 84 | 85 | |
| 85 | 86 | /* |
| @@ -100,6 +101,8 @@ extern "C" { · 14 unmodified lines | ||
| 100 | 101 | #define DRM_XE_EXEC_QUEUE_GET_PROPERTY 0x08 |
| 101 | 102 | #define DRM_XE_EXEC 0x09 |
| 102 | 103 | #define DRM_XE_WAIT_USER_FENCE 0x0a |
| 104 | +#define DRM_XE_PERF 0x0b | |
| 105 | + | |
| 103 | 106 | /* Must be kept compact -- no holes */ |
| 104 | 107 | |
| 105 | 108 | #define DRM_IOCTL_XE_DEVICE_QUERY DRM_IOWR(DRM_COMMAND_BASE + DRM_XE_DEVICE_QUERY, struct drm_xe_device_query) |
| @@ -113,6 +116,7 @@ extern "C" { · 7 unmodified lines | ||
| 113 | 116 | #define DRM_IOCTL_XE_EXEC_QUEUE_GET_PROPERTY DRM_IOWR(DRM_COMMAND_BASE + DRM_XE_EXEC_QUEUE_GET_PROPERTY, struct drm_xe_exec_queue_get_property) |
| 114 | 117 | #define DRM_IOCTL_XE_EXEC DRM_IOW(DRM_COMMAND_BASE + DRM_XE_EXEC, struct drm_xe_exec) |
| 115 | 118 | #define DRM_IOCTL_XE_WAIT_USER_FENCE DRM_IOWR(DRM_COMMAND_BASE + DRM_XE_WAIT_USER_FENCE, struct drm_xe_wait_user_fence) |
| 119 | +#define DRM_IOCTL_XE_PERF DRM_IOW(DRM_COMMAND_BASE + DRM_XE_PERF, struct drm_xe_perf_param) | |
| 116 | 120 | |
| 117 | 121 | /** |
| 118 | 122 | * DOC: Xe IOCTL Extensions |
| @@ -685,6 +689,7 @@ struct drm_xe_device_query { · 566 unmodified lines | ||
| 685 | 689 | #define DRM_XE_DEVICE_QUERY_GT_TOPOLOGY 5 |
| 686 | 690 | #define DRM_XE_DEVICE_QUERY_ENGINE_CYCLES 6 |
| 687 | 691 | #define DRM_XE_DEVICE_QUERY_UC_FW_VERSION 7 |
| 692 | +#define DRM_XE_DEVICE_QUERY_OA_UNITS 8 | |
| 688 | 693 | /** @query: The type of data to query */ |
| 689 | 694 | __u32 query; |
| 690 | 695 | |
| @@ -1370,6 +1375,309 @@ struct drm_xe_wait_user_fence { · 679 unmodified lines | ||
| 1370 | 1375 | __u64 reserved[2]; |
| 1371 | 1376 | }; |
| 1372 | 1377 | |
| 1378 | +/** | |
| 1379 | + * enum drm_xe_perf_type - Perf stream types | |
| 1380 | + */ | |
| 1381 | +enum drm_xe_perf_type { | |
| 1382 | + /** @DRM_XE_PERF_TYPE_OA: OA perf stream type */ | |
| 1383 | + DRM_XE_PERF_TYPE_OA, | |
| 1384 | +}; | |
| 1385 | + | |
| 1386 | +/** | |
| 1387 | + * enum drm_xe_perf_op - Perf stream ops | |
| 1388 | + */ | |
| 1389 | +enum drm_xe_perf_op { | |
| 1390 | + /** @DRM_XE_PERF_OP_STREAM_OPEN: Open a perf counter stream */ | |
| 1391 | + DRM_XE_PERF_OP_STREAM_OPEN, | |
| 1392 | + | |
| 1393 | + /** @DRM_XE_PERF_OP_ADD_CONFIG: Add perf stream config */ | |
| 1394 | + DRM_XE_PERF_OP_ADD_CONFIG, | |
| 1395 | + | |
| 1396 | + /** @DRM_XE_PERF_OP_REMOVE_CONFIG: Remove perf stream config */ | |
| 1397 | + DRM_XE_PERF_OP_REMOVE_CONFIG, | |
| 1398 | +}; | |
| 1399 | + | |
| 1400 | +/** | |
| 1401 | + * struct drm_xe_perf_param - Input of &DRM_XE_PERF | |
| 1402 | + * | |
| 1403 | + * The perf layer enables multiplexing perf counter streams of multiple | |
| 1404 | + * types. The actual params for a particular stream operation are supplied | |
| 1405 | + * via the @param pointer (use __copy_from_user to get these params). | |
| 1406 | + */ | |
| 1407 | +struct drm_xe_perf_param { | |
| 1408 | + /** @extensions: Pointer to the first extension struct, if any */ | |
| 1409 | + __u64 extensions; | |
| 1410 | + /** @perf_type: Perf stream type, of enum @drm_xe_perf_type */ | |
| 1411 | + __u64 perf_type; | |
| 1412 | + /** @perf_op: Perf op, of enum @drm_xe_perf_op */ | |
| 1413 | + __u64 perf_op; | |
| 1414 | + /** @param: Pointer to actual stream params */ | |
| 1415 | + __u64 param; | |
| 1416 | +}; | |
| 1417 | + | |
| 1418 | +/** | |
| 1419 | + * enum drm_xe_perf_ioctls - Perf fd ioctl's | |
| 1420 | + * | |
| 1421 | + * Information exchanged between userspace and kernel for perf fd ioctl's | |
| 1422 | + * is stream type specific | |
| 1423 | + */ | |
| 1424 | +enum drm_xe_perf_ioctls { | |
| 1425 | + /** @DRM_XE_PERF_IOCTL_ENABLE: Enable data capture for a stream */ | |
| 1426 | + DRM_XE_PERF_IOCTL_ENABLE = _IO('i', 0x0), | |
| 1427 | + | |
| 1428 | + /** @DRM_XE_PERF_IOCTL_DISABLE: Disable data capture for a stream */ | |
| 1429 | + DRM_XE_PERF_IOCTL_DISABLE = _IO('i', 0x1), | |
| 1430 | + | |
| 1431 | + /** @DRM_XE_PERF_IOCTL_CONFIG: Change stream configuration */ | |
| 1432 | + DRM_XE_PERF_IOCTL_CONFIG = _IO('i', 0x2), | |
| 1433 | + | |
| 1434 | + /** @DRM_XE_PERF_IOCTL_STATUS: Return stream status */ | |
| 1435 | + DRM_XE_PERF_IOCTL_STATUS = _IO('i', 0x3), | |
| 1436 | + | |
| 1437 | + /** @DRM_XE_PERF_IOCTL_INFO: Return stream info */ | |
| 1438 | + DRM_XE_PERF_IOCTL_INFO = _IO('i', 0x4), | |
| 1439 | +}; | |
| 1440 | + | |
| 1441 | +/** | |
| 1442 | + * enum drm_xe_oa_unit_type - OA unit types | |
| 1443 | + */ | |
| 1444 | +enum drm_xe_oa_unit_type { | |
| 1445 | + /** | |
| 1446 | + * @DRM_XE_OA_UNIT_TYPE_OAG: OAG OA unit. OAR/OAC are considered | |
| 1447 | + * sub-types of OAG. For OAR/OAC, use OAG. | |
| 1448 | + */ | |
| 1449 | + DRM_XE_OA_UNIT_TYPE_OAG, | |
| 1450 | + | |
| 1451 | + /** @DRM_XE_OA_UNIT_TYPE_OAM: OAM OA unit */ | |
| 1452 | + DRM_XE_OA_UNIT_TYPE_OAM, | |
| 1453 | +}; | |
| 1454 | + | |
| 1455 | +/** | |
| 1456 | + * struct drm_xe_oa_unit - describe OA unit | |
| 1457 | + */ | |
| 1458 | +struct drm_xe_oa_unit { | |
| 1459 | + /** @extensions: Pointer to the first extension struct, if any */ | |
| 1460 | + __u64 extensions; | |
| 1461 | + | |
| 1462 | + /** @oa_unit_id: OA unit ID */ | |
| 1463 | + __u32 oa_unit_id; | |
| 1464 | + | |
| 1465 | + /** @oa_unit_type: OA unit type of @drm_xe_oa_unit_type */ | |
| 1466 | + __u32 oa_unit_type; | |
| 1467 | + | |
| 1468 | + /** @capabilities: OA capabilities bit-mask */ | |
| 1469 | + __u64 capabilities; | |
| 1470 | +#define DRM_XE_OA_CAPS_BASE (1 << 0) | |
| 1471 | + | |
| 1472 | + /** @oa_timestamp_freq: OA timestamp freq */ | |
| 1473 | + __u64 oa_timestamp_freq; | |
| 1474 | + | |
| 1475 | + /** @reserved: MBZ */ | |
| 1476 | + __u64 reserved[4]; | |
| 1477 | + | |
| 1478 | + /** @num_engines: number of engines in @eci array */ | |
| 1479 | + __u64 num_engines; | |
| 1480 | + | |
| 1481 | + /** @eci: engines attached to this OA unit */ | |
| 1482 | + struct drm_xe_engine_class_instance eci[]; | |
| 1483 | +}; | |
| 1484 | + | |
| 1485 | +/** | |
| 1486 | + * struct drm_xe_query_oa_units - describe OA units | |
| 1487 | + * | |
| 1488 | + * If a query is made with a struct drm_xe_device_query where .query | |
| 1489 | + * is equal to DRM_XE_DEVICE_QUERY_OA_UNITS, then the reply uses struct | |
| 1490 | + * drm_xe_query_oa_units in .data. | |
| 1491 | + * | |
| 1492 | + * OA unit properties for all OA units can be accessed using a code block | |
| 1493 | + * such as the one below: | |
| 1494 | + * | |
| 1495 | + * .. code-block:: C | |
| 1496 | + * | |
| 1497 | + * struct drm_xe_query_oa_units *qoa; | |
| 1498 | + * struct drm_xe_oa_unit *oau; | |
| 1499 | + * u8 *poau; | |
| 1500 | + * | |
| 1501 | + * // malloc qoa and issue DRM_XE_DEVICE_QUERY_OA_UNITS. Then: | |
| 1502 | + * poau = (u8 *)&qoa->oa_units[0]; | |
| 1503 | + * for (int i = 0; i < qoa->num_oa_units; i++) { | |
| 1504 | + * oau = (struct drm_xe_oa_unit *)poau; | |
| 1505 | + * // Access 'struct drm_xe_oa_unit' fields here | |
| 1506 | + * poau += sizeof(*oau) + oau->num_engines * sizeof(oau->eci[0]); | |
| 1507 | + * } | |
| 1508 | + */ | |
| 1509 | +struct drm_xe_query_oa_units { | |
| 1510 | + /** @extensions: Pointer to the first extension struct, if any */ | |
| 1511 | + __u64 extensions; | |
| 1512 | + /** @num_oa_units: number of OA units returned in oau[] */ | |
| 1513 | + __u32 num_oa_units; | |
| 1514 | + /** @pad: MBZ */ | |
| 1515 | + __u32 pad; | |
| 1516 | + /** | |
| 1517 | + * @oa_units: struct @drm_xe_oa_unit array returned for this device. | |
| 1518 | + * Written below as a u64 array to avoid problems with nested flexible | |
| 1519 | + * arrays with some compilers | |
| 1520 | + */ | |
| 1521 | + __u64 oa_units[]; | |
| 1522 | +}; | |
| 1523 | + | |
| 1524 | +/** | |
| 1525 | + * enum drm_xe_oa_format_type - OA format types as specified in PRM/Bspec | |
| 1526 | + * 52198/60942 | |
| 1527 | + */ | |
| 1528 | +enum drm_xe_oa_format_type { | |
| 1529 | + /** @DRM_XE_OA_FMT_TYPE_OAG: OAG report format */ | |
| 1530 | + DRM_XE_OA_FMT_TYPE_OAG, | |
| 1531 | + /** @DRM_XE_OA_FMT_TYPE_OAR: OAR report format */ | |
| 1532 | + DRM_XE_OA_FMT_TYPE_OAR, | |
| 1533 | + /** @DRM_XE_OA_FMT_TYPE_OAM: OAM report format */ | |
| 1534 | + DRM_XE_OA_FMT_TYPE_OAM, | |
| 1535 | + /** @DRM_XE_OA_FMT_TYPE_OAC: OAC report format */ | |
| 1536 | + DRM_XE_OA_FMT_TYPE_OAC, | |
| 1537 | + /** @DRM_XE_OA_FMT_TYPE_OAM_MPEC: OAM SAMEDIA or OAM MPEC report format */ | |
| 1538 | + DRM_XE_OA_FMT_TYPE_OAM_MPEC, | |
| 1539 | + /** @DRM_XE_OA_FMT_TYPE_PEC: PEC report format */ | |
| 1540 | + DRM_XE_OA_FMT_TYPE_PEC, | |
| 1541 | +}; | |
| 1542 | + | |
| 1543 | +/** | |
| 1544 | + * enum drm_xe_oa_property_id - OA stream property id's | |
| 1545 | + * | |
| 1546 | + * Stream params are specified as a chain of @drm_xe_ext_set_property | |
| 1547 | + * struct's, with @property values from enum @drm_xe_oa_property_id and | |
| 1548 | + * @drm_xe_user_extension base.name set to @DRM_XE_OA_EXTENSION_SET_PROPERTY. | |
| 1549 | + * @param field in struct @drm_xe_perf_param points to the first | |
| 1550 | + * @drm_xe_ext_set_property struct. | |
| 1551 | + * | |
| 1552 | + * Exactly the same mechanism is also used for stream reconfiguration using | |
| 1553 | + * the @DRM_XE_PERF_IOCTL_CONFIG perf fd ioctl, though only a subset of | |
| 1554 | + * properties below can be specified for stream reconfiguration. | |
| 1555 | + */ | |
| 1556 | +enum drm_xe_oa_property_id { | |
| 1557 | +#define DRM_XE_OA_EXTENSION_SET_PROPERTY 0 | |
| 1558 | + /** | |
| 1559 | + * @DRM_XE_OA_PROPERTY_OA_UNIT_ID: ID of the OA unit on which to open | |
| 1560 | + * the OA stream, see @oa_unit_id in 'struct | |
| 1561 | + * drm_xe_query_oa_units'. Defaults to 0 if not provided. | |
| 1562 | + */ | |
| 1563 | + DRM_XE_OA_PROPERTY_OA_UNIT_ID = 1, | |
| 1564 | + | |
| 1565 | + /** | |
| 1566 | + * @DRM_XE_OA_PROPERTY_SAMPLE_OA: A value of 1 requests inclusion of raw | |
| 1567 | + * OA unit reports or stream samples in a global buffer attached to an | |
| 1568 | + * OA unit. | |
| 1569 | + */ | |
| 1570 | + DRM_XE_OA_PROPERTY_SAMPLE_OA, | |
| 1571 | + | |
| 1572 | + /** | |
| 1573 | + * @DRM_XE_OA_PROPERTY_OA_METRIC_SET: OA metrics defining contents of OA | |
| 1574 | + * reports, previously added via @DRM_XE_PERF_OP_ADD_CONFIG. | |
| 1575 | + */ | |
| 1576 | + DRM_XE_OA_PROPERTY_OA_METRIC_SET, | |
| 1577 | + | |
| 1578 | + /** @DRM_XE_OA_PROPERTY_OA_FORMAT: Perf counter report format */ | |
| 1579 | + DRM_XE_OA_PROPERTY_OA_FORMAT, | |
| 1580 | + /* | |
| 1581 | + * OA_FORMAT's are specified the same way as in PRM/Bspec 52198/60942, | |
| 1582 | + * in terms of the following quantities: a. enum @drm_xe_oa_format_type | |
| 1583 | + * b. Counter select c. Counter size and d. BC report. Also refer to the | |
| 1584 | + * oa_formats array in drivers/gpu/drm/xe/xe_oa.c. | |
| 1585 | + */ | |
| 1586 | +#define DRM_XE_OA_FORMAT_MASK_FMT_TYPE (0xff << 0) | |
| 1587 | +#define DRM_XE_OA_FORMAT_MASK_COUNTER_SEL (0xff << 8) | |
| 1588 | +#define DRM_XE_OA_FORMAT_MASK_COUNTER_SIZE (0xff << 16) | |
| 1589 | +#define DRM_XE_OA_FORMAT_MASK_BC_REPORT (0xff << 24) | |
| 1590 | + | |
| 1591 | + /** | |
| 1592 | + * @DRM_XE_OA_PROPERTY_OA_PERIOD_EXPONENT: Requests periodic OA unit | |
| 1593 | + * sampling with sampling frequency proportional to 2^(period_exponent + 1) | |
| 1594 | + */ | |
| 1595 | + DRM_XE_OA_PROPERTY_OA_PERIOD_EXPONENT, | |
| 1596 | + | |
| 1597 | + /** | |
| 1598 | + * @DRM_XE_OA_PROPERTY_OA_DISABLED: A value of 1 will open the OA | |
| 1599 | + * stream in a DISABLED state (see @DRM_XE_PERF_IOCTL_ENABLE). | |
| 1600 | + */ | |
| 1601 | + DRM_XE_OA_PROPERTY_OA_DISABLED, | |
| 1602 | + | |
| 1603 | + /** | |
| 1604 | + * @DRM_XE_OA_PROPERTY_EXEC_QUEUE_ID: Open the stream for a specific | |
| 1605 | + * @exec_queue_id. Perf queries can be executed on this exec queue. | |
| 1606 | + */ | |
| 1607 | + DRM_XE_OA_PROPERTY_EXEC_QUEUE_ID, | |
| 1608 | + | |
| 1609 | + /** | |
| 1610 | + * @DRM_XE_OA_PROPERTY_OA_ENGINE_INSTANCE: Optional engine instance to | |
| 1611 | + * pass along with @DRM_XE_OA_PROPERTY_EXEC_QUEUE_ID or will default to 0. | |
| 1612 | + */ | |
| 1613 | + DRM_XE_OA_PROPERTY_OA_ENGINE_INSTANCE, | |
| 1614 | + | |
| 1615 | + /** | |
| 1616 | + * @DRM_XE_OA_PROPERTY_NO_PREEMPT: Allow preemption and timeslicing | |
| 1617 | + * to be disabled for the stream exec queue. | |
| 1618 | + */ | |
| 1619 | + DRM_XE_OA_PROPERTY_NO_PREEMPT, | |
| 1620 | +}; | |
| 1621 | + | |
| 1622 | +/** | |
| 1623 | + * struct drm_xe_oa_config - OA metric configuration | |
| 1624 | + * | |
| 1625 | + * Multiple OA configs can be added using @DRM_XE_PERF_OP_ADD_CONFIG. A | |
| 1626 | + * particular config can be specified when opening an OA stream using | |
| 1627 | + * @DRM_XE_OA_PROPERTY_OA_METRIC_SET property. | |
| 1628 | + */ | |
| 1629 | +struct drm_xe_oa_config { | |
| 1630 | + /** @extensions: Pointer to the first extension struct, if any */ | |
| 1631 | + __u64 extensions; | |
| 1632 | + | |
| 1633 | + /** @uuid: String formatted like "%\08x-%\04x-%\04x-%\04x-%\012x" */ | |
| 1634 | + char uuid[36]; | |
| 1635 | + | |
| 1636 | + /** @n_regs: Number of regs in @regs_ptr */ | |
| 1637 | + __u32 n_regs; | |
| 1638 | + | |
| 1639 | + /** | |
| 1640 | + * @regs_ptr: Pointer to (register address, value) pairs for OA config | |
| 1641 | + * registers. Expected length of buffer is: (2 * sizeof(u32) * @n_regs). | |
| 1642 | + */ | |
| 1643 | + __u64 regs_ptr; | |
| 1644 | +}; | |
| 1645 | + | |
| 1646 | +/** | |
| 1647 | + * struct drm_xe_oa_stream_status - OA stream status returned from | |
| 1648 | + * @DRM_XE_PERF_IOCTL_STATUS perf fd ioctl. Userspace can call the ioctl to | |
| 1649 | + * query stream status in response to EIO errno from perf fd read(). | |
| 1650 | + */ | |
| 1651 | +struct drm_xe_oa_stream_status { | |
| 1652 | + /** @extensions: Pointer to the first extension struct, if any */ | |
| 1653 | + __u64 extensions; | |
| 1654 | + | |
| 1655 | + /** @oa_status: OA stream status (see Bspec 46717/61226) */ | |
| 1656 | + __u64 oa_status; | |
| 1657 | +#define DRM_XE_OASTATUS_MMIO_TRG_Q_FULL (1 << 3) | |
| 1658 | +#define DRM_XE_OASTATUS_COUNTER_OVERFLOW (1 << 2) | |
| 1659 | +#define DRM_XE_OASTATUS_BUFFER_OVERFLOW (1 << 1) | |
| 1660 | +#define DRM_XE_OASTATUS_REPORT_LOST (1 << 0) | |
| 1661 | + | |
| 1662 | + /** @reserved: reserved for future use */ | |
| 1663 | + __u64 reserved[3]; | |
| 1664 | +}; | |
| 1665 | + | |
| 1666 | +/** | |
| 1667 | + * struct drm_xe_oa_stream_info - OA stream info returned from | |
| 1668 | + * @DRM_XE_PERF_IOCTL_INFO perf fd ioctl | |
| 1669 | + */ | |
| 1670 | +struct drm_xe_oa_stream_info { | |
| 1671 | + /** @extensions: Pointer to the first extension struct, if any */ | |
| 1672 | + __u64 extensions; | |
| 1673 | + | |
| 1674 | + /** @oa_buf_size: OA buffer size */ | |
| 1675 | + __u64 oa_buf_size; | |
| 1676 | + | |
| 1677 | + /** @reserved: reserved for future use */ | |
| 1678 | + __u64 reserved[3]; | |
| 1679 | +}; | |
| 1680 | + | |
| 1373 | 1681 | #if defined(__cplusplus) |
| 1374 | 1682 | } |
| 1375 | 1683 | #endif |