From patchwork Sun Sep 24 13:15:25 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Gmeiner X-Patchwork-Id: 9967993 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id DAFFA602D8 for ; Sun, 24 Sep 2017 13:16:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CCB1928C23 for ; Sun, 24 Sep 2017 13:16:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C1C2428C26; Sun, 24 Sep 2017 13:16:25 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 7F7F928C23 for ; Sun, 24 Sep 2017 13:16:25 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 35F7D6E1C6; Sun, 24 Sep 2017 13:16:10 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr0-x243.google.com (mail-wr0-x243.google.com [IPv6:2a00:1450:400c:c0c::243]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6AB616E16F; Sun, 24 Sep 2017 13:16:07 +0000 (UTC) Received: by mail-wr0-x243.google.com with SMTP id b9so2999651wra.0; Sun, 24 Sep 2017 06:16:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=DVu5LsK/ZvwILq+8rvkiLxfABeMRmHsnrMQbp2SPmzQ=; b=LTzGLaQdCV48eEUi3SOEolbDlXXsHGIn4XuVPJh3wgAEVeCx1CerC1OsXImoQO7Ubb kEGpE4USvzfT42QSqeOYbvENVOiIsz5Vc4M3DbTyXn3W1fcwCbQ9uQbK6UgkE/WTDjd0 O/DUddeD2VHqYXUle1Dg/l599/yzsZmjnAyT00F3d2PVw20WrbAGiuUzhtFaAR0spZQF moSlwj/RhKJmU2By8AVNpul7aESNfIUXC4D2tP8E74G+mvb/AV8kUnqY1cWHPA5lzoDQ ckA5PYBBPzGceJmsform0FvwAYnJKhWqSXpFQWInM317yAsIplPgcIQwXDX+Y8AWg2va 8ySA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=DVu5LsK/ZvwILq+8rvkiLxfABeMRmHsnrMQbp2SPmzQ=; b=AE/9D3HgmANcpjaxUdKE1dxckjfwo+SeMsqDSaencyYDBVPsNqgtHCVSsfbnb1sz0o IzUmnE6mjwN862fpPUf/oM3W3bdr5E77be4+d66Uz/HXKbL89ty96YeYeGwwAJ1NhK8X dEJrekRFv5MYtWYw0H9HNCJQQjKFP9nWwHmLT7jHseBVG9Jmcl8HtYu8ntWFB7OdMfom 1qEYGlMA8lrHdUv7VRZ9HNQDRsZD2aFj0IJA4r/gG6B2hFwpW7WJl3RYQnFbuX7hT0G5 TAEB/H7+kqfQQ7fczBTnh4T0c6jTkZWoSz+AhUR5fmnrcElWrWW9zg6EinsapvLBrH/g UWTA== X-Gm-Message-State: AHPjjUjbBOr3r08/3paZcK9z9twFStPsaQsK7GWNz6Ai1jkvcGRIwkVx OI8Mn+AzJ3UzmfM91QbhY+pd7w== X-Google-Smtp-Source: AOwi7QBdnkDKP5cMtJQnhkqg4LbtGqfdkoIayRjCR2z11Qt3LjTo0Tlx0JWJefFzSPosfyHAYhf3Qg== X-Received: by 10.223.169.83 with SMTP id u77mr3301527wrc.268.1506258965692; Sun, 24 Sep 2017 06:16:05 -0700 (PDT) Received: from localhost.localdomain (194-166-231-209.adsl.highway.telekom.at. [194.166.231.209]) by smtp.gmail.com with ESMTPSA id z51sm5748304wrz.80.2017.09.24.06.16.03 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 24 Sep 2017 06:16:04 -0700 (PDT) From: Christian Gmeiner To: dri-devel@lists.freedesktop.org Subject: [PATCH V5 07/25] drm/etnaviv: add performance monitor request validation Date: Sun, 24 Sep 2017 15:15:25 +0200 Message-Id: <20170924131543.4066-8-christian.gmeiner@gmail.com> X-Mailer: git-send-email 2.13.5 In-Reply-To: <20170924131543.4066-1-christian.gmeiner@gmail.com> References: <20170924131543.4066-1-christian.gmeiner@gmail.com> Cc: linux+etnaviv@armlinux.org.uk, etnaviv@lists.freedesktop.org, cphealy@gmail.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Check if the selected domain and signal combination exists. Changes from v4 to v5 - add exec_state parameter Signed-off-by: Christian Gmeiner --- drivers/gpu/drm/etnaviv/etnaviv_perfmon.c | 17 +++++++++++++++++ drivers/gpu/drm/etnaviv/etnaviv_perfmon.h | 3 +++ 2 files changed, 20 insertions(+) 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; +} diff --git a/drivers/gpu/drm/etnaviv/etnaviv_perfmon.h b/drivers/gpu/drm/etnaviv/etnaviv_perfmon.h index 4b2b518cfd16..9fcd1fb2e482 100644 --- a/drivers/gpu/drm/etnaviv/etnaviv_perfmon.h +++ b/drivers/gpu/drm/etnaviv/etnaviv_perfmon.h @@ -40,4 +40,7 @@ int etnaviv_pm_query_dom(struct etnaviv_gpu *gpu, int etnaviv_pm_query_sig(struct etnaviv_gpu *gpu, struct drm_etnaviv_pm_signal *signal); +int etnaviv_pm_req_validate(const struct drm_etnaviv_gem_submit_pmr *r, + u32 exec_state); + #endif /* __ETNAVIV_PERFMON_H__ */