From 733fb79b39869665addcd80ccdf1c15f4a5aaa29 Mon Sep 17 00:00:00 2001 From: Sachit Kadle Date: Mon, 15 Aug 2016 14:32:39 -0700 Subject: gpu: nvgpu: add support for pre-allocated resources Add support for pre-allocation of job tracking resources w/ new (extended) ioctl. Goal is to avoid dynamic memory allocation in the submit path. This patch does the following: 1) Intoduces a new ioctl, NVGPU_IOCTL_CHANNEL_ALLOC_GPFIFO_EX, which enables pre-allocation of tracking resources per job: a) 2x priv_cmd_entry b) 2x gk20a_fence 2) Implements circular ring buffer for job tracking to avoid lock contention between producer (submitter) and consumer (clean-up) Bug 1795076 Change-Id: I6b52e5c575871107ff380f9a5790f440a6969347 Signed-off-by: Sachit Kadle Reviewed-on: http://git-master/r/1203300 (cherry picked from commit 9fd270c22b860935dffe244753dabd87454bef39) Reviewed-on: http://git-master/r/1223934 Reviewed-by: mobile promotions Tested-by: mobile promotions --- include/uapi/linux/nvgpu.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'include') diff --git a/include/uapi/linux/nvgpu.h b/include/uapi/linux/nvgpu.h index 0bf88628..22e357b6 100644 --- a/include/uapi/linux/nvgpu.h +++ b/include/uapi/linux/nvgpu.h @@ -963,7 +963,13 @@ struct nvgpu_alloc_gpfifo_args { __u32 num_entries; #define NVGPU_ALLOC_GPFIFO_FLAGS_VPR_ENABLED (1 << 0) /* set owner channel of this gpfifo as a vpr channel */ __u32 flags; +}; +struct nvgpu_alloc_gpfifo_ex_args { + __u32 num_entries; + __u32 num_inflight_jobs; + __u32 flags; + __u32 reserved[5]; }; struct gk20a_sync_pt_info { @@ -1182,6 +1188,8 @@ struct nvgpu_preemption_mode_args { _IOWR(NVGPU_IOCTL_MAGIC, 18, struct nvgpu_set_timeout_ex_args) #define NVGPU_IOCTL_CHANNEL_ALLOC_GPFIFO \ _IOW(NVGPU_IOCTL_MAGIC, 100, struct nvgpu_alloc_gpfifo_args) +#define NVGPU_IOCTL_CHANNEL_ALLOC_GPFIFO_EX \ + _IOW(NVGPU_IOCTL_MAGIC, 101, struct nvgpu_alloc_gpfifo_ex_args) #define NVGPU_IOCTL_CHANNEL_WAIT \ _IOWR(NVGPU_IOCTL_MAGIC, 102, struct nvgpu_wait_args) #define NVGPU_IOCTL_CHANNEL_CYCLE_STATS \ -- cgit v1.2.2