Sync drm-xe-next with drm-next to unblock some topic branches.
Showing the changes to include/uapi (7 of 2283 files). Show all
Unified · Split
| @@ -156,10 +156,11 @@ struct amdxdna_drm_config_hwctx { · 155 unmodified lines | ||
| 156 | 156 | |
| 157 | 157 | enum amdxdna_bo_type { |
| 158 | 158 | AMDXDNA_BO_INVALID = 0, |
| 159 | − AMDXDNA_BO_SHMEM, | |
| 160 | − AMDXDNA_BO_DEV_HEAP, | |
| 161 | − AMDXDNA_BO_DEV, | |
| 162 | − AMDXDNA_BO_CMD, | |
| 159 | + AMDXDNA_BO_SHMEM = 1, /* Be compatible with legacy application code. */ | |
| 160 | + AMDXDNA_BO_SHARE = 1, | |
| 161 | + AMDXDNA_BO_DEV_HEAP = 2, | |
| 162 | + AMDXDNA_BO_DEV = 3, | |
| 163 | + AMDXDNA_BO_CMD = 4, | |
| 163 | 164 | }; |
| 164 | 165 | |
| 165 | 166 | /** |
| @@ -590,8 +591,37 @@ struct amdxdna_async_error { · 424 unmodified lines | ||
| 590 | 591 | __u64 ex_err_code; |
| 591 | 592 | }; |
| 592 | 593 | |
| 594 | +/** | |
| 595 | + * struct amdxdna_drm_bo_usage - all types of BO usage | |
| 596 | + * BOs managed by XRT/SHIM/driver is counted as internal. | |
| 597 | + * Others are counted as external which are managed by applications. | |
| 598 | + * | |
| 599 | + * Among all types of BOs: | |
| 600 | + * AMDXDNA_BO_DEV_HEAP - is counted for internal. | |
| 601 | + * AMDXDNA_BO_SHARE - is counted for external. | |
| 602 | + * AMDXDNA_BO_CMD - is counted for internal. | |
| 603 | + * AMDXDNA_BO_DEV - is counted by heap_usage only, not internal | |
| 604 | + * or external. It does not add to the total memory | |
| 605 | + * footprint since its mem comes from heap which is | |
| 606 | + * already counted as internal. | |
| 607 | + */ | |
| 608 | +struct amdxdna_drm_bo_usage { | |
| 609 | + /** @pid: The ID of the process to query from. */ | |
| 610 | + __s64 pid; | |
| 611 | + /** @total_usage: Total BO size used by process. */ | |
| 612 | + __u64 total_usage; | |
| 613 | + /** @internal_usage: Total internal BO size used by process. */ | |
| 614 | + __u64 internal_usage; | |
| 615 | + /** @heap_usage: Total device BO size used by process. */ | |
| 616 | + __u64 heap_usage; | |
| 617 | +}; | |
| 618 | + | |
| 619 | +/* | |
| 620 | + * Supported params in struct amdxdna_drm_get_array | |
| 621 | + */ | |
| 593 | 622 | #define DRM_AMDXDNA_HW_CONTEXT_ALL 0 |
| 594 | 623 | #define DRM_AMDXDNA_HW_LAST_ASYNC_ERR 2 |
| 624 | +#define DRM_AMDXDNA_BO_USAGE 6 | |
| 595 | 625 | |
| 596 | 626 | /** |
| 597 | 627 | * struct amdxdna_drm_get_array - Get information array. |
| @@ -604,6 +634,12 @@ struct amdxdna_drm_get_array { · 6 unmodified lines | ||
| 604 | 634 | * |
| 605 | 635 | * %DRM_AMDXDNA_HW_CONTEXT_ALL: |
| 606 | 636 | * Returns all created hardware contexts. |
| 637 | + * | |
| 638 | + * %DRM_AMDXDNA_HW_LAST_ASYNC_ERR: | |
| 639 | + * Returns last async error. | |
| 640 | + * | |
| 641 | + * %DRM_AMDXDNA_BO_USAGE: | |
| 642 | + * Returns usage of heap/internal/external BOs. | |
| 607 | 643 | */ |
| 608 | 644 | __u32 param; |
| 609 | 645 | /** |
| @@ -27,6 +27,9 @@ · 26 unmodified lines | ||
| 27 | 27 | #ifndef _DRM_MODE_H |
| 28 | 28 | #define _DRM_MODE_H |
| 29 | 29 | |
| 30 | +#include <linux/bits.h> | |
| 31 | +#include <linux/const.h> | |
| 32 | + | |
| 30 | 33 | #include "drm.h" |
| 31 | 34 | |
| 32 | 35 | #if defined(__cplusplus) |
| @@ -1549,6 +1552,83 @@ struct drm_mode_closefb { · 1516 unmodified lines | ||
| 1549 | 1552 | __u32 pad; |
| 1550 | 1553 | }; |
| 1551 | 1554 | |
| 1555 | +/* | |
| 1556 | + * Put 16-bit ARGB values into a standard 64-bit representation that can be | |
| 1557 | + * used for ioctl parameters, inter-driver communication, etc. | |
| 1558 | + * | |
| 1559 | + * If the component values being provided contain less than 16 bits of | |
| 1560 | + * precision, use a conversion ratio to get a better color approximation. | |
| 1561 | + * The ratio is computed as (2^16 - 1) / (2^bpc - 1), where bpc and 16 are | |
| 1562 | + * the input and output precision, respectively. | |
| 1563 | + * Also note bpc must be greater than 0. | |
| 1564 | + */ | |
| 1565 | +#define __DRM_ARGB64_PREP(c, shift) \ | |
| 1566 | + (((__u64)(c) & __GENMASK(15, 0)) << (shift)) | |
| 1567 | + | |
| 1568 | +#define __DRM_ARGB64_PREP_BPC(c, shift, bpc) \ | |
| 1569 | +({ \ | |
| 1570 | + __u16 mask = __GENMASK((bpc) - 1, 0); \ | |
| 1571 | + __u16 conv = __KERNEL_DIV_ROUND_CLOSEST((mask & (c)) * \ | |
| 1572 | + __GENMASK(15, 0), mask);\ | |
| 1573 | + __DRM_ARGB64_PREP(conv, shift); \ | |
| 1574 | +}) | |
| 1575 | + | |
| 1576 | +#define DRM_ARGB64_PREP(alpha, red, green, blue) \ | |
| 1577 | +( \ | |
| 1578 | + __DRM_ARGB64_PREP(alpha, 48) | \ | |
| 1579 | + __DRM_ARGB64_PREP(red, 32) | \ | |
| 1580 | + __DRM_ARGB64_PREP(green, 16) | \ | |
| 1581 | + __DRM_ARGB64_PREP(blue, 0) \ | |
| 1582 | +) | |
| 1583 | + | |
| 1584 | +#define DRM_ARGB64_PREP_BPC(alpha, red, green, blue, bpc) \ | |
| 1585 | +({ \ | |
| 1586 | + __typeof__(bpc) __bpc = bpc; \ | |
| 1587 | + __DRM_ARGB64_PREP_BPC(alpha, 48, __bpc) | \ | |
| 1588 | + __DRM_ARGB64_PREP_BPC(red, 32, __bpc) | \ | |
| 1589 | + __DRM_ARGB64_PREP_BPC(green, 16, __bpc) | \ | |
| 1590 | + __DRM_ARGB64_PREP_BPC(blue, 0, __bpc); \ | |
| 1591 | +}) | |
| 1592 | + | |
| 1593 | +/* | |
| 1594 | + * Extract the specified color component from a standard 64-bit ARGB value. | |
| 1595 | + * | |
| 1596 | + * If the requested precision is less than 16 bits, make use of a conversion | |
| 1597 | + * ratio calculated as (2^bpc - 1) / (2^16 - 1), where bpc and 16 are the | |
| 1598 | + * output and input precision, respectively. | |
| 1599 | + * | |
| 1600 | + * If speed is more important than accuracy, use DRM_ARGB64_GET*_BPCS() | |
| 1601 | + * instead of DRM_ARGB64_GET*_BPC() in order to replace the expensive | |
| 1602 | + * division with a simple bit right-shift operation. | |
| 1603 | + */ | |
| 1604 | +#define __DRM_ARGB64_GET(c, shift) \ | |
| 1605 | + ((__u16)(((__u64)(c) >> (shift)) & __GENMASK(15, 0))) | |
| 1606 | + | |
| 1607 | +#define __DRM_ARGB64_GET_BPC(c, shift, bpc) \ | |
| 1608 | +({ \ | |
| 1609 | + __u16 comp = __DRM_ARGB64_GET(c, shift); \ | |
| 1610 | + __KERNEL_DIV_ROUND_CLOSEST(comp * __GENMASK((bpc) - 1, 0), \ | |
| 1611 | + __GENMASK(15, 0)); \ | |
| 1612 | +}) | |
| 1613 | + | |
| 1614 | +#define __DRM_ARGB64_GET_BPCS(c, shift, bpc) \ | |
| 1615 | + (__DRM_ARGB64_GET(c, shift) >> (16 - (bpc))) | |
| 1616 | + | |
| 1617 | +#define DRM_ARGB64_GETA(c) __DRM_ARGB64_GET(c, 48) | |
| 1618 | +#define DRM_ARGB64_GETR(c) __DRM_ARGB64_GET(c, 32) | |
| 1619 | +#define DRM_ARGB64_GETG(c) __DRM_ARGB64_GET(c, 16) | |
| 1620 | +#define DRM_ARGB64_GETB(c) __DRM_ARGB64_GET(c, 0) | |
| 1621 | + | |
| 1622 | +#define DRM_ARGB64_GETA_BPC(c, bpc) __DRM_ARGB64_GET_BPC(c, 48, bpc) | |
| 1623 | +#define DRM_ARGB64_GETR_BPC(c, bpc) __DRM_ARGB64_GET_BPC(c, 32, bpc) | |
| 1624 | +#define DRM_ARGB64_GETG_BPC(c, bpc) __DRM_ARGB64_GET_BPC(c, 16, bpc) | |
| 1625 | +#define DRM_ARGB64_GETB_BPC(c, bpc) __DRM_ARGB64_GET_BPC(c, 0, bpc) | |
| 1626 | + | |
| 1627 | +#define DRM_ARGB64_GETA_BPCS(c, bpc) __DRM_ARGB64_GET_BPCS(c, 48, bpc) | |
| 1628 | +#define DRM_ARGB64_GETR_BPCS(c, bpc) __DRM_ARGB64_GET_BPCS(c, 32, bpc) | |
| 1629 | +#define DRM_ARGB64_GETG_BPCS(c, bpc) __DRM_ARGB64_GET_BPCS(c, 16, bpc) | |
| 1630 | +#define DRM_ARGB64_GETB_BPCS(c, bpc) __DRM_ARGB64_GET_BPCS(c, 0, bpc) | |
| 1631 | + | |
| 1552 | 1632 | #if defined(__cplusplus) |
| 1553 | 1633 | } |
| 1554 | 1634 | #endif |
| @@ -117,6 +117,7 @@ struct drm_msm_timespec { · 116 unmodified lines | ||
| 117 | 117 | * ioctl will throw -EPIPE. |
| 118 | 118 | */ |
| 119 | 119 | #define MSM_PARAM_EN_VM_BIND 0x16 /* WO, once */ |
| 120 | +#define MSM_PARAM_AQE 0x17 /* RO */ | |
| 120 | 121 | |
| 121 | 122 | /* For backwards compat. The original support for preemption was based on |
| 122 | 123 | * a single ring per priority level so # of priority levels equals the # |
| @@ -409,6 +409,38 @@ struct drm_panthor_csif_info { · 408 unmodified lines | ||
| 409 | 409 | __u32 pad; |
| 410 | 410 | }; |
| 411 | 411 | |
| 412 | +/** | |
| 413 | + * enum drm_panthor_timestamp_info_flags - drm_panthor_timestamp_info.flags | |
| 414 | + */ | |
| 415 | +enum drm_panthor_timestamp_info_flags { | |
| 416 | + /** @DRM_PANTHOR_TIMESTAMP_GPU: Query GPU time. */ | |
| 417 | + DRM_PANTHOR_TIMESTAMP_GPU = 1 << 0, | |
| 418 | + | |
| 419 | + /** @DRM_PANTHOR_TIMESTAMP_CPU_NONE: Don't query CPU time. */ | |
| 420 | + DRM_PANTHOR_TIMESTAMP_CPU_NONE = 0 << 1, | |
| 421 | + | |
| 422 | + /** @DRM_PANTHOR_TIMESTAMP_CPU_MONOTONIC: Query CPU time using CLOCK_MONOTONIC. */ | |
| 423 | + DRM_PANTHOR_TIMESTAMP_CPU_MONOTONIC = 1 << 1, | |
| 424 | + | |
| 425 | + /** @DRM_PANTHOR_TIMESTAMP_CPU_MONOTONIC_RAW: Query CPU time using CLOCK_MONOTONIC_RAW. */ | |
| 426 | + DRM_PANTHOR_TIMESTAMP_CPU_MONOTONIC_RAW = 2 << 1, | |
| 427 | + | |
| 428 | + /** @DRM_PANTHOR_TIMESTAMP_CPU_TYPE_MASK: Space reserved for CPU clock type. */ | |
| 429 | + DRM_PANTHOR_TIMESTAMP_CPU_TYPE_MASK = 7 << 1, | |
| 430 | + | |
| 431 | + /** @DRM_PANTHOR_TIMESTAMP_GPU_OFFSET: Query GPU offset. */ | |
| 432 | + DRM_PANTHOR_TIMESTAMP_GPU_OFFSET = 1 << 4, | |
| 433 | + | |
| 434 | + /** @DRM_PANTHOR_TIMESTAMP_GPU_CYCLE_COUNT: Query GPU cycle count. */ | |
| 435 | + DRM_PANTHOR_TIMESTAMP_GPU_CYCLE_COUNT = 1 << 5, | |
| 436 | + | |
| 437 | + /** @DRM_PANTHOR_TIMESTAMP_FREQ: Query timestamp frequency. */ | |
| 438 | + DRM_PANTHOR_TIMESTAMP_FREQ = 1 << 6, | |
| 439 | + | |
| 440 | + /** @DRM_PANTHOR_TIMESTAMP_DURATION: Return duration of time query. */ | |
| 441 | + DRM_PANTHOR_TIMESTAMP_DURATION = 1 << 7, | |
| 442 | +}; | |
| 443 | + | |
| 412 | 444 | /** |
| 413 | 445 | * struct drm_panthor_timestamp_info - Timestamp information |
| 414 | 446 | * |
| @@ -421,11 +453,38 @@ struct drm_panthor_timestamp_info { · 6 unmodified lines | ||
| 421 | 453 | */ |
| 422 | 454 | __u64 timestamp_frequency; |
| 423 | 455 | |
| 424 | − /** @current_timestamp: The current timestamp. */ | |
| 456 | + /** @current_timestamp: The current GPU timestamp. */ | |
| 425 | 457 | __u64 current_timestamp; |
| 426 | 458 | |
| 427 | − /** @timestamp_offset: The offset of the timestamp timer. */ | |
| 459 | + /** @timestamp_offset: The offset of the GPU timestamp timer. */ | |
| 428 | 460 | __u64 timestamp_offset; |
| 461 | + | |
| 462 | + /** | |
| 463 | + * @flags: Bitmask of drm_panthor_timestamp_info_flags. | |
| 464 | + * | |
| 465 | + * If set to 0, then it is interpreted as: | |
| 466 | + * DRM_PANTHOR_TIMESTAMP_GPU | | |
| 467 | + * DRM_PANTHOR_TIMESTAMP_GPU_OFFSET | | |
| 468 | + * DRM_PANTHOR_TIMESTAMP_FREQ | |
| 469 | + * | |
| 470 | + * Note: these flags are exclusive to each other (only one can be used): | |
| 471 | + * - DRM_PANTHOR_TIMESTAMP_CPU_NONE | |
| 472 | + * - DRM_PANTHOR_TIMESTAMP_CPU_MONOTONIC | |
| 473 | + * - DRM_PANTHOR_TIMESTAMP_CPU_MONOTONIC_RAW | |
| 474 | + */ | |
| 475 | + __u32 flags; | |
| 476 | + | |
| 477 | + /** @duration_nsec: Duration of time query. */ | |
| 478 | + __u32 duration_nsec; | |
| 479 | + | |
| 480 | + /** @cycle_count: Value of GPU_CYCLE_COUNT. */ | |
| 481 | + __u64 cycle_count; | |
| 482 | + | |
| 483 | + /** @cpu_timestamp_sec: Seconds part of CPU timestamp. */ | |
| 484 | + __u64 cpu_timestamp_sec; | |
| 485 | + | |
| 486 | + /** @cpu_timestamp_nsec: Nanseconds part of CPU timestamp. */ | |
| 487 | + __u64 cpu_timestamp_nsec; | |
| 429 | 488 | }; |
| 430 | 489 | |
| 431 | 490 | /** |
| @@ -50,4 +50,22 @@ · 49 unmodified lines | ||
| 50 | 50 | |
| 51 | 51 | #define __KERNEL_DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d)) |
| 52 | 52 | |
| 53 | +/* | |
| 54 | + * Divide positive or negative dividend by positive or negative divisor | |
| 55 | + * and round to closest integer. Result is undefined for negative | |
| 56 | + * divisors if the dividend variable type is unsigned and for negative | |
| 57 | + * dividends if the divisor variable type is unsigned. | |
| 58 | + */ | |
| 59 | +#define __KERNEL_DIV_ROUND_CLOSEST(x, divisor) \ | |
| 60 | +({ \ | |
| 61 | + __typeof__(x) __x = x; \ | |
| 62 | + __typeof__(divisor) __d = divisor; \ | |
| 63 | + \ | |
| 64 | + (((__typeof__(x))-1) > 0 || \ | |
| 65 | + ((__typeof__(divisor))-1) > 0 || \ | |
| 66 | + (((__x) > 0) == ((__d) > 0))) ? \ | |
| 67 | + (((__x) + ((__d) / 2)) / (__d)) : \ | |
| 68 | + (((__x) - ((__d) / 2)) / (__d)); \ | |
| 69 | +}) | |
| 70 | + | |
| 53 | 71 | #endif /* _UAPI_LINUX_CONST_H */ |
| @@ -14,6 +14,10 @@ · 13 unmodified lines | ||
| 14 | 14 | #include <linux/ioctl.h> |
| 15 | 15 | #include <asm/kvm.h> |
| 16 | 16 | |
| 17 | +#ifdef __KERNEL__ | |
| 18 | +#include <linux/kvm_types.h> | |
| 19 | +#endif | |
| 20 | + | |
| 17 | 21 | #define KVM_API_VERSION 12 |
| 18 | 22 | |
| 19 | 23 | /* |
| @@ -1601,7 +1605,11 @@ struct kvm_stats_desc { · 1581 unmodified lines | ||
| 1601 | 1605 | __u16 size; |
| 1602 | 1606 | __u32 offset; |
| 1603 | 1607 | __u32 bucket_size; |
| 1608 | +#ifdef __KERNEL__ | |
| 1609 | + char name[KVM_STATS_NAME_SIZE]; | |
| 1610 | +#else | |
| 1604 | 1611 | char name[]; |
| 1612 | +#endif | |
| 1605 | 1613 | }; |
| 1606 | 1614 | |
| 1607 | 1615 | #define KVM_GET_STATS_FD _IO(KVMIO, 0xce) |
| @@ -159,5 +159,9 @@ enum ip_conntrack_expect_events { · 158 unmodified lines | ||
| 159 | 159 | #define NF_CT_EXPECT_INACTIVE 0x2 |
| 160 | 160 | #define NF_CT_EXPECT_USERSPACE 0x4 |
| 161 | 161 | |
| 162 | +#ifdef __KERNEL__ | |
| 163 | +#define NF_CT_EXPECT_MASK (NF_CT_EXPECT_PERMANENT | NF_CT_EXPECT_INACTIVE | \ | |
| 164 | + NF_CT_EXPECT_USERSPACE) | |
| 165 | +#endif | |
| 162 | 166 | |
| 163 | 167 | #endif /* _UAPI_NF_CONNTRACK_COMMON_H */ |