diff options
| author | Shridhar Rasal <srasal@nvidia.com> | 2016-07-25 05:28:10 -0400 |
|---|---|---|
| committer | Shridhar Rasal <srasal@nvidia.com> | 2016-08-11 01:53:20 -0400 |
| commit | 99b319a13e559bc8eec488ec35cb50ed23d0e68b (patch) | |
| tree | 98955f597289c87996771a94dd153a26ceff917e | |
| parent | e2c3f43e9c8a77d01b1321a22dbb7be8acc7c292 (diff) | |
video: tegra: host: dla: add submit IOCTL
- add initial task submit stub
Jira DLA-19
Change-Id: Iea249cfd14cf186b984d1f296373740f80429c3d
Signed-off-by: Shridhar Rasal <srasal@nvidia.com>
Reviewed-on: http://git-master/r/1191493
| -rw-r--r-- | drivers/video/tegra/host/nvdla/nvdla_ioctl.c | 37 | ||||
| -rw-r--r-- | include/linux/nvhost_nvdla_ioctl.h | 62 |
2 files changed, 97 insertions, 2 deletions
diff --git a/drivers/video/tegra/host/nvdla/nvdla_ioctl.c b/drivers/video/tegra/host/nvdla/nvdla_ioctl.c index 64f0377d2..fcf35b1a0 100644 --- a/drivers/video/tegra/host/nvdla/nvdla_ioctl.c +++ b/drivers/video/tegra/host/nvdla/nvdla_ioctl.c | |||
| @@ -152,6 +152,40 @@ fail_to_alloc: | |||
| 152 | return err; | 152 | return err; |
| 153 | } | 153 | } |
| 154 | 154 | ||
| 155 | static int nvdla_ctrl_submit(struct nvdla_private *priv, void *arg) | ||
| 156 | { | ||
| 157 | struct nvdla_ctrl_submit_args *args = | ||
| 158 | (struct nvdla_ctrl_submit_args *)arg; | ||
| 159 | struct nvdla_ctrl_ioctl_submit_task __user *user_tasks = | ||
| 160 | (struct nvdla_ctrl_ioctl_submit_task __user *) | ||
| 161 | (uintptr_t)args->tasks; | ||
| 162 | struct nvdla_ctrl_ioctl_submit_task *local_tasks; | ||
| 163 | struct nvhost_queue *queue = priv->queue; | ||
| 164 | u32 num_tasks = args->num_tasks; | ||
| 165 | int err = 0, i = 0; | ||
| 166 | |||
| 167 | if (num_tasks > MAX_TASKS_PER_SUBMIT) | ||
| 168 | return -EINVAL; | ||
| 169 | |||
| 170 | local_tasks = kcalloc(num_tasks, sizeof(*local_tasks), | ||
| 171 | GFP_KERNEL); | ||
| 172 | if (!local_tasks) | ||
| 173 | return -ENOMEM; | ||
| 174 | |||
| 175 | if (copy_from_user(local_tasks, user_tasks, | ||
| 176 | (num_tasks * sizeof(*user_tasks)))) { | ||
| 177 | err = -EFAULT; | ||
| 178 | goto fail_to_copy_task; | ||
| 179 | } | ||
| 180 | |||
| 181 | for (i = 0; i < num_tasks; i++) | ||
| 182 | nvhost_queue_submit(queue, &local_tasks[i]); | ||
| 183 | |||
| 184 | fail_to_copy_task: | ||
| 185 | return err; | ||
| 186 | } | ||
| 187 | |||
| 188 | |||
| 155 | static long nvdla_ioctl(struct file *file, unsigned int cmd, | 189 | static long nvdla_ioctl(struct file *file, unsigned int cmd, |
| 156 | unsigned long arg) | 190 | unsigned long arg) |
| 157 | { | 191 | { |
| @@ -186,6 +220,9 @@ static long nvdla_ioctl(struct file *file, unsigned int cmd, | |||
| 186 | case NVDLA_IOCTL_CTRL_UNPIN: | 220 | case NVDLA_IOCTL_CTRL_UNPIN: |
| 187 | err = nvdla_ctrl_unpin(priv, (void *)buf); | 221 | err = nvdla_ctrl_unpin(priv, (void *)buf); |
| 188 | break; | 222 | break; |
| 223 | case NVDLA_IOCTL_CTRL_SUBMIT: | ||
| 224 | err = nvdla_ctrl_submit(priv, (void *)buf); | ||
| 225 | break; | ||
| 189 | default: | 226 | default: |
| 190 | err = -ENOIOCTLCMD; | 227 | err = -ENOIOCTLCMD; |
| 191 | break; | 228 | break; |
diff --git a/include/linux/nvhost_nvdla_ioctl.h b/include/linux/nvhost_nvdla_ioctl.h index b5b6c676b..06f4f1011 100644 --- a/include/linux/nvhost_nvdla_ioctl.h +++ b/include/linux/nvhost_nvdla_ioctl.h | |||
| @@ -39,6 +39,63 @@ struct nvdla_ctrl_pin_unpin_args { | |||
| 39 | __u32 reserved; | 39 | __u32 reserved; |
| 40 | }; | 40 | }; |
| 41 | 41 | ||
| 42 | struct nvdla_ctrl_submit_args { | ||
| 43 | __u64 tasks; | ||
| 44 | __u16 num_tasks; | ||
| 45 | #define MAX_TASKS_PER_SUBMIT 32 | ||
| 46 | #define NVDLA_SUBMIT_FLAGS_ATOMIC (1 << 0) | ||
| 47 | __u16 flags; | ||
| 48 | __u32 version; | ||
| 49 | }; | ||
| 50 | |||
| 51 | struct nvdla_ctrl_ioctl_submit_task { | ||
| 52 | __u8 num_prefences; | ||
| 53 | __u8 num_postfences; | ||
| 54 | __u8 num_input_task_status; | ||
| 55 | __u8 num_output_task_status; | ||
| 56 | __u16 flags; | ||
| 57 | __u16 reserved; | ||
| 58 | |||
| 59 | __u64 prefences; | ||
| 60 | __u64 postfences; | ||
| 61 | |||
| 62 | __u64 input_task_status; | ||
| 63 | __u64 output_task_status; | ||
| 64 | |||
| 65 | __u32 num_operations; | ||
| 66 | __u32 num_addresses; | ||
| 67 | __u64 operation_desc; | ||
| 68 | |||
| 69 | __u64 surface_desc; | ||
| 70 | __u64 address_list; | ||
| 71 | }; | ||
| 72 | |||
| 73 | struct nvdla_fence { | ||
| 74 | __u32 type; | ||
| 75 | #define NVDLA_FENCE_TYPE_SYNCPT 0 | ||
| 76 | #define NVDLA_FENCE_TYPE_SYNC_FD 1 | ||
| 77 | __u32 syncpoint_index; | ||
| 78 | __u32 syncpoint_value; | ||
| 79 | __u32 sync_fd; | ||
| 80 | }; | ||
| 81 | |||
| 82 | struct nvdla_task_surface { | ||
| 83 | __u64 format; | ||
| 84 | __u32 handle; | ||
| 85 | __u32 offset; | ||
| 86 | }; | ||
| 87 | |||
| 88 | struct nvdla_task_roi { | ||
| 89 | __u32 handle; | ||
| 90 | __u32 offset; | ||
| 91 | }; | ||
| 92 | |||
| 93 | struct nvdla_task_status_handle { | ||
| 94 | __u32 handle; | ||
| 95 | __u32 reserved; | ||
| 96 | __u64 offset; | ||
| 97 | }; | ||
| 98 | |||
| 42 | #define NVHOST_NVDLA_IOCTL_MAGIC 'D' | 99 | #define NVHOST_NVDLA_IOCTL_MAGIC 'D' |
| 43 | 100 | ||
| 44 | #define NVDLA_IOCTL_CTRL_PING \ | 101 | #define NVDLA_IOCTL_CTRL_PING \ |
| @@ -47,9 +104,10 @@ struct nvdla_ctrl_pin_unpin_args { | |||
| 47 | _IOW(NVHOST_NVDLA_IOCTL_MAGIC, 2, struct nvdla_ctrl_pin_unpin_args) | 104 | _IOW(NVHOST_NVDLA_IOCTL_MAGIC, 2, struct nvdla_ctrl_pin_unpin_args) |
| 48 | #define NVDLA_IOCTL_CTRL_UNPIN \ | 105 | #define NVDLA_IOCTL_CTRL_UNPIN \ |
| 49 | _IOW(NVHOST_NVDLA_IOCTL_MAGIC, 3, struct nvdla_ctrl_pin_unpin_args) | 106 | _IOW(NVHOST_NVDLA_IOCTL_MAGIC, 3, struct nvdla_ctrl_pin_unpin_args) |
| 50 | 107 | #define NVDLA_IOCTL_CTRL_SUBMIT \ | |
| 108 | _IOW(NVHOST_NVDLA_IOCTL_MAGIC, 4, struct nvdla_ctrl_submit_args) | ||
| 51 | #define NVDLA_IOCTL_CTRL_LAST \ | 109 | #define NVDLA_IOCTL_CTRL_LAST \ |
| 52 | _IOC_NR(NVDLA_IOCTL_CTRL_UNPIN) | 110 | _IOC_NR(NVDLA_IOCTL_CTRL_SUBMIT) |
| 53 | 111 | ||
| 54 | #define NVDLA_IOCTL_CTRL_MAX_ARG_SIZE \ | 112 | #define NVDLA_IOCTL_CTRL_MAX_ARG_SIZE \ |
| 55 | sizeof(struct nvdla_ctrl_pin_unpin_args) | 113 | sizeof(struct nvdla_ctrl_pin_unpin_args) |
