From e41fd090315ff37fa09314a8cfde6d384385e17a Mon Sep 17 00:00:00 2001 From: Thomas Fleury Date: Tue, 27 Aug 2019 10:09:51 -0400 Subject: gpu: nvgpu: use refcnt for ch mmu_debug_mode Replaced ch->mmu_debug_mode_enabled with ch->mmu_debug_mode_refcnt. If channel is enabled multiple times by userspace, then ref count is updated accordingly. There is an expectation that enable/disable calls are balanced for setting channel's mmu debug mode. When unbinding the channel, decrease refcnt for the channel until it reaches 0. Also, removed tsg parameter from nvgpu_tsg_set_mmu_debug_mode as it can be retrieved from ch. Bug 2515097 Bug 2713590 Change-Id: If334e374a55bd14ae219edbfd3b1fce5ff25c226 Signed-off-by: Thomas Fleury Reviewed-on: https://git-master.nvidia.com/r/2184702 (cherry picked from commit f422aee39387a5aa337de69cc21a67f16697ae0e) Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2208772 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Kajetan Dutka Reviewed-by: Alex Waterman Reviewed-by: Winnie Hsu Reviewed-by: mobile promotions Tested-by: Kajetan Dutka Tested-by: mobile promotions GVS: Gerrit_Virtual_Submit --- drivers/gpu/nvgpu/include/nvgpu/channel.h | 6 +++++- drivers/gpu/nvgpu/include/nvgpu/tsg.h | 3 +-- 2 files changed, 6 insertions(+), 3 deletions(-) (limited to 'drivers/gpu/nvgpu/include') diff --git a/drivers/gpu/nvgpu/include/nvgpu/channel.h b/drivers/gpu/nvgpu/include/nvgpu/channel.h index e98af09b..764d047c 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/channel.h +++ b/drivers/gpu/nvgpu/include/nvgpu/channel.h @@ -328,7 +328,11 @@ struct channel_gk20a { bool has_os_fence_framework_support; bool is_privileged_channel; - bool mmu_debug_mode_enabled; + + /** + * MMU Debugger Mode is enabled for this channel if refcnt > 0 + */ + u32 mmu_debug_mode_refcnt; }; static inline struct channel_gk20a * diff --git a/drivers/gpu/nvgpu/include/nvgpu/tsg.h b/drivers/gpu/nvgpu/include/nvgpu/tsg.h index b43a6b98..7cd97c97 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/tsg.h +++ b/drivers/gpu/nvgpu/include/nvgpu/tsg.h @@ -127,7 +127,6 @@ gk20a_event_id_data_from_event_id_node(struct nvgpu_list_node *node) ((uintptr_t)node - offsetof(struct gk20a_event_id_data, event_id_node)); }; -int nvgpu_tsg_set_mmu_debug_mode(struct tsg_gk20a *tsg, - struct channel_gk20a *ch, bool enable); +int nvgpu_tsg_set_mmu_debug_mode(struct channel_gk20a *ch, bool enable); #endif /* TSG_GK20A_H */ -- cgit v1.2.2