diff options
author | Terje Bergstrom <tbergstrom@nvidia.com> | 2014-10-15 03:27:52 -0400 |
---|---|---|
committer | Dan Willemsen <dwillemsen@nvidia.com> | 2015-03-18 15:11:50 -0400 |
commit | 3446d89539253f88353672792c0e198b6220487e (patch) | |
tree | 73f558758e1d9bb0ce0e3b2e9b2a756f5c8414c4 /drivers/gpu/nvgpu/gk20a/ctrl_gk20a.c | |
parent | 3f3844a11ccac7957fdb7139a1c9c2a767d315a5 (diff) |
gpu: nvgpu: Add ioctl to create new TSG
Add ioctl to nvhost-ctrl to create a new TSG.
Bug 200042993
Change-Id: Icdd0edb1d9e374740ace6da9eb3a10c57c62617a
Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/ctrl_gk20a.c')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/ctrl_gk20a.c | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/ctrl_gk20a.c b/drivers/gpu/nvgpu/gk20a/ctrl_gk20a.c index fbc93fc3..93831844 100644 --- a/drivers/gpu/nvgpu/gk20a/ctrl_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/ctrl_gk20a.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/cdev.h> | 18 | #include <linux/cdev.h> |
19 | #include <linux/file.h> | 19 | #include <linux/file.h> |
20 | #include <linux/anon_inodes.h> | 20 | #include <linux/anon_inodes.h> |
21 | #include <linux/nvgpu.h> | ||
21 | #include <uapi/linux/nvgpu.h> | 22 | #include <uapi/linux/nvgpu.h> |
22 | 23 | ||
23 | #include "gk20a.h" | 24 | #include "gk20a.h" |
@@ -181,6 +182,45 @@ clean_up: | |||
181 | return err; | 182 | return err; |
182 | } | 183 | } |
183 | 184 | ||
185 | static int gk20a_ctrl_open_tsg(struct gk20a *g, | ||
186 | struct nvgpu_gpu_open_tsg_args *args) | ||
187 | { | ||
188 | struct platform_device *dev = g->dev; | ||
189 | int err; | ||
190 | int fd; | ||
191 | struct file *file; | ||
192 | char *name; | ||
193 | |||
194 | err = get_unused_fd_flags(O_RDWR); | ||
195 | if (err < 0) | ||
196 | return err; | ||
197 | fd = err; | ||
198 | |||
199 | name = kasprintf(GFP_KERNEL, "nvgpu-%s-tsg%d", | ||
200 | dev_name(&dev->dev), fd); | ||
201 | |||
202 | file = anon_inode_getfile(name, g->tsg.cdev.ops, NULL, O_RDWR); | ||
203 | kfree(name); | ||
204 | if (IS_ERR(file)) { | ||
205 | err = PTR_ERR(file); | ||
206 | goto clean_up; | ||
207 | } | ||
208 | fd_install(fd, file); | ||
209 | |||
210 | err = gk20a_tsg_open(g, file); | ||
211 | if (err) | ||
212 | goto clean_up_file; | ||
213 | |||
214 | args->tsg_fd = fd; | ||
215 | return 0; | ||
216 | |||
217 | clean_up_file: | ||
218 | fput(file); | ||
219 | clean_up: | ||
220 | put_unused_fd(fd); | ||
221 | return err; | ||
222 | } | ||
223 | |||
184 | long gk20a_ctrl_dev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | 224 | long gk20a_ctrl_dev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) |
185 | { | 225 | { |
186 | struct platform_device *dev = filp->private_data; | 226 | struct platform_device *dev = filp->private_data; |
@@ -346,6 +386,10 @@ long gk20a_ctrl_dev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg | |||
346 | err = gk20a_ctrl_alloc_as(g, | 386 | err = gk20a_ctrl_alloc_as(g, |
347 | (struct nvgpu_alloc_as_args *)buf); | 387 | (struct nvgpu_alloc_as_args *)buf); |
348 | break; | 388 | break; |
389 | case NVGPU_GPU_IOCTL_OPEN_TSG: | ||
390 | err = gk20a_ctrl_open_tsg(g, | ||
391 | (struct nvgpu_gpu_open_tsg_args *)buf); | ||
392 | break; | ||
349 | default: | 393 | default: |
350 | dev_dbg(dev_from_gk20a(g), "unrecognized gpu ioctl cmd: 0x%x", cmd); | 394 | dev_dbg(dev_from_gk20a(g), "unrecognized gpu ioctl cmd: 0x%x", cmd); |
351 | err = -ENOTTY; | 395 | err = -ENOTTY; |