Re: [PATCH 5/9] drm/i915: Add function to set subslices

Chris Wilson
2019-08-20T10:51:42Z

Quoting Stuart Summers (2019-08-19 22:49:59)
> Add a new function to set a range of subslices for a
> specified slice based on a given mask.
>
> v2: Use local variable for subslice_mask on HSW and
> clean up a few other subslice_mask local variable
> changes
>
> Signed-off-by: Stuart Summers <stuart.summers@intel.com>
> ---
> drivers/gpu/drm/i915/gt/intel_sseu.c | 10 ++++
> drivers/gpu/drm/i915/gt/intel_sseu.h | 3 ++
> drivers/gpu/drm/i915/intel_device_info.c | 59 +++++++++++++-----------
> 3 files changed, 46 insertions(+), 26 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/gt/intel_sseu.c b/drivers/gpu/drm/i915/gt/intel_sseu.c
> index 3a5c0f7b5a08..f5ee43a034bd 100644
> --- a/drivers/gpu/drm/i915/gt/intel_sseu.c
> +++ b/drivers/gpu/drm/i915/gt/intel_sseu.c
> @@ -30,6 +30,16 @@ intel_sseu_subslice_total(const struct sseu_dev_info *sseu)
> return total;
> }
>
> +void intel_sseu_set_subslices(struct sseu_dev_info *sseu, int slice,
> + u32 ss_mask)
> +{
> + int i, offset = slice * sseu->ss_stride;
> +

Some sort of
GEM_BUG_ON(sseu->ss_stride > 32);
to detect UB ?

> + for (i = 0; i < sseu->ss_stride; i++)
> + sseu->subslice_mask[offset + i] =
> + (ss_mask >> (BITS_PER_BYTE * i)) & 0xff;

This is a non-trivial transformation :|
-Chris