summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Waterman <alexw@nvidia.com>2018-05-16 14:15:27 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2018-05-17 16:03:32 -0400
commit2203d0330231821eeae18517715ba754e093ab18 (patch)
tree73b142861090ea56b7f4e1a3b055d5adfff5fd07
parent7abf697204481869dd2652fe306e2a46879d9152 (diff)
gpu: nvgpu: Translate as_alloc flags
Translate the as_alloc flags so that the common/as.c code no longer needs to include <uapi/linux/nvgpu.h>. This was an oversight from prior MM unification efforts which was caught by the userspace POSIX build on QNX. JIRA NVGPU-525 Change-Id: I6af6cb9904c2ae9edeb8dbb970846c31b56822bf Signed-off-by: Alex Waterman <alexw@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1720918 Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com> Reviewed-by: Sourab Gupta <sourabg@nvidia.com> GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
-rw-r--r--drivers/gpu/nvgpu/common/as.c3
-rw-r--r--drivers/gpu/nvgpu/common/linux/ioctl_as.c6
-rw-r--r--drivers/gpu/nvgpu/common/linux/ioctl_ctrl.c14
-rw-r--r--drivers/gpu/nvgpu/include/nvgpu/as.h5
4 files changed, 22 insertions, 6 deletions
diff --git a/drivers/gpu/nvgpu/common/as.c b/drivers/gpu/nvgpu/common/as.c
index 77f088b7..5458614e 100644
--- a/drivers/gpu/nvgpu/common/as.c
+++ b/drivers/gpu/nvgpu/common/as.c
@@ -23,7 +23,6 @@
23 */ 23 */
24 24
25#include <trace/events/gk20a.h> 25#include <trace/events/gk20a.h>
26#include <uapi/linux/nvgpu.h>
27 26
28#include <nvgpu/kmem.h> 27#include <nvgpu/kmem.h>
29#include <nvgpu/vm.h> 28#include <nvgpu/vm.h>
@@ -58,7 +57,7 @@ static int gk20a_vm_alloc_share(struct gk20a_as_share *as_share,
58 struct vm_gk20a *vm; 57 struct vm_gk20a *vm;
59 char name[32]; 58 char name[32];
60 const bool userspace_managed = 59 const bool userspace_managed =
61 (flags & NVGPU_GPU_IOCTL_ALLOC_AS_FLAGS_USERSPACE_MANAGED) != 0; 60 (flags & NVGPU_AS_ALLOC_USERSPACE_MANAGED) != 0;
62 61
63 nvgpu_log_fn(g, " "); 62 nvgpu_log_fn(g, " ");
64 63
diff --git a/drivers/gpu/nvgpu/common/linux/ioctl_as.c b/drivers/gpu/nvgpu/common/linux/ioctl_as.c
index 41bbdfcb..47f612cc 100644
--- a/drivers/gpu/nvgpu/common/linux/ioctl_as.c
+++ b/drivers/gpu/nvgpu/common/linux/ioctl_as.c
@@ -32,7 +32,7 @@
32#include "ioctl_as.h" 32#include "ioctl_as.h"
33#include "os_linux.h" 33#include "os_linux.h"
34 34
35static u32 gk20a_as_translate_linux_flags(struct gk20a *g, u32 flags) 35static u32 gk20a_as_translate_as_alloc_space_flags(struct gk20a *g, u32 flags)
36{ 36{
37 u32 core_flags = 0; 37 u32 core_flags = 0;
38 38
@@ -80,8 +80,8 @@ static int gk20a_as_ioctl_alloc_space(
80 nvgpu_log_fn(g, " "); 80 nvgpu_log_fn(g, " ");
81 return nvgpu_vm_area_alloc(as_share->vm, args->pages, args->page_size, 81 return nvgpu_vm_area_alloc(as_share->vm, args->pages, args->page_size,
82 &args->o_a.offset, 82 &args->o_a.offset,
83 gk20a_as_translate_linux_flags(g, 83 gk20a_as_translate_as_alloc_space_flags(g,
84 args->flags)); 84 args->flags));
85} 85}
86 86
87static int gk20a_as_ioctl_free_space( 87static int gk20a_as_ioctl_free_space(
diff --git a/drivers/gpu/nvgpu/common/linux/ioctl_ctrl.c b/drivers/gpu/nvgpu/common/linux/ioctl_ctrl.c
index 7bb97369..e7da0978 100644
--- a/drivers/gpu/nvgpu/common/linux/ioctl_ctrl.c
+++ b/drivers/gpu/nvgpu/common/linux/ioctl_ctrl.c
@@ -55,6 +55,16 @@ struct gk20a_ctrl_priv {
55 struct nvgpu_clk_session *clk_session; 55 struct nvgpu_clk_session *clk_session;
56}; 56};
57 57
58static u32 gk20a_as_translate_as_alloc_flags(struct gk20a *g, u32 flags)
59{
60 u32 core_flags = 0;
61
62 if (flags & NVGPU_GPU_IOCTL_ALLOC_AS_FLAGS_USERSPACE_MANAGED)
63 core_flags |= NVGPU_AS_ALLOC_USERSPACE_MANAGED;
64
65 return core_flags;
66}
67
58int gk20a_ctrl_dev_open(struct inode *inode, struct file *filp) 68int gk20a_ctrl_dev_open(struct inode *inode, struct file *filp)
59{ 69{
60 struct nvgpu_os_linux *l; 70 struct nvgpu_os_linux *l;
@@ -439,7 +449,9 @@ static int gk20a_ctrl_alloc_as(
439 goto clean_up; 449 goto clean_up;
440 } 450 }
441 451
442 err = gk20a_as_alloc_share(g, args->big_page_size, args->flags, 452 err = gk20a_as_alloc_share(g, args->big_page_size,
453 gk20a_as_translate_as_alloc_flags(g,
454 args->flags),
443 &as_share); 455 &as_share);
444 if (err) 456 if (err)
445 goto clean_up_file; 457 goto clean_up_file;
diff --git a/drivers/gpu/nvgpu/include/nvgpu/as.h b/drivers/gpu/nvgpu/include/nvgpu/as.h
index 03799717..b16652da 100644
--- a/drivers/gpu/nvgpu/include/nvgpu/as.h
+++ b/drivers/gpu/nvgpu/include/nvgpu/as.h
@@ -36,6 +36,11 @@ struct gk20a_as_share {
36 int id; 36 int id;
37}; 37};
38 38
39/*
40 * AS allocation flags.
41 */
42#define NVGPU_AS_ALLOC_USERSPACE_MANAGED (1 << 0)
43
39int gk20a_as_release_share(struct gk20a_as_share *as_share); 44int gk20a_as_release_share(struct gk20a_as_share *as_share);
40 45
41/* if big_page_size == 0, the default big page size is used */ 46/* if big_page_size == 0, the default big page size is used */