From 67a68771d468bdec5f093d26d1cc4089eecc8e03 Mon Sep 17 00:00:00 2001 From: Deepak Nibade Date: Mon, 2 Nov 2020 10:54:42 +0530 Subject: [PATCH] gpu: nvgpu: skip physical instance dev nodes On Linux, nvrm_gpu can open channel/tsg/address space only using ctrl node. This tricks nvrm_gpu into considering physical instance as actual available fGPU if ctrl node is exposed for physical instance. There is no current requirement to expose physical instance ctrl node. It might be needed later for profiling use cases. For now, skip dev node creation for physical instance. Jira NVGPU-5648 Change-Id: I23398ba993f97e2d2f344876c0c6b0c82b336402 Signed-off-by: Deepak Nibade Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2439880 Reviewed-by: automaticguardword Reviewed-by: Lakshmanan M Reviewed-by: mobile promotions Tested-by: mobile promotions GVS: Gerrit_Virtual_Submit --- drivers/gpu/nvgpu/os/linux/ioctl.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/gpu/nvgpu/os/linux/ioctl.c b/drivers/gpu/nvgpu/os/linux/ioctl.c index a123b38b7..a5f63f7bb 100644 --- a/drivers/gpu/nvgpu/os/linux/ioctl.c +++ b/drivers/gpu/nvgpu/os/linux/ioctl.c @@ -495,6 +495,17 @@ static bool check_valid_dev_node(struct gk20a *g, struct nvgpu_class *class, return true; } +static bool check_valid_class(struct gk20a *g, struct nvgpu_class *class) +{ + if (nvgpu_is_enabled(g, NVGPU_SUPPORT_MIG)) { + if (class->instance_type == NVGPU_MIG_TYPE_PHYSICAL) { + return false; + } + } + + return true; +} + int gk20a_user_init(struct device *dev) { int err; @@ -526,6 +537,10 @@ int gk20a_user_init(struct device *dev) l->cdev_region = devno; nvgpu_list_for_each_entry(class, &l->class_list_head, nvgpu_class, list_entry) { + if (!check_valid_class(g, class)) { + continue; + } + for (cdev_index = 0; cdev_index < num_cdevs; cdev_index++) { if (!check_valid_dev_node(g, class, &dev_node_list[cdev_index])) { continue;