From d868b654419cfa096f563c9281a2a5cc067c23db Mon Sep 17 00:00:00 2001 From: Deepak Nibade Date: Tue, 19 Apr 2016 16:57:49 +0530 Subject: gpu: nvgpu: separate IOCTL to set preemption mode Add separate IOCTL NVGPU_IOCTL_CHANNEL_SET_PREEMPTION_MODE to allow setting preemption modes from UMD Define preemption modes in nvgpu.h and use them everywhere Remove mode definitions from mm_gk20a.h Also, we support setting only one preemption mode in a channel But it is possible to have multiple preemption modes (one from graphics and one from compute) set simultaneously Hence, update struct gr_ctx_desc to include two separate preemption modes (graphics_preempt_mode and compute_preempt_mode) API NVGPU_IOCTL_CHANNEL_SET_PREEMPTION_MODE also supports setting two separate preemption modes i.e. one for graphics and one for compute Make necessary changes in code to support two preemption modes Bug 1646259 Change-Id: Ia1dea19e609ba8cc0de2f39ab6c0c4cd6b0a752c Signed-off-by: Deepak Nibade Reviewed-on: http://git-master/r/1131805 Reviewed-by: Terje Bergstrom Tested-by: Terje Bergstrom --- include/uapi/linux/nvgpu.h | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'include/uapi') diff --git a/include/uapi/linux/nvgpu.h b/include/uapi/linux/nvgpu.h index b8bd21f2..8ebe8d06 100644 --- a/include/uapi/linux/nvgpu.h +++ b/include/uapi/linux/nvgpu.h @@ -999,6 +999,16 @@ struct nvgpu_event_id_ctrl_args { #define NVGPU_IOCTL_CHANNEL_EVENT_ID_CMD_ENABLE 1 +struct nvgpu_preemption_mode_args { +/* only one should be enabled at a time */ +#define NVGPU_GRAPHICS_PREEMPTION_MODE_WFI BIT(0) + __u32 graphics_preempt_mode; /* in */ + +/* only one should be enabled at a time */ +#define NVGPU_COMPUTE_PREEMPTION_MODE_WFI BIT(0) +#define NVGPU_COMPUTE_PREEMPTION_MODE_CTA BIT(1) + __u32 compute_preempt_mode; /* in */ +}; #define NVGPU_IOCTL_CHANNEL_SET_NVMAP_FD \ _IOW(NVGPU_IOCTL_MAGIC, 5, struct nvgpu_set_nvmap_fd_args) @@ -1046,9 +1056,11 @@ struct nvgpu_event_id_ctrl_args { _IOW(NVGPU_IOCTL_MAGIC, 120, struct nvgpu_runlist_interleave_args) #define NVGPU_IOCTL_CHANNEL_SET_TIMESLICE \ _IOW(NVGPU_IOCTL_MAGIC, 121, struct nvgpu_timeslice_args) +#define NVGPU_IOCTL_CHANNEL_SET_PREEMPTION_MODE \ + _IOW(NVGPU_IOCTL_MAGIC, 122, struct nvgpu_preemption_mode_args) #define NVGPU_IOCTL_CHANNEL_LAST \ - _IOC_NR(NVGPU_IOCTL_CHANNEL_SET_TIMESLICE) + _IOC_NR(NVGPU_IOCTL_CHANNEL_SET_PREEMPTION_MODE) #define NVGPU_IOCTL_CHANNEL_MAX_ARG_SIZE sizeof(struct nvgpu_submit_gpfifo_args) /* -- cgit v1.2.2