summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDebarshi Dutta <ddutta@nvidia.com>2019-08-28 02:39:25 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2019-09-04 15:02:38 -0400
commit1d532589b0a8815b4c4f33b8527fae4b3a5b4bbe (patch)
tree5faa5da30095689383254c4e40350cecbf9ac79b
parentd601ff515902b4840109742f5f2ac8881058405c (diff)
gpu: nvgpu: Add support for XPU rail split
Check if CPU/GPU rails are joint, disable railgating if they are. Add the DT support for T194 and T186 platforms. Disable railgate_enable sysfs node update in the above condition. Bug 200546450 Bug 200545711 Change-Id: I002488f6418805569b0ef0fc3032b58297adeafb Signed-off-by: Debarshi Dutta <ddutta@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/2185221 Reviewed-by: Rajkumar Kasirajan <rkasirajan@nvidia.com> Tested-by: Rajkumar Kasirajan <rkasirajan@nvidia.com> GVS: Gerrit_Virtual_Submit Reviewed-by: Thomas Fleury <tfleury@nvidia.com> Reviewed-by: Alex Waterman <alexw@nvidia.com> Reviewed-by: Bibek Basu <bbasu@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
-rw-r--r--drivers/gpu/nvgpu/os/linux/platform_gk20a_tegra.c1
-rw-r--r--drivers/gpu/nvgpu/os/linux/platform_gp10b_tegra.c13
-rw-r--r--drivers/gpu/nvgpu/os/linux/platform_gv11b_tegra.c13
-rw-r--r--drivers/gpu/nvgpu/os/linux/sysfs.c8
4 files changed, 34 insertions, 1 deletions
diff --git a/drivers/gpu/nvgpu/os/linux/platform_gk20a_tegra.c b/drivers/gpu/nvgpu/os/linux/platform_gk20a_tegra.c
index 0977e63a..c39e4f0e 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)
799 799
800 if (joint_xpu_rail) { 800 if (joint_xpu_rail) {
801 nvgpu_log_info(g, "XPU rails are joint\n"); 801 nvgpu_log_info(g, "XPU rails are joint\n");
802 platform->can_railgate_init = false;
802 __nvgpu_set_enabled(g, NVGPU_CAN_RAILGATE, false); 803 __nvgpu_set_enabled(g, NVGPU_CAN_RAILGATE, false);
803 } 804 }
804 805
diff --git a/drivers/gpu/nvgpu/os/linux/platform_gp10b_tegra.c b/drivers/gpu/nvgpu/os/linux/platform_gp10b_tegra.c
index c5527f2d..9bf8d637 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)
141static int gp10b_tegra_probe(struct device *dev) 141static int gp10b_tegra_probe(struct device *dev)
142{ 142{
143 struct gk20a_platform *platform = dev_get_drvdata(dev); 143 struct gk20a_platform *platform = dev_get_drvdata(dev);
144 bool joint_xpu_rail = false;
145 struct gk20a *g = platform->g;
144#ifdef CONFIG_TEGRA_GK20A_NVHOST 146#ifdef CONFIG_TEGRA_GK20A_NVHOST
145 int ret; 147 int ret;
146 148
@@ -163,6 +165,17 @@ static int gp10b_tegra_probe(struct device *dev)
163 platform->g->gr.ctx_vars.force_preemption_gfxp = false; 165 platform->g->gr.ctx_vars.force_preemption_gfxp = false;
164 platform->g->gr.ctx_vars.force_preemption_cilp = false; 166 platform->g->gr.ctx_vars.force_preemption_cilp = false;
165 167
168#ifdef CONFIG_OF
169 joint_xpu_rail = of_property_read_bool(of_chosen,
170 "nvidia,tegra-joint_xpu_rail");
171#endif
172
173 if (joint_xpu_rail) {
174 nvgpu_log_info(g, "XPU rails are joint\n");
175 platform->can_railgate_init = false;
176 __nvgpu_set_enabled(g, NVGPU_CAN_RAILGATE, false);
177 }
178
166 gp10b_tegra_get_clocks(dev); 179 gp10b_tegra_get_clocks(dev);
167 nvgpu_linux_init_clk_support(platform->g); 180 nvgpu_linux_init_clk_support(platform->g);
168 181
diff --git a/drivers/gpu/nvgpu/os/linux/platform_gv11b_tegra.c b/drivers/gpu/nvgpu/os/linux/platform_gv11b_tegra.c
index ac1958a2..6c9d0f5c 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)
73{ 73{
74 struct gk20a_platform *platform = dev_get_drvdata(dev); 74 struct gk20a_platform *platform = dev_get_drvdata(dev);
75 int err; 75 int err;
76 bool joint_xpu_rail = false;
77 struct gk20a *g = platform->g;
76 78
77 err = nvgpu_nvhost_syncpt_init(platform->g); 79 err = nvgpu_nvhost_syncpt_init(platform->g);
78 if (err) { 80 if (err) {
@@ -94,6 +96,17 @@ static int gv11b_tegra_probe(struct device *dev)
94 platform->g->gr.ctx_vars.force_preemption_gfxp = false; 96 platform->g->gr.ctx_vars.force_preemption_gfxp = false;
95 platform->g->gr.ctx_vars.force_preemption_cilp = false; 97 platform->g->gr.ctx_vars.force_preemption_cilp = false;
96 98
99#ifdef CONFIG_OF
100 joint_xpu_rail = of_property_read_bool(of_chosen,
101 "nvidia,tegra-joint_xpu_rail");
102#endif
103
104 if (joint_xpu_rail) {
105 nvgpu_log_info(g, "XPU rails are joint\n");
106 platform->can_railgate_init = false;
107 __nvgpu_set_enabled(g, NVGPU_CAN_RAILGATE, false);
108 }
109
97 gp10b_tegra_get_clocks(dev); 110 gp10b_tegra_get_clocks(dev);
98 nvgpu_linux_init_clk_support(platform->g); 111 nvgpu_linux_init_clk_support(platform->g);
99 112
diff --git a/drivers/gpu/nvgpu/os/linux/sysfs.c b/drivers/gpu/nvgpu/os/linux/sysfs.c
index 2ab29649..84a311de 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,
259 unsigned long railgate_enable = 0; 259 unsigned long railgate_enable = 0;
260 /* dev is guaranteed to be valid here. Ok to de-reference */ 260 /* dev is guaranteed to be valid here. Ok to de-reference */
261 struct gk20a *g = get_gk20a(dev); 261 struct gk20a *g = get_gk20a(dev);
262 struct gk20a_platform *platform = dev_get_drvdata(dev);
262 bool enabled = nvgpu_is_enabled(g, NVGPU_CAN_RAILGATE); 263 bool enabled = nvgpu_is_enabled(g, NVGPU_CAN_RAILGATE);
263 int err; 264 int err;
264 265
265 if (kstrtoul(buf, 10, &railgate_enable) < 0) 266 if (kstrtoul(buf, 10, &railgate_enable) < 0)
266 return -EINVAL; 267 return -EINVAL;
267 268
268 if (railgate_enable && !enabled) { 269 if (!platform->can_railgate_init) {
270 nvgpu_err(g, "Railgating is not supported");
271 return -EINVAL;
272 }
273
274 if (railgate_enable) {
269 __nvgpu_set_enabled(g, NVGPU_CAN_RAILGATE, true); 275 __nvgpu_set_enabled(g, NVGPU_CAN_RAILGATE, true);
270 pm_runtime_set_autosuspend_delay(dev, g->railgate_delay); 276 pm_runtime_set_autosuspend_delay(dev, g->railgate_delay);
271 } else if (railgate_enable == 0 && enabled) { 277 } else if (railgate_enable == 0 && enabled) {