[Intel-gfx] [PATCH] drm/i915: Include reminders about leaving no holes in uAPI enums

Joonas Lahtinen joonas.lahtinen at linux.intel.com
Tue Feb 19 09:40:56 UTC 2019


Quoting Chris Wilson (2019-02-18 11:46:28)
> We don't want to pre-reserve any holes in our uAPI for that is a sign of
> nefarious and hidden activity. Add a reminder about our uAPI
> expectations to encourage good practice when adding new defines/enums.
> 
> Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> Cc: Joonas Lahtinen <joonas.lahtinen at linux.intel.com>
> Cc: Jani Nikula <jani.nikula at intel.com>

Yeah, makes sense as I've had to bring this up on multiple
occasions.

Reviewed-by: Joonas Lahtinen <joonas.lahtinen at linux.intel.com>

Regards, Joonas

> ---
>  include/uapi/drm/i915_drm.h | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/include/uapi/drm/i915_drm.h b/include/uapi/drm/i915_drm.h
> index 397810fa2d33..2d20004d5a40 100644
> --- a/include/uapi/drm/i915_drm.h
> +++ b/include/uapi/drm/i915_drm.h
> @@ -99,6 +99,8 @@ enum drm_i915_gem_engine_class {
>         I915_ENGINE_CLASS_VIDEO         = 2,
>         I915_ENGINE_CLASS_VIDEO_ENHANCE = 3,
>  
> +       /* should be kept compact */
> +
>         I915_ENGINE_CLASS_INVALID       = -1
>  };
>  
> @@ -319,6 +321,7 @@ typedef struct _drm_i915_sarea {
>  #define DRM_I915_PERF_ADD_CONFIG       0x37
>  #define DRM_I915_PERF_REMOVE_CONFIG    0x38
>  #define DRM_I915_QUERY                 0x39
> +/* Must be kept compact -- no holes */
>  
>  #define DRM_IOCTL_I915_INIT            DRM_IOW( DRM_COMMAND_BASE + DRM_I915_INIT, drm_i915_init_t)
>  #define DRM_IOCTL_I915_FLUSH           DRM_IO ( DRM_COMMAND_BASE + DRM_I915_FLUSH)
> @@ -559,6 +562,8 @@ typedef struct drm_i915_irq_wait {
>   */
>  #define I915_PARAM_MMAP_GTT_COHERENT   52
>  
> +/* Must be kept compact -- no holes and well documented */
> +
>  typedef struct drm_i915_getparam {
>         __s32 param;
>         /*
> @@ -574,6 +579,7 @@ typedef struct drm_i915_getparam {
>  #define I915_SETPARAM_TEX_LRU_LOG_GRANULARITY             2
>  #define I915_SETPARAM_ALLOW_BATCHBUFFER                   3
>  #define I915_SETPARAM_NUM_USED_FENCES                     4
> +/* Must be kept compact -- no holes */
>  
>  typedef struct drm_i915_setparam {
>         int param;
> @@ -1491,6 +1497,7 @@ struct drm_i915_gem_context_param {
>          * drm_i915_gem_context_param_sseu.
>          */
>  #define I915_CONTEXT_PARAM_SSEU                0x7
> +/* Must be kept compact -- no holes and well documented */
>         __u64 value;
>  };
>  
> @@ -1714,6 +1721,7 @@ struct drm_i915_perf_oa_config {
>  struct drm_i915_query_item {
>         __u64 query_id;
>  #define DRM_I915_QUERY_TOPOLOGY_INFO    1
> +/* Must be kept compact -- no holes and well documented */
>  
>         /*
>          * When set to zero by userspace, this is filled with the size of the
> -- 
> 2.20.1
> 


More information about the Intel-gfx mailing list