On Thu, 16 Feb 2023 16:58:44 -0800, Umesh Nerlige Ramappa wrote:
>
> Once OA supports media engine class:instance, the engine can only be
> validated outside the switch since class and instance parameters are
> separate entities. Since OA sseu config depends on engine
> class:instance, validate OA sseu config outside the switch.
>
> v2: (Ashutosh)
> - Clarify commit message
> - Use drm_dbg instead of DRM_DEBUG
> - Reorder stack variables

Reviewed-by: Ashutosh Dixit <ashutosh.di...@intel.com>

>
> Signed-off-by: Umesh Nerlige Ramappa <umesh.nerlige.rama...@intel.com>
> ---
>  drivers/gpu/drm/i915/i915_perf.c | 23 +++++++++++++----------
>  1 file changed, 13 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_perf.c 
> b/drivers/gpu/drm/i915/i915_perf.c
> index b0e1acbe90fc..1229f65534e2 100644
> --- a/drivers/gpu/drm/i915/i915_perf.c
> +++ b/drivers/gpu/drm/i915/i915_perf.c
> @@ -3950,7 +3950,9 @@ static int read_properties_unlocked(struct i915_perf 
> *perf,
>                                   u32 n_props,
>                                   struct perf_open_properties *props)
>  {
> +     struct drm_i915_gem_context_param_sseu user_sseu;
>       u64 __user *uprop = uprops;
> +     bool config_sseu = false;
>       u32 i;
>       int ret;
>
> @@ -4079,8 +4081,6 @@ static int read_properties_unlocked(struct i915_perf 
> *perf,
>                       props->hold_preemption = !!value;
>                       break;
>               case DRM_I915_PERF_PROP_GLOBAL_SSEU: {
> -                     struct drm_i915_gem_context_param_sseu user_sseu;
> -
>                       if (GRAPHICS_VER_FULL(perf->i915) >= IP_VER(12, 50)) {
>                               drm_dbg(&perf->i915->drm,
>                                       "SSEU config not supported on gfx %x\n",
> @@ -4095,14 +4095,7 @@ static int read_properties_unlocked(struct i915_perf 
> *perf,
>                                       "Unable to copy global sseu 
> parameter\n");
>                               return -EFAULT;
>                       }
> -
> -                     ret = get_sseu_config(&props->sseu, props->engine, 
> &user_sseu);
> -                     if (ret) {
> -                             drm_dbg(&perf->i915->drm,
> -                                     "Invalid SSEU configuration\n");
> -                             return ret;
> -                     }
> -                     props->has_sseu = true;
> +                     config_sseu = true;
>                       break;
>               }
>               case DRM_I915_PERF_PROP_POLL_OA_PERIOD:
> @@ -4122,6 +4115,16 @@ static int read_properties_unlocked(struct i915_perf 
> *perf,
>               uprop += 2;
>       }
>
> +     if (config_sseu) {
> +             ret = get_sseu_config(&props->sseu, props->engine, &user_sseu);
> +             if (ret) {
> +                     drm_dbg(&perf->i915->drm,
> +                             "Invalid SSEU configuration\n");
> +                     return ret;
> +             }
> +             props->has_sseu = true;
> +     }
> +
>       return 0;
>  }
>
> --
> 2.36.1
>

Reply via email to