diff options
author | Mahantesh Kumbar <mkumbar@nvidia.com> | 2017-12-07 13:41:13 -0500 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2018-01-25 17:24:33 -0500 |
commit | 99e808567ca358e0e6d03f4731b81854070266a3 (patch) | |
tree | ad8b851f0a2c50f79be3ebd003f57d35bf705909 /drivers/gpu/nvgpu/gv100/pmu_gv100.c | |
parent | 729403f545c5bc26ce208d38db65962596951e0a (diff) |
gpu: nvgpu: gv100: BOOTSTRAP_GR_FALCONS using RPC
- Created nv_pmu_rpc_struct_acr_bootstrap_gr_falcons struct
- gv100_load_falcon_ucode() function to bootstrap GR
flacons using RPC, wait for INIT_WPR_REGION before
creating & executing BOOTSTRAP_GR_FALCONS RPC.
- Added code to handle BOOTSTRAP_GR_FALCONS ack in
RPC handler
Change-Id: If70dc75bb2789970382853fb001d970a346b2915
Signed-off-by: Mahantesh Kumbar <mkumbar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1613316
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gv100/pmu_gv100.c')
-rw-r--r-- | drivers/gpu/nvgpu/gv100/pmu_gv100.c | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/gv100/pmu_gv100.c b/drivers/gpu/nvgpu/gv100/pmu_gv100.c index 339df6af..113e554b 100644 --- a/drivers/gpu/nvgpu/gv100/pmu_gv100.c +++ b/drivers/gpu/nvgpu/gv100/pmu_gv100.c | |||
@@ -43,3 +43,53 @@ int gv100_pmu_init_acr(struct gk20a *g) | |||
43 | 43 | ||
44 | return status; | 44 | return status; |
45 | } | 45 | } |
46 | |||
47 | int gv100_load_falcon_ucode(struct gk20a *g, u32 falconidmask) | ||
48 | { | ||
49 | struct nvgpu_pmu *pmu = &g->pmu; | ||
50 | struct nv_pmu_rpc_struct_acr_bootstrap_gr_falcons rpc; | ||
51 | u32 flags = PMU_ACR_CMD_BOOTSTRAP_FALCON_FLAGS_RESET_YES; | ||
52 | int status = 0; | ||
53 | |||
54 | if (falconidmask == 0) | ||
55 | return -EINVAL; | ||
56 | |||
57 | if (falconidmask & ~((1 << LSF_FALCON_ID_FECS) | | ||
58 | (1 << LSF_FALCON_ID_GPCCS))) | ||
59 | return -EINVAL; | ||
60 | |||
61 | g->pmu_lsf_loaded_falcon_id = 0; | ||
62 | /* check whether pmu is ready to bootstrap lsf if not wait for it */ | ||
63 | if (!g->pmu_lsf_pmu_wpr_init_done) { | ||
64 | pmu_wait_message_cond(&g->pmu, | ||
65 | gk20a_get_gr_idle_timeout(g), | ||
66 | &g->pmu_lsf_pmu_wpr_init_done, 1); | ||
67 | /* check again if it still not ready indicate an error */ | ||
68 | if (!g->pmu_lsf_pmu_wpr_init_done) { | ||
69 | nvgpu_err(g, "PMU not ready to load LSF"); | ||
70 | status = -ETIMEDOUT; | ||
71 | goto exit; | ||
72 | } | ||
73 | } | ||
74 | |||
75 | memset(&rpc, 0, sizeof(struct nv_pmu_rpc_struct_acr_bootstrap_gr_falcons)); | ||
76 | rpc.falcon_id_mask = falconidmask; | ||
77 | rpc.flags = flags; | ||
78 | rpc.falcon_va_mask = 0; | ||
79 | rpc.wpr_base_virtual.lo = 0; | ||
80 | rpc.wpr_base_virtual.hi = 0; | ||
81 | PMU_RPC_EXECUTE(status, pmu, ACR, BOOTSTRAP_GR_FALCONS, &rpc, 0); | ||
82 | if (status) { | ||
83 | nvgpu_err(g, "Failed to execute RPC, status=0x%x", status); | ||
84 | goto exit; | ||
85 | } | ||
86 | |||
87 | pmu_wait_message_cond(&g->pmu, gk20a_get_gr_idle_timeout(g), | ||
88 | &g->pmu_lsf_loaded_falcon_id, 1); | ||
89 | |||
90 | if (g->pmu_lsf_loaded_falcon_id != 1) | ||
91 | status = -ETIMEDOUT; | ||
92 | |||
93 | exit: | ||
94 | return status; | ||
95 | } | ||