From f91495c41d59f5c4a15d651e8a7ab5a87fe90ab4 Mon Sep 17 00:00:00 2001 From: Sagar Kamble Date: Mon, 2 Mar 2020 22:15:41 +0530 Subject: [PATCH] gpu: nvgpu: cond. compile with CONFIG_NV_TEGRA_MC Protect tegra MC code under the config flag CONFIG_NV_TEGRA_MC. Bug 2834141 Change-Id: Ibb883ca69ea26467f095aca22552b1ad20279cd9 Signed-off-by: Sagar Kamble Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2306434 Tested-by: mobile promotions Reviewed-by: automaticguardword Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Terje Bergstrom Reviewed-by: Debarshi Dutta Reviewed-by: Vijayakumar Subbu Reviewed-by: mobile promotions GVS: Gerrit_Virtual_Submit --- drivers/gpu/nvgpu/os/linux/platform_gk20a_tegra.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/gpu/nvgpu/os/linux/platform_gk20a_tegra.c b/drivers/gpu/nvgpu/os/linux/platform_gk20a_tegra.c index dfc933b97..7cc7c7375 100644 --- a/drivers/gpu/nvgpu/os/linux/platform_gk20a_tegra.c +++ b/drivers/gpu/nvgpu/os/linux/platform_gk20a_tegra.c @@ -26,7 +26,11 @@ #include #endif #include + +#ifdef CONFIG_NV_TEGRA_MC #include +#endif /* CONFIG_NV_TEGRA_MC */ + #include #if defined(CONFIG_COMMON_CLK) && defined(CONFIG_TEGRA_DVFS) @@ -322,6 +326,7 @@ static int gm20b_tegra_railgate(struct device *dev) struct gk20a_platform *platform = dev_get_drvdata(dev); int ret = 0; +#ifdef CONFIG_NV_TEGRA_MC #ifdef CONFIG_TEGRA_DVFS if (nvgpu_is_enabled(g, NVGPU_IS_FMODEL) || !tegra_dvfs_is_rail_up(platform->gpu_rail)) @@ -371,6 +376,10 @@ static int gm20b_tegra_railgate(struct device *dev) return 0; +#else + ret = -ENOTSUP; +#endif /* CONFIG_NV_TEGRA_MC */ + err_power_off: nvgpu_err(platform->g, "Could not railgate GPU"); return ret; @@ -453,12 +462,14 @@ static int gm20b_tegra_unrailgate(struct device *dev) platform->reset_deassert(dev); clk_enable(platform->clk_reset); +#ifdef CONFIG_NV_TEGRA_MC /* Flush MC after boot/railgate/SC7 */ tegra_mc_flush(MC_CLIENT_GPU); udelay(10); tegra_mc_flush_done(MC_CLIENT_GPU); +#endif udelay(10);