diff --git a/drivers/gpu/nvgpu/os/linux/platform_gk20a_tegra.c b/drivers/gpu/nvgpu/os/linux/platform_gk20a_tegra.c index 0977e63ae..c39e4f0e6 100644 --- a/drivers/gpu/nvgpu/os/linux/platform_gk20a_tegra.c +++ b/drivers/gpu/nvgpu/os/linux/platform_gk20a_tegra.c @@ -799,6 +799,7 @@ static int gk20a_tegra_probe(struct device *dev) if (joint_xpu_rail) { nvgpu_log_info(g, "XPU rails are joint\n"); + platform->can_railgate_init = false; __nvgpu_set_enabled(g, NVGPU_CAN_RAILGATE, false); } diff --git a/drivers/gpu/nvgpu/os/linux/platform_gp10b_tegra.c b/drivers/gpu/nvgpu/os/linux/platform_gp10b_tegra.c index c5527f2d7..9bf8d637c 100644 --- a/drivers/gpu/nvgpu/os/linux/platform_gp10b_tegra.c +++ b/drivers/gpu/nvgpu/os/linux/platform_gp10b_tegra.c @@ -141,6 +141,8 @@ static void gp10b_tegra_scale_exit(struct device *dev) static int gp10b_tegra_probe(struct device *dev) { struct gk20a_platform *platform = dev_get_drvdata(dev); + bool joint_xpu_rail = false; + struct gk20a *g = platform->g; #ifdef CONFIG_TEGRA_GK20A_NVHOST int ret; @@ -163,6 +165,17 @@ static int gp10b_tegra_probe(struct device *dev) platform->g->gr.ctx_vars.force_preemption_gfxp = false; platform->g->gr.ctx_vars.force_preemption_cilp = false; +#ifdef CONFIG_OF + joint_xpu_rail = of_property_read_bool(of_chosen, + "nvidia,tegra-joint_xpu_rail"); +#endif + + if (joint_xpu_rail) { + nvgpu_log_info(g, "XPU rails are joint\n"); + platform->can_railgate_init = false; + __nvgpu_set_enabled(g, NVGPU_CAN_RAILGATE, false); + } + gp10b_tegra_get_clocks(dev); nvgpu_linux_init_clk_support(platform->g); diff --git a/drivers/gpu/nvgpu/os/linux/platform_gv11b_tegra.c b/drivers/gpu/nvgpu/os/linux/platform_gv11b_tegra.c index ac1958a25..6c9d0f5cd 100644 --- a/drivers/gpu/nvgpu/os/linux/platform_gv11b_tegra.c +++ b/drivers/gpu/nvgpu/os/linux/platform_gv11b_tegra.c @@ -73,6 +73,8 @@ static int gv11b_tegra_probe(struct device *dev) { struct gk20a_platform *platform = dev_get_drvdata(dev); int err; + bool joint_xpu_rail = false; + struct gk20a *g = platform->g; err = nvgpu_nvhost_syncpt_init(platform->g); if (err) { @@ -94,6 +96,17 @@ static int gv11b_tegra_probe(struct device *dev) platform->g->gr.ctx_vars.force_preemption_gfxp = false; platform->g->gr.ctx_vars.force_preemption_cilp = false; +#ifdef CONFIG_OF + joint_xpu_rail = of_property_read_bool(of_chosen, + "nvidia,tegra-joint_xpu_rail"); +#endif + + if (joint_xpu_rail) { + nvgpu_log_info(g, "XPU rails are joint\n"); + platform->can_railgate_init = false; + __nvgpu_set_enabled(g, NVGPU_CAN_RAILGATE, false); + } + gp10b_tegra_get_clocks(dev); nvgpu_linux_init_clk_support(platform->g); diff --git a/drivers/gpu/nvgpu/os/linux/sysfs.c b/drivers/gpu/nvgpu/os/linux/sysfs.c index 2ab296498..84a311de3 100644 --- a/drivers/gpu/nvgpu/os/linux/sysfs.c +++ b/drivers/gpu/nvgpu/os/linux/sysfs.c @@ -259,13 +259,19 @@ static ssize_t railgate_enable_store(struct device *dev, unsigned long railgate_enable = 0; /* dev is guaranteed to be valid here. Ok to de-reference */ struct gk20a *g = get_gk20a(dev); + struct gk20a_platform *platform = dev_get_drvdata(dev); bool enabled = nvgpu_is_enabled(g, NVGPU_CAN_RAILGATE); int err; if (kstrtoul(buf, 10, &railgate_enable) < 0) return -EINVAL; - if (railgate_enable && !enabled) { + if (!platform->can_railgate_init) { + nvgpu_err(g, "Railgating is not supported"); + return -EINVAL; + } + + if (railgate_enable) { __nvgpu_set_enabled(g, NVGPU_CAN_RAILGATE, true); pm_runtime_set_autosuspend_delay(dev, g->railgate_delay); } else if (railgate_enable == 0 && enabled) {