Commit 9919d119 authored by Umesh Nerlige Ramappa's avatar Umesh Nerlige Ramappa

drm/i915/perf: Validate OA sseu config outside switch

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
Signed-off-by: default avatarUmesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
Reviewed-by: default avatarAshutosh Dixit <ashutosh.dixit@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230323225901.3743681-4-umesh.nerlige.ramappa@intel.com
parent 37350409
...@@ -3940,7 +3940,9 @@ static int read_properties_unlocked(struct i915_perf *perf, ...@@ -3940,7 +3940,9 @@ static int read_properties_unlocked(struct i915_perf *perf,
u32 n_props, u32 n_props,
struct perf_open_properties *props) struct perf_open_properties *props)
{ {
struct drm_i915_gem_context_param_sseu user_sseu;
u64 __user *uprop = uprops; u64 __user *uprop = uprops;
bool config_sseu = false;
u32 i; u32 i;
int ret; int ret;
...@@ -4069,8 +4071,6 @@ static int read_properties_unlocked(struct i915_perf *perf, ...@@ -4069,8 +4071,6 @@ static int read_properties_unlocked(struct i915_perf *perf,
props->hold_preemption = !!value; props->hold_preemption = !!value;
break; break;
case DRM_I915_PERF_PROP_GLOBAL_SSEU: { 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)) { if (GRAPHICS_VER_FULL(perf->i915) >= IP_VER(12, 50)) {
drm_dbg(&perf->i915->drm, drm_dbg(&perf->i915->drm,
"SSEU config not supported on gfx %x\n", "SSEU config not supported on gfx %x\n",
...@@ -4085,14 +4085,7 @@ static int read_properties_unlocked(struct i915_perf *perf, ...@@ -4085,14 +4085,7 @@ static int read_properties_unlocked(struct i915_perf *perf,
"Unable to copy global sseu parameter\n"); "Unable to copy global sseu parameter\n");
return -EFAULT; return -EFAULT;
} }
config_sseu = true;
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;
break; break;
} }
case DRM_I915_PERF_PROP_POLL_OA_PERIOD: case DRM_I915_PERF_PROP_POLL_OA_PERIOD:
...@@ -4112,6 +4105,16 @@ static int read_properties_unlocked(struct i915_perf *perf, ...@@ -4112,6 +4105,16 @@ static int read_properties_unlocked(struct i915_perf *perf,
uprop += 2; 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; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment