From cc9f3d80e32c63ae003a8dc66016a035100a6359 Mon Sep 17 00:00:00 2001 From: Richard Zhao Date: Thu, 12 Apr 2018 16:06:02 -0700 Subject: gpu: nvgpu: pass pid/tid from os specific code to common code linux driver runs in user's process but qnx driver has dedicate driver process, so they have different way to get user pid. nvgpu common code expect calls from os specific code pass pid/tid. ce/cde open channel for internal use, we use driver pid. Jira VQRM-3534 Change-Id: I892372ac5f1dc4d25f9928d16992bcc659d12a56 Signed-off-by: Richard Zhao Reviewed-on: https://git-master.nvidia.com/r/1694145 GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/common/linux/cde.c | 3 ++- drivers/gpu/nvgpu/common/linux/channel.c | 6 ++++-- drivers/gpu/nvgpu/common/linux/ioctl_channel.c | 6 ++++-- drivers/gpu/nvgpu/common/linux/ioctl_tsg.c | 3 ++- 4 files changed, 12 insertions(+), 6 deletions(-) (limited to 'drivers/gpu/nvgpu/common/linux') diff --git a/drivers/gpu/nvgpu/common/linux/cde.c b/drivers/gpu/nvgpu/common/linux/cde.c index 4911afa1..f3895d5c 100644 --- a/drivers/gpu/nvgpu/common/linux/cde.c +++ b/drivers/gpu/nvgpu/common/linux/cde.c @@ -31,6 +31,7 @@ #include #include #include +#include #include @@ -1287,7 +1288,7 @@ static int gk20a_cde_load(struct gk20a_cde_ctx *cde_ctx) return -ENOSYS; } - tsg = gk20a_tsg_open(g); + tsg = gk20a_tsg_open(g, nvgpu_current_pid(g)); if (!tsg) { nvgpu_err(g, "cde: could not create TSG"); err = -ENOMEM; diff --git a/drivers/gpu/nvgpu/common/linux/channel.c b/drivers/gpu/nvgpu/common/linux/channel.c index 70baeb2d..a360d0df 100644 --- a/drivers/gpu/nvgpu/common/linux/channel.c +++ b/drivers/gpu/nvgpu/common/linux/channel.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, NVIDIA Corporation. All rights reserved. + * Copyright (c) 2017-2018, NVIDIA Corporation. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, @@ -18,6 +18,7 @@ #include #include #include +#include /* * This is required for nvgpu_vm_find_buf() which is used in the tracing @@ -251,7 +252,8 @@ struct channel_gk20a *gk20a_open_new_channel_with_cb(struct gk20a *g, struct channel_gk20a *ch; struct nvgpu_channel_linux *priv; - ch = gk20a_open_new_channel(g, runlist_id, is_privileged_channel); + ch = gk20a_open_new_channel(g, runlist_id, is_privileged_channel, + nvgpu_current_pid(g), nvgpu_current_tid(g)); if (ch) { priv = ch->os_priv; diff --git a/drivers/gpu/nvgpu/common/linux/ioctl_channel.c b/drivers/gpu/nvgpu/common/linux/ioctl_channel.c index 5b4dda6c..b4d7d501 100644 --- a/drivers/gpu/nvgpu/common/linux/ioctl_channel.c +++ b/drivers/gpu/nvgpu/common/linux/ioctl_channel.c @@ -1,7 +1,7 @@ /* * GK20A Graphics channel * - * Copyright (c) 2011-2017, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2011-2018, NVIDIA CORPORATION. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, @@ -33,6 +33,7 @@ #include #include #include +#include #include "gk20a/gk20a.h" #include "gk20a/dbg_gpu_gk20a.h" @@ -495,7 +496,8 @@ static int __gk20a_channel_open(struct gk20a *g, goto fail_busy; } /* All the user space channel should be non privilege */ - ch = gk20a_open_new_channel(g, runlist_id, false); + ch = gk20a_open_new_channel(g, runlist_id, false, + nvgpu_current_pid(g), nvgpu_current_tid(g)); gk20a_idle(g); if (!ch) { nvgpu_err(g, diff --git a/drivers/gpu/nvgpu/common/linux/ioctl_tsg.c b/drivers/gpu/nvgpu/common/linux/ioctl_tsg.c index 60aca5ec..be2315bd 100644 --- a/drivers/gpu/nvgpu/common/linux/ioctl_tsg.c +++ b/drivers/gpu/nvgpu/common/linux/ioctl_tsg.c @@ -24,6 +24,7 @@ #include #include +#include #include "gk20a/gk20a.h" #include "gk20a/tsg_gk20a.h" @@ -370,7 +371,7 @@ int nvgpu_ioctl_tsg_open(struct gk20a *g, struct file *filp) goto free_ref; } - tsg = gk20a_tsg_open(g); + tsg = gk20a_tsg_open(g, nvgpu_current_pid(g)); if (!tsg) { nvgpu_kfree(g, priv); err = -ENOMEM; -- cgit v1.2.2