diff options
author | Konsta Holtta <kholtta@nvidia.com> | 2018-05-17 06:30:11 -0400 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2018-06-20 09:14:31 -0400 |
commit | 0ca69a482d15ccf22bacccc4964606969df144f6 (patch) | |
tree | f24433fba5d875aaf2e8edc29cac568fc392d929 /drivers/gpu/nvgpu | |
parent | 06ceff1240902c7f4cdb01dcbc9c988fc5fd9495 (diff) |
gpu: nvgpu: add submit entry points for kernel and ioctl
gk20a_submit_channel_gpfifo() supports reading the gpfifo entries from
either a kernel buffer or an userspace buffer in an ioctl. Add two
separate entry points: one for the ioctl and another for any other
kernel use. This shortens the function prototypes and simplifies and
clarifies the call sites slightly.
Jira NVGPU-705
Change-Id: If5141a459261a451f78cc50972f4c94d95ba44d1
Signed-off-by: Konsta Holtta <kholtta@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1730479
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu')
-rw-r--r-- | drivers/gpu/nvgpu/os/linux/cde.c | 5 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/os/linux/ce2.c | 5 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/os/linux/channel.c | 24 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/os/linux/channel.h | 10 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/os/linux/ioctl_channel.c | 5 |
5 files changed, 37 insertions, 12 deletions
diff --git a/drivers/gpu/nvgpu/os/linux/cde.c b/drivers/gpu/nvgpu/os/linux/cde.c index 32b333f1..66a80403 100644 --- a/drivers/gpu/nvgpu/os/linux/cde.c +++ b/drivers/gpu/nvgpu/os/linux/cde.c | |||
@@ -783,9 +783,8 @@ static int gk20a_cde_execute_buffer(struct gk20a_cde_ctx *cde_ctx, | |||
783 | return -ENOSYS; | 783 | return -ENOSYS; |
784 | } | 784 | } |
785 | 785 | ||
786 | return gk20a_submit_channel_gpfifo(cde_ctx->ch, gpfifo, NULL, | 786 | return gk20a_submit_channel_gpfifo_kernel(cde_ctx->ch, gpfifo, |
787 | num_entries, flags, fence, fence_out, | 787 | num_entries, flags, fence, fence_out); |
788 | NULL); | ||
789 | } | 788 | } |
790 | 789 | ||
791 | static void gk20a_cde_ctx_release(struct gk20a_cde_ctx *cde_ctx) | 790 | static void gk20a_cde_ctx_release(struct gk20a_cde_ctx *cde_ctx) |
diff --git a/drivers/gpu/nvgpu/os/linux/ce2.c b/drivers/gpu/nvgpu/os/linux/ce2.c index 165f33db..8f20091b 100644 --- a/drivers/gpu/nvgpu/os/linux/ce2.c +++ b/drivers/gpu/nvgpu/os/linux/ce2.c | |||
@@ -130,9 +130,8 @@ int gk20a_ce_execute_ops(struct gk20a *g, | |||
130 | 130 | ||
131 | nvgpu_smp_wmb(); | 131 | nvgpu_smp_wmb(); |
132 | 132 | ||
133 | ret = gk20a_submit_channel_gpfifo(ce_ctx->ch, &gpfifo, NULL, | 133 | ret = gk20a_submit_channel_gpfifo_kernel(ce_ctx->ch, &gpfifo, |
134 | 1, submit_flags, &fence, | 134 | 1, submit_flags, &fence, &ce_cmd_buf_fence_out); |
135 | &ce_cmd_buf_fence_out, NULL); | ||
136 | 135 | ||
137 | if (!ret) { | 136 | if (!ret) { |
138 | ce_ctx->postfences[ce_ctx->cmd_buf_read_queue_offset] = | 137 | ce_ctx->postfences[ce_ctx->cmd_buf_read_queue_offset] = |
diff --git a/drivers/gpu/nvgpu/os/linux/channel.c b/drivers/gpu/nvgpu/os/linux/channel.c index cc2d525d..a84c5a1c 100644 --- a/drivers/gpu/nvgpu/os/linux/channel.c +++ b/drivers/gpu/nvgpu/os/linux/channel.c | |||
@@ -752,7 +752,7 @@ out: | |||
752 | return 0; | 752 | return 0; |
753 | } | 753 | } |
754 | 754 | ||
755 | int gk20a_submit_channel_gpfifo(struct channel_gk20a *c, | 755 | static int gk20a_submit_channel_gpfifo(struct channel_gk20a *c, |
756 | struct nvgpu_gpfifo_entry *gpfifo, | 756 | struct nvgpu_gpfifo_entry *gpfifo, |
757 | struct nvgpu_submit_gpfifo_args *args, | 757 | struct nvgpu_submit_gpfifo_args *args, |
758 | u32 num_entries, | 758 | u32 num_entries, |
@@ -1019,3 +1019,25 @@ clean_up: | |||
1019 | return err; | 1019 | return err; |
1020 | } | 1020 | } |
1021 | 1021 | ||
1022 | int gk20a_submit_channel_gpfifo_user(struct channel_gk20a *c, | ||
1023 | struct nvgpu_submit_gpfifo_args *args, | ||
1024 | u32 num_entries, | ||
1025 | u32 flags, | ||
1026 | struct nvgpu_channel_fence *fence, | ||
1027 | struct gk20a_fence **fence_out, | ||
1028 | struct fifo_profile_gk20a *profile) | ||
1029 | { | ||
1030 | return gk20a_submit_channel_gpfifo(c, NULL, args, num_entries, | ||
1031 | flags, fence, fence_out, profile); | ||
1032 | } | ||
1033 | |||
1034 | int gk20a_submit_channel_gpfifo_kernel(struct channel_gk20a *c, | ||
1035 | struct nvgpu_gpfifo_entry *gpfifo, | ||
1036 | u32 num_entries, | ||
1037 | u32 flags, | ||
1038 | struct nvgpu_channel_fence *fence, | ||
1039 | struct gk20a_fence **fence_out) | ||
1040 | { | ||
1041 | return gk20a_submit_channel_gpfifo(c, gpfifo, NULL, num_entries, flags, | ||
1042 | fence, fence_out, NULL); | ||
1043 | } | ||
diff --git a/drivers/gpu/nvgpu/os/linux/channel.h b/drivers/gpu/nvgpu/os/linux/channel.h index 4a58b10c..689ad8bf 100644 --- a/drivers/gpu/nvgpu/os/linux/channel.h +++ b/drivers/gpu/nvgpu/os/linux/channel.h | |||
@@ -84,8 +84,7 @@ struct channel_gk20a *gk20a_open_new_channel_with_cb(struct gk20a *g, | |||
84 | int runlist_id, | 84 | int runlist_id, |
85 | bool is_privileged_channel); | 85 | bool is_privileged_channel); |
86 | 86 | ||
87 | int gk20a_submit_channel_gpfifo(struct channel_gk20a *c, | 87 | int gk20a_submit_channel_gpfifo_user(struct channel_gk20a *c, |
88 | struct nvgpu_gpfifo_entry *gpfifo, | ||
89 | struct nvgpu_submit_gpfifo_args *args, | 88 | struct nvgpu_submit_gpfifo_args *args, |
90 | u32 num_entries, | 89 | u32 num_entries, |
91 | u32 flags, | 90 | u32 flags, |
@@ -93,4 +92,11 @@ int gk20a_submit_channel_gpfifo(struct channel_gk20a *c, | |||
93 | struct gk20a_fence **fence_out, | 92 | struct gk20a_fence **fence_out, |
94 | struct fifo_profile_gk20a *profile); | 93 | struct fifo_profile_gk20a *profile); |
95 | 94 | ||
95 | int gk20a_submit_channel_gpfifo_kernel(struct channel_gk20a *c, | ||
96 | struct nvgpu_gpfifo_entry *gpfifo, | ||
97 | u32 num_entries, | ||
98 | u32 flags, | ||
99 | struct nvgpu_channel_fence *fence, | ||
100 | struct gk20a_fence **fence_out); | ||
101 | |||
96 | #endif /* __NVGPU_CHANNEL_H__ */ | 102 | #endif /* __NVGPU_CHANNEL_H__ */ |
diff --git a/drivers/gpu/nvgpu/os/linux/ioctl_channel.c b/drivers/gpu/nvgpu/os/linux/ioctl_channel.c index b04bb9de..ee4ef237 100644 --- a/drivers/gpu/nvgpu/os/linux/ioctl_channel.c +++ b/drivers/gpu/nvgpu/os/linux/ioctl_channel.c | |||
@@ -798,9 +798,8 @@ static int gk20a_ioctl_channel_submit_gpfifo( | |||
798 | return fd; | 798 | return fd; |
799 | } | 799 | } |
800 | 800 | ||
801 | ret = gk20a_submit_channel_gpfifo(ch, NULL, args, args->num_entries, | 801 | ret = gk20a_submit_channel_gpfifo_user(ch, args, args->num_entries, |
802 | submit_flags, &fence, | 802 | submit_flags, &fence, &fence_out, profile); |
803 | &fence_out, profile); | ||
804 | 803 | ||
805 | if (ret) { | 804 | if (ret) { |
806 | if (fd != -1) | 805 | if (fd != -1) |