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 --- drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.h | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) (limited to 'drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.h') diff --git a/drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.h b/drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.h index 0ff6cfb3..d569a6cd 100644 --- a/drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.h @@ -31,6 +31,9 @@ int gk20a_prof_gpu_dev_open(struct inode *inode, struct file *filp); /* used by the interrupt handler to post events */ void gk20a_dbg_gpu_post_events(struct channel_gk20a *fault_ch); +struct channel_gk20a * +nvgpu_dbg_gpu_get_session_channel(struct dbg_session_gk20a *dbg_s); + struct dbg_gpu_session_ops { int (*exec_reg_ops)(struct dbg_session_gk20a *dbg_s, struct nvgpu_dbg_gpu_reg_op *ops, @@ -68,22 +71,37 @@ struct dbg_session_gk20a { struct device *dev; struct gk20a *g; - /* bound channel, if any */ - struct file *ch_f; - struct channel_gk20a *ch; + /* list of bound channels, if any */ + struct list_head ch_list; + struct mutex ch_list_lock; /* session operations */ struct dbg_gpu_session_ops *ops; /* event support */ struct dbg_gpu_session_events dbg_events; - struct list_head dbg_s_list_node; bool broadcast_stop_trigger; }; +struct dbg_session_data { + struct dbg_session_gk20a *dbg_s; + struct list_head dbg_s_entry; +}; + +struct dbg_session_channel_data { + struct file *ch_f; + int channel_fd; + int chid; + struct list_head ch_entry; + struct dbg_session_data *session_data; +}; + extern struct dbg_gpu_session_ops dbg_gpu_session_ops_gk20a; +int dbg_unbind_single_channel_gk20a(struct dbg_session_gk20a *dbg_s, + struct dbg_session_channel_data *ch_data); + bool gk20a_dbg_gpu_broadcast_stop_trigger(struct channel_gk20a *ch); int gk20a_dbg_gpu_clear_broadcast_stop_trigger(struct channel_gk20a *ch); -- cgit v1.2.2