summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gk20a/gk20a.c
diff options
context:
space:
mode:
authorsujeet baranwal <sbaranwal@nvidia.com>2015-03-02 18:36:22 -0500
committerDan Willemsen <dwillemsen@nvidia.com>2015-04-04 21:58:04 -0400
commit895675e1d5790e2361b22edb50d702f7dd9a8edd (patch)
treedbe3586cec5351fd2c2eb13d91c258e663d73b08 /drivers/gpu/nvgpu/gk20a/gk20a.c
parentcf0085ec231246748b34081d2786c29cedcbd706 (diff)
gpu: nvgpu: Removal of regops from CUDA driver
The current CUDA drivers have been using the regops to directly accessing the GPU registers from user space through the dbg node. This is a security hole and needs to be avoided. The patch alternatively implements the similar functionality in the kernel and provide an ioctl for it. Bug 200083334 Change-Id: Ic5ff5a215cbabe7a46837bc4e15efcceb0df0367 Signed-off-by: sujeet baranwal <sbaranwal@nvidia.com> Reviewed-on: http://git-master/r/711758 Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com> Tested-by: Terje Bergstrom <tbergstrom@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/gk20a.c')
-rw-r--r--drivers/gpu/nvgpu/gk20a/gk20a.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.c b/drivers/gpu/nvgpu/gk20a/gk20a.c
index 67aa49c6..3389aca5 100644
--- a/drivers/gpu/nvgpu/gk20a/gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/gk20a.c
@@ -56,6 +56,8 @@
56#include "hw_sim_gk20a.h" 56#include "hw_sim_gk20a.h"
57#include "hw_top_gk20a.h" 57#include "hw_top_gk20a.h"
58#include "hw_ltc_gk20a.h" 58#include "hw_ltc_gk20a.h"
59#include "hw_gr_gk20a.h"
60#include "hw_fb_gk20a.h"
59#include "gk20a_scale.h" 61#include "gk20a_scale.h"
60#include "dbg_gpu_gk20a.h" 62#include "dbg_gpu_gk20a.h"
61#include "hal.h" 63#include "hal.h"
@@ -727,6 +729,21 @@ static int gk20a_detect_chip(struct gk20a *g)
727 return gpu_init_hal(g); 729 return gpu_init_hal(g);
728} 730}
729 731
732void gk20a_pm_restore_debug_setting(struct gk20a *g)
733{
734 u32 mmu_debug_ctrl;
735
736 /* restore mmu debug state */
737 if (g->mmu_debug_ctrl)
738 mmu_debug_ctrl = fb_mmu_debug_ctrl_debug_enabled_v();
739 else
740 mmu_debug_ctrl = fb_mmu_debug_ctrl_debug_disabled_v();
741
742 mmu_debug_ctrl = gk20a_readl(g, fb_mmu_debug_ctrl_r());
743 mmu_debug_ctrl = set_field(mmu_debug_ctrl, fb_mmu_debug_ctrl_debug_m(), mmu_debug_ctrl);
744 gk20a_writel(g, fb_mmu_debug_ctrl_r(), mmu_debug_ctrl);
745}
746
730static int gk20a_pm_finalize_poweron(struct device *dev) 747static int gk20a_pm_finalize_poweron(struct device *dev)
731{ 748{
732 struct platform_device *pdev = to_platform_device(dev); 749 struct platform_device *pdev = to_platform_device(dev);
@@ -851,6 +868,9 @@ static int gk20a_pm_finalize_poweron(struct device *dev)
851 goto done; 868 goto done;
852 } 869 }
853 870
871 /* Restore the debug setting */
872 gk20a_pm_restore_debug_setting(g);
873
854 gk20a_channel_resume(g); 874 gk20a_channel_resume(g);
855 set_user_nice(current, nice_value); 875 set_user_nice(current, nice_value);
856 876