summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gk20a/gk20a.c
diff options
context:
space:
mode:
authorThomas Fleury <tfleury@nvidia.com>2016-05-10 12:05:45 -0400
committerVijayakumar Subbu <vsubbu@nvidia.com>2016-07-19 02:12:51 -0400
commitc8ffe0fdecfa110a9f9beb1b7e0298d3c3c64cc2 (patch)
tree08054741c436ab6a783e710a9efa87fc7a0b71df /drivers/gpu/nvgpu/gk20a/gk20a.c
parent90988af81237d3b56c063b750c32efcbee9ab9cc (diff)
gpu: nvgpu: add sched control API
Added a dedicated device node to allow an app manager to control TSG scheduling parameters: - Get list of TSGs - Get list of recent TSGs - Get list of TSGs per pid - Get TSG current scheduling parameters - Set TSG timeslice - Set TSG runlist interleave Jira VFND-1586 Change-Id: I014c9d1534bce0eaea6c25ad114cf0cff317af79 Signed-off-by: Thomas Fleury <tfleury@nvidia.com> Reviewed-on: http://git-master/r/1160384 (cherry picked from commit 75ca739517cc7f7f76714b5f6a1a57c39b8cb38e) Reviewed-on: http://git-master/r/1167021 Reviewed-by: Richard Zhao <rizhao@nvidia.com> GVS: Gerrit_Virtual_Submit Reviewed-by: Alex Waterman <alexw@nvidia.com> Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/gk20a.c')
-rw-r--r--drivers/gpu/nvgpu/gk20a/gk20a.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.c b/drivers/gpu/nvgpu/gk20a/gk20a.c
index 9255c847..822cd3ff 100644
--- a/drivers/gpu/nvgpu/gk20a/gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/gk20a.c
@@ -246,6 +246,18 @@ static const struct file_operations gk20a_ctxsw_ops = {
246 .mmap = gk20a_ctxsw_dev_mmap, 246 .mmap = gk20a_ctxsw_dev_mmap,
247}; 247};
248 248
249static const struct file_operations gk20a_sched_ops = {
250 .owner = THIS_MODULE,
251 .release = gk20a_sched_dev_release,
252 .open = gk20a_sched_dev_open,
253#ifdef CONFIG_COMPAT
254 .compat_ioctl = gk20a_sched_dev_ioctl,
255#endif
256 .unlocked_ioctl = gk20a_sched_dev_ioctl,
257 .poll = gk20a_sched_dev_poll,
258 .read = gk20a_sched_dev_read,
259};
260
249static inline void sim_writel(struct gk20a *g, u32 r, u32 v) 261static inline void sim_writel(struct gk20a *g, u32 r, u32 v)
250{ 262{
251 writel(v, g->sim.regs+r); 263 writel(v, g->sim.regs+r);
@@ -965,6 +977,12 @@ int gk20a_pm_finalize_poweron(struct device *dev)
965 if (err) 977 if (err)
966 gk20a_warn(dev, "could not initialize ctxsw tracing"); 978 gk20a_warn(dev, "could not initialize ctxsw tracing");
967 979
980 err = gk20a_sched_ctrl_init(g);
981 if (err) {
982 gk20a_err(dev, "failed to init sched control");
983 goto done;
984 }
985
968 /* Restore the debug setting */ 986 /* Restore the debug setting */
969 g->ops.mm.set_debug_mode(g, g->mmu_debug_ctrl); 987 g->ops.mm.set_debug_mode(g, g->mmu_debug_ctrl);
970 988
@@ -1101,6 +1119,11 @@ void gk20a_user_deinit(struct device *dev, struct class *class)
1101 cdev_del(&g->ctxsw.cdev); 1119 cdev_del(&g->ctxsw.cdev);
1102 } 1120 }
1103 1121
1122 if (g->sched.node) {
1123 device_destroy(&nvgpu_class, g->sched.cdev.dev);
1124 cdev_del(&g->sched.cdev);
1125 }
1126
1104 if (g->cdev_region) 1127 if (g->cdev_region)
1105 unregister_chrdev_region(g->cdev_region, GK20A_NUM_CDEVS); 1128 unregister_chrdev_region(g->cdev_region, GK20A_NUM_CDEVS);
1106} 1129}
@@ -1170,6 +1193,12 @@ int gk20a_user_init(struct device *dev, const char *interface_name,
1170 goto fail; 1193 goto fail;
1171#endif 1194#endif
1172 1195
1196 err = gk20a_create_device(dev, devno++, interface_name, "-sched",
1197 &g->sched.cdev, &g->sched.node,
1198 &gk20a_sched_ops,
1199 class);
1200 if (err)
1201 goto fail;
1173 1202
1174 return 0; 1203 return 0;
1175fail: 1204fail:
@@ -1632,6 +1661,7 @@ static int gk20a_probe(struct platform_device *dev)
1632 gk20a_alloc_debugfs_init(dev); 1661 gk20a_alloc_debugfs_init(dev);
1633 gk20a_mm_debugfs_init(&dev->dev); 1662 gk20a_mm_debugfs_init(&dev->dev);
1634 gk20a_fifo_debugfs_init(&dev->dev); 1663 gk20a_fifo_debugfs_init(&dev->dev);
1664 gk20a_sched_debugfs_init(&dev->dev);
1635#endif 1665#endif
1636 1666
1637 gk20a_init_gr(gk20a); 1667 gk20a_init_gr(gk20a);
@@ -1655,6 +1685,8 @@ static int __exit gk20a_remove(struct platform_device *pdev)
1655 1685
1656 gk20a_ctxsw_trace_cleanup(g); 1686 gk20a_ctxsw_trace_cleanup(g);
1657 1687
1688 gk20a_sched_ctrl_cleanup(g);
1689
1658 if (IS_ENABLED(CONFIG_GK20A_DEVFREQ)) 1690 if (IS_ENABLED(CONFIG_GK20A_DEVFREQ))
1659 gk20a_scale_exit(dev); 1691 gk20a_scale_exit(dev);
1660 1692