From 9d2c9072c8b9a7742db3974d6027df9d44e0953f Mon Sep 17 00:00:00 2001 From: Sami Kiminki Date: Mon, 4 May 2015 18:41:23 +0300 Subject: gpu: nvgpu: User-space managed address space support Implement NVGPU_GPU_IOCTL_ALLOC_AS_FLAGS_USERSPACE_MANAGED, which enables creating userspace-managed GPU address spaces. When an address space is marked as userspace-managed, the following changes are in effect: - Only fixed-address mappings are allowed. - VA space allocation for fixed-address mappings is not required, except to mark space as sparse. - Maps and unmaps are always immediate. In particular, the mapping ref increments at kickoffs and decrements at job completion are skipped. Bug 1614735 Bug 1623949 Bug 1660392 Change-Id: I834fe19b3f65e9b02c268952383eddee0e465759 Signed-off-by: Sami Kiminki Reviewed-on: http://git-master/r/738558 Reviewed-on: http://git-master/r/833253 Reviewed-by: Terje Bergstrom Tested-by: Terje Bergstrom --- include/uapi/linux/nvgpu.h | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'include/uapi/linux/nvgpu.h') diff --git a/include/uapi/linux/nvgpu.h b/include/uapi/linux/nvgpu.h index 6a8e44c5..d2b5ceb8 100644 --- a/include/uapi/linux/nvgpu.h +++ b/include/uapi/linux/nvgpu.h @@ -106,6 +106,8 @@ struct nvgpu_gpu_zbc_query_table_args { #define NVGPU_GPU_FLAGS_SUPPORT_CYCLE_STATS (1 << 4) /* NVGPU_IOCTL_CHANNEL_CYCLE_STATS_SNAPSHOT is available */ #define NVGPU_GPU_FLAGS_SUPPORT_CYCLE_STATS_SNAPSHOT (1 << 6) +/* User-space managed address spaces support */ +#define NVGPU_GPU_FLAGS_SUPPORT_USERSPACE_MANAGED_AS (1 << 7) struct nvgpu_gpu_characteristics { __u32 arch; @@ -239,7 +241,22 @@ struct nvgpu_gpu_mark_compressible_write_args { struct nvgpu_alloc_as_args { __u32 big_page_size; __s32 as_fd; - __u64 reserved; /* must be zero */ + +/* + * The GPU address space will be managed by the userspace. This has + * the following changes in functionality: + * 1. All non-fixed-offset user mappings are rejected (i.e., + * fixed-offset only) + * 2. Address space does not need to be allocated for fixed-offset + * mappings, except to mark sparse address space areas. + * 3. Maps and unmaps are immediate. In particular, mapping ref + * increments at kickoffs and decrements at job completion are + * bypassed. + */ +#define NVGPU_GPU_IOCTL_ALLOC_AS_FLAGS_USERSPACE_MANAGED (1 << 0) + __u32 flags; + + __u32 reserved; /* must be zero */ }; struct nvgpu_gpu_open_tsg_args { -- cgit v1.2.2