summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTerje Bergstrom <tbergstrom@nvidia.com>2018-04-05 17:16:04 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2018-04-06 17:07:33 -0400
commitaeaa7c982662c98d2477b5cfb9fb5242d5f540b5 (patch)
treedd33f32bf7873dbf3ca7968e9bf834f0935e07bb
parent1389aa3e87ae059121329af41009b37692177775 (diff)
gpu: nvgpu: Use tegra_alloc_fd() only on Tegra kernel
tegra_alloc_fd() exists only in Tegra kernel. Use get_unused_fd_flags() in other platforms. JIRA NVGPU-4 Change-Id: I12b16957263f6cea771314a9da229384c865e65f Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1689538 Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com> GVS: Gerrit_Virtual_Submit Reviewed-by: Alex Waterman <alexw@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
-rw-r--r--drivers/gpu/nvgpu/Kconfig11
-rw-r--r--drivers/gpu/nvgpu/common/linux/vidmem.c6
2 files changed, 17 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/Kconfig b/drivers/gpu/nvgpu/Kconfig
index ca1db973..ac0fa261 100644
--- a/drivers/gpu/nvgpu/Kconfig
+++ b/drivers/gpu/nvgpu/Kconfig
@@ -135,3 +135,14 @@ config NVGPU_SUPPORT_CDE
135 default y 135 default y
136 help 136 help
137 Enable support for extraction of comptags for CDE. 137 Enable support for extraction of comptags for CDE.
138
139config NVGPU_USE_TEGRA_ALLOC_FD
140 bool "Use tegra_alloc_fd() for allocating dma_buf fds for vidmem"
141 depends on GK20A && GK20A_VIDMEM
142 default y
143 help
144 Use tegra_alloc_fd() for allocating dma_buf fds. This allocates
145 the fds above 1024 which exempts them from counting against process
146 fd limit.
147
148 It is only available in Tegra kernel.
diff --git a/drivers/gpu/nvgpu/common/linux/vidmem.c b/drivers/gpu/nvgpu/common/linux/vidmem.c
index 684262ba..136d4a10 100644
--- a/drivers/gpu/nvgpu/common/linux/vidmem.c
+++ b/drivers/gpu/nvgpu/common/linux/vidmem.c
@@ -17,7 +17,9 @@
17#include <linux/dma-buf.h> 17#include <linux/dma-buf.h>
18#include <uapi/linux/nvgpu.h> 18#include <uapi/linux/nvgpu.h>
19 19
20#ifdef CONFIG_NVGPU_USE_TEGRA_ALLOC_FD
20#include <linux/platform/tegra/tegra_fd.h> 21#include <linux/platform/tegra/tegra_fd.h>
22#endif
21 23
22#include <nvgpu/dma.h> 24#include <nvgpu/dma.h>
23#include <nvgpu/enabled.h> 25#include <nvgpu/enabled.h>
@@ -195,7 +197,11 @@ int nvgpu_vidmem_export_linux(struct gk20a *g, size_t bytes)
195 197
196 buf->priv = priv; 198 buf->priv = priv;
197 199
200#ifdef CONFIG_NVGPU_USE_TEGRA_ALLOC_FD
198 fd = tegra_alloc_fd(current->files, 1024, O_RDWR); 201 fd = tegra_alloc_fd(current->files, 1024, O_RDWR);
202#else
203 fd = get_unused_fd_flags(O_RDWR);
204#endif
199 if (fd < 0) { 205 if (fd < 0) {
200 /* ->release frees what we have done */ 206 /* ->release frees what we have done */
201 dma_buf_put(priv->dmabuf); 207 dma_buf_put(priv->dmabuf);