diff options
author | Terje Bergstrom <tbergstrom@nvidia.com> | 2017-12-27 16:04:17 -0500 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2018-01-02 16:53:09 -0500 |
commit | 86691b59c6fae2b091855c0f4d44079cad8529b1 (patch) | |
tree | c9fd2914ed052771980298f5e77bd43d7c430ec9 /drivers/gpu/nvgpu/gk20a | |
parent | 14fa8207e2f7feb36f8fa284b94859e05136eb0f (diff) |
gpu: nvgpu: Remove bare channel scheduling
Remove scheduling IOCTL implementations for bare channels. Also
removes code that constructs bare channels in runlist.
Bug 1842197
Change-Id: I6e833b38e24a2f2c45c7993edf939d365eaf41f0
Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1627326
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Seshendra Gadagottu <sgadagottu@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/ce2_gk20a.c | 5 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/channel_gk20a.c | 40 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/channel_gk20a.h | 6 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/fifo_gk20a.c | 90 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/fifo_gk20a.h | 3 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/gk20a.h | 4 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/tsg_gk20a.c | 2 |
7 files changed, 7 insertions, 143 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/ce2_gk20a.c b/drivers/gpu/nvgpu/gk20a/ce2_gk20a.c index 5e2fc6b3..ec20a679 100644 --- a/drivers/gpu/nvgpu/gk20a/ce2_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/ce2_gk20a.c | |||
@@ -504,7 +504,7 @@ u32 gk20a_ce_create_context(struct gk20a *g, | |||
504 | 504 | ||
505 | /* -1 means default channel timeslice value */ | 505 | /* -1 means default channel timeslice value */ |
506 | if (timeslice != -1) { | 506 | if (timeslice != -1) { |
507 | err = gk20a_fifo_set_timeslice(ce_ctx->ch, timeslice); | 507 | err = gk20a_fifo_tsg_set_timeslice(ce_ctx->tsg, timeslice); |
508 | if (err) { | 508 | if (err) { |
509 | nvgpu_err(g, | 509 | nvgpu_err(g, |
510 | "ce: could not set the channel timeslice value for CE context"); | 510 | "ce: could not set the channel timeslice value for CE context"); |
@@ -514,7 +514,8 @@ u32 gk20a_ce_create_context(struct gk20a *g, | |||
514 | 514 | ||
515 | /* -1 means default channel runlist level */ | 515 | /* -1 means default channel runlist level */ |
516 | if (runlist_level != -1) { | 516 | if (runlist_level != -1) { |
517 | err = gk20a_channel_set_runlist_interleave(ce_ctx->ch, runlist_level); | 517 | err = gk20a_tsg_set_runlist_interleave(ce_ctx->tsg, |
518 | runlist_level); | ||
518 | if (err) { | 519 | if (err) { |
519 | nvgpu_err(g, | 520 | nvgpu_err(g, |
520 | "ce: could not set the runlist interleave for CE context"); | 521 | "ce: could not set the runlist interleave for CE context"); |
diff --git a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c index f4a49a4b..aeac490a 100644 --- a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c | |||
@@ -129,16 +129,6 @@ int channel_gk20a_commit_va(struct channel_gk20a *c) | |||
129 | return 0; | 129 | return 0; |
130 | } | 130 | } |
131 | 131 | ||
132 | u32 gk20a_channel_get_timeslice(struct channel_gk20a *ch) | ||
133 | { | ||
134 | struct gk20a *g = ch->g; | ||
135 | |||
136 | if (!ch->timeslice_us) | ||
137 | return g->ops.fifo.default_timeslice_us(g); | ||
138 | |||
139 | return ch->timeslice_us; | ||
140 | } | ||
141 | |||
142 | int gk20a_channel_get_timescale_from_timeslice(struct gk20a *g, | 132 | int gk20a_channel_get_timescale_from_timeslice(struct gk20a *g, |
143 | int timeslice_period, | 133 | int timeslice_period, |
144 | int *__timeslice_timeout, int *__timeslice_scale) | 134 | int *__timeslice_timeout, int *__timeslice_scale) |
@@ -312,34 +302,6 @@ void gk20a_disable_channel(struct channel_gk20a *ch) | |||
312 | channel_gk20a_update_runlist(ch, false); | 302 | channel_gk20a_update_runlist(ch, false); |
313 | } | 303 | } |
314 | 304 | ||
315 | int gk20a_channel_set_runlist_interleave(struct channel_gk20a *ch, | ||
316 | u32 level) | ||
317 | { | ||
318 | struct gk20a *g = ch->g; | ||
319 | int ret; | ||
320 | |||
321 | if (gk20a_is_channel_marked_as_tsg(ch)) { | ||
322 | nvgpu_err(g, "invalid operation for TSG!"); | ||
323 | return -EINVAL; | ||
324 | } | ||
325 | |||
326 | switch (level) { | ||
327 | case NVGPU_FIFO_RUNLIST_INTERLEAVE_LEVEL_LOW: | ||
328 | case NVGPU_FIFO_RUNLIST_INTERLEAVE_LEVEL_MEDIUM: | ||
329 | case NVGPU_FIFO_RUNLIST_INTERLEAVE_LEVEL_HIGH: | ||
330 | ret = g->ops.fifo.set_runlist_interleave(g, ch->chid, | ||
331 | false, 0, level); | ||
332 | break; | ||
333 | default: | ||
334 | ret = -EINVAL; | ||
335 | break; | ||
336 | } | ||
337 | |||
338 | gk20a_dbg(gpu_dbg_sched, "chid=%u interleave=%u", ch->chid, level); | ||
339 | |||
340 | return ret ? ret : g->ops.fifo.update_runlist(g, ch->runlist_id, ~0, true, true); | ||
341 | } | ||
342 | |||
343 | static void gk20a_wait_until_counter_is_N( | 305 | static void gk20a_wait_until_counter_is_N( |
344 | struct channel_gk20a *ch, nvgpu_atomic_t *counter, int wait_value, | 306 | struct channel_gk20a *ch, nvgpu_atomic_t *counter, int wait_value, |
345 | struct nvgpu_cond *c, const char *caller, const char *counter_name) | 307 | struct nvgpu_cond *c, const char *caller, const char *counter_name) |
@@ -742,8 +704,6 @@ struct channel_gk20a *gk20a_open_new_channel(struct gk20a *g, | |||
742 | ch->has_timedout = false; | 704 | ch->has_timedout = false; |
743 | ch->wdt_enabled = true; | 705 | ch->wdt_enabled = true; |
744 | ch->obj_class = 0; | 706 | ch->obj_class = 0; |
745 | ch->interleave_level = NVGPU_FIFO_RUNLIST_INTERLEAVE_LEVEL_LOW; | ||
746 | ch->timeslice_us = g->timeslice_low_priority_us; | ||
747 | #ifdef CONFIG_TEGRA_19x_GPU | 707 | #ifdef CONFIG_TEGRA_19x_GPU |
748 | memset(&ch->t19x, 0, sizeof(struct channel_t19x)); | 708 | memset(&ch->t19x, 0, sizeof(struct channel_t19x)); |
749 | #endif | 709 | #endif |
diff --git a/drivers/gpu/nvgpu/gk20a/channel_gk20a.h b/drivers/gpu/nvgpu/gk20a/channel_gk20a.h index b43c5638..596b85f3 100644 --- a/drivers/gpu/nvgpu/gk20a/channel_gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/channel_gk20a.h | |||
@@ -247,7 +247,6 @@ struct channel_gk20a { | |||
247 | bool has_timedout; | 247 | bool has_timedout; |
248 | u32 timeout_ms_max; | 248 | u32 timeout_ms_max; |
249 | bool timeout_debug_dump; | 249 | bool timeout_debug_dump; |
250 | unsigned int timeslice_us; | ||
251 | 250 | ||
252 | struct nvgpu_mutex sync_lock; | 251 | struct nvgpu_mutex sync_lock; |
253 | struct gk20a_channel_sync *sync; | 252 | struct gk20a_channel_sync *sync; |
@@ -256,8 +255,6 @@ struct channel_gk20a { | |||
256 | u64 virt_ctx; | 255 | u64 virt_ctx; |
257 | #endif | 256 | #endif |
258 | 257 | ||
259 | u32 interleave_level; | ||
260 | |||
261 | u32 runlist_id; | 258 | u32 runlist_id; |
262 | 259 | ||
263 | bool is_privileged_channel; | 260 | bool is_privileged_channel; |
@@ -355,12 +352,9 @@ void channel_gk20a_joblist_unlock(struct channel_gk20a *c); | |||
355 | bool channel_gk20a_joblist_is_empty(struct channel_gk20a *c); | 352 | bool channel_gk20a_joblist_is_empty(struct channel_gk20a *c); |
356 | 353 | ||
357 | int channel_gk20a_update_runlist(struct channel_gk20a *c, bool add); | 354 | int channel_gk20a_update_runlist(struct channel_gk20a *c, bool add); |
358 | u32 gk20a_channel_get_timeslice(struct channel_gk20a *ch); | ||
359 | int gk20a_channel_get_timescale_from_timeslice(struct gk20a *g, | 355 | int gk20a_channel_get_timescale_from_timeslice(struct gk20a *g, |
360 | int timeslice_period, | 356 | int timeslice_period, |
361 | int *__timeslice_timeout, int *__timeslice_scale); | 357 | int *__timeslice_timeout, int *__timeslice_scale); |
362 | int gk20a_channel_set_runlist_interleave(struct channel_gk20a *ch, | ||
363 | u32 level); | ||
364 | 358 | ||
365 | int channel_gk20a_alloc_job(struct channel_gk20a *c, | 359 | int channel_gk20a_alloc_job(struct channel_gk20a *c, |
366 | struct channel_gk20a_job **job_out); | 360 | struct channel_gk20a_job **job_out); |
diff --git a/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c b/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c index fc71e907..194d5e3c 100644 --- a/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c | |||
@@ -3075,48 +3075,11 @@ static u32 *gk20a_runlist_construct_locked(struct fifo_gk20a *f, | |||
3075 | bool last_level = cur_level == NVGPU_FIFO_RUNLIST_INTERLEAVE_LEVEL_HIGH; | 3075 | bool last_level = cur_level == NVGPU_FIFO_RUNLIST_INTERLEAVE_LEVEL_HIGH; |
3076 | struct channel_gk20a *ch; | 3076 | struct channel_gk20a *ch; |
3077 | bool skip_next = false; | 3077 | bool skip_next = false; |
3078 | u32 chid, tsgid, count = 0; | 3078 | u32 tsgid, count = 0; |
3079 | u32 runlist_entry_words = f->runlist_entry_size / sizeof(u32); | 3079 | u32 runlist_entry_words = f->runlist_entry_size / sizeof(u32); |
3080 | 3080 | ||
3081 | gk20a_dbg_fn(""); | 3081 | gk20a_dbg_fn(""); |
3082 | 3082 | ||
3083 | /* for each bare channel, CH, on this level, insert all higher-level | ||
3084 | channels and TSGs before inserting CH. */ | ||
3085 | for_each_set_bit(chid, runlist->active_channels, f->num_channels) { | ||
3086 | ch = &f->channel[chid]; | ||
3087 | |||
3088 | if (ch->interleave_level != cur_level) | ||
3089 | continue; | ||
3090 | |||
3091 | if (gk20a_is_channel_marked_as_tsg(ch)) | ||
3092 | continue; | ||
3093 | |||
3094 | if (!last_level && !skip_next) { | ||
3095 | runlist_entry = gk20a_runlist_construct_locked(f, | ||
3096 | runlist, | ||
3097 | cur_level + 1, | ||
3098 | runlist_entry, | ||
3099 | interleave_enabled, | ||
3100 | false, | ||
3101 | entries_left); | ||
3102 | /* if interleaving is disabled, higher-level channels | ||
3103 | and TSGs only need to be inserted once */ | ||
3104 | if (!interleave_enabled) | ||
3105 | skip_next = true; | ||
3106 | } | ||
3107 | |||
3108 | if (!(*entries_left)) | ||
3109 | return NULL; | ||
3110 | |||
3111 | gk20a_dbg_info("add channel %d to runlist", chid); | ||
3112 | f->g->ops.fifo.get_ch_runlist_entry(ch, runlist_entry); | ||
3113 | gk20a_dbg_info("run list count %d runlist [0] %x [1] %x\n", | ||
3114 | count, runlist_entry[0], runlist_entry[1]); | ||
3115 | runlist_entry += runlist_entry_words; | ||
3116 | count++; | ||
3117 | (*entries_left)--; | ||
3118 | } | ||
3119 | |||
3120 | /* for each TSG, T, on this level, insert all higher-level channels | 3083 | /* for each TSG, T, on this level, insert all higher-level channels |
3121 | and TSGs before inserting T. */ | 3084 | and TSGs before inserting T. */ |
3122 | for_each_set_bit(tsgid, runlist->active_tsgs, f->num_channels) { | 3085 | for_each_set_bit(tsgid, runlist->active_tsgs, f->num_channels) { |
@@ -3204,16 +3167,12 @@ static u32 *gk20a_runlist_construct_locked(struct fifo_gk20a *f, | |||
3204 | 3167 | ||
3205 | int gk20a_fifo_set_runlist_interleave(struct gk20a *g, | 3168 | int gk20a_fifo_set_runlist_interleave(struct gk20a *g, |
3206 | u32 id, | 3169 | u32 id, |
3207 | bool is_tsg, | ||
3208 | u32 runlist_id, | 3170 | u32 runlist_id, |
3209 | u32 new_level) | 3171 | u32 new_level) |
3210 | { | 3172 | { |
3211 | gk20a_dbg_fn(""); | 3173 | gk20a_dbg_fn(""); |
3212 | 3174 | ||
3213 | if (is_tsg) | 3175 | g->fifo.tsg[id].interleave_level = new_level; |
3214 | g->fifo.tsg[id].interleave_level = new_level; | ||
3215 | else | ||
3216 | g->fifo.channel[id].interleave_level = new_level; | ||
3217 | 3176 | ||
3218 | return 0; | 3177 | return 0; |
3219 | } | 3178 | } |
@@ -3917,51 +3876,6 @@ int gk20a_fifo_setup_ramfc(struct channel_gk20a *c, | |||
3917 | return gk20a_fifo_commit_userd(c); | 3876 | return gk20a_fifo_commit_userd(c); |
3918 | } | 3877 | } |
3919 | 3878 | ||
3920 | static int channel_gk20a_set_schedule_params(struct channel_gk20a *c) | ||
3921 | { | ||
3922 | int shift = 0, value = 0; | ||
3923 | |||
3924 | gk20a_channel_get_timescale_from_timeslice(c->g, | ||
3925 | c->timeslice_us, &value, &shift); | ||
3926 | |||
3927 | /* disable channel */ | ||
3928 | c->g->ops.fifo.disable_channel(c); | ||
3929 | |||
3930 | /* preempt the channel */ | ||
3931 | WARN_ON(c->g->ops.fifo.preempt_channel(c->g, c->chid)); | ||
3932 | |||
3933 | /* set new timeslice */ | ||
3934 | nvgpu_mem_wr32(c->g, &c->inst_block, ram_fc_runlist_timeslice_w(), | ||
3935 | value | (shift << 12) | | ||
3936 | fifo_runlist_timeslice_enable_true_f()); | ||
3937 | |||
3938 | /* enable channel */ | ||
3939 | c->g->ops.fifo.enable_channel(c); | ||
3940 | |||
3941 | return 0; | ||
3942 | } | ||
3943 | |||
3944 | int gk20a_fifo_set_timeslice(struct channel_gk20a *ch, u32 timeslice) | ||
3945 | { | ||
3946 | struct gk20a *g = ch->g; | ||
3947 | |||
3948 | if (gk20a_is_channel_marked_as_tsg(ch)) { | ||
3949 | nvgpu_err(g, "invalid operation for TSG!"); | ||
3950 | return -EINVAL; | ||
3951 | } | ||
3952 | |||
3953 | if (timeslice < g->min_timeslice_us || | ||
3954 | timeslice > g->max_timeslice_us) | ||
3955 | return -EINVAL; | ||
3956 | |||
3957 | ch->timeslice_us = timeslice; | ||
3958 | |||
3959 | gk20a_dbg(gpu_dbg_sched, "chid=%u timeslice=%u us", | ||
3960 | ch->chid, timeslice); | ||
3961 | |||
3962 | return channel_gk20a_set_schedule_params(ch); | ||
3963 | } | ||
3964 | |||
3965 | void gk20a_fifo_setup_ramfc_for_privileged_channel(struct channel_gk20a *c) | 3879 | void gk20a_fifo_setup_ramfc_for_privileged_channel(struct channel_gk20a *c) |
3966 | { | 3880 | { |
3967 | struct gk20a *g = c->g; | 3881 | struct gk20a *g = c->g; |
diff --git a/drivers/gpu/nvgpu/gk20a/fifo_gk20a.h b/drivers/gpu/nvgpu/gk20a/fifo_gk20a.h index 3587ffa8..7fdd3b6b 100644 --- a/drivers/gpu/nvgpu/gk20a/fifo_gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/fifo_gk20a.h | |||
@@ -297,12 +297,10 @@ struct channel_gk20a *gk20a_fifo_channel_from_chid(struct gk20a *g, | |||
297 | void gk20a_fifo_issue_preempt(struct gk20a *g, u32 id, bool is_tsg); | 297 | void gk20a_fifo_issue_preempt(struct gk20a *g, u32 id, bool is_tsg); |
298 | int gk20a_fifo_set_runlist_interleave(struct gk20a *g, | 298 | int gk20a_fifo_set_runlist_interleave(struct gk20a *g, |
299 | u32 id, | 299 | u32 id, |
300 | bool is_tsg, | ||
301 | u32 runlist_id, | 300 | u32 runlist_id, |
302 | u32 new_level); | 301 | u32 new_level); |
303 | int gk20a_fifo_tsg_set_timeslice(struct tsg_gk20a *tsg, u32 timeslice); | 302 | int gk20a_fifo_tsg_set_timeslice(struct tsg_gk20a *tsg, u32 timeslice); |
304 | 303 | ||
305 | |||
306 | const char *gk20a_fifo_interleave_level_name(u32 interleave_level); | 304 | const char *gk20a_fifo_interleave_level_name(u32 interleave_level); |
307 | 305 | ||
308 | int gk20a_fifo_engine_enum_from_type(struct gk20a *g, u32 engine_type, | 306 | int gk20a_fifo_engine_enum_from_type(struct gk20a *g, u32 engine_type, |
@@ -383,7 +381,6 @@ void __locked_fifo_preempt_timeout_rc(struct gk20a *g, u32 id, | |||
383 | int gk20a_fifo_setup_ramfc(struct channel_gk20a *c, | 381 | int gk20a_fifo_setup_ramfc(struct channel_gk20a *c, |
384 | u64 gpfifo_base, u32 gpfifo_entries, | 382 | u64 gpfifo_base, u32 gpfifo_entries, |
385 | unsigned long timeout, u32 flags); | 383 | unsigned long timeout, u32 flags); |
386 | int gk20a_fifo_set_timeslice(struct channel_gk20a *ch, unsigned int timeslice); | ||
387 | void gk20a_fifo_setup_ramfc_for_privileged_channel(struct channel_gk20a *c); | 384 | void gk20a_fifo_setup_ramfc_for_privileged_channel(struct channel_gk20a *c); |
388 | int gk20a_fifo_alloc_inst(struct gk20a *g, struct channel_gk20a *ch); | 385 | int gk20a_fifo_alloc_inst(struct gk20a *g, struct channel_gk20a *ch); |
389 | void gk20a_fifo_free_inst(struct gk20a *g, struct channel_gk20a *ch); | 386 | void gk20a_fifo_free_inst(struct gk20a *g, struct channel_gk20a *ch); |
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.h b/drivers/gpu/nvgpu/gk20a/gk20a.h index ebe29bc3..6a669d88 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/gk20a.h | |||
@@ -535,10 +535,8 @@ struct gpu_ops { | |||
535 | u32 (*get_num_fifos)(struct gk20a *g); | 535 | u32 (*get_num_fifos)(struct gk20a *g); |
536 | u32 (*get_pbdma_signature)(struct gk20a *g); | 536 | u32 (*get_pbdma_signature)(struct gk20a *g); |
537 | int (*set_runlist_interleave)(struct gk20a *g, u32 id, | 537 | int (*set_runlist_interleave)(struct gk20a *g, u32 id, |
538 | bool is_tsg, u32 runlist_id, | 538 | u32 runlist_id, |
539 | u32 new_level); | 539 | u32 new_level); |
540 | int (*channel_set_timeslice)(struct channel_gk20a *ch, | ||
541 | u32 timeslice); | ||
542 | int (*tsg_set_timeslice)(struct tsg_gk20a *tsg, u32 timeslice); | 540 | int (*tsg_set_timeslice)(struct tsg_gk20a *tsg, u32 timeslice); |
543 | u32 (*default_timeslice_us)(struct gk20a *); | 541 | u32 (*default_timeslice_us)(struct gk20a *); |
544 | int (*force_reset_ch)(struct channel_gk20a *ch, | 542 | int (*force_reset_ch)(struct channel_gk20a *ch, |
diff --git a/drivers/gpu/nvgpu/gk20a/tsg_gk20a.c b/drivers/gpu/nvgpu/gk20a/tsg_gk20a.c index 64d521a0..ff700372 100644 --- a/drivers/gpu/nvgpu/gk20a/tsg_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/tsg_gk20a.c | |||
@@ -211,7 +211,7 @@ int gk20a_tsg_set_runlist_interleave(struct tsg_gk20a *tsg, u32 level) | |||
211 | case NVGPU_FIFO_RUNLIST_INTERLEAVE_LEVEL_MEDIUM: | 211 | case NVGPU_FIFO_RUNLIST_INTERLEAVE_LEVEL_MEDIUM: |
212 | case NVGPU_FIFO_RUNLIST_INTERLEAVE_LEVEL_HIGH: | 212 | case NVGPU_FIFO_RUNLIST_INTERLEAVE_LEVEL_HIGH: |
213 | ret = g->ops.fifo.set_runlist_interleave(g, tsg->tsgid, | 213 | ret = g->ops.fifo.set_runlist_interleave(g, tsg->tsgid, |
214 | true, 0, level); | 214 | 0, level); |
215 | if (!ret) | 215 | if (!ret) |
216 | tsg->interleave_level = level; | 216 | tsg->interleave_level = level; |
217 | break; | 217 | break; |