summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/common/linux
diff options
context:
space:
mode:
authorSourab Gupta <sourabg@nvidia.com>2018-03-27 10:09:21 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2018-04-05 08:22:54 -0400
commit03b87689025b86b145236a9c707e31a3d3214eb0 (patch)
treec9f1d756e50c24b69718a04778d88bb53f26ca3b /drivers/gpu/nvgpu/common/linux
parent077de38dfbc37ca933e0f3456397a44a49b1202e (diff)
gpu: nvgpu: pass alloc_gpfifo args to gk20a_channel_alloc_gpfifo
The patch defines 'struct nvgpu_gpfifo_args' to be filled by alloc_gpfifo(_ex) ioctls and passed to the gk20a_channel_alloc_gpfifo function. This is required as a prep towards having the usermode submission support in the core channel core. Change-Id: I72acc00cc5558dd3623604da7d716bf849f0152c Signed-off-by: Sourab Gupta <sourabg@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1683391 GVS: Gerrit_Virtual_Submit Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/common/linux')
-rw-r--r--drivers/gpu/nvgpu/common/linux/cde.c6
-rw-r--r--drivers/gpu/nvgpu/common/linux/ioctl_channel.c49
2 files changed, 34 insertions, 21 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/cde.c b/drivers/gpu/nvgpu/common/linux/cde.c
index b366acc4..e5441ac9 100644
--- a/drivers/gpu/nvgpu/common/linux/cde.c
+++ b/drivers/gpu/nvgpu/common/linux/cde.c
@@ -1277,6 +1277,7 @@ static int gk20a_cde_load(struct gk20a_cde_ctx *cde_ctx)
1277 struct channel_gk20a *ch; 1277 struct channel_gk20a *ch;
1278 struct tsg_gk20a *tsg; 1278 struct tsg_gk20a *tsg;
1279 struct gr_gk20a *gr = &g->gr; 1279 struct gr_gk20a *gr = &g->gr;
1280 struct nvgpu_gpfifo_args gpfifo_args;
1280 int err = 0; 1281 int err = 0;
1281 u64 vaddr; 1282 u64 vaddr;
1282 1283
@@ -1316,8 +1317,11 @@ static int gk20a_cde_load(struct gk20a_cde_ctx *cde_ctx)
1316 goto err_alloc_gpfifo; 1317 goto err_alloc_gpfifo;
1317 } 1318 }
1318 1319
1320 gpfifo_args.num_entries = 1024;
1321 gpfifo_args.num_inflight_jobs = 0;
1322 gpfifo_args.flags = 0;
1319 /* allocate gpfifo (1024 should be more than enough) */ 1323 /* allocate gpfifo (1024 should be more than enough) */
1320 err = gk20a_channel_alloc_gpfifo(ch, 1024, 0, 0); 1324 err = gk20a_channel_alloc_gpfifo(ch, &gpfifo_args);
1321 if (err) { 1325 if (err) {
1322 nvgpu_warn(g, "cde: unable to allocate gpfifo"); 1326 nvgpu_warn(g, "cde: unable to allocate gpfifo");
1323 goto err_alloc_gpfifo; 1327 goto err_alloc_gpfifo;
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 }