diff options
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/nvgpu/common/as.c | 3 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/common/linux/ioctl_as.c | 6 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/common/linux/ioctl_ctrl.c | 14 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/include/nvgpu/as.h | 5 |
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 | ||
35 | static u32 gk20a_as_translate_linux_flags(struct gk20a *g, u32 flags) | 35 | static 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 | ||
87 | static int gk20a_as_ioctl_free_space( | 87 | static 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 | ||
58 | static 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 | |||
58 | int gk20a_ctrl_dev_open(struct inode *inode, struct file *filp) | 68 | int 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 | |||
39 | int gk20a_as_release_share(struct gk20a_as_share *as_share); | 44 | int 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 */ |