Skip to content

Commit 142256d

Browse files
committed
tools headers UAPI: Sync drm/i915_drm.h with the kernel sources
81b1b59 ("drm/i915: Allow user to set cache at BO creation") 98d2722 ("drm/i915/huc: differentiate the 2 steps of the MTL HuC auth flow") bc4be0a ("drm/i915/pmu: Prepare for multi-tile non-engine counters") d1da138 ("drm/i915/uapi/pxp: Add a GET_PARAM for PXP") That adds some ioctls but use the __I915_PMU_OTHER() macro, not supported yet in the tools/perf/trace/beauty/drm_ioctl.sh conversion script. This silences this perf build warning: Warning: Kernel ABI header differences: diff -u tools/include/uapi/drm/i915_drm.h include/uapi/drm/i915_drm.h Cc: Adrian Hunter <[email protected]> Cc: Alan Previn <[email protected]> Cc: Andi Shyti <[email protected]> Cc: Daniele Ceraolo Spurio <[email protected]> Cc: Fei Yang <[email protected]> Cc: Ian Rogers <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Radhakrishna Sripada <[email protected]> Cc: Tvrtko Ursulin <[email protected]> Cc: Umesh Nerlige Ramappa <[email protected]> Link: https://lore.kernel.org/lkml/ZK1R%[email protected]/ Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent c66e1c6 commit 142256d

File tree

1 file changed

+93
-2
lines changed

1 file changed

+93
-2
lines changed

tools/include/uapi/drm/i915_drm.h

Lines changed: 93 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)