diff options
author | Deepak Nibade <dnibade@nvidia.com> | 2017-11-23 06:59:14 -0500 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2017-11-28 12:46:54 -0500 |
commit | ce06f74d6ba9eb495661c29eabcd6da2f52c7c8b (patch) | |
tree | 307c045b4df7861d20f46a120a3726e274f6e472 /drivers/gpu/nvgpu/gk20a | |
parent | 861b11a968b1f51f45832486e62bfe23fc29fc19 (diff) |
gpu: nvgpu: move cycle state buffer handler to linux
We use dma_buf pointer cyclestate_buffer_handler in common code
But since this is linux specific, we need to move this out of common code and
into linux specific code
Move dma_buf pointer cyclestate_buffer_handler from common channel code to
struct nvgpu_channel_linux
Fix all pointer accesses to this handle
Move gk20a_channel_free_cycle_stats_buffer() to ioctl_channel.c since it is
mostly linux specific
And since gk20a_channel_free_cycle_stats_buffer() needs to be called while
closing the channel, call it from nvgpu_channel_close_linux()
Jira NVGPU-397
Jira NVGPU-415
Change-Id: Ifb429e49b8f7a1c9e2bc757f3efdd50b28ceca1f
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1603909
GVS: Gerrit_Virtual_Submit
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/channel_gk20a.c | 22 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/channel_gk20a.h | 8 |
2 files changed, 3 insertions, 27 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c index dac38739..6d62d888 100644 --- a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c | |||
@@ -360,24 +360,6 @@ static void gk20a_wait_until_counter_is_N( | |||
360 | } | 360 | } |
361 | } | 361 | } |
362 | 362 | ||
363 | #if defined(CONFIG_GK20A_CYCLE_STATS) | ||
364 | void gk20a_channel_free_cycle_stats_buffer(struct channel_gk20a *ch) | ||
365 | { | ||
366 | /* disable existing cyclestats buffer */ | ||
367 | nvgpu_mutex_acquire(&ch->cyclestate.cyclestate_buffer_mutex); | ||
368 | if (ch->cyclestate.cyclestate_buffer_handler) { | ||
369 | dma_buf_vunmap(ch->cyclestate.cyclestate_buffer_handler, | ||
370 | ch->cyclestate.cyclestate_buffer); | ||
371 | dma_buf_put(ch->cyclestate.cyclestate_buffer_handler); | ||
372 | ch->cyclestate.cyclestate_buffer_handler = NULL; | ||
373 | ch->cyclestate.cyclestate_buffer = NULL; | ||
374 | ch->cyclestate.cyclestate_buffer_size = 0; | ||
375 | } | ||
376 | nvgpu_mutex_release(&ch->cyclestate.cyclestate_buffer_mutex); | ||
377 | } | ||
378 | |||
379 | #endif | ||
380 | |||
381 | /* call ONLY when no references to the channel exist: after the last put */ | 363 | /* call ONLY when no references to the channel exist: after the last put */ |
382 | static void gk20a_free_channel(struct channel_gk20a *ch, bool force) | 364 | static void gk20a_free_channel(struct channel_gk20a *ch, bool force) |
383 | { | 365 | { |
@@ -490,10 +472,6 @@ static void gk20a_free_channel(struct channel_gk20a *ch, bool force) | |||
490 | nvgpu_big_free(g, ch->gpfifo.pipe); | 472 | nvgpu_big_free(g, ch->gpfifo.pipe); |
491 | memset(&ch->gpfifo, 0, sizeof(struct gpfifo_desc)); | 473 | memset(&ch->gpfifo, 0, sizeof(struct gpfifo_desc)); |
492 | 474 | ||
493 | #if defined(CONFIG_GK20A_CYCLE_STATS) | ||
494 | gk20a_channel_free_cycle_stats_buffer(ch); | ||
495 | #endif | ||
496 | |||
497 | channel_gk20a_free_priv_cmdbuf(ch); | 475 | channel_gk20a_free_priv_cmdbuf(ch); |
498 | 476 | ||
499 | /* sync must be destroyed before releasing channel vm */ | 477 | /* sync must be destroyed before releasing channel vm */ |
diff --git a/drivers/gpu/nvgpu/gk20a/channel_gk20a.h b/drivers/gpu/nvgpu/gk20a/channel_gk20a.h index 87ab6202..9d294399 100644 --- a/drivers/gpu/nvgpu/gk20a/channel_gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/channel_gk20a.h | |||
@@ -253,10 +253,9 @@ struct channel_gk20a { | |||
253 | 253 | ||
254 | #if defined(CONFIG_GK20A_CYCLE_STATS) | 254 | #if defined(CONFIG_GK20A_CYCLE_STATS) |
255 | struct { | 255 | struct { |
256 | void *cyclestate_buffer; | 256 | void *cyclestate_buffer; |
257 | u32 cyclestate_buffer_size; | 257 | u32 cyclestate_buffer_size; |
258 | struct dma_buf *cyclestate_buffer_handler; | 258 | struct nvgpu_mutex cyclestate_buffer_mutex; |
259 | struct nvgpu_mutex cyclestate_buffer_mutex; | ||
260 | } cyclestate; | 259 | } cyclestate; |
261 | 260 | ||
262 | struct nvgpu_mutex cs_client_mutex; | 261 | struct nvgpu_mutex cs_client_mutex; |
@@ -370,7 +369,6 @@ int gk20a_channel_alloc_gpfifo(struct channel_gk20a *c, | |||
370 | unsigned int num_entries, | 369 | unsigned int num_entries, |
371 | unsigned int num_inflight_jobs, | 370 | unsigned int num_inflight_jobs, |
372 | u32 flags); | 371 | u32 flags); |
373 | void gk20a_channel_free_cycle_stats_buffer(struct channel_gk20a *ch); | ||
374 | 372 | ||
375 | void gk20a_channel_timeout_restart_all_channels(struct gk20a *g); | 373 | void gk20a_channel_timeout_restart_all_channels(struct gk20a *g); |
376 | 374 | ||