From d474bd4206b622d0c5e2373f765c9828166f7da8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konsta=20H=C3=B6ltt=C3=A4?= Date: Wed, 1 Dec 2021 18:51:05 +0200 Subject: [PATCH] gpu: nvgpu: advertise NVS capability in gpu chars MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add nvs_ioctl_nr_last in nvgpu_gpu_characteristics. Add a feature flag SUPPORTS_NVS and enable it in Linux builds. Jira NVGPU-6788 Change-Id: I19df78982cca989da7ee053511af59bbb5df1180 Signed-off-by: Konsta Hölttä Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2636409 Reviewed-by: Alex Waterman Reviewed-by: Vijayakumar Subbu Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/include/nvgpu/enabled.h | 1 + drivers/gpu/nvgpu/os/linux/driver_common.c | 2 ++ drivers/gpu/nvgpu/os/linux/ioctl_ctrl.c | 3 +++ include/uapi/linux/nvgpu-ctrl.h | 5 ++++- 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/nvgpu/include/nvgpu/enabled.h b/drivers/gpu/nvgpu/include/nvgpu/enabled.h index 33fcf2377..4362d7d81 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/enabled.h +++ b/drivers/gpu/nvgpu/include/nvgpu/enabled.h @@ -216,6 +216,7 @@ struct gk20a; DEFINE_FLAG(NVGPU_SUPPORT_VAB_ENABLED, "VAB feature supported"), \ DEFINE_FLAG(NVGPU_SUPPORT_ROP_IN_GPC, "ROP is part of GPC"), \ DEFINE_FLAG(NVGPU_SUPPORT_BUFFER_METADATA, "Buffer metadata support"), \ + DEFINE_FLAG(NVGPU_SUPPORT_NVS, "Domain scheduler support"), \ DEFINE_FLAG(NVGPU_MAX_ENABLED_BITS, "Marks max number of flags"), /** diff --git a/drivers/gpu/nvgpu/os/linux/driver_common.c b/drivers/gpu/nvgpu/os/linux/driver_common.c index 022632403..83e672270 100644 --- a/drivers/gpu/nvgpu/os/linux/driver_common.c +++ b/drivers/gpu/nvgpu/os/linux/driver_common.c @@ -129,6 +129,8 @@ static void nvgpu_init_vars(struct gk20a *g) nvgpu_init_list_node(&g->boardobjgrp_head); nvgpu_set_enabled(g, NVGPU_HAS_SYNCPOINTS, platform->has_syncpoints); + + nvgpu_set_enabled(g, NVGPU_SUPPORT_NVS, true); } static void nvgpu_init_max_comptag(struct gk20a *g) diff --git a/drivers/gpu/nvgpu/os/linux/ioctl_ctrl.c b/drivers/gpu/nvgpu/os/linux/ioctl_ctrl.c index 333f56583..e657c352a 100644 --- a/drivers/gpu/nvgpu/os/linux/ioctl_ctrl.c +++ b/drivers/gpu/nvgpu/os/linux/ioctl_ctrl.c @@ -305,6 +305,8 @@ static struct nvgpu_flags_mapping flags_mapping[] = { NVGPU_SUPPORT_VAB_ENABLED}, {NVGPU_GPU_FLAGS_SUPPORT_BUFFER_METADATA, NVGPU_SUPPORT_BUFFER_METADATA}, + {NVGPU_GPU_FLAGS_SUPPORT_NVS, + NVGPU_SUPPORT_NVS}, }; static u64 nvgpu_ctrl_ioctl_gpu_characteristics_flags(struct gk20a *g) @@ -468,6 +470,7 @@ static long gk20a_ctrl_ioctl_gpu_characteristics( gpu.event_ioctl_nr_last = NVGPU_EVENT_IOCTL_LAST; gpu.ctxsw_ioctl_nr_last = NVGPU_CTXSW_IOCTL_LAST; gpu.prof_ioctl_nr_last = NVGPU_PROFILER_IOCTL_LAST; + gpu.nvs_ioctl_nr_last = NVGPU_NVS_IOCTL_LAST; gpu.gpu_va_bit_count = 40; gpu.max_dbg_tsg_timeslice = g->tsg_dbg_timeslice_max_us; diff --git a/include/uapi/linux/nvgpu-ctrl.h b/include/uapi/linux/nvgpu-ctrl.h index 120f03c9c..535cca5fc 100644 --- a/include/uapi/linux/nvgpu-ctrl.h +++ b/include/uapi/linux/nvgpu-ctrl.h @@ -199,6 +199,8 @@ struct nvgpu_gpu_zbc_query_table_args { #define NVGPU_GPU_FLAGS_L2_MAX_WAYS_EVICT_LAST_ENABLED (1ULL << 51) /* Vidmem access bits feature is supported */ #define NVGPU_GPU_FLAGS_SUPPORT_VAB (1ULL << 52) +/* The NVS scheduler interface is usable */ +#define NVGPU_GPU_FLAGS_SUPPORT_NVS (1ULL << 53) /* SM LRF ECC is enabled */ #define NVGPU_GPU_FLAGS_ECC_ENABLED_SM_LRF (1ULL << 60) /* SM SHM ECC is enabled */ @@ -315,7 +317,8 @@ struct nvgpu_gpu_characteristics { __s16 ctxsw_ioctl_nr_last; __s16 prof_ioctl_nr_last; - __u8 reserved2[4]; + __s16 nvs_ioctl_nr_last; + __u8 reserved2[2]; __u32 max_ctxsw_ring_buffer_size; __u32 reserved3;