From 895675e1d5790e2361b22edb50d702f7dd9a8edd Mon Sep 17 00:00:00 2001 From: sujeet baranwal Date: Mon, 2 Mar 2015 15:36:22 -0800 Subject: 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 Reviewed-on: http://git-master/r/711758 Reviewed-by: Terje Bergstrom Tested-by: Terje Bergstrom --- drivers/gpu/nvgpu/gk20a/gk20a.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'drivers/gpu/nvgpu/gk20a/gk20a.c') 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 @@ #include "hw_sim_gk20a.h" #include "hw_top_gk20a.h" #include "hw_ltc_gk20a.h" +#include "hw_gr_gk20a.h" +#include "hw_fb_gk20a.h" #include "gk20a_scale.h" #include "dbg_gpu_gk20a.h" #include "hal.h" @@ -727,6 +729,21 @@ static int gk20a_detect_chip(struct gk20a *g) return gpu_init_hal(g); } +void gk20a_pm_restore_debug_setting(struct gk20a *g) +{ + u32 mmu_debug_ctrl; + + /* restore mmu debug state */ + if (g->mmu_debug_ctrl) + mmu_debug_ctrl = fb_mmu_debug_ctrl_debug_enabled_v(); + else + mmu_debug_ctrl = fb_mmu_debug_ctrl_debug_disabled_v(); + + mmu_debug_ctrl = gk20a_readl(g, fb_mmu_debug_ctrl_r()); + mmu_debug_ctrl = set_field(mmu_debug_ctrl, fb_mmu_debug_ctrl_debug_m(), mmu_debug_ctrl); + gk20a_writel(g, fb_mmu_debug_ctrl_r(), mmu_debug_ctrl); +} + static int gk20a_pm_finalize_poweron(struct device *dev) { struct platform_device *pdev = to_platform_device(dev); @@ -851,6 +868,9 @@ static int gk20a_pm_finalize_poweron(struct device *dev) goto done; } + /* Restore the debug setting */ + gk20a_pm_restore_debug_setting(g); + gk20a_channel_resume(g); set_user_nice(current, nice_value); -- cgit v1.2.2