summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/common/linux/ioctl_channel.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/nvgpu/common/linux/ioctl_channel.c')
-rw-r--r--drivers/gpu/nvgpu/common/linux/ioctl_channel.c49
1 files changed, 29 insertions, 20 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/ioctl_channel.c b/drivers/gpu/nvgpu/common/linux/ioctl_channel.c
index 01355b78..9b5a850a 100644
--- a/drivers/gpu/nvgpu/common/linux/ioctl_channel.c
+++ b/drivers/gpu/nvgpu/common/linux/ioctl_channel.c
@@ -589,16 +589,30 @@ static u32 nvgpu_gpfifo_user_flags_to_common_flags(u32 user_flags)
589 return flags; 589 return flags;
590} 590}
591 591
592static int nvgpu_channel_ioctl_alloc_gpfifo(struct channel_gk20a *c, 592static void nvgpu_get_gpfifo_ex_args(
593 unsigned int num_entries, 593 struct nvgpu_alloc_gpfifo_ex_args *alloc_gpfifo_ex_args,
594 unsigned int num_inflight_jobs, 594 struct nvgpu_gpfifo_args *gpfifo_args)
595 u32 user_flags)
596{ 595{
597 return gk20a_channel_alloc_gpfifo(c, num_entries, 596 gpfifo_args->num_entries = alloc_gpfifo_ex_args->num_entries;
598 num_inflight_jobs, 597 gpfifo_args->num_inflight_jobs = alloc_gpfifo_ex_args->num_inflight_jobs;
599 nvgpu_gpfifo_user_flags_to_common_flags(user_flags)); 598 gpfifo_args->flags = nvgpu_gpfifo_user_flags_to_common_flags(
599 alloc_gpfifo_ex_args->flags);
600} 600}
601 601
602static void nvgpu_get_gpfifo_args(
603 struct nvgpu_alloc_gpfifo_args *alloc_gpfifo_args,
604 struct nvgpu_gpfifo_args *gpfifo_args)
605{
606 /*
607 * Kernel can insert one extra gpfifo entry before user
608 * submitted gpfifos and another one after, for internal usage.
609 * Triple the requested size.
610 */
611 gpfifo_args->num_entries = alloc_gpfifo_args->num_entries * 3;
612 gpfifo_args->num_inflight_jobs = 0;
613 gpfifo_args->flags = nvgpu_gpfifo_user_flags_to_common_flags(
614 alloc_gpfifo_args->flags);
615}
602 616
603static int gk20a_channel_wait_semaphore(struct channel_gk20a *ch, 617static int gk20a_channel_wait_semaphore(struct channel_gk20a *ch,
604 ulong id, u32 offset, 618 ulong id, u32 offset,
@@ -1075,6 +1089,9 @@ long gk20a_channel_ioctl(struct file *filp,
1075 { 1089 {
1076 struct nvgpu_alloc_gpfifo_ex_args *alloc_gpfifo_ex_args = 1090 struct nvgpu_alloc_gpfifo_ex_args *alloc_gpfifo_ex_args =
1077 (struct nvgpu_alloc_gpfifo_ex_args *)buf; 1091 (struct nvgpu_alloc_gpfifo_ex_args *)buf;
1092 struct nvgpu_gpfifo_args gpfifo_args;
1093
1094 nvgpu_get_gpfifo_ex_args(alloc_gpfifo_ex_args, &gpfifo_args);
1078 1095
1079 err = gk20a_busy(ch->g); 1096 err = gk20a_busy(ch->g);
1080 if (err) { 1097 if (err) {
@@ -1089,10 +1106,7 @@ long gk20a_channel_ioctl(struct file *filp,
1089 gk20a_idle(ch->g); 1106 gk20a_idle(ch->g);
1090 break; 1107 break;
1091 } 1108 }
1092 err = nvgpu_channel_ioctl_alloc_gpfifo(ch, 1109 err = gk20a_channel_alloc_gpfifo(ch, &gpfifo_args);
1093 alloc_gpfifo_ex_args->num_entries,
1094 alloc_gpfifo_ex_args->num_inflight_jobs,
1095 alloc_gpfifo_ex_args->flags);
1096 gk20a_idle(ch->g); 1110 gk20a_idle(ch->g);
1097 break; 1111 break;
1098 } 1112 }
@@ -1100,6 +1114,9 @@ long gk20a_channel_ioctl(struct file *filp,
1100 { 1114 {
1101 struct nvgpu_alloc_gpfifo_args *alloc_gpfifo_args = 1115 struct nvgpu_alloc_gpfifo_args *alloc_gpfifo_args =
1102 (struct nvgpu_alloc_gpfifo_args *)buf; 1116 (struct nvgpu_alloc_gpfifo_args *)buf;
1117 struct nvgpu_gpfifo_args gpfifo_args;
1118
1119 nvgpu_get_gpfifo_args(alloc_gpfifo_args, &gpfifo_args);
1103 1120
1104 err = gk20a_busy(ch->g); 1121 err = gk20a_busy(ch->g);
1105 if (err) { 1122 if (err) {
@@ -1109,15 +1126,7 @@ long gk20a_channel_ioctl(struct file *filp,
1109 break; 1126 break;
1110 } 1127 }
1111 1128
1112 /* 1129 err = gk20a_channel_alloc_gpfifo(ch, &gpfifo_args);
1113 * Kernel can insert one extra gpfifo entry before user
1114 * submitted gpfifos and another one after, for internal usage.
1115 * Triple the requested size.
1116 */
1117 err = nvgpu_channel_ioctl_alloc_gpfifo(ch,
1118 alloc_gpfifo_args->num_entries * 3,
1119 0,
1120 alloc_gpfifo_args->flags);
1121 gk20a_idle(ch->g); 1130 gk20a_idle(ch->g);
1122 break; 1131 break;
1123 } 1132 }