aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/tegra/gr2d.c
diff options
context:
space:
mode:
authorDmitry Osipenko <digetx@gmail.com>2017-06-15 02:18:37 +0300
committerThierry Reding <treding@nvidia.com>2017-06-15 14:23:50 +0200
commit0f563a4bf66e5182f0882efee398f7e6bc0bb1be (patch)
tree3197816e7ddebd5d8360c6aae439d20a956b6a95 /drivers/gpu/drm/tegra/gr2d.c
parentgpu: host1x: Forbid RESTART opcode in the firewall (diff)
downloadlinux-dev-0f563a4bf66e5182f0882efee398f7e6bc0bb1be.tar.xz
linux-dev-0f563a4bf66e5182f0882efee398f7e6bc0bb1be.zip
gpu: host1x: Forbid unrelated SETCLASS opcode in the firewall
Several channels could be made to write the same unit concurrently via the SETCLASS opcode, trusting userspace is a bad idea. It should be possible to drop the per-client channel reservation and add a per-unit locking by inserting MLOCK's to the command stream to re-allow the SETCLASS opcode, but it will be much more work. Let's forbid the unit-unrelated class changes for now. Signed-off-by: Dmitry Osipenko <digetx@gmail.com> Reviewed-by: Erik Faye-Lund <kusmabite@gmail.com> Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com> Signed-off-by: Thierry Reding <treding@nvidia.com>
Diffstat (limited to 'drivers/gpu/drm/tegra/gr2d.c')
-rw-r--r--drivers/gpu/drm/tegra/gr2d.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/gpu/drm/tegra/gr2d.c b/drivers/gpu/drm/tegra/gr2d.c
index 02cd3e37a6ec..fbe0b8b25b42 100644
--- a/drivers/gpu/drm/tegra/gr2d.c
+++ b/drivers/gpu/drm/tegra/gr2d.c
@@ -109,10 +109,17 @@ static int gr2d_is_addr_reg(struct device *dev, u32 class, u32 offset)
return 0;
}
+static int gr2d_is_valid_class(u32 class)
+{
+ return (class == HOST1X_CLASS_GR2D ||
+ class == HOST1X_CLASS_GR2D_SB);
+}
+
static const struct tegra_drm_client_ops gr2d_ops = {
.open_channel = gr2d_open_channel,
.close_channel = gr2d_close_channel,
.is_addr_reg = gr2d_is_addr_reg,
+ .is_valid_class = gr2d_is_valid_class,
.submit = tegra_drm_submit,
};