From dfac8ce70464413c0e3748634c57d49950e71933 Mon Sep 17 00:00:00 2001 From: Deepak Nibade Date: Tue, 29 Mar 2016 15:01:25 +0530 Subject: gpu: nvgpu: support binding multiple channels to a debug session We currently bind only one channel to a debug session But some use cases might need multiple channels bound to same debug session Add this support by adding a list of channels to debug session. List structure is implemented as struct dbg_session_channel_data List node dbg_s_list_node is currently defined in struct dbg_session_gk20a. But this is inefficient when we need to add debug session to multiple channels Hence add new reference structure dbg_session_data to store dbg_session pointer and list entry For each NVGPU_DBG_GPU_IOCTL_BIND_CHANNEL call, create two reference structure dbg_session_channel_data for channel and dbg_session_data for debug session and bind them together Define API nvgpu_dbg_gpu_get_session_channel() which will get first channel in the list of debug session Use this API wherever we refer to channel bound to debug session Remove dbg_sessions define in struct gk20a since it is not being used anywhere Add new API NVGPU_DBG_GPU_IOCTL_UNBIND_CHANNEL to support unbinding of channel from debug sesssion Bug 200156699 Change-Id: I3bfa6f9cd5b90e7254a75c7e64ac893739776b7f Signed-off-by: Deepak Nibade Reviewed-on: http://git-master/r/1120331 GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom --- include/uapi/linux/nvgpu.h | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'include/uapi/linux') diff --git a/include/uapi/linux/nvgpu.h b/include/uapi/linux/nvgpu.h index 89871b53..36616913 100644 --- a/include/uapi/linux/nvgpu.h +++ b/include/uapi/linux/nvgpu.h @@ -496,8 +496,7 @@ struct nvgpu_gpu_get_gpu_time_args { * Binding/attaching a debugger session to an nvgpu channel * * The 'channel_fd' given here is the fd used to allocate the - * gpu channel context. To detach/unbind the debugger session - * use a channel_fd of -1. + * gpu channel context. * */ struct nvgpu_dbg_gpu_bind_channel_args { @@ -510,6 +509,8 @@ struct nvgpu_dbg_gpu_bind_channel_args { /* * Register operations + * All operations are targeted towards first channel + * attached to debug session */ /* valid op values */ #define NVGPU_DBG_GPU_REG_OP_READ_32 (0x00000000) @@ -722,9 +723,23 @@ struct nvgpu_dbg_gpu_write_single_sm_error_state_args { #define NVGPU_DBG_GPU_IOCTL_WRITE_SINGLE_SM_ERROR_STATE \ _IOW(NVGPU_DBG_GPU_IOCTL_MAGIC, 16, struct nvgpu_dbg_gpu_write_single_sm_error_state_args) +/* + * Unbinding/detaching a debugger session from a nvgpu channel + * + * The 'channel_fd' given here is the fd used to allocate the + * gpu channel context. + */ +struct nvgpu_dbg_gpu_unbind_channel_args { + __u32 channel_fd; /* in */ + __u32 _pad0[1]; +}; + +#define NVGPU_DBG_GPU_IOCTL_UNBIND_CHANNEL \ + _IOW(NVGPU_DBG_GPU_IOCTL_MAGIC, 17, struct nvgpu_dbg_gpu_unbind_channel_args) + #define NVGPU_DBG_GPU_IOCTL_LAST \ - _IOC_NR(NVGPU_DBG_GPU_IOCTL_WRITE_SINGLE_SM_ERROR_STATE) + _IOC_NR(NVGPU_DBG_GPU_IOCTL_UNBIND_CHANNEL) #define NVGPU_DBG_GPU_IOCTL_MAX_ARG_SIZE \ sizeof(struct nvgpu_dbg_gpu_perfbuf_map_args) -- cgit v1.2.2