summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/common/sim_pci.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/nvgpu/common/sim_pci.c')
-rw-r--r--drivers/gpu/nvgpu/common/sim_pci.c30
1 files changed, 20 insertions, 10 deletions
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,
201 return err; 201 return err;
202} 202}
203 203
204int nvgpu_init_sim_support_pci(struct gk20a *g) 204static void nvgpu_sim_init_late(struct gk20a *g)
205{ 205{
206 int err = -ENOMEM;
207 u64 phys; 206 u64 phys;
208 207
209 if (!g->sim) 208 if (!g->sim)
210 return 0; 209 return;
211 210
212 /* allocate sim event/msg buffers */ 211 nvgpu_info(g, "sim init late pci");
213 err = nvgpu_alloc_sim_buffer(g, &g->sim->send_bfr);
214 err = err || nvgpu_alloc_sim_buffer(g, &g->sim->recv_bfr);
215 err = err || nvgpu_alloc_sim_buffer(g, &g->sim->msg_bfr);
216
217 if (err)
218 goto fail;
219 /* mark send ring invalid */ 212 /* mark send ring invalid */
220 sim_writel(g->sim, sim_send_ring_r(), sim_send_ring_status_invalid_f()); 213 sim_writel(g->sim, sim_send_ring_r(), sim_send_ring_status_invalid_f());
221 214
@@ -249,7 +242,24 @@ int nvgpu_init_sim_support_pci(struct gk20a *g)
249 sim_recv_ring_target_phys_pci_coherent_f() | 242 sim_recv_ring_target_phys_pci_coherent_f() |
250 sim_recv_ring_size_4kb_f() | 243 sim_recv_ring_size_4kb_f() |
251 sim_recv_ring_addr_lo_f(phys >> PAGE_SHIFT)); 244 sim_recv_ring_addr_lo_f(phys >> PAGE_SHIFT));
245}
246
247int nvgpu_init_sim_support_pci(struct gk20a *g)
248{
249 int err = -ENOMEM;
250
251 if(!g->sim)
252 return 0;
253
254 /* allocate sim event/msg buffers */
255 err = nvgpu_alloc_sim_buffer(g, &g->sim->send_bfr);
256 err = err || nvgpu_alloc_sim_buffer(g, &g->sim->recv_bfr);
257 err = err || nvgpu_alloc_sim_buffer(g, &g->sim->msg_bfr);
258
259 if (err)
260 goto fail;
252 261
262 g->sim->sim_init_late = nvgpu_sim_init_late;
253 g->sim->remove_support = nvgpu_remove_sim_support; 263 g->sim->remove_support = nvgpu_remove_sim_support;
254 g->sim->esc_readl = nvgpu_sim_esc_readl; 264 g->sim->esc_readl = nvgpu_sim_esc_readl;
255 return 0; 265 return 0;