diff options
author | Thomas Fleury <tfleury@nvidia.com> | 2017-01-09 13:54:36 -0500 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2017-01-16 15:15:23 -0500 |
commit | f6a634ff24194ee83579f90ab399a08d91df233a (patch) | |
tree | 56e87309729a5e926ef2fd30bb8ede2abbd23da7 /drivers/gpu/nvgpu/gk20a | |
parent | bb5a9e1c6cfbe69b8a984439a092db7a1a75a405 (diff) |
gpu: nvgpu: use HAL to set TSG timeslice
Setting timeslice for virtualized case was not effective,
because both ioctls NVGPU_TSG_IOCTL_SET_TIMESLICE and
NVGPU_SCHED_IOCTL_TSG_SET_TIMESLICE were calling the
native function to set TSG timeslice.
- Fixed wrapper function to call HAL
- Defined HAL function for "native" set TSG timeslice
- Also, properly update timeout_us in TSG context, in
virtualized case.
This change also moves the min/max bounds checking for
tsg timeslice into the native function implementation.
There is no sysfs node for these parameters for vgpu,
as RM server is ultimately responsible for this check.
Bug 200263575
Change-Id: Ibceab9427561ad58ec28abfff0c96ca8f592bdb9
Signed-off-by: Thomas Fleury <tfleury@nvidia.com>
Reviewed-on: http://git-master/r/1283180
Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/fifo_gk20a.c | 19 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/fifo_gk20a.h | 4 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/tsg_gk20a.c | 33 |
3 files changed, 35 insertions, 21 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c b/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c index ccc3afca..2daeb1d0 100644 --- a/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * GK20A Graphics FIFO (gr host) | 2 | * GK20A Graphics FIFO (gr host) |
3 | * | 3 | * |
4 | * Copyright (c) 2011-2016, NVIDIA CORPORATION. All rights reserved. | 4 | * Copyright (c) 2011-2017, NVIDIA CORPORATION. All rights reserved. |
5 | * | 5 | * |
6 | * This program is free software; you can redistribute it and/or modify it | 6 | * This program is free software; you can redistribute it and/or modify it |
7 | * under the terms and conditions of the GNU General Public License, | 7 | * under the terms and conditions of the GNU General Public License, |
@@ -2870,6 +2870,22 @@ int gk20a_fifo_set_runlist_interleave(struct gk20a *g, | |||
2870 | return 0; | 2870 | return 0; |
2871 | } | 2871 | } |
2872 | 2872 | ||
2873 | int gk20a_fifo_tsg_set_timeslice(struct tsg_gk20a *tsg, u32 timeslice) | ||
2874 | { | ||
2875 | struct gk20a *g = tsg->g; | ||
2876 | |||
2877 | if (timeslice < g->min_timeslice_us || | ||
2878 | timeslice > g->max_timeslice_us) | ||
2879 | return -EINVAL; | ||
2880 | |||
2881 | gk20a_channel_get_timescale_from_timeslice(g, timeslice, | ||
2882 | &tsg->timeslice_timeout, &tsg->timeslice_scale); | ||
2883 | |||
2884 | tsg->timeslice_us = timeslice; | ||
2885 | |||
2886 | return g->ops.fifo.update_runlist(g, tsg->runlist_id, ~0, true, true); | ||
2887 | } | ||
2888 | |||
2873 | static int gk20a_fifo_update_runlist_locked(struct gk20a *g, u32 runlist_id, | 2889 | static int gk20a_fifo_update_runlist_locked(struct gk20a *g, u32 runlist_id, |
2874 | u32 hw_chid, bool add, | 2890 | u32 hw_chid, bool add, |
2875 | bool wait_for_finish) | 2891 | bool wait_for_finish) |
@@ -3296,6 +3312,7 @@ void gk20a_init_fifo(struct gpu_ops *gops) | |||
3296 | gops->fifo.get_num_fifos = gk20a_fifo_get_num_fifos; | 3312 | gops->fifo.get_num_fifos = gk20a_fifo_get_num_fifos; |
3297 | gops->fifo.get_pbdma_signature = gk20a_fifo_get_pbdma_signature; | 3313 | gops->fifo.get_pbdma_signature = gk20a_fifo_get_pbdma_signature; |
3298 | gops->fifo.set_runlist_interleave = gk20a_fifo_set_runlist_interleave; | 3314 | gops->fifo.set_runlist_interleave = gk20a_fifo_set_runlist_interleave; |
3315 | gops->fifo.tsg_set_timeslice = gk20a_fifo_tsg_set_timeslice; | ||
3299 | gops->fifo.force_reset_ch = gk20a_fifo_force_reset_ch; | 3316 | gops->fifo.force_reset_ch = gk20a_fifo_force_reset_ch; |
3300 | gops->fifo.engine_enum_from_type = gk20a_fifo_engine_enum_from_type; | 3317 | gops->fifo.engine_enum_from_type = gk20a_fifo_engine_enum_from_type; |
3301 | /* gk20a doesn't support device_info_data packet parsing */ | 3318 | /* gk20a doesn't support device_info_data packet parsing */ |
diff --git a/drivers/gpu/nvgpu/gk20a/fifo_gk20a.h b/drivers/gpu/nvgpu/gk20a/fifo_gk20a.h index c32142e3..20baf9de 100644 --- a/drivers/gpu/nvgpu/gk20a/fifo_gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/fifo_gk20a.h | |||
@@ -3,7 +3,7 @@ | |||
3 | * | 3 | * |
4 | * GK20A graphics fifo (gr host) | 4 | * GK20A graphics fifo (gr host) |
5 | * | 5 | * |
6 | * Copyright (c) 2011-2016, NVIDIA CORPORATION. All rights reserved. | 6 | * Copyright (c) 2011-2017, NVIDIA CORPORATION. All rights reserved. |
7 | * | 7 | * |
8 | * This program is free software; you can redistribute it and/or modify it | 8 | * This program is free software; you can redistribute it and/or modify it |
9 | * under the terms and conditions of the GNU General Public License, | 9 | * under the terms and conditions of the GNU General Public License, |
@@ -231,6 +231,8 @@ int gk20a_fifo_set_runlist_interleave(struct gk20a *g, | |||
231 | bool is_tsg, | 231 | bool is_tsg, |
232 | u32 runlist_id, | 232 | u32 runlist_id, |
233 | u32 new_level); | 233 | u32 new_level); |
234 | int gk20a_fifo_tsg_set_timeslice(struct tsg_gk20a *tsg, u32 timeslice); | ||
235 | |||
234 | 236 | ||
235 | void gk20a_fifo_debugfs_init(struct device *dev); | 237 | void gk20a_fifo_debugfs_init(struct device *dev); |
236 | 238 | ||
diff --git a/drivers/gpu/nvgpu/gk20a/tsg_gk20a.c b/drivers/gpu/nvgpu/gk20a/tsg_gk20a.c index 81a4b78e..96d6873d 100644 --- a/drivers/gpu/nvgpu/gk20a/tsg_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/tsg_gk20a.c | |||
@@ -177,27 +177,24 @@ int gk20a_init_tsg_support(struct gk20a *g, u32 tsgid) | |||
177 | static int gk20a_tsg_set_priority(struct gk20a *g, struct tsg_gk20a *tsg, | 177 | static int gk20a_tsg_set_priority(struct gk20a *g, struct tsg_gk20a *tsg, |
178 | u32 priority) | 178 | u32 priority) |
179 | { | 179 | { |
180 | u32 timeslice_us; | ||
181 | |||
180 | switch (priority) { | 182 | switch (priority) { |
181 | case NVGPU_PRIORITY_LOW: | 183 | case NVGPU_PRIORITY_LOW: |
182 | tsg->timeslice_us = g->timeslice_low_priority_us; | 184 | timeslice_us = g->timeslice_low_priority_us; |
183 | break; | 185 | break; |
184 | case NVGPU_PRIORITY_MEDIUM: | 186 | case NVGPU_PRIORITY_MEDIUM: |
185 | tsg->timeslice_us = g->timeslice_medium_priority_us; | 187 | timeslice_us = g->timeslice_medium_priority_us; |
186 | break; | 188 | break; |
187 | case NVGPU_PRIORITY_HIGH: | 189 | case NVGPU_PRIORITY_HIGH: |
188 | tsg->timeslice_us = g->timeslice_high_priority_us; | 190 | timeslice_us = g->timeslice_high_priority_us; |
189 | break; | 191 | break; |
190 | default: | 192 | default: |
191 | pr_err("Unsupported priority"); | 193 | pr_err("Unsupported priority"); |
192 | return -EINVAL; | 194 | return -EINVAL; |
193 | } | 195 | } |
194 | 196 | ||
195 | gk20a_channel_get_timescale_from_timeslice(g, tsg->timeslice_us, | 197 | return gk20a_tsg_set_timeslice(tsg, timeslice_us); |
196 | &tsg->timeslice_timeout, &tsg->timeslice_scale); | ||
197 | |||
198 | g->ops.fifo.update_runlist(g, tsg->runlist_id, ~0, true, true); | ||
199 | |||
200 | return 0; | ||
201 | } | 198 | } |
202 | 199 | ||
203 | static int gk20a_tsg_get_event_data_from_id(struct tsg_gk20a *tsg, | 200 | static int gk20a_tsg_get_event_data_from_id(struct tsg_gk20a *tsg, |
@@ -343,6 +340,8 @@ int gk20a_tsg_set_runlist_interleave(struct tsg_gk20a *tsg, u32 level) | |||
343 | struct gk20a *g = tsg->g; | 340 | struct gk20a *g = tsg->g; |
344 | int ret; | 341 | int ret; |
345 | 342 | ||
343 | gk20a_dbg(gpu_dbg_sched, "tsgid=%u interleave=%u", tsg->tsgid, level); | ||
344 | |||
346 | switch (level) { | 345 | switch (level) { |
347 | case NVGPU_RUNLIST_INTERLEAVE_LEVEL_LOW: | 346 | case NVGPU_RUNLIST_INTERLEAVE_LEVEL_LOW: |
348 | case NVGPU_RUNLIST_INTERLEAVE_LEVEL_MEDIUM: | 347 | case NVGPU_RUNLIST_INTERLEAVE_LEVEL_MEDIUM: |
@@ -364,16 +363,9 @@ int gk20a_tsg_set_timeslice(struct tsg_gk20a *tsg, u32 timeslice) | |||
364 | { | 363 | { |
365 | struct gk20a *g = tsg->g; | 364 | struct gk20a *g = tsg->g; |
366 | 365 | ||
367 | if (timeslice < g->min_timeslice_us || | 366 | gk20a_dbg(gpu_dbg_sched, "tsgid=%u timeslice=%u us", tsg->tsgid, timeslice); |
368 | timeslice > g->max_timeslice_us) | ||
369 | return -EINVAL; | ||
370 | |||
371 | gk20a_channel_get_timescale_from_timeslice(g, timeslice, | ||
372 | &tsg->timeslice_timeout, &tsg->timeslice_scale); | ||
373 | |||
374 | tsg->timeslice_us = timeslice; | ||
375 | 367 | ||
376 | return g->ops.fifo.update_runlist(g, tsg->runlist_id, ~0, true, true); | 368 | return g->ops.fifo.tsg_set_timeslice(tsg, timeslice); |
377 | } | 369 | } |
378 | 370 | ||
379 | static void release_used_tsg(struct fifo_gk20a *f, struct tsg_gk20a *tsg) | 371 | static void release_used_tsg(struct fifo_gk20a *f, struct tsg_gk20a *tsg) |
@@ -551,6 +543,8 @@ static int gk20a_tsg_ioctl_set_runlist_interleave(struct gk20a *g, | |||
551 | struct gk20a_sched_ctrl *sched = &g->sched_ctrl; | 543 | struct gk20a_sched_ctrl *sched = &g->sched_ctrl; |
552 | int err; | 544 | int err; |
553 | 545 | ||
546 | gk20a_dbg(gpu_dbg_fn | gpu_dbg_sched, "tsgid=%u", tsg->tsgid); | ||
547 | |||
554 | mutex_lock(&sched->control_lock); | 548 | mutex_lock(&sched->control_lock); |
555 | if (sched->control_locked) { | 549 | if (sched->control_locked) { |
556 | err = -EPERM; | 550 | err = -EPERM; |
@@ -576,6 +570,8 @@ static int gk20a_tsg_ioctl_set_timeslice(struct gk20a *g, | |||
576 | struct gk20a_sched_ctrl *sched = &g->sched_ctrl; | 570 | struct gk20a_sched_ctrl *sched = &g->sched_ctrl; |
577 | int err; | 571 | int err; |
578 | 572 | ||
573 | gk20a_dbg(gpu_dbg_fn | gpu_dbg_sched, "tsgid=%u", tsg->tsgid); | ||
574 | |||
579 | mutex_lock(&sched->control_lock); | 575 | mutex_lock(&sched->control_lock); |
580 | if (sched->control_locked) { | 576 | if (sched->control_locked) { |
581 | err = -EPERM; | 577 | err = -EPERM; |
@@ -728,5 +724,4 @@ void gk20a_init_tsg_ops(struct gpu_ops *gops) | |||
728 | { | 724 | { |
729 | gops->fifo.tsg_bind_channel = gk20a_tsg_bind_channel; | 725 | gops->fifo.tsg_bind_channel = gk20a_tsg_bind_channel; |
730 | gops->fifo.tsg_unbind_channel = gk20a_tsg_unbind_channel; | 726 | gops->fifo.tsg_unbind_channel = gk20a_tsg_unbind_channel; |
731 | gops->fifo.tsg_set_timeslice = gk20a_tsg_set_timeslice; | ||
732 | } | 727 | } |