summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gk20a/channel_gk20a.c
diff options
context:
space:
mode:
authorThomas Fleury <tfleury@nvidia.com>2016-03-15 22:06:43 -0400
committerKen Adams <kadams@nvidia.com>2016-05-05 12:25:02 -0400
commit93678f571c323861458992de16d552ea7313e831 (patch)
tree7a1faae97be3a9be5f180b011d66075ab8a1541c /drivers/gpu/nvgpu/gk20a/channel_gk20a.c
parent8beea96fad15724bc1fb7302668077617c9dbcee (diff)
gpu: nvgpu: Add trace and debugfs for sched params
JIRA EVLR-244 JIRA EVLR-318 Change-Id: Ie95f42212dadcf2d0c1737eeb28812afb03b712f Signed-off-by: Thomas Fleury <tfleury@nvidia.com> Reviewed-on: http://git-master/r/1120603 GVS: Gerrit_Virtual_Submit Reviewed-by: Deepak Nibade <dnibade@nvidia.com> Reviewed-by: Ken Adams <kadams@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/channel_gk20a.c')
-rw-r--r--drivers/gpu/nvgpu/gk20a/channel_gk20a.c38
1 files changed, 26 insertions, 12 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c
index 9e023e16..697861e2 100644
--- a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c
@@ -184,8 +184,7 @@ int gk20a_channel_get_timescale_from_timeslice(struct gk20a *g,
184 return 0; 184 return 0;
185} 185}
186 186
187static int channel_gk20a_set_schedule_params(struct channel_gk20a *c, 187static int channel_gk20a_set_schedule_params(struct channel_gk20a *c)
188 u32 timeslice_period)
189{ 188{
190 void *inst_ptr; 189 void *inst_ptr;
191 int shift = 0, value = 0; 190 int shift = 0, value = 0;
@@ -194,8 +193,8 @@ static int channel_gk20a_set_schedule_params(struct channel_gk20a *c,
194 if (!inst_ptr) 193 if (!inst_ptr)
195 return -ENOMEM; 194 return -ENOMEM;
196 195
197 gk20a_channel_get_timescale_from_timeslice(c->g, timeslice_period, 196 gk20a_channel_get_timescale_from_timeslice(c->g,
198 &value, &shift); 197 c->timeslice_us, &value, &shift);
199 198
200 /* disable channel */ 199 /* disable channel */
201 c->g->ops.fifo.disable_channel(c); 200 c->g->ops.fifo.disable_channel(c);
@@ -1162,6 +1161,7 @@ struct channel_gk20a *gk20a_open_new_channel(struct gk20a *g)
1162 ch->obj_class = 0; 1161 ch->obj_class = 0;
1163 ch->clean_up.scheduled = false; 1162 ch->clean_up.scheduled = false;
1164 ch->interleave_level = NVGPU_RUNLIST_INTERLEAVE_LEVEL_LOW; 1163 ch->interleave_level = NVGPU_RUNLIST_INTERLEAVE_LEVEL_LOW;
1164 ch->timeslice_us = g->timeslice_low_priority_us;
1165 1165
1166 /* The channel is *not* runnable at this point. It still needs to have 1166 /* The channel is *not* runnable at this point. It still needs to have
1167 * an address space bound and allocate a gpfifo and grctx. */ 1167 * an address space bound and allocate a gpfifo and grctx. */
@@ -1207,6 +1207,8 @@ static int __gk20a_channel_open(struct gk20a *g, struct file *filp)
1207 return -ENOMEM; 1207 return -ENOMEM;
1208 } 1208 }
1209 1209
1210 trace_gk20a_channel_sched_defaults(GK20A_TP_ARGS_SCHED(ch));
1211
1210 filp->private_data = ch; 1212 filp->private_data = ch;
1211 return 0; 1213 return 0;
1212} 1214}
@@ -2699,8 +2701,6 @@ static int gk20a_channel_event_id_ctrl(struct channel_gk20a *ch,
2699 2701
2700int gk20a_channel_set_priority(struct channel_gk20a *ch, u32 priority) 2702int gk20a_channel_set_priority(struct channel_gk20a *ch, u32 priority)
2701{ 2703{
2702 u32 timeslice_timeout;
2703
2704 if (gk20a_is_channel_marked_as_tsg(ch)) { 2704 if (gk20a_is_channel_marked_as_tsg(ch)) {
2705 gk20a_err(dev_from_gk20a(ch->g), 2705 gk20a_err(dev_from_gk20a(ch->g),
2706 "invalid operation for TSG!\n"); 2706 "invalid operation for TSG!\n");
@@ -2710,21 +2710,20 @@ int gk20a_channel_set_priority(struct channel_gk20a *ch, u32 priority)
2710 /* set priority of graphics channel */ 2710 /* set priority of graphics channel */
2711 switch (priority) { 2711 switch (priority) {
2712 case NVGPU_PRIORITY_LOW: 2712 case NVGPU_PRIORITY_LOW:
2713 timeslice_timeout = ch->g->timeslice_low_priority_us; 2713 ch->timeslice_us = ch->g->timeslice_low_priority_us;
2714 break; 2714 break;
2715 case NVGPU_PRIORITY_MEDIUM: 2715 case NVGPU_PRIORITY_MEDIUM:
2716 timeslice_timeout = ch->g->timeslice_medium_priority_us; 2716 ch->timeslice_us = ch->g->timeslice_medium_priority_us;
2717 break; 2717 break;
2718 case NVGPU_PRIORITY_HIGH: 2718 case NVGPU_PRIORITY_HIGH:
2719 timeslice_timeout = ch->g->timeslice_high_priority_us; 2719 ch->timeslice_us = ch->g->timeslice_high_priority_us;
2720 break; 2720 break;
2721 default: 2721 default:
2722 pr_err("Unsupported priority"); 2722 pr_err("Unsupported priority");
2723 return -EINVAL; 2723 return -EINVAL;
2724 } 2724 }
2725 2725
2726 return channel_gk20a_set_schedule_params(ch, 2726 return channel_gk20a_set_schedule_params(ch);
2727 timeslice_timeout);
2728} 2727}
2729 2728
2730int gk20a_channel_set_timeslice(struct channel_gk20a *ch, u32 timeslice) 2729int gk20a_channel_set_timeslice(struct channel_gk20a *ch, u32 timeslice)
@@ -2739,7 +2738,9 @@ int gk20a_channel_set_timeslice(struct channel_gk20a *ch, u32 timeslice)
2739 timeslice > NVGPU_CHANNEL_MAX_TIMESLICE_US) 2738 timeslice > NVGPU_CHANNEL_MAX_TIMESLICE_US)
2740 return -EINVAL; 2739 return -EINVAL;
2741 2740
2742 return channel_gk20a_set_schedule_params(ch, timeslice); 2741 ch->timeslice_us = timeslice;
2742
2743 return channel_gk20a_set_schedule_params(ch);
2743} 2744}
2744 2745
2745static int gk20a_channel_zcull_bind(struct channel_gk20a *ch, 2746static int gk20a_channel_zcull_bind(struct channel_gk20a *ch,
@@ -3059,6 +3060,8 @@ long gk20a_channel_ioctl(struct file *filp,
3059 gk20a_dbg(gpu_dbg_gpu_dbg, "setting timeout (%d ms) for chid %d", 3060 gk20a_dbg(gpu_dbg_gpu_dbg, "setting timeout (%d ms) for chid %d",
3060 timeout, ch->hw_chid); 3061 timeout, ch->hw_chid);
3061 ch->timeout_ms_max = timeout; 3062 ch->timeout_ms_max = timeout;
3063
3064 trace_gk20a_channel_set_timeout(GK20A_TP_ARGS_SCHED(ch));
3062 break; 3065 break;
3063 } 3066 }
3064 case NVGPU_IOCTL_CHANNEL_SET_TIMEOUT_EX: 3067 case NVGPU_IOCTL_CHANNEL_SET_TIMEOUT_EX:
@@ -3072,6 +3075,8 @@ long gk20a_channel_ioctl(struct file *filp,
3072 timeout, ch->hw_chid); 3075 timeout, ch->hw_chid);
3073 ch->timeout_ms_max = timeout; 3076 ch->timeout_ms_max = timeout;
3074 ch->timeout_debug_dump = timeout_debug_dump; 3077 ch->timeout_debug_dump = timeout_debug_dump;
3078
3079 trace_gk20a_channel_set_timeout(GK20A_TP_ARGS_SCHED(ch));
3075 break; 3080 break;
3076 } 3081 }
3077 case NVGPU_IOCTL_CHANNEL_GET_TIMEDOUT: 3082 case NVGPU_IOCTL_CHANNEL_GET_TIMEDOUT:
@@ -3088,7 +3093,10 @@ long gk20a_channel_ioctl(struct file *filp,
3088 } 3093 }
3089 err = ch->g->ops.fifo.channel_set_priority(ch, 3094 err = ch->g->ops.fifo.channel_set_priority(ch,
3090 ((struct nvgpu_set_priority_args *)buf)->priority); 3095 ((struct nvgpu_set_priority_args *)buf)->priority);
3096
3091 gk20a_idle(dev); 3097 gk20a_idle(dev);
3098
3099 trace_gk20a_channel_set_priority(GK20A_TP_ARGS_SCHED(ch));
3092 break; 3100 break;
3093 case NVGPU_IOCTL_CHANNEL_ENABLE: 3101 case NVGPU_IOCTL_CHANNEL_ENABLE:
3094 err = gk20a_busy(dev); 3102 err = gk20a_busy(dev);
@@ -3172,7 +3180,10 @@ long gk20a_channel_ioctl(struct file *filp,
3172 } 3180 }
3173 err = gk20a_channel_set_runlist_interleave(ch, 3181 err = gk20a_channel_set_runlist_interleave(ch,
3174 ((struct nvgpu_runlist_interleave_args *)buf)->level); 3182 ((struct nvgpu_runlist_interleave_args *)buf)->level);
3183
3175 gk20a_idle(dev); 3184 gk20a_idle(dev);
3185
3186 trace_gk20a_channel_set_runlist_interleave(GK20A_TP_ARGS_SCHED(ch));
3176 break; 3187 break;
3177 case NVGPU_IOCTL_CHANNEL_SET_TIMESLICE: 3188 case NVGPU_IOCTL_CHANNEL_SET_TIMESLICE:
3178 err = gk20a_busy(dev); 3189 err = gk20a_busy(dev);
@@ -3184,7 +3195,10 @@ long gk20a_channel_ioctl(struct file *filp,
3184 } 3195 }
3185 err = ch->g->ops.fifo.channel_set_timeslice(ch, 3196 err = ch->g->ops.fifo.channel_set_timeslice(ch,
3186 ((struct nvgpu_timeslice_args *)buf)->timeslice_us); 3197 ((struct nvgpu_timeslice_args *)buf)->timeslice_us);
3198
3187 gk20a_idle(dev); 3199 gk20a_idle(dev);
3200
3201 trace_gk20a_channel_set_timeslice(GK20A_TP_ARGS_SCHED(ch));
3188 break; 3202 break;
3189 default: 3203 default:
3190 dev_dbg(dev, "unrecognized ioctl cmd: 0x%x", cmd); 3204 dev_dbg(dev, "unrecognized ioctl cmd: 0x%x", cmd);