diff options
author | Deepak Nibade <dnibade@nvidia.com> | 2015-10-28 06:43:14 -0400 |
---|---|---|
committer | Terje Bergstrom <tbergstrom@nvidia.com> | 2015-11-03 17:20:08 -0500 |
commit | 9592a4e6fce8204e9ada54ba00902e792199fec5 (patch) | |
tree | 37cc1bffce5ea48555a1ed88865e5f545627b546 /drivers/gpu/nvgpu/gk20a/tsg_gk20a.c | |
parent | 8d279dbac10b8521aa7eaeb7640c01d21ce044f2 (diff) |
gpu: nvgpu: IOCTL to set TSG timeslice
Add new IOCTL NVGPU_IOCTL_TSG_SET_PRIORITY to allow
setting timeslice for entire TSG
Return error from channel specific IOCTL_CHANNEL_SET_PRIORITY
if the channel is part of TSG
Separate out API gk20a_channel_get_timescale_from_timeslice()
to get timeslice_timeout and scale from timeslice period
Use this API to get timeslice_timeout and scale for TSG and
store it in tsg_gk20a structure
Then trigger runlist update so that new timeslice values
will be re-written to runlist for TSG
Bug 200146615
Change-Id: I555467d034f81b372b31372f0835d72b1c159508
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: http://git-master/r/824206
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Tested-by: Terje Bergstrom <tbergstrom@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/tsg_gk20a.c')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/tsg_gk20a.c | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/tsg_gk20a.c b/drivers/gpu/nvgpu/gk20a/tsg_gk20a.c index 37a326d2..5cd43329 100644 --- a/drivers/gpu/nvgpu/gk20a/tsg_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/tsg_gk20a.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2014, NVIDIA CORPORATION. All rights reserved. | 2 | * Copyright (c) 2014-2015, NVIDIA CORPORATION. All rights reserved. |
3 | * | 3 | * |
4 | * This program is free software; you can redistribute it and/or modify it | 4 | * This program is free software; you can redistribute it and/or modify it |
5 | * under the terms and conditions of the GNU General Public License, | 5 | * under the terms and conditions of the GNU General Public License, |
@@ -126,6 +126,34 @@ int gk20a_init_tsg_support(struct gk20a *g, u32 tsgid) | |||
126 | return 0; | 126 | return 0; |
127 | } | 127 | } |
128 | 128 | ||
129 | static int gk20a_tsg_set_priority(struct gk20a *g, struct tsg_gk20a *tsg, | ||
130 | u32 priority) | ||
131 | { | ||
132 | int timeslice_period; | ||
133 | |||
134 | switch (priority) { | ||
135 | case NVGPU_PRIORITY_LOW: | ||
136 | timeslice_period = g->timeslice_low_priority_us; | ||
137 | break; | ||
138 | case NVGPU_PRIORITY_MEDIUM: | ||
139 | timeslice_period = g->timeslice_medium_priority_us; | ||
140 | break; | ||
141 | case NVGPU_PRIORITY_HIGH: | ||
142 | timeslice_period = g->timeslice_high_priority_us; | ||
143 | break; | ||
144 | default: | ||
145 | pr_err("Unsupported priority"); | ||
146 | return -EINVAL; | ||
147 | } | ||
148 | |||
149 | gk20a_channel_get_timescale_from_timeslice(g, timeslice_period, | ||
150 | &tsg->timeslice_timeout, &tsg->timeslice_scale); | ||
151 | |||
152 | g->ops.fifo.update_runlist(g, 0, ~0, true, true); | ||
153 | |||
154 | return 0; | ||
155 | } | ||
156 | |||
129 | static void release_used_tsg(struct fifo_gk20a *f, struct tsg_gk20a *tsg) | 157 | static void release_used_tsg(struct fifo_gk20a *f, struct tsg_gk20a *tsg) |
130 | { | 158 | { |
131 | mutex_lock(&f->tsg_inuse_mutex); | 159 | mutex_lock(&f->tsg_inuse_mutex); |
@@ -320,6 +348,13 @@ long gk20a_tsg_dev_ioctl(struct file *filp, unsigned int cmd, | |||
320 | break; | 348 | break; |
321 | } | 349 | } |
322 | 350 | ||
351 | case NVGPU_IOCTL_TSG_SET_PRIORITY: | ||
352 | { | ||
353 | err = gk20a_tsg_set_priority(g, tsg, | ||
354 | ((struct nvgpu_set_priority_args *)buf)->priority); | ||
355 | break; | ||
356 | } | ||
357 | |||
323 | default: | 358 | default: |
324 | gk20a_err(dev_from_gk20a(g), | 359 | gk20a_err(dev_from_gk20a(g), |
325 | "unrecognized tsg gpu ioctl cmd: 0x%x", | 360 | "unrecognized tsg gpu ioctl cmd: 0x%x", |