diff options
author | Christian Gmeiner <christian.gmeiner@gmail.com> | 2017-09-24 16:15:25 +0300 |
---|---|---|
committer | Lucas Stach <l.stach@pengutronix.de> | 2017-10-10 12:45:43 +0300 |
commit | 46df52cd4395b62d05b9ac99a7f320f577b5cff5 (patch) | |
tree | dadd3910de13da7f5cd7f58e28c42e9fe8b88f82 /drivers/gpu/drm/etnaviv/etnaviv_perfmon.c | |
parent | 4fc3e66adb291cc3ec4a360c75221e9fbf416938 (diff) | |
download | linux-46df52cd4395b62d05b9ac99a7f320f577b5cff5.tar.xz |
drm/etnaviv: add performance monitor request validation
Check if the selected domain and signal combination exists.
Changes from v4 to v5
- add exec_state parameter
Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Diffstat (limited to 'drivers/gpu/drm/etnaviv/etnaviv_perfmon.c')
-rw-r--r-- | drivers/gpu/drm/etnaviv/etnaviv_perfmon.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/gpu/drm/etnaviv/etnaviv_perfmon.c b/drivers/gpu/drm/etnaviv/etnaviv_perfmon.c index 08ef01c2a0ef..09fbd33764e8 100644 --- a/drivers/gpu/drm/etnaviv/etnaviv_perfmon.c +++ b/drivers/gpu/drm/etnaviv/etnaviv_perfmon.c @@ -111,3 +111,20 @@ int etnaviv_pm_query_sig(struct etnaviv_gpu *gpu, return 0; } + +int etnaviv_pm_req_validate(const struct drm_etnaviv_gem_submit_pmr *r, + u32 exec_state) +{ + const struct etnaviv_pm_domain_meta *meta = &doms_meta[exec_state]; + const struct etnaviv_pm_domain *dom; + + if (r->domain >= meta->nr_domains) + return -EINVAL; + + dom = meta->domains + r->domain; + + if (r->signal > dom->nr_signals) + return -EINVAL; + + return 0; +} |