From 878182c1d551e6363e64af9a2ec92ac02dd9ece8 Mon Sep 17 00:00:00 2001 From: Sagar Kamble Date: Mon, 15 May 2023 15:51:37 +0530 Subject: [PATCH] gpu: nvgpu: disable nvgpu rpm if genpd support is not available GPU is set to always ON state on safety L4T for SMCU to not fault. However, nvgpu railgating was always enabled. This will lead to improper GPU railgate/unrailgate sequence as bpmp will not powergate/ungate the gpu on suspend and resume requests. Keeping rpm enabled can lead to ACR failure on resume as it expects the GPU to be reset on every resume. Disable nvgpu runtime PM when the power domain node for the gpu is not defined. Bug 4111746 Change-Id: I9215ea87dbfbf53360003cac5f8a51d39982ace9 Signed-off-by: Sagar Kamble Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2904335 (cherry picked from commit c066401be7a03c331cbddfe284404eaa8ba08b26) Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2908071 Reviewed-by: svc-mobile-coverity Reviewed-by: svc-mobile-cert Reviewed-by: Mahantesh Kumbar Reviewed-by: Ankur Kishore GVS: Gerrit_Virtual_Submit --- drivers/gpu/nvgpu/os/linux/driver_common.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/nvgpu/os/linux/driver_common.c b/drivers/gpu/nvgpu/os/linux/driver_common.c index 46bd88f23..5b4d56df7 100644 --- a/drivers/gpu/nvgpu/os/linux/driver_common.c +++ b/drivers/gpu/nvgpu/os/linux/driver_common.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2022, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2016-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, @@ -190,7 +190,8 @@ static void nvgpu_init_timeslice(struct gk20a *g) static void nvgpu_init_pm_vars(struct gk20a *g) { - struct gk20a_platform *platform = dev_get_drvdata(dev_from_gk20a(g)); + struct device *dev = dev_from_gk20a(g); + struct gk20a_platform *platform = dev_get_drvdata(dev); /* * Set up initial power settings. For non-slicon platforms, disable @@ -246,6 +247,17 @@ static void nvgpu_init_pm_vars(struct gk20a *g) /* Always enable railgating on simulation platform */ platform->can_railgate_init = nvgpu_platform_is_simulation(g) ? true : platform->can_railgate_init; + + /* + * Disable railgating if GPU power domain node is not defined + * in the DT as bpmp will not powergate/ungate the GPU on + * suspend/resume and can lead to ACR failure on resume + * as it expects GPU to be reset on every resume. + */ + if (!of_property_read_bool(dev->of_node, "power-domains")) { + platform->can_railgate_init = false; + } + nvgpu_set_enabled(g, NVGPU_CAN_RAILGATE, platform->can_railgate_init); }