From 2203d0330231821eeae18517715ba754e093ab18 Mon Sep 17 00:00:00 2001 From: Alex Waterman Date: Wed, 16 May 2018 11:15:27 -0700 Subject: gpu: nvgpu: Translate as_alloc flags Translate the as_alloc flags so that the common/as.c code no longer needs to include . 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 Reviewed-on: https://git-master.nvidia.com/r/1720918 Reviewed-by: svc-mobile-coverity Reviewed-by: Sourab Gupta GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/common/as.c | 3 +-- drivers/gpu/nvgpu/common/linux/ioctl_as.c | 6 +++--- drivers/gpu/nvgpu/common/linux/ioctl_ctrl.c | 14 +++++++++++++- drivers/gpu/nvgpu/include/nvgpu/as.h | 5 +++++ 4 files changed, 22 insertions(+), 6 deletions(-) (limited to 'drivers/gpu/nvgpu') 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 @@ */ #include -#include #include #include @@ -58,7 +57,7 @@ static int gk20a_vm_alloc_share(struct gk20a_as_share *as_share, struct vm_gk20a *vm; char name[32]; const bool userspace_managed = - (flags & NVGPU_GPU_IOCTL_ALLOC_AS_FLAGS_USERSPACE_MANAGED) != 0; + (flags & NVGPU_AS_ALLOC_USERSPACE_MANAGED) != 0; nvgpu_log_fn(g, " "); 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 @@ #include "ioctl_as.h" #include "os_linux.h" -static u32 gk20a_as_translate_linux_flags(struct gk20a *g, u32 flags) +static u32 gk20a_as_translate_as_alloc_space_flags(struct gk20a *g, u32 flags) { u32 core_flags = 0; @@ -80,8 +80,8 @@ static int gk20a_as_ioctl_alloc_space( nvgpu_log_fn(g, " "); return nvgpu_vm_area_alloc(as_share->vm, args->pages, args->page_size, &args->o_a.offset, - gk20a_as_translate_linux_flags(g, - args->flags)); + gk20a_as_translate_as_alloc_space_flags(g, + args->flags)); } 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 { struct nvgpu_clk_session *clk_session; }; +static u32 gk20a_as_translate_as_alloc_flags(struct gk20a *g, u32 flags) +{ + u32 core_flags = 0; + + if (flags & NVGPU_GPU_IOCTL_ALLOC_AS_FLAGS_USERSPACE_MANAGED) + core_flags |= NVGPU_AS_ALLOC_USERSPACE_MANAGED; + + return core_flags; +} + int gk20a_ctrl_dev_open(struct inode *inode, struct file *filp) { struct nvgpu_os_linux *l; @@ -439,7 +449,9 @@ static int gk20a_ctrl_alloc_as( goto clean_up; } - err = gk20a_as_alloc_share(g, args->big_page_size, args->flags, + err = gk20a_as_alloc_share(g, args->big_page_size, + gk20a_as_translate_as_alloc_flags(g, + args->flags), &as_share); if (err) 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 { int id; }; +/* + * AS allocation flags. + */ +#define NVGPU_AS_ALLOC_USERSPACE_MANAGED (1 << 0) + int gk20a_as_release_share(struct gk20a_as_share *as_share); /* if big_page_size == 0, the default big page size is used */ -- cgit v1.2.2