[Intel-gfx] [PATCH 6/6] drm/i915/perf: Map OA buffer to user space for gen12 performance query

Chris Wilson chris at chris-wilson.co.uk
Thu Jul 30 09:08:17 UTC 2020


Quoting Umesh Nerlige Ramappa (2020-07-30 01:48:26)
>  #if IS_ENABLED(CONFIG_DRM_I915_SELFTEST)
> diff --git a/include/uapi/drm/i915_drm.h b/include/uapi/drm/i915_drm.h
> index 00546062e023..36f6b9799ecd 100644
> --- a/include/uapi/drm/i915_drm.h
> +++ b/include/uapi/drm/i915_drm.h
> @@ -2048,6 +2048,22 @@ struct drm_i915_perf_open_param {
>   */
>  #define I915_PERF_IOCTL_CONFIG _IO('i', 0x2)
>  
> +/**
> + * Returns OA buffer properties to be used with mmap.
> + *
> + * This ioctl is available in perf revision 8.
> + */
> +#define I915_PERF_IOCTL_GET_OA_BUFFER_INFO _IO('i', 0x3)

This should be _IORW iirc.

> +
> +/**
> + * OA buffer size and offset.
> + */
> +struct drm_i915_perf_oa_buffer_info {
> +       __u32 size;
> +       __u32 offset;
> +       __u64 reserved[4];

5xu64? Might as well just trim it to 4xu64. Unless you have a reason for
a large reserved, we can always extend the struct later (or replace it
with a new ioctl).

However, I would suggest {
	u32 type;  /* in */
	u32 flags; /* in */
	u64 size;   /* out */
	u64 offset; /* out */
	u64 rsvd; /* mbz */
};

Oh, and don't forget to check all unused members are 0.
-Chris


More information about the Intel-gfx mailing list