summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorKirill Artamonov <kartamonov@nvidia.com>2015-09-16 03:51:05 -0400
committerTerje Bergstrom <tbergstrom@nvidia.com>2015-10-06 16:31:10 -0400
commit3ad8438c906c815748886ea923320fae91ea2538 (patch)
tree079cd5e8d6d4ee4c05678a180023bb17c1ee93ec /drivers
parentd60a45b9fdd935c5e0c29c2cc3c056e0ce8c9873 (diff)
gpu: nvgpu: set correct timeslice value
Scale timeslice register value based on platform specific ptimer scale koefficient. Expose timeslice values through debugfs to simplify performance tuning. bug 1605552 bug 1603226 Change-Id: I49f86f22d58d26a366ee1b5f5a9ab9d7f896ad25 Signed-off-by: Kirill Artamonov <kartamonov@nvidia.com> Reviewed-on: http://git-master/r/800007 (cherry picked from commit 00c85ef24cf28ffaa81eb53fff7edef1c699220a) Reviewed-on: http://git-master/r/808251 GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com> Tested-by: Terje Bergstrom <tbergstrom@nvidia.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/nvgpu/gk20a/channel_gk20a.c13
-rw-r--r--drivers/gpu/nvgpu/gk20a/gk20a.c23
-rw-r--r--drivers/gpu/nvgpu/gk20a/gk20a.h9
3 files changed, 38 insertions, 7 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c
index 2dc8e9a0..29fec4fe 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)
@@ -2339,16 +2341,13 @@ static int gk20a_channel_set_priority(struct channel_gk20a *ch,
2339 /* set priority of graphics channel */ 2341 /* set priority of graphics channel */
2340 switch (priority) { 2342 switch (priority) {
2341 case NVGPU_PRIORITY_LOW: 2343 case NVGPU_PRIORITY_LOW:
2342 /* 64 << 3 = 512us */ 2344 timeslice_timeout = ch->g->timeslice_low_priority_us;
2343 timeslice_timeout = 64;
2344 break; 2345 break;
2345 case NVGPU_PRIORITY_MEDIUM: 2346 case NVGPU_PRIORITY_MEDIUM:
2346 /* 128 << 3 = 1024us */ 2347 timeslice_timeout = ch->g->timeslice_medium_priority_us;
2347 timeslice_timeout = 128;
2348 break; 2348 break;
2349 case NVGPU_PRIORITY_HIGH: 2349 case NVGPU_PRIORITY_HIGH:
2350 /* 255 << 3 = 2048us */ 2350 timeslice_timeout = ch->g->timeslice_high_priority_us;
2351 timeslice_timeout = 255;
2352 break; 2351 break;
2353 default: 2352 default:
2354 pr_err("Unsupported priority"); 2353 pr_err("Unsupported priority");
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.c b/drivers/gpu/nvgpu/gk20a/gk20a.c
index 6f650a3b..0cc29026 100644
--- a/drivers/gpu/nvgpu/gk20a/gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/gk20a.c
@@ -1460,6 +1460,10 @@ static int gk20a_probe(struct platform_device *dev)
1460 gk20a->timeouts_enabled = true; 1460 gk20a->timeouts_enabled = true;
1461 gk20a->ch_wdt_enabled = true; 1461 gk20a->ch_wdt_enabled = true;
1462 1462
1463 gk20a->timeslice_low_priority_us = 1300;
1464 gk20a->timeslice_medium_priority_us = 2600;
1465 gk20a->timeslice_high_priority_us = 5200;
1466
1463 /* Set up initial power settings. For non-slicon platforms, disable * 1467 /* Set up initial power settings. For non-slicon platforms, disable *
1464 * power features and for silicon platforms, read from platform data */ 1468 * power features and for silicon platforms, read from platform data */
1465 gk20a->slcg_enabled = 1469 gk20a->slcg_enabled =
@@ -1512,6 +1516,25 @@ static int gk20a_probe(struct platform_device *dev)
1512 S_IRUGO|S_IWUSR, 1516 S_IRUGO|S_IWUSR,
1513 platform->debugfs, 1517 platform->debugfs,
1514 &gk20a->mm.disable_bigpage); 1518 &gk20a->mm.disable_bigpage);
1519
1520 gk20a->debugfs_timeslice_low_priority_us =
1521 debugfs_create_u32("timeslice_low_priority_us",
1522 S_IRUGO|S_IWUSR,
1523 platform->debugfs,
1524 &gk20a->timeslice_low_priority_us);
1525
1526 gk20a->debugfs_timeslice_medium_priority_us =
1527 debugfs_create_u32("timeslice_medium_priority_us",
1528 S_IRUGO|S_IWUSR,
1529 platform->debugfs,
1530 &gk20a->timeslice_medium_priority_us);
1531
1532 gk20a->debugfs_timeslice_high_priority_us =
1533 debugfs_create_u32("timeslice_high_priority_us",
1534 S_IRUGO|S_IWUSR,
1535 platform->debugfs,
1536 &gk20a->timeslice_high_priority_us);
1537
1515 gr_gk20a_debugfs_init(gk20a); 1538 gr_gk20a_debugfs_init(gk20a);
1516 gk20a_pmu_debugfs_init(dev); 1539 gk20a_pmu_debugfs_init(dev);
1517 gk20a_cde_debugfs_init(dev); 1540 gk20a_cde_debugfs_init(dev);
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.h b/drivers/gpu/nvgpu/gk20a/gk20a.h
index 8290e7e7..bec2d2a0 100644
--- a/drivers/gpu/nvgpu/gk20a/gk20a.h
+++ b/drivers/gpu/nvgpu/gk20a/gk20a.h
@@ -491,6 +491,11 @@ struct gk20a {
491 u32 ch_wdt_enabled; 491 u32 ch_wdt_enabled;
492 struct mutex ch_wdt_lock; 492 struct mutex ch_wdt_lock;
493 493
494 /* Channel priorities */
495 u32 timeslice_low_priority_us;
496 u32 timeslice_medium_priority_us;
497 u32 timeslice_high_priority_us;
498
494 bool slcg_enabled; 499 bool slcg_enabled;
495 bool blcg_enabled; 500 bool blcg_enabled;
496 bool elcg_enabled; 501 bool elcg_enabled;
@@ -510,6 +515,10 @@ struct gk20a {
510 struct dentry *debugfs_bypass_smmu; 515 struct dentry *debugfs_bypass_smmu;
511 struct dentry *debugfs_disable_bigpage; 516 struct dentry *debugfs_disable_bigpage;
512 struct dentry *debugfs_gr_default_attrib_cb_size; 517 struct dentry *debugfs_gr_default_attrib_cb_size;
518
519 struct dentry * debugfs_timeslice_low_priority_us;
520 struct dentry * debugfs_timeslice_medium_priority_us;
521 struct dentry * debugfs_timeslice_high_priority_us;
513#endif 522#endif
514 struct gk20a_ctxsw_ucode_info ctxsw_ucode_info; 523 struct gk20a_ctxsw_ucode_info ctxsw_ucode_info;
515 524