From 560e243f2d8b6cf3fafd8e79560cbf6dffe58e9e Mon Sep 17 00:00:00 2001 From: Antony Clince Alex Date: Mon, 30 Apr 2018 12:57:29 +0530 Subject: gpu: nvgpu: added nvgpu_sim_init_late Split sim initialization to two parts, first part gets invoked as part of probe and second part gets invoked in the finalize_poweron after the hal has been initialized. This is done because some of the sim init code uses mm api's which are assigned as part of hal init. replaced sim buffer allocation api's with nvgpu_dma_sys_alloc. Change-Id: Ib019fbb747bdf6dcc74e7deba732ab41f0869e96 Signed-off-by: Antony Clince Alex Reviewed-on: https://git-master.nvidia.com/r/1705424 Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/common/sim_pci.c | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) (limited to 'drivers/gpu/nvgpu/common/sim_pci.c') diff --git a/drivers/gpu/nvgpu/common/sim_pci.c b/drivers/gpu/nvgpu/common/sim_pci.c index a72623e9..2f6f6765 100644 --- a/drivers/gpu/nvgpu/common/sim_pci.c +++ b/drivers/gpu/nvgpu/common/sim_pci.c @@ -201,21 +201,14 @@ static int nvgpu_sim_esc_readl(struct gk20a *g, return err; } -int nvgpu_init_sim_support_pci(struct gk20a *g) +static void nvgpu_sim_init_late(struct gk20a *g) { - int err = -ENOMEM; u64 phys; if (!g->sim) - return 0; + return; - /* allocate sim event/msg buffers */ - err = nvgpu_alloc_sim_buffer(g, &g->sim->send_bfr); - err = err || nvgpu_alloc_sim_buffer(g, &g->sim->recv_bfr); - err = err || nvgpu_alloc_sim_buffer(g, &g->sim->msg_bfr); - - if (err) - goto fail; + nvgpu_info(g, "sim init late pci"); /* mark send ring invalid */ sim_writel(g->sim, sim_send_ring_r(), sim_send_ring_status_invalid_f()); @@ -249,7 +242,24 @@ int nvgpu_init_sim_support_pci(struct gk20a *g) sim_recv_ring_target_phys_pci_coherent_f() | sim_recv_ring_size_4kb_f() | sim_recv_ring_addr_lo_f(phys >> PAGE_SHIFT)); +} + +int nvgpu_init_sim_support_pci(struct gk20a *g) +{ + int err = -ENOMEM; + + if(!g->sim) + return 0; + + /* allocate sim event/msg buffers */ + err = nvgpu_alloc_sim_buffer(g, &g->sim->send_bfr); + err = err || nvgpu_alloc_sim_buffer(g, &g->sim->recv_bfr); + err = err || nvgpu_alloc_sim_buffer(g, &g->sim->msg_bfr); + + if (err) + goto fail; + g->sim->sim_init_late = nvgpu_sim_init_late; g->sim->remove_support = nvgpu_remove_sim_support; g->sim->esc_readl = nvgpu_sim_esc_readl; return 0; -- cgit v1.2.2