From 28abb3d2cd3a9efe413be3c2f8e897ccd72f6b93 Mon Sep 17 00:00:00 2001 From: Richard Zhao Date: Mon, 29 Jan 2018 17:51:06 -0800 Subject: gpu: nvgpu: vgpu: avoid using sg_table when map bar1 Move to use OS agnostic function nvgpu_mem_get_addr(). Jira EVLR-2364 Change-Id: I2f38567cae35c5d410f082785213af6052150c27 Signed-off-by: Richard Zhao Reviewed-on: https://git-master.nvidia.com/r/1649942 Reviewed-by: Aingara Paramakuru Reviewed-by: Terje Bergstrom GVS: Gerrit_Virtual_Submit Reviewed-by: Nirav Patel Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/common/linux/vgpu/fifo_vgpu.c | 3 +-- drivers/gpu/nvgpu/common/linux/vgpu/mm_vgpu.c | 6 +++--- drivers/gpu/nvgpu/common/linux/vgpu/vgpu.h | 6 +++--- 3 files changed, 7 insertions(+), 8 deletions(-) (limited to 'drivers/gpu/nvgpu/common/linux/vgpu') diff --git a/drivers/gpu/nvgpu/common/linux/vgpu/fifo_vgpu.c b/drivers/gpu/nvgpu/common/linux/vgpu/fifo_vgpu.c index 2a7cfdb3..9b82ba8f 100644 --- a/drivers/gpu/nvgpu/common/linux/vgpu/fifo_vgpu.c +++ b/drivers/gpu/nvgpu/common/linux/vgpu/fifo_vgpu.c @@ -290,8 +290,7 @@ static int vgpu_init_fifo_setup_sw(struct gk20a *g) /* bar1 va */ if (g->ops.mm.is_bar1_supported(g)) { - f->userd.gpu_va = vgpu_bar1_map(g, &f->userd.priv.sgt, - f->userd.size); + f->userd.gpu_va = vgpu_bar1_map(g, &f->userd); if (!f->userd.gpu_va) { nvgpu_err(g, "gmmu mapping failed"); goto clean_up; diff --git a/drivers/gpu/nvgpu/common/linux/vgpu/mm_vgpu.c b/drivers/gpu/nvgpu/common/linux/vgpu/mm_vgpu.c index 7290c9df..7d73594d 100644 --- a/drivers/gpu/nvgpu/common/linux/vgpu/mm_vgpu.c +++ b/drivers/gpu/nvgpu/common/linux/vgpu/mm_vgpu.c @@ -157,9 +157,9 @@ void vgpu_vm_remove(struct vm_gk20a *vm) WARN_ON(err || msg.ret); } -u64 vgpu_bar1_map(struct gk20a *g, struct sg_table **sgt, u64 size) +u64 vgpu_bar1_map(struct gk20a *g, struct nvgpu_mem *mem) { - u64 addr = nvgpu_mem_get_addr_sgl(g, (*sgt)->sgl); + u64 addr = nvgpu_mem_get_addr(g, mem); struct tegra_vgpu_cmd_msg msg; struct tegra_vgpu_as_map_params *p = &msg.params.as_map; int err; @@ -167,7 +167,7 @@ u64 vgpu_bar1_map(struct gk20a *g, struct sg_table **sgt, u64 size) msg.cmd = TEGRA_VGPU_CMD_MAP_BAR1; msg.handle = vgpu_get_handle(g); p->addr = addr; - p->size = size; + p->size = mem->size; p->iova = 0; err = vgpu_comm_sendrecv(&msg, sizeof(msg), sizeof(msg)); if (err || msg.ret) diff --git a/drivers/gpu/nvgpu/common/linux/vgpu/vgpu.h b/drivers/gpu/nvgpu/common/linux/vgpu/vgpu.h index be999930..eafe503c 100644 --- a/drivers/gpu/nvgpu/common/linux/vgpu/vgpu.h +++ b/drivers/gpu/nvgpu/common/linux/vgpu/vgpu.h @@ -24,6 +24,7 @@ struct tegra_vgpu_gr_intr_info; struct tegra_vgpu_fifo_intr_info; struct tegra_vgpu_cmd_msg; struct gk20a_platform; +struct nvgpu_mem; #ifdef CONFIG_TEGRA_GR_VIRTUALIZATION #include @@ -69,7 +70,7 @@ int vgpu_pm_prepare_poweroff(struct device *dev); int vgpu_pm_finalize_poweron(struct device *dev); int vgpu_probe(struct platform_device *dev); int vgpu_remove(struct platform_device *dev); -u64 vgpu_bar1_map(struct gk20a *g, struct sg_table **sgt, u64 size); +u64 vgpu_bar1_map(struct gk20a *g, struct nvgpu_mem *mem); int vgpu_gr_isr(struct gk20a *g, struct tegra_vgpu_gr_intr_info *info); int vgpu_gr_nonstall_isr(struct gk20a *g, struct tegra_vgpu_gr_nonstall_intr_info *info); @@ -125,8 +126,7 @@ static inline int vgpu_remove(struct platform_device *dev) { return -ENOSYS; } -static inline u64 vgpu_bar1_map(struct gk20a *g, struct sg_table **sgt, - u64 size) +static inline u64 vgpu_bar1_map(struct gk20a *g, struct nvgpu_mem *mem) { return 0; } -- cgit v1.2.2