From 31432919cac8fc4ddad3b9245cf61ffd47d5db82 Mon Sep 17 00:00:00 2001 From: Richard Zhao Date: Thu, 29 Mar 2018 16:52:16 -0700 Subject: gpu: nvgpu: vgpu: fix build errors on qnx - Declare global functions before reaching the implementation. - avoid using current (current process). - assign ch->pid/tgid before using them. Jira VFND-4870 Change-Id: I688a1b89ef4d5dcf046929eab11d7e523caba0a5 Signed-off-by: Richard Zhao Reviewed-on: https://git-master.nvidia.com/r/1687142 Reviewed-by: svc-mobile-coverity Reviewed-by: Terje Bergstrom GVS: Gerrit_Virtual_Submit Reviewed-by: Nirav Patel Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/gk20a/channel_gk20a.c | 6 +++--- drivers/gpu/nvgpu/vgpu/fifo_vgpu.c | 2 +- drivers/gpu/nvgpu/vgpu/gp10b/vgpu_fuse_gp10b.c | 1 + drivers/gpu/nvgpu/vgpu/gv11b/vgpu_fifo_gv11b.c | 1 + drivers/gpu/nvgpu/vgpu/gv11b/vgpu_gr_gv11b.c | 1 + drivers/gpu/nvgpu/vgpu/gv11b/vgpu_subctx_gv11b.c | 1 + drivers/gpu/nvgpu/vgpu/mm_vgpu.c | 3 --- 7 files changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c index a68968fe..f50c37a7 100644 --- a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c @@ -645,6 +645,9 @@ struct channel_gk20a *gk20a_open_new_channel(struct gk20a *g, /* Channel privilege level */ ch->is_privileged_channel = is_privileged_channel; + ch->pid = nvgpu_current_tid(g); + ch->tgid = nvgpu_current_pid(g); /* process granularity for FECS traces */ + if (g->ops.fifo.alloc_inst(g, ch)) { ch->g = NULL; free_channel(f, ch); @@ -656,9 +659,6 @@ struct channel_gk20a *gk20a_open_new_channel(struct gk20a *g, /* now the channel is in a limbo out of the free list but not marked as * alive and used (i.e. get-able) yet */ - ch->pid = nvgpu_current_tid(g); - ch->tgid = nvgpu_current_pid(g); /* process granularity for FECS traces */ - /* By default, channel is regular (non-TSG) channel */ ch->tsgid = NVGPU_INVALID_TSG_ID; diff --git a/drivers/gpu/nvgpu/vgpu/fifo_vgpu.c b/drivers/gpu/nvgpu/vgpu/fifo_vgpu.c index c8a8ce49..d077f329 100644 --- a/drivers/gpu/nvgpu/vgpu/fifo_vgpu.c +++ b/drivers/gpu/nvgpu/vgpu/fifo_vgpu.c @@ -89,7 +89,7 @@ int vgpu_channel_alloc_inst(struct gk20a *g, struct channel_gk20a *ch) msg.cmd = TEGRA_VGPU_CMD_CHANNEL_ALLOC_HWCTX; msg.handle = vgpu_get_handle(g); p->id = ch->chid; - p->pid = (u64)current->tgid; + p->pid = (u64)ch->pid; err = vgpu_comm_sendrecv(&msg, sizeof(msg), sizeof(msg)); if (err || msg.ret) { nvgpu_err(g, "fail"); diff --git a/drivers/gpu/nvgpu/vgpu/gp10b/vgpu_fuse_gp10b.c b/drivers/gpu/nvgpu/vgpu/gp10b/vgpu_fuse_gp10b.c index 52b2aee5..0d3c6bc1 100644 --- a/drivers/gpu/nvgpu/vgpu/gp10b/vgpu_fuse_gp10b.c +++ b/drivers/gpu/nvgpu/vgpu/gp10b/vgpu_fuse_gp10b.c @@ -23,6 +23,7 @@ #include #include "gk20a/gk20a.h" +#include "vgpu_fuse_gp10b.h" int vgpu_gp10b_fuse_check_priv_security(struct gk20a *g) { diff --git a/drivers/gpu/nvgpu/vgpu/gv11b/vgpu_fifo_gv11b.c b/drivers/gpu/nvgpu/vgpu/gv11b/vgpu_fifo_gv11b.c index 18d2de70..9b689699 100644 --- a/drivers/gpu/nvgpu/vgpu/gv11b/vgpu_fifo_gv11b.c +++ b/drivers/gpu/nvgpu/vgpu/gv11b/vgpu_fifo_gv11b.c @@ -26,6 +26,7 @@ #include #include "gv11b/fifo_gv11b.h" +#include "vgpu_fifo_gv11b.h" #ifdef CONFIG_TEGRA_GK20A_NVHOST diff --git a/drivers/gpu/nvgpu/vgpu/gv11b/vgpu_gr_gv11b.c b/drivers/gpu/nvgpu/vgpu/gv11b/vgpu_gr_gv11b.c index 3c93c581..df4d87da 100644 --- a/drivers/gpu/nvgpu/vgpu/gv11b/vgpu_gr_gv11b.c +++ b/drivers/gpu/nvgpu/vgpu/gv11b/vgpu_gr_gv11b.c @@ -23,6 +23,7 @@ #include "gk20a/gk20a.h" #include "vgpu/gr_vgpu.h" #include "vgpu_subctx_gv11b.h" +#include "vgpu_gr_gv11b.h" int vgpu_gr_gv11b_commit_inst(struct channel_gk20a *c, u64 gpu_va) { diff --git a/drivers/gpu/nvgpu/vgpu/gv11b/vgpu_subctx_gv11b.c b/drivers/gpu/nvgpu/vgpu/gv11b/vgpu_subctx_gv11b.c index ba92c8d5..2372b9c4 100644 --- a/drivers/gpu/nvgpu/vgpu/gv11b/vgpu_subctx_gv11b.c +++ b/drivers/gpu/nvgpu/vgpu/gv11b/vgpu_subctx_gv11b.c @@ -21,6 +21,7 @@ */ #include "gk20a/gk20a.h" +#include "vgpu_subctx_gv11b.h" #include #include diff --git a/drivers/gpu/nvgpu/vgpu/mm_vgpu.c b/drivers/gpu/nvgpu/vgpu/mm_vgpu.c index 21496906..c10a1982 100644 --- a/drivers/gpu/nvgpu/vgpu/mm_vgpu.c +++ b/drivers/gpu/nvgpu/vgpu/mm_vgpu.c @@ -31,9 +31,6 @@ #include #include -#include -#include - #include "mm_vgpu.h" #include "gk20a/gk20a.h" #include "gk20a/mm_gk20a.h" -- cgit v1.2.2