diff options
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/nvgpu/common/linux/cde.c | 6 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/common/linux/ioctl_channel.c | 49 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/ce2_gk20a.c | 6 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/channel_gk20a.c | 18 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/channel_gk20a.h | 10 |
5 files changed, 54 insertions, 35 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 | ||
592 | static int nvgpu_channel_ioctl_alloc_gpfifo(struct channel_gk20a *c, | 592 | static 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 | ||
602 | static 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 | ||
603 | static int gk20a_channel_wait_semaphore(struct channel_gk20a *ch, | 617 | static 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 | } |
diff --git a/drivers/gpu/nvgpu/gk20a/ce2_gk20a.c b/drivers/gpu/nvgpu/gk20a/ce2_gk20a.c index 5841c72c..87eff813 100644 --- a/drivers/gpu/nvgpu/gk20a/ce2_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/ce2_gk20a.c | |||
@@ -406,6 +406,7 @@ u32 gk20a_ce_create_context(struct gk20a *g, | |||
406 | { | 406 | { |
407 | struct gk20a_gpu_ctx *ce_ctx; | 407 | struct gk20a_gpu_ctx *ce_ctx; |
408 | struct gk20a_ce_app *ce_app = &g->ce_app; | 408 | struct gk20a_ce_app *ce_app = &g->ce_app; |
409 | struct nvgpu_gpfifo_args gpfifo_args; | ||
409 | u32 ctx_id = ~0; | 410 | u32 ctx_id = ~0; |
410 | int err = 0; | 411 | int err = 0; |
411 | 412 | ||
@@ -458,8 +459,11 @@ u32 gk20a_ce_create_context(struct gk20a *g, | |||
458 | goto end; | 459 | goto end; |
459 | } | 460 | } |
460 | 461 | ||
462 | gpfifo_args.num_entries = 1024; | ||
463 | gpfifo_args.num_inflight_jobs = 0; | ||
464 | gpfifo_args.flags = 0; | ||
461 | /* allocate gpfifo (1024 should be more than enough) */ | 465 | /* allocate gpfifo (1024 should be more than enough) */ |
462 | err = gk20a_channel_alloc_gpfifo(ce_ctx->ch, 1024, 0, 0); | 466 | err = gk20a_channel_alloc_gpfifo(ce_ctx->ch, &gpfifo_args); |
463 | if (err) { | 467 | if (err) { |
464 | nvgpu_err(g, "ce: unable to allocate gpfifo"); | 468 | nvgpu_err(g, "ce: unable to allocate gpfifo"); |
465 | goto end; | 469 | goto end; |
diff --git a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c index 8b9f02df..83c49d52 100644 --- a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c | |||
@@ -1034,9 +1034,7 @@ static void channel_gk20a_free_prealloc_resources(struct channel_gk20a *c) | |||
1034 | } | 1034 | } |
1035 | 1035 | ||
1036 | int gk20a_channel_alloc_gpfifo(struct channel_gk20a *c, | 1036 | int gk20a_channel_alloc_gpfifo(struct channel_gk20a *c, |
1037 | unsigned int num_entries, | 1037 | struct nvgpu_gpfifo_args *gpfifo_args) |
1038 | unsigned int num_inflight_jobs, | ||
1039 | u32 flags) | ||
1040 | { | 1038 | { |
1041 | struct gk20a *g = c->g; | 1039 | struct gk20a *g = c->g; |
1042 | struct vm_gk20a *ch_vm; | 1040 | struct vm_gk20a *ch_vm; |
@@ -1044,13 +1042,13 @@ int gk20a_channel_alloc_gpfifo(struct channel_gk20a *c, | |||
1044 | int err = 0; | 1042 | int err = 0; |
1045 | unsigned long acquire_timeout; | 1043 | unsigned long acquire_timeout; |
1046 | 1044 | ||
1047 | gpfifo_size = num_entries; | 1045 | gpfifo_size = gpfifo_args->num_entries; |
1048 | gpfifo_entry_size = nvgpu_get_gpfifo_entry_size(); | 1046 | gpfifo_entry_size = nvgpu_get_gpfifo_entry_size(); |
1049 | 1047 | ||
1050 | if (flags & NVGPU_GPFIFO_FLAGS_SUPPORT_VPR) | 1048 | if (gpfifo_args->flags & NVGPU_GPFIFO_FLAGS_SUPPORT_VPR) |
1051 | c->vpr = true; | 1049 | c->vpr = true; |
1052 | 1050 | ||
1053 | if (flags & NVGPU_GPFIFO_FLAGS_SUPPORT_DETERMINISTIC) { | 1051 | if (gpfifo_args->flags & NVGPU_GPFIFO_FLAGS_SUPPORT_DETERMINISTIC) { |
1054 | nvgpu_rwsem_down_read(&g->deterministic_busy); | 1052 | nvgpu_rwsem_down_read(&g->deterministic_busy); |
1055 | /* | 1053 | /* |
1056 | * Railgating isn't deterministic; instead of disallowing | 1054 | * Railgating isn't deterministic; instead of disallowing |
@@ -1137,15 +1135,15 @@ int gk20a_channel_alloc_gpfifo(struct channel_gk20a *c, | |||
1137 | 1135 | ||
1138 | err = g->ops.fifo.setup_ramfc(c, c->gpfifo.mem.gpu_va, | 1136 | err = g->ops.fifo.setup_ramfc(c, c->gpfifo.mem.gpu_va, |
1139 | c->gpfifo.entry_num, | 1137 | c->gpfifo.entry_num, |
1140 | acquire_timeout, flags); | 1138 | acquire_timeout, gpfifo_args->flags); |
1141 | if (err) | 1139 | if (err) |
1142 | goto clean_up_sync; | 1140 | goto clean_up_sync; |
1143 | 1141 | ||
1144 | /* TBD: setup engine contexts */ | 1142 | /* TBD: setup engine contexts */ |
1145 | 1143 | ||
1146 | if (num_inflight_jobs) { | 1144 | if (gpfifo_args->num_inflight_jobs) { |
1147 | err = channel_gk20a_prealloc_resources(c, | 1145 | err = channel_gk20a_prealloc_resources(c, |
1148 | num_inflight_jobs); | 1146 | gpfifo_args->num_inflight_jobs); |
1149 | if (err) | 1147 | if (err) |
1150 | goto clean_up_sync; | 1148 | goto clean_up_sync; |
1151 | } | 1149 | } |
@@ -1166,7 +1164,7 @@ int gk20a_channel_alloc_gpfifo(struct channel_gk20a *c, | |||
1166 | clean_up_priv_cmd: | 1164 | clean_up_priv_cmd: |
1167 | channel_gk20a_free_priv_cmdbuf(c); | 1165 | channel_gk20a_free_priv_cmdbuf(c); |
1168 | clean_up_prealloc: | 1166 | clean_up_prealloc: |
1169 | if (num_inflight_jobs) | 1167 | if (gpfifo_args->num_inflight_jobs) |
1170 | channel_gk20a_free_prealloc_resources(c); | 1168 | channel_gk20a_free_prealloc_resources(c); |
1171 | clean_up_sync: | 1169 | clean_up_sync: |
1172 | if (c->sync) { | 1170 | if (c->sync) { |
diff --git a/drivers/gpu/nvgpu/gk20a/channel_gk20a.h b/drivers/gpu/nvgpu/gk20a/channel_gk20a.h index f2cb2ab8..eaa5f81b 100644 --- a/drivers/gpu/nvgpu/gk20a/channel_gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/channel_gk20a.h | |||
@@ -46,6 +46,12 @@ struct fifo_profile_gk20a; | |||
46 | #define NVGPU_GPFIFO_FLAGS_SUPPORT_DETERMINISTIC (1 << 1) | 46 | #define NVGPU_GPFIFO_FLAGS_SUPPORT_DETERMINISTIC (1 << 1) |
47 | #define NVGPU_GPFIFO_FLAGS_REPLAYABLE_FAULTS_ENABLE (1 << 2) | 47 | #define NVGPU_GPFIFO_FLAGS_REPLAYABLE_FAULTS_ENABLE (1 << 2) |
48 | 48 | ||
49 | struct nvgpu_gpfifo_args { | ||
50 | u32 num_entries; | ||
51 | u32 num_inflight_jobs; | ||
52 | u32 flags; | ||
53 | }; | ||
54 | |||
49 | struct notification { | 55 | struct notification { |
50 | struct { | 56 | struct { |
51 | u32 nanoseconds[2]; | 57 | u32 nanoseconds[2]; |
@@ -324,9 +330,7 @@ struct channel_gk20a *gk20a_open_new_channel(struct gk20a *g, | |||
324 | bool is_privileged_channel); | 330 | bool is_privileged_channel); |
325 | 331 | ||
326 | int gk20a_channel_alloc_gpfifo(struct channel_gk20a *c, | 332 | int gk20a_channel_alloc_gpfifo(struct channel_gk20a *c, |
327 | unsigned int num_entries, | 333 | struct nvgpu_gpfifo_args *gpfifo_args); |
328 | unsigned int num_inflight_jobs, | ||
329 | u32 flags); | ||
330 | 334 | ||
331 | void gk20a_channel_timeout_restart_all_channels(struct gk20a *g); | 335 | void gk20a_channel_timeout_restart_all_channels(struct gk20a *g); |
332 | 336 | ||