From 0a939d12f49a583796a36e402f1f1136dd22fbba Mon Sep 17 00:00:00 2001 From: Deepak Nibade Date: Thu, 21 Jun 2018 03:03:59 -0700 Subject: gpu: nvgpu: use explicit phys address for pci simulation nvgpu_mem_get_addr() gets virtual/phys address depending on the platform. But we need to explicitly use physical addresses to configure PCI simulation support since simulator expects physical address only Hence use nvgpu_mem_get_phys_addr() explicitly to configure msg/send/recv buffers needed for pci simulation support Jira NVGPUT-41 Change-Id: I6870feef35fe81d43189fa048dc2f7052926bcc4 Signed-off-by: Deepak Nibade Reviewed-on: https://git-master.nvidia.com/r/1756843 Reviewed-by: svc-mobile-coverity GVS: Gerrit_Virtual_Submit Reviewed-by: Vijayakumar Subbu Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/common/sim_pci.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'drivers') diff --git a/drivers/gpu/nvgpu/common/sim_pci.c b/drivers/gpu/nvgpu/common/sim_pci.c index 2f6f6765..b05504fe 100644 --- a/drivers/gpu/nvgpu/common/sim_pci.c +++ b/drivers/gpu/nvgpu/common/sim_pci.c @@ -89,11 +89,11 @@ static int rpc_send_message(struct gk20a *g) sim_dma_target_phys_pci_coherent_f() | sim_dma_status_valid_f() | sim_dma_size_4kb_f() | - sim_dma_addr_lo_f(nvgpu_mem_get_addr(g, &g->sim->msg_bfr) + sim_dma_addr_lo_f(nvgpu_mem_get_phys_addr(g, &g->sim->msg_bfr) >> PAGE_SHIFT); *sim_send_ring_bfr(g, dma_hi_offset*sizeof(u32)) = - u64_hi32(nvgpu_mem_get_addr(g, &g->sim->msg_bfr)); + u64_hi32(nvgpu_mem_get_phys_addr(g, &g->sim->msg_bfr)); *sim_msg_hdr(g, sim_msg_sequence_r()) = g->sim->sequence_base++; @@ -138,7 +138,8 @@ static int rpc_recv_poll(struct gk20a *g) recv_phys_addr = (u64)recv_phys_addr_hi << 32 | (u64)recv_phys_addr_lo << PAGE_SHIFT; - if (recv_phys_addr != nvgpu_mem_get_addr(g, &g->sim->msg_bfr)) { + if (recv_phys_addr != + nvgpu_mem_get_phys_addr(g, &g->sim->msg_bfr)) { nvgpu_err(g, "Error in RPC reply"); return -EINVAL; } @@ -217,7 +218,7 @@ static void nvgpu_sim_init_late(struct gk20a *g) sim_writel(g->sim, sim_send_put_r(), g->sim->send_ring_put); /* write send ring address and make it valid */ - phys = nvgpu_mem_get_addr(g, &g->sim->send_bfr); + phys = nvgpu_mem_get_phys_addr(g, &g->sim->send_bfr); sim_writel(g->sim, sim_send_ring_hi_r(), sim_send_ring_hi_addr_f(u64_hi32(phys))); sim_writel(g->sim, sim_send_ring_r(), @@ -234,7 +235,7 @@ static void nvgpu_sim_init_late(struct gk20a *g) sim_writel(g->sim, sim_recv_get_r(), g->sim->recv_ring_get); /* write send ring address and make it valid */ - phys = nvgpu_mem_get_addr(g, &g->sim->recv_bfr); + phys = nvgpu_mem_get_phys_addr(g, &g->sim->recv_bfr); sim_writel(g->sim, sim_recv_ring_hi_r(), sim_recv_ring_hi_addr_f(u64_hi32(phys))); sim_writel(g->sim, sim_recv_ring_r(), -- cgit v1.2.2