From a4145c7b6e05af9b5ee4b8da246e3b3820023dca Mon Sep 17 00:00:00 2001 From: Dinesh T Date: Thu, 28 Aug 2025 18:47:46 +0000 Subject: [PATCH] gpu: nvgpu: Device nodes creation as default This is creating GPU nodes by default. If MIG enabled after probe then delete and recreate the device nodes. Bug 5084299 Change-Id: I9ce33e148ec13f29735db9d778f666dc02b64e66 Signed-off-by: Dinesh T Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/3442428 (cherry picked from commit 5c59e4d3d5a7df6f49668995b62d7f67f57f0cc6) Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/3456076 Reviewed-by: Brad Griffis Tested-by: Jon Hunter GVS: buildbot_gerritrpt Reviewed-by: Jon Hunter Reviewed-by: svcacv --- drivers/gpu/nvgpu/os/linux/driver_common.c | 31 ++++--------------- drivers/gpu/nvgpu/os/linux/module.c | 6 ++-- drivers/gpu/nvgpu/os/linux/vgpu/vgpu_common.c | 23 +++++--------- 3 files changed, 17 insertions(+), 43 deletions(-) diff --git a/drivers/gpu/nvgpu/os/linux/driver_common.c b/drivers/gpu/nvgpu/os/linux/driver_common.c index e5ff525ec..97d5d9743 100644 --- a/drivers/gpu/nvgpu/os/linux/driver_common.c +++ b/drivers/gpu/nvgpu/os/linux/driver_common.c @@ -1,18 +1,5 @@ -/* - * Copyright (c) 2016-2024, NVIDIA CORPORATION. All rights reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ +// SPDX-License-Identifier: GPL-2.0-only +// SPDX-FileCopyrightText: Copyright (c) 2016-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. #include #include @@ -507,16 +494,10 @@ int nvgpu_probe(struct gk20a *g, */ nvgpu_read_support_gpu_tools(g); - /* - * TODO: While removing the legacy nodes the following condition - * need to be removed. - */ - if (platform->platform_chip_id == TEGRA_210) { - err = gk20a_user_nodes_init(dev); - if (err) - return err; - l->dev_nodes_created = true; - } + err = gk20a_user_nodes_init(dev); + if (err) + return err; + l->dev_nodes_created = true; /* * Note that for runtime suspend to work the clocks have to be setup diff --git a/drivers/gpu/nvgpu/os/linux/module.c b/drivers/gpu/nvgpu/os/linux/module.c index 7522c01e7..b132884bc 100644 --- a/drivers/gpu/nvgpu/os/linux/module.c +++ b/drivers/gpu/nvgpu/os/linux/module.c @@ -1,5 +1,5 @@ // SPDX-License-Identifier: GPL-2.0-only -// SPDX-FileCopyrightText: Copyright (c) 2011-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// SPDX-FileCopyrightText: Copyright (c) 2011-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. /* * GK20A Graphics @@ -495,7 +495,9 @@ int gk20a_pm_finalize_poweron(struct device *dev) goto done; } - if (!l->dev_nodes_created) { + if ((!l->dev_nodes_created) || + (nvgpu_grmgr_is_multi_gr_enabled(g))) { + gk20a_user_nodes_deinit(dev); err = gk20a_user_nodes_init(dev); if (err) { goto done; diff --git a/drivers/gpu/nvgpu/os/linux/vgpu/vgpu_common.c b/drivers/gpu/nvgpu/os/linux/vgpu/vgpu_common.c index 5eab11468..9204f5ba2 100644 --- a/drivers/gpu/nvgpu/os/linux/vgpu/vgpu_common.c +++ b/drivers/gpu/nvgpu/os/linux/vgpu/vgpu_common.c @@ -1,19 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0-only +// SPDX-FileCopyrightText: Copyright (c) 2023-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + /* * Linux common code for legacy VGPU and VF - * - * Copyright (c) 2023, NVIDIA CORPORATION. All rights reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . */ #include @@ -27,7 +16,7 @@ #include #include #include - +#include #include "vgpu_linux.h" #include "common/vgpu/ivc/comm_vgpu.h" #include "common/vgpu/init/init_vgpu.h" @@ -167,7 +156,9 @@ int vgpu_pm_finalize_poweron(struct device *dev) if (err) goto done; - if (!l->dev_nodes_created) { + if ((!l->dev_nodes_created) || + (nvgpu_grmgr_is_multi_gr_enabled(g))) { + gk20a_user_nodes_deinit(dev); err = gk20a_user_nodes_init(dev); if (err) { goto done;