diff options
author | Mahantesh Kumbar <mkumbar@nvidia.com> | 2018-09-10 11:41:49 -0400 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2018-09-24 11:12:03 -0400 |
commit | 863b47064445b3dd5cdc354821c8d3d14deade33 (patch) | |
tree | 1e53f26c1549d1970d752f74ab82a4d55642620b /drivers/gpu/nvgpu/gm20b | |
parent | fdf77eda18b59c305d4dd8436d8b09d42ec4718a (diff) |
gpu: nvgpu: PMU init sequence change
-Moved PMU RTOS init & start RTOS from acr_gm20b.c file pmu.c
method nvgpu_init_pmu_support()
-Modified nvgpu_init_pmu_support() to init required interface
for PMU RTOS & does start PMU RTOS in secure & non-secure
based on NVGPU_SEC_PRIVSECURITY flag.
-Created secured_pmu_start ops under PMU ops to start PMU
falcon in low secure mode.
-Updated PMU ops update_lspmu_cmdline_args, setup_apertures &
secured_pmu_start assignment for gp106 & gv100 to support
modified PMU init sequence.
-Removed duplicate PMU non-secure bootstrap code from multiple
files & defined gm20b_ns_pmu_setup_hw_and_bootstrap()method
to handle non secure PMU bootstrap, reused this method
for need chips.
JIRA NVGPU-1146
Change-Id: I3957da2936b3c4ea0c985e67802c847c38de7c89
Signed-off-by: Mahantesh Kumbar <mkumbar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1818099
Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gm20b')
-rw-r--r-- | drivers/gpu/nvgpu/gm20b/acr_gm20b.c | 70 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gm20b/acr_gm20b.h | 4 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gm20b/hal_gm20b.c | 5 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gm20b/pmu_gm20b.c | 72 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gm20b/pmu_gm20b.h | 4 |
5 files changed, 80 insertions, 75 deletions
diff --git a/drivers/gpu/nvgpu/gm20b/acr_gm20b.c b/drivers/gpu/nvgpu/gm20b/acr_gm20b.c index a4657ff3..e38e9a85 100644 --- a/drivers/gpu/nvgpu/gm20b/acr_gm20b.c +++ b/drivers/gpu/nvgpu/gm20b/acr_gm20b.c | |||
@@ -1045,76 +1045,6 @@ int acr_ucode_patch_sig(struct gk20a *g, | |||
1045 | return 0; | 1045 | return 0; |
1046 | } | 1046 | } |
1047 | 1047 | ||
1048 | int gm20b_init_nspmu_setup_hw1(struct gk20a *g) | ||
1049 | { | ||
1050 | struct nvgpu_pmu *pmu = &g->pmu; | ||
1051 | int err = 0; | ||
1052 | |||
1053 | nvgpu_log_fn(g, " "); | ||
1054 | |||
1055 | nvgpu_mutex_acquire(&pmu->isr_mutex); | ||
1056 | nvgpu_flcn_reset(pmu->flcn); | ||
1057 | pmu->isr_enabled = true; | ||
1058 | nvgpu_mutex_release(&pmu->isr_mutex); | ||
1059 | |||
1060 | /* setup apertures - virtual */ | ||
1061 | gk20a_writel(g, pwr_fbif_transcfg_r(GK20A_PMU_DMAIDX_UCODE), | ||
1062 | pwr_fbif_transcfg_mem_type_virtual_f()); | ||
1063 | gk20a_writel(g, pwr_fbif_transcfg_r(GK20A_PMU_DMAIDX_VIRT), | ||
1064 | pwr_fbif_transcfg_mem_type_virtual_f()); | ||
1065 | /* setup apertures - physical */ | ||
1066 | gk20a_writel(g, pwr_fbif_transcfg_r(GK20A_PMU_DMAIDX_PHYS_VID), | ||
1067 | pwr_fbif_transcfg_mem_type_physical_f() | | ||
1068 | pwr_fbif_transcfg_target_local_fb_f()); | ||
1069 | gk20a_writel(g, pwr_fbif_transcfg_r(GK20A_PMU_DMAIDX_PHYS_SYS_COH), | ||
1070 | pwr_fbif_transcfg_mem_type_physical_f() | | ||
1071 | pwr_fbif_transcfg_target_coherent_sysmem_f()); | ||
1072 | gk20a_writel(g, pwr_fbif_transcfg_r(GK20A_PMU_DMAIDX_PHYS_SYS_NCOH), | ||
1073 | pwr_fbif_transcfg_mem_type_physical_f() | | ||
1074 | pwr_fbif_transcfg_target_noncoherent_sysmem_f()); | ||
1075 | |||
1076 | err = g->ops.pmu.pmu_nsbootstrap(pmu); | ||
1077 | |||
1078 | return err; | ||
1079 | } | ||
1080 | |||
1081 | void gm20b_setup_apertures(struct gk20a *g) | ||
1082 | { | ||
1083 | /* setup apertures - virtual */ | ||
1084 | gk20a_writel(g, pwr_fbif_transcfg_r(GK20A_PMU_DMAIDX_UCODE), | ||
1085 | pwr_fbif_transcfg_mem_type_physical_f() | | ||
1086 | pwr_fbif_transcfg_target_local_fb_f()); | ||
1087 | gk20a_writel(g, pwr_fbif_transcfg_r(GK20A_PMU_DMAIDX_VIRT), | ||
1088 | pwr_fbif_transcfg_mem_type_virtual_f()); | ||
1089 | /* setup apertures - physical */ | ||
1090 | gk20a_writel(g, pwr_fbif_transcfg_r(GK20A_PMU_DMAIDX_PHYS_VID), | ||
1091 | pwr_fbif_transcfg_mem_type_physical_f() | | ||
1092 | pwr_fbif_transcfg_target_local_fb_f()); | ||
1093 | gk20a_writel(g, pwr_fbif_transcfg_r(GK20A_PMU_DMAIDX_PHYS_SYS_COH), | ||
1094 | pwr_fbif_transcfg_mem_type_physical_f() | | ||
1095 | pwr_fbif_transcfg_target_coherent_sysmem_f()); | ||
1096 | gk20a_writel(g, pwr_fbif_transcfg_r(GK20A_PMU_DMAIDX_PHYS_SYS_NCOH), | ||
1097 | pwr_fbif_transcfg_mem_type_physical_f() | | ||
1098 | pwr_fbif_transcfg_target_noncoherent_sysmem_f()); | ||
1099 | } | ||
1100 | |||
1101 | void gm20b_update_lspmu_cmdline_args(struct gk20a *g) | ||
1102 | { | ||
1103 | struct nvgpu_pmu *pmu = &g->pmu; | ||
1104 | /*Copying pmu cmdline args*/ | ||
1105 | g->ops.pmu_ver.set_pmu_cmdline_args_cpu_freq(pmu, | ||
1106 | g->ops.clk.get_rate(g, CTRL_CLK_DOMAIN_PWRCLK)); | ||
1107 | g->ops.pmu_ver.set_pmu_cmdline_args_secure_mode(pmu, 1); | ||
1108 | g->ops.pmu_ver.set_pmu_cmdline_args_trace_size( | ||
1109 | pmu, GK20A_PMU_TRACE_BUFSIZE); | ||
1110 | g->ops.pmu_ver.set_pmu_cmdline_args_trace_dma_base(pmu); | ||
1111 | g->ops.pmu_ver.set_pmu_cmdline_args_trace_dma_idx( | ||
1112 | pmu, GK20A_PMU_DMAIDX_VIRT); | ||
1113 | nvgpu_flcn_copy_to_dmem(pmu->flcn, g->acr.pmu_args, | ||
1114 | (u8 *)(g->ops.pmu_ver.get_pmu_cmdline_args_ptr(pmu)), | ||
1115 | g->ops.pmu_ver.get_pmu_cmdline_args_size(pmu), 0); | ||
1116 | } | ||
1117 | |||
1118 | static int nvgpu_gm20b_acr_wait_for_completion(struct gk20a *g, | 1048 | static int nvgpu_gm20b_acr_wait_for_completion(struct gk20a *g, |
1119 | struct nvgpu_falcon *flcn, unsigned int timeout) | 1049 | struct nvgpu_falcon *flcn, unsigned int timeout) |
1120 | { | 1050 | { |
diff --git a/drivers/gpu/nvgpu/gm20b/acr_gm20b.h b/drivers/gpu/nvgpu/gm20b/acr_gm20b.h index cae6ab6a..fad40081 100644 --- a/drivers/gpu/nvgpu/gm20b/acr_gm20b.h +++ b/drivers/gpu/nvgpu/gm20b/acr_gm20b.h | |||
@@ -41,10 +41,6 @@ int gm20b_pmu_populate_loader_cfg(struct gk20a *g, | |||
41 | void *lsfm, u32 *p_bl_gen_desc_size); | 41 | void *lsfm, u32 *p_bl_gen_desc_size); |
42 | int gm20b_flcn_populate_bl_dmem_desc(struct gk20a *g, | 42 | int gm20b_flcn_populate_bl_dmem_desc(struct gk20a *g, |
43 | void *lsfm, u32 *p_bl_gen_desc_size, u32 falconid); | 43 | void *lsfm, u32 *p_bl_gen_desc_size, u32 falconid); |
44 | void gm20b_update_lspmu_cmdline_args(struct gk20a *g); | ||
45 | void gm20b_setup_apertures(struct gk20a *g); | ||
46 | int gm20b_pmu_setup_sw(struct gk20a *g); | ||
47 | int gm20b_init_nspmu_setup_hw1(struct gk20a *g); | ||
48 | 44 | ||
49 | int acr_ucode_patch_sig(struct gk20a *g, | 45 | int acr_ucode_patch_sig(struct gk20a *g, |
50 | unsigned int *p_img, | 46 | unsigned int *p_img, |
diff --git a/drivers/gpu/nvgpu/gm20b/hal_gm20b.c b/drivers/gpu/nvgpu/gm20b/hal_gm20b.c index 52f86dab..133428da 100644 --- a/drivers/gpu/nvgpu/gm20b/hal_gm20b.c +++ b/drivers/gpu/nvgpu/gm20b/hal_gm20b.c | |||
@@ -735,7 +735,8 @@ int gm20b_init_hal(struct gk20a *g) | |||
735 | gm20b_flcn_populate_bl_dmem_desc; | 735 | gm20b_flcn_populate_bl_dmem_desc; |
736 | gops->pmu.update_lspmu_cmdline_args = | 736 | gops->pmu.update_lspmu_cmdline_args = |
737 | gm20b_update_lspmu_cmdline_args; | 737 | gm20b_update_lspmu_cmdline_args; |
738 | gops->pmu.setup_apertures = gm20b_setup_apertures; | 738 | gops->pmu.setup_apertures = gm20b_pmu_setup_apertures; |
739 | gops->pmu.secured_pmu_start = gm20b_secured_pmu_start; | ||
739 | 740 | ||
740 | gops->pmu.init_wpr_region = gm20b_pmu_init_acr; | 741 | gops->pmu.init_wpr_region = gm20b_pmu_init_acr; |
741 | gops->pmu.load_lsfalcon_ucode = gm20b_load_falcon_ucode; | 742 | gops->pmu.load_lsfalcon_ucode = gm20b_load_falcon_ucode; |
@@ -745,6 +746,8 @@ int gm20b_init_hal(struct gk20a *g) | |||
745 | /* Inherit from gk20a */ | 746 | /* Inherit from gk20a */ |
746 | gops->pmu.is_pmu_supported = gk20a_is_pmu_supported; | 747 | gops->pmu.is_pmu_supported = gk20a_is_pmu_supported; |
747 | gops->pmu.prepare_ucode = nvgpu_pmu_prepare_ns_ucode_blob; | 748 | gops->pmu.prepare_ucode = nvgpu_pmu_prepare_ns_ucode_blob; |
749 | gops->pmu.pmu_setup_hw_and_bootstrap = | ||
750 | gm20b_ns_pmu_setup_hw_and_bootstrap; | ||
748 | gops->pmu.pmu_nsbootstrap = pmu_bootstrap; | 751 | gops->pmu.pmu_nsbootstrap = pmu_bootstrap; |
749 | 752 | ||
750 | gops->pmu.load_lsfalcon_ucode = NULL; | 753 | gops->pmu.load_lsfalcon_ucode = NULL; |
diff --git a/drivers/gpu/nvgpu/gm20b/pmu_gm20b.c b/drivers/gpu/nvgpu/gm20b/pmu_gm20b.c index 6e764ac5..df0ae58d 100644 --- a/drivers/gpu/nvgpu/gm20b/pmu_gm20b.c +++ b/drivers/gpu/nvgpu/gm20b/pmu_gm20b.c | |||
@@ -278,6 +278,72 @@ bool gm20b_pmu_is_debug_mode_en(struct gk20a *g) | |||
278 | return pwr_pmu_scpctl_stat_debug_mode_v(ctl_stat) != 0U; | 278 | return pwr_pmu_scpctl_stat_debug_mode_v(ctl_stat) != 0U; |
279 | } | 279 | } |
280 | 280 | ||
281 | int gm20b_ns_pmu_setup_hw_and_bootstrap(struct gk20a *g) | ||
282 | { | ||
283 | struct nvgpu_pmu *pmu = &g->pmu; | ||
284 | |||
285 | nvgpu_log_fn(g, " "); | ||
286 | |||
287 | nvgpu_mutex_acquire(&pmu->isr_mutex); | ||
288 | nvgpu_flcn_reset(pmu->flcn); | ||
289 | pmu->isr_enabled = true; | ||
290 | nvgpu_mutex_release(&pmu->isr_mutex); | ||
291 | |||
292 | /* setup apertures - virtual */ | ||
293 | gk20a_writel(g, pwr_fbif_transcfg_r(GK20A_PMU_DMAIDX_UCODE), | ||
294 | pwr_fbif_transcfg_mem_type_virtual_f()); | ||
295 | gk20a_writel(g, pwr_fbif_transcfg_r(GK20A_PMU_DMAIDX_VIRT), | ||
296 | pwr_fbif_transcfg_mem_type_virtual_f()); | ||
297 | /* setup apertures - physical */ | ||
298 | gk20a_writel(g, pwr_fbif_transcfg_r(GK20A_PMU_DMAIDX_PHYS_VID), | ||
299 | pwr_fbif_transcfg_mem_type_physical_f() | | ||
300 | pwr_fbif_transcfg_target_local_fb_f()); | ||
301 | gk20a_writel(g, pwr_fbif_transcfg_r(GK20A_PMU_DMAIDX_PHYS_SYS_COH), | ||
302 | pwr_fbif_transcfg_mem_type_physical_f() | | ||
303 | pwr_fbif_transcfg_target_coherent_sysmem_f()); | ||
304 | gk20a_writel(g, pwr_fbif_transcfg_r(GK20A_PMU_DMAIDX_PHYS_SYS_NCOH), | ||
305 | pwr_fbif_transcfg_mem_type_physical_f() | | ||
306 | pwr_fbif_transcfg_target_noncoherent_sysmem_f()); | ||
307 | |||
308 | return g->ops.pmu.pmu_nsbootstrap(pmu); | ||
309 | } | ||
310 | |||
311 | void gm20b_pmu_setup_apertures(struct gk20a *g) | ||
312 | { | ||
313 | /* setup apertures - virtual */ | ||
314 | gk20a_writel(g, pwr_fbif_transcfg_r(GK20A_PMU_DMAIDX_UCODE), | ||
315 | pwr_fbif_transcfg_mem_type_physical_f() | | ||
316 | pwr_fbif_transcfg_target_local_fb_f()); | ||
317 | gk20a_writel(g, pwr_fbif_transcfg_r(GK20A_PMU_DMAIDX_VIRT), | ||
318 | pwr_fbif_transcfg_mem_type_virtual_f()); | ||
319 | /* setup apertures - physical */ | ||
320 | gk20a_writel(g, pwr_fbif_transcfg_r(GK20A_PMU_DMAIDX_PHYS_VID), | ||
321 | pwr_fbif_transcfg_mem_type_physical_f() | | ||
322 | pwr_fbif_transcfg_target_local_fb_f()); | ||
323 | gk20a_writel(g, pwr_fbif_transcfg_r(GK20A_PMU_DMAIDX_PHYS_SYS_COH), | ||
324 | pwr_fbif_transcfg_mem_type_physical_f() | | ||
325 | pwr_fbif_transcfg_target_coherent_sysmem_f()); | ||
326 | gk20a_writel(g, pwr_fbif_transcfg_r(GK20A_PMU_DMAIDX_PHYS_SYS_NCOH), | ||
327 | pwr_fbif_transcfg_mem_type_physical_f() | | ||
328 | pwr_fbif_transcfg_target_noncoherent_sysmem_f()); | ||
329 | } | ||
330 | |||
331 | void gm20b_update_lspmu_cmdline_args(struct gk20a *g) | ||
332 | { | ||
333 | struct nvgpu_pmu *pmu = &g->pmu; | ||
334 | /*Copying pmu cmdline args*/ | ||
335 | g->ops.pmu_ver.set_pmu_cmdline_args_cpu_freq(pmu, | ||
336 | g->ops.clk.get_rate(g, CTRL_CLK_DOMAIN_PWRCLK)); | ||
337 | g->ops.pmu_ver.set_pmu_cmdline_args_secure_mode(pmu, 1); | ||
338 | g->ops.pmu_ver.set_pmu_cmdline_args_trace_size( | ||
339 | pmu, GK20A_PMU_TRACE_BUFSIZE); | ||
340 | g->ops.pmu_ver.set_pmu_cmdline_args_trace_dma_base(pmu); | ||
341 | g->ops.pmu_ver.set_pmu_cmdline_args_trace_dma_idx( | ||
342 | pmu, GK20A_PMU_DMAIDX_VIRT); | ||
343 | nvgpu_flcn_copy_to_dmem(pmu->flcn, g->acr.pmu_args, | ||
344 | (u8 *)(g->ops.pmu_ver.get_pmu_cmdline_args_ptr(pmu)), | ||
345 | g->ops.pmu_ver.get_pmu_cmdline_args_size(pmu), 0); | ||
346 | } | ||
281 | 347 | ||
282 | static int gm20b_bl_bootstrap(struct gk20a *g, | 348 | static int gm20b_bl_bootstrap(struct gk20a *g, |
283 | struct nvgpu_falcon_bl_info *bl_info) | 349 | struct nvgpu_falcon_bl_info *bl_info) |
@@ -337,3 +403,9 @@ int gm20b_pmu_setup_hw_and_bl_bootstrap(struct gk20a *g, | |||
337 | exit: | 403 | exit: |
338 | return err; | 404 | return err; |
339 | } | 405 | } |
406 | |||
407 | void gm20b_secured_pmu_start(struct gk20a *g) | ||
408 | { | ||
409 | gk20a_writel(g, pwr_falcon_cpuctl_alias_r(), | ||
410 | pwr_falcon_cpuctl_startcpu_f(1)); | ||
411 | } | ||
diff --git a/drivers/gpu/nvgpu/gm20b/pmu_gm20b.h b/drivers/gpu/nvgpu/gm20b/pmu_gm20b.h index 37634783..0e4968fb 100644 --- a/drivers/gpu/nvgpu/gm20b/pmu_gm20b.h +++ b/drivers/gpu/nvgpu/gm20b/pmu_gm20b.h | |||
@@ -34,7 +34,11 @@ void gm20b_pmu_load_lsf(struct gk20a *g, u32 falcon_id, u32 flags); | |||
34 | int gm20b_pmu_init_acr(struct gk20a *g); | 34 | int gm20b_pmu_init_acr(struct gk20a *g); |
35 | void gm20b_write_dmatrfbase(struct gk20a *g, u32 addr); | 35 | void gm20b_write_dmatrfbase(struct gk20a *g, u32 addr); |
36 | bool gm20b_pmu_is_debug_mode_en(struct gk20a *g); | 36 | bool gm20b_pmu_is_debug_mode_en(struct gk20a *g); |
37 | int gm20b_ns_pmu_setup_hw_and_bootstrap(struct gk20a *g); | ||
38 | void gm20b_pmu_setup_apertures(struct gk20a *g); | ||
39 | void gm20b_update_lspmu_cmdline_args(struct gk20a *g); | ||
37 | int gm20b_pmu_setup_hw_and_bl_bootstrap(struct gk20a *g, | 40 | int gm20b_pmu_setup_hw_and_bl_bootstrap(struct gk20a *g, |
38 | struct hs_acr *acr_desc, | 41 | struct hs_acr *acr_desc, |
39 | struct nvgpu_falcon_bl_info *bl_info); | 42 | struct nvgpu_falcon_bl_info *bl_info); |
43 | void gm20b_secured_pmu_start(struct gk20a *g); | ||
40 | #endif /*NVGPU_GM20B_PMU_GM20B_H*/ | 44 | #endif /*NVGPU_GM20B_PMU_GM20B_H*/ |