summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/gpu/nvgpu/gk20a/gk20a.h1
-rw-r--r--drivers/gpu/nvgpu/gk20a/tsg_gk20a.c3
-rw-r--r--drivers/gpu/nvgpu/vgpu/tsg_vgpu.c22
-rw-r--r--include/linux/tegra_vgpu.h7
4 files changed, 32 insertions, 1 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.h b/drivers/gpu/nvgpu/gk20a/gk20a.h
index 6f47f228..36bc0fb7 100644
--- a/drivers/gpu/nvgpu/gk20a/gk20a.h
+++ b/drivers/gpu/nvgpu/gk20a/gk20a.h
@@ -340,6 +340,7 @@ struct gpu_ops {
340 u32 new_level); 340 u32 new_level);
341 int (*channel_set_timeslice)(struct channel_gk20a *ch, 341 int (*channel_set_timeslice)(struct channel_gk20a *ch,
342 u32 timeslice); 342 u32 timeslice);
343 int (*tsg_set_timeslice)(struct tsg_gk20a *tsg, u32 timeslice);
343 int (*force_reset_ch)(struct channel_gk20a *ch, bool verbose); 344 int (*force_reset_ch)(struct channel_gk20a *ch, bool verbose);
344 int (*engine_enum_from_type)(struct gk20a *g, u32 engine_type, 345 int (*engine_enum_from_type)(struct gk20a *g, u32 engine_type,
345 u32 *inst_id); 346 u32 *inst_id);
diff --git a/drivers/gpu/nvgpu/gk20a/tsg_gk20a.c b/drivers/gpu/nvgpu/gk20a/tsg_gk20a.c
index 1e479395..5298d380 100644
--- a/drivers/gpu/nvgpu/gk20a/tsg_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/tsg_gk20a.c
@@ -582,7 +582,7 @@ long gk20a_tsg_dev_ioctl(struct file *filp, unsigned int cmd,
582 "failed to host gk20a for ioctl cmd: 0x%x", cmd); 582 "failed to host gk20a for ioctl cmd: 0x%x", cmd);
583 return err; 583 return err;
584 } 584 }
585 err = gk20a_tsg_set_timeslice(tsg, 585 err = g->ops.fifo.tsg_set_timeslice(tsg,
586 ((struct nvgpu_timeslice_args *)buf)->timeslice_us); 586 ((struct nvgpu_timeslice_args *)buf)->timeslice_us);
587 gk20a_idle(g->dev); 587 gk20a_idle(g->dev);
588 break; 588 break;
@@ -607,4 +607,5 @@ void gk20a_init_tsg_ops(struct gpu_ops *gops)
607{ 607{
608 gops->fifo.tsg_bind_channel = gk20a_tsg_bind_channel; 608 gops->fifo.tsg_bind_channel = gk20a_tsg_bind_channel;
609 gops->fifo.tsg_unbind_channel = gk20a_tsg_unbind_channel; 609 gops->fifo.tsg_unbind_channel = gk20a_tsg_unbind_channel;
610 gops->fifo.tsg_set_timeslice = gk20a_tsg_set_timeslice;
610} 611}
diff --git a/drivers/gpu/nvgpu/vgpu/tsg_vgpu.c b/drivers/gpu/nvgpu/vgpu/tsg_vgpu.c
index 9245693d..820a3db3 100644
--- a/drivers/gpu/nvgpu/vgpu/tsg_vgpu.c
+++ b/drivers/gpu/nvgpu/vgpu/tsg_vgpu.c
@@ -78,8 +78,30 @@ static int vgpu_tsg_unbind_channel(struct channel_gk20a *ch)
78 return err; 78 return err;
79} 79}
80 80
81static int vgpu_tsg_set_timeslice(struct tsg_gk20a *tsg, u32 timeslice)
82{
83 struct gk20a_platform *platform = gk20a_get_platform(tsg->g->dev);
84 struct tegra_vgpu_cmd_msg msg = {0};
85 struct tegra_vgpu_tsg_timeslice_params *p =
86 &msg.params.tsg_timeslice;
87 int err;
88
89 gk20a_dbg_fn("");
90
91 msg.cmd = TEGRA_VGPU_CMD_TSG_SET_TIMESLICE;
92 msg.handle = platform->virt_handle;
93 p->tsg_id = tsg->tsgid;
94 p->timeslice_us = timeslice;
95 err = vgpu_comm_sendrecv(&msg, sizeof(msg), sizeof(msg));
96 err = err ? err : msg.ret;
97 WARN_ON(err);
98
99 return err;
100}
101
81void vgpu_init_tsg_ops(struct gpu_ops *gops) 102void vgpu_init_tsg_ops(struct gpu_ops *gops)
82{ 103{
83 gops->fifo.tsg_bind_channel = vgpu_tsg_bind_channel; 104 gops->fifo.tsg_bind_channel = vgpu_tsg_bind_channel;
84 gops->fifo.tsg_unbind_channel = vgpu_tsg_unbind_channel; 105 gops->fifo.tsg_unbind_channel = vgpu_tsg_unbind_channel;
106 gops->fifo.tsg_set_timeslice = vgpu_tsg_set_timeslice;
85} 107}
diff --git a/include/linux/tegra_vgpu.h b/include/linux/tegra_vgpu.h
index bdaabf29..706d87e4 100644
--- a/include/linux/tegra_vgpu.h
+++ b/include/linux/tegra_vgpu.h
@@ -91,6 +91,7 @@ enum {
91 TEGRA_VGPU_CMD_TSG_BIND_CHANNEL, 91 TEGRA_VGPU_CMD_TSG_BIND_CHANNEL,
92 TEGRA_VGPU_CMD_TSG_UNBIND_CHANNEL, 92 TEGRA_VGPU_CMD_TSG_UNBIND_CHANNEL,
93 TEGRA_VGPU_CMD_TSG_PREEMPT, 93 TEGRA_VGPU_CMD_TSG_PREEMPT,
94 TEGRA_VGPU_CMD_TSG_SET_TIMESLICE,
94}; 95};
95 96
96struct tegra_vgpu_connect_params { 97struct tegra_vgpu_connect_params {
@@ -373,6 +374,11 @@ struct tegra_vgpu_tsg_preempt_params {
373 u32 tsg_id; 374 u32 tsg_id;
374}; 375};
375 376
377struct tegra_vgpu_tsg_timeslice_params {
378 u32 tsg_id;
379 u32 timeslice_us;
380};
381
376struct tegra_vgpu_cmd_msg { 382struct tegra_vgpu_cmd_msg {
377 u32 cmd; 383 u32 cmd;
378 int ret; 384 int ret;
@@ -411,6 +417,7 @@ struct tegra_vgpu_cmd_msg {
411 struct tegra_vgpu_tsg_bind_gr_ctx_params tsg_bind_gr_ctx; 417 struct tegra_vgpu_tsg_bind_gr_ctx_params tsg_bind_gr_ctx;
412 struct tegra_vgpu_tsg_bind_unbind_channel_params tsg_bind_unbind_channel; 418 struct tegra_vgpu_tsg_bind_unbind_channel_params tsg_bind_unbind_channel;
413 struct tegra_vgpu_tsg_preempt_params tsg_preempt; 419 struct tegra_vgpu_tsg_preempt_params tsg_preempt;
420 struct tegra_vgpu_tsg_timeslice_params tsg_timeslice;
414 char padding[192]; 421 char padding[192];
415 } params; 422 } params;
416}; 423};