@@ -280,7 +280,16 @@ enum drm_i915_pmu_engine_sample {
280280#define I915_PMU_ENGINE_SEMA (class , instance ) \
281281 __I915_PMU_ENGINE(class, instance, I915_SAMPLE_SEMA)
282282
283- #define __I915_PMU_OTHER (x ) (__I915_PMU_ENGINE(0xff, 0xff, 0xf) + 1 + (x))
283+ /*
284+ * Top 4 bits of every non-engine counter are GT id.
285+ */
286+ #define __I915_PMU_GT_SHIFT (60)
287+
288+ #define ___I915_PMU_OTHER (gt , x ) \
289+ (((__u64)__I915_PMU_ENGINE(0xff, 0xff, 0xf) + 1 + (x)) | \
290+ ((__u64)(gt) << __I915_PMU_GT_SHIFT))
291+
292+ #define __I915_PMU_OTHER (x ) ___I915_PMU_OTHER(0, x)
284293
285294#define I915_PMU_ACTUAL_FREQUENCY __I915_PMU_OTHER(0)
286295#define I915_PMU_REQUESTED_FREQUENCY __I915_PMU_OTHER(1)
@@ -290,6 +299,12 @@ enum drm_i915_pmu_engine_sample {
290299
291300#define I915_PMU_LAST /* Deprecated - do not use */ I915_PMU_RC6_RESIDENCY
292301
302+ #define __I915_PMU_ACTUAL_FREQUENCY (gt ) ___I915_PMU_OTHER(gt, 0)
303+ #define __I915_PMU_REQUESTED_FREQUENCY (gt ) ___I915_PMU_OTHER(gt, 1)
304+ #define __I915_PMU_INTERRUPTS (gt ) ___I915_PMU_OTHER(gt, 2)
305+ #define __I915_PMU_RC6_RESIDENCY (gt ) ___I915_PMU_OTHER(gt, 3)
306+ #define __I915_PMU_SOFTWARE_GT_AWAKE_TIME (gt ) ___I915_PMU_OTHER(gt, 4)
307+
293308/* Each region is a minimum of 16k, and there are at most 255 of them.
294309 */
295310#define I915_NR_TEX_REGIONS 255 /* table size 2k - maximum due to use
@@ -659,7 +674,8 @@ typedef struct drm_i915_irq_wait {
659674 * If the IOCTL is successful, the returned parameter will be set to one of the
660675 * following values:
661676 * * 0 if HuC firmware load is not complete,
662- * * 1 if HuC firmware is authenticated and running.
677+ * * 1 if HuC firmware is loaded and fully authenticated,
678+ * * 2 if HuC firmware is loaded and authenticated for clear media only
663679 */
664680#define I915_PARAM_HUC_STATUS 42
665681
@@ -771,6 +787,25 @@ typedef struct drm_i915_irq_wait {
771787 */
772788#define I915_PARAM_OA_TIMESTAMP_FREQUENCY 57
773789
790+ /*
791+ * Query the status of PXP support in i915.
792+ *
793+ * The query can fail in the following scenarios with the listed error codes:
794+ * -ENODEV = PXP support is not available on the GPU device or in the
795+ * kernel due to missing component drivers or kernel configs.
796+ *
797+ * If the IOCTL is successful, the returned parameter will be set to one of
798+ * the following values:
799+ * 1 = PXP feature is supported and is ready for use.
800+ * 2 = PXP feature is supported but should be ready soon (pending
801+ * initialization of non-i915 system dependencies).
802+ *
803+ * NOTE: When param is supported (positive return values), user space should
804+ * still refer to the GEM PXP context-creation UAPI header specs to be
805+ * aware of possible failure due to system state machine at the time.
806+ */
807+ #define I915_PARAM_PXP_STATUS 58
808+
774809/* Must be kept compact -- no holes and well documented */
775810
776811/**
@@ -2096,6 +2131,21 @@ struct drm_i915_gem_context_param {
20962131 *
20972132 * -ENODEV: feature not available
20982133 * -EPERM: trying to mark a recoverable or not bannable context as protected
2134+ * -ENXIO: A dependency such as a component driver or firmware is not yet
2135+ * loaded so user space may need to attempt again. Depending on the
2136+ * device, this error may be reported if protected context creation is
2137+ * attempted very early after kernel start because the internal timeout
2138+ * waiting for such dependencies is not guaranteed to be larger than
2139+ * required (numbers differ depending on system and kernel config):
2140+ * - ADL/RPL: dependencies may take up to 3 seconds from kernel start
2141+ * while context creation internal timeout is 250 milisecs
2142+ * - MTL: dependencies may take up to 8 seconds from kernel start
2143+ * while context creation internal timeout is 250 milisecs
2144+ * NOTE: such dependencies happen once, so a subsequent call to create a
2145+ * protected context after a prior successful call will not experience
2146+ * such timeouts and will not return -ENXIO (unless the driver is reloaded,
2147+ * or, depending on the device, resumes from a suspended state).
2148+ * -EIO: The firmware did not succeed in creating the protected context.
20992149 */
21002150#define I915_CONTEXT_PARAM_PROTECTED_CONTENT 0xd
21012151/* Must be kept compact -- no holes and well documented */
@@ -3630,9 +3680,13 @@ struct drm_i915_gem_create_ext {
36303680 *
36313681 * For I915_GEM_CREATE_EXT_PROTECTED_CONTENT usage see
36323682 * struct drm_i915_gem_create_ext_protected_content.
3683+ *
3684+ * For I915_GEM_CREATE_EXT_SET_PAT usage see
3685+ * struct drm_i915_gem_create_ext_set_pat.
36333686 */
36343687#define I915_GEM_CREATE_EXT_MEMORY_REGIONS 0
36353688#define I915_GEM_CREATE_EXT_PROTECTED_CONTENT 1
3689+ #define I915_GEM_CREATE_EXT_SET_PAT 2
36363690 __u64 extensions ;
36373691};
36383692
@@ -3747,6 +3801,43 @@ struct drm_i915_gem_create_ext_protected_content {
37473801 __u32 flags ;
37483802};
37493803
3804+ /**
3805+ * struct drm_i915_gem_create_ext_set_pat - The
3806+ * I915_GEM_CREATE_EXT_SET_PAT extension.
3807+ *
3808+ * If this extension is provided, the specified caching policy (PAT index) is
3809+ * applied to the buffer object.
3810+ *
3811+ * Below is an example on how to create an object with specific caching policy:
3812+ *
3813+ * .. code-block:: C
3814+ *
3815+ * struct drm_i915_gem_create_ext_set_pat set_pat_ext = {
3816+ * .base = { .name = I915_GEM_CREATE_EXT_SET_PAT },
3817+ * .pat_index = 0,
3818+ * };
3819+ * struct drm_i915_gem_create_ext create_ext = {
3820+ * .size = PAGE_SIZE,
3821+ * .extensions = (uintptr_t)&set_pat_ext,
3822+ * };
3823+ *
3824+ * int err = ioctl(fd, DRM_IOCTL_I915_GEM_CREATE_EXT, &create_ext);
3825+ * if (err) ...
3826+ */
3827+ struct drm_i915_gem_create_ext_set_pat {
3828+ /** @base: Extension link. See struct i915_user_extension. */
3829+ struct i915_user_extension base ;
3830+ /**
3831+ * @pat_index: PAT index to be set
3832+ * PAT index is a bit field in Page Table Entry to control caching
3833+ * behaviors for GPU accesses. The definition of PAT index is
3834+ * platform dependent and can be found in hardware specifications,
3835+ */
3836+ __u32 pat_index ;
3837+ /** @rsvd: reserved for future use */
3838+ __u32 rsvd ;
3839+ };
3840+
37503841/* ID of the protected content session managed by i915 when PXP is active */
37513842#define I915_PROTECTED_CONTENT_DEFAULT_SESSION 0xf
37523843
0 commit comments