summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gm20b
diff options
context:
space:
mode:
authorMahantesh Kumbar <mkumbar@nvidia.com>2017-09-20 12:44:26 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2017-09-22 09:14:02 -0400
commite32cc0108cf2ef5de7a17f0f6c0aa9af7faf23ed (patch)
tree9bd3cbc01e3b23387f58bb1e2fa7de54f6e450c1 /drivers/gpu/nvgpu/gm20b
parent2197a928c38ae8d518ad18348c7c2106fb56e230 (diff)
gpu: nvgpu: read WPR info from fb
- Added function to read WPR info from FB MMU registers - Added HAL to point wpr info read function - Replaced wpr info read from MC with HAL - Removed debugfs header include from acr files. JIRA NVGPU-128 Change-Id: I5ebec46bfe03b9200f2aa569f2e5a780a715616d Signed-off-by: Mahantesh Kumbar <mkumbar@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1564683 Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com> Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com> Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gm20b')
-rw-r--r--drivers/gpu/nvgpu/gm20b/acr_gm20b.c13
-rw-r--r--drivers/gpu/nvgpu/gm20b/fb_gm20b.c32
-rw-r--r--drivers/gpu/nvgpu/gm20b/fb_gm20b.h1
-rw-r--r--drivers/gpu/nvgpu/gm20b/hal_gm20b.c1
4 files changed, 35 insertions, 12 deletions
diff --git a/drivers/gpu/nvgpu/gm20b/acr_gm20b.c b/drivers/gpu/nvgpu/gm20b/acr_gm20b.c
index 0df80a94..649e32bb 100644
--- a/drivers/gpu/nvgpu/gm20b/acr_gm20b.c
+++ b/drivers/gpu/nvgpu/gm20b/acr_gm20b.c
@@ -11,12 +11,7 @@
11 * more details. 11 * more details.
12 */ 12 */
13 13
14#ifdef CONFIG_DEBUG_FS
15#include <linux/debugfs.h>
16#endif
17
18#include <nvgpu/types.h> 14#include <nvgpu/types.h>
19#include <linux/platform/tegra/mc.h>
20 15
21#include <nvgpu/dma.h> 16#include <nvgpu/dma.h>
22#include <nvgpu/gmmu.h> 17#include <nvgpu/gmmu.h>
@@ -83,13 +78,7 @@ static void start_gm20b_pmu(struct gk20a *g)
83 78
84void gm20b_wpr_info(struct gk20a *g, struct wpr_carveout_info *inf) 79void gm20b_wpr_info(struct gk20a *g, struct wpr_carveout_info *inf)
85{ 80{
86 struct mc_carveout_info mem_inf; 81 g->ops.fb.read_wpr_info(g, inf);
87
88 mc_get_carveout_info(&mem_inf, NULL, MC_SECURITY_CARVEOUT2);
89
90 inf->wpr_base = mem_inf.base;
91 inf->nonwpr_base = 0;
92 inf->size = mem_inf.size;
93} 82}
94 83
95bool gm20b_is_pmu_supported(struct gk20a *g) 84bool gm20b_is_pmu_supported(struct gk20a *g)
diff --git a/drivers/gpu/nvgpu/gm20b/fb_gm20b.c b/drivers/gpu/nvgpu/gm20b/fb_gm20b.c
index 31947ad0..8f124eec 100644
--- a/drivers/gpu/nvgpu/gm20b/fb_gm20b.c
+++ b/drivers/gpu/nvgpu/gm20b/fb_gm20b.c
@@ -24,6 +24,7 @@
24#include <nvgpu/hw/gm20b/hw_gr_gm20b.h> 24#include <nvgpu/hw/gm20b/hw_gr_gm20b.h>
25 25
26#define VPR_INFO_FETCH_WAIT (5) 26#define VPR_INFO_FETCH_WAIT (5)
27#define WPR_INFO_ADDR_ALIGNMENT 0x0000000c
27 28
28void fb_gm20b_init_fs_state(struct gk20a *g) 29void fb_gm20b_init_fs_state(struct gk20a *g)
29{ 30{
@@ -523,6 +524,37 @@ int gm20b_fb_vpr_info_fetch(struct gk20a *g)
523 return gm20b_fb_vpr_info_fetch_wait(g, VPR_INFO_FETCH_WAIT); 524 return gm20b_fb_vpr_info_fetch_wait(g, VPR_INFO_FETCH_WAIT);
524} 525}
525 526
527void gm20b_fb_read_wpr_info(struct gk20a *g, struct wpr_carveout_info *inf)
528{
529 u32 val = 0;
530 u64 wpr_start = 0;
531 u64 wpr_end = 0;
532
533 val = gk20a_readl(g, fb_mmu_wpr_info_r());
534 val &= ~0xF;
535 val |= fb_mmu_wpr_info_index_wpr1_addr_lo_v();
536 gk20a_writel(g, fb_mmu_wpr_info_r(), val);
537
538 val = gk20a_readl(g, fb_mmu_wpr_info_r()) >> 0x4;
539 wpr_start = hi32_lo32_to_u64(
540 (val >> (32 - WPR_INFO_ADDR_ALIGNMENT)),
541 (val << WPR_INFO_ADDR_ALIGNMENT));
542
543 val = gk20a_readl(g, fb_mmu_wpr_info_r());
544 val &= ~0xF;
545 val |= fb_mmu_wpr_info_index_wpr1_addr_hi_v();
546 gk20a_writel(g, fb_mmu_wpr_info_r(), val);
547
548 val = gk20a_readl(g, fb_mmu_wpr_info_r()) >> 0x4;
549 wpr_end = hi32_lo32_to_u64(
550 (val >> (32 - WPR_INFO_ADDR_ALIGNMENT)),
551 (val << WPR_INFO_ADDR_ALIGNMENT));
552
553 inf->wpr_base = wpr_start;
554 inf->nonwpr_base = 0;
555 inf->size = (wpr_end - wpr_start);
556}
557
526bool gm20b_fb_debug_mode_enabled(struct gk20a *g) 558bool gm20b_fb_debug_mode_enabled(struct gk20a *g)
527{ 559{
528 u32 debug_ctrl = gk20a_readl(g, gr_gpcs_pri_mmu_debug_ctrl_r()); 560 u32 debug_ctrl = gk20a_readl(g, gr_gpcs_pri_mmu_debug_ctrl_r());
diff --git a/drivers/gpu/nvgpu/gm20b/fb_gm20b.h b/drivers/gpu/nvgpu/gm20b/fb_gm20b.h
index 42e86407..690eb6a2 100644
--- a/drivers/gpu/nvgpu/gm20b/fb_gm20b.h
+++ b/drivers/gpu/nvgpu/gm20b/fb_gm20b.h
@@ -23,6 +23,7 @@ bool gm20b_fb_set_use_full_comp_tag_line(struct gk20a *g);
23unsigned int gm20b_fb_compression_page_size(struct gk20a *g); 23unsigned int gm20b_fb_compression_page_size(struct gk20a *g);
24unsigned int gm20b_fb_compressible_page_size(struct gk20a *g); 24unsigned int gm20b_fb_compressible_page_size(struct gk20a *g);
25void gm20b_fb_dump_vpr_wpr_info(struct gk20a *g); 25void gm20b_fb_dump_vpr_wpr_info(struct gk20a *g);
26void gm20b_fb_read_wpr_info(struct gk20a *g, struct wpr_carveout_info *inf);
26int gm20b_fb_vpr_info_fetch(struct gk20a *g); 27int gm20b_fb_vpr_info_fetch(struct gk20a *g);
27bool gm20b_fb_debug_mode_enabled(struct gk20a *g); 28bool gm20b_fb_debug_mode_enabled(struct gk20a *g);
28void gm20b_fb_set_debug_mode(struct gk20a *g, bool enable); 29void gm20b_fb_set_debug_mode(struct gk20a *g, bool enable);
diff --git a/drivers/gpu/nvgpu/gm20b/hal_gm20b.c b/drivers/gpu/nvgpu/gm20b/hal_gm20b.c
index f71c70f5..298d4f2b 100644
--- a/drivers/gpu/nvgpu/gm20b/hal_gm20b.c
+++ b/drivers/gpu/nvgpu/gm20b/hal_gm20b.c
@@ -296,6 +296,7 @@ static const struct gpu_ops gm20b_ops = {
296 .compressible_page_size = gm20b_fb_compressible_page_size, 296 .compressible_page_size = gm20b_fb_compressible_page_size,
297 .vpr_info_fetch = gm20b_fb_vpr_info_fetch, 297 .vpr_info_fetch = gm20b_fb_vpr_info_fetch,
298 .dump_vpr_wpr_info = gm20b_fb_dump_vpr_wpr_info, 298 .dump_vpr_wpr_info = gm20b_fb_dump_vpr_wpr_info,
299 .read_wpr_info = gm20b_fb_read_wpr_info,
299 .is_debug_mode_enabled = gm20b_fb_debug_mode_enabled, 300 .is_debug_mode_enabled = gm20b_fb_debug_mode_enabled,
300 .set_debug_mode = gm20b_fb_set_debug_mode, 301 .set_debug_mode = gm20b_fb_set_debug_mode,
301 .tlb_invalidate = gk20a_fb_tlb_invalidate, 302 .tlb_invalidate = gk20a_fb_tlb_invalidate,