diff options
author | Mahantesh Kumbar <mkumbar@nvidia.com> | 2018-09-06 11:14:27 -0400 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2018-09-24 11:11:49 -0400 |
commit | 5d30a5cda37ca349b4d9cb7e1985c7a0849001b6 (patch) | |
tree | 89a37078480d7cec42d9a8c7bc869aae8bb28279 /drivers/gpu/nvgpu/gm20b/pmu_gm20b.c | |
parent | 7465926ccdcdad87c22c788fe04fc11961df53ba (diff) |
gpu: nvgpu: ACR code refactor
-Created struct nvgpu_acr to hold acr module related member
within single struct which are currently spread across multiple structs
like nvgpu_pmu, pmu_ops & gk20a.
-Created struct hs_flcn_bl struct to hold ACR HS bootloader specific members
-Created struct hs_acr to hold ACR ucode specific members like bootloader data
using struct hs_flcn_bl, acr type & falcon info on which ACR ucode need to run.
-Created acr ops under struct nvgpu_acr to perform ACR specific operation,
currently ACR ops were part PMU which caused to have always dependence
on PMU even though ACR was not executing on PMU.
-Added acr_remove_support ops which will be called as part of
gk20a_remove_support() method, earlier acr cleanup was part of
pmu remove_support method.
-Created define for ACR types,
-Ops acr_sw_init() function helps to set ACR properties
statically for chip currently in execution & assign ops to point to
needed functions as per chip.
-Ops acr_sw_init execute at early as nvgpu_init_mm_support calls acr
function to alloc blob space.
-Created ops to fill bootloader descriptor & to patch WPR info to ACR uocde
based on interfaces used to bootstrap ACR ucode.
-Created function gm20b_bootstrap_hs_acr() function which is now common
HAL for all chips to bootstrap ACR, earlier had 3 different function for
gm20b/gp10b, gv11b & for all dgpu based on interface needed.
-Removed duplicate code for falcon engine wherever common falcon code can be used.
-Removed ACR code dependent on PMU & made changes to use from nvgpu_acr.
JIRA NVGPU-1148
Change-Id: I39951d2fc9a0bb7ee6057e0fa06da78045d47590
Signed-off-by: Mahantesh Kumbar <mkumbar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1813231
GVS: Gerrit_Virtual_Submit
Reviewed-by: svc-misra-checker <svc-misra-checker@nvidia.com>
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/pmu_gm20b.c')
-rw-r--r-- | drivers/gpu/nvgpu/gm20b/pmu_gm20b.c | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/gm20b/pmu_gm20b.c b/drivers/gpu/nvgpu/gm20b/pmu_gm20b.c index c1ec4d8e..6e764ac5 100644 --- a/drivers/gpu/nvgpu/gm20b/pmu_gm20b.c +++ b/drivers/gpu/nvgpu/gm20b/pmu_gm20b.c | |||
@@ -277,3 +277,63 @@ bool gm20b_pmu_is_debug_mode_en(struct gk20a *g) | |||
277 | u32 ctl_stat = gk20a_readl(g, pwr_pmu_scpctl_stat_r()); | 277 | u32 ctl_stat = gk20a_readl(g, pwr_pmu_scpctl_stat_r()); |
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 | |||
281 | |||
282 | static int gm20b_bl_bootstrap(struct gk20a *g, | ||
283 | struct nvgpu_falcon_bl_info *bl_info) | ||
284 | { | ||
285 | struct mm_gk20a *mm = &g->mm; | ||
286 | |||
287 | nvgpu_log_fn(g, " "); | ||
288 | |||
289 | gk20a_writel(g, pwr_falcon_itfen_r(), | ||
290 | gk20a_readl(g, pwr_falcon_itfen_r()) | | ||
291 | pwr_falcon_itfen_ctxen_enable_f()); | ||
292 | gk20a_writel(g, pwr_pmu_new_instblk_r(), | ||
293 | pwr_pmu_new_instblk_ptr_f( | ||
294 | nvgpu_inst_block_addr(g, &mm->pmu.inst_block) >> 12U) | | ||
295 | pwr_pmu_new_instblk_valid_f(1U) | | ||
296 | (nvgpu_is_enabled(g, NVGPU_USE_COHERENT_SYSMEM) ? | ||
297 | pwr_pmu_new_instblk_target_sys_coh_f() : | ||
298 | pwr_pmu_new_instblk_target_sys_ncoh_f())) ; | ||
299 | |||
300 | nvgpu_flcn_bl_bootstrap(&g->pmu_flcn, bl_info); | ||
301 | |||
302 | return 0; | ||
303 | } | ||
304 | |||
305 | int gm20b_pmu_setup_hw_and_bl_bootstrap(struct gk20a *g, | ||
306 | struct hs_acr *acr_desc, | ||
307 | struct nvgpu_falcon_bl_info *bl_info) | ||
308 | { | ||
309 | struct nvgpu_pmu *pmu = &g->pmu; | ||
310 | int err; | ||
311 | |||
312 | nvgpu_log_fn(g, " "); | ||
313 | |||
314 | nvgpu_mutex_acquire(&pmu->isr_mutex); | ||
315 | /* | ||
316 | * disable irqs for hs falcon booting | ||
317 | * as we will poll for halt | ||
318 | */ | ||
319 | g->ops.pmu.pmu_enable_irq(pmu, false); | ||
320 | pmu->isr_enabled = false; | ||
321 | err = nvgpu_flcn_reset(acr_desc->acr_flcn); | ||
322 | if (err != 0) { | ||
323 | nvgpu_mutex_release(&pmu->isr_mutex); | ||
324 | goto exit; | ||
325 | } | ||
326 | nvgpu_mutex_release(&pmu->isr_mutex); | ||
327 | |||
328 | if (g->ops.pmu.setup_apertures) { | ||
329 | g->ops.pmu.setup_apertures(g); | ||
330 | } | ||
331 | |||
332 | /*Clearing mailbox register used to reflect capabilities*/ | ||
333 | gk20a_writel(g, pwr_falcon_mailbox1_r(), 0); | ||
334 | |||
335 | err = gm20b_bl_bootstrap(g, bl_info); | ||
336 | |||
337 | exit: | ||
338 | return err; | ||
339 | } | ||