diff options
author | Deepak Nibade <dnibade@nvidia.com> | 2016-03-29 05:31:25 -0400 |
---|---|---|
committer | Terje Bergstrom <tbergstrom@nvidia.com> | 2016-04-19 11:07:34 -0400 |
commit | dfac8ce70464413c0e3748634c57d49950e71933 (patch) | |
tree | 35d17f9d35aadf134bbff98ee41e8d7664f442da /drivers/gpu/nvgpu/gk20a/channel_gk20a.c | |
parent | c651adbeaacf063b856ef8126b74661b54066477 (diff) |
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 <dnibade@nvidia.com>
Reviewed-on: http://git-master/r/1120331
GVS: Gerrit_Virtual_Submit
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/channel_gk20a.c')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/channel_gk20a.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c index b7bccd07..e0beefb1 100644 --- a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c | |||
@@ -857,6 +857,8 @@ static void gk20a_free_channel(struct channel_gk20a *ch) | |||
857 | struct vm_gk20a *ch_vm = ch->vm; | 857 | struct vm_gk20a *ch_vm = ch->vm; |
858 | unsigned long timeout = gk20a_get_gr_idle_timeout(g); | 858 | unsigned long timeout = gk20a_get_gr_idle_timeout(g); |
859 | struct dbg_session_gk20a *dbg_s; | 859 | struct dbg_session_gk20a *dbg_s; |
860 | struct dbg_session_data *session_data, *tmp_s; | ||
861 | struct dbg_session_channel_data *ch_data, *tmp; | ||
860 | bool was_reset; | 862 | bool was_reset; |
861 | 863 | ||
862 | gk20a_dbg_fn(""); | 864 | gk20a_dbg_fn(""); |
@@ -992,14 +994,21 @@ unbind: | |||
992 | WARN_ON(ch->sync); | 994 | WARN_ON(ch->sync); |
993 | 995 | ||
994 | /* unlink all debug sessions */ | 996 | /* unlink all debug sessions */ |
995 | mutex_lock(&ch->dbg_s_lock); | 997 | mutex_lock(&g->dbg_sessions_lock); |
996 | 998 | ||
997 | list_for_each_entry(dbg_s, &ch->dbg_s_list, dbg_s_list_node) { | 999 | list_for_each_entry_safe(session_data, tmp_s, |
998 | dbg_s->ch = NULL; | 1000 | &ch->dbg_s_list, dbg_s_entry) { |
999 | list_del_init(&dbg_s->dbg_s_list_node); | 1001 | dbg_s = session_data->dbg_s; |
1002 | mutex_lock(&dbg_s->ch_list_lock); | ||
1003 | list_for_each_entry_safe(ch_data, tmp, | ||
1004 | &dbg_s->ch_list, ch_entry) { | ||
1005 | if (ch_data->chid == ch->hw_chid) | ||
1006 | dbg_unbind_single_channel_gk20a(dbg_s, ch_data); | ||
1007 | } | ||
1008 | mutex_unlock(&dbg_s->ch_list_lock); | ||
1000 | } | 1009 | } |
1001 | 1010 | ||
1002 | mutex_unlock(&ch->dbg_s_lock); | 1011 | mutex_unlock(&g->dbg_sessions_lock); |
1003 | 1012 | ||
1004 | release: | 1013 | release: |
1005 | /* make sure we catch accesses of unopened channels in case | 1014 | /* make sure we catch accesses of unopened channels in case |