Skip to content

Commit

Permalink
drm/i915/uapi: Add query for hwconfig blob
Browse files Browse the repository at this point in the history
In this interface i915 is returning a blob of data which it receives
from the guc software. This blob provides some useful data about the
hardware for drivers. The format of this blob will be documented in
the Programmer Reference Manuals when released.

Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
Cc: Kenneth Graunke <kenneth.w.graunke@intel.com>
Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: Slawomir Milczarek <slawomir.milczarek@intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: John Harrison <John.C.Harrison@Intel.com>
Reviewed-by: Matthew Brost <matthew.brost@intel.com>
Acked-by: Jordan Justen <jordan.l.justen@intel.com>
Tested-by: Jordan Justen <jordan.l.justen@intel.com>
Acked-by: Jon Bloomfield <jon.bloomfield@intel.com>
Signed-off-by: John Harrison <John.C.Harrison@Intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220306232157.1174335-3-jordan.l.justen@intel.com
  • Loading branch information
Rodrigo Vivi authored and John Harrison committed Mar 18, 2022
1 parent 8781f05 commit 78e1fb3
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
23 changes: 23 additions & 0 deletions drivers/gpu/drm/i915/i915_query.c
Original file line number Diff line number Diff line change
Expand Up @@ -479,12 +479,35 @@ static int query_memregion_info(struct drm_i915_private *i915,
return total_length;
}

static int query_hwconfig_blob(struct drm_i915_private *i915,
struct drm_i915_query_item *query_item)
{
struct intel_gt *gt = to_gt(i915);
struct intel_hwconfig *hwconfig = &gt->info.hwconfig;

if (!hwconfig->size || !hwconfig->ptr)
return -ENODEV;

if (query_item->length == 0)
return hwconfig->size;

if (query_item->length < hwconfig->size)
return -EINVAL;

if (copy_to_user(u64_to_user_ptr(query_item->data_ptr),
hwconfig->ptr, hwconfig->size))
return -EFAULT;

return hwconfig->size;
}

static int (* const i915_query_funcs[])(struct drm_i915_private *dev_priv,
struct drm_i915_query_item *query_item) = {
query_topology_info,
query_engine_info,
query_perf_config,
query_memregion_info,
query_hwconfig_blob,
};

int i915_query_ioctl(struct drm_device *dev, void *data, struct drm_file *file)
Expand Down
1 change: 1 addition & 0 deletions include/uapi/drm/i915_drm.h
Original file line number Diff line number Diff line change
Expand Up @@ -2691,6 +2691,7 @@ struct drm_i915_query_item {
#define DRM_I915_QUERY_ENGINE_INFO 2
#define DRM_I915_QUERY_PERF_CONFIG 3
#define DRM_I915_QUERY_MEMORY_REGIONS 4
#define DRM_I915_QUERY_HWCONFIG_BLOB 5
/* Must be kept compact -- no holes and well documented */

/**
Expand Down

0 comments on commit 78e1fb3

Please sign in to comment.