From 58ee7561f72653aea8acece9f5d33ff8fe6fb99d Mon Sep 17 00:00:00 2001 From: Debarshi Dutta Date: Wed, 7 Aug 2019 11:57:28 +0530 Subject: gpu: nvgpu: Add CHANNEL_SETUP_BIND IOCTL For a long time now, the ALLOC_GPFIFO_EX channel IOCTL has done much more than just gpfifo allocation, and its signature does not match support that's needed soon. Add a new one called SETUP_BIND to hopefully cover our future needs and deprecate ALLOC_GPFIFO_EX. Change nvgpu internals to match this new naming as well. Bug 200145225 Bug 200541476 Change-Id: I766f9283a064e140656f6004b2b766db70bd6cad Signed-off-by: Konsta Holtta Reviewed-on: https://git-master.nvidia.com/r/1835186 Signed-off-by: Debarshi Dutta (cherry-picked from e0c8a16c8d474eac6723fea3980833873ab921a6 in dev-main) Reviewed-on: https://git-master.nvidia.com/r/2169882 GVS: Gerrit_Virtual_Submit Reviewed-by: Bibek Basu Reviewed-by: mobile promotions Tested-by: mobile promotions --- include/uapi/linux/nvgpu.h | 36 +++++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 11 deletions(-) (limited to 'include') diff --git a/include/uapi/linux/nvgpu.h b/include/uapi/linux/nvgpu.h index 1d803ae9..0fa04f6b 100644 --- a/include/uapi/linux/nvgpu.h +++ b/include/uapi/linux/nvgpu.h @@ -1468,22 +1468,32 @@ struct nvgpu_alloc_obj_ctx_args { __u64 obj_id; /* output, used to free later */ }; +/* Deprecated. Use the SETUP_BIND IOCTL instead. */ 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 */ -/* - * this flag is used in struct nvgpu_alloc_gpfifo_args - * to enable re-playable faults for that channel - */ +#define NVGPU_ALLOC_GPFIFO_FLAGS_VPR_ENABLED (1 << 0) #define NVGPU_ALLOC_GPFIFO_FLAGS_REPLAYABLE_FAULTS_ENABLE (1 << 2) __u32 flags; }; +/* Deprecated. Use the SETUP_BIND IOCTL instead. */ struct nvgpu_alloc_gpfifo_ex_args { __u32 num_entries; __u32 num_inflight_jobs; -/* Set owner channel of this gpfifo as a vpr channel. */ #define NVGPU_ALLOC_GPFIFO_EX_FLAGS_VPR_ENABLED (1 << 0) +#define NVGPU_ALLOC_GPFIFO_EX_FLAGS_DETERMINISTIC (1 << 1) + __u32 flags; + __u32 reserved[5]; +}; + +/* + * Setup the channel and bind it (enable). + */ +struct nvgpu_channel_setup_bind_args { + __u32 num_gpfifo_entries; + __u32 num_inflight_jobs; +/* Set owner channel of this gpfifo as a vpr channel. */ +#define NVGPU_CHANNEL_SETUP_BIND_FLAGS_VPR_ENABLED (1 << 0) /* * Channel shall exhibit deterministic behavior in the submit path. * @@ -1501,11 +1511,12 @@ struct nvgpu_alloc_gpfifo_ex_args { * NVGPU_GPU_FLAGS_SUPPORT_DETERMINISTIC_SUBMIT_NO_JOBTRACKING; this flag or * num_inflight_jobs are not necessary in that case. */ -#define NVGPU_ALLOC_GPFIFO_EX_FLAGS_DETERMINISTIC (1 << 1) +#define NVGPU_CHANNEL_SETUP_BIND_FLAGS_DETERMINISTIC (1 << 1) +/* enable replayable gmmu faults for this channel */ +#define NVGPU_CHANNEL_SETUP_BIND_FLAGS_REPLAYABLE_FAULTS_ENABLE (1 << 2) __u32 flags; - __u32 reserved[5]; + __u32 reserved[16]; }; - struct nvgpu_fence { __u32 id; /* syncpoint id or sync fence fd */ __u32 value; /* syncpoint value (discarded when using sync fence) */ @@ -1763,10 +1774,13 @@ struct nvgpu_reschedule_runlist_args { _IOR(NVGPU_IOCTL_MAGIC, 126, struct nvgpu_get_user_syncpoint_args) #define NVGPU_IOCTL_CHANNEL_RESCHEDULE_RUNLIST \ _IOW(NVGPU_IOCTL_MAGIC, 127, struct nvgpu_reschedule_runlist_args) +#define NVGPU_IOCTL_CHANNEL_SETUP_BIND \ + _IOWR(NVGPU_IOCTL_MAGIC, 128, struct nvgpu_channel_setup_bind_args) #define NVGPU_IOCTL_CHANNEL_LAST \ - _IOC_NR(NVGPU_IOCTL_CHANNEL_RESCHEDULE_RUNLIST) -#define NVGPU_IOCTL_CHANNEL_MAX_ARG_SIZE sizeof(struct nvgpu_alloc_gpfifo_ex_args) + _IOC_NR(NVGPU_IOCTL_CHANNEL_SETUP_BIND) +#define NVGPU_IOCTL_CHANNEL_MAX_ARG_SIZE \ + sizeof(struct nvgpu_channel_setup_bind_args) /* * /dev/nvhost-as-gpu device -- cgit v1.2.2