From 150e1ad3c9f2869e55cdfacf17ef6b1efc0b0b95 Mon Sep 17 00:00:00 2001 From: Sagar Kamble Date: Fri, 26 Apr 2019 14:30:27 +0530 Subject: [PATCH] gpu: nvgpu: add gpu characteristics flag for reduced profile Several of the nvgpu driver capabilities will be disabled in the reduced version. To know the version of the nvgpu driver we introduce a new global characteristic flag NVGPU_DRIVER_REDUCED_PROFILE. JIRA NVGPU-3062 Change-Id: I93c76df1110c24ea0055c77d332fe297d56db65d Signed-off-by: Sagar Kamble Reviewed-on: https://git-master.nvidia.com/r/2108143 Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/common/init/nvgpu_init.c | 3 +++ drivers/gpu/nvgpu/include/nvgpu/enabled.h | 6 +++++- drivers/gpu/nvgpu/os/linux/ioctl_ctrl.c | 2 ++ include/uapi/linux/nvgpu.h | 2 ++ 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/nvgpu/common/init/nvgpu_init.c b/drivers/gpu/nvgpu/common/init/nvgpu_init.c index dee1b7000..739216079 100644 --- a/drivers/gpu/nvgpu/common/init/nvgpu_init.c +++ b/drivers/gpu/nvgpu/common/init/nvgpu_init.c @@ -528,6 +528,9 @@ int gk20a_wait_for_idle(struct gk20a *g) void gk20a_init_gpu_characteristics(struct gk20a *g) { +#ifdef NVGPU_REDUCED + nvgpu_set_enabled(g, NVGPU_DRIVER_REDUCED_PROFILE, true); +#endif nvgpu_set_enabled(g, NVGPU_SUPPORT_MAP_DIRECT_KIND_CTRL, true); nvgpu_set_enabled(g, NVGPU_SUPPORT_MAP_BUFFER_BATCH, true); nvgpu_set_enabled(g, NVGPU_SUPPORT_SPARSE_ALLOCS, true); diff --git a/drivers/gpu/nvgpu/include/nvgpu/enabled.h b/drivers/gpu/nvgpu/include/nvgpu/enabled.h index fa2a65584..82c39513d 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/enabled.h +++ b/drivers/gpu/nvgpu/include/nvgpu/enabled.h @@ -196,10 +196,14 @@ struct gk20a; /* PMU Super surface */ #define NVGPU_SUPPORT_PMU_SUPER_SURFACE 76 + +/* Reduced profile of nvgpu driver */ +#define NVGPU_DRIVER_REDUCED_PROFILE 77 + /* * Must be greater than the largest bit offset in the above list. */ -#define NVGPU_MAX_ENABLED_BITS 77U +#define NVGPU_MAX_ENABLED_BITS 78U /** * nvgpu_is_enabled - 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 036f4a932..46658b2da 100644 --- a/drivers/gpu/nvgpu/os/linux/ioctl_ctrl.c +++ b/drivers/gpu/nvgpu/os/linux/ioctl_ctrl.c @@ -234,6 +234,8 @@ static struct nvgpu_flags_mapping flags_mapping[] = { NVGPU_SUPPORT_SCG}, {NVGPU_GPU_FLAGS_SUPPORT_VPR, NVGPU_SUPPORT_VPR}, + {NVGPU_GPU_FLAGS_DRIVER_REDUCED_PROFILE, + NVGPU_DRIVER_REDUCED_PROFILE}, }; static u64 nvgpu_ctrl_ioctl_gpu_characteristics_flags(struct gk20a *g) diff --git a/include/uapi/linux/nvgpu.h b/include/uapi/linux/nvgpu.h index 4bfda8ef1..45e8ae79e 100644 --- a/include/uapi/linux/nvgpu.h +++ b/include/uapi/linux/nvgpu.h @@ -166,6 +166,8 @@ struct nvgpu_gpu_zbc_query_table_args { #define NVGPU_GPU_FLAGS_CAN_RAILGATE (1ULL << 29) /* Usermode submit is available */ #define NVGPU_GPU_FLAGS_SUPPORT_USERMODE_SUBMIT (1ULL << 30) +/* Reduced profile is enabled */ +#define NVGPU_GPU_FLAGS_DRIVER_REDUCED_PROFILE (1ULL << 31) /* SM LRF ECC is enabled */ #define NVGPU_GPU_FLAGS_ECC_ENABLED_SM_LRF (1ULL << 60) /* SM SHM ECC is enabled */