From b03afb6d5c4bbca5a26cc95027491c816e5e1f6d Mon Sep 17 00:00:00 2001 From: Thomas Fleury Date: Wed, 19 Apr 2017 16:47:13 -0700 Subject: gpu: nvgpu: add ioctls to get current timeslice Add the following ioctls - NVGPU_CHANNEL_IOCTL_GET_TIMESLICE for channel timeslice in us - NVGPU_TSG_IOCTL_GET_TIMESLICE for TSG timeslice in us If timeslice has not been set explicitly, ioctl returns the default timeslice that will be used when programming the runlist entry. Bug 1883271 Change-Id: Ib18fdd836323b1a2d4efceb1e27d07713bd6fca5 Signed-off-by: Thomas Fleury Reviewed-on: http://git-master/r/1469040 Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/common/linux/ioctl_channel.c | 4 ++++ drivers/gpu/nvgpu/common/linux/ioctl_tsg.c | 12 ++++++++++++ 2 files changed, 16 insertions(+) (limited to 'drivers/gpu/nvgpu/common') diff --git a/drivers/gpu/nvgpu/common/linux/ioctl_channel.c b/drivers/gpu/nvgpu/common/linux/ioctl_channel.c index 8a87e4cb..4d4d1690 100644 --- a/drivers/gpu/nvgpu/common/linux/ioctl_channel.c +++ b/drivers/gpu/nvgpu/common/linux/ioctl_channel.c @@ -1125,6 +1125,10 @@ long gk20a_channel_ioctl(struct file *filp, gk20a_channel_trace_sched_param( trace_gk20a_channel_set_timeslice, ch); break; + case NVGPU_IOCTL_CHANNEL_GET_TIMESLICE: + ((struct nvgpu_timeslice_args *)buf)->timeslice_us = + gk20a_channel_get_timeslice(ch); + break; case NVGPU_IOCTL_CHANNEL_SET_PREEMPTION_MODE: if (ch->g->ops.gr.set_preemption_mode) { err = gk20a_busy(ch->g); diff --git a/drivers/gpu/nvgpu/common/linux/ioctl_tsg.c b/drivers/gpu/nvgpu/common/linux/ioctl_tsg.c index e67965e1..25805ea0 100644 --- a/drivers/gpu/nvgpu/common/linux/ioctl_tsg.c +++ b/drivers/gpu/nvgpu/common/linux/ioctl_tsg.c @@ -340,6 +340,12 @@ done: return err; } +static int gk20a_tsg_ioctl_get_timeslice(struct gk20a *g, + struct tsg_gk20a *tsg, struct nvgpu_timeslice_args *arg) +{ + arg->timeslice_us = gk20a_tsg_get_timeslice(tsg); + return 0; +} long nvgpu_ioctl_tsg_dev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) @@ -455,6 +461,12 @@ long nvgpu_ioctl_tsg_dev_ioctl(struct file *filp, unsigned int cmd, (struct nvgpu_timeslice_args *)buf); break; } + case NVGPU_IOCTL_TSG_GET_TIMESLICE: + { + err = gk20a_tsg_ioctl_get_timeslice(g, tsg, + (struct nvgpu_timeslice_args *)buf); + break; + } default: nvgpu_err(g, "unrecognized tsg gpu ioctl cmd: 0x%x", -- cgit v1.2.2