From 7fea56cf9789c2b955729865ee7e9130efc62a0a Mon Sep 17 00:00:00 2001 From: Sagar Kamble Date: Thu, 18 Jun 2020 18:33:15 +0530 Subject: [PATCH] gpu: nvgpu: add MAP_ACCESS_TYPE enabled flag On Linux, nvgpu mapping ioctl provides option to specify the access type flags for the mapping. This support is not implemented for other OS. For nvrm_gpu to know when to set these flags add new enabled flag *_MAP_ACCESS_TYPE that is enabled only for Linux. Bug 200621157 Change-Id: If1397bb0d5fdc5589458d92f24647afa586af1c2 Signed-off-by: Sagar Kamble Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2363829 Reviewed-by: automaticguardword Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Deepak Nibade Reviewed-by: mobile promotions Tested-by: mobile promotions GVS: Gerrit_Virtual_Submit --- drivers/gpu/nvgpu/include/nvgpu/enabled.h | 5 ++++- drivers/gpu/nvgpu/os/linux/ioctl_ctrl.c | 4 +++- drivers/gpu/nvgpu/os/linux/module.c | 1 + include/uapi/linux/nvgpu.h | 2 ++ 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/nvgpu/include/nvgpu/enabled.h b/drivers/gpu/nvgpu/include/nvgpu/enabled.h index 6bf3f7d2c..7c3807328 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/enabled.h +++ b/drivers/gpu/nvgpu/include/nvgpu/enabled.h @@ -261,10 +261,13 @@ struct gk20a; /** PLC Compression */ #define NVGPU_SUPPORT_POST_L2_COMPRESSION 89U +/** GMMU map access type support */ +#define NVGPU_SUPPORT_MAP_ACCESS_TYPE 90U + /* * Must be greater than the largest bit offset in the above list. */ -#define NVGPU_MAX_ENABLED_BITS 90U +#define NVGPU_MAX_ENABLED_BITS 91U /** * @brief Check if the passed flag is enabled. diff --git a/drivers/gpu/nvgpu/os/linux/ioctl_ctrl.c b/drivers/gpu/nvgpu/os/linux/ioctl_ctrl.c index 9021b28b9..d8bea882f 100644 --- a/drivers/gpu/nvgpu/os/linux/ioctl_ctrl.c +++ b/drivers/gpu/nvgpu/os/linux/ioctl_ctrl.c @@ -256,7 +256,9 @@ static struct nvgpu_flags_mapping flags_mapping[] = { {NVGPU_GPU_FLAGS_SUPPORT_SM_TTU, NVGPU_SUPPORT_SM_TTU}, {NVGPU_GPU_FLAGS_SUPPORT_POST_L2_COMPRESSION, - NVGPU_SUPPORT_POST_L2_COMPRESSION} + NVGPU_SUPPORT_POST_L2_COMPRESSION}, + {NVGPU_GPU_FLAGS_SUPPORT_MAP_ACCESS_TYPE, + NVGPU_SUPPORT_MAP_ACCESS_TYPE} }; static u64 nvgpu_ctrl_ioctl_gpu_characteristics_flags(struct gk20a *g) diff --git a/drivers/gpu/nvgpu/os/linux/module.c b/drivers/gpu/nvgpu/os/linux/module.c index 0b50102df..b1e136259 100644 --- a/drivers/gpu/nvgpu/os/linux/module.c +++ b/drivers/gpu/nvgpu/os/linux/module.c @@ -317,6 +317,7 @@ void gk20a_init_linux_characteristics(struct gk20a *g) nvgpu_set_enabled(g, NVGPU_SUPPORT_PARTIAL_MAPPINGS, true); nvgpu_set_enabled(g, NVGPU_SUPPORT_DETERMINISTIC_OPTS, true); nvgpu_set_enabled(g, NVGPU_SUPPORT_USERSPACE_MANAGED_AS, true); + nvgpu_set_enabled(g, NVGPU_SUPPORT_MAP_ACCESS_TYPE, true); if (!IS_ENABLED(CONFIG_NVGPU_SYNCFD_NONE)) { nvgpu_set_enabled(g, NVGPU_SUPPORT_SYNC_FENCE_FDS, true); diff --git a/include/uapi/linux/nvgpu.h b/include/uapi/linux/nvgpu.h index 16ee496eb..c592dd228 100644 --- a/include/uapi/linux/nvgpu.h +++ b/include/uapi/linux/nvgpu.h @@ -179,6 +179,8 @@ struct nvgpu_gpu_zbc_query_table_args { #define NVGPU_GPU_FLAGS_SUPPORT_SM_TTU (1ULL << 37) /* Compression PLC is enabled */ #define NVGPU_GPU_FLAGS_SUPPORT_POST_L2_COMPRESSION (1ULL << 38) +/** GMMU map access type available */ +#define NVGPU_GPU_FLAGS_SUPPORT_MAP_ACCESS_TYPE (1ULL << 39) /* SM LRF ECC is enabled */ #define NVGPU_GPU_FLAGS_ECC_ENABLED_SM_LRF (1ULL << 60) /* SM SHM ECC is enabled */