From 99e808567ca358e0e6d03f4731b81854070266a3 Mon Sep 17 00:00:00 2001 From: Mahantesh Kumbar Date: Fri, 8 Dec 2017 00:11:13 +0530 Subject: 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 Reviewed-on: https://git-master.nvidia.com/r/1613316 Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/gv100/pmu_gv100.c | 50 +++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) (limited to 'drivers/gpu/nvgpu/gv100/pmu_gv100.c') 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) return status; } + +int gv100_load_falcon_ucode(struct gk20a *g, u32 falconidmask) +{ + struct nvgpu_pmu *pmu = &g->pmu; + struct nv_pmu_rpc_struct_acr_bootstrap_gr_falcons rpc; + u32 flags = PMU_ACR_CMD_BOOTSTRAP_FALCON_FLAGS_RESET_YES; + int status = 0; + + if (falconidmask == 0) + return -EINVAL; + + if (falconidmask & ~((1 << LSF_FALCON_ID_FECS) | + (1 << LSF_FALCON_ID_GPCCS))) + return -EINVAL; + + g->pmu_lsf_loaded_falcon_id = 0; + /* check whether pmu is ready to bootstrap lsf if not wait for it */ + if (!g->pmu_lsf_pmu_wpr_init_done) { + pmu_wait_message_cond(&g->pmu, + gk20a_get_gr_idle_timeout(g), + &g->pmu_lsf_pmu_wpr_init_done, 1); + /* check again if it still not ready indicate an error */ + if (!g->pmu_lsf_pmu_wpr_init_done) { + nvgpu_err(g, "PMU not ready to load LSF"); + status = -ETIMEDOUT; + goto exit; + } + } + + memset(&rpc, 0, sizeof(struct nv_pmu_rpc_struct_acr_bootstrap_gr_falcons)); + rpc.falcon_id_mask = falconidmask; + rpc.flags = flags; + rpc.falcon_va_mask = 0; + rpc.wpr_base_virtual.lo = 0; + rpc.wpr_base_virtual.hi = 0; + PMU_RPC_EXECUTE(status, pmu, ACR, BOOTSTRAP_GR_FALCONS, &rpc, 0); + if (status) { + nvgpu_err(g, "Failed to execute RPC, status=0x%x", status); + goto exit; + } + + pmu_wait_message_cond(&g->pmu, gk20a_get_gr_idle_timeout(g), + &g->pmu_lsf_loaded_falcon_id, 1); + + if (g->pmu_lsf_loaded_falcon_id != 1) + status = -ETIMEDOUT; + +exit: + return status; +} -- cgit v1.2.2