summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gk20a/channel_gk20a.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/channel_gk20a.c')
-rw-r--r--drivers/gpu/nvgpu/gk20a/channel_gk20a.c35
1 files changed, 26 insertions, 9 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c
index 2dc8e9a0..92b4b3de 100644
--- a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c
@@ -136,8 +136,10 @@ static int channel_gk20a_set_schedule_params(struct channel_gk20a *c,
136 u32 timeslice_timeout) 136 u32 timeslice_timeout)
137{ 137{
138 void *inst_ptr; 138 void *inst_ptr;
139 struct gk20a_platform *platform = platform_get_drvdata(c->g->dev);
139 int shift = 3; 140 int shift = 3;
140 int value = timeslice_timeout; 141 int value = scale_ptimer(timeslice_timeout,
142 platform->ptimerscaling10x);
141 143
142 inst_ptr = c->inst_block.cpu_va; 144 inst_ptr = c->inst_block.cpu_va;
143 if (!inst_ptr) 145 if (!inst_ptr)
@@ -1474,8 +1476,11 @@ bool gk20a_channel_update_and_check_timeout(struct channel_gk20a *ch,
1474 1476
1475static u32 gk20a_get_channel_watchdog_timeout(struct channel_gk20a *ch) 1477static u32 gk20a_get_channel_watchdog_timeout(struct channel_gk20a *ch)
1476{ 1478{
1477 if (ch->g->timeouts_enabled && ch->g->ch_wdt_enabled) 1479 struct gk20a_platform *platform = gk20a_get_platform(ch->g->dev);
1478 return NVGPU_CHANNEL_WATCHDOG_DEFAULT_TIMEOUT_MS; 1480
1481 if (ch->g->timeouts_enabled && ch->g->ch_wdt_enabled &&
1482 platform->ch_wdt_timeout_ms)
1483 return platform->ch_wdt_timeout_ms;
1479 else 1484 else
1480 return (u32)MAX_SCHEDULE_TIMEOUT; 1485 return (u32)MAX_SCHEDULE_TIMEOUT;
1481} 1486}
@@ -1568,6 +1573,21 @@ static void gk20a_channel_timeout_stop(struct channel_gk20a *ch)
1568 mutex_unlock(&ch->timeout.lock); 1573 mutex_unlock(&ch->timeout.lock);
1569} 1574}
1570 1575
1576void gk20a_channel_timeout_stop_all_channels(struct gk20a *g)
1577{
1578 u32 chid;
1579 struct fifo_gk20a *f = &g->fifo;
1580
1581 for (chid = 0; chid < f->num_channels; chid++) {
1582 struct channel_gk20a *ch = &f->channel[chid];
1583
1584 if (gk20a_channel_get(ch)) {
1585 gk20a_channel_timeout_stop(ch);
1586 gk20a_channel_put(ch);
1587 }
1588 }
1589}
1590
1571static void gk20a_channel_timeout_handler(struct work_struct *work) 1591static void gk20a_channel_timeout_handler(struct work_struct *work)
1572{ 1592{
1573 struct channel_gk20a_job *job; 1593 struct channel_gk20a_job *job;
@@ -2339,16 +2359,13 @@ static int gk20a_channel_set_priority(struct channel_gk20a *ch,
2339 /* set priority of graphics channel */ 2359 /* set priority of graphics channel */
2340 switch (priority) { 2360 switch (priority) {
2341 case NVGPU_PRIORITY_LOW: 2361 case NVGPU_PRIORITY_LOW:
2342 /* 64 << 3 = 512us */ 2362 timeslice_timeout = ch->g->timeslice_low_priority_us;
2343 timeslice_timeout = 64;
2344 break; 2363 break;
2345 case NVGPU_PRIORITY_MEDIUM: 2364 case NVGPU_PRIORITY_MEDIUM:
2346 /* 128 << 3 = 1024us */ 2365 timeslice_timeout = ch->g->timeslice_medium_priority_us;
2347 timeslice_timeout = 128;
2348 break; 2366 break;
2349 case NVGPU_PRIORITY_HIGH: 2367 case NVGPU_PRIORITY_HIGH:
2350 /* 255 << 3 = 2048us */ 2368 timeslice_timeout = ch->g->timeslice_high_priority_us;
2351 timeslice_timeout = 255;
2352 break; 2369 break;
2353 default: 2370 default:
2354 pr_err("Unsupported priority"); 2371 pr_err("Unsupported priority");