History

Merge drm/drm-next into drm-xe-next

Sync drm-xe-next with drm-next to unblock some topic branches.

Rodrigo Vivi committed 7 months ago

Commit af35e742 parents 5150b57 45164322283 files · +50956 −20795Browse files

Showing the changes to include/uapi (7 of 2283 files). Show all

Unified · Split

7 files
  1. include/uapi/drm/amdxdna_accel.h +40 −4
  2. include/uapi/drm/drm_mode.h +80 −0
  3. include/uapi/drm/msm_drm.h +1 −0
  4. include/uapi/drm/panthor_drm.h +61 −2
  5. include/uapi/linux/const.h +18 −0
  6. include/uapi/linux/kvm.h +8 −0
  7. include/uapi/linux/netfilter/nf_conntrack_common.h +4 −0
include/uapi/drm/amdxdna_accel.h+40−4
@@ -156,10 +156,11 @@ struct amdxdna_drm_config_hwctx { · 155 unmodified lines
156156
157157 enum amdxdna_bo_type {
158158 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,
163164 };
164165
165166 /**
@@ -590,8 +591,37 @@ struct amdxdna_async_error { · 424 unmodified lines
590591 __u64 ex_err_code;
591592 };
592593
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+ */
593622 #define DRM_AMDXDNA_HW_CONTEXT_ALL 0
594623 #define DRM_AMDXDNA_HW_LAST_ASYNC_ERR 2
624+#define DRM_AMDXDNA_BO_USAGE 6
595625
596626 /**
597627 * struct amdxdna_drm_get_array - Get information array.
@@ -604,6 +634,12 @@ struct amdxdna_drm_get_array { · 6 unmodified lines
604634 *
605635 * %DRM_AMDXDNA_HW_CONTEXT_ALL:
606636 * 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.
607643 */
608644 __u32 param;
609645 /**
include/uapi/drm/drm_mode.h+80−0
@@ -27,6 +27,9 @@ · 26 unmodified lines
2727 #ifndef _DRM_MODE_H
2828 #define _DRM_MODE_H
2929
30+#include <linux/bits.h>
31+#include <linux/const.h>
32+
3033 #include "drm.h"
3134
3235 #if defined(__cplusplus)
@@ -1549,6 +1552,83 @@ struct drm_mode_closefb { · 1516 unmodified lines
15491552 __u32 pad;
15501553 };
15511554
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+
15521632 #if defined(__cplusplus)
15531633 }
15541634 #endif
include/uapi/drm/msm_drm.h+1−0
@@ -117,6 +117,7 @@ struct drm_msm_timespec { · 116 unmodified lines
117117 * ioctl will throw -EPIPE.
118118 */
119119 #define MSM_PARAM_EN_VM_BIND 0x16 /* WO, once */
120+#define MSM_PARAM_AQE 0x17 /* RO */
120121
121122 /* For backwards compat. The original support for preemption was based on
122123 * a single ring per priority level so # of priority levels equals the #
include/uapi/drm/panthor_drm.h+61−2
@@ -409,6 +409,38 @@ struct drm_panthor_csif_info { · 408 unmodified lines
409409 __u32 pad;
410410 };
411411
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+
412444 /**
413445 * struct drm_panthor_timestamp_info - Timestamp information
414446 *
@@ -421,11 +453,38 @@ struct drm_panthor_timestamp_info { · 6 unmodified lines
421453 */
422454 __u64 timestamp_frequency;
423455
424− /** @current_timestamp: The current timestamp. */
456+ /** @current_timestamp: The current GPU timestamp. */
425457 __u64 current_timestamp;
426458
427− /** @timestamp_offset: The offset of the timestamp timer. */
459+ /** @timestamp_offset: The offset of the GPU timestamp timer. */
428460 __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;
429488 };
430489
431490 /**
include/uapi/linux/const.h+18−0
@@ -50,4 +50,22 @@ · 49 unmodified lines
5050
5151 #define __KERNEL_DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d))
5252
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+
5371 #endif /* _UAPI_LINUX_CONST_H */
include/uapi/linux/kvm.h+8−0
@@ -14,6 +14,10 @@ · 13 unmodified lines
1414 #include <linux/ioctl.h>
1515 #include <asm/kvm.h>
1616
17+#ifdef __KERNEL__
18+#include <linux/kvm_types.h>
19+#endif
20+
1721 #define KVM_API_VERSION 12
1822
1923 /*
@@ -1601,7 +1605,11 @@ struct kvm_stats_desc { · 1581 unmodified lines
16011605 __u16 size;
16021606 __u32 offset;
16031607 __u32 bucket_size;
1608+#ifdef __KERNEL__
1609+ char name[KVM_STATS_NAME_SIZE];
1610+#else
16041611 char name[];
1612+#endif
16051613 };
16061614
16071615 #define KVM_GET_STATS_FD _IO(KVMIO, 0xce)
include/uapi/linux/netfilter/nf_conntrack_common.h+4−0
@@ -159,5 +159,9 @@ enum ip_conntrack_expect_events { · 158 unmodified lines
159159 #define NF_CT_EXPECT_INACTIVE 0x2
160160 #define NF_CT_EXPECT_USERSPACE 0x4
161161
162+#ifdef __KERNEL__
163+#define NF_CT_EXPECT_MASK (NF_CT_EXPECT_PERMANENT | NF_CT_EXPECT_INACTIVE | \
164+ NF_CT_EXPECT_USERSPACE)
165+#endif
162166
163167 #endif /* _UAPI_NF_CONNTRACK_COMMON_H */