Enables userspace to determine the number of slices & subslices enabled and also know what specific slices & subslices are enabled. This information is required, for example, to be able to analyse some OA counter reports where the counter configuration depends on the HW slice configuration. Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@xxxxxxxxx> --- drivers/gpu/drm/i915/i915_drv.h | 12 ++++++++++++ drivers/gpu/drm/i915/i915_perf.c | 14 ++++++++++++++ include/uapi/drm/i915_drm.h | 15 +++++++++++++++ 3 files changed, 41 insertions(+) diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 10ffbfec3b2e..18e12e61949b 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -2966,6 +2966,18 @@ extern long i915_compat_ioctl(struct file *filp, unsigned int cmd, #endif extern const struct dev_pm_ops i915_pm_ops; +static inline u64 i915_pack_sseu_to_user(struct sseu_dev_info *sseu) +{ + union drm_i915_gem_param_sseu user; + + user.packed.slice_mask = sseu->slice_mask; + user.packed.subslice_mask = sseu->subslice_mask; + user.packed.min_eu_per_subslice = sseu->min_eu_per_subslice; + user.packed.max_eu_per_subslice = sseu->max_eu_per_subslice; + + return user.value; +} + extern int i915_driver_load(struct pci_dev *pdev, const struct pci_device_id *ent); extern void i915_driver_unload(struct drm_device *dev); diff --git a/drivers/gpu/drm/i915/i915_perf.c b/drivers/gpu/drm/i915/i915_perf.c index 5f4eccaa06d6..d20cceef93d0 100644 --- a/drivers/gpu/drm/i915/i915_perf.c +++ b/drivers/gpu/drm/i915/i915_perf.c @@ -1618,6 +1618,18 @@ static void i915_perf_disable_locked(struct i915_perf_stream *stream) stream->ops->disable(stream); } +static int i915_perf_get_sseu_locked(struct i915_perf_stream *stream, + unsigned long arg) +{ + struct drm_i915_private *dev_priv = stream->dev_priv; + u64 sseu = i915_pack_sseu_to_user(&dev_priv->perf.oa.sseu); + + if (copy_to_user((void __user *)arg, &sseu, sizeof(sseu)) != 0) + return -EFAULT; + + return 0; +} + /** * i915_perf_ioctl - support ioctl() usage with i915 perf stream FDs * @stream: An i915 perf stream @@ -1641,6 +1653,8 @@ static long i915_perf_ioctl_locked(struct i915_perf_stream *stream, case I915_PERF_IOCTL_DISABLE: i915_perf_disable_locked(stream); return 0; + case I915_PERF_IOCTL_GET_SSEU: + return i915_perf_get_sseu_locked(stream, arg); } return -EINVAL; diff --git a/include/uapi/drm/i915_drm.h b/include/uapi/drm/i915_drm.h index ba722fb343a4..8871c526205b 100644 --- a/include/uapi/drm/i915_drm.h +++ b/include/uapi/drm/i915_drm.h @@ -350,6 +350,16 @@ typedef struct drm_i915_irq_wait { int irq_seq; } drm_i915_irq_wait_t; +union drm_i915_gem_param_sseu { + struct { + u8 slice_mask; + u8 subslice_mask; + u8 min_eu_per_subslice; + u8 max_eu_per_subslice; + } packed; + __u64 value; +}; + /* Ioctl to query kernel params: */ #define I915_PARAM_IRQ_ACTIVE 1 @@ -1399,6 +1409,11 @@ struct drm_i915_perf_open_param { #define I915_PERF_IOCTL_DISABLE _IO('i', 0x1) /** + * Query sseu configuration for a stream. + */ +#define I915_PERF_IOCTL_GET_SSEU _IOW('i', 0x2, union drm_i915_gem_param_sseu) + +/** * Common to all i915 perf records */ struct drm_i915_perf_record_header { -- 2.11.0 _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/intel-gfx